Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] ITypeBinding - How to tell your at "java.lang.Object"?

Tim,  Since java.lang.Object is the only genuine class without a
superclass, you could also use
      typeBinding.isClass() && typeBinding.getSuperclass() == null
---jim



                                                                                                                                        
                      Timothy Halloran                                                                                                  
                      <thallora@xxxxxxxxx         To:      jdt-core-dev@xxxxxxxxxxx                                                     
                      .CMU.EDU>                   cc:                                                                                   
                      Sent by:                    Subject: [jdt-core-dev] ITypeBinding - How to tell your at "java.lang.Object"?        
                      jdt-core-dev-admin@                                                                                               
                      eclipse.org                                                                                                       
                                                                                                                                        
                                                                                                                                        
                      11/13/2002 04:07 PM                                                                                               
                      Please respond to                                                                                                 
                      jdt-core-dev                                                                                                      
                                                                                                                                        
                                                                                                                                        



If one walks up the type hierarchy using ITypeBindings it appears a bit
difficult to figure out you are at the top (e.g., you get null from an
getSuperclass() method call).  The problem is "null" from this call can
reasonably mean a few other things as well.

I've compared the fully qualified name to "java.lang.Object" but I'm
wondering if there is a better way?

Should there be a "boolean isJavaLangObject()" method that returns true
if the type is "java.lang.Object", and false otherwise?

Thoughts?

Take Care,
Tim Halloran
Carnegie Mellon University


_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev






Back to the top