table of contents
JAVA_REMOVE_ANNOTATIONS(7) | Jurand | JAVA_REMOVE_ANNOTATIONS(7) |
NAME¶
java_remove_annotations - remove imports and annotations from Java source files
SYNOPSIS¶
%java_remove_annotations [optional flags] <matcher>... [file path]...
DESCRIPTION¶
This macro removes import statements as well as usage of annotations from Java source files. The does the same as java_remove_imports and on top of that finds all uses of annotations and matches the content between the '@' symbol and either ending with whitespace or with an opening parethesis '(' (the annotation arguments).
In case of match, the script also removes the block of paretheses that follows the matched annotation, if it is present.
File path arguments are handled the following way:
Arguments can be specified in arbitrary order.
Matcher is one of:
-n <name>
-p <pattern>
Optional flags:
-s, --strict
EXAMPLES¶
Example of usage in a .spec file:
%java_remove_annotations src -n Nullable
Examples of patterns:
1) @SuppressWarnings 2) @SuppressFBWarnings(value = {"EI_EXPOSE_REP", "EI_EXPOSE_REP2"}) 3) @org.junit.Test 4) @org.junit.jupiter.api.Test
Name 'SuppressWarnings' matches 1) Name 'Test' matches 3), 4).
Name 'junit' does not match anything.
Pattern 'SuppressWarnings' matches 1). Pattern 'Suppress' matches 1), 2). Pattern 'org[.]junit[.]Test' matches 3). Pattern 'junit' matches 3), 4).
Pattern '@SuppressWarnings' does not match anything. Pattern 'EI_EXPOSE_REP' does not match anything.
REPORTING BUGS¶
Bugs should be reported through the issue tracker at GitHub: <https://github.com/fedora-java/jurand/issues>.
AUTHOR¶
Written by Marián Konček.
SEE ALSO¶
2024-04-10 | JURAND |