Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 207774

Summary: [search] no references to anonymous type found
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: frederic_fusier
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Markus Keller CLA 2007-10-29 09:34:17 EDT
I20071029-0010 (not new)

Search for references to an anonymous type does not find any matches:

package xy;
public class Try {
	void m() {
		new Try() { /*anonymous*/ }.m();
	}
}

- select 'new Try() {...}' in Outline
- press Ctrl+Shift+G
=> was: no match
=> expected: either a match in m() or the anonymous type itself.
Comment 1 Markus Keller CLA 2009-09-25 12:24:26 EDT
Search for declarations of an anonymous type also finds nothing.
Comment 2 Frederic Fusier CLA 2009-09-29 07:12:06 EDT
No reference and no declaration found are two separated problems. The former is due because references to anonymous are not stored in the index files, the latter seems to be a problem in the match locating.

What is the use case where one need to search for references/declaration of an anonymous?
Comment 3 Markus Keller CLA 2009-10-09 09:17:55 EDT
> What is the use case where one need to search for references/declaration of an
> anonymous?

I tried to simplify the code we have in the call hierarchy when you open a caller hierarchy on a class. We sometimes use the class as a stand-in for all constructors of a class, concretely for anonymous classes and for classes with only the default constructor.

We currently have special handling for anonymous types, since the workaround for bug 23112 and bug 43276 (use a text pattern to find references to a constructor for which there is no element) doesn't work for anonymous class.

I wanted to get rid of the special cases and just search for references to the class with limitTo=IJavaSearchConstants.CLASS_INSTANCE_CREATION_TYPE_REFERENCE. Only later, I realized that this does not find implicit references such as 'super(..)' in a subtype constructor, so I had to revert that for the other case (class with only default constructor) as well.

=> I don't have a concrete use case any more.
Comment 4 Eclipse Genie CLA 2020-03-04 17:07:25 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.