Summary: | [ast/dom] type bindings that return null for superclass | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Jim des Rivieres <jeem> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | hallorant, philippe_mulet |
Version: | 2.0 | ||
Target Milestone: | 2.1 M5 | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Jim des Rivieres
2002-11-14 11:48:57 EST
You can look at the qualified name of the type binding. If it if 'java.lang.Object' you found it. (From the jdt-core-dev mailing list) a good approach that maybe should be wrapped into a convience API method...Tim Jim des Rivieres <Jim_des_Rivieres@oti.com> To:jdt-core-dev@eclipse.org Subject:[jdt-core-dev] ITypeBinding - How to tell your at "java.lang.Object"? Date:13 Nov 2002 19:17:46 -0500 Tim, Since java.lang.Object is the only genuine class without a superclass, you could also use typeBinding.isClass() && typeBinding.getSuperclass() == null ---jim Another idea: From: Dirk Baeumer <Dirk_Baeumer@oti.com> To: jdt-core-dev@eclipse.org Subject: Re: [jdt-core-dev] ITypeBinding - How to tell your at "java.lang.Object"? Date: 14 Nov 2002 18:45:49 +0100 Another idea is to compare the binding with the binding returned from AST#resolveWellKnownType("java.lang.Object"); Dirk The latter suggestion should be added to the superclass API. Jim - please update the API Added the following para to javadoc for ITypeBinding.getSuperclass(): "Loops that ascend the class hierarchy need a suitable termination test. Rather than test the superclass for <code>null</code>, it is more transparent to check whether the class is <code>Object</code>, by comparing whether the class binding is identical to <code>ast.resolveWellKnownType("java.lang.Object")</code>." Closing. Doc fixed. Verified. |