Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20][record pattern] NPE with records pattern type inference #910

Closed
mpalat opened this issue Mar 27, 2023 · 1 comment
Closed

[20][record pattern] NPE with records pattern type inference #910

mpalat opened this issue Mar 27, 2023 · 1 comment
Assignees
Milestone

Comments

@mpalat
Copy link
Contributor

mpalat commented Mar 27, 2023

Ref
interface I {
int a();
}

record R(T a) {}

public class X {

private static boolean test(R<? extends I> p) {
    if (p instanceof R(String a)) {
         return a instanceof String;
    }
    return true;
}

public static void main(String argv[]) {
    System.out.println(test(new R<>((I) () -> 0))); 
}

}

get this.resolved.type == null
Java Model Exception: java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.internal.compiler.lookup.TypeBinding.isValidBinding()" because "this.resolvedType" is null
at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:326)
at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:193)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:266)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:597)
at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:1148)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:173)

@mpalat mpalat self-assigned this Mar 27, 2023
@mpalat mpalat added this to the 4.28 milestone Mar 27, 2023
@mpalat mpalat mentioned this issue Mar 27, 2023
3 tasks
@mpalat
Copy link
Contributor Author

mpalat commented Mar 28, 2023

resolved

@mpalat mpalat closed this as completed Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant