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 static Object unpackValue(NdConstant value) { if (value == null) { return null; } if (value instanceof NdConstantAnnotation) { NdConstantAnnotation annotation = (NdConstantAnnotation) value; return createBinaryAnnotation(annotation.getValue()); } if (value instanceof NdConstantArray) { NdConstantArray array = (NdConstantArray) value; List<NdConstant> arrayContents = array.getValue(); Object[] result = new Object[arrayContents.size()]; for (int idx = 0; idx < arrayContents.size(); idx++) { result[idx] = unpackValue(arrayContents.get(idx)); } return result; } if (value instanceof NdConstantEnum) { NdConstantEnum ndConstantEnum = (NdConstantEnum) value; NdTypeSignature signature = ndConstantEnum.getType(); return new EnumConstantSignature(signature.getRawType().getBinaryName(), ndConstantEnum.getValue()); } if (value instanceof NdConstantClass) { NdConstantClass constant = (NdConstantClass) value; return new ClassSignature(constant.getValue().getRawType().getBinaryName()); } return value.getConstant(); }
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 static Object unpackValue(NdConstant value) { if (value == null) { return null; } if (value instanceof NdConstantAnnotation) { NdConstantAnnotation annotation = (NdConstantAnnotation) value; return createBinaryAnnotation(annotation.getValue()); } if (value instanceof NdConstantArray) { NdConstantArray array = (NdConstantArray) value; List<NdConstant> arrayContents = array.getValue(); Object[] result = new Object[arrayContents.size()]; for (int idx = 0; idx < arrayContents.size(); idx++) { result[idx] = unpackValue(arrayContents.get(idx)); } return result; } if (value instanceof NdConstantEnum) { NdConstantEnum ndConstantEnum = (NdConstantEnum) value; NdTypeSignature signature = ndConstantEnum.getType(); return new EnumConstantSignature(signature.getRawType().getBinaryName(), ndConstantEnum.getValue()); } if (value instanceof NdConstantClass) { NdConstantClass constant = (NdConstantClass) value; return new ClassSignature(constant.getValue().getRawType().getBinaryName()); } return value.getConstant(); }
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; } } } }
constValueOffset = this.constantPoolOffsets[u2At(this.readOffset)] - this.structOffset; char[] className = utf8At(constValueOffset + 3, u2At(constValueOffset + 1)); value = new ClassSignature(className); this.readOffset += 2; 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; } } } }
constValueOffset = this.constantPoolOffsets[u2At(this.readOffset)] - this.structOffset; char[] className = utf8At(constValueOffset + 3, u2At(constValueOffset + 1)); value = new ClassSignature(className); this.readOffset += 2; 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; } } } }
constValueOffset = this.constantPoolOffsets[u2At(this.readOffset)] - this.structOffset; char[] className = utf8At(constValueOffset + 3, u2At(constValueOffset + 1)); value = new ClassSignature(className); this.readOffset += 2; 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; } } } }
constValueOffset = this.constantPoolOffsets[u2At(this.readOffset)] - this.structOffset; char[] className = utf8At(constValueOffset + 3, u2At(constValueOffset + 1)); value = new ClassSignature(className); this.readOffset += 2; 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; } } } }
constValueOffset = this.constantPoolOffsets[u2At(this.readOffset)] - this.structOffset; char[] className = utf8At(constValueOffset + 3, u2At(constValueOffset + 1)); value = new ClassSignature(className); this.readOffset += 2; 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; } } } }
constValueOffset = this.constantPoolOffsets[u2At(this.readOffset)] - this.structOffset; char[] className = utf8At(constValueOffset + 3, u2At(constValueOffset + 1)); value = new ClassSignature(className); this.readOffset += 2; 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; } } } }
constValueOffset = this.constantPoolOffsets[u2At(this.readOffset)] - this.structOffset; char[] className = utf8At(constValueOffset + 3, u2At(constValueOffset + 1)); value = new ClassSignature(className); this.readOffset += 2; 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; } } } }
constValueOffset = this.constantPoolOffsets[u2At(this.readOffset)] - this.structOffset; char[] className = utf8At(constValueOffset + 3, u2At(constValueOffset + 1)); value = new ClassSignature(className); this.readOffset += 2; break;