Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 91489 Details for
Bug 221130
[search] No fine-grain search for instanceof criteria
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v01.txt (text/plain), 5.28 KB, created by
Frederic Fusier
on 2008-03-04 05:02:54 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2008-03-04 05:02:54 EST
Size:
5.28 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/core/search/IJavaSearchConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java,v >retrieving revision 1.30 >diff -u -r1.30 IJavaSearchConstants.java >--- search/org/eclipse/jdt/core/search/IJavaSearchConstants.java 5 Dec 2007 12:43:25 -0000 1.30 >+++ search/org/eclipse/jdt/core/search/IJavaSearchConstants.java 4 Mar 2008 10:01:43 -0000 >@@ -382,6 +382,17 @@ > * @category limitTo > */ > int WILDCARD_BOUND_TYPE_REFERENCE = 0x80000; >+ >+ /** >+ * Return only type references used as an instance of. >+ * <p> >+ * When this flag is set, only {@link TypeReferenceMatch} matches will be >+ * returned. >+ *</p> >+ * @since 3.4 >+ * @category limitTo >+ */ >+ int INSTANCEOF_TYPE_REFERENCE = 0x100000; > > /** > * Return only super field accesses or super method invocations (e.g. using the >Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java,v >retrieving revision 1.82 >diff -u -r1.82 MatchLocatorParser.java >--- search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java 12 Dec 2007 09:18:51 -0000 1.82 >+++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java 4 Mar 2008 10:01:43 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.core.search.matching; > >+import org.eclipse.jdt.core.dom.InfixExpression; > import org.eclipse.jdt.core.search.IJavaSearchConstants; > import org.eclipse.jdt.internal.compiler.ASTVisitor; > import org.eclipse.jdt.internal.compiler.ast.*; >@@ -322,6 +323,20 @@ > this.patternLocator.match((LocalDeclaration) this.astStack[this.astPtr], this.nodeSet); > } > >+protected void consumeInstanceOfExpression() { >+ super.consumeInstanceOfExpression(); >+ if ((this.patternFineGrain & IJavaSearchConstants.INSTANCEOF_TYPE_REFERENCE) != 0) { >+ InstanceOfExpression expression = (InstanceOfExpression) this.expressionStack[this.expressionPtr]; >+ this.patternLocator.match(expression.type, this.nodeSet); >+ } >+} >+protected void consumeInstanceOfExpressionWithName() { >+ super.consumeInstanceOfExpressionWithName(); >+ if ((this.patternFineGrain & IJavaSearchConstants.INSTANCEOF_TYPE_REFERENCE) != 0) { >+ InstanceOfExpression expression = (InstanceOfExpression) this.expressionStack[this.expressionPtr]; >+ this.patternLocator.match(expression.type, this.nodeSet); >+ } >+} > protected void consumeInterfaceType() { > super.consumeInterfaceType(); > if ((this.patternFineGrain & IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE) != 0) { >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java,v >retrieving revision 1.6 >diff -u -r1.6 JavaSearchFineGrainTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java 12 Dec 2007 10:26:59 -0000 1.6 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java 4 Mar 2008 10:01:45 -0000 >@@ -436,6 +436,51 @@ > ); > } > >+/** >+ * @bug 221130: [search] No fine-grain search for instanceof criteria >+ * @test Verify that type references are only reported in instanceof pattern when >+ * corresponding fine grain flag is set. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=221130" >+ */ >+public void testTypeRef_InstanceOf() throws CoreException { >+ workingCopies = new ICompilationUnit[1]; >+ workingCopies[0] = getWorkingCopy("/JavaSearch15/src/Test.java", >+ "public class Test {\n" + >+ " Object field;\n" + >+ " void foo(Object param) {\n" + >+ " if (field instanceof java.lang.String) {\n" + >+ " }\n" + >+ " if (param instanceof Test) {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ ); >+ search("*", TYPE, INSTANCEOF_TYPE_REFERENCE); >+ assertSearchResults( >+ "src/Test.java void Test.foo(Object) [ if (field instanceof §|java.lang.String|§) {@84] EXACT_MATCH\n" + >+ "src/Test.java void Test.foo(Object) [ if (param instanceof §|Test|§) {@131] EXACT_MATCH" >+ ); >+} >+public void testTypeRef_InstanceOfWithParenthesis() throws CoreException { >+ workingCopies = new ICompilationUnit[1]; >+ workingCopies[0] = getWorkingCopy("/JavaSearch15/src/Test.java", >+ "public class Test {\n" + >+ " Object field;\n" + >+ " void foo(Object param) {\n" + >+ " if ((field instanceof Test)) {\n" + >+ " }\n" + >+ " if ((param instanceof java.lang.Throwable)) {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ ); >+ search("*", TYPE, INSTANCEOF_TYPE_REFERENCE); >+ assertSearchResults( >+ "src/Test.java void Test.foo(Object) [ if ((field instanceof §|Test|§)) {@85] EXACT_MATCH\n" + >+ "src/Test.java void Test.foo(Object) [ if ((param instanceof §|java.lang.Throwable|§)) {@122] EXACT_MATCH" >+ ); >+} >+ > /* > * References to a all types (using '*' string pattern) > */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 221130
: 91489 |
91494