Bug 19839 - Can't search for declaration of methods in inner types [search] [general issue]
Summary: Can't search for declaration of methods in inner types [search] [general issue]
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 39911
  Show dependency tree
 
Reported: 2002-06-10 16:26 EDT by Peter Burka CLA
Modified: 2009-08-30 02:20 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Burka CLA 2002-06-10 16:26:44 EDT
Build F2

Enter the following class into Eclipse:

public class Foo {
	public void bar() {
	}
	public Object x = new Object() {
		public void quux() {
		}
	}
}

If you select 'bar' in the Java editor and search for 'Declarations'->'In 
Workspace' the search proceeds as expected.

But if you select 'quux' instead, you get an error dialog that 'The operation 
is unavailable on the current element, please select a valid Java element 
name.'

quux is a valid Java element name, and the search should work.
Comment 1 Peter Burka CLA 2002-06-10 16:29:26 EDT
Oops - missing a semicolon in the example. The code should be:

public class Foo {
	public void bar() {
	}
	public Object x = new Object() {
		public void quux() {
		}
	};
}
Comment 2 Dirk Baeumer CLA 2002-08-07 13:17:35 EDT
Two issues:
- we are using code resolve to convert a selection into a Java element. Since
  there isn't a Java element for local and anonymous types code resolve doesn't
  return the correct Java element.
- I even didn't find a way to do the search in the Search dialog. There is no
  way to enter a "signature" for anonymous inner types.
Comment 3 Dani Megert CLA 2002-08-19 10:45:52 EDT
Moving to J Core for comment.
Comment 4 Jerome Lanneluc CLA 2002-10-03 04:44:57 EDT
As Dirk said there is no IJavaElement for anonymous or local types in the Java 
model.
When resolving maybe we could return a non-existing 
IJavaElement: "java.lang.Object.quux()"
Comment 5 Dani Megert CLA 2002-10-03 08:57:19 EDT
What should I do with a non-existent Java Element? How would I feed it into the
Search engine?
Comment 6 Jerome Lanneluc CLA 2002-10-03 09:12:18 EDT
I was just thinking out loud. I was expecting that SearchEngine.search
(IWorkspace, IJavaElement, int, IJavaSearchScope, IJavaSearchResultCollector) 
would not need to open the element. This is not currently true.

Need to find another solution.
Comment 7 Jerome Lanneluc CLA 2002-11-25 10:46:27 EST
The more general issue of having IJavaElements for local and anonymous types 
will be investigated after 2.1.
Comment 8 Nikolay Metchev CLA 2003-07-15 06:16:31 EDT
It is now "after 2.1" as comment #7 says. Would this bug be investigated now? 
or later?
Comment 9 Jerome Lanneluc CLA 2003-07-15 06:22:13 EDT
Having IJavaElement handles on local constructs is on the 3.0 plan (see 
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core-
home/r3.0/main.html#release-plan).
Comment 10 Jerome Lanneluc CLA 2004-07-05 07:15:20 EDT
Closing as this is now supported.
Comment 11 Nikolay Metchev CLA 2005-09-27 04:58:48 EDT
This issue appears to be fixed in eclipse 3.1
Comment 12 Denis Roy CLA 2009-08-30 02:20:28 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.