Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 425585

Summary: Bad recovered type binding for qualified parameterized type
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: srikanth_sankaran
Version: 4.3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Markus Keller CLA 2014-01-13 11:58:49 EST
4.3.1

- have this code (with unresolved "Bar"):

    void foo(String.Bar<Object> arg) { }

- select "Bar"
- press Ctrl+1
=> IAE in log; preview for "Assign parameter to new field" quick assist fails

The problem is in the recovered binding for the SingleVariableDeclaration for "arg": IVariableBinding#getType() returns an ITypeBinding whose #getTypeDeclaration() returns itself. But the binding is for a parameterized type, so the declaration binding should not have type arguments any more.

When I remove the "String." qualifier, the bindings are fine (but I still only get a parameterized type binding via the IVariableBinding, but not when resolving the binding of the ParameterizedType node itself).


!ENTRY org.eclipse.jface.text 2 0 2014-01-13 17:40:36.904
!MESSAGE
!STACK 0
java.lang.IllegalArgumentException
        at org.eclipse.jdt.core.dom.SimpleName.setIdentifier(SimpleName.java:198)
        at org.eclipse.jdt.core.dom.AST.newSimpleName(AST.java:2045)
        at org.eclipse.jdt.core.dom.AST.newName(AST.java:1795)
        at org.eclipse.jdt.core.dom.rewrite.ImportRewrite.addImport(ImportRewrite.java:726)
        at org.eclipse.jdt.internal.ui.text.correction.proposals.AssignToVariableAssistProposal.evaluateType(AssignToVariableAssistProposal.java:356)
        at org.eclipse.jdt.internal.ui.text.correction.proposals.AssignToVariableAssistProposal.addFieldDeclaration(AssignToVariableAssistProposal.java:335)
        at org.eclipse.jdt.internal.ui.text.correction.proposals.AssignToVariableAssistProposal.doAddField(AssignToVariableAssistProposal.java:256)
        at org.eclipse.jdt.internal.ui.text.correction.proposals.AssignToVariableAssistProposal.getRewrite(AssignToVariableAssistProposal.java:139)
        at org.eclipse.jdt.ui.text.java.correction.ASTRewriteCorrectionProposal.addEdits(ASTRewriteCorrectionProposal.java:113)
        at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.createTextChange(CUCorrectionProposal.java:234)
        at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.createChange(CUCorrectionProposal.java:244)
        at org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal.getChange(ChangeCorrectionProposal.java:372)
        at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.getTextChange(CUCorrectionProposal.java:254)
        at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.getAdditionalProposalInfo(CUCorrectionProposal.java:141)
        at org.eclipse.jface.text.contentassist.AdditionalInfoController$3.run(AdditionalInfoController.java:106)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Comment 1 Eclipse Genie CLA 2020-05-16 16:53:38 EDT
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.