Skip to content

NPE during incremental compilation #332

@zuckel

Description

@zuckel

I've run into another compiler problem. This time it seems like it's only an "incremental" problem that I am unable to trigger from the command line because the compiler will fail already for the previous class.

See https://github.com/zuckel/aspectj-nullbinding-reproducer for a reproducer (will at least fail in Eclipse 4.35 with AJDT 2.2.4).

Setup

This is really all about the missing import in class Outer. Also while it does not matter if Inner is a class or record and if trigger is a (record) field or a normal method, it seems that Outer has to be a record.

Without the import, class FailsToCompile fails to compile if trigger() is called starting from outer.

Code

package a;
public record Inner(boolean trigger){}
package b;
//import a.Inner;
public record Outer(Inner inner) {
}
package b;
public class FailsToCompile {
    public void method(Outer outer) {
        outer.inner().trigger();
    }
}

Exception

java.lang.NullPointerException
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:162)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:172)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:988)
at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDecl ... lPointerException thrown: Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding.isStatic()" because "this.binding" is null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions