if (!"Target".equals(CharOperation.charToString(annotation.getAnnotationType().sourceName()))) { continue; Object value = annotation.getElementValuePairs()[0].value; if (value == null) { continue;
public AnnotationBinding createAnnotation(ReferenceBinding annotationType, ElementValuePair[] pairs) { if (pairs.length != 0) { AnnotationBinding.setMethodBindings(annotationType, pairs); } return new AnnotationBinding(annotationType, pairs); }
System.arraycopy(recordedAnnotations, 0, result, 0, index); if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) result[index++] = buildTargetAnnotation(annotationTagBits, env); if ((annotationTagBits & TagBits.AnnotationRetentionMASK) != 0) result[index++] = buildRetentionAnnotation(annotationTagBits, env); if ((annotationTagBits & TagBits.AnnotationDeprecated) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_DEPRECATED, env); if ((annotationTagBits & TagBits.AnnotationDocumented) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_ANNOTATION_DOCUMENTED, env); if ((annotationTagBits & TagBits.AnnotationInherited) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_ANNOTATION_INHERITED, env); if ((annotationTagBits & TagBits.AnnotationOverride) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, env); if ((annotationTagBits & TagBits.AnnotationSuppressWarnings) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, env); if ((annotationTagBits & TagBits.AnnotationPolymorphicSignature) != 0) result[index++] = buildMarkerAnnotationForMemberType(TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE, env); if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS, env); return result;
public ITypeBinding getAnnotationType() { ITypeBinding typeBinding = this.bindingResolver.getTypeBinding(this.binding.getAnnotationType()); if (typeBinding == null) return null; return typeBinding; }
@NonNull @Override public List<Value> getValues() { ElementValuePair[] pairs = binding.getElementValuePairs(); if (pairs != null && pairs.length > 0) { List<Value> values = Lists.newArrayListWithExpectedSize(pairs.length); for (ElementValuePair pair : pairs) { values.add(new Value(new String(pair.getName()), getPairValue(pair))); } } return Collections.emptyList(); }
public final AnnotationBinding getAnnotationType(ReferenceBinding annotationType, boolean requiredResolved) { AnnotationBinding annotation = (AnnotationBinding) this.annotationTypes.get(annotationType); if (annotation == null) { if (requiredResolved) annotation = new AnnotationBinding(annotationType, Binding.NO_ELEMENT_VALUE_PAIRS); else annotation = new UnresolvedAnnotationBinding(annotationType, Binding.NO_ELEMENT_VALUE_PAIRS, this.environment); this.annotationTypes.put(annotationType, annotation); } if (requiredResolved) annotation.resolve(); return annotation; }
System.arraycopy(recordedAnnotations, 0, result, 0, index); if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) result[index++] = buildTargetAnnotation(annotationTagBits, env); if ((annotationTagBits & TagBits.AnnotationRetentionMASK) != 0) result[index++] = buildRetentionAnnotation(annotationTagBits, env); if ((annotationTagBits & TagBits.AnnotationDeprecated) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_DEPRECATED, env); if ((annotationTagBits & TagBits.AnnotationDocumented) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_ANNOTATION_DOCUMENTED, env); if ((annotationTagBits & TagBits.AnnotationInherited) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_ANNOTATION_INHERITED, env); if ((annotationTagBits & TagBits.AnnotationOverride) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, env); if ((annotationTagBits & TagBits.AnnotationSuppressWarnings) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, env); return result;
AnnotationBinding[] retrieveAnnotations(Binding binding) { return AnnotationBinding.addStandardAnnotations(super.retrieveAnnotations(binding), binding.getAnnotationTagBits(), this.environment); } SimpleLookupTable storedAnnotations(boolean forceInitialize) {
annotations = new AnnotationBinding[length]; for (int i = 0; i < length; i++) annotations[i] = new AnnotationBinding(annotationNodes[i]); setAnnotations(annotations);
@Override public int hashCode() { return this.internalInstance.hashCode(); } }
static boolean hasDeprecatedAnnotation(AnnotationBinding[] annotations) { if (annotations == null) { return false; } for (int i = 0, length = annotations.length; i < length; i++) { AnnotationBinding annotation = annotations[i]; if (CharOperation.equals(annotation.getAnnotationType().sourceName, TypeConstants.JAVA_LANG_DEPRECATED[2])) { return true; } } return false; }
@NonNull @Override public PsiNameValuePair[] getAttributes() { if (mPairs == null) { ElementValuePair[] elementValuePairs = mBinding.getElementValuePairs(); if (elementValuePairs != null && elementValuePairs.length > 0) { mPairs = new PsiNameValuePair[elementValuePairs.length]; for (int i = 0; i < elementValuePairs.length; i++) { ElementValuePair pair = elementValuePairs[i]; mPairs[i] = new EcjPsiBinaryNameValuePair(mManager, pair); } } else { mPairs = PsiNameValuePair.EMPTY_ARRAY; } } return mPairs; } }
public final AnnotationBinding getAnnotationType(ReferenceBinding annotationType, boolean requiredResolved) { AnnotationBinding annotation = (AnnotationBinding) this.annotationTypes.get(annotationType); if (annotation == null) { if (requiredResolved) annotation = new AnnotationBinding(annotationType, Binding.NO_ELEMENT_VALUE_PAIRS); else annotation = new UnresolvedAnnotationBinding(annotationType, Binding.NO_ELEMENT_VALUE_PAIRS, this.environment); this.annotationTypes.put(annotationType, annotation); } if (requiredResolved) annotation.resolve(); return annotation; }
System.arraycopy(recordedAnnotations, 0, result, 0, index); if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) result[index++] = buildTargetAnnotation(annotationTagBits, env); if ((annotationTagBits & TagBits.AnnotationRetentionMASK) != 0) result[index++] = buildRetentionAnnotation(annotationTagBits, env); if ((annotationTagBits & TagBits.AnnotationDeprecated) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_DEPRECATED, env); if ((annotationTagBits & TagBits.AnnotationDocumented) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_ANNOTATION_DOCUMENTED, env); if ((annotationTagBits & TagBits.AnnotationInherited) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_ANNOTATION_INHERITED, env); if ((annotationTagBits & TagBits.AnnotationOverride) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, env); if ((annotationTagBits & TagBits.AnnotationSuppressWarnings) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, env); return result;
AnnotationBinding[] retrieveAnnotations(Binding binding) { return AnnotationBinding.addStandardAnnotations(super.retrieveAnnotations(binding), binding.getAnnotationTagBits(), this.environment); } SimpleLookupTable storedAnnotations(boolean forceInitialize) {
annotations = new AnnotationBinding[length]; for (int i = 0; i < length; i++) annotations[i] = new AnnotationBinding(annotationNodes[i]); setAnnotations(annotations, this.declaringScope);
@Override public int hashCode() { return this.internalInstance.hashCode(); } }
System.arraycopy(recordedAnnotations, 0, result, 0, index); if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) result[index++] = buildTargetAnnotation(annotationTagBits, env); if ((annotationTagBits & TagBits.AnnotationRetentionMASK) != 0) result[index++] = buildRetentionAnnotation(annotationTagBits, env); if ((annotationTagBits & TagBits.AnnotationDeprecated) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_DEPRECATED, env); if ((annotationTagBits & TagBits.AnnotationDocumented) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_ANNOTATION_DOCUMENTED, env); if ((annotationTagBits & TagBits.AnnotationInherited) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_ANNOTATION_INHERITED, env); if ((annotationTagBits & TagBits.AnnotationOverride) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, env); if ((annotationTagBits & TagBits.AnnotationSuppressWarnings) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, env); if ((annotationTagBits & TagBits.AnnotationPolymorphicSignature) != 0) result[index++] = buildMarkerAnnotationForMemberType(TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE, env); if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0) result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS, env); return result;
@Override public int hashCode() { int result = 17; int c = this.getAnnotationType().hashCode(); result = 31 * result + c; c = Arrays.hashCode(this.getElementValuePairs()); result = 31 * result + c; return result; } @Override
@Override public TypeSpi getType() { if (m_type == null) { m_type = SpiWithJdtUtils.bindingToType(m_env, m_binding.getAnnotationType()); } return m_type; }