Lines 1767-1781
Link Here
|
1767 |
|
1767 |
|
1768 |
// report annotations |
1768 |
// report annotations |
1769 |
if (method.annotations != null) { |
1769 |
if (method.annotations != null) { |
1770 |
for (int i=0, al=method.annotations.length; i<al; i++) { |
1770 |
if (enclosingElement == null) { |
1771 |
TypeReference typeRef = method.annotations[i].type; |
1771 |
enclosingElement = createHandle(method, parent); |
1772 |
Integer level = (Integer) nodeSet.matchingNodes.removeKey(typeRef); |
|
|
1773 |
if (level != null) { |
1774 |
if (enclosingElement == null) |
1775 |
enclosingElement = createHandle(method, parent); |
1776 |
this.patternLocator.matchReportReference(typeRef, enclosingElement, method.binding, level.intValue(), this); |
1777 |
} |
1778 |
} |
1772 |
} |
|
|
1773 |
reportMatching(method.annotations, enclosingElement, method.binding, nodeSet, true, true); |
1779 |
} |
1774 |
} |
1780 |
|
1775 |
|
1781 |
// references in this method |
1776 |
// references in this method |
Lines 1800-1805
Link Here
|
1800 |
} |
1795 |
} |
1801 |
} |
1796 |
} |
1802 |
/** |
1797 |
/** |
|
|
1798 |
* Report matching in annotations. |
1799 |
*/ |
1800 |
protected void reportMatching(Annotation[] annotations, IJavaElement enclosingElement, Binding elementBinding, MatchingNodeSet nodeSet, boolean matchedContainer, boolean enclosesElement) throws CoreException { |
1801 |
for (int i=0, al=annotations.length; i<al; i++) { |
1802 |
Annotation annotationType = annotations[i]; |
1803 |
|
1804 |
// Look for annotation type ref |
1805 |
TypeReference typeRef = annotationType.type; |
1806 |
Integer level = (Integer) nodeSet.matchingNodes.removeKey(typeRef); |
1807 |
if (level != null && matchedContainer) { |
1808 |
this.patternLocator.matchReportReference(typeRef, enclosingElement, elementBinding, level.intValue(), this); |
1809 |
} |
1810 |
|
1811 |
// Look for attribute ref |
1812 |
MemberValuePair[] pairs = annotationType.memberValuePairs(); |
1813 |
for (int j = 0, pl = pairs.length; j < pl; j++) { |
1814 |
MemberValuePair pair = pairs[j]; |
1815 |
level = (Integer) nodeSet.matchingNodes.removeKey(pair); |
1816 |
if (level != null && enclosesElement) { |
1817 |
ASTNode reference = (annotationType instanceof SingleMemberAnnotation) ? (ASTNode) annotationType: pair; |
1818 |
this.patternLocator.matchReportReference(reference, enclosingElement, pair.binding, level.intValue(), this); |
1819 |
} |
1820 |
} |
1821 |
} |
1822 |
} |
1823 |
/** |
1803 |
* Visit the given resolved parse tree and report the nodes that match the search pattern. |
1824 |
* Visit the given resolved parse tree and report the nodes that match the search pattern. |
1804 |
*/ |
1825 |
*/ |
1805 |
protected void reportMatching(CompilationUnitDeclaration unit, boolean mustResolve) throws CoreException { |
1826 |
protected void reportMatching(CompilationUnitDeclaration unit, boolean mustResolve) throws CoreException { |
Lines 1889-1903
Link Here
|
1889 |
|
1910 |
|
1890 |
// report annotations |
1911 |
// report annotations |
1891 |
if (field.annotations != null) { |
1912 |
if (field.annotations != null) { |
1892 |
for (int i=0, al=field.annotations.length; i<al; i++) { |
1913 |
if (enclosingElement == null) { |
1893 |
TypeReference typeRef = field.annotations[i].type; |
1914 |
enclosingElement = createHandle(field, type, parent); |
1894 |
Integer level = (Integer) nodeSet.matchingNodes.removeKey(typeRef); |
|
|
1895 |
if (level != null) { |
1896 |
if (enclosingElement == null) |
1897 |
enclosingElement = createHandle(field, type, parent); |
1898 |
this.patternLocator.matchReportReference(typeRef, enclosingElement, field.binding, level.intValue(), this); |
1899 |
} |
1900 |
} |
1915 |
} |
|
|
1916 |
reportMatching(field.annotations, enclosingElement, field.binding, nodeSet, true, true); |
1901 |
} |
1917 |
} |
1902 |
|
1918 |
|
1903 |
if (typeInHierarchy) { |
1919 |
if (typeInHierarchy) { |
Lines 1940-1948
Link Here
|
1940 |
enclosingElement = member.getType(new String(type.name), occurrenceCount); |
1956 |
enclosingElement = member.getType(new String(type.name), occurrenceCount); |
1941 |
} |
1957 |
} |
1942 |
if (enclosingElement == null) return; |
1958 |
if (enclosingElement == null) return; |
|
|
1959 |
boolean enclosesElement = encloses(enclosingElement); |
1943 |
|
1960 |
|
1944 |
// report the type declaration |
1961 |
// report the type declaration |
1945 |
if (accuracy > -1 && encloses(enclosingElement)) { |
1962 |
if (accuracy > -1 && enclosesElement) { |
1946 |
int offset = type.sourceStart; |
1963 |
int offset = type.sourceStart; |
1947 |
SearchMatch match = this.patternLocator.newDeclarationMatch(type, enclosingElement, type.binding, accuracy, type.sourceEnd-offset+1, this); |
1964 |
SearchMatch match = this.patternLocator.newDeclarationMatch(type, enclosingElement, type.binding, accuracy, type.sourceEnd-offset+1, this); |
1948 |
report(match); |
1965 |
report(match); |
Lines 1957-1963
Link Here
|
1957 |
if (typeParameter != null) { |
1974 |
if (typeParameter != null) { |
1958 |
Integer level = (Integer) nodeSet.matchingNodes.removeKey(typeParameter); |
1975 |
Integer level = (Integer) nodeSet.matchingNodes.removeKey(typeParameter); |
1959 |
if (level != null && matchedClassContainer) { |
1976 |
if (level != null && matchedClassContainer) { |
1960 |
if (level.intValue() > -1 && encloses(enclosingElement)) { |
1977 |
if (level.intValue() > -1 && enclosesElement) { |
1961 |
int offset = typeParameter.sourceStart; |
1978 |
int offset = typeParameter.sourceStart; |
1962 |
SearchMatch match = this.patternLocator.newDeclarationMatch(typeParameter, enclosingElement, type.binding, level.intValue(), typeParameter.sourceEnd-offset+1, this); |
1979 |
SearchMatch match = this.patternLocator.newDeclarationMatch(typeParameter, enclosingElement, type.binding, level.intValue(), typeParameter.sourceEnd-offset+1, this); |
1963 |
report(match); |
1980 |
report(match); |
Lines 1983-1995
Link Here
|
1983 |
|
2000 |
|
1984 |
// report annotations |
2001 |
// report annotations |
1985 |
if (type.annotations != null) { |
2002 |
if (type.annotations != null) { |
1986 |
for (int i=0, al=type.annotations.length; i<al; i++) { |
2003 |
reportMatching(type.annotations, enclosingElement, type.binding, nodeSet, matchedClassContainer, enclosesElement); |
1987 |
TypeReference typeRef = type.annotations[i].type; |
|
|
1988 |
Integer level = (Integer) nodeSet.matchingNodes.removeKey(typeRef); |
1989 |
if (level != null && matchedClassContainer) { |
1990 |
this.patternLocator.matchReportReference(typeRef, enclosingElement, type.binding, level.intValue(), this); |
1991 |
} |
1992 |
} |
1993 |
} |
2004 |
} |
1994 |
|
2005 |
|
1995 |
// report references in javadoc |
2006 |
// report references in javadoc |
Lines 2003-2010
Link Here
|
2003 |
for (int i = 0, l = nodes.length; i < l; i++) { |
2014 |
for (int i = 0, l = nodes.length; i < l; i++) { |
2004 |
ASTNode node = nodes[i]; |
2015 |
ASTNode node = nodes[i]; |
2005 |
Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); |
2016 |
Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); |
2006 |
if (encloses(enclosingElement)) |
2017 |
if (enclosesElement) { |
2007 |
this.patternLocator.matchReportReference(node, enclosingElement, type.binding, level.intValue(), this); |
2018 |
this.patternLocator.matchReportReference(node, enclosingElement, type.binding, level.intValue(), this); |
|
|
2019 |
} |
2008 |
} |
2020 |
} |
2009 |
} |
2021 |
} |
2010 |
} |
2022 |
} |