Eclipse Luna does not find references to Java elements [message #1426212] |
Thu, 18 September 2014 12:10 |
|
In the Java editor I right-click on a method name or class name or other element (defined in my source, not in a dependency JAR) and from the menu I select References / Workspace.
In some cases the references to such elements are found and shown in the Search view as expected. But in most cases no reference is found, which I know is wrong because those elements are definitely referenced by some code in projects found in the workspace (and if I do a File search they are always found, and if I Ctrl-click on the reference, f.ex. a method call, I'm taken to the method body as expected).
It makes no difference if instead of using the menu item References / Workspace I select the element in the code and hit Ctrl+Shift+G, or right-click on the element in the Outline view and use the menu item References / Workspace from there.
No project in the workspace has compilation errors and all the projects run normally. The projects are all set to use Java 7 JDK ("C:\glassfish4\jdk7").
In another post about Juno I found mentions to an Index Rebuild feature, but I couldn't find anything index-related in Luna preferences or in the menu I get when I right-click on a project.
When I was using Eclipse Kepler instead of Luna I was searching for references in exactly the same ways and the references were always found correctly. Actually this problem occurred with Kepler too for a short period but then it went away and I never understood why. But now with Luna this problem is there since the beginning and it seems to be there to stay.
The version of Luna is 4.4.0.I20140606-1215. I added to it the same plugins I had in Kepler: Subclipse, TapestryTools, FindBugs, ResourceBundle Editor, TestNG.
I could not find any Preferences setting that appears to me to be affecting this.
I'm wondering if other people are experiencing the same problem and if there is a known cause, solution or workaround.
|
|
|
Re: Eclipse Luna does not find references to Java elements [message #1426494 is a reply to message #1426212] |
Thu, 18 September 2014 21:03 |
|
I've never seen this required for the Java indexes, but shut down Eclipse, and from the .metadata/.plugins/org.eclipse.jdt.core directory in that workspace, delete *.index, indexNamesMap.txt, and savedIndexNames.txt. Failing that, import your projects and preferences into a new workspace.
IIRC you did have to force the indexes to rebuild for PDT in Juno.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Re: Eclipse Luna does not find references to Java elements [message #1426744 is a reply to message #1426494] |
Fri, 19 September 2014 06:47 |
|
Thanks, I'll try that when I get to that PC.
However if the indexes are stored in the workspace so that creating a new workspace would get them rebuilt, it means there is something wrong in my environment, because I always create a new workspace for each new task (all Java), and I have the missing references problem on many different workspaces, old and new, so there must be something going on that causes the indexes to be often created wrong in my environment. I'm wondering what could that be.
|
|
|
Re: Eclipse Luna does not find references to Java elements [message #1436714 is a reply to message #1426744] |
Fri, 03 October 2014 09:43 |
|
I tried creating new workspaces, and the problem is there since the very beginning. This is what I do step by step, without omissions:
1) I start Eclipse and when asked for the workspace name I enter a non-existing name, so Eclipse creates a new workspace. Then I check out the projects from SVN.
2) I run the Gradle scripts and all the dependencies come into place correctly and when I refresh the projects there are no compilation errors anywhere.
3) Ctrl+Shift+T and the "Open Type" dialog comes up, showing a message that it's creating the indexes. I wait for the index creation to finish before I type anything.
4) I type a class name and the class is not found.
5) I close the "Open Type" dialog, then Crtl+Shift+R to get the "Open Resource" dialog. I type into it the exact same class name and it's found.
Are there known situations that can cause the Java indexes to be created wrong ?
|
|
|
|
Re: Eclipse Luna does not find references to Java elements [message #1562412 is a reply to message #1560430] |
Tue, 13 January 2015 17:47 |
Eric Rizzo Messages: 3070 Registered: July 2009 |
Senior Member |
|
|
It's probably something unusual in either your project contents or in the interaction with one of the third-party plugins.
Since you have a few third-party plugins installed, I'd start by trying to reproduce the problem with a fresh workspace and a fresh installation of Eclipse with nothing extra installed (other than Subclipse). The JDK under /glassfish also makes me wonder; does Oracle do something odd with a JDK distributed with Glassfish that might give Eclipse trouble? Can you try also with a stand-alone JDK installation?
[Updated on: Tue, 13 January 2015 17:47] Report message to a moderator
|
|
|
Re: Eclipse Luna does not find references to Java elements [message #1563812 is a reply to message #1562412] |
Wed, 14 January 2015 12:16 |
|
My first suspect would be the Java Build Path that Gradle is setting up. When you open a class that's not found by Open Type but is found by Open Resource, is there anything unusual about its presentation in the Package Explorer or feature set within the Java Editor (unexpected limitations or loss of functionality)?
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Re: Eclipse Luna does not find references to Java elements [message #1563999 is a reply to message #1563812] |
Wed, 14 January 2015 14:42 |
|
Good idea, as soon as I get the chance I will try with a fresh installation of Eclipse without all the extra plugins, and I will try with a stand-alone JDK.
When I open a class that's not found by Open Type but is found by Open Resource I don't see anything unusual about it in Package Explorer, and the editor shows the class in the usual way, read-write and normal icon in the tab.
|
|
|
|
|
Re: Eclipse Luna does not find references to Java elements [message #1708806 is a reply to message #1708797] |
Mon, 21 September 2015 11:48 |
|
Anjith, are you using the Java 7 JDK that comes with Glassfish, and/or any of the following Eclipse plugins ? Subclipse, TapestryTools, FindBugs, ResourceBundle Editor, TestNG.
I'm asking because it has been hypothesized that my problem is caused by one of them, so it would be interesting to know if you and I have some of them in common. If you don't have any of them it would make it much less likely that one of them is responsible for this error.
|
|
|
|
Powered by
FUDForum. Page generated in 0.09433 seconds