Bug 211781 - [search] clarify 'ALLOCATION_EXPRESSION_TYPE_REFERENCE'
Summary: [search] clarify 'ALLOCATION_EXPRESSION_TYPE_REFERENCE'
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-03 11:38 EST by Martin Aeschlimann CLA
Modified: 2007-12-12 09:47 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2007-12-03 11:38:55 EST
20071203

It would be good to clarify what IJavaSearchConstants.ALLOCATION_EXPRESSION_TYPE_REFERENCE
exactly means, maybe in DOM AST terms.

Is it class instance creations and array creations?

So maybe using the word 'creations' would be better to use?
Comment 1 Frederic Fusier CLA 2007-12-04 17:26:13 EST
Here's the new proposal:
/**
 * Return only type references used in class instance creation.
 * <p>
 * When this flag is set, only {@link TypeReferenceMatch} matches will be
 * returned.
 *</p><p>
 *	Example:
 *<pre>
 * public class Test {
 * 	Test() {}
 * 	static Test bar()  {
 * 		return new <i>Test</i>();
 * 	}
 * }
 *</pre>
 * Searching references to the type <code>Test</code> using this flag in the
 * above snippet will match only the reference in italic.
 * </p><p>
 * Note that array creations are not returned when using this flag.
 * </p>
 * @since 3.4
 * @category limitTo
 */
int CLASS_INSTANCE_CREATION_TYPE_REFERENCE = 0x2000;
Comment 2 Frederic Fusier CLA 2007-12-04 17:28:12 EST
Note that while testing a little bit more this flag, I discovered a problem with parameterized constructor call.

Use following test case
public class Test {
	Test() {}
	<U> Test(U u) {}
	static Test foo() {
		return new <String> Test("");
	}
	static Test bar()  {
		return new Test();
	}
}
and search for all references ("*" string pattern) using this CLASS_INSTANCE_CREATION_TYPE_REFERENCE flag does not return the reference in parameterized constructor call: new <String> Test("")

I'll fix this issue while releasing changes for this bug...
Comment 3 Martin Aeschlimann CLA 2007-12-05 04:11:54 EST
proposal in comment 1 sounds good.
Comment 4 Frederic Fusier CLA 2007-12-05 07:44:30 EST
Released for 3.4M4 in HEAD stream.
Comment 5 David Audel CLA 2007-12-12 09:47:15 EST
Verified for 3.4M4 using build I20071210-1800.