Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » General (non-technical) » Test » test CR
test CR [message #5996] Wed, 11 July 2007 15:02 Go to next message
Eclipse UserFriend
Originally posted by: dfgdf.dfgfd.ie

<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550
Re: test CR [message #6009 is a reply to message #5996] Wed, 11 July 2007 15:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ddfgdf.dgfd.ie

<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549

<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037

<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078

<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199

<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94

<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217

<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502

<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550
Re: test CR [message #6842 is a reply to message #6009] Wed, 11 July 2007 15:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dfg.dgdf.ie

<test>

<test2>
Re: test CR [message #6848 is a reply to message #6842] Wed, 11 July 2007 15:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dfg.dgfd.dfgdf

<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549

<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
Re: test CR [message #6863 is a reply to message #6848] Wed, 11 July 2007 15:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dfgdf.df.e

<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549

<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
Re: test CR [message #6884 is a reply to message #6863] Wed, 11 July 2007 15:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dfg.dfgfd.dfg

<unknown receiving type>

<unknown receiving type>
Re: test CR [message #6906 is a reply to message #6884] Wed, 11 July 2007 15:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dfgf.dfgfd.gfd

<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
Re: test CR [message #6929 is a reply to message #6906] Wed, 11 July 2007 15:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dfgfd.dfgfd.ie

I am having a problem with searching for classes that extend another
class. The version of Eclipse that I am using is Version: 3.3.0, Build id:
I20070503-1400.

I have the following code



final Set<SearchMatch> classesThatExtendFoo= new
HashSet<SearchMatch>();

IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
SearchPattern pattern= SearchPattern.createPattern("Foo",
engine.search(pattern, new SearchParticipant[] {
SearchEngine.getDefaultSearchParticipant()},
scope,
new SearchRequestor() {

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
if (match.getAccuracy() == SearchMatch.A_ACCURATE &&
!match.isInsideDocComment())
System.out.println(match);
classesThatExtendFoo.add(match);
} }, new SubProgressMonitor(monitor, 1,
SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));



which I am trying to use in order to find classes that extend a class
named Foo.

This code works when the class Foo exists in my project.

But I would also like it to work when the class Foo does not exist in the
project (i.e. the code will be broken and will not compile).

For example if I have the class



class Bar extends Foo{

}



and the class Foo does not exist in the project is it still possible to
find classes that extend Foo i.e. Bar?



The code above does not find Bar.

The code gets as far as "process(PossibleMatch, boolean) line: 1549"



<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550


so it does identify Bar as a possible match.

The problem arises when it goes to report the possible match



MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



it calls the method resolveLevel



/**
* Finds out whether the given ast node matches this search pattern.
* Returns IMPOSSIBLE_MATCH if it doesn't.
* Returns INACCURATE_MATCH if it potentially matches this search
pattern (ie. * it has already been resolved but resolving failed.)
* Returns ACCURATE_MATCH if it matches exactly this search pattern
(ie. * it doesn't need to be resolved or it has already been
resolved.)
*/
public int resolveLevel(ASTNode possibleMatchingNode) {
// only called with nodes which were possible matches to the call
to matchLevel
// need to do instance of checks to find out exact type of ASTNode
return IMPOSSIBLE_MATCH;
}



from the class



org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator



in order to see if the class that the class Bar extends is a match for the
class Foo.

But even though the node passed in to the method resolveLevel is for the
class Foo an IMPOSSIBLE_MATCH is returned as no bindings exist (or are
missing) for the class Foo. No bindings exist for the class Foo (I
presume) because the class Foo does not exist.

The problem with the lack of binding information can be seen here




ProblemReferenceBinding(ReferenceBinding).sourceName() line: 1136
ProblemReferenceBinding(ReferenceBinding).qualifiedSourceNam e() line:
1065
PatternLocator.qualifiedSourceName(TypeBinding) line: 113
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
TypeBinding) line: 749
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
char[], TypeBinding) line: 698
SuperTypeReferenceLocator.resolveLevel(ASTNode) line: 82
MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
MatchLocator.process(PossibleMatch, boolean) line: 1549
MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
line: 1037
MatchLocator.locateMatches(JavaProject, PossibleMatchSet, int) line:
1078
MatchLocator.locateMatches(SearchDocument[]) line: 1199
JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern,
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 94
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 217
BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 502
SearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 550



where the sourceName returned is null, and similiary when searching for
the package name. This results in an IMPOSSIBLE_MATCH being returned from
the method
org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator::resolveLevelForType.
Is there anyway to get around this and find Bar i.e. find all classes that
extend Foo even when the class Foo does not exist?

Creating the class Foo on the fly solves this problem but I was wondering
if there is a way of doing this without having to create the class Foo?


Any help greatly appreciated,

Máirtín
Re: test CR [message #6951 is a reply to message #6929] Wed, 11 July 2007 15:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dfgdf.dfgfd.ie

I am having a problem with searching for classes that extend another
class. The version of Eclipse that I am using is Version: 3.3.0, Build id:
I20070503-1400.

I have the following code



final Set<SearchMatch> classesThatExtendFoo= new
HashSet<SearchMatch>();

IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
SearchPattern pattern= SearchPattern.createPattern("Foo",
engine.search(pattern, new SearchParticipant[] {
SearchEngine.getDefaultSearchParticipant()},
scope,
new SearchRequestor() {

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
if (match.getAccuracy() == SearchMatch.A_ACCURATE &&
!match.isInsideDocComment())
System.out.println(match);
classesThatExtendFoo.add(match);
} }, new SubProgressMonitor(monitor, 1,
SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));



which I am trying to use in order to find classes that extend a class
named Foo.

This code works when the class Foo exists in my project.

But I would also like it to work when the class Foo does not exist in the
project (i.e. the code will be broken and will not compile).

For example if I have the class



class Bar extends Foo{

}



and the class Foo does not exist in the project is it still possible to
find classes that extend Foo i.e. Bar?



The code above does not find Bar.

The code gets as far as "process(PossibleMatch, boolean) line: 1549"



<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550


so it does identify Bar as a possible match.

The problem arises when it goes to report the possible match



MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



it calls the method resolveLevel



/**
* Finds out whether the given ast node matches this search pattern.
* Returns IMPOSSIBLE_MATCH if it doesn't.
* Returns INACCURATE_MATCH if it potentially matches this search
pattern (ie. * it has already been resolved but resolving failed.)
* Returns ACCURATE_MATCH if it matches exactly this search pattern
(ie. * it doesn't need to be resolved or it has already been
resolved.)
*/
public int resolveLevel(ASTNode possibleMatchingNode) {
// only called with nodes which were possible matches to the call
to matchLevel
// need to do instance of checks to find out exact type of ASTNode
return IMPOSSIBLE_MATCH;
}



from the class



org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator



in order to see if the class that the class Bar extends is a match for the
class Foo.

But even though the node passed in to the method resolveLevel is for the
class Foo an IMPOSSIBLE_MATCH is returned as no bindings exist (or are
missing) for the class Foo. No bindings exist for the class Foo (I
presume) because the class Foo does not exist.

The problem with the lack of binding information can be seen here




ProblemReferenceBinding(ReferenceBinding).sourceName() line: 1136
ProblemReferenceBinding(ReferenceBinding).qualifiedSourceNam e() line:
1065
PatternLocator.qualifiedSourceName(TypeBinding) line: 113
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
TypeBinding) line: 749
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
char[], TypeBinding) line: 698
SuperTypeReferenceLocator.resolveLevel(ASTNode) line: 82
MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
MatchLocator.process(PossibleMatch, boolean) line: 1549
MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
line: 1037
MatchLocator.locateMatches(JavaProject, PossibleMatchSet, int) line:
1078
MatchLocator.locateMatches(SearchDocument[]) line: 1199
JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern,
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 94
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 217
BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 502
SearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 550



where the sourceName returned is null, and similiary when searching for
the package name.


This results in an IMPOSSIBLE_MATCH being returned from the method




org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator::resolveLevelForType.



Is there anyway to get around this and find Bar i.e. find all classes that
extend Foo even when the class Foo does not exist?

Creating the class Foo on the fly solves this problem but I was wondering
if there is a way of doing this without having to create the class Foo?


Any help greatly appreciated,

Máirtín
Re: test CR [message #6975 is a reply to message #6951] Wed, 11 July 2007 15:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dfgfd.dfgfd.gfd

I am having a problem with searching for classes that extend another
class. The version of Eclipse that I am using is Version: 3.3.0, Build id:
I20070503-1400.

I have the following code



final Set<SearchMatch> classesThatExtendFoo= new
HashSet<SearchMatch>();

IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
SearchPattern pattern= SearchPattern.createPattern("Foo",
engine.search(pattern, new SearchParticipant[] {
SearchEngine.getDefaultSearchParticipant()},
scope,
new SearchRequestor() {

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
if (match.getAccuracy() == SearchMatch.A_ACCURATE &&
!match.isInsideDocComment())
System.out.println(match);
classesThatExtendFoo.add(match);
} }, new SubProgressMonitor(monitor, 1,
SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));



which I am trying to use in order to find classes that extend a class
named Foo.

This code works when the class Foo exists in my project.

But I would also like it to work when the class Foo does not exist in the
project (i.e. the code will be broken and will not compile).

For example if I have the class



class Bar extends Foo{

}



and the class Foo does not exist in the project is it still possible to
find classes that extend Foo i.e. Bar?



The code above does not find Bar.

The code gets as far as "process(PossibleMatch, boolean) line: 1549"



<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550


so it does identify Bar as a possible match.

The problem arises when it goes to report the possible match



MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



it calls the method resolveLevel



/**
* Finds out whether the given ast node matches this search pattern.
* Returns IMPOSSIBLE_MATCH if it doesn't.
* Returns INACCURATE_MATCH if it potentially matches this search
pattern (ie. * it has already been resolved but resolving failed.)
* Returns ACCURATE_MATCH if it matches exactly this search pattern
(ie. * it doesn't need to be resolved or it has already been
resolved.)
*/
public int resolveLevel(ASTNode possibleMatchingNode) {
// only called with nodes which were possible matches to the call
to matchLevel
// need to do instance of checks to find out exact type of ASTNode
return IMPOSSIBLE_MATCH;
}



from the class



org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator



in order to see if the class that the class Bar extends is a match for the
class Foo.

But even though the node passed in to the method resolveLevel is for the
class Foo an IMPOSSIBLE_MATCH is returned as no bindings exist (or are
missing) for the class Foo. No bindings exist for the class Foo (I
presume) because the class Foo does not exist.

The problem with the lack of binding information can be seen here




ProblemReferenceBinding(ReferenceBinding).sourceName() line: 1136
ProblemReferenceBinding(ReferenceBinding).qualifiedSourceNam e() line:
1065
PatternLocator.qualifiedSourceName(TypeBinding) line: 113
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
TypeBinding) line: 749
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
char[], TypeBinding) line: 698
SuperTypeReferenceLocator.resolveLevel(ASTNode) line: 82
MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
MatchLocator.process(PossibleMatch, boolean) line: 1549
MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
line: 1037
MatchLocator.locateMatches(JavaProject, PossibleMatchSet, int) line:
1078
MatchLocator.locateMatches(SearchDocument[]) line: 1199
JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern,
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 94
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 217
BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 502
SearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 550



where the sourceName returned is null, and similiary when searching for
the package name.


This results in an IMPOSSIBLE_MATCH being returned from the method




org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator::resolveLevelForType.



Is there anyway to get around this and find Bar i.e. find all classes that
extend Foo even when the class Foo does not exist?

Creating the class Foo on the fly solves this problem but I was wondering
if there is a way of doing this without having to create the class Foo?


Any help greatly appreciated,

Máirtín
Re: test CR [message #7000 is a reply to message #6975] Wed, 11 July 2007 15:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dfgdfg.dfgfd.dfgfd

I am having a problem with searching for classes that extend another
class. The version of Eclipse that I am using is Version: 3.3.0, Build id:
I20070503-1400.

I have the following code



final Set<SearchMatch> classesThatExtendFoo= new
HashSet<SearchMatch>();

IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
SearchPattern pattern= SearchPattern.createPattern("Foo",
engine.search(pattern, new SearchParticipant[] {
SearchEngine.getDefaultSearchParticipant()},
scope,
new SearchRequestor() {

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
if (match.getAccuracy() == SearchMatch.A_ACCURATE &&
!match.isInsideDocComment())
System.out.println(match);
classesThatExtendFoo.add(match);
} }, new SubProgressMonitor(monitor, 1,
SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));



which I am trying to use in order to find classes that extend a class
named Foo.

This code works when the class Foo exists in my project.

But I would also like it to work when the class Foo does not exist in the
project (i.e. the code will be broken and will not compile).

For example if I have the class



class Bar extends Foo{

}



and the class Foo does not exist in the project is it still possible to
find classes that extend Foo i.e. Bar?



The code above does not find Bar.

The code gets as far as "process(PossibleMatch, boolean) line: 1549"



<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550


so it does identify Bar as a possible match.

The problem arises when it goes to report the possible match



MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



it calls the method resolveLevel



/**
* Finds out whether the given ast node matches this search pattern.
* Returns IMPOSSIBLE_MATCH if it doesn't.
* Returns INACCURATE_MATCH if it potentially matches this search
pattern (ie. * it has already been resolved but resolving failed.)
* Returns ACCURATE_MATCH if it matches exactly this search pattern
(ie. * it doesn't need to be resolved or it has already been
resolved.)
*/
public int resolveLevel(ASTNode possibleMatchingNode) {
// only called with nodes which were possible matches to the call
to matchLevel
// need to do instance of checks to find out exact type of ASTNode
return IMPOSSIBLE_MATCH;
}



from the class



org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator



in order to see if the class that the class Bar extends is a match for the
class Foo.

But even though the node passed in to the method resolveLevel is for the
class Foo an IMPOSSIBLE_MATCH is returned as no bindings exist (or are
missing) for the class Foo. No bindings exist for the class Foo (I
presume) because the class Foo does not exist.

The problem with the lack of binding information can be seen here




ProblemReferenceBinding(ReferenceBinding).sourceName() line: 1136
ProblemReferenceBinding(ReferenceBinding).qualifiedSourceNam e() line:
1065
PatternLocator.qualifiedSourceName(TypeBinding) line: 113
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
TypeBinding) line: 749
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
char[], TypeBinding) line: 698
SuperTypeReferenceLocator.resolveLevel(ASTNode) line: 82
MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
MatchLocator.process(PossibleMatch, boolean) line: 1549
MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
line: 1037
MatchLocator.locateMatches(JavaProject, PossibleMatchSet, int) line:
1078
MatchLocator.locateMatches(SearchDocument[]) line: 1199
JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern,
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 94
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 217
BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 502
SearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 550



where the sourceName returned is null, and similiary when searching for
the package name.


This results in an IMPOSSIBLE_MATCH being returned from the method




org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator::resolveLevelForType.



Is there anyway to get around this and find Bar i.e. find all classes that
extend Foo even when the class Foo does not exist?

Creating the class Foo on the fly solves this problem but I was wondering
if there is a way of doing this without having to create the class Foo?


Any help greatly appreciated,

Máirtín
Re: test CR [message #7023 is a reply to message #7000] Wed, 11 July 2007 15:23 Go to previous message
Eclipse UserFriend
Originally posted by: dfgdf.dfgf.ie

I am having a problem with searching for classes that extend another
class. The version of Eclipse that I am using is Version: 3.3.0, Build id:
I20070503-1400.

I have the following code



final Set<SearchMatch> classesThatExtendFoo= new
HashSet<SearchMatch>();

IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
SearchPattern pattern= SearchPattern.createPattern("Foo",
engine.search(pattern, new SearchParticipant[] {
SearchEngine.getDefaultSearchParticipant()},
scope,
new SearchRequestor() {

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
if (match.getAccuracy() == SearchMatch.A_ACCURATE &&
!match.isInsideDocComment())
System.out.println(match);
classesThatExtendFoo.add(match);
} }, new SubProgressMonitor(monitor, 1,
SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));



which I am trying to use in order to find classes that extend a class
named Foo.

This code works when the class Foo exists in my project.

But I would also like it to work when the class Foo does not exist in the
project (i.e. the code will be broken and will not compile).

For example if I have the class



class Bar extends Foo{

}



and the class Foo does not exist in the project is it still possible to
find classes that extend Foo i.e. Bar?



The code above does not find Bar.

The code gets as far as "process(PossibleMatch, boolean) line: 1549"



<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



so it does identify Bar as a possible match.

The problem arises when it goes to report the possible match



MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



it calls the method resolveLevel



/**
* Finds out whether the given ast node matches this search pattern.
* Returns IMPOSSIBLE_MATCH if it doesn't.
* Returns INACCURATE_MATCH if it potentially matches this search
pattern (ie. * it has already been resolved but resolving failed.)
* Returns ACCURATE_MATCH if it matches exactly this search pattern
(ie. * it doesn't need to be resolved or it has already been
resolved.)
*/
public int resolveLevel(ASTNode possibleMatchingNode) {
// only called with nodes which were possible matches to the call
to matchLevel
// need to do instance of checks to find out exact type of ASTNode
return IMPOSSIBLE_MATCH;
}



from the class



org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator



in order to see if the class that the class Bar extends is a match for the
class Foo.

But even though the node passed in to the method resolveLevel is for the
class Foo an IMPOSSIBLE_MATCH is returned as no bindings exist (or are
missing) for the class Foo. No bindings exist for the class Foo (I
presume) because the class Foo does not exist.

The problem with the lack of binding information can be seen here




ProblemReferenceBinding(ReferenceBinding).sourceName() line: 1136
ProblemReferenceBinding(ReferenceBinding).qualifiedSourceNam e() line:
1065
PatternLocator.qualifiedSourceName(TypeBinding) line: 113
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
TypeBinding) line: 749
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
char[], TypeBinding) line: 698
SuperTypeReferenceLocator.resolveLevel(ASTNode) line: 82
MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
MatchLocator.process(PossibleMatch, boolean) line: 1549
MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
line: 1037
MatchLocator.locateMatches(JavaProject, PossibleMatchSet, int) line:
1078
MatchLocator.locateMatches(SearchDocument[]) line: 1199
JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern,
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 94
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 217
BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 502
SearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 550



where the sourceName returned is null, and similiary when searching for
the package name.


This results in an IMPOSSIBLE_MATCH being returned from the method




org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator::resolveLevelForType.



Is there anyway to get around this and find Bar i.e. find all classes that
extend Foo even when the class Foo does not exist?

Creating the class Foo on the fly solves this problem but I was wondering
if there is a way of doing this without having to create the class Foo?


Any help greatly appreciated,

Máirtín
Re: test CR [message #560761 is a reply to message #5996] Wed, 11 July 2007 15:03 Go to previous message
Eclipse UserFriend
Originally posted by: ddfgdf.dgfd.ie

<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549

<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037

<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078

<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199

<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94

<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217

<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502

<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550
Re: test CR [message #560770 is a reply to message #6009] Wed, 11 July 2007 15:04 Go to previous message
Eclipse UserFriend
Originally posted by: dfg.dgdf.ie

<test>

<test2>
Re: test CR [message #560778 is a reply to message #6842] Wed, 11 July 2007 15:04 Go to previous message
Eclipse UserFriend
Originally posted by: dfg.dgfd.dfgdf

<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549

<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
Re: test CR [message #560788 is a reply to message #6848] Wed, 11 July 2007 15:05 Go to previous message
Eclipse UserFriend
Originally posted by: dfgdf.df.e

<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549

<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
Re: test CR [message #560796 is a reply to message #6863] Wed, 11 July 2007 15:06 Go to previous message
Eclipse UserFriend
Originally posted by: dfg.dfgfd.dfg

<unknown receiving type>

<unknown receiving type>
Re: test CR [message #560806 is a reply to message #6884] Wed, 11 July 2007 15:07 Go to previous message
Eclipse UserFriend
Originally posted by: dfgf.dfgfd.gfd

<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
Re: test CR [message #560817 is a reply to message #6906] Wed, 11 July 2007 15:16 Go to previous message
Eclipse UserFriend
Originally posted by: dfgfd.dfgfd.ie

I am having a problem with searching for classes that extend another
class. The version of Eclipse that I am using is Version: 3.3.0, Build id:
I20070503-1400.

I have the following code



final Set<SearchMatch> classesThatExtendFoo= new
HashSet<SearchMatch>();

IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
SearchPattern pattern= SearchPattern.createPattern("Foo",
engine.search(pattern, new SearchParticipant[] {
SearchEngine.getDefaultSearchParticipant()},
scope,
new SearchRequestor() {

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
if (match.getAccuracy() == SearchMatch.A_ACCURATE &&
!match.isInsideDocComment())
System.out.println(match);
classesThatExtendFoo.add(match);
} }, new SubProgressMonitor(monitor, 1,
SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));



which I am trying to use in order to find classes that extend a class
named Foo.

This code works when the class Foo exists in my project.

But I would also like it to work when the class Foo does not exist in the
project (i.e. the code will be broken and will not compile).

For example if I have the class



class Bar extends Foo{

}



and the class Foo does not exist in the project is it still possible to
find classes that extend Foo i.e. Bar?



The code above does not find Bar.

The code gets as far as "process(PossibleMatch, boolean) line: 1549"



<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550


so it does identify Bar as a possible match.

The problem arises when it goes to report the possible match



MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



it calls the method resolveLevel



/**
* Finds out whether the given ast node matches this search pattern.
* Returns IMPOSSIBLE_MATCH if it doesn't.
* Returns INACCURATE_MATCH if it potentially matches this search
pattern (ie. * it has already been resolved but resolving failed.)
* Returns ACCURATE_MATCH if it matches exactly this search pattern
(ie. * it doesn't need to be resolved or it has already been
resolved.)
*/
public int resolveLevel(ASTNode possibleMatchingNode) {
// only called with nodes which were possible matches to the call
to matchLevel
// need to do instance of checks to find out exact type of ASTNode
return IMPOSSIBLE_MATCH;
}



from the class



org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator



in order to see if the class that the class Bar extends is a match for the
class Foo.

But even though the node passed in to the method resolveLevel is for the
class Foo an IMPOSSIBLE_MATCH is returned as no bindings exist (or are
missing) for the class Foo. No bindings exist for the class Foo (I
presume) because the class Foo does not exist.

The problem with the lack of binding information can be seen here




ProblemReferenceBinding(ReferenceBinding).sourceName() line: 1136
ProblemReferenceBinding(ReferenceBinding).qualifiedSourceNam e() line:
1065
PatternLocator.qualifiedSourceName(TypeBinding) line: 113
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
TypeBinding) line: 749
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
char[], TypeBinding) line: 698
SuperTypeReferenceLocator.resolveLevel(ASTNode) line: 82
MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
MatchLocator.process(PossibleMatch, boolean) line: 1549
MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
line: 1037
MatchLocator.locateMatches(JavaProject, PossibleMatchSet, int) line:
1078
MatchLocator.locateMatches(SearchDocument[]) line: 1199
JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern,
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 94
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 217
BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 502
SearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 550



where the sourceName returned is null, and similiary when searching for
the package name. This results in an IMPOSSIBLE_MATCH being returned from
the method
org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator::resolveLevelForType.
Is there anyway to get around this and find Bar i.e. find all classes that
extend Foo even when the class Foo does not exist?

Creating the class Foo on the fly solves this problem but I was wondering
if there is a way of doing this without having to create the class Foo?


Any help greatly appreciated,

Máirtín
Re: test CR [message #560830 is a reply to message #6929] Wed, 11 July 2007 15:19 Go to previous message
Eclipse UserFriend
Originally posted by: dfgdf.dfgfd.ie

I am having a problem with searching for classes that extend another
class. The version of Eclipse that I am using is Version: 3.3.0, Build id:
I20070503-1400.

I have the following code



final Set<SearchMatch> classesThatExtendFoo= new
HashSet<SearchMatch>();

IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
SearchPattern pattern= SearchPattern.createPattern("Foo",
engine.search(pattern, new SearchParticipant[] {
SearchEngine.getDefaultSearchParticipant()},
scope,
new SearchRequestor() {

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
if (match.getAccuracy() == SearchMatch.A_ACCURATE &&
!match.isInsideDocComment())
System.out.println(match);
classesThatExtendFoo.add(match);
} }, new SubProgressMonitor(monitor, 1,
SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));



which I am trying to use in order to find classes that extend a class
named Foo.

This code works when the class Foo exists in my project.

But I would also like it to work when the class Foo does not exist in the
project (i.e. the code will be broken and will not compile).

For example if I have the class



class Bar extends Foo{

}



and the class Foo does not exist in the project is it still possible to
find classes that extend Foo i.e. Bar?



The code above does not find Bar.

The code gets as far as "process(PossibleMatch, boolean) line: 1549"



<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550


so it does identify Bar as a possible match.

The problem arises when it goes to report the possible match



MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



it calls the method resolveLevel



/**
* Finds out whether the given ast node matches this search pattern.
* Returns IMPOSSIBLE_MATCH if it doesn't.
* Returns INACCURATE_MATCH if it potentially matches this search
pattern (ie. * it has already been resolved but resolving failed.)
* Returns ACCURATE_MATCH if it matches exactly this search pattern
(ie. * it doesn't need to be resolved or it has already been
resolved.)
*/
public int resolveLevel(ASTNode possibleMatchingNode) {
// only called with nodes which were possible matches to the call
to matchLevel
// need to do instance of checks to find out exact type of ASTNode
return IMPOSSIBLE_MATCH;
}



from the class



org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator



in order to see if the class that the class Bar extends is a match for the
class Foo.

But even though the node passed in to the method resolveLevel is for the
class Foo an IMPOSSIBLE_MATCH is returned as no bindings exist (or are
missing) for the class Foo. No bindings exist for the class Foo (I
presume) because the class Foo does not exist.

The problem with the lack of binding information can be seen here




ProblemReferenceBinding(ReferenceBinding).sourceName() line: 1136
ProblemReferenceBinding(ReferenceBinding).qualifiedSourceNam e() line:
1065
PatternLocator.qualifiedSourceName(TypeBinding) line: 113
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
TypeBinding) line: 749
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
char[], TypeBinding) line: 698
SuperTypeReferenceLocator.resolveLevel(ASTNode) line: 82
MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
MatchLocator.process(PossibleMatch, boolean) line: 1549
MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
line: 1037
MatchLocator.locateMatches(JavaProject, PossibleMatchSet, int) line:
1078
MatchLocator.locateMatches(SearchDocument[]) line: 1199
JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern,
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 94
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 217
BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 502
SearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 550



where the sourceName returned is null, and similiary when searching for
the package name.


This results in an IMPOSSIBLE_MATCH being returned from the method




org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator::resolveLevelForType.



Is there anyway to get around this and find Bar i.e. find all classes that
extend Foo even when the class Foo does not exist?

Creating the class Foo on the fly solves this problem but I was wondering
if there is a way of doing this without having to create the class Foo?


Any help greatly appreciated,

Máirtín
Re: test CR [message #560843 is a reply to message #6951] Wed, 11 July 2007 15:20 Go to previous message
Eclipse UserFriend
Originally posted by: dfgfd.dfgfd.gfd

I am having a problem with searching for classes that extend another
class. The version of Eclipse that I am using is Version: 3.3.0, Build id:
I20070503-1400.

I have the following code



final Set<SearchMatch> classesThatExtendFoo= new
HashSet<SearchMatch>();

IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
SearchPattern pattern= SearchPattern.createPattern("Foo",
engine.search(pattern, new SearchParticipant[] {
SearchEngine.getDefaultSearchParticipant()},
scope,
new SearchRequestor() {

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
if (match.getAccuracy() == SearchMatch.A_ACCURATE &&
!match.isInsideDocComment())
System.out.println(match);
classesThatExtendFoo.add(match);
} }, new SubProgressMonitor(monitor, 1,
SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));



which I am trying to use in order to find classes that extend a class
named Foo.

This code works when the class Foo exists in my project.

But I would also like it to work when the class Foo does not exist in the
project (i.e. the code will be broken and will not compile).

For example if I have the class



class Bar extends Foo{

}



and the class Foo does not exist in the project is it still possible to
find classes that extend Foo i.e. Bar?



The code above does not find Bar.

The code gets as far as "process(PossibleMatch, boolean) line: 1549"



<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550


so it does identify Bar as a possible match.

The problem arises when it goes to report the possible match



MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



it calls the method resolveLevel



/**
* Finds out whether the given ast node matches this search pattern.
* Returns IMPOSSIBLE_MATCH if it doesn't.
* Returns INACCURATE_MATCH if it potentially matches this search
pattern (ie. * it has already been resolved but resolving failed.)
* Returns ACCURATE_MATCH if it matches exactly this search pattern
(ie. * it doesn't need to be resolved or it has already been
resolved.)
*/
public int resolveLevel(ASTNode possibleMatchingNode) {
// only called with nodes which were possible matches to the call
to matchLevel
// need to do instance of checks to find out exact type of ASTNode
return IMPOSSIBLE_MATCH;
}



from the class



org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator



in order to see if the class that the class Bar extends is a match for the
class Foo.

But even though the node passed in to the method resolveLevel is for the
class Foo an IMPOSSIBLE_MATCH is returned as no bindings exist (or are
missing) for the class Foo. No bindings exist for the class Foo (I
presume) because the class Foo does not exist.

The problem with the lack of binding information can be seen here




ProblemReferenceBinding(ReferenceBinding).sourceName() line: 1136
ProblemReferenceBinding(ReferenceBinding).qualifiedSourceNam e() line:
1065
PatternLocator.qualifiedSourceName(TypeBinding) line: 113
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
TypeBinding) line: 749
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
char[], TypeBinding) line: 698
SuperTypeReferenceLocator.resolveLevel(ASTNode) line: 82
MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
MatchLocator.process(PossibleMatch, boolean) line: 1549
MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
line: 1037
MatchLocator.locateMatches(JavaProject, PossibleMatchSet, int) line:
1078
MatchLocator.locateMatches(SearchDocument[]) line: 1199
JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern,
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 94
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 217
BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 502
SearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 550



where the sourceName returned is null, and similiary when searching for
the package name.


This results in an IMPOSSIBLE_MATCH being returned from the method




org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator::resolveLevelForType.



Is there anyway to get around this and find Bar i.e. find all classes that
extend Foo even when the class Foo does not exist?

Creating the class Foo on the fly solves this problem but I was wondering
if there is a way of doing this without having to create the class Foo?


Any help greatly appreciated,

Máirtín
Re: test CR [message #560857 is a reply to message #6975] Wed, 11 July 2007 15:21 Go to previous message
Eclipse UserFriend
Originally posted by: dfgdfg.dfgfd.dfgfd

I am having a problem with searching for classes that extend another
class. The version of Eclipse that I am using is Version: 3.3.0, Build id:
I20070503-1400.

I have the following code



final Set<SearchMatch> classesThatExtendFoo= new
HashSet<SearchMatch>();

IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
SearchPattern pattern= SearchPattern.createPattern("Foo",
engine.search(pattern, new SearchParticipant[] {
SearchEngine.getDefaultSearchParticipant()},
scope,
new SearchRequestor() {

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
if (match.getAccuracy() == SearchMatch.A_ACCURATE &&
!match.isInsideDocComment())
System.out.println(match);
classesThatExtendFoo.add(match);
} }, new SubProgressMonitor(monitor, 1,
SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));



which I am trying to use in order to find classes that extend a class
named Foo.

This code works when the class Foo exists in my project.

But I would also like it to work when the class Foo does not exist in the
project (i.e. the code will be broken and will not compile).

For example if I have the class



class Bar extends Foo{

}



and the class Foo does not exist in the project is it still possible to
find classes that extend Foo i.e. Bar?



The code above does not find Bar.

The code gets as far as "process(PossibleMatch, boolean) line: 1549"



<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550


so it does identify Bar as a possible match.

The problem arises when it goes to report the possible match



MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



it calls the method resolveLevel



/**
* Finds out whether the given ast node matches this search pattern.
* Returns IMPOSSIBLE_MATCH if it doesn't.
* Returns INACCURATE_MATCH if it potentially matches this search
pattern (ie. * it has already been resolved but resolving failed.)
* Returns ACCURATE_MATCH if it matches exactly this search pattern
(ie. * it doesn't need to be resolved or it has already been
resolved.)
*/
public int resolveLevel(ASTNode possibleMatchingNode) {
// only called with nodes which were possible matches to the call
to matchLevel
// need to do instance of checks to find out exact type of ASTNode
return IMPOSSIBLE_MATCH;
}



from the class



org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator



in order to see if the class that the class Bar extends is a match for the
class Foo.

But even though the node passed in to the method resolveLevel is for the
class Foo an IMPOSSIBLE_MATCH is returned as no bindings exist (or are
missing) for the class Foo. No bindings exist for the class Foo (I
presume) because the class Foo does not exist.

The problem with the lack of binding information can be seen here




ProblemReferenceBinding(ReferenceBinding).sourceName() line: 1136
ProblemReferenceBinding(ReferenceBinding).qualifiedSourceNam e() line:
1065
PatternLocator.qualifiedSourceName(TypeBinding) line: 113
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
TypeBinding) line: 749
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
char[], TypeBinding) line: 698
SuperTypeReferenceLocator.resolveLevel(ASTNode) line: 82
MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
MatchLocator.process(PossibleMatch, boolean) line: 1549
MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
line: 1037
MatchLocator.locateMatches(JavaProject, PossibleMatchSet, int) line:
1078
MatchLocator.locateMatches(SearchDocument[]) line: 1199
JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern,
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 94
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 217
BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 502
SearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 550



where the sourceName returned is null, and similiary when searching for
the package name.


This results in an IMPOSSIBLE_MATCH being returned from the method




org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator::resolveLevelForType.



Is there anyway to get around this and find Bar i.e. find all classes that
extend Foo even when the class Foo does not exist?

Creating the class Foo on the fly solves this problem but I was wondering
if there is a way of doing this without having to create the class Foo?


Any help greatly appreciated,

Máirtín
Re: test CR [message #560869 is a reply to message #7000] Wed, 11 July 2007 15:23 Go to previous message
Eclipse UserFriend
Originally posted by: dfgdf.dfgf.ie

I am having a problem with searching for classes that extend another
class. The version of Eclipse that I am using is Version: 3.3.0, Build id:
I20070503-1400.

I have the following code



final Set<SearchMatch> classesThatExtendFoo= new
HashSet<SearchMatch>();

IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
SearchPattern pattern= SearchPattern.createPattern("Foo",
engine.search(pattern, new SearchParticipant[] {
SearchEngine.getDefaultSearchParticipant()},
scope,
new SearchRequestor() {

@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException
{
if (match.getAccuracy() == SearchMatch.A_ACCURATE &&
!match.isInsideDocComment())
System.out.println(match);
classesThatExtendFoo.add(match);
} }, new SubProgressMonitor(monitor, 1,
SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));



which I am trying to use in order to find classes that extend a class
named Foo.

This code works when the class Foo exists in my project.

But I would also like it to work when the class Foo does not exist in the
project (i.e. the code will be broken and will not compile).

For example if I have the class



class Bar extends Foo{

}



and the class Foo does not exist in the project is it still possible to
find classes that extend Foo i.e. Bar?



The code above does not find Bar.

The code gets as far as "process(PossibleMatch, boolean) line: 1549"



<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



so it does identify Bar as a possible match.

The problem arises when it goes to report the possible match



MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
<unknown receiving type>(MatchLocator).process(PossibleMatch, boolean)
line: 1549
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatch[], int, int) line: 1037
<unknown receiving type>(MatchLocator).locateMatches(JavaProject,
PossibleMatchSet, int) line: 1078
<unknown receiving type>(MatchLocator).locateMatches(SearchDocument[])
line: 1199
<unknown receiving
type>(JavaSearchParticipant).locateMatches(SearchDocument[],
SearchPattern, IJavaSearchScope, SearchRequestor, IProgressMonitor) line:
94
<unknown receiving type>(BasicSearchEngine).findMatches(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 217
<unknown receiving type>(BasicSearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 502
<unknown receiving type>(SearchEngine).search(SearchPattern,
SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
line: 550



it calls the method resolveLevel



/**
* Finds out whether the given ast node matches this search pattern.
* Returns IMPOSSIBLE_MATCH if it doesn't.
* Returns INACCURATE_MATCH if it potentially matches this search
pattern (ie. * it has already been resolved but resolving failed.)
* Returns ACCURATE_MATCH if it matches exactly this search pattern
(ie. * it doesn't need to be resolved or it has already been
resolved.)
*/
public int resolveLevel(ASTNode possibleMatchingNode) {
// only called with nodes which were possible matches to the call
to matchLevel
// need to do instance of checks to find out exact type of ASTNode
return IMPOSSIBLE_MATCH;
}



from the class



org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator



in order to see if the class that the class Bar extends is a match for the
class Foo.

But even though the node passed in to the method resolveLevel is for the
class Foo an IMPOSSIBLE_MATCH is returned as no bindings exist (or are
missing) for the class Foo. No bindings exist for the class Foo (I
presume) because the class Foo does not exist.

The problem with the lack of binding information can be seen here




ProblemReferenceBinding(ReferenceBinding).sourceName() line: 1136
ProblemReferenceBinding(ReferenceBinding).qualifiedSourceNam e() line:
1065
PatternLocator.qualifiedSourceName(TypeBinding) line: 113
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
TypeBinding) line: 749
SuperTypeReferenceLocator(PatternLocator).resolveLevelForTyp e(char[],
char[], TypeBinding) line: 698
SuperTypeReferenceLocator.resolveLevel(ASTNode) line: 82
MatchLocator.reportMatching(CompilationUnitDeclaration, boolean) line:
2139
MatchLocator.process(PossibleMatch, boolean) line: 1549
MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
line: 1037
MatchLocator.locateMatches(JavaProject, PossibleMatchSet, int) line:
1078
MatchLocator.locateMatches(SearchDocument[]) line: 1199
JavaSearchParticipant.locateMatches(SearchDocument[], SearchPattern,
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 94
BasicSearchEngine.findMatches(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 217
BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 502
SearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor) line: 550



where the sourceName returned is null, and similiary when searching for
the package name.


This results in an IMPOSSIBLE_MATCH being returned from the method




org.eclipse.jdt.internal.core.search.matching.SuperTypeRefer enceLocator::resolveLevelForType.



Is there anyway to get around this and find Bar i.e. find all classes that
extend Foo even when the class Foo does not exist?

Creating the class Foo on the fly solves this problem but I was wondering
if there is a way of doing this without having to create the class Foo?


Any help greatly appreciated,

Máirtín
Previous Topic:test CR
Next Topic:fdg
Goto Forum:
  


Current Time: Thu Apr 25 01:09:42 GMT 2024

Powered by FUDForum. Page generated in 0.05556 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top