public IMemberValuePair[] getMemberValuePairs() throws JavaModelException { Object info = getElementInfo(); if (info instanceof AnnotationInfo) return ((AnnotationInfo) info).members; IBinaryElementValuePair[] binaryAnnotations = ((IBinaryAnnotation) info).getElementValuePairs(); int length = binaryAnnotations.length; IMemberValuePair[] result = new IMemberValuePair[length]; for (int i = 0; i < length; i++) { IBinaryElementValuePair binaryAnnotation = binaryAnnotations[i]; MemberValuePair memberValuePair = new MemberValuePair(new String(binaryAnnotation.getName())); memberValuePair.value = Util.getAnnotationMemberValue(this, memberValuePair, binaryAnnotation.getValue()); result[i] = memberValuePair; } return result; }
private void scanTypeForContainerAnnotation(IBinaryType binaryType, char[][][] missingTypeNames) { if (!isPrototype()) throw new IllegalStateException(); IBinaryAnnotation[] annotations = binaryType.getAnnotations(); if (annotations != null) { int length = annotations.length; for (int i = 0; i < length; i++) { char[] annotationTypeName = annotations[i].getTypeName(); if (CharOperation.equals(annotationTypeName, ConstantPool.JAVA_LANG_ANNOTATION_REPEATABLE)) { IBinaryElementValuePair[] elementValuePairs = annotations[i].getElementValuePairs(); if (elementValuePairs != null && elementValuePairs.length == 1) { Object value = elementValuePairs[0].getValue(); if (value instanceof ClassSignature) { this.containerAnnotationType = (ReferenceBinding) this.environment.getTypeFromSignature(((ClassSignature)value).getTypeName(), 0, -1, false, null, missingTypeNames, ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); } } break; } } } }
private void scanTypeForContainerAnnotation(IBinaryType binaryType, char[][][] missingTypeNames) { if (!isPrototype()) throw new IllegalStateException(); IBinaryAnnotation[] annotations = binaryType.getAnnotations(); if (annotations != null) { int length = annotations.length; for (int i = 0; i < length; i++) { char[] annotationTypeName = annotations[i].getTypeName(); if (CharOperation.equals(annotationTypeName, ConstantPool.JAVA_LANG_ANNOTATION_REPEATABLE)) { IBinaryElementValuePair[] elementValuePairs = annotations[i].getElementValuePairs(); if (elementValuePairs != null && elementValuePairs.length == 1) { Object value = elementValuePairs[0].getValue(); if (value instanceof ClassSignature) { this.containerAnnotationType = (ReferenceBinding) this.environment.getTypeFromSignature(((ClassSignature)value).getTypeName(), 0, -1, false, null, missingTypeNames, TypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); } } break; } } } }
public IMemberValuePair[] getMemberValuePairs() throws JavaModelException { Object info = getElementInfo(); if (info instanceof AnnotationInfo) return ((AnnotationInfo) info).members; IBinaryElementValuePair[] binaryAnnotations = ((IBinaryAnnotation) info).getElementValuePairs(); int length = binaryAnnotations.length; IMemberValuePair[] result = new IMemberValuePair[length]; for (int i = 0; i < length; i++) { IBinaryElementValuePair binaryAnnotation = binaryAnnotations[i]; MemberValuePair memberValuePair = new MemberValuePair(new String(binaryAnnotation.getName())); memberValuePair.value = Util.getAnnotationMemberValue(this, memberValuePair, binaryAnnotation.getValue()); result[i] = memberValuePair; } return result; }
private void scanTypeForContainerAnnotation(IBinaryType binaryType, char[][][] missingTypeNames) { if (!isPrototype()) throw new IllegalStateException(); IBinaryAnnotation[] annotations = binaryType.getAnnotations(); if (annotations != null) { int length = annotations.length; for (int i = 0; i < length; i++) { char[] annotationTypeName = annotations[i].getTypeName(); if (CharOperation.equals(annotationTypeName, ConstantPool.JAVA_LANG_ANNOTATION_REPEATABLE)) { IBinaryElementValuePair[] elementValuePairs = annotations[i].getElementValuePairs(); if (elementValuePairs != null && elementValuePairs.length == 1) { Object value = elementValuePairs[0].getValue(); if (value instanceof ClassSignature) { this.containerAnnotationType = (ReferenceBinding) this.environment.getTypeFromSignature(((ClassSignature)value).getTypeName(), 0, -1, false, null, missingTypeNames, ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); } } break; } } } }
public IMemberValuePair[] getMemberValuePairs() throws JavaModelException { Object info = getElementInfo(); if (info instanceof AnnotationInfo) return ((AnnotationInfo) info).members; IBinaryElementValuePair[] binaryAnnotations = ((IBinaryAnnotation) info).getElementValuePairs(); int length = binaryAnnotations.length; IMemberValuePair[] result = new IMemberValuePair[length]; for (int i = 0; i < length; i++) { IBinaryElementValuePair binaryAnnotation = binaryAnnotations[i]; MemberValuePair memberValuePair = new MemberValuePair(new String(binaryAnnotation.getName())); memberValuePair.value = Util.getAnnotationMemberValue(this, memberValuePair, binaryAnnotation.getValue()); result[i] = memberValuePair; } return result; }
private void scanTypeForContainerAnnotation(IBinaryType binaryType, char[][][] missingTypeNames) { if (!isPrototype()) throw new IllegalStateException(); IBinaryAnnotation[] annotations = binaryType.getAnnotations(); if (annotations != null) { int length = annotations.length; for (int i = 0; i < length; i++) { char[] annotationTypeName = annotations[i].getTypeName(); if (CharOperation.equals(annotationTypeName, ConstantPool.JAVA_LANG_ANNOTATION_REPEATABLE)) { IBinaryElementValuePair[] elementValuePairs = annotations[i].getElementValuePairs(); if (elementValuePairs != null && elementValuePairs.length == 1) { Object value = elementValuePairs[0].getValue(); if (value instanceof ClassSignature) { this.containerAnnotationType = (ReferenceBinding) this.environment.getTypeFromSignature(((ClassSignature)value).getTypeName(), 0, -1, false, null, missingTypeNames, ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); } } break; } } } }
public IMemberValuePair[] getMemberValuePairs() throws JavaModelException { Object info = getElementInfo(); if (info instanceof AnnotationInfo) return ((AnnotationInfo) info).members; IBinaryElementValuePair[] binaryAnnotations = ((IBinaryAnnotation) info).getElementValuePairs(); int length = binaryAnnotations.length; IMemberValuePair[] result = new IMemberValuePair[length]; for (int i = 0; i < length; i++) { IBinaryElementValuePair binaryAnnotation = binaryAnnotations[i]; MemberValuePair memberValuePair = new MemberValuePair(new String(binaryAnnotation.getName())); memberValuePair.value = Util.getAnnotationMemberValue(this, memberValuePair, binaryAnnotation.getValue()); result[i] = memberValuePair; } return result; }
private void scanTypeForContainerAnnotation(IBinaryType binaryType, char[][][] missingTypeNames) { if (!isPrototype()) throw new IllegalStateException(); IBinaryAnnotation[] annotations = binaryType.getAnnotations(); if (annotations != null) { int length = annotations.length; for (int i = 0; i < length; i++) { char[] annotationTypeName = annotations[i].getTypeName(); if (CharOperation.equals(annotationTypeName, ConstantPool.JAVA_LANG_ANNOTATION_REPEATABLE)) { IBinaryElementValuePair[] elementValuePairs = annotations[i].getElementValuePairs(); if (elementValuePairs != null && elementValuePairs.length == 1) { Object value = elementValuePairs[0].getValue(); if (value instanceof ClassSignature) { this.containerAnnotationType = (ReferenceBinding) this.environment.getTypeFromSignature(((ClassSignature)value).getTypeName(), 0, -1, false, null, missingTypeNames, TypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); } } break; } } } }
public IMemberValuePair[] getMemberValuePairs() throws JavaModelException { Object info = getElementInfo(); if (info instanceof AnnotationInfo) return ((AnnotationInfo) info).members; IBinaryElementValuePair[] binaryAnnotations = ((IBinaryAnnotation) info).getElementValuePairs(); int length = binaryAnnotations.length; IMemberValuePair[] result = new IMemberValuePair[length]; for (int i = 0; i < length; i++) { IBinaryElementValuePair binaryAnnotation = binaryAnnotations[i]; MemberValuePair memberValuePair = new MemberValuePair(new String(binaryAnnotation.getName())); memberValuePair.value = Util.getAnnotationMemberValue(this, memberValuePair, binaryAnnotation.getValue()); result[i] = memberValuePair; } return result; }
private void scanTypeForContainerAnnotation(IBinaryType binaryType, char[][][] missingTypeNames) { if (!isPrototype()) throw new IllegalStateException(); IBinaryAnnotation[] annotations = binaryType.getAnnotations(); if (annotations != null) { int length = annotations.length; for (int i = 0; i < length; i++) { char[] annotationTypeName = annotations[i].getTypeName(); if (CharOperation.equals(annotationTypeName, ConstantPool.JAVA_LANG_ANNOTATION_REPEATABLE)) { IBinaryElementValuePair[] elementValuePairs = annotations[i].getElementValuePairs(); if (elementValuePairs != null && elementValuePairs.length == 1) { Object value = elementValuePairs[0].getValue(); if (value instanceof ClassSignature) { this.containerAnnotationType = (ReferenceBinding) this.environment.getTypeFromSignature(((ClassSignature)value).getTypeName(), 0, -1, false, null, missingTypeNames, TypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); } } break; } } } }
@Override public IMemberValuePair[] getMemberValuePairs() throws JavaModelException { Object info = getElementInfo(); if (info instanceof AnnotationInfo) return ((AnnotationInfo) info).members; IBinaryElementValuePair[] binaryAnnotations = ((IBinaryAnnotation) info).getElementValuePairs(); int length = binaryAnnotations.length; IMemberValuePair[] result = new IMemberValuePair[length]; for (int i = 0; i < length; i++) { IBinaryElementValuePair binaryAnnotation = binaryAnnotations[i]; MemberValuePair memberValuePair = new MemberValuePair(new String(binaryAnnotation.getName())); memberValuePair.value = Util.getAnnotationMemberValue(this, memberValuePair, binaryAnnotation.getValue()); result[i] = memberValuePair; } return result; }
private void scanTypeForContainerAnnotation(IBinaryType binaryType, char[][][] missingTypeNames) { if (!isPrototype()) throw new IllegalStateException(); IBinaryAnnotation[] annotations = binaryType.getAnnotations(); if (annotations != null) { int length = annotations.length; for (int i = 0; i < length; i++) { char[] annotationTypeName = annotations[i].getTypeName(); if (CharOperation.equals(annotationTypeName, ConstantPool.JAVA_LANG_ANNOTATION_REPEATABLE)) { IBinaryElementValuePair[] elementValuePairs = annotations[i].getElementValuePairs(); if (elementValuePairs != null && elementValuePairs.length == 1) { Object value = elementValuePairs[0].getValue(); if (value instanceof ClassSignature) { this.containerAnnotationType = (ReferenceBinding) this.environment.getTypeFromSignature(((ClassSignature)value).getTypeName(), 0, -1, false, null, missingTypeNames, ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); } } break; } } } }
private boolean hasStructuralAnnotationChanges(IBinaryAnnotation[] currentAnnotations, IBinaryAnnotation[] otherAnnotations) { if (currentAnnotations == otherAnnotations) return false; int currentAnnotationsLength = currentAnnotations == null ? 0 : currentAnnotations.length; int otherAnnotationsLength = otherAnnotations == null ? 0 : otherAnnotations.length; if (currentAnnotationsLength != otherAnnotationsLength) return true; for (int i = 0; i < currentAnnotationsLength; i++) { if (!CharOperation.equals(currentAnnotations[i].getTypeName(), otherAnnotations[i].getTypeName())) return true; IBinaryElementValuePair[] currentPairs = currentAnnotations[i].getElementValuePairs(); IBinaryElementValuePair[] otherPairs = otherAnnotations[i].getElementValuePairs(); int currentPairsLength = currentPairs == null ? 0 : currentPairs.length; int otherPairsLength = otherPairs == null ? 0 : otherPairs.length; if (currentPairsLength != otherPairsLength) return true; for (int j = 0; j < currentPairsLength; j++) { if (!CharOperation.equals(currentPairs[j].getName(), otherPairs[j].getName())) return true; if (!currentPairs[j].getValue().equals(otherPairs[j].getValue())) return true; } } return false; }
private void scanTypeForContainerAnnotation(IBinaryType binaryType, char[][][] missingTypeNames) { if (!isPrototype()) throw new IllegalStateException(); IBinaryAnnotation[] annotations = binaryType.getAnnotations(); if (annotations != null) { int length = annotations.length; for (int i = 0; i < length; i++) { char[] annotationTypeName = annotations[i].getTypeName(); if (CharOperation.equals(annotationTypeName, ConstantPool.JAVA_LANG_ANNOTATION_REPEATABLE)) { IBinaryElementValuePair[] elementValuePairs = annotations[i].getElementValuePairs(); if (elementValuePairs != null && elementValuePairs.length == 1) { Object value = elementValuePairs[0].getValue(); if (value instanceof ClassSignature) { this.containerAnnotationType = (ReferenceBinding) this.environment.getTypeFromSignature(((ClassSignature)value).getTypeName(), 0, -1, false, null, missingTypeNames, ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); } } break; } } } }
return Boolean.TRUE; for (int j = 0; j < currentPairsLength; j++) { if (!CharOperation.equals(currentPairs[j].getName(), otherPairs[j].getName())) return Boolean.TRUE; final Object value = currentPairs[j].getValue(); final Object value2 = otherPairs[j].getValue(); if (value instanceof Object[]) { Object[] currentValues = (Object[]) value;
private boolean checkAnnotation(IBinaryAnnotation annotation, TypeReferencePattern pattern) { if (checkTypeName(pattern.simpleName, pattern.qualification, convertClassFileFormat(Signature.toCharArray(annotation.getTypeName())), pattern.isCaseSensitive, pattern.isCamelCase)) { return true; } IBinaryElementValuePair[] valuePairs = annotation.getElementValuePairs(); if (valuePairs != null) { for (int j=0, vpLength=valuePairs.length; j<vpLength; j++) { IBinaryElementValuePair valuePair = valuePairs[j]; Object pairValue = valuePair.getValue(); if (pairValue instanceof IBinaryAnnotation) { if (checkAnnotation((IBinaryAnnotation) pairValue, pattern)) { return true; } } } } return false; } private boolean checkAnnotations(TypeReferencePattern pattern, IBinaryAnnotation[] annotations, long tagBits) {
private void generateAnnotationInfo(JavaElement parent, char[] parameterName, HashMap newElements, IBinaryAnnotation annotationInfo, String memberValuePairName) { char[] typeName = org.eclipse.jdt.core.Signature.toCharArray(CharOperation.replaceOnCopy(annotationInfo.getTypeName(), '/', '.')); Annotation annotation = new Annotation(parent, new String(typeName), memberValuePairName); while (newElements.containsKey(annotation)) { annotation.occurrenceCount++; } newElements.put(annotation, annotationInfo); IBinaryElementValuePair[] pairs = annotationInfo.getElementValuePairs(); for (int i = 0, length = pairs.length; i < length; i++) { Object value = pairs[i].getValue(); if (value instanceof IBinaryAnnotation) { generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) value, new String(pairs[i].getName())); } else if (value instanceof Object[]) { // if the value is an array, it can have no more than 1 dimension - no need to recurse Object[] valueArray = (Object[]) value; for (int j = 0, valueArrayLength = valueArray.length; j < valueArrayLength; j++) { Object nestedValue = valueArray[j]; if (nestedValue instanceof IBinaryAnnotation) { generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) nestedValue, new String(pairs[i].getName())); } } } } } private void generateStandardAnnotationsInfos(JavaElement javaElement, char[] parameterName, long tagBits, HashMap newElements) {
private boolean checkAnnotation(IBinaryAnnotation annotation, TypeReferencePattern pattern) { if (checkTypeName(pattern.simpleName, pattern.qualification, convertClassFileFormat(Signature.toCharArray(annotation.getTypeName())), pattern.isCaseSensitive, pattern.isCamelCase)) { return true; } IBinaryElementValuePair[] valuePairs = annotation.getElementValuePairs(); if (valuePairs != null) { for (int j=0, vpLength=valuePairs.length; j<vpLength; j++) { IBinaryElementValuePair valuePair = valuePairs[j]; Object pairValue = valuePair.getValue(); if (pairValue instanceof IBinaryAnnotation) { if (checkAnnotation((IBinaryAnnotation) pairValue, pattern)) { return true; } } } } return false; } private boolean checkAnnotations(TypeReferencePattern pattern, IBinaryAnnotation[] annotations, long tagBits) {
private void generateAnnotationInfo(JavaElement parent, char[] parameterName, HashMap newElements, IBinaryAnnotation annotationInfo, String memberValuePairName) { char[] typeName = org.eclipse.jdt.core.Signature.toCharArray(CharOperation.replaceOnCopy(annotationInfo.getTypeName(), '/', '.')); Annotation annotation = new Annotation(parent, new String(typeName), memberValuePairName); while (newElements.containsKey(annotation)) { annotation.occurrenceCount++; } newElements.put(annotation, annotationInfo); IBinaryElementValuePair[] pairs = annotationInfo.getElementValuePairs(); for (int i = 0, length = pairs.length; i < length; i++) { Object value = pairs[i].getValue(); if (value instanceof IBinaryAnnotation) { generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) value, new String(pairs[i].getName())); } else if (value instanceof Object[]) { // if the value is an array, it can have no more than 1 dimension - no need to recurse Object[] valueArray = (Object[]) value; for (int j = 0, valueArrayLength = valueArray.length; j < valueArrayLength; j++) { Object nestedValue = valueArray[j]; if (nestedValue instanceof IBinaryAnnotation) { generateAnnotationInfo(annotation, newElements, (IBinaryAnnotation) nestedValue, new String(pairs[i].getName())); } } } } } private void generateStandardAnnotationsInfos(JavaElement javaElement, char[] parameterName, long tagBits, HashMap newElements) {