1JAVA_REMOVE_IMPORTS(7)        Java Packages Tools       JAVA_REMOVE_IMPORTS(7)
2
3
4

NAME

6       java_remove_imports - remove import statements from Java source files
7

SYNOPSIS

9       %java_remove_imports [list of file paths]... [-n <list of class
10       names>...] [-p <list of patterns>...]
11

DESCRIPTION

13       This macro removes import statements from Java source files. The script
14       matches all non-whitespace content following the import [static]
15       statement against all patterns listed after the -p flag and all simple
16       class names against names listed after the -n flag.
17
18       If the file path is a directory, recursively finds all Java source
19       files inside. If not specified, runs in the current working directory.
20
21       -n
22           List of simple class names to be matched against the simple names
23           of imported symbols. Names are matched for exact equality.
24
25       -p
26           List of patterns to be matched against imported symbols. The script
27           uses the string.find function from Lua to match each imported
28           symbol against every pattern.
29

EXAMPLES

31       Example of usage:
32
33       %java_remove_imports -n Nullable
34
35       Examples of patterns:
36
37       •   Import statements present in Java source file:
38
39               1) import java.lang.Runnable;
40               2) import java.util.List;
41               3) import static java.util.*;
42               4) import static java.lang.String.valueOf;
43               5) import com.google.common.util.concurrent.Service;
44
45       •   Names used to match:
46
47               Name 'Runnable' matches 1)
48
49               Name 'util' does not match anything.
50               Name '*' does not match anything.
51               Name 'valueOf' does not match anything.
52
53       •   Patterns used to match:
54
55               Pattern 'Runnable' matches 1).
56               Pattern '[*]' matches 3).
57               Pattern 'java[.]util' matches 2), 3).
58               Pattern 'util' matches 2), 3), 5).
59               Patterns 'java', 'java.*' match 1) - 4).
60
61               Pattern 'static' does not match anything.
62

AUTHOR

64       Written by Marián Konček.
65

REPORTING BUGS

67       Bugs should be reported through Java Packages Tools issue tracker at
68       Github: https://github.com/fedora-java/javapackages/issues.
69

SEE ALSO

71       java_remove_annotations(7).
72
73
74
75JAVAPACKAGES                      07/21/2022            JAVA_REMOVE_IMPORTS(7)
Impressum