Chapter 4. Jamaicac - Java Bytecode Compiler

Jamaicac is a Java bytecode compiler that is based on the Eclipse Java Compiler version 3.1.1 (see Eclipse Public License the Section called Eclipse Public License (EPL) in Appendix I). It uses the system classes of the Jamaica distribution as default bootclasspath.

Jamaicac Usage

The command line syntax for the jamaicac is as follows:

jamaicac <options> <source files | directories>

If directories are specified, then their source contents are compiled. Possible options are listed below. Options enabled by default are prefixed with `+'

Classpath options:

-cp -classpath <list>

The classpath option specifies the location for application classes and sources. The entries in the list are directories, zip files or jar files separated by colons (`:'). Each directory or file can specify access rules for types between `[' and `]' (e.g. "[-X.java]" to deny access to type X).

-bootclasspath <list>

The bootclasspath option specifies location for system classes. The entries in the list are directories, zip files or jar files separated by colons (`:'). Each directory or file can specify access rules for types between `[' and `]' (e.g. "[-X.java]" to deny access to type X).

-sourcepath <directories separated by :>

The sourcepath option specifies location for application sources. Each directory can specify access rules for types between `[' and `]' (e.g. "[-X.java]" to deny access to type X)

-useTarget <platform>

The useTarget option specifies the target platform to compile for. It is used to compute the bootclasspath in case bootclasspath is omitted. By default, the host platform is used.

-extdirs <directories separated by :>

The extdirs option specifies location for extension zip/jar files.

-d <dir>

The d option sets the destination directory to write the generated class files to. If omitted, no directory is created.

-d none

With parameter none the d option disables the generation of class files.

-encoding <enc>

The encoding option specifies custom encoding for all sources. Each file/directory can override it when suffixed with `['<enc>`]' (e.g. "X.java[utf8]").

Compliance options:

-1.3

The 1.3 option uses 1.3 compliance level (implicit "-source 1.3 -target 1.1")

-1.4 +

The 1.4 option uses 1.4 compliance level (implicit "-source 1.3 -target 1.2")

-1.5

The 1.5 option use 1.5 compliance level (implicit "-source 1.5 -target 1.5")

-source <version>

The source option sets source level: 1.3 to 1.5 (or 5 or 5.0).

-target <version>

The target option sets classfile target level: 1.1 to 1.5 (or 5 or 5.0)

Warning options:

-deprecation +

The deprecation option checks for deprecation outside deprecated code.

-nowarn, -warn:none

The nowarn option disables all warnings. See the Section called Jamaicac warning types for a list of all warnings created by jamaicac.

-warn:<warnings separated by ,>

The warn option enables exactly the listed warnings. See the Section called Jamaicac warning types for a list of all warnings created by jamaicac.

-warn:+<warnings separated by ,>

The warn option with `+' enables additional warnings. See the Section called Jamaicac warning types for a list of all warnings created by jamaicac.

-warn:-<warnings separated by ,>

The warn option with `-' disables specific warnings. See the Section called Jamaicac warning types for a list of all warnings created by jamaicac.

Jamaicac warning types

Table 4-1. Warnings created by jamaicac

warning optionmeaning
allDeprecation deprecation including inside deprecated code
allJavadoc invalid or missing javadoc
assertIdentifier + assert used as identifier
boxing autoboxing conversion
charConcat  + char[] in String concat
conditionAssign possible accidental boolean assignment
constructorName + method with constructor name
dep-ann missing @Deprecated annotation
deprecation  + deprecation outside deprecated code
emptyBlock undocumented empty block
enumSwitch incomplete enum switch
fieldHiding field hiding another variable
finalBound type parameter with final bound
finally + finally block not completing normally
hiding macro for fieldHiding, localHiding, typeHiding and maskedCatchBlock
incomplete-switch same as enumSwitch
indirectStatic indirect reference to static member
intfAnnotation + annotation type used as super interface
intfNonInherited + interface non-inherited method compatibility
javadoc invalid javadoc
localHiding local variable hiding another variable
maskedCatchBlock + hidden catch block
nls string literal lacking non-nls tag //$NON-NLS<n>$
noEffectAssign + assignment without effect
null missing or redundant null check
over-ann missing @Override annotation
pkgDefaultMethod + attempt to override package-default method
semicolon unnecessary semicolon, empty statement
serial + missing serialVersionUID
specialParamHiding constructor or setter parameter hiding another field
static-access macro for indirectStatic and staticReceiver 
staticReceiver + non-static reference to static member
suppress + enable @SuppressWarnings
synthetic-access same as syntheticAccess
syntheticAccess synthetic access for innerclass
tasks(<tags separated by |>)tasks identified by tags inside comments
typeHiding + type parameter hiding another type
unchecked + unchecked type operation
unnecessaryElse  unnecessary else clause
unqualified-field- access same as unQualifiedField
unqualifiedField unqualified reference to field
unused macro for unusedArgument, unusedImport, unusedLocal, unusedPrivate and unusedThrown
unusedArgument unread method parameter
unusedImport + unused import declaration
unusedLocal + unread local variable
unusedPrivate + unused private member declaration
unusedThrown unused declared thrown exception
uselessTypeCheck unnecessary cast/instanceof operation
varargsCast + varargs argument need explicit cast
warningToken + unhandled warning token in @SuppressWarnings

Debug options:

-g[:lines,vars,source]

The g option customs debug info.

-g:lines,source +

The g option sets both lines table and source debug info.

-g

The g option without parameter activates all debug info.

-g:none

The g option with none disables debug info.

-preserveAllLocals

The preserveAllLocals option preserves unused local vars for debug purpose.

Ignored options:

-J<option>

A J<option> option passes an option to virtual machine (ignored).

-X<option>

The J<option> option specifies a non-standard option (ignored).

-X

The X option prints non-standard options and exits (ignored).

-O

The X option optimizes for execution time (ignored).