Skip to content

Commit 7cb33b3

Browse files
committed
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 72d0b48 commit 7cb33b3

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

Lines changed: 4 additions & 1 deletion
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)