src/share/classes/sun/rmi/rmic/Main.java
Print this page
*** 71,88 ****
String extDirsArg;
String classPathString;
File destDir;
int flags;
long tm;
! Vector classes;
boolean nowrite;
boolean nocompile;
boolean keepGenerated;
boolean status;
String[] generatorArgs;
! Vector generators;
! Class environmentClass = BatchEnvironment.class;
boolean iiopGeneration = false;
/**
* Name of the program.
*/
--- 71,88 ----
String extDirsArg;
String classPathString;
File destDir;
int flags;
long tm;
! Vector<String> classes;
boolean nowrite;
boolean nocompile;
boolean keepGenerated;
boolean status;
String[] generatorArgs;
! Vector<Generator> generators;
! Class<?> environmentClass = BatchEnvironment.class;
boolean iiopGeneration = false;
/**
* Name of the program.
*/
*** 181,199 ****
classPathString = null;
destDir = null;
flags = F_WARNINGS;
tm = System.currentTimeMillis();
! classes = new Vector();
nowrite = false;
nocompile = false;
keepGenerated = false;
generatorArgs = getArray("generator.args",true);
if (generatorArgs == null) {
return false;
}
! generators = new Vector();
// Pre-process command line for @file arguments
try {
argv = CommandLine.parse(argv);
} catch (FileNotFoundException e) {
--- 181,199 ----
classPathString = null;
destDir = null;
flags = F_WARNINGS;
tm = System.currentTimeMillis();
! classes = new Vector<String>();
nowrite = false;
nocompile = false;
keepGenerated = false;
generatorArgs = getArray("generator.args",true);
if (generatorArgs == null) {
return false;
}
! generators = new Vector<Generator>();
// Pre-process command line for @file arguments
try {
argv = CommandLine.parse(argv);
} catch (FileNotFoundException e) {
*** 409,419 ****
generators.addElement(gen);
// Get the environment required by this generator...
! Class envClass = BatchEnvironment.class;
String env = getString("generator.env." + arg);
if (env != null) {
try {
envClass = Class.forName(env);
--- 409,419 ----
generators.addElement(gen);
// Get the environment required by this generator...
! Class<?> envClass = BatchEnvironment.class;
String env = getString("generator.env." + arg);
if (env != null) {
try {
envClass = Class.forName(env);
*** 493,503 ****
extDirsArg);
BatchEnvironment result = null;
try {
Class[] ctorArgTypes = {OutputStream.class,ClassPath.class,Main.class};
Object[] ctorArgs = {out,classPath,this};
! Constructor constructor = environmentClass.getConstructor(ctorArgTypes);
result = (BatchEnvironment) constructor.newInstance(ctorArgs);
result.reset();
}
catch (Exception e) {
error("rmic.cannot.instantiate",environmentClass.getName());
--- 493,503 ----
extDirsArg);
BatchEnvironment result = null;
try {
Class[] ctorArgTypes = {OutputStream.class,ClassPath.class,Main.class};
Object[] ctorArgs = {out,classPath,this};
! Constructor<?> constructor = environmentClass.getConstructor(ctorArgTypes);
result = (BatchEnvironment) constructor.newInstance(ctorArgs);
result.reset();
}
catch (Exception e) {
error("rmic.cannot.instantiate",environmentClass.getName());
*** 528,538 ****
/** Load the classes on the command line
* Replace the entries in classes with the ClassDefinition for the class
*/
for (int i = classes.size()-1; i >= 0; i-- ) {
Identifier implClassName =
! Identifier.lookup((String)classes.elementAt(i));
/*
* 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").
--- 528,538 ----
/** Load the classes on the command line
* Replace the entries in classes with the ClassDefinition for the class
*/
for (int i = classes.size()-1; i >= 0; i-- ) {
Identifier implClassName =
! Identifier.lookup(classes.elementAt(i));
/*
* 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").
*** 556,566 ****
ClassDeclaration decl = env.getClassDeclaration(implClassName);
try {
ClassDefinition def = decl.getClassDefinition(env);
for (int j = 0; j < generators.size(); j++) {
! Generator gen = (Generator)generators.elementAt(j);
gen.generate(env, def, destDir);
}
} catch (ClassNotFound ex) {
env.error(0, "rmic.class.not.found", implClassName);
}
--- 556,566 ----
ClassDeclaration decl = env.getClassDeclaration(implClassName);
try {
ClassDefinition def = decl.getClassDefinition(env);
for (int j = 0; j < generators.size(); j++) {
! Generator gen = generators.elementAt(j);
gen.generate(env, def, destDir);
}
} catch (ClassNotFound ex) {
env.error(0, "rmic.class.not.found", implClassName);
}
*** 671,690 ****
ByteArrayOutputStream buf = new ByteArrayOutputStream(4096);
boolean done;
do {
done = true;
! for (Enumeration e = env.getClasses() ; e.hasMoreElements() ; ) {
ClassDeclaration c = (ClassDeclaration)e.nextElement();
done = compileClass(c,buf,env);
}
} while (!done);
}
/*
* Compile a single class.
*/
public boolean compileClass (ClassDeclaration c,
ByteArrayOutputStream buf,
BatchEnvironment env)
throws ClassNotFound,
IOException,
--- 671,692 ----
ByteArrayOutputStream buf = new ByteArrayOutputStream(4096);
boolean done;
do {
done = true;
! for (Enumeration<?> e = env.getClasses() ; e.hasMoreElements() ; ) {
ClassDeclaration c = (ClassDeclaration)e.nextElement();
done = compileClass(c,buf,env);
}
} while (!done);
}
/*
* Compile a single class.
+ * Fallthrough is intentional
*/
+ @SuppressWarnings("fallthrough")
public boolean compileClass (ClassDeclaration c,
ByteArrayOutputStream buf,
BatchEnvironment env)
throws ClassNotFound,
IOException,
*** 877,884 ****
String[] args = new String[3];
args[0] = (arg0 != null ? arg0.toString() : "null");
args[1] = (arg1 != null ? arg1.toString() : "null");
args[2] = (arg2 != null ? arg2.toString() : "null");
! return java.text.MessageFormat.format(format, args);
}
}
--- 879,886 ----
String[] args = new String[3];
args[0] = (arg0 != null ? arg0.toString() : "null");
args[1] = (arg1 != null ? arg1.toString() : "null");
args[2] = (arg2 != null ? arg2.toString() : "null");
! return java.text.MessageFormat.format(format, (Object[]) args);
}
}