private void reportMatching(Annotation[][] annotationsList, IJavaElement enclosingElement, Binding binding, MatchingNodeSet nodeSet, boolean matchedClassContainer) throws CoreException { if (annotationsList != null) { for (int i = 0, length = annotationsList.length; i < length; ++i) { Annotation[] annotations = annotationsList[i]; if (annotations != null) reportMatching(annotations, enclosingElement, null, binding, nodeSet, matchedClassContainer, encloses(enclosingElement)); } } } /**
private void reportMatching(Annotation[][] annotationsList, IJavaElement enclosingElement, Binding binding, MatchingNodeSet nodeSet, boolean matchedClassContainer) throws CoreException { if (annotationsList != null) { for (int i = 0, length = annotationsList.length; i < length; ++i) { Annotation[] annotations = annotationsList[i]; if (annotations != null) reportMatching(annotations, enclosingElement, null, binding, nodeSet, matchedClassContainer, encloses(enclosingElement)); } } } /**
/** * Reports the match of the given import reference. */ protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (locator.encloses(element)) { // default is to report a match as a regular ref. this.matchReportReference(importRef, element, null/*no binding*/, accuracy, locator); } } /**
/** * Reports the match of the given import reference. */ protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (locator.encloses(element)) { // default is to report a match as a regular ref. this.matchReportReference(importRef, element, null/*no binding*/, accuracy, locator); } } /**
/** * Reports the match of the given import reference. */ protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (locator.encloses(element)) { // default is to report a match as a regular ref. this.matchReportReference(importRef, element, null/*no binding*/, accuracy, locator); } } /**
private void reportMatching(Annotation[][] annotationsList, IJavaElement enclosingElement, Binding binding, MatchingNodeSet nodeSet, boolean matchedClassContainer) throws CoreException { if (annotationsList != null) { for (int i = 0, length = annotationsList.length; i < length; ++i) { Annotation[] annotations = annotationsList[i]; if (annotations != null) reportMatching(annotations, enclosingElement, null, binding, nodeSet, matchedClassContainer, encloses(enclosingElement)); } } } /**
/** * Reports the match of the given import reference. */ protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (locator.encloses(element)) { // default is to report a match as a regular ref. this.matchReportReference(importRef, element, null/*no binding*/, accuracy, locator); } } /**
private void reportMatching(Annotation[][] annotationsList, IJavaElement enclosingElement, Binding binding, MatchingNodeSet nodeSet, boolean matchedClassContainer) throws CoreException { if (annotationsList != null) { for (int i = 0, length = annotationsList.length; i < length; ++i) { Annotation[] annotations = annotationsList[i]; if (annotations != null) reportMatching(annotations, enclosingElement, null, binding, nodeSet, matchedClassContainer, encloses(enclosingElement)); } } } /**
private void reportMatching(Annotation[][] annotationsList, IJavaElement enclosingElement, Binding binding, MatchingNodeSet nodeSet, boolean matchedClassContainer) throws CoreException { if (annotationsList != null) { for (int i = 0, length = annotationsList.length; i < length; ++i) { Annotation[] annotations = annotationsList[i]; if (annotations != null) reportMatching(annotations, enclosingElement, null, binding, nodeSet, matchedClassContainer, encloses(enclosingElement)); } } } /**
/** * Reports the match of the given import reference. */ protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (locator.encloses(element)) { // default is to report a match as a regular ref. this.matchReportReference(importRef, element, null/*no binding*/, accuracy, locator); } } /**
/** * Reports the match of the given import reference. */ protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (locator.encloses(element)) { // default is to report a match as a regular ref. this.matchReportReference(importRef, element, null/*no binding*/, accuracy, locator); } } /**
protected void reportMatchingSuper(TypeReference superReference, IJavaElement enclosingElement, Binding elementBinding, MatchingNodeSet nodeSet, boolean matchedClassContainer) throws CoreException { ASTNode[] nodes = null; if (superReference instanceof ParameterizedSingleTypeReference || superReference instanceof ParameterizedQualifiedTypeReference) { long lastTypeArgumentInfo = findLastTypeArgumentInfo(superReference); nodes = nodeSet.matchingNodes(superReference.sourceStart, (int)lastTypeArgumentInfo); } if (nodes != null) { if ((this.matchContainer & PatternLocator.CLASS_CONTAINER) == 0) { for (int i = 0, l = nodes.length; i < l; i++) nodeSet.matchingNodes.removeKey(nodes[i]); } else { if (encloses(enclosingElement)) for (int i = 0, l = nodes.length; i < l; i++) { ASTNode node = nodes[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); this.patternLocator.matchReportReference(node, enclosingElement, null, null, elementBinding, level.intValue(), this); } } } else if (encloses(enclosingElement)) { Integer level = (Integer) nodeSet.matchingNodes.removeKey(superReference); if (level != null && matchedClassContainer) this.patternLocator.matchReportReference(superReference, enclosingElement, null, null, elementBinding, level.intValue(), this); } } protected boolean typeInHierarchy(ReferenceBinding binding) {
protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (binding == null) { this.matchReportReference(importRef, element, null/*no binding*/, accuracy, locator); } else { if (locator.encloses(element)) { long[] positions = importRef.sourcePositions; int last = positions.length - 1; if (binding instanceof ProblemReferenceBinding) binding = ((ProblemReferenceBinding) binding).closestMatch(); if (binding instanceof ReferenceBinding) { PackageBinding pkgBinding = ((ReferenceBinding) binding).fPackage; if (pkgBinding != null) last = pkgBinding.compoundName.length; } if (binding instanceof PackageBinding) last = ((PackageBinding) binding).compoundName.length; int start = (int) (positions[0] >>> 32); int end = (int) positions[last - 1]; this.match = locator.newPackageReferenceMatch(element, accuracy, start, end-start+1, importRef); locator.report(this.match); } } } protected void matchReportReference(ASTNode reference, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException {
protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (binding == null) { this.matchReportReference(importRef, element, null/*no binding*/, accuracy, locator); } else { if (locator.encloses(element)) { long[] positions = importRef.sourcePositions; int last = positions.length - 1; if (binding instanceof ProblemReferenceBinding) binding = ((ProblemReferenceBinding) binding).closestMatch(); if (binding instanceof ReferenceBinding) { PackageBinding pkgBinding = ((ReferenceBinding) binding).fPackage; if (pkgBinding != null) last = pkgBinding.compoundName.length; } if (binding instanceof PackageBinding) last = ((PackageBinding) binding).compoundName.length; int start = (int) (positions[0] >>> 32); int end = (int) positions[last > 0 ? last - 1 : 0]; this.match = locator.newPackageReferenceMatch(element, accuracy, start, end-start+1, importRef); locator.report(this.match); } } } protected void matchReportReference(ASTNode reference, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException {
@Override protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (binding == null) { this.matchReportReference(importRef, element, null/*no binding*/, accuracy, locator); } else { if (locator.encloses(element)) { long[] positions = importRef.sourcePositions; int last = positions.length - 1; if (binding instanceof ProblemReferenceBinding) binding = ((ProblemReferenceBinding) binding).closestMatch(); if (binding instanceof ReferenceBinding) { PackageBinding pkgBinding = ((ReferenceBinding) binding).fPackage; if (pkgBinding != null) last = pkgBinding.compoundName.length; } if (binding instanceof PackageBinding) last = ((PackageBinding) binding).compoundName.length; int start = (int) (positions[0] >>> 32); int end = (int) positions[last > 0 ? last - 1 : 0]; this.match = locator.newPackageReferenceMatch(element, accuracy, start, end-start+1, importRef); locator.report(this.match); } } } @Override
protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { if (binding == null) { this.matchReportReference(importRef, element, null/*no binding*/, accuracy, locator); } else { if (locator.encloses(element)) { long[] positions = importRef.sourcePositions; int last = positions.length - 1; if (binding instanceof ProblemReferenceBinding) binding = ((ProblemReferenceBinding) binding).closestMatch(); if (binding instanceof ReferenceBinding) { PackageBinding pkgBinding = ((ReferenceBinding) binding).fPackage; if (pkgBinding != null) last = pkgBinding.compoundName.length; } if (binding instanceof PackageBinding) last = ((PackageBinding) binding).compoundName.length; int start = (int) (positions[0] >>> 32); int end = (int) positions[last - 1]; this.match = locator.newPackageReferenceMatch(element, accuracy, start, end-start+1, importRef); locator.report(this.match); } } } protected void matchReportReference(ASTNode reference, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException {
protected void matchReportReference(ArrayTypeReference arrayRef, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException { if (this.pattern.simpleName == null) { // TODO (frederic) need to add a test for this case while searching generic types... if (locator.encloses(element)) { int offset = arrayRef.sourceStart; int length = arrayRef.sourceEnd-offset+1; if (this.match == null) { this.match = locator.newTypeReferenceMatch(element, elementBinding, accuracy, offset, length, arrayRef); } else { this.match.setOffset(offset); this.match.setLength(length); } locator.report(this.match); return; } } this.match = locator.newTypeReferenceMatch(element, elementBinding, accuracy, arrayRef); if (arrayRef.resolvedType != null) { matchReportReference(arrayRef, -1, arrayRef.resolvedType.leafComponentType(), locator); return; } locator.reportAccurateTypeReference(this.match, arrayRef, this.pattern.simpleName); } /**
protected void matchReportReference(ArrayTypeReference arrayRef, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException { if (this.pattern.simpleName == null) { // TODO (frederic) need to add a test for this case while searching generic types... if (locator.encloses(element)) { int offset = arrayRef.sourceStart; int length = arrayRef.sourceEnd-offset+1; if (this.match == null) { this.match = locator.newTypeReferenceMatch(element, elementBinding, accuracy, offset, length, arrayRef); } else { this.match.setOffset(offset); this.match.setLength(length); } locator.report(this.match); return; } } this.match = locator.newTypeReferenceMatch(element, elementBinding, accuracy, arrayRef); if (arrayRef.resolvedType != null) { matchReportReference(arrayRef, -1, arrayRef.resolvedType.leafComponentType(), locator); return; } locator.reportAccurateTypeReference(this.match, arrayRef, this.pattern.simpleName); } /**
protected void matchReportReference(ArrayTypeReference arrayRef, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException { if (this.pattern.simpleName == null) { // TODO (frederic) need to add a test for this case while searching generic types... if (locator.encloses(element)) { int offset = arrayRef.sourceStart; int length = arrayRef.sourceEnd-offset+1; if (this.match == null) { this.match = locator.newTypeReferenceMatch(element, elementBinding, accuracy, offset, length, arrayRef); } else { this.match.setOffset(offset); this.match.setLength(length); } locator.report(this.match); return; } } this.match = locator.newTypeReferenceMatch(element, elementBinding, accuracy, arrayRef); if (arrayRef.resolvedType != null) { matchReportReference(arrayRef, -1, arrayRef.resolvedType.leafComponentType(), locator); return; } locator.reportAccurateTypeReference(this.match, arrayRef, this.pattern.simpleName); } /**
protected void matchReportReference(ArrayTypeReference arrayRef, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException { if (this.pattern.simpleName == null) { // TODO (frederic) need to add a test for this case while searching generic types... if (locator.encloses(element)) { int offset = arrayRef.sourceStart; int length = arrayRef.sourceEnd-offset+1; if (this.match == null) { this.match = locator.newTypeReferenceMatch(element, elementBinding, accuracy, offset, length, arrayRef); } else { this.match.setOffset(offset); this.match.setLength(length); } locator.report(this.match); return; } } this.match = locator.newTypeReferenceMatch(element, elementBinding, accuracy, arrayRef); if (arrayRef.resolvedType != null) { matchReportReference(arrayRef, -1, arrayRef.resolvedType.leafComponentType(), locator); return; } locator.reportAccurateTypeReference(this.match, arrayRef, this.pattern.simpleName); } /**