Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] How to resolve the qualified name of a type?

org.eclipse.jdt.core.IType.resolveType("Object") --> {"java.lang", "Object"
}
then it can be turned into a classfile signature using:
org.eclipse.jdt.core.Signature.createTypeSignature(...)

The DOM AST is more heavy weight if the only purpose is to resolve this one
name in the proper context.



|---------+------------------------------>
|         |           Olivier            |
|         |           Thomann/Ottawa/IBM@|
|         |           IBMCA              |
|         |           Sent by:           |
|         |           jdt-core-dev-admin@|
|         |           eclipse.org        |
|         |                              |
|         |                              |
|         |           03/28/2003 07:17 PM|
|         |           Please respond to  |
|         |           jdt-core-dev       |
|         |                              |
|---------+------------------------------>
  >---------------------------------------------------------------------------------------------------------------|
  |                                                                                                               |
  |       To:       jdt-core-dev@xxxxxxxxxxx                                                                      |
  |       cc:                                                                                                     |
  |       Subject:  Re: [jdt-core-dev] How to resolve the qualified name of a type?                               |
  |                                                                                                               |
  >---------------------------------------------------------------------------------------------------------------|





You might want to use DOM/AST APIs with binding resolution.

Therefore when you have a MethodDeclaration, it would be trivial to get it
method signature.

Olivier




                      "Robb, Sam"

                      <sam.robb@timesys.c        To:
<jdt-core-dev@xxxxxxxxxxx>

                      om>                        cc:

                      Sent by:                   Subject:  [jdt-core-dev]
How to resolve the qualified name of a type?
                      jdt-core-dev-admin@

                      eclipse.org



                      03/28/03 12:56 PM

                      Please respond to

                      jdt-core-dev







All,

  I'm currently in a situation where I need to generate the
internal type signatures that will be present in a compiled
class file.  That is, given a method declaration of:

    public void someFunction(String) { ... }

  I want to be able to generate a type signature similar to
that produced by the javap utility:

    (Ljava/lang/String;)V

  Querying an IMethod for the method signature under JDT returns
the following:

    (QString;)V

  What I'd like to know is if there is a straightforward method
of resolving a type name ("String") in the context of a method
declaration or compilation unit.

  I've spent a good part of the last two days going through the
JDT developer documentation and source, trying to figure out if
there's a reasonable way to do this, and so far, I've been drawing
a blank.

  Am I missing something?  Or is this kind of capability not
generally available in the current release of JDT?

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




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







Back to the top