New class in same package says class can't be resolved [message #475348] |
Wed, 05 August 2009 18:31  |
Eclipse User |
|
|
|
Eclipse 3.5, WinXP.
My project is in a very weird state. I've been using it for a while without any particular problems. I have a bunch of code that Eclipse doesn't complain about. I have many Java source files in many projects, all in SVN.
There's one class in one package that works in a particular way, and I need to write a new class in the same package that works similarly. There's a helper class and package that the first class imports successfully.
I right-clicked on the package and created a new class that extends the same class as the first class. So far so good.
I created an instance variable for the helper class, using completion to specify the name. It automatically created the import statement for the helper class. Everything looks fine except for the fact that it's marked a compile error on the import line and the instance variable declaration, saying that it can't resolve the class.
This makes absolutely no sense. This new class is in the same package as the first class. I can see both of them in the package explorer. The helper package is in a "nearby" package.
I can use completion to get the class name, and I can use completion to manually build a fully-qualified import statement to the class, but after completing the statement, it says it can't resolve the class.
I've been staring at this for an hour, and I can't make sense of it.
I've tried starting Eclipse with "-clean". No difference.
If I just copy/paste the working class in the same package, giving it a different name, it gives me the same error. In fact, in the entire file, it gives lots of compile errors, but it's only complaining that it can't find the classes that reside in that "helper" package. There are lots of other imports that it's perfectly happy with.
I'm befuddled. I guess I'll try rebooting.
|
|
|
Re: New class in same package says class can't be resolved [message #475825 is a reply to message #475348] |
Wed, 05 August 2009 19:03  |
Eclipse User |
|
|
|
Well, rebooting didn't help, but I did think to do a "Project Clean", which DID resolve the problem. This reminded me of the fact that this project was created with an output folder of "classes", which conflicts with the command-line Ant build (which I ran earlier today). I remembered that I had changed this to "/bin" in other projects, which resolved similar problems, so I've now fixed that in this project also.
|
|
|
Powered by
FUDForum. Page generated in 0.10060 seconds