Bug 342054 - ILocalVariable#isParameter() returns true for exception of catch clause
Summary: ILocalVariable#isParameter() returns true for exception of catch clause
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-06 13:31 EDT by Markus Keller CLA
Modified: 2011-04-26 06:19 EDT (History)
3 users (show)

See Also:


Attachments
Preo (142.47 KB, text/plain)
2011-04-06 18:23 EDT, Olivier Thomann CLA
no flags Details
Proposed fix + regression tests (142.47 KB, patch)
2011-04-06 18:24 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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