2362N/A * Copyright (c) 1996, 2007, 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 * Licensed Materials - Property of IBM 0N/A * Copyright IBM Corp. 1998 1999 All Rights Reserved 0N/A * Main "rmic" program. 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 * Name of the program. 0N/A * The stream where error message are printed. 0N/A * Top level error message. This method is called when the 0N/A * environment could not be set up yet. 0N/A * Handle internal option to use the new (and incomplete) rmic 0N/A * implementation. This option is handled here, rather than 0N/A * in parseArgs, so that none of the arguments will be nulled 0N/A * before delegating to the new implementation. 0N/A * Get the destination directory. 0N/A * Parse the arguments for compile. 0N/A // Pre-process command line for @file arguments 0N/A error(
"rmic.option.unsupported",
"-show");
0N/A error(
"rmic.option.already.seen",
"-classpath");
0N/A error(
"rmic.option.requires.argument",
"-classpath");
0N/A error(
"rmic.option.already.seen",
"-sourcepath");
0N/A error(
"rmic.option.requires.argument",
"-sourcepath");
0N/A error(
"rmic.option.already.seen",
"-bootclasspath");
0N/A error(
"rmic.option.requires.argument",
"-bootclasspath");
0N/A error(
"rmic.option.already.seen",
"-extdirs");
0N/A error(
"rmic.option.requires.argument",
"-extdirs");
0N/A error(
"rmic.option.already.seen",
"-d");
0N/A error(
"rmic.option.requires.argument",
"-d");
0N/A // Now that all generators have had a chance at the args, 0N/A // scan what's left for classes and illegal args... 0N/A // If the generators vector is empty, add the default generator... 0N/A * If this argument is for a generator, instantiate it, call 0N/A * parseArgs(...) and add generator to generators vector. 0N/A * Returns false on error. 0N/A // Got a match, add Generator and call parseArgs... 0N/A * Instantiate and add a generator to the generators array. 0N/A // Create an instance of the generator and add it to 0N/A // Get the environment required by this generator... 0N/A // Is the new class a subclass of the current one? 0N/A // Yes, so switch to the new one... 0N/A // No. Is the current class a subclass of the 0N/A // No, so it's a conflict... 0N/A // If this is the iiop stub generator, cache 0N/A // that fact for the jrmp generator... 0N/A * Grab a resource string and parse it into an array of strings. Assumes 0N/A * comma separated list. 0N/A * @param name The resource name. 0N/A * @param mustExist If true, throws error if resource does not exist. If 0N/A * false and resource does not exist, returns zero element array. 0N/A * Get the correct type of BatchEnvironment 0N/A * Do the compile with the switches and files already supplied 0N/A // Create batch environment 0N/A // Set the classfile version numbers 0N/A // Compat and 1.1 stubs must retain the old version number. 0N/A // Preload the "out of memory" error string just in case we run 0N/A // out of memory during the compile. 0N/A /** Load the classes on the command line 0N/A * Replace the entries in classes with the ClassDefinition for the class 0N/A * Fix bugid 4049354: support using '.' as an inner class 0N/A * qualifier on the command line (previously, only mangled 0N/A * inner class names were understood, like "pkg.Outer$Inner"). 0N/A * The following method, also used by "javap", resolves the 0N/A * given unmangled inner class name to the appropriate 0N/A * internal identifier. For example, it translates 0N/A * "pkg.Outer.Inner" to "pkg.Outer. Inner". 0N/A * But if we use such an internal inner class name identifier 0N/A * to load the class definition, the Java compiler will notice 0N/A * if the impl class is a "private" inner class and then deny 0N/A * skeletons (needed unless "-v1.2" is used) the ability to 0N/A * cast to it. To work around this problem, we mangle inner 0N/A * class name identifiers to their binary "outer" class name: 0N/A * "pkg.Outer. Inner" becomes "pkg.Outer$Inner". 0N/A // compile all classes that need compilation 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 // last step is to delete generated source files 0N/A // Shutdown the environment object and release our resources. 0N/A // Note that while this is unneccessary when rmic is invoked 0N/A // the command line, there are environments in which rmic 0N/A // from is invoked within a server process, so resource 0N/A // reclamation is important... 0N/A * Compile all classes that need to be compiled. 0N/A * Compile a single class. 5561N/A * Fallthrough is intentional 0N/A // If we get to here, then compilation is going 0N/A // to occur. If the -Xnocompile switch is set 0N/A // then fail. Note that this check is required 0N/A // here because this method is called from 0N/A // generators, not just from within this class... 0N/A throw new IOException(
"Compilation required, but -Xnocompile option in effect");
0N/A // bail out if there were any errors 0N/A * resource bundle. If the resource is not found, null is returned. 0N/A // To enable extensions, search the 'resourcesExt' 0N/A // bundle first, followed by the 'resources' bundle... 0N/A throw new Error(
"fatal: missing resource bundle: " +
0N/A "arguments = \"{0}\", \"{1}\", \"{2}\"";