Community
Participate
Working Groups
Tracktrace: Exception in thread "main" java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.lookup.Scope.isBoxingCompatibleWith(Scope.java:3754) at org.eclipse.jdt.internal.compiler.ast.Statement.isBoxingCompatible(Statement.java:448) at org.eclipse.jdt.internal.compiler.ast.AllocationExpression.isBoxingCompatibleWith(AllocationExpression.java:555) at org.eclipse.jdt.internal.compiler.lookup.ConstraintExpressionFormula.reduce(ConstraintExpressionFormula.java:75) at org.eclipse.jdt.internal.compiler.lookup.BoundSet.reduceOneConstraint(BoundSet.java:985) at org.eclipse.jdt.internal.compiler.lookup.InferenceContext18.reduce(InferenceContext18.java:1072) at org.eclipse.jdt.internal.compiler.lookup.InferenceContext18.solve(InferenceContext18.java:1023) at org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding.computeCompatibleMethod18(ParameterizedGenericMethodBinding.java:249) at org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding.computeCompatibleMethod(ParameterizedGenericMethodBinding.java:92) at org.eclipse.jdt.internal.compiler.lookup.Scope.computeCompatibleMethod(Scope.java:841) at org.eclipse.jdt.internal.compiler.lookup.Scope.computeCompatibleMethod(Scope.java:798) at org.eclipse.jdt.internal.compiler.lookup.Scope.findMethod0(Scope.java:1756) at org.eclipse.jdt.internal.compiler.lookup.Scope.findMethod(Scope.java:1657) at org.eclipse.jdt.internal.compiler.lookup.Scope.getImplicitMethod(Scope.java:2627) at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:805) at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:1082) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:664) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:361) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:573) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1490) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1615) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:662) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:902) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1044) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:662) at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1001) Test code: public final class Main<T extends Object> { public static <T extends Object> Main<T> invoke(Object o) { return null; } public void test() { invoke(new Main.Inner()); } } Java Development Tools Core version 3.23.0
Regression in 4.17. 4.16 is OK. Stack from 4.18 head: java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.lookup.Scope.isBoxingCompatibleWith(Scope.java:3753) at org.eclipse.jdt.internal.compiler.ast.Statement.isBoxingCompatible(Statement.java:451) at org.eclipse.jdt.internal.compiler.ast.AllocationExpression.isBoxingCompatibleWith(AllocationExpression.java:555) at org.eclipse.jdt.internal.compiler.lookup.ConstraintExpressionFormula.reduce(ConstraintExpressionFormula.java:75) at org.eclipse.jdt.internal.compiler.lookup.BoundSet.reduceOneConstraint(BoundSet.java:985) at org.eclipse.jdt.internal.compiler.lookup.InferenceContext18.reduce(InferenceContext18.java:1072) at org.eclipse.jdt.internal.compiler.lookup.InferenceContext18.solve(InferenceContext18.java:1023) at org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding.computeCompatibleMethod18(ParameterizedGenericMethodBinding.java:249) at org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding.computeCompatibleMethod(ParameterizedGenericMethodBinding.java:92) at org.eclipse.jdt.internal.compiler.lookup.Scope.computeCompatibleMethod(Scope.java:841) at org.eclipse.jdt.internal.compiler.lookup.Scope.computeCompatibleMethod(Scope.java:798) at org.eclipse.jdt.internal.compiler.lookup.Scope.findMethod0(Scope.java:1756) at org.eclipse.jdt.internal.compiler.lookup.Scope.findMethod(Scope.java:1657) at org.eclipse.jdt.internal.compiler.lookup.Scope.getImplicitMethod(Scope.java:2626) at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:805) at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:1113) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:661) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:362) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:570) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1492) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1617) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:662) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1243) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:714) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1205) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:820) at org.eclipse.jdt.core.manipulation.CoreASTProvider$1.run(CoreASTProvider.java:272) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.jdt.core.manipulation.CoreASTProvider.createAST(CoreASTProvider.java:264) at org.eclipse.jdt.core.manipulation.CoreASTProvider.getAST(CoreASTProvider.java:197) at org.eclipse.jdt.core.manipulation.SharedASTProviderCore.getAST(SharedASTProviderCore.java:138) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:166) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup$1.run(SelectionListenerWithASTManager.java:151) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
This is happening since bug 566125 was fixed. Will take a look.
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/171405
(In reply to Eclipse Genie from comment #3) > New Gerrit change created: > https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/171405 The fix for bug 566125 replaced the call to isCompatibleWith() with isBoxingCompatibleWith(), we also lost a bunch of checks that are required when the allocation expression resolves to a null binding. I have brought those checks back now.
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/171405 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=906149d4e477ce7f1f44620826a862d06f501e19
Verified for Eclipse 4.18 M3 Version: 2020-12 (4.18) with Build id: I20201117-0600