1JAVA_REMOVE_ANNOTATI(7)             Jurand             JAVA_REMOVE_ANNOTATI(7)
2
3
4

NAME

6       java_remove_annotations - remove imports and annotations from Java
7       source files
8

SYNOPSIS

10       %java_remove_annotations [optional flags] <matcher>... [file path]...
11

DESCRIPTION

13       This macro removes import statements as well as usage of annotations
14       from Java source files. The does the same as java_remove_imports and on
15       top of that finds all uses of annotations and matches the content
16       between the @ symbol and either ending with whitespace or with an
17       opening parethesis (.
18
19       In case of match, the script also removes the block of paretheses that
20       follows the matched annotation, if it is present.
21
22       File path arguments are handled the following way:
23
24       •   Symlinks are ignored
25
26       •   Regular files are handled regardless of the file name
27
28       •   Directories are traversed recursively and all .java files are
29           handled
30
31       Arguments can be specified in arbitrary order.
32
33       Matcher is one of:
34
35       -n <name>
36           Simple class name to be matched against the simple names of
37           imported symbols. Names are matched for exact equality. Can be
38           specified multiple times.
39
40       -p <pattern>
41           Regex patterns to be matched against imported symbols. Each
42           imported symbol found in the code is matched against each pattern.
43           Can be specified multiple times.
44
45       Optional flags:
46
47       -s, --strict
48           Fail if any of the user provided arguments were redundant.
49

EXAMPLES

51       Example of usage:
52
53       %java_remove_annotations src -n Nullable
54
55       Examples of patterns:
56
57       •   Annotations present in Java source file:
58
59               1) @SuppressWarnings
60               2) @SuppressFBWarnings(value = {"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
61               3) @org.junit.Test
62               4) @org.junit.jupiter.api.Test
63
64       •   Names used to match:
65
66               Name 'SuppressWarnings' matches 1)
67               Name 'Test' matches 3), 4).
68
69               Name 'junit' does not match anything.
70
71       •   Patterns used to match:
72
73               Pattern 'SuppressWarnings' matches 1).
74               Pattern 'Suppress' matches 1), 2).
75               Pattern 'org[.]junit[.]Test' matches 3).
76               Pattern 'junit' matches 3), 4).
77
78               Pattern '@SuppressWarnings' does not match anything.
79               Pattern 'EI_EXPOSE_REP' does not match anything.
80

AUTHOR

82       Written by Marián Konček.
83

REPORTING BUGS

85       Bugs should be reported through the issue tracker at GitHub:
86       https://github.com/fedora-java/jurand/issues.
87

SEE ALSO

89       java_remove_imports(7).
90
91
92
93JURAND                            07/20/2023           JAVA_REMOVE_ANNOTATI(7)
Impressum