Commit 917173f4 by Archit Shah Committed by Andrew Haley

re PR libgcj/25414 (should update rmic)

2006-04-05  Archit Shah  <ashah@redhat.com>

        PR java/25414
        * gnu/java/rmi/rmic/CompilerProcess.java (computeTypicalArguments):
        Add classpath argument.
        * gnu/java/rmi/rmic/Compile_gcj.java (computeArguments): Adjust
        caller.
        * gnu/java/rmi/rmic/Compile_jikes.java (computeArguments): Likewise.
        * gnu/java/rmi/rmic/Compile_kjc.java (computeArguments): Likewise.
        * gnu/java/rmi/rmic/Compiler.java (getClasspath, setClasspath): New.
        * gnu/java/rmi/rmic/RMIC.java: Set classpath for compiler, call
        mkdirs for destination directory, correct handling of superclasses
        and interfaces of the remote class, correct handling of exceptions
        declared by remote methods.

From-SVN: r112699
parent 6eee9893
2006-04-05 Archit Shah <ashah@redhat.com>
PR java/25414
* gnu/java/rmi/rmic/CompilerProcess.java (computeTypicalArguments):
Add classpath argument.
* gnu/java/rmi/rmic/Compile_gcj.java (computeArguments): Adjust
caller.
* gnu/java/rmi/rmic/Compile_jikes.java (computeArguments): Likewise.
* gnu/java/rmi/rmic/Compile_kjc.java (computeArguments): Likewise.
* gnu/java/rmi/rmic/Compiler.java (getClasspath, setClasspath): New.
* gnu/java/rmi/rmic/RMIC.java: Set classpath for compiler, call
mkdirs for destination directory, correct handling of superclasses
and interfaces of the remote class, correct handling of exceptions
declared by remote methods.
2006-04-04 Tom Tromey <tromey@redhat.com>
PR libgcj/26990:
......
......@@ -49,6 +49,7 @@ public class Compile_gcj extends CompilerProcess
public String[] computeArguments (String filename)
{
return computeTypicalArguments(COMPILER_ARGS,
getClasspath(),
getDestination(),
filename);
}
......
......@@ -50,6 +50,7 @@ public class Compile_jikes extends CompilerProcess
public String[] computeArguments (String filename)
{
return computeTypicalArguments(COMPILER_ARGS,
getClasspath(),
getDestination(),
filename);
}
......
......@@ -50,6 +50,7 @@ public class Compile_kjc extends CompilerProcess
public String[] computeArguments (String filename)
{
return computeTypicalArguments(COMPILER_ARGS,
getClasspath(),
getDestination(),
filename);
}
......
......@@ -82,12 +82,27 @@ public abstract class Compiler
this.dest = dest;
}
/** Get the classpath for compilation. */
public String getClasspath ()
{
return classpath;
}
/** Set the classpath for compilation. */
public void setClasspath (String classpath)
{
this.classpath = classpath;
}
/** Compile the given file. Throws exception on error. */
public abstract void compile (String name) throws Exception;
/** The destination directory, or null if none set. */
protected String dest;
/** The classpath directory, or null if none set. */
private String classpath;
/** Class prefix used when trying to find instance. */
private static final String classPrefix = "gnu.java.rmi.rmic.Compile_";
}
......@@ -59,11 +59,27 @@ public abstract class CompilerProcess extends Compiler
public static String[] computeTypicalArguments(String[] compilerArgs,
String destination, String filename)
{
return computeTypicalArguments(compilerArgs, null, destination, filename);
}
/**
* This is used to compute the command line for the process.
* Most compilers typically arrange their arguments as in
* &lt;compiler name and arguments&gt; &lt;optional destination&gt; &lt;filename&gt;.
* This method builds an argument array out that. It should be used
* to define computeArguments for those compilers that follow the
* argument convention described above.
*/
public static String[] computeTypicalArguments(String[] compilerArgs,
String classpath,
String destination,
String filename)
{
/* length of compiler specific arguments */
final int len = compilerArgs.length;
int len = compilerArgs.length;
/* length of returned array of arguments */
final int arglen = len + (destination == null ? 0 : 2) + 1;
final int arglen = len + (classpath == null ? 0 : 2) +
(destination == null ? 0 : 2) + 1;
/* Allocate String array for computed arguments. */
String [] args = new String[arglen];
......@@ -71,11 +87,18 @@ public abstract class CompilerProcess extends Compiler
/* Fill in compiler arguments. */
System.arraycopy(compilerArgs, 0, args, 0, len);
/* Fill in classpath argument if necessary. */
if (classpath != null)
{
args[len++] = "-classpath";
args[len++] = classpath;
}
/* Fill in destination argument if necessary. */
if (destination != null)
{
args[len] = "-d";
args[len + 1] = destination;
args[len++] = "-d";
args[len++] = destination;
}
/* Fill in filename */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment