Bug 155003 - [model] Missing exception types / wrong signature?
Summary: [model] Missing exception types / wrong signature?
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.3 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-24 04:42 EDT by Dani Megert CLA
Modified: 2006-12-12 05:06 EST (History)
2 users (show)

See Also:


Attachments
Proposed patch (12.08 KB, patch)
2006-10-26 10:33 EDT, Frederic Fusier CLA
no flags Details | Diff
New proposed patch (15.43 KB, patch)
2006-10-28 12:13 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2006-08-24 04:42:40 EDT
R3.2 and 3.3 M1

Hovering over a binary method call no longer shows the exception types. Tracked this down to JavaElementLabels line 476 and 477 where a wrong signature seems to be produced (for the test case below the signature is "()!+LTest;".

This used to work in 3.1 and should be fixed for 3.2.1

Test Case: hover over "newInstance" in the code below:
public class Test {
    public void x() throws InstantiationException, IllegalAccessException {
	    getClass().newInstance();
    }
}
Comment 1 Dani Megert CLA 2006-08-24 04:48:43 EDT
>This used to work in 3.1 and should be fixed for 3.2.1
Not true: it stopped working in R3.1 ==> not necessary a 3.2.1 candidate. Reducing severity to major.
Comment 2 Frederic Fusier CLA 2006-10-08 07:35:37 EDT
Jerome, looking at code, it seems that thrown exceptions are only added in method signature for generic/parameterized types but I cannot see this point specified in Signature.getThrownExceptionTypes(...) javadoc comment methods. Is there any reason why thrown exceptions have not been added for "standard" methods?
Comment 3 Jerome Lanneluc CLA 2006-10-09 04:27:08 EDT
I don't see any reasons why they should not be added. I think this is just an oversight.
Comment 4 Frederic Fusier CLA 2006-10-26 10:33:50 EDT
Created attachment 52751 [details]
Proposed patch

Include additional tests on SignatureTests (#testGetThrownExceptions_Bug155003()) and ASTConverter15Test (#testBug155003() and #testBug155003_Generic()).

All JDT/Core tests pass.

Jerome, may you review this patch?
Thanks
Comment 5 Frederic Fusier CLA 2006-10-28 12:13:16 EDT
Created attachment 52906 [details]
New proposed patch

Previous patch wrongly changed KeyToSignature.toSignature() output although it should not as its behavior is API...
Change has been done to store additional thrown exceptions in a specific field and make it accessible to BindingKey through #getThrownExceptions() new method...
Comment 6 Jerome Lanneluc CLA 2006-11-06 06:29:42 EST
Patch looks good. 
Just need to add '@since 3.3' in BindingKey#getThrownExceptions().
Comment 7 Frederic Fusier CLA 2006-11-06 09:18:09 EST
(In reply to comment #6)
> Patch looks good. 
> Just need to add '@since 3.3' in BindingKey#getThrownExceptions().
> 
Thanks Jerome for the review => tag added...

Released for 3.3 M4 in HEAD stream.
Comment 8 Frederic Fusier CLA 2006-11-07 04:27:46 EST
Dani, Martin,

I forgot to precise that to be _really_ fixed, following change needs to be done in JavaElementLabels line 584 (in method getMethodLabel):
	types= resolvedKey.getThrownExceptions();
instead of:
	types= Signature.getThrownExceptionTypes(resolvedSig);

May you fix it before today's integration build?
Thanks
Comment 9 Martin Aeschlimann CLA 2006-11-07 06:40:14 EST
I updated our code, but I still can't see the exceptions for 'newInstance()'

Key is now:
Ljunit/awtui/Test;&Ljava/lang/Class<!Ljava/lang/Class;+Ljunit/awtui/Test;141;>;.newInstance()!+Ljunit/awtui/Test;|Ljava/lang/InstantiationException;|Ljava/lang/IllegalAccessException;

The code seems to look for a '^'
Comment 10 Frederic Fusier CLA 2006-11-07 07:23:17 EST
Indeed, it still does not work for some 1.5 syntaxes. My test cases have some but in fact comment 0 test case works with JRE 1.4 but not using JRE 1.5, that explains why I missed this failure...
Comment 11 Frederic Fusier CLA 2006-11-07 07:34:59 EST
Problem only happens with message sends on captures. I'd prefer closing this one and open a new specific bug as it is a more general problem on binding keys: captures are not decoded properly...
Comment 12 Frederic Fusier CLA 2006-11-07 07:48:30 EST
I've opened bug 163647 for this specific binding key parser issue
Comment 13 David Audel CLA 2006-12-12 05:06:29 EST
Verified for 3.3M4 with I20061212-0010.