Bug 558995 - NullPointerException at org.aspectj.weaver.ReferenceType.getWeaverState
Summary: NullPointerException at org.aspectj.weaver.ReferenceType.getWeaverState
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.9.5   Edit
Hardware: PC Windows 8
: P3 major (vote)
Target Milestone: 1.9.6   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-09 15:38 EST by Oliver CLA
Modified: 2020-04-22 13:43 EDT (History)
2 users (show)

See Also:


Attachments
Maven project to reproduce NPE (14.64 KB, application/x-zip-compressed)
2020-01-09 15:38 EST, Oliver CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver CLA 2020-01-09 15:38:05 EST
Created attachment 281434 [details]
Maven project to reproduce NPE

After updating the PatternTesting project from AspectJ 1.8.x to 1.9.5 one module crashed during compilation with

java.lang.NullPointerException
	at org.aspectj.weaver.ReferenceType.getWeaverState(ReferenceType.java:680)
	at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:693)
	at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:672)
	at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1453)
	at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:1046)

Steps to reproduce the NPE:
- extract attached ZIP file (with Maven project inside)
- change to the extracted project (`cd aspectj-NPE`)
- compile: `mvn clean compile`

You'll find also an ajcore-file inside from the crash. It happens not only on Windows put also on MacOS
Comment 1 Matt Benson CLA 2020-04-01 14:13:34 EDT
I am also experiencing this issue upgrading 1.8.4 to 1.9.5 (in order to resolve generic parameter compile issues). Also MacOS here; 1.9.4 does not produce the same problem.
Comment 2 Andrew Clement CLA 2020-04-21 20:51:36 EDT
Thanks so much for the testcase.

The type for which we are having trouble (null delegate) is: 
patterntesting.concurrent.SynchronizedAspect$ajcMightHaveAspect

This is one of the synthetic classes generated during matching.

I think this is due to JDT updating much more frequently than it used to, to keep up with Java versions. They are changing many things that are hitting us (when we used to be on the same version for years at a time).

In this case it looks like it is asking to resolve types earlier than it used to, for computing stack map frames in the bytecode.
Comment 3 Andrew Clement CLA 2020-04-22 13:43:41 EDT
Fixed for the problematic project here. I initialized the delegate for the synthetic type early enough to keep the process happy.