private void updateAnnotationValue(Object object) { // @see org.eclipse.jdt.internal.compiler.env.IBinaryElementValuePair.getValue() // @see org.eclipse.jdt.internal.compiler.classfmt.AnnotationInfo.decodeDefaultValue() if (object instanceof ClassSignature) { updateChars(((ClassSignature) object).getTypeName()); } else if (object instanceof Constant) { updateConstant((Constant) object); } else if (object instanceof EnumConstantSignature) { updateChars(((EnumConstantSignature) object).getTypeName()); updateChars(((EnumConstantSignature) object).getEnumConstantName()); } else if (object instanceof IBinaryAnnotation) { updateAnnotation((IBinaryAnnotation) object); } else { throw new IllegalArgumentException("Unsupported annotation value " + object.toString()); } }
private void updateAnnotationValue(Object object) { // @see org.eclipse.jdt.internal.compiler.env.IBinaryElementValuePair.getValue() // @see org.eclipse.jdt.internal.compiler.classfmt.AnnotationInfo.decodeDefaultValue() if (object instanceof ClassSignature) { updateChars(((ClassSignature) object).getTypeName()); } else if (object instanceof Constant) { updateConstant((Constant) object); } else if (object instanceof EnumConstantSignature) { updateChars(((EnumConstantSignature) object).getTypeName()); updateChars(((EnumConstantSignature) object).getEnumConstantName()); } else if (object instanceof IBinaryAnnotation) { updateAnnotation((IBinaryAnnotation) object); } else { throw new IllegalArgumentException("Unsupported annotation value " + object.toString()); } }
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, 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; } } } }
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, 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, 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; } } } }
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; } } } }
static Object convertMemberValue(Object binaryValue, LookupEnvironment env, char[][][] missingTypeNames) { if (binaryValue == null) return null; if (binaryValue instanceof Constant) return binaryValue; if (binaryValue instanceof ClassSignature) return env.getTypeFromSignature(((ClassSignature) binaryValue).getTypeName(), 0, -1, false, null, missingTypeNames); if (binaryValue instanceof IBinaryAnnotation) return createAnnotation((IBinaryAnnotation) binaryValue, env, missingTypeNames); if (binaryValue instanceof EnumConstantSignature) { EnumConstantSignature ref = (EnumConstantSignature) binaryValue; ReferenceBinding enumType = (ReferenceBinding) env.getTypeFromSignature(ref.getTypeName(), 0, -1, false, null, missingTypeNames); enumType = (ReferenceBinding) resolveType(enumType, env, false /* no raw conversion */); return enumType.getField(ref.getEnumConstantName(), false); } if (binaryValue instanceof Object[]) { Object[] objects = (Object[]) binaryValue; int length = objects.length; if (length == 0) return objects; Object[] values = new Object[length]; for (int i = 0; i < length; i++) values[i] = convertMemberValue(objects[i], env, missingTypeNames); return values; } // should never reach here. throw new IllegalStateException(); }
static Object convertMemberValue(Object binaryValue, LookupEnvironment env, char[][][] missingTypeNames) { if (binaryValue == null) return null; if (binaryValue instanceof Constant) return binaryValue; if (binaryValue instanceof ClassSignature) return env.getTypeFromSignature(((ClassSignature) binaryValue).getTypeName(), 0, -1, false, null, missingTypeNames); if (binaryValue instanceof IBinaryAnnotation) return createAnnotation((IBinaryAnnotation) binaryValue, env, missingTypeNames); if (binaryValue instanceof EnumConstantSignature) { EnumConstantSignature ref = (EnumConstantSignature) binaryValue; ReferenceBinding enumType = (ReferenceBinding) env.getTypeFromSignature(ref.getTypeName(), 0, -1, false, null, missingTypeNames); enumType = (ReferenceBinding) resolveType(enumType, env, false /* no raw conversion */); return enumType.getField(ref.getEnumConstantName(), false); } if (binaryValue instanceof Object[]) { Object[] objects = (Object[]) binaryValue; int length = objects.length; if (length == 0) return objects; Object[] values = new Object[length]; for (int i = 0; i < length; i++) values[i] = convertMemberValue(objects[i], env, missingTypeNames); return values; } // should never reach here. throw new IllegalStateException(); }
static Object convertMemberValue(Object binaryValue, LookupEnvironment env, char[][][] missingTypeNames) { if (binaryValue == null) return null; if (binaryValue instanceof Constant) return binaryValue; if (binaryValue instanceof ClassSignature) return env.getTypeFromSignature(((ClassSignature) binaryValue).getTypeName(), 0, -1, false, null, missingTypeNames); if (binaryValue instanceof IBinaryAnnotation) return createAnnotation((IBinaryAnnotation) binaryValue, env, missingTypeNames); if (binaryValue instanceof EnumConstantSignature) { EnumConstantSignature ref = (EnumConstantSignature) binaryValue; ReferenceBinding enumType = (ReferenceBinding) env.getTypeFromSignature(ref.getTypeName(), 0, -1, false, null, missingTypeNames); enumType = (ReferenceBinding) resolveType(enumType, env, false /* no raw conversion */); return enumType.getField(ref.getEnumConstantName(), false); } if (binaryValue instanceof Object[]) { Object[] objects = (Object[]) binaryValue; int length = objects.length; if (length == 0) return objects; Object[] values = new Object[length]; for (int i = 0; i < length; i++) values[i] = convertMemberValue(objects[i], env, missingTypeNames); return values; } // should never reach here. throw new IllegalStateException(); }
static Object convertMemberValue(Object binaryValue, LookupEnvironment env, char[][][] missingTypeNames, boolean resolveEnumConstants) { if (binaryValue == null) return null; if (binaryValue instanceof Constant) return binaryValue; if (binaryValue instanceof ClassSignature) return env.getTypeFromSignature(((ClassSignature) binaryValue).getTypeName(), 0, -1, false, null, missingTypeNames, ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); if (binaryValue instanceof IBinaryAnnotation) return createAnnotation((IBinaryAnnotation) binaryValue, env, missingTypeNames); if (binaryValue instanceof EnumConstantSignature) { EnumConstantSignature ref = (EnumConstantSignature) binaryValue; ReferenceBinding enumType = (ReferenceBinding) env.getTypeFromSignature(ref.getTypeName(), 0, -1, false, null, missingTypeNames, ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); if (enumType.isUnresolvedType() && !resolveEnumConstants) return new ElementValuePair.UnresolvedEnumConstant(enumType, env, ref.getEnumConstantName()); enumType = (ReferenceBinding) resolveType(enumType, env, false /* no raw conversion */); return enumType.getField(ref.getEnumConstantName(), false); } if (binaryValue instanceof Object[]) { Object[] objects = (Object[]) binaryValue; int length = objects.length; if (length == 0) return objects; Object[] values = new Object[length]; for (int i = 0; i < length; i++) values[i] = convertMemberValue(objects[i], env, missingTypeNames, resolveEnumConstants); return values; } // should never reach here. throw new IllegalStateException(); }
private void addPairValue(Object pairValue) { if (pairValue instanceof EnumConstantSignature) { EnumConstantSignature enumConstant = (EnumConstantSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(enumConstant.getTypeName()))); addNameReference(enumConstant.getEnumConstantName()); } else if (pairValue instanceof ClassSignature) { ClassSignature classConstant = (ClassSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(classConstant.getTypeName()))); } else if (pairValue instanceof IBinaryAnnotation) { addBinaryAnnotation((IBinaryAnnotation) pairValue); } else if (pairValue instanceof Object[]) { Object[] objects = (Object[]) pairValue; for (int i=0,l=objects.length; i<l; i++) { addPairValue(objects[i]); } } } public void addTypeReference(char[] typeName) {
private void addPairValue(Object pairValue) { if (pairValue instanceof EnumConstantSignature) { EnumConstantSignature enumConstant = (EnumConstantSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(enumConstant.getTypeName()))); addNameReference(enumConstant.getEnumConstantName()); } else if (pairValue instanceof ClassSignature) { ClassSignature classConstant = (ClassSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(classConstant.getTypeName()))); } else if (pairValue instanceof IBinaryAnnotation) { addBinaryAnnotation((IBinaryAnnotation) pairValue); } else if (pairValue instanceof Object[]) { Object[] objects = (Object[]) pairValue; for (int i=0,l=objects.length; i<l; i++) { addPairValue(objects[i]); } } } public void addTypeReference(char[] typeName) {
private void addPairValue(Object pairValue) { if (pairValue instanceof EnumConstantSignature) { EnumConstantSignature enumConstant = (EnumConstantSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(enumConstant.getTypeName()))); addNameReference(enumConstant.getEnumConstantName()); } else if (pairValue instanceof ClassSignature) { ClassSignature classConstant = (ClassSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(classConstant.getTypeName()))); } else if (pairValue instanceof IBinaryAnnotation) { addBinaryAnnotation((IBinaryAnnotation) pairValue); } else if (pairValue instanceof Object[]) { Object[] objects = (Object[]) pairValue; for (int i=0,l=objects.length; i<l; i++) { addPairValue(objects[i]); } } } public void addTypeReference(char[] typeName) {
private void addPairValue(Object pairValue) { if (pairValue instanceof EnumConstantSignature) { EnumConstantSignature enumConstant = (EnumConstantSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(enumConstant.getTypeName()))); addNameReference(enumConstant.getEnumConstantName()); } else if (pairValue instanceof ClassSignature) { ClassSignature classConstant = (ClassSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(classConstant.getTypeName()))); } else if (pairValue instanceof IBinaryAnnotation) { addBinaryAnnotation((IBinaryAnnotation) pairValue); } else if (pairValue instanceof Object[]) { Object[] objects = (Object[]) pairValue; for (int i=0,l=objects.length; i<l; i++) { addPairValue(objects[i]); } } } public void addTypeReference(char[] typeName) {
private void addPairValue(Object pairValue) { if (pairValue instanceof EnumConstantSignature) { EnumConstantSignature enumConstant = (EnumConstantSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(enumConstant.getTypeName()))); addNameReference(enumConstant.getEnumConstantName()); } else if (pairValue instanceof ClassSignature) { ClassSignature classConstant = (ClassSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(classConstant.getTypeName()))); } else if (pairValue instanceof IBinaryAnnotation) { addBinaryAnnotation((IBinaryAnnotation) pairValue); } else if (pairValue instanceof Object[]) { Object[] objects = (Object[]) pairValue; for (int i=0,l=objects.length; i<l; i++) { addPairValue(objects[i]); } } } @Override
private void addPairValue(Object pairValue) { if (pairValue instanceof EnumConstantSignature) { EnumConstantSignature enumConstant = (EnumConstantSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(enumConstant.getTypeName()))); addNameReference(enumConstant.getEnumConstantName()); } else if (pairValue instanceof ClassSignature) { ClassSignature classConstant = (ClassSignature) pairValue; addTypeReference(replace('/', '.', Signature.toCharArray(classConstant.getTypeName()))); } else if (pairValue instanceof IBinaryAnnotation) { addBinaryAnnotation((IBinaryAnnotation) pairValue); } else if (pairValue instanceof Object[]) { Object[] objects = (Object[]) pairValue; for (int i=0,l=objects.length; i<l; i++) { addPairValue(objects[i]); } } } public void addTypeReference(char[] typeName) {