java_remove_imports - Man Page

remove import statements from Java source files


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


This macro removes import statements from Java source files. The script matches all non-whitespace content following the import [static] statement against all patterns listed after the -p flag and all simple class names against names listed after the -n flag.

If the file path is a directory, recursively finds all Java source files inside. If not specified, runs in the current working directory.


List of simple class names to be matched against the simple names of imported symbols. Names are matched for exact equality.


List of patterns to be matched against imported symbols. The script uses the string.find function from Lua to match each imported symbol against every pattern.


Example of usage:

%java_remove_imports -n Nullable

Examples of patterns:


Written by Marián Konček.

Reporting Bugs

Bugs should be reported through Java Packages Tools issue tracker at Github:

See Also


Referenced By


08/19/2022 JAVAPACKAGES Java Packages Tools