JAVA_REMOVE_ANNOTATIONS(7)
π java_remove_annotations(7) π
okay bestie, buckle up β this is the manual page for java_remove_annotations, living under the Java packaging support umbrella. It's a macro that does a little spring cleaning on your Java source files, and honestly? It ate. β¨
πΈ NAME πΈ
java_remove_annotations β remove imports and annotations from Java source files π§Ήπ
β¨ SYNOPSIS β¨
%java_remove_annotations [optional flags] <matcher>... [file path]...
matchers go in, file paths go in, chaos gets removed. Simple as.
π¦ DESCRIPTION π¦
So like. This macro removes import statements and usage of annotations from Java source files. It's giving "I contain multitudes." π
It does the exact same thing as java_remove_imports, and on top of that it finds all uses of annotations and matches the content between the '@' symbol and either ending with whitespace or with an opening parenthesis '(' β that's the annotation arguments, btw. iykyk. π
In case of match, the script also removes the block of parentheses that follows the matched annotation, if it is present. Not me deleting the whole little argument party along with the annotation π
Now, file path arguments are handled the following way:
- Symlinks are ignored. π we do not see her, she is not here
- Regular files are handled regardless of the file name. no name-shaming in this house
- Directories are traversed recursively and all
.javafiles are handled. we go deep π³οΈβ¨
Arguments can be specified in arbitrary order. The vibes are unordered, the behavior is not.
π Matcher is one of:
-n <name>β simple class name to be matched against the simple names of imported symbols. Names are matched for exact equality. Can be specified multiple times. (yes bestie, stack them up π«Ά)-p <pattern>β regex patterns to be matched against imported symbols. Each imported symbol found in the code is matched against each pattern. Can be specified multiple times.
π Optional flags:
-s,--strictβ fail if any of the user provided arguments were redundant. she is not here for your extra unused args, she will call it out π€
π EXAMPLES π
Example of usage in a .spec file:
%java_remove_annotations src -n Nullable
β Examples of patterns:
- Annotations present in Java source file:
1) @SuppressWarnings
2) @SuppressFBWarnings(value = {"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
3) @org.junit.Test
4) @org.junit.jupiter.api.Test
- Names used to match:
Name 'SuppressWarnings' matches 1)
Name 'Test' matches 3), 4).
Name 'junit' does not match anything.
- Patterns used to match:
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.
see how 'junit' eats as a pattern but flops as a name? the way that regex and exact-equality are simply built different ππ
π REPORTING BUGS π
Bugs should be reported through the issue tracker at GitHub: https://github.com/fedora-java/jurand/issues
found a bug? bestie, do NOT gatekeep it. drop it in the tracker, we're all ears ππ
π§ AUTHOR π§
Written by MariΓ‘n KonΔek. π
π₯ SEE ALSO π₯
and that's the whole page, no cap β this was JAVA_REMOVE_ANNOTATIONS(7) from Java packaging support, dated 2025-07-24. go forth and de-annotate, bestie. slay π
β¨π¦
π¦ where this page comes from
- fedora 43: jurand 1.3.5-2.fc43 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms