Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Fwd: ClassCastException: ConstantUtf8 cannot be cast to ConstantInvokeDynamic

Hi,

That's pretty serious. I'd like to fix it but I can't build your project to recreate it (using git clone/mvn compile) - can you raise an AspectJ issue https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ and attach or point me to something I can build to recreate it?

thanks,
Andy

On 28 September 2014 10:57, José San Leandro <jose.sanleandro@xxxxxxxxxxx> wrote:
Hi,

When compiling a simple project [1] using aspectj-maven-plugin, I get the error below. It only happens when the pointcut gets applied. If I make the pointcut intercept nothing [2], it compiles successfully.

[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.7:compile (default) on project lambda-control-flow-poc: AJC compiler errors:
[ERROR] error at (no source information available)
[ERROR] /home/chous/github/LambdaControlFlowPoC/src/main/java/org/acmsl/pocs/lambdafor/ControlFlowDriver.java:0::0 Internal compiler error: java.lang.ClassCastException: org.aspectj.apache.bcel.classfile.ConstantUtf8 cannot be cast to org.aspectj.apache.bcel.classfile.ConstantInvokeDynamic at org.aspectj.apache.bcel.generic.InvokeDynamic.getSignature(InvokeDynamic.java:108)
[ERROR] abort ABORT -- (ClassCastException) org.aspectj.apache.bcel.classfile.ConstantUtf8 cannot be cast to org.aspectj.apache.bcel.classfile.ConstantInvokeDynamic
[ERROR] org.aspectj.apache.bcel.classfile.ConstantUtf8 cannot be cast to org.aspectj.apache.bcel.classfile.ConstantInvokeDynamic
[ERROR] java.lang.ClassCastException: org.aspectj.apache.bcel.classfile.ConstantUtf8 cannot be cast to org.aspectj.apache.bcel.classfile.ConstantInvokeDynamic
[ERROR] at org.aspectj.apache.bcel.generic.InvokeDynamic.getSignature(InvokeDynamic.java:108)
[ERROR] at org.aspectj.apache.bcel.generic.InvokeDynamic.getReturnType(InvokeDynamic.java:99)
[ERROR] at org.aspectj.apache.bcel.generic.InvokeInstruction.produceStack(InvokeInstruction.java:107)
[ERROR] at org.aspectj.apache.bcel.generic.MethodGen.getMaxStack(MethodGen.java:988)
[ERROR] at org.aspectj.apache.bcel.generic.MethodGen.setMaxStack(MethodGen.java:876)
[ERROR] at org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:1019)

The context is:
- Project uses lambda expressions.
- Java 1.8.11 on gentoo linux 64b.
- aspectjrt, aspectjtools 1.8.2
- aspectj-maven-plugin 1.7

[1] https://github.com/rydnr/LambdaControlFlowPoC
[2] https://github.com/rydnr/LambdaControlFlowPoC/blob/master/src/main/aspect/org/acmsl/pocs/lambdafor/ForReplacer.aj

I'm attaching the effective pom should it helps to figure out the issue.

I've downloaded aspectj 1.8.2 sources, and when debugging, the invalid cast is produced by extracting "org/acmsl/pocs/lambdafor/ControlFlowCommand" String from the constant pool at index 62.
I've no idea what could be causing this. I've tried adding some defensive programming hacks but it causes one NPE in the caller for each guarding condition. I think InvokeDynamic class is not prepared yet to handle ConstantUtf8 instances, but I'm far from solving this by myself.

Thank you very much in advance.

Jose.


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top