13.4 Compilation of Schema Objects
Loading a source file creates or updates a Java source schema object and invalidates the class schema objects previously derived from the source. If the class schema objects do not exist, then the loadjava
tool creates them. The loadjava
tool invalidates the old class schema objects because they were not compiled from the newly loaded source. Compilation of a newly loaded source, for example, class A
, is automatically triggered by any of the following conditions:
-
The resolver, while working on class
B
, finds that classB
refers to classA
, but classA
is invalid. -
The compiler, while compiling the source of class
B
, finds that classB
refers to classA
, but classA
is invalid. -
The class loader, while trying to load class
A
for running it, finds that classA
is invalid.
To force compilation when you load a source file, use the loadjava -resolve
option.
The compiler writes error messages to the predefined USER_ERRORS
view. The loadjava
tool retrieves and displays the messages produced by its compiler invocations.
The compiler recognizes some options. There are two ways to specify options to the compiler. If you run the loadjava
tool with the -resolve
option, then you can specify compiler options on the command line. You can additionally specify persistent compiler options in a per-schema database table, JAVA$OPTIONS
. You can use the JAVA$OPTIONS
table for default compiler options, which you can override selectively using a loadjava
tool option.
Note:
A command-line option overrides and clears the matching entry in the JAVA$OPTIONS
table.
A JAVA$OPTIONS
row contains the names of source schema objects to which an option setting applies. You can use multiple rows to set the options differently for different source schema objects. The compiler looks up options in JAVA$OPTIONS
when it has been called by the class loader or when called from the command line without specifying any options. When compiling a source schema object for which there is neither a JAVA$OPTIONS
entry nor a command-line value for an option, the compiler assumes a default value, as follows:
-
encoding = System.getProperty("file.encoding");
-
online = true
This applies only to Java sources that contain SQLJ constructs.
-
debug = true
This option is equivalent to
javac -g
.