mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Andrew Niefer
Core: -bug42911 - Search: cannot find beyond use of data member - fix NPE's in BasicSearchMatch.equals & hashCode TESTS: -added testBug42911 to OtherPatternTests
This commit is contained in:
parent
16c24c6cc9
commit
9cef992b8e
4 changed files with 38 additions and 4 deletions
|
@ -8,6 +8,9 @@
|
|||
-Renamed FailedCompleteParseASTExpressionTest to FailedCompleteParseASTTest
|
||||
-Added FailedCompleteParseASTTest::testBug43503()
|
||||
|
||||
2003-09-29 Andrew Niefer
|
||||
added testBug42911 to OtherPatternTests
|
||||
|
||||
2003-09-29 Andrew Niefer
|
||||
added testbug43834() to ParserSymbolTableTest
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.Iterator;
|
|||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
||||
import org.eclipse.cdt.core.search.IMatch;
|
||||
import org.eclipse.cdt.core.search.SearchEngine;
|
||||
|
@ -323,4 +324,20 @@ public class OtherPatternTests extends BaseSearchTest {
|
|||
Set matches = resultCollector.getSearchResults();
|
||||
assertEquals( matches.size(), 4 );
|
||||
}
|
||||
|
||||
public void testBug42911(){
|
||||
BasicSearchMatch match1 = new BasicSearchMatch();
|
||||
BasicSearchMatch match2 = new BasicSearchMatch();
|
||||
|
||||
assertTrue( match1.equals( match2 ) );
|
||||
assertTrue( match2.equals( match1 ) );
|
||||
|
||||
match1.setName( "IWasSaying" );
|
||||
match1.setParentName( "boo" );
|
||||
match1.setReturnType( "urns" );
|
||||
|
||||
assertFalse( match1.equals( match2 ) );
|
||||
assertFalse( match2.equals( match1 ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
- modify CSearchPattern.scanForNames to use same naming convention as TokenDuple.toString()
|
||||
- modify MatchLocator.report to use IASTOffsetableNamedElement.getNameEndOffset()
|
||||
|
||||
2003-09-29 Andrew Niefer
|
||||
-bug42911 - Search: cannot find beyond use of data member
|
||||
- fix NPE's in BasicSearchMatch.equals & hashCode
|
||||
|
||||
2003-09-29 Andrew Niefer
|
||||
-fix NPE if IScannerInfoProvider returns null IScannerInfo
|
||||
|
||||
|
|
|
@ -43,7 +43,10 @@ public class BasicSearchMatch implements IMatch, Comparable {
|
|||
hashString += name;
|
||||
hashString += ":" + parentName;
|
||||
hashString += ":" + returnType;
|
||||
|
||||
if( getLocation() != null)
|
||||
hashString += ":" + getLocation().toString();
|
||||
|
||||
hashString += ":" + startOffset + ":" + endOffset;
|
||||
hashString += ":" + type + ":" + visibility;
|
||||
|
||||
|
@ -64,9 +67,16 @@ public class BasicSearchMatch implements IMatch, Comparable {
|
|||
if( type != match.getElementType() || visibility != match.getVisibility() )
|
||||
return false;
|
||||
|
||||
if( !name.equals( match.getName() )
|
||||
|| !parentName.equals( match.getParentName() )
|
||||
|| !returnType.equals( match.getReturnType() ) )
|
||||
if( ( name != null && match.getName() != null && !name.equals( match.getName() ) )
|
||||
|| 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;
|
||||
|
||||
IPath thisPath = getLocation();
|
||||
|
|
Loading…
Add table
Reference in a new issue