| Summary: | CCE in InitializeFinalFieldProposal for enum | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Noopur Gupta <noopur_gupta> |
| Component: | UI | Assignee: | Kenneth Styrberg <kenneth> |
| Status: | VERIFIED FIXED | QA Contact: | Roland Grunberg <rgrunber> |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 4.16 | ||
| Target Milestone: | 4.16 M3 | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: |
https://git.eclipse.org/r/163194 https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=359efe357dd13123570f8cccc80bd94425e65350 |
||
| Whiteboard: | |||
| Bug Depends on: | 37872 | ||
| Bug Blocks: | |||
I'll take a look New Gerrit change created: https://git.eclipse.org/r/163194 Gerrit change https://git.eclipse.org/r/163194 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=359efe357dd13123570f8cccc80bd94425e65350 It might be useful to look at other places throughout the codebase where the proposal logic casts to TypeDeclaration, and the user might be in the context of some "sibling" type (eg. EnumDeclaration) where AbstractTypeDeclaration is safer. Verified in eclipse-SDK-4.16M3-win32-x86_64 |
package pp; public enum Organization { toReal, toIrrational, toImaginary, toComplex; public final String instructions; public final String formOptions; private Organization(String instructions, String formOptions) { this.instructions = instructions; this.formOptions = formOptions; } Organization() { // TODO Auto-generated constructor stub } } - Hover on the error at "Organization" to get the quick fixes. We get the following exception in error log view: java.lang.ClassCastException: class org.eclipse.jdt.core.dom.EnumDeclaration cannot be cast to class org.eclipse.jdt.core.dom.TypeDeclaration (org.eclipse.jdt.core.dom.EnumDeclaration and org.eclipse.jdt.core.dom.TypeDeclaration are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @1f4bdf41) at org.eclipse.jdt.internal.ui.text.correction.proposals.InitializeFinalFieldProposal.doUpdateConstructorWithParameter(InitializeFinalFieldProposal.java:253) at org.eclipse.jdt.internal.ui.text.correction.proposals.InitializeFinalFieldProposal.getRewrite(InitializeFinalFieldProposal.java:117) at org.eclipse.jdt.internal.ui.text.correction.proposals.InitializeFinalFieldProposal.hasProposal(InitializeFinalFieldProposal.java:101) at org.eclipse.jdt.internal.ui.text.correction.UnInitializedFinalFieldSubProcessor.getProposals(UnInitializedFinalFieldSubProcessor.java:73) at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.process(QuickFixProcessor.java:395) ...