Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] ClassFormatError in certain situations

Thank you for the fast fix and workaround Andy. I added the
-Xset:pipelineCompilation=false to "Non-standard compiler options" and
the issue went away. 

Regards,
Jouni Lantinen.

On Thu, 2008-12-18 at 10:49 -0800, Andy Clement wrote:
> Fix is in AspectJ - I will put this fix into 1.6.3 final release as it
> is quite a nasty bug, but it is an entirely self contained fix so I
> don't believe it needs a new release candidate.
> 
> cheers,
> Andy.
> 
> 2008/12/18 Andy Clement <andrew.clement@xxxxxxxxx>
>         Hi Jouni,
>         
>         I just raised this as
>         https://bugs.eclipse.org/bugs/show_bug.cgi?id=259279
>         
>         If you want to workaround it at the moment, you can deactivate
>         pipelineCompilation until it is fixed.
>         
>         -Xset:pipelineCompilation=false
>         
>         in the AspectJ compiler options for the project.
>         
>         Andy.
>         
>         2008/12/18 Jouni Lantinen <jouni.lantinen@xxxxxxxxx>
>         
>         
>                 Hello.
>                 
>                 I have an issue that comes from a combination of
>                 things and leads to
>                 java.lang.ClassFormatError at runtime. Here is the
>                 most minimalistic
>                 package to reproduce this problem:
>                 
>                 public aspect Aspect pertypewithin(*){}
>                 
>                 public interface GenericService<T extends
>                 SomeInterface> {
>                        public void doStuff(T t);
>                 }
>                 
>                 public class GenericServiceImpl<T extends
>                 SomeInterface> implements
>                 GenericService<T> {
>                        public void doStuff(T t) {}
>                 }
>                 
>                 public interface SomeInterface {}
>                 
>                 public class SomeServiceImpl extends
>                 GenericServiceImpl<SomeInterface> {
>                        @Override
>                        public void doStuff(SomeInterface
>                 someInterface) {
>                        }
>                 }
>                 
>                 public class Main {
>                        public static void main(String[] args) {
>                                new SomeServiceImpl();
>                        }
>                 }
>                 
>                 And here is what I get right after I have done clean
>                 and ran my little
>                 test.
>                 
>                 Exception in thread "main" java.lang.ClassFormatError:
>                 Repetitive method
>                 name/signature in class file SomeServiceImpl
>                        at java.lang.ClassLoader.defineClass1(Native
>                 Method)
>                        at
>                 java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>                        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:306)
>                        at sun.misc.Launcher
>                 $AppClassLoader.loadClass(Launcher.java:268)
>                        at
>                 java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>                        at
>                 java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>                        at Main.main(Main.java:3)
>                 
>                 Any of the following will remove this issue:
>                 
>                 1) Removing pertypewithin(*) from the aspect
>                 2) Renaming SomeServiceImpl to ASomeServiceImpl, or
>                 anything so is
>                 before GenericServiceImpl alphabetically.
>                 3) Compiling SomeServiceImpl again after cleaning
>                 (whitespace
>                 modification and save).
>                 4) Commenting the doStuff method out from
>                 SomeServiceImpl class.
>                 5) Changing method signature in SomeServiceImpl to
>                 take T (T extends
>                 SomeInterface) as the argument.
>                 
>                 The difference between working and not working .class
>                 files I get is
>                 that there is an additional method descriptor in the
>                 one that does not
>                 work:
>                 
>                  // Method descriptor #15 (LSomeInterface;)V
>                  // Stack: 2, Locals: 2
>                  public bridge void doStuff(SomeInterface arg0);
>                    0  aload_0
>                    1  aload_1
>                    2  invokevirtual
>                 SomeServiceImpl.doStuff(SomeInterface) : void [36]
>                    5  return
>                      Line numbers:
>                        [pc: 0, line: 1]
>                 
>                 And here are my versions:
>                 Eclipse Platform
>                 
>                 Version: 3.4.1
>                 Build id: M20080911-1700
>                 
>                 Eclipse AspectJ Development Tools
>                 
>                 Version: 1.6.1.20081104192500
>                 AspectJ version: 1.6.3.20081028135200
>                 
>                 java version "1.5.0_16"
>                 Java(TM) 2 Runtime Environment, Standard Edition
>                 (build 1.5.0_16-b02)
>                 Java HotSpot(TM) Server VM (build 1.5.0_16-b02, mixed
>                 mode)
>                 
>                 Has anyone experienced and maybe resolved this issue?
>                 I tried to browse
>                 the bug reports but couldn't find anything that seemed
>                 like a match.
>                 
>                 Thanks in advance,
>                 Jouni Lantinen
>                 
>                 _______________________________________________
>                 aspectj-users mailing list
>                 aspectj-users@xxxxxxxxxxx
>                 https://dev.eclipse.org/mailman/listinfo/aspectj-users
>         
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top