Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » package binding
package binding [message #250424] Thu, 03 January 2008 00:02 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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?
Previous Topic:Where is it stored whether a directory is 'derived'?
Next Topic:linux 32 bit jdk
Goto Forum:
  


Current Time: Wed Feb 05 06:36:18 GMT 2025

Powered by FUDForum. Page generated in 0.02878 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top