package binding [message #250424] |
Thu, 03 January 2008 00:02 |
Eclipse User |
|
|
|
Originally posted by: wharley.bea.com
I'm inside an ASTParser callback and I have a package fragment that contains
an org.eclipse.jdt.core.ICompilationUnit that corresponds to
package-info.java; the package has no other contents (no types).
Is it possible to get from this ICompilationUnit to an
org.eclipse.jdt.core.dom.IPackageBinding for the package?
Similarly, is it possible to get from an org.eclipse.jdt.core.IClassFile for
package-info.class to an IPackageBinding for the package?
Thanks!
|
|
|
Re: package binding [message #250458 is a reply to message #250424] |
Sat, 05 January 2008 00:18 |
Eclipse User |
|
|
|
Originally posted by: wharley.bea.com
"Walter Harley" <wharley@bea.com> wrote in message
news:flh8lr$k0c$1@build.eclipse.org...
> I'm inside an ASTParser callback and I have a package fragment that
> contains an org.eclipse.jdt.core.ICompilationUnit that corresponds to
> package-info.java; the package has no other contents (no types).
>
> Is it possible to get from this ICompilationUnit to an
> org.eclipse.jdt.core.dom.IPackageBinding for the package?
>
> Similarly, is it possible to get from an org.eclipse.jdt.core.IClassFile
> for package-info.class to an IPackageBinding for the package?
I was able to get a package binding from the package name alone, by using
ASTRequestor.createBindings() with a binding key that I cobbled up by hand
by changing dots to slashes.
However, I didn't find any public API for "legitimately" creating such a
binding key, nor any javadoc that asserts that is a valid thing to do, so
I'm concerned that I'm relying on implementation details.
BindingKey.createTypeBindingKey() might be able to do the job, but its
javadoc does not say anything about package bindings. Is that what I should
use anyway?
|
|
|
Powered by
FUDForum. Page generated in 0.02878 seconds