Bug 342054

Summary: ILocalVariable#isParameter() returns true for exception of catch clause
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, Olivier_Thomann, satyam.kandula
Version: 3.7   
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Preo
none
Proposed fix + regression tests none

Description Markus Keller CLA 2011-04-06 13:31:25 EDT
HEAD

ILocalVariable#isParameter() returns true for exception of catch clause:

    void m() {
        try {
            
        } catch (Exception e) {
            
        }
    }
Comment 1 Olivier Thomann CLA 2011-04-06 15:31:16 EDT
This is true only when the ILocalVariable is created from the selection node.
Catch clause locals are created as arguments, but right now there is no way to know that this local is part of a catch clause and not a method parameter.
Comment 2 Olivier Thomann CLA 2011-04-06 18:23:37 EDT
Created attachment 192678 [details]
Preo
Comment 3 Olivier Thomann CLA 2011-04-06 18:24:05 EDT
Created attachment 192679 [details]
Proposed fix + regression tests
Comment 4 Olivier Thomann CLA 2011-04-06 18:24:35 EDT
Released for 3.7M7.
Only the selection node was broken.
Comment 5 Olivier Thomann CLA 2011-04-06 18:25:20 EDT
Parser resources need to be generated to apply the source patch on head.
Comment 6 Satyam Kandula CLA 2011-04-07 09:54:22 EDT
Olivier, I was wondering if this should really need a grammar change. Can't this be done by just clearing the IsArgument flag in consumeCatchHeader()? I haven't tried this out and may be missing something.
Comment 7 Olivier Thomann CLA 2011-04-07 10:09:20 EDT
(In reply to comment #6)
> Olivier, I was wondering if this should really need a grammar change. Can't
> this be done by just clearing the IsArgument flag in consumeCatchHeader()? I
> haven't tried this out and may be missing something.
Unfortunately this rule is only used in the recovery. Since in Java 7 branch we also have a consumeCatchFormalParameter() method, this was the easiest way to fix it.
Comment 8 Satyam Kandula CLA 2011-04-08 06:32:25 EDT
(In reply to comment #7)
> Unfortunately this rule is only used in the recovery. Since in Java 7 branch we
> also have a consumeCatchFormalParameter() method, this was the easiest way to
> fix it.
Thanks for the explanation.
Comment 9 Jay Arthanareeswaran CLA 2011-04-26 06:19:34 EDT
Verified for 3.7M7 using build I20110421-1800