AspectJ - NullPointerException when building and compiling project - java

Edit: I fixed this by starting an entirely new workspace and creating new projects. Everything compiles and builds now. I can't answer my own questions yet, so I'll just put this here! I'm not deleting this post since it might be useful to others.
I had to reinstall Eclipse from scratch. I decided to go with the newest version. I also installed the AspectJ plugin from the Eclipse Marketplace since my project uses AspectJ. Now, I have done this a few times before and I usually get issues with AspectJ. After cleaning and rebuilding and readding the projects a few times the build errors usually disappear.
But now I can't get past it. Whenever I try to build my project, I get the following error:
java.lang.NullPointerException
at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.unnecessaryCast(ProblemReporter.java:7066)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CastExpression.resolveType(CastExpression.java:512)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Assignment.resolveType(Assignment.java:150)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:947) ... oBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Compile error: NullPointerException thrown: null
The build fails at that point.
I have tried using an Indigo version of Eclipse with the Indigo version of AJDT. No luck.
I have tried reverting back to a stable branch in GIT and rebuilding. Again, same error. I've tried searching online but haven't found anything.
I am able to compile the program using an ant script that uses Java 1.6 and AspectJ 1.6.
I'm not sure where to go next to solve this problem. I am also wondering if anyone has had similar issues.
Thank you!

Related

Eclipse-PMD : error while installing through eclipse market place

I'm trying to install the PMD source code analyser plugin for Eclipse. It's available through Eclipse Market Place, but I'm getting following problem in the phase of installation :
Why am I getting this problem ?
EDIT
I do not have this menu even though I have added the ruleset configuration file
I'm the creator of eclipse-pmd, the plugin you are trying to install. I tried to install it myself just now and it worked without any problems. So I can only guess what could be the problem in your case:
The repository was temporarily not available
Simply try again.
You are using a (very) old version of Eclipse
The plugin requires Eclipse Indigo (3.7) or later. I tried to install eclipse-pmd with Indigo and Luna just now and it worked both times.
Run Eclipse with Java 7
You need to run Eclipse with a JRE 7 or later. There have been problems during the installation with people using an older JRE in the past. However they could finish the installation but Eclipse silently refused to load the plugin (this has been fixed a few versions ago though).
Proxy configuration
Although unlikely as you came this far, please open the proxy configuration in Eclipse and check if the settings are correct and the domain is accessible.
If you tried everything I suggested above and are still not able to install the plugin, please head over to the project's Github page and open an issue.

Java Compilation Errors: Unsupported Class Version

I recently finished a project in Eclipse and it ran without a problem. Then recently I imported a new assignment to work on for class, but when I did my old project all of a sudden had a x on its icon. I looked through the code, nothing had been changed, but it threw this error in the console:
java.lang.UnsupportedClassVersionError
at java.lang.ClassLoader.defineClass1(Native Method)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:685)
And others. Is this possibly due to the version of java being used or something else?
An UnsupportedClassVersionError is thrown when you use a higher JDK version to compile than when you try to run the program. For example, you compile Program.java using JDK1.7 but then attempt to run using JDK1.6. I am guessing that upon importing the new assignment for your class, you unknowingly adopted to use the JDK that the imported project was compiled in.
I suggest going to Eclipse Preferences and taking a look at your installed JRE's to make sure everything is okay and also to look at the projects Properties and looking at its Build Path. In general, make you you are using a version to run in that is at LEAST what you used to compile it. If you chose a higher version everything will still be okay.
EDIT:
Here is a link for more information on the matter and where I had originally read about this. I knew I had saved the link somewhere.
http://javarevisited.blogspot.com/2011/07/javalangunsupportedclassversionerror.html

Receiving error when I add the scala nature to project in Eclipse

How can I use scala and java within Eclipse ? When I add the scala nature to my project I receive below error :
Errors occurred during the build. Errors running builder 'Scala
Builder' on project 'my-scala-java-project'.
scala/tools/nsc/settings/MutableSettings$SettingValue
I'm using Eclipse Helios with Scala version 2.0.2
Is there a step I am missing or maybe this is a Eclipse/Scala plugin bug ?
The Scala IDE is under rapid development, I'd suggest updating to the latest version first, and if it doesn't solve the issue, contact the developers at the scala-ide-user group.
Btw this thread might help you get started.

Is the Google Eclipse Plugin for Juno (Eclipse 4.2) broken?

I just installed Eclipse EE Juno (4.2) and a whole slew of plugins for it. I am now attempting to install the Google plugin (GAE and GWT) and am getting an error when adding the update site through Juno's Install new software window:
Name: Google-Plugin
Location: http://dl.google.com/eclipse/plugin/4.2
When I try to enter this I get:
Could not find http://dl.google.com/eclipse/plugin/4.2
I see this question from a few months ago. Although I am having a very similar problem, I think I have a different problem altogether.
When I change the Location to http://dl.google.com/eclipse/plugin/3.7, I get the same error (except with 3.7 appended on the end of the error message instead of 4.2). I definitely have Internet access (how else would I be posting this question?!) so that's not the issue. If this was only working for the 4.2 plugin, I would happily try the "workaround" mentioned in the other post, or even step back down to Eclipse 3.7 (I have to have this plugin!) until 4.2 was working. But the fact that it's not even working for 3.7 tells me that something else is awrye here. Thanks in advance!
Edit:
Just to mess around with things, I have downloaded Indigo (3.7) and immediately attempted to install the Google-Eclipse plugin. I entered the following for my update site:
http://dl.google.com/eclipse/plugin/3.7
And received a nasty error:
Artifact not found: http://dl.google.com/eclipse/plugin/3.7/compositeContent.xml.
Artifact not found: http://dl.google.com/eclipse/plugin/3.7/compositeContent.xml.
http://dl.google.com/eclipse/plugin/3.7/compositeContent.xml
Am I going crazy here?!?! I've installed my fair share of Eclipse plugins and never had this much trouble. Especially from Google. And I know its not my Internet connection or my Eclipse instance because before I attempted to install the Google plugin, I installed Subversive, IvyDE and EclEmma...
It was also broken for me a little while ago, but seems to be working now. Maybe the site was down for a bit?
You can try installing the plugin from archive as described in the link:
https://developers.google.com/eclipse/docs/install-from-zip
Basically what you are doing is, you download the plugin as a zip(archive) and browse this archive instead of update site, during the plugin installation.

Groovy, Grails & Eclipse/STS - Bad Version Number

I have a clean, vanilla system (Mac OS 1.5) with Java 6 installed - I have also installed the latest version of Grails (2.0.0.RC3) and STS (2.8.1), together with appropriate extensions:
Grails Support
Groovy 1.8 Compiler
Within STS I have navigated to Peferences -> Groovy -> Compiler and changed it to use version 1.8 compiler (rather than 1.7).
I have then created a blank Grails project from the command-line (using "grails create-app", etc) and everything works fine - I can compile/test/run it.
However, when I access the problem via STS/Eclipse I get a Bad version number being reported on conf/ApplicationResources.groovy; nevertheless, the project still works - I can still compile and run from within STS, but the auto-build feature keeps kicking in and reporting the same compilation problem on this file...
Can anyone shed any light on why this might be and how to solve it?
I have done various clean operations, such as "grails clean" and removed the ~/.grails and ~/.groovy directories in case of a stale class file, but it's made no difference so far...
Any help much appreciated!
It seems my answer to Eclipse problems (not specific to STS) was usually do clean install. You likely have already heard this and perhaps I should not post as an 'answer' (I'm new to stackoverflow) but my team uses IntelliJ IDEA across the board. Some start with STS for familiarity but eventually that gets overridden by IntelliJ's Grails support. It is worth giving it a try over Christmas break. You can try the Ultimate edition (has Grails support) for free for at least 30 days and if you like, you can probably get an extension (I did for several months until my boss stepped up).
Removed comment as issue returned

Categories

Resources