Bug 163647

Summary: [model] Thrown exceptions are not found in method binding key which have a capture as declaring class
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jerome_lanneluc, martinae
Version: 3.3   
Target Milestone: 3.3 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Frederic Fusier CLA 2006-11-07 07:46:04 EST
Follow-up of bug 155003.

Given example:
public class Test {
    public void x() throws InstantiationException, IllegalAccessException {
            getClass().newInstance();
    }
}
works well with JRE 1.4 but not with JRE 1.5.

It comes from the fact that BindingKeyParser does not parse correctly captures.

As in the example, message newInstance() is send on a capture of Class<Test>, the thrown exceptions are not found in BindingKey as the parser failed after the added capture 'LTest;&' of the signature:
LTest;&Ljava/lang/Class<!Ljava/lang/Class;+LTest;287;>;.newInstance()!+LTest;|Ljava/lang/InstantiationException;|Ljava/lang/IllegalAccessException;
Comment 1 Frederic Fusier CLA 2006-11-07 10:24:52 EST
Initial investigation was wrong. Problem was not the BindingKeyParser unable to parse capture in method binding key. Thrown exceptions were well read but during the parse of the capture (in method #parseTypeWithCapture). This method uses a local parser which stores the thrown exceptions but didn't give them back to the main parser.
Comment 2 Frederic Fusier CLA 2006-11-07 12:24:38 EST
Created attachment 53390 [details]
Proposed patch

Fix this issue by copying stored thrown exception in local parser to main one in KeyToSignature#consumeTypeWithCapture() method...
Comment 3 Frederic Fusier CLA 2006-11-08 02:52:44 EST
Released for 3.3 M4 in HEAD stream.
Comment 4 David Audel CLA 2006-12-12 05:06:27 EST
Verified for 3.3M4 with I20061212-0010.