Skip to content

Commit d09514d

Browse files
kriegaexslachiewicz
authored andcommitted
Avoid NPE in AspectJCompilerTest on AspectJ 1.9.8+
Due to changed Eclipse Compiler (JDT Core) upstream of AJC, we need to call 'buildArgParser.populateBuildConfig(..)' in order to avoid an NPE when AjBuildConfig.getCheckedClasspaths() is called later during compilation. Only the unit test (which is not really a unit test) is affected by this problem, because it compiles in-process. The 'aspectj-compiler' IT was still passing before this change.
1 parent 1cc3a76 commit d09514d

File tree

1 file changed

+4
-1
lines changed
  • plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc

1 file changed

+4
-1
lines changed

plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,10 @@ public AspectJMessagePrinter( boolean verbose )
340340
private AjBuildConfig buildCompilerConfig( CompilerConfiguration config )
341341
throws CompilerException
342342
{
343-
AjBuildConfig buildConfig = new AjBuildConfig(new BuildArgParser(new AspectJMessagePrinter(config.isVerbose())));
343+
BuildArgParser buildArgParser = new BuildArgParser(new AspectJMessagePrinter(config.isVerbose()));
344+
AjBuildConfig buildConfig = new AjBuildConfig(buildArgParser);
345+
// Avoid NPE when AjBuildConfig.getCheckedClasspaths() is called later during compilation
346+
buildArgParser.populateBuildConfig(buildConfig, new String[0], true, null);
344347
buildConfig.setIncrementalMode( false );
345348

346349
String[] files = getSourceFiles( config );

0 commit comments

Comments
 (0)