Snippet tag was introduced in java18 and some of the scenarios covered in the ASTConverterJavadocTest_18. The remaining scenarios are following.
- Empty Body
- Single Element
{@snippet :
int a = 10;
}
- Multi-line plain code
{@snippet :
int a = 1;
int b = 2;
}
- Blank line inside body
{@snippet :
int a = 1;
int b = 2;
}
- Multiple attribute
{@snippet id="x1" lang=java region="main" :
int a;
}
- Single quote attributes
{@snippet id='demo' lang='java' :
int a;
}
- Nested blocks
{@snippet :
if (a) {
while (b) {
foo();
}
}
}
- {@code} inside snippet (here code tag will treat as plain text)
{@snippet :
{@code int a = 0;}
}
- Replace tag
{@snippet :
System.out.println("abc"); // @replace substring="abc" replacement="xyz"
}
- Link tag
{@snippet :
System.out.println("abc"); //@link substring="System" target="System"
}
Snippet tag was introduced in java18 and some of the scenarios covered in the ASTConverterJavadocTest_18. The remaining scenarios are following.