Bug 376139 - AspectJ throws Nullpointer after its IDE plugin update
Summary: AspectJ throws Nullpointer after its IDE plugin update
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: IDE (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 critical with 3 votes (vote)
Target Milestone: 1.7.0   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-05 00:00 EDT by Arpit Mittal CLA
Modified: 2012-04-05 19:14 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arpit Mittal CLA 2012-04-05 00:00:07 EDT
Build Identifier: Version: Indigo Service Release 2 Build id: 20120216-1857

java.lang.NullPointerException
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.SwitchStatement.analyseCode(SwitchStatement.java:118)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:104)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:730)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseC ... oBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Compile error: NullPointerException thrown: null

Reproducible: Always

Steps to Reproduce:
1. After updating the eclipse plugin
Comment 1 Adam Gent CLA 2012-04-05 11:54:56 EDT
Showstopper for me. There is no way to workaround other than just letting maven do the work. Back to Eclipse 3.6 .
Comment 2 Adam Gent CLA 2012-04-05 12:04:12 EDT
I found the issue. Empty Switch statements seems to cause the problem.

switch(stuff) {
}

We had left the switch statement there and had commented some of the code out and forgot to remove the whole switch statement.

While it seems to be legally java it seems to break aspectj.
Comment 3 Andrew Clement CLA 2012-04-05 12:06:06 EDT
thanks for discovering that - that's invaluable info!
Comment 4 Arpit Mittal CLA 2012-04-05 12:17:49 EDT
Great Guys.. So when can we get the update (relief), or is there a way to use older version on Eclipse 3.7
Comment 5 Andrew Clement CLA 2012-04-05 12:38:54 EDT
if that is the issue, hopefully in a few hours I'll have something out. (just gotta get through some meetings)
Comment 6 Andrew Clement CLA 2012-04-05 16:15:58 EDT
I guess there is a little more to it as this simple program doesn't seem to fail for me:
===
public class CC {
	public static void main(String[] args) {
		int i=4;
		switch (i) {
		}
	}
}
===
Comment 7 Andrew Clement CLA 2012-04-05 16:25:16 EDT
Got it, the thing being switched on had to be an enum:

enum Color { R,G,B; }

public class C {

        public void foo() {
                Color c;
                switch (c) {
                }
        }
}
Comment 8 Andrew Clement CLA 2012-04-05 19:14:25 EDT
fix committed into AspectJ and into AJDT - should be in a dev build in 2 hours.