ecj(1) | General Commands Manual | ecj(1) |
ecj - the eclipse JDT Batch Compiler
ecj [OPTION]... [SOURCEFILE]... ...
ecj is the batch compiler from Eclipse and is available as ecj.jar. Since 3.3, this jar also contains the support for jsr199 (Compiler API) and the support for jsr269 (Annotation processing). In order to use the annotations processing support, a 1.6 VM is required.
Here is a summary of all the options, grouped by type. Explanations are in the OPTIONS section.
Module Options
--add-exports --add-modules --add-reads --limit-modules -p|--module-path --module-source-path --processor-module-path --system
ClassPath Options
-bootclasspath -cp|-classpath -extdirs -endorseddirs -sourcepath -d -encoding
Compliance Options
-target -1.3 -1.4 -1.5 -1.6 -1.7 -1.8 1.9 -source --release
Warning Options
-?:warn -help:warn -warn:... -nowarn -err:... -deprecation -properties
Debug Options
-g -preserveAllLocals -parameters
Annotation Processing Options
-Akey[=value] -proc:[only|none] -processor -processorpath -s -XprintProcessorInfo -XprintRounds -classNames
Ignored Options (for compatibility with javac options)
-J -X -O
Advanced Options
@<file> -maxProblems -log -Xemacs -proceedOnError -verbose -referenceInfo -progress -time -noExit -repeat -inlineJSR -enableJavaDoc -missingNullDefault
Helping Options
-? -help -v -version -showversion
Module Options (Supported from 9 onwards)
ClassPath Options
For example: ... -encoding UTF-8 X.java[Cp1252]
Y.java[UTF-16] Z.java ....
All source files will be read using UTF-8 encoding (this includes Z.java).
X.java will be read using Cp1252 encoding and Y.java will be read using
UTF-16 encoding.
... -encoding UTF-8 -encoding UTF-16 ....
All source files will be read using UTF-16 encoding. The -encoding option
for UTF-8 is ignored.
... -encoding Cp1252 /foo/bar/X.java[UTF-16]
/foo/bar[UTF-8] ....
All source files will be read using Cp1252 encoding. X.java is the only
file inside the /foo/bar directory to be read using the encoding UTF-16.
All other files in that directory will use UTF-8 encoding.
Compliance Options
Defaults are:
1.1 in -1.3 mode
1.2 in -1.4 mode
1.5 in -1.5 mode
1.6 in -1.6 mode
1.7 in -1.7 mode
1.8 in -1.8 mode
1.9 in -1.9 mode clcd1.1 can be used to generate the StackMap
attribute.
Defaults are:
1.3 in -1.3 mode
1.3 in -1.4 mode
1.5 in -1.5 mode
1.6 in -1.6 mode
1.7 in -1.7 mode
1.8 in -1.8 mode
1.9 in -1.9 mode
In 1.4, assert is treated as a keyword. In 1.5 and 1.6, enum and assert
are treated as keywords.
Warning Options
Examples:
warn:unusedLocal,deprecation
enables only the given two warning options and disables all the other
options
warn:-unusedLocal,deprecation,+fallthrough
disables unusedLocal and deprecation, enables fallthrough, and leaves the
other warning options untouched
The first column below shows the default state for an option. A mark "+/-" indicates that an option covers several fine grained warning variants, some of which are enabled by default, others disabled. This means that specifying the given option with "+" will enable more warnings than the default, and specifying "-" disables some that are enabled by default.
+/- allDeadCode dead code including trivial if (DEBUG) check
+/- allDeprecation deprecation even inside deprecated code
- allJavadoc invalid or missing Javadoc
- allOver-ann all missing @Override annotations (superclass and superinterfaces)
- all-static-method all method can be declared as static warnings
+ assertIdentifier occurrence of assert used as identifier
- boxing autoboxing conversion
+ charConcat when a char array is used in a string concatenation without being converted explicitly to a string
+ compareIdentical comparing identical expressions
- conditionAssign possible accidental boolean assignment
+ constructorName method with constructor name
+ deadCode dead code excluding trivial if (DEBUG) check
- dep-ann missing @Deprecated annotation
+/- deprecation usage of deprecated type or member outside deprecated code
+ discouraged use of types matching a discouraged access rule
- emptyBlock undocumented empty block
+ enumIdentifier occurrence of enum used as identifier
+ enumSwitch incomplete enum switch
- enumSwitchPedantic report missing enum switch cases even in the presence of a default case
- fallthrough possible fall-through case
- fieldHiding field hiding another variable
+ finalBound type parameter with final bound
+ finally finally block not completing normally
+ forbidden use of types matching a forbidden access rule
- hashCode missing hashCode() method when overriding equals()
+/- hiding macro for fieldHiding, localHiding, maskedCatchBlock, and typeHiding
- includeAssertNull raise null warnings for variables that got tainted in an assert expression
- indirectStatic indirect reference to static member
- inheritNullAnnot consider null annotations as being inherited from an overridden method to any overriding methods
+ intfAnnotation annotation type used as super interface
+ intfNonInherited interface non-inherited method compatibility
- intfRedundant find redundant superinterfaces
- invalidJavadoc macro to toggle the 'malformed Javadoc comments' option and all its sub-options listed below
- invalidJavadocTag report invalid Javadoc tags in Javadoc comments.
- invalidJavadocTagDep report invalid deprecated references in Javadoc tag arguments
- invalidJavadocTagNotVisible report invalid non-visible references in Javadoc tag arguments
- invalidJavadocVisibility(<visibility>) specify visibility modifier ("public", "protected" or "private") for malformed Javadoc tag warnings. Usage example: invalidJavadocVisibility(public)
- javadoc invalid Javadoc
- localHiding local variable hiding another variable
+ maskedCatchBlock hidden catch block
- missingJavadocTags macro to toggle the 'missing Javadoc tags' option and all its sub-options listed below
- missingJavadocTagsMethod report missing Javadoc tags for a method's type parameters
- missingJavadocTagsOverriding report missing Javadoc tags in overriding methods
- missingJavadocTagsVisibility(<visibility>) specify visibility modifier ("public", "protected" or "private") for missing Javadoc tags warnings. Usage example: missingJavadocTagsVisibility(public)
- missingJavadocComments macro to toggle the 'missing Javadoc comments' option and all its sub-options listed below
- missingJavadocCommentsOverriding report missing Javadoc comments in overriding methods
- missingJavadocCommentsVisibility(<visibility>) specify visibility modifier ("public", "protected" or "private") for missing Javadoc comments warnings. Usage example: missingJavadocCommentsVisibility(public)
- nls non-nls string literals (lacking of tags //$NON-NLS-<n>)
+ noEffectAssign assignment with no effect
+ nonnullNotRepeated nonnull parameter annotation from overridden method is not repeated in an overriding method. Is effective only with the nullAnnot option enabled.
+/- null potential missing or redundant null check
- nullAnnot enable annotation based null analysis. If desired, the annotation types to be interpreted by the compiler can be specified by appending (nullable|nonnull|nonnullbydefault), where each annotation type is specified using its fully qualified name. Usage example: nullAnnot(p.Nullable|p.NonNull|p.NonNullByDefault)
Enabling this option enables all null-annotation related sub-options. These can be individually controlled using options listed below
- nullAnnotConflict report conflicts between null annotation specified and nullness inferred. Is effective only with the nullAnnot option enabled.
- nullAnnotRedundant report redundant specification of null annotation. Is effective only with the nullAnnot option enabled.
- nullDereference missing null check
- nullUncheckedConversion report unchecked conversion from unannotated type to @NonNull type. Is effective only with the nullAnnot option enabled.
- over-ann missing @Override annotation (superclass only)
- paramAssign assignment to a parameter
+ pkgDefaultMethod attempt to override package-default method
+ raw usage a of raw type (instead of a parameterized type)
+/- resource (potentially) unsafe usage of resource of type Closeable
- semicolon unnecessary semicolon or empty statement
+ serial missing serialVersionUID
- specialParamHiding constructor or setter parameter hiding another field
+/- static-access macro for indirectStatic and staticReceiver
- static-method an instance method that could be as a static method
+ staticReceiver if a non static receiver is used to get a static field or call a static method
- super overriding a method without making a super invocation
+ suppress enable @SuppressWarnings
- switchDefault switch statement lacking a default case
- syncOverride missing synchronized in synchronized method override
- syntacticAnalysis perform syntax-based null analysis for fields
- syntheticAccess when performing synthetic access for innerclass
- tasks enable support for tasks tags in source code
+ typeHiding type parameter hiding another type
+ unavoidableGenericProblems report even unavoidable type safety problems due to raw APIs
+ unchecked unchecked type operation
- unnecessaryElse unnecessary else clause
- unqualifiedField unqualified reference to field
+/- unused macro for unusedImport, unusedLabel, unusedLocal, unusedPrivate, unusedThrown, unusedTypeArgs, and unusedTypeParameter
- unusedAllocation allocating an object that is not used
- unusedArgument unused method parameter (deprecated option; use unusedParam instead)
+ unusedImport unused import reference
+ unusedLabel unused label
+ unusedLocal unused local variable
+ unusedParam unused method parameter
+ unusedParamImplementing unused parameter for implementing method
+ unusedParamIncludeDoc unused parameter documented in a Javadoc comment tag
+ unusedParamOverriding unused parameter for overriding method
+ unusedPrivate unused private member declaration
- unusedThrown unused declared thrown exception
- unusedThrownIncludeDocComment unused declared thrown exception documented in a Javadoc comment tag
- unusedThrownExemptExceptionThrowable report unused declared thrown exception but exempt Exception and Throwable
- unusedThrownWhenOverriding unused declared thrown exception in overriding method
+ unusedTypeArgs unused type arguments for method and constructor
+ unusedTypeParameter unused type parameter
- uselessTypeCheck unnecessary cast/instanceof operation
+ varargsCast varargs argument need explicit cast
+/- warningToken unhandled or unused warning token in
@SuppressWarnings
-err:<warning tokens separated by ,> convert
exactly the listed warnings to errors
-err:+<warning tokens separated by ,> convert additional
warnings to errors
-err:-<warning tokens separated by ,> remove specific
warnings from being converted to errors
The properties file contents can be generated by setting project specific settings on an existing java project and using the file in .settings/org.eclipse.jdt.core.prefs file as a properties file, or a simple text file that is defined entry/value pairs using the constants defined in the org.eclipse.jdt.core.JavaCore class. Of those constants declared in this class, all options starting with "org.eclipse.jdt.core.compiler." are interpreted by the batch compiler.
...
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
...
To ensure that a property file has the same effect when used in the IDE and for the batch compiler, use of the -properties option will change the defaults for a few options:
-g default changed to all enabled
-preserveAllLocals default changed to enabled
-enableJavadoc default changed to enabled
error/warning forbidden default changed to error
Debug Options
Annotation Processing Options
Ignored Options (for compatibility with javac options)
Advanced Options
Helping Options
<http://help.eclipse.org/topic/org.eclipse.jdt.doc.user/tasks/task-using_batch_compiler.htm>
To report bugs, use <https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT&component=Core>
For details on Eclipse committers, see <http://www.eclipse.org/committers/>
13 March 2017 |