Bug 258905 - making java.lang.AssertionError accessible thru resolveWellKnownType method
Summary: making java.lang.AssertionError accessible thru resolveWellKnownType method
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-16 04:29 EST by Zsolt Thalmeiner CLA
Modified: 2010-09-14 07:49 EDT (History)
2 users (show)

See Also:


Attachments
patch for requested enhancement (1.14 KB, patch)
2008-12-16 04:29 EST, Zsolt Thalmeiner CLA
no flags Details | Diff
Proposed fix (5.80 KB, patch)
2010-08-31 16:07 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 Zsolt Thalmeiner CLA 2008-12-16 04:29:12 EST
Created attachment 120547 [details]
patch for requested enhancement

We are building control flow graphs from Java sources using the Eclipse AST. In the case of assert statement we have to simulate an AssertionError exception. Unfortunately there is no binding information available about the AssertionError class in the AST if the class was not explicitly referenced.

The patch I'm attached to this enhancement proposal contains the solution of this problem. It is a two-line modification of DefaultBindingResolver.resolveWellKnownType method.
Comment 1 Olivier Thomann CLA 2010-08-05 17:39:08 EDT
Will consider for 3.7M2.
AssertionError are linked to the assert statement and as is it mihgt be interesting to expose it as a well known type binding.
Of course javadoc also needs to be updated.
Comment 2 Olivier Thomann CLA 2010-08-31 16:07:41 EDT
Created attachment 177882 [details]
Proposed fix
Comment 3 Olivier Thomann CLA 2010-08-31 16:08:23 EDT
Released for 3.7M2.
Added regression test in:
org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0719
Comment 4 Srikanth Sankaran CLA 2010-09-14 05:21:52 EDT
I noticed two issues with the patch:

1. TESTS_NUMBERS stands uncommented.
2. In the chunk of code below:

+			// none of the well known bindings resolve in a plain AST
+			for (int i = 0; i<wkbs.length; i++) {
+				assertNotNull("No binding for " + wkbs[i], currentAst.resolveWellKnownType(wkbs[i]));
+			}
+
+			// none of the no so well known bindings resolve either
+			for (int i = 0; i<nwkbs.length; i++) {
+				assertNull("Binding for " + nwkbs[i], currentAst.resolveWellKnownType(nwkbs[i]));
+			}

I think the first comment is wrong.

Verified for 3.7 M2 by code inspection.
Comment 5 Olivier Thomann CLA 2010-09-14 07:46:51 EDT
(In reply to comment #4)
> I noticed two issues with the patch:
> 1. TESTS_NUMBERS stands uncommented

> 2. In the chunk of code below:
> I think the first comment is wrong.

I'll fix both problems.
Comment 6 Olivier Thomann CLA 2010-09-14 07:49:38 EDT
Done. We will contribute again to fix this issue.