Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Classpath incomplete in IJavaProject#findType
Classpath incomplete in IJavaProject#findType [message #148262] Fri, 12 March 2004 06:40 Go to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.de

Hi!

I'm having a problem with the classpath of a project. We have our own
project nature attached to projects and created several classpath containers
plus a managed IVMInstall entry based on the standard JDK
(StandardVMInstallType).

We use JDT API to find a specific typ (IType) in the build path
[IJavaProject#findType(String)].

Now the problem: when I close and reopen a project in workspace, we listen
for resource changes and update our model if a project is opened. In this
case, the IType cannot be found.

During debugging I discovered, that the classpath is incomplete. It only
contains IPackageFragmentRoots from the JRE container and from some other
containers (managed by us). The entries of one specific container are
missing.

When I expand this container in the Package Explorer, then it correctly
resolves and shows the missing entries. But I can refresh my model several
times, the entries are still missing.

If I call IJavaProject#getResolvedClasspath(false) before
IJavaProject#findType I get the complete classpath and the container is
correctly resolved. But the type is still not found.

Now the part I don't understand. If I right click the project in the Package
Explorer and select "Properties" to bring up the "Java Build Path"
properties page, and immediately click OK to close this window after
bringing up (ONLY SHOWING) the "Java Build Path" properties page, and then
refresh my model again, the type is found by IJavaProject#findType(String).

What is going on here? Anybody knows what happen and how I can work around
this (IMHO) bug?

Thanks,
Gunnar
Re: Classpath incomplete in IJavaProject#findType [message #148266 is a reply to message #148262] Fri, 12 March 2004 08:18 Go to previous message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.de

Gunnar Wagenknecht wrote:

> What is going on here? Anybody knows what happen and how I can work
> around this (IMHO) bug?

The following code snipped works:

javaProject.getResolvedClasspath(false);
((JavaProject) javaProject).updatePackageFragmentRoots();
IType myType = javaProject.findType("my.Type");

As you can see, you have to do a cast to an internal class.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=54582

Cu, Gunnar
Previous Topic:Method reference chain
Next Topic:JUnit Tests w/ no Class to Test
Goto Forum:
  


Current Time: Sat Nov 09 05:45:41 GMT 2024

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

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

Back to the top