axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Colwell" <jcolw...@bea.com>
Subject JWS files can't compile with annotations
Date Fri, 13 Aug 2004 17:43:51 GMT
Hi there,

 

I tried to hit a jws containing annotations and the compiler got mad
about the '@' symbol in source code.  When I looked into the Axis
compiler utilities I found that
org.apache.axis.components.compiler.Javac.java was always using the old
sun.tools.javac.Main compiler which has not been updated to support the
new 1.5 features.  I'm certain there was an intention to pick a suitable
compiler class since the code did attempt to find out whether to use the
newer compilers but never made use of the modern flag.  With the changes
below, the jws appears to compile and run successfully, or at least in
the single test I did.

 

I'm not sure of the correct way to propose changes to code so I pasted
the diff below.  Let me know if I should submit the actual java file or
something.

 

Thanks,

 

Jonathan

 

 

Proposed Javac.java fix to support source code annotations

Produced: 8/13/2004 10:25:12 AM

 

 

Left file:  Existing Javac.java     Right file: Proposed Javac.java

29a30,31

> import java.io.OutputStreamWriter;

> import java.io.PrintWriter;

55c57

<     public static final String MODERN_CLASS =
"com.sun.tools.javac.Main";

---

>   public static final String MODERN_CLASS =
"com.sun.tools.javac.main.Main";

109c113

<             Class c = ClassUtils.forName("sun.tools.javac.Main", true,
getClassLoader());

---

>       Class c = ClassUtils.forName(modern ? MODERN_CLASS :
CLASSIC_CLASS);

111c115,121

<             Constructor cons =

---

>       Constructor cons;

>       Object compiler;

>       if (modern) {

>         PrintWriter pw = new PrintWriter(new OutputStreamWriter(err));

>         cons =

>           c.getConstructor(new Class[] { String.class,

>                                          PrintWriter.class});

111a123,126

>         compiler = cons.newInstance(new Object[] { "javac", pw });

>       }

>       else {

>         cons =

114c129

<             Object compiler = cons.newInstance(new Object[] { err,

---

>         compiler = cons.newInstance(new Object[] { err, "javac" });

115c131

<                                                               "javac"
});

---

>       }

119c136,143

<             Boolean ok =

---

> 

>       if (modern) {

>         int compilationResult =

>           ((Integer)compile.invoke(compiler,

>                                    new Object[] {toStringArray

>                                                  (fillArguments

>                                                   (new
ArrayList()))}))

>           .intValue();

119,121c145,153

<                 (Boolean) compile.invoke(compiler,

<                                         new Object[]
{toStringArray(fillArguments(new ArrayList()))});

---

>         result = (compilationResult == 0);

>         log.debug("Compilation Returned: "

>                   + Integer.toString(compilationResult));

>       }

>       else {

>         Boolean ok = (Boolean)compile.invoke(compiler,

>                                              new Object[]
{toStringArray

>
(fillArguments

>                                                             (new
ArrayList()))});

122a156

>       }


Mime
View raw message