Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Eclipse Luna does not find references to Java elements(Right-click on f.ex. a method name, then References, Workspace. No reference is found although calls to the method certainly exist.)
icon5.gif  Eclipse Luna does not find references to Java elements [message #1426212] Thu, 18 September 2014 12:10 Go to next message
Davide Vecchi is currently offline Davide VecchiFriend
Messages: 35
Registered: July 2009
Member

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 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

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 Go to previous messageGo to next message
Davide Vecchi is currently offline Davide VecchiFriend
Messages: 35
Registered: July 2009
Member
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 Go to previous messageGo to next message
Davide Vecchi is currently offline Davide VecchiFriend
Messages: 35
Registered: July 2009
Member
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 ?
icon1.gif  Re: Eclipse Luna does not find references to Java elements [message #1560430 is a reply to message #1436714] Mon, 12 January 2015 15:50 Go to previous messageGo to next message
Davide Vecchi is currently offline Davide VecchiFriend
Messages: 35
Registered: July 2009
Member
Just for the record, this problem is still there ("Version: Luna Service Release 1 (4.4.1)
Build id: 20140925-1800").
It keeps occurring on more than one computer.
The workaround of deleting all the *.index files works (mentioned in a comment above (message #1426494)).
Re: Eclipse Luna does not find references to Java elements [message #1562412 is a reply to message #1560430] Tue, 13 January 2015 17:47 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
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 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

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 Go to previous messageGo to next message
Davide Vecchi is currently offline Davide VecchiFriend
Messages: 35
Registered: July 2009
Member
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 #1706047 is a reply to message #1563999] Fri, 21 August 2015 11:53 Go to previous messageGo to next message
Davide Vecchi is currently offline Davide VecchiFriend
Messages: 35
Registered: July 2009
Member
Switched to Eclipse Mars (added same plugins), problem still there. I did not investigate it further though.
Re: Eclipse Luna does not find references to Java elements [message #1708797 is a reply to message #1426212] Mon, 21 September 2015 10:22 Go to previous messageGo to next message
Anjith Kumar Paila is currently offline Anjith Kumar PailaFriend
Messages: 1
Registered: August 2012
Junior Member
I'm also facing the same problem; tried with both Luna and Mars. could be a possible bug in Eclispe ?
Re: Eclipse Luna does not find references to Java elements [message #1708806 is a reply to message #1708797] Mon, 21 September 2015 11:48 Go to previous messageGo to next message
Davide Vecchi is currently offline Davide VecchiFriend
Messages: 35
Registered: July 2009
Member
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.
Re: Eclipse Luna does not find references to Java elements [message #1708908 is a reply to message #1708806] Tue, 22 September 2015 12:01 Go to previous message
Davide Vecchi is currently offline Davide VecchiFriend
Messages: 35
Registered: July 2009
Member
Before message #1708797 above it used to feel like I was the only one having this issue or even knowing about it, but if a bug report I just read (here) is actually about this issue as it would seem, then a lot of people is having this issue and since at least 10 years.
Previous Topic:Half of program print problem
Next Topic:Eclipse 4 Welcome page from menu item
Goto Forum:
  


Current Time: Fri Apr 26 01:14:01 GMT 2024

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

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

Back to the top