Bug 37256 - ClassDefNotFoundError on spacewar edit
Summary: ClassDefNotFoundError on spacewar edit
Status: RESOLVED DUPLICATE of bug 34206
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-06 05:22 EDT by Wes Isberg CLA
Modified: 2003-05-06 14:20 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wes Isberg CLA 2003-05-06 05:22:55 EDT
After changing line 198 of spacewar/Debug.java from

  info.setEditable(false);

to

  info.setEditable(false);
  info.addNotify();

get ClassDefNotFoundError when trying to run.

True of compiler in 1.1rc1 and current tree, and when
running java 1.1, 1.3, and 1.4.

  $ cd examples
  $ mkdir classes
  $ ../../bin/ajc -d classes -classpath ../../lib/aspectjrt.jar \
   -argfile spacewar/debug.lst
  $ java -classpath "classes;../../lib/aspectjrt.jar" spacewar.Game

  Exception in thread "main" java.lang.NoClassDefFoundError
        at spacewar.Game.main(Game.java:45) 

  $ jar -tf  ../../lib/aspectjrt.jar org/aspectj/lang/JoinPoint.class
  org/aspectj/lang/JoinPoint.class
Comment 1 Jim Hugunin CLA 2003-05-06 14:20:55 EDT
This is a dup of bug #34206.  This is another example of the sort of strange 
behavior you can get with before+pure after advice.  You're seeing this 
problem because there is an exception being thrown during the class 
initializer of the Debug aspect (which has the dangerous before+pure after 
advice).

The "fix" is to change all of the after advice in Debug.java to after 
returning advice.  There's no good reason not to do this and that will make 
the failure much more graceful.  Here's the stack trace you see when doing 
that:

java.lang.ExceptionInInitializerError: java.lang.NullPointerException: peer
	at sun.awt.windows.WTextAreaPeer.create(Native Method)
	at sun.awt.windows.WComponentPeer.<init>(WComponentPeer.java:375)
	at sun.awt.windows.WTextComponentPeer.<init>
(WTextComponentPeer.java:39)
	at sun.awt.windows.WTextAreaPeer.<init>(WTextAreaPeer.java:47)
	at sun.awt.windows.WToolkit.createTextArea(WToolkit.java:267)
	at java.awt.TextArea.addNotify(TextArea.java:230)
	at spacewar.InfoWin.<init>(Debug.java:200)
	at spacewar.Debug.<clinit>(Debug.java:58)
	at spacewar.Game.main(Game.java)
Exception in thread "main"

I don't understand what's wrong with the code here, but this makes it clear 
that the underlying issue is something in the AWT.

ajc should probably add an exception handler to every aspect's clint method 
that will somehow produce a useful message for the user.  However, failures in 
clinit can have very unusual behavior and this will take some thought to 
handle correctly.

See the duplicate bug for another manifestation of this same confusing 
behavior.



*** This bug has been marked as a duplicate of 34206 ***