Community
Participate
Working Groups
Created attachment 259112 [details] Tar file with maven project to reproduce error During maven build with aspectj-maven-plugin I got the following NullPointerException: [ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.8:compile (compile) on project patterntesting-check-rt: AJC compiler errors: [ERROR] abort ABORT -- (NullPointerException) null [ERROR] null [ERROR] java.lang.NullPointerException [ERROR] at org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration.isAtAspectJ(PointcutDeclaration.java:122) [ERROR] at org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration.postParse(PointcutDeclaration.java:94) [ERROR] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope.postParse(ClassScope.java:215) [ERROR] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope.buildFieldsAndMethods(ClassScope.java:191) [ERROR] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildFieldsAndMethods(CompilationUnitScope.java:84) [ERROR] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.completeTypeBindings(AjLookupEnvironment.java:141) [ERROR] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:852) [ERROR] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:385) [ERROR] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:428) [ERROR] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:1036) [ERROR] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:272) [ERROR] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:185) [ERROR] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:114) [ERROR] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [ERROR] at org.aspectj.tools.ajc.Main.run(Main.java:371) [ERROR] at org.aspectj.tools.ajc.Main.runMain(Main.java:248) [ERROR] at org.codehaus.mojo.aspectj.AbstractAjcCompiler.execute(AbstractAjcCompiler.java:537) From the listed stacktrace it seems to be a bug of the AspectJ compiler or AJDT. The problem only occurs on Linux (tested with Ubuntu 14.04 and Debian) with Java 8 or Java 7, and with Maven 3.3 and Maven 3.0. The bug does not appear on MacOS. Steps to reproduce the error: 1. Extract the attached 'testcase.tgz' on a Linux machine 2. go to the directory testcase/patterntesting-check-rt 3. start 'mvn clean compile'
Created attachment 259673 [details] ajcore file Looks like the build server runs only an JRE, not an JDK. But nevertheless a NPE should not happen...
Actually an AspectJ bug. Thanks for the testcode. I've fixed it up and committed the changes into AspectJ with a test. The problem was that the code was attempting to look at annotations too soon - looking for the resolved type of an annotation just after parsing. I've moved the checks to later on (from postParse() into resolve()).
Worth mentioning it does actually report an error now it is beyond the NPE - related to abstract pointcuts in classes. If those were not abstract you would avoid the error and the NPE (or they need to be in an aspect).