Community
Participate
Working Groups
The following aspect: interface Foo { public static final Object dummy = new Object(); } public aspect Test { Object around(): call(Object.new(..)) { return proceed(); } public static void main(String[] args) { System.out.println(Foo.dummy); } } Compiles without error, but produces the following error at runtime: Exception in thread "main" java.lang.ClassFormatError: Method init$_aroundBody0 in class Foo has illegal modifiers: 0x101A at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:675) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374) at Test.main(Test.aj:12) Initialization of Fields in Interfaces is described here: http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html#40720 The problem might be that you cannot put methods in interfaces, but then it seems AspectJ should anticipate this and complain while compiling.
Similar to bug 163005. and as I wrote in comment 2 there: "recognize this problem and dont weave methods into an interface" try and look at this for 1.6.3
163005 now fixed. this situation will now produce an xlint and skip the join point.