| Summary: | Compiler crash on second constructor if uncheckedTypeOperation warning is enabled | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Andrey Loskutov <loskutov> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | stephan.herrmann |
| Version: | 4.6 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
Andrey is using raw types? And calls that code "innocent"? Unbelievable! :p (In reply to Stephan Herrmann from comment #1) > Andrey is using raw types? And calls that code "innocent"? Unbelievable! :p (-: Actually a colleague found this, I've just reduced the problem to a reproducible example. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
This innocent code below causes compiler crash and build error (in both 4.6.3 and 4.7 I20170409-2000). Commenting out the second constuctor makes compiler happy :-) The problem occurs only if the preference below is set: org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning In the debugger I see that in org.eclipse.jdt.internal.compiler.ast.Expression.forcedToBeRaw(ReferenceContext) line 1090: if (TypeBinding.notEquals(field.declaringClass, methodDecl.binding.declaringClass)) "methodDecl.binding" is null. null org.eclipse.jdt.core Error Tue Apr 11 17:06:05 CEST 2017 Exception occurred during problem detection: ----------------------------------- SOURCE BEGIN ------------------------------------- import java.util.Collections; import java.util.Map; class X { Map<String, Boolean> pass = Collections.EMPTY_MAP; public X(Map<String, Boolean> pass) { this.pass = pass; } public X(Map<String, Boolean> pass) { pass = Collections.EMPTY_MAP; } } ----------------------------------- SOURCE END ------------------------------------- java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.ast.Expression.forcedToBeRaw(Expression.java:1090) at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.unsafeTypeConversion(ProblemReporter.java:8643) at org.eclipse.jdt.internal.compiler.ast.Assignment.checkAssignment(Assignment.java:126) at org.eclipse.jdt.internal.compiler.ast.Assignment.resolveType(Assignment.java:224) at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:1026) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:634) at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.resolveStatements(ConstructorDeclaration.java:600) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:544) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1195) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1308) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:605) at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:1030) at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:1075) at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:205) at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:271) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:191) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:90) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:724) at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:790) at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1250) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:128) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:110) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:90) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:87) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:154) at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:89) at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:104) at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:73) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:207)