Community
Participate
Working Groups
Converted a large, legacy Java project to and AspectJ project, attempted to build and received the following error: java.lang.IllegalStateException at org.aspectj.apache.bcel.generic.MethodGen.getMethod(MethodGen.java:699) at org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:491) at org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:515) at org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:697) at org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1440) at org.aspect ... va/lang/String;Ljava/util/Map;Ljava/util/Map;[Lcom/orora/arcade/design/netlist/model/INetlistTerminal;Ljava/util/List;Ljava/util/Map;Ljava/util/Set;)V Eclipse version: Luna SR2 (4.4.2) I used the following link to install: http://download.eclipse.org/tools/ajdt/44/dev/update
Just to give some additional information the weaver plugin jar is: org.aspectj.weaver_1.8.6.20150608154244.jar
When that exception is thrown it includes the underlying exception that triggered the failure - was there some more to that stack trace? it would be logged after the stack trace for the IllegalStateException. My only initial thought is that the method may be too big (sometimes advising it can blow the 64k byte code limit depending on the original method size and the amount of advice being applied to it).
This is a good point. I glanced at the source code and noticed that when this exception is thrown, it includes the underlying exception that causes it. However, there was no additional stack trace information printed. I thought that the reason might be that I was using a version of the jar that was out of sync with the current source. If this is true and you guys want to update the jar in the eclipse repository, I could update, try again, hopefully get a better stack trace. The only AspectJ that is being applied is this: ***************************************************************** import javax.swing.*; aspect EdtRuleChecker { private boolean isStressChecking = true; public pointcut anySwingMethods(JComponent c): target(c) && call(* *(..)); public pointcut threadSafeMethods(): call(* repaint(..)) || call(* revalidate()) || call(* invalidate()) || call(* getListeners(..)) || call(* add*Listener(..)) || call(* remove*Listener(..)); //calls of any JComponent method, including subclasses before(JComponent c): anySwingMethods(c) && !threadSafeMethods() && !within(EdtRuleChecker) { if(!SwingUtilities.isEventDispatchThread() && (isStressChecking || c.isShowing())) { System.err.println(thisJoinPoint.getSourceLocation()); System.err.println(thisJoinPoint.getSignature()); System.err.println(); } } //calls of any JComponent constructor, including subclasses before(): call(JComponent+.new(..)) { if (isStressChecking && !SwingUtilities.isEventDispatchThread()) { System.err.println(thisJoinPoint.getSourceLocation()); System.err.println(thisJoinPoint.getSignature() + " *constructor*"); System.err.println(); } } } ***************************************************************** I copied from this site: https://weblogs.java.net/blog/2006/02/16/debugging-swing-final-summary Also, it's not clear which particular method is causing this error, so I can't comment on how large it is. Thanks so much!
That code hasn't changed for a while so I don't think you could be picking up an old version. I note your stack trace also didn't include the text of the IllegalStateException message - I've seen this sometimes vary across JVMs. What JVM are you on, is there a more recent one to try it on?