Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] fix for bug43988

Search filtering was broken, it would have become more obvious when 
searching larger projects with includes.

core:
-modify BasicSearchMatch.equals()

tests:
modified OtherPatternTests.testBug42911() and renamed it 
testBug42911_43988

tested on windows & linux
-Andrew

Index: search/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/ChangeLog,v
retrieving revision 1.35
diff -u -r1.35 ChangeLog
--- search/ChangeLog	1 Oct 2003 13:33:33 -0000	1.35
+++ search/ChangeLog	1 Oct 2003 17:26:05 -0000
@@ -1,3 +1,6 @@
+2003-10-01 Andrew Niefer
+	- fix BasicSearchMatch.equals() for bug43988
+
 2003-09-30 Bogdan Gheorghe
 	- changed logging in JobManager to use new ICLogConstants
 	
Index: search/org/eclipse/cdt/core/search/BasicSearchMatch.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/BasicSearchMatch.java,v
retrieving revision 1.7
diff -u -r1.7 BasicSearchMatch.java
--- search/org/eclipse/cdt/core/search/BasicSearchMatch.java	30 Sep 2003 14:10:23 -0000	1.7
+++ search/org/eclipse/cdt/core/search/BasicSearchMatch.java	1 Oct 2003 17:26:05 -0000
@@ -67,17 +67,26 @@
 		if( type != match.getElementType() || visibility != match.getVisibility() )
 			return false;
 			
-		if( ( name != null && match.getName() != null && !name.equals( match.getName() ) ) 
-		 ||	name != match.getName() )
-			return false; 
+		if( name != null && match.getName() != null){
+			if( !name.equals( match.getName() ) ) 
+		 		return false; 
+		} else if( name != match.getName() ){
+			return false;
+		}
 		 	
-		if( ( parentName != null && match.getParentName() != null && !parentName.equals( match.getParentName() ) ) 
-		 ||	parentName != match.getParentName() )
-			return false; 
-					 	
-		if( ( returnType != null && match.getReturnType() != null && !returnType.equals( match.getReturnType() ) ) 
-		 ||	returnType != match.getReturnType() )
-			return false; 
+		if( parentName != null && match.getParentName() != null){
+			if( !parentName.equals( match.getParentName() ) ) 
+				return false; 
+		} else if( parentName != match.getParentName() ){
+			return false;
+		}
+		
+		if( returnType != null && match.getReturnType() != null){
+			if( !returnType.equals( match.getReturnType() ) ) 
+				return false; 
+		} else if( returnType != match.getReturnType() ){
+			return false;
+		}
 		
 		IPath thisPath = getLocation();
 		IPath matchPath = match.getLocation();
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.129
diff -u -r1.129 ChangeLog
--- ChangeLog	1 Oct 2003 17:10:20 -0000	1.129
+++ ChangeLog	1 Oct 2003 17:26:15 -0000
@@ -1,4 +1,7 @@
 2003-10-01 Andrew Niefer
+	modified OtherPatternTests.testBug42911() and renamed it testBug42911_43988
+
+2003-10-01 Andrew Niefer
 	added testBug43450 to ManagedBuildTests.java
 	added a user include to plugin.xml
 
Index: search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java,v
retrieving revision 1.17
diff -u -r1.17 OtherPatternTests.java
--- search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java	30 Sep 2003 18:18:26 -0000	1.17
+++ search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java	1 Oct 2003 17:26:16 -0000
@@ -330,7 +330,7 @@
 		assertEquals( matches.size(), 4 );
 	}
 	
-	public void testBug42911(){
+	public void testBug42911_43988(){
 		BasicSearchMatch match1 = new BasicSearchMatch();
 		BasicSearchMatch match2 = new BasicSearchMatch();
 		
@@ -344,5 +344,10 @@
 		assertFalse( match1.equals( match2 ) );
 		assertFalse( match2.equals( match1 ) );
 		
+		match2.setName( "IWasSaying" );
+		match2.setParentName( "boo" );
+		match2.setReturnType( "urns" );
+		
+		assertTrue( match1.equals( match2 ) );
 	}
 }

Back to the top