2362N/A * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Main program of the Java compiler 0N/A * WARNING: The contents of this source file are not part of any 0N/A * supported API. Code that depends on them does so at its own risk: 0N/A * they are subject to change or removal without notice. 0N/A * @deprecated As of J2SE 1.3, the preferred way to compile Java 0N/A * language sources is by using the new compiler, 0N/A * Name of the program. 0N/A * The stream where error message are printed. 0N/A * We introduce a separate integer status variable, and do not alter the 0N/A * convention that 'compile' returns a boolean true upon a successful 0N/A * compilation with no errors. (JavaTest relies on this.) 0N/A public static final int EXIT_OK =
0;
// Compilation completed with no errors. 0N/A public static final int EXIT_ERROR =
1;
// Compilation completed but reported errors. 0N/A public static final int EXIT_SYSERR =
3;
// System error or resource exhaustion. 0N/A * Top level error message. This method is called when the 0N/A * environment could not be set up yet. 0N/A * Print usage message and make exit status an error. 0N/A * Note: 'javac' invoked without any arguments is considered 0N/A * Initialize ResourceBundle 0N/A throw new Error(
"Fatal: Resource for javac is missing");
0N/A * get and format message string from resource 0N/A String message =
"JAVAC MESSAGE FILE IS BROKEN: key={0}, arguments={1}, {2}, {3}";
0N/A // What major and minor version numbers to use for the -target flag. 0N/A // This should grow every time the minor version number accepted by 0N/A // the VM is incremented. 0N/A // These flags are used to make sure conflicting -O and -g 0N/A // options aren't given. 0N/A // Pre-process command line for @file arguments 0N/A // We choose to have debugging options conflict even 0N/A // if they amount to the same thing (for example, 0N/A // -g:source,lines and -g:lines,source). However, multiple 0N/A // debugging options are allowed if they are textually 0N/A return false;
// Stop processing now 0N/A // -O is accepted for backward compatibility, but 0N/A // is no longer effective. Use the undocumented 0N/A // -XO option to get the old behavior. 0N/A error(
"main.option.already.seen",
"-classpath");
0N/A error(
"main.option.requires.argument",
"-classpath");
0N/A return false;
// Stop processing now 0N/A error(
"main.option.already.seen",
"-sourcepath");
0N/A error(
"main.option.requires.argument",
"-sourcepath");
0N/A return false;
// Stop processing now 0N/A error(
"main.option.already.seen",
"-sysclasspath");
0N/A error(
"main.option.requires.argument",
"-sysclasspath");
0N/A return false;
// Stop processing now 0N/A error(
"main.option.already.seen",
"-bootclasspath");
0N/A error(
"main.option.requires.argument",
"-bootclasspath");
0N/A return false;
// Stop processing now 0N/A error(
"main.option.already.seen",
"-extdirs");
0N/A error(
"main.option.requires.argument",
"-extdirs");
0N/A return false;
// Stop processing now 0N/A error(
"main.option.already.seen",
"-encoding");
0N/A error(
"main.option.requires.argument",
"-encoding");
0N/A return false;
// Stop processing now 0N/A error(
"main.option.already.seen",
"-target");
0N/A return false;
// Stop processing now 0N/A error(
"main.option.requires.argument",
"-target");
0N/A return false;
// Stop processing now 0N/A return false;
// Stop processing now 0N/A error(
"main.option.requires.argument",
"-d");
0N/A return false;
// Stop processing now 0N/A // This is what -O used to be. Now undocumented. 0N/A // Unadvertised option used by JWS. The non-X version should 0N/A // be removed, but we'll leave it in until we find out for 0N/A // sure that no one still depends on that option syntax. 0N/A // change the default output in this case: 0N/A // Make strict floating point the default 0N/A return false;
// Stop processing now 0N/A // Inform the compiler that it need not target VMs 0N/A // earlier than version 1.2. This option is here 0N/A // for testing purposes only. It is deliberately 0N/A // kept orthogonal to the -target option in 1.2.0 0N/A // for the sake of stability. These options will 0N/A // be merged in a future release. 0N/A return false;
// Stop processing now 0N/A // Create our Environment. 0N/A // Preload the "out of memory" error string just in case we run 0N/A // out of memory during the compile. 0N/A // Parse all input files 0N/A // Do a post-read check on all newly-parsed classes, 0N/A // after they have all been read. 0N/A // compile all classes that need compilation 0N/A // the enclosing block will check this one 0N/A env.
dtEvent(
"Main.compile (PARSED): skipping local class, " + c);
0N/A // bail out if there were any errors 0N/A env.
dtEvent(
"Main.compile (CHECKED): bailing out on error, " + c);
0N/A // Print class dependencies if requested (-xdepend) 0N/A // The compiler has run out of memory. Use the error string 0N/A // which we preloaded. 0N/A // We allow the compiler to take an exception silently if a program 0N/A // error has previously been detected. Presumably, this makes the 0N/A // compiler more robust in the face of bad error recovery. 0N/A // Allow EXIT_CMDERR or EXIT_ABNORMAL to take precedence. 0N/A // This is superceeded by the -Xstdout option, but we leave 0N/A // in the old property check for compatibility.