/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Licensed Materials - Property of IBM
* RMI-IIOP v1.0
* Copyright IBM Corp. 1998 1999 All Rights Reserved
*
*/
/**
* Main "rmic" program.
*
* WARNING: The contents of this source file are not part of any
* supported API. Code that depends on them does so at its own risk:
* they are subject to change or removal without notice.
*/
int flags;
long tm;
boolean nowrite;
boolean nocompile;
boolean keepGenerated;
boolean status;
BatchEnvironment.class;
boolean iiopGeneration = false;
/**
* Name of the program.
*/
/**
* The stream where error message are printed.
*/
/**
* Constructor.
*/
}
/**
* Output a message.
*/
: new PrintStream(this.out, true);
}
/**
* Top level error message. This method is called when the
* environment could not be set up yet.
*/
}
}
}
/**
* Usage
*/
public void usage() {
}
/**
* Run the compiler
*/
/*
* Handle internal option to use the new (and incomplete) rmic
* implementation. This option is handled here, rather than
* in parseArgs, so that none of the arguments will be nulled
* before delegating to the new implementation.
*/
}
}
return false;
}
usage();
return false;
}
return doCompile();
}
/**
* Get the destination directory.
*/
return destDir;
}
/**
* Parse the arguments for compile.
*/
extDirsArg = null;
flags = F_WARNINGS;
nowrite = false;
nocompile = false;
keepGenerated = false;
if (generatorArgs == null) {
return false;
}
generators = new Vector<>();
// Pre-process command line for @file arguments
try {
} catch (FileNotFoundException e) {
return false;
} catch (IOException e) {
(PrintStream) out :
new PrintStream(out, true));
return false;
}
// Parse arguments
flags &= ~F_DEBUG_LINES;
flags &= ~F_DEBUG_VARS;
flags &= ~F_WARNINGS;
flags |= F_DEPENDENCIES;
nowrite = true;
nocompile = true;
keepGenerated = true;
keepGenerated = true;
usage();
return false;
if (classPathString != null) {
usage();
return false;
}
classPathString = argv[++i];
} else {
usage();
return false;
}
if (sourcePathArg != null) {
usage();
return false;
}
sourcePathArg = argv[++i];
} else {
usage();
return false;
}
if (sysClassPathArg != null) {
usage();
return false;
}
sysClassPathArg = argv[++i];
} else {
usage();
return false;
}
if (extDirsArg != null) {
usage();
return false;
}
extDirsArg = argv[++i];
} else {
usage();
return false;
}
usage();
return false;
}
usage();
return false;
}
} else {
usage();
return false;
}
} else {
if (!checkGeneratorArg(argv,i)) {
usage();
return false;
}
}
}
}
// Now that all generators have had a chance at the args,
// scan what's left for classes and illegal args...
usage();
return false;
} else {
}
}
}
// If the generators vector is empty, add the default generator...
addGenerator("default");
}
return true;
}
/**
* If this argument is for a generator, instantiate it, call
* parseArgs(...) and add generator to generators vector.
* Returns false on error.
*/
boolean result = true;
// Got a match, add Generator and call parseArgs...
return false;
}
break;
}
}
}
return result;
}
/**
* Instantiate and add a generator to the generators array.
*/
// Create an instance of the generator and add it to
// the array...
return null;
}
try {
} catch (Exception e) {
return null;
}
// Get the environment required by this generator...
try {
// Is the new class a subclass of the current one?
// Yes, so switch to the new one...
} else {
// No. Is the current class a subclass of the
// new one?
// No, so it's a conflict...
return null;
}
}
} catch (ClassNotFoundException e) {
return null;
}
}
// If this is the iiop stub generator, cache
// that fact for the jrmp generator...
iiopGeneration = true;
}
return gen;
}
/**
* Grab a resource string and parse it into an array of strings. Assumes
* comma separated list.
* @param name The resource name.
* @param mustExist If true, throws error if resource does not exist. If
* false and resource does not exist, returns zero element array.
*/
if (mustExist) {
return null;
} else {
return new String[0];
}
}
for (int i = 0; i < count; i++) {
}
return result;
}
/**
* Get the correct type of BatchEnvironment
*/
try {
}
catch (Exception e) {
}
return result;
}
/**
* Do the compile with the switches and files already supplied
*/
public boolean doCompile() {
// Create batch environment
// Set the classfile version numbers
// Compat and 1.1 stubs must retain the old version number.
// Preload the "out of memory" error string just in case we run
// out of memory during the compile.
try {
/** Load the classes on the command line
* Replace the entries in classes with the ClassDefinition for the class
*/
/*
* Fix bugid 4049354: support using '.' as an inner class
* qualifier on the command line (previously, only mangled
* inner class names were understood, like "pkg.Outer$Inner").
*
* The following method, also used by "javap", resolves the
* given unmangled inner class name to the appropriate
* internal identifier. For example, it translates
* "pkg.Outer.Inner" to "pkg.Outer. Inner".
*/
/*
* But if we use such an internal inner class name identifier
* to load the class definition, the Java compiler will notice
* if the impl class is a "private" inner class and then deny
* skeletons (needed unless "-v1.2" is used) the ability to
* cast to it. To work around this problem, we mangle inner
* class name identifiers to their binary "outer" class name:
* "pkg.Outer. Inner" becomes "pkg.Outer$Inner".
*/
try {
}
} catch (ClassNotFound ex) {
}
}
// compile all classes that need compilation
if (!nocompile) {
}
} catch (OutOfMemoryError ee) {
// The compiler has run out of memory. Use the error string
// which we preloaded.
return false;
} catch (StackOverflowError ee) {
return false;
// We allow the compiler to take an exception silently if a program
// error has previously been detected. Presumably, this makes the
// compiler more robust in the face of bad error recovery.
(PrintStream) out :
new PrintStream(out, true));
}
(PrintStream) out :
new PrintStream(out, true));
}
}
env.flushErrors();
boolean status = true;
} else {
}
} else {
}
}
status = false;
} else {
} else {
}
}
}
// last step is to delete generated source files
if (!keepGenerated) {
}
// We're done
}
// Shutdown the environment object and release our resources.
// Note that while this is unneccessary when rmic is invoked
// the command line, there are environments in which rmic
// from is invoked within a server process, so resource
// reclamation is important...
extDirsArg = null;
generators = null;
return status;
}
/*
* Compile all classes that need to be compiled.
*/
throws ClassNotFound,
boolean done;
do {
done = true;
}
} while (!done);
}
/*
* Compile a single class.
* Fallthrough is intentional
*/
@SuppressWarnings("fallthrough")
throws ClassNotFound,
boolean done = true;
env.flushErrors();
switch (c.getStatus()) {
case CS_UNDEFINED:
{
if (!env.dependencies()) {
break;
}
// fall through
}
case CS_SOURCE:
{
done = false;
env.loadDefinition(c);
break;
}
// fall through
}
case CS_PARSED:
{
if (c.getClassDefinition().isInsideLocal()) {
break;
}
// If we get to here, then compilation is going
// to occur. If the -Xnocompile switch is set
// then fail. Note that this check is required
// here because this method is called from
// generators, not just from within this class...
if (nocompile) {
throw new IOException("Compilation required, but -Xnocompile option in effect");
}
done = false;
// fall through
}
case CS_CHECKED:
{
// bail out if there were any errors
break;
}
done = false;
break;
}
}
} else {
}
} else {
break;
}
}
// Create the file
try {
}
} catch (IOException ee) {
}
}
}
return done;
}
/**
* Main program
*/
}
/**
* Return the string value of a named resource in the rmic.properties
* resource bundle. If the resource is not found, null is returned.
*/
if (!resourcesInitialized) {
}
// To enable extensions, search the 'resourcesExt'
// bundle first, followed by the 'resources' bundle...
if (resourcesExt != null) {
try {
} catch (MissingResourceException e) {}
}
try {
} catch (MissingResourceException ignore) {
}
return null;
}
private static boolean resourcesInitialized = false;
private static void initResources() {
try {
resourcesInitialized = true;
try {
} catch (MissingResourceException e) {}
} catch (MissingResourceException e) {
throw new Error("fatal: missing resource bundle: " +
e.getClassName());
}
}
}
return message;
}
}
}
}
{
"arguments = \"{0}\", \"{1}\", \"{2}\"";
}
}
}