Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ 1.2rc1 and Java 1.5


I saw the post below and thought we should start discussing how best to use AspectJ and Java 1.5.

There are two things to point out:

1) Runtime.  Code produced by the AspectJ 1.2 compiler runs on a 1.5 JVM (the only one I have available
for testing is the beta SUN 1.5 JVM)

2) Compile time.  The AspectJ 1.2 compiler is a Java 1.4 level compiler, it cannot be used to
compile source code that exploits Java 1.5 language features.

The note below shows the kind of errors produced if ajc is used to build code containing
Java 1.5 level features:

     [iajc]
/export/horn/2/amichail/argouml/src_new/org/argouml/xml/XMLElement.java:50:0
Type mismatch: cannot convert from AbstractStringBuilder to StringBuffer
    [iajc] [error  96]: error at sb.append('%');
    [iajc] ^^^^^^^^^^


In this case the source code is apparently using  the capability in 1.5 of modifying a methods
return type when overriding it an subclass.  The way to work in this case is to use the 1.5
compiler to build your source code into class files and then use ajc to binary weave those class
files with your aspects.  I have successfully tested this approach with some simple code that
used 1.5 features.

Andy.




Amir Michail <amichail@xxxxxxxxxxxxxxx>
Sent by: aspectj-users-admin@xxxxxxxxxxx

16/04/2004 08:49

Please respond to
aspectj-users

To
aspectj-users@xxxxxxxxxxx
cc
Subject
Re: [aspectj-users] AspectJ 1.2 release candidate 1 now available.





Hi,

Does this version work with Java 1.5?  In my experimentation, one application
worked while another, ArgoUML, does not compile.  (ArgoUML used to compile
with the previous version of AspectJ & Java 1.4.  Moreover, ArgoUML compiles
fine with javac 1.5.)

The problem appears to be this:

http://forum.java.sun.com/thread.jsp?thread=510771&forum=31&message=2426492

Maybe this needs to be fixed in the aspectj compiler?

I get errors like this:

compile:compile:
    [echo] Compiling the sources
    [echo] ../src_new
    [iajc]
/export/horn/2/amichail/argouml/src_new/org/argouml/application/modules/ModuleLoader.java:121
warning The method decode(String) from the type URLDecoder is deprecated
    [iajc] argoHome = java.net.URLDecoder.decode(argoHome);
    [iajc]            ^^^^^^^^^^^^^^^^^^^^^^^^^^
    [iajc]
/export/horn/2/amichail/argouml/src_new/org/argouml/cognitive/ToDoList.java:615
error The type AbstractStringBuilder is not visible
    [iajc] res.append(getClass().getName()).append(" {\n");
    [iajc] ^^^^^^^^^^^^^^^^^^^^^^^
    [iajc]
/export/horn/2/amichail/argouml/src_new/org/argouml/cognitive/ToDoList.java:619
error The type AbstractStringBuilder is not visible
    [iajc] res.append("    ").append(item.toString()).append("\n");

    [echo] Compiling the sources
    [echo] ../src_new
    [iajc]
/export/horn/2/amichail/argouml/src_new/org/argouml/application/modules/ModuleLoader.java:121
warning The method decode(String) from the type URLDecoder is deprecated
    [iajc] argoHome = java.net.URLDecoder.decode(argoHome);
    [iajc]            ^^^^^^^^^^^^^^^^^^^^^^^^^^
    [iajc]
/export/horn/2/amichail/argouml/src_new/org/argouml/cognitive/ToDoList.java:615
error The type AbstractStringBuilder is not visible
    [iajc] res.append(getClass().getName()).append(" {\n");
    [iajc] ^^^^^^^^^^^^^^^^^^^^^^^
    [iajc]
/export/horn/2/amichail/argouml/src_new/org/argouml/cognitive/ToDoList.java:619
error The type AbstractStringBuilder is not visible
    [iajc] res.append("    ").append(item.toString()).append("\n");


...


    [iajc]
/export/horn/2/amichail/argouml/src_new/org/argouml/xml/XMLElement.java:50:0
Type mismatch: cannot convert from AbstractStringBuilder to StringBuffer
    [iajc] [error  96]: error at sb.append('%');
    [iajc] ^^^^^^^^^^
    [iajc]
/export/horn/2/amichail/argouml/src_new/org/argouml/xml/todo/TodoParser.java:475:0
Unhandled exception type IOException
    [iajc] [error  97]: error at sb.append((char) Integer.parseInt(ent));
    [iajc] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [iajc]
/export/horn/2/amichail/argouml/src_new/org/argouml/xml/todo/TodoParser.java:478:0
Unhandled exception type IOException

BUILD FAILED
/export/horn/2/amichail/argouml/src_new/build.xml:563: 98 errors

Total time: 1 minute 4 seconds


Amir


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top