@Override public boolean isAnnotationType() { return mTypeBinding.isAnnotationType(); }
public void nullAnnotationUnsupportedLocation(Annotation annotation) { String[] arguments = new String[] { String.valueOf(annotation.resolvedType.readableName()) }; String[] shortArguments = new String[] { String.valueOf(annotation.resolvedType.shortReadableName()) }; int severity = ProblemSeverities.Error | ProblemSeverities.Fatal; if (annotation.recipient instanceof ReferenceBinding) { if (((ReferenceBinding) annotation.recipient).isAnnotationType()) severity = ProblemSeverities.Warning; // special case for https://bugs.eclipse.org/461878 } handle(IProblem.NullAnnotationUnsupportedLocation, arguments, shortArguments, severity, annotation.sourceStart, annotation.sourceEnd); } public void nullAnnotationAtQualifyingType(Annotation annotation) {
public void checkRepeatableMetaAnnotation(BlockScope scope) { // `this' is the @Repeatable meta annotation, its recipient is the *repeatable* annotation type - we are at the declaration site, not the repeating use site. ReferenceBinding repeatableAnnotationType = (ReferenceBinding) this.recipient; // know it to be an annotation type. On target miss we don't get here MemberValuePair[] valuePairs = this.memberValuePairs(); if (valuePairs == null || valuePairs.length != 1) return; Object value = valuePairs[0].compilerElementPair.value; if (!(value instanceof ReferenceBinding)) return; // Has deeper problems, will bark elsewhere. ReferenceBinding containerAnnotationType = (ReferenceBinding) value; if (!containerAnnotationType.isAnnotationType()) return; // Has deeper problems, will bark elsewhere. repeatableAnnotationType.setContainerAnnotationType(containerAnnotationType); // For now. May be reset later to PRB in case of problems. checkContainerAnnotationType(valuePairs[0], scope, containerAnnotationType, repeatableAnnotationType, false); // false => not use site, i.e declaration site error reporting requested. }
public void checkRepeatableMetaAnnotation(BlockScope scope) { // `this' is the @Repeatable meta annotation, its recipient is the *repeatable* annotation type - we are at the declaration site, not the repeating use site. ReferenceBinding repeatableAnnotationType = (ReferenceBinding) this.recipient; // know it to be an annotation type. On target miss we don't get here MemberValuePair[] valuePairs = this.memberValuePairs(); if (valuePairs == null || valuePairs.length != 1) return; Object value = valuePairs[0].compilerElementPair.value; if (!(value instanceof ReferenceBinding)) return; // Has deeper problems, will bark elsewhere. ReferenceBinding containerAnnotationType = (ReferenceBinding) value; if (!containerAnnotationType.isAnnotationType()) return; // Has deeper problems, will bark elsewhere. repeatableAnnotationType.setContainerAnnotationType(containerAnnotationType); // For now. May be reset later to PRB in case of problems. checkContainerAnnotationType(valuePairs[0], scope, containerAnnotationType, repeatableAnnotationType, false); // false => not use site, i.e declaration site error reporting requested. }
public void checkRepeatableMetaAnnotation(BlockScope scope) { // `this' is the @Repeatable meta annotation, its recipient is the *repeatable* annotation type - we are at the declaration site, not the repeating use site. ReferenceBinding repeatableAnnotationType = (ReferenceBinding) this.recipient; // know it to be an annotation type. On target miss we don't get here MemberValuePair[] valuePairs = this.memberValuePairs(); if (valuePairs == null || valuePairs.length != 1) return; Object value = valuePairs[0].compilerElementPair.value; if (!(value instanceof ReferenceBinding)) return; // Has deeper problems, will bark elsewhere. ReferenceBinding containerAnnotationType = (ReferenceBinding) value; if (!containerAnnotationType.isAnnotationType()) return; // Has deeper problems, will bark elsewhere. repeatableAnnotationType.setContainerAnnotationType(containerAnnotationType); // For now. May be reset later to PRB in case of problems. checkContainerAnnotationType(valuePairs[0], scope, containerAnnotationType, repeatableAnnotationType, false); // false => not use site, i.e declaration site error reporting requested. }
public void checkRepeatableMetaAnnotation(BlockScope scope) { // `this' is the @Repeatable meta annotation, its recipient is the *repeatable* annotation type - we are at the declaration site, not the repeating use site. ReferenceBinding repeatableAnnotationType = (ReferenceBinding) this.recipient; // know it to be an annotation type. On target miss we don't get here MemberValuePair[] valuePairs = this.memberValuePairs(); if (valuePairs == null || valuePairs.length != 1) return; Object value = valuePairs[0].compilerElementPair.value; if (!(value instanceof ReferenceBinding)) return; // Has deeper problems, will bark elsewhere. ReferenceBinding containerAnnotationType = (ReferenceBinding) value; if (!containerAnnotationType.isAnnotationType()) return; // Has deeper problems, will bark elsewhere. repeatableAnnotationType.setContainerAnnotationType(containerAnnotationType); // For now. May be reset later to PRB in case of problems. checkContainerAnnotationType(valuePairs[0], scope, containerAnnotationType, repeatableAnnotationType, false); // false => not use site, i.e declaration site error reporting requested. }
public void checkRepeatableMetaAnnotation(BlockScope scope) { // `this' is the @Repeatable meta annotation, its recipient is the *repeatable* annotation type - we are at the declaration site, not the repeating use site. ReferenceBinding repeatableAnnotationType = (ReferenceBinding) this.recipient; // know it to be an annotation type. On target miss we don't get here MemberValuePair[] valuePairs = this.memberValuePairs(); if (valuePairs == null || valuePairs.length != 1) return; Object value = valuePairs[0].compilerElementPair.value; if (!(value instanceof ReferenceBinding)) return; // Has deeper problems, will bark elsewhere. ReferenceBinding containerAnnotationType = (ReferenceBinding) value; if (!containerAnnotationType.isAnnotationType()) return; // Has deeper problems, will bark elsewhere. repeatableAnnotationType.setContainerAnnotationType(containerAnnotationType); // For now. May be reset later to PRB in case of problems. checkContainerAnnotationType(valuePairs[0], scope, containerAnnotationType, repeatableAnnotationType, false); // false => not use site, i.e declaration site error reporting requested. }
public void checkRepeatableMetaAnnotation(BlockScope scope) { // `this' is the @Repeatable meta annotation, its recipient is the *repeatable* annotation type - we are at the declaration site, not the repeating use site. ReferenceBinding repeatableAnnotationType = (ReferenceBinding) this.recipient; // know it to be an annotation type. On target miss we don't get here MemberValuePair[] valuePairs = this.memberValuePairs(); if (valuePairs == null || valuePairs.length != 1) return; Object value = valuePairs[0].compilerElementPair.value; if (!(value instanceof ReferenceBinding)) return; // Has deeper problems, will bark elsewhere. ReferenceBinding containerAnnotationType = (ReferenceBinding) value; if (!containerAnnotationType.isAnnotationType()) return; // Has deeper problems, will bark elsewhere. repeatableAnnotationType.setContainerAnnotationType(containerAnnotationType); // For now. May be reset later to PRB in case of problems. checkContainerAnnotationType(valuePairs[0], scope, containerAnnotationType, repeatableAnnotationType, false); // false => not use site, i.e declaration site error reporting requested. }
public void checkRepeatableMetaAnnotation(BlockScope scope) { // `this' is the @Repeatable meta annotation, its recipient is the *repeatable* annotation type - we are at the declaration site, not the repeating use site. ReferenceBinding repeatableAnnotationType = (ReferenceBinding) this.recipient; // know it to be an annotation type. On target miss we don't get here MemberValuePair[] valuePairs = this.memberValuePairs(); if (valuePairs == null || valuePairs.length != 1) return; Object value = valuePairs[0].compilerElementPair.value; if (!(value instanceof ReferenceBinding)) return; // Has deeper problems, will bark elsewhere. ReferenceBinding containerAnnotationType = (ReferenceBinding) value; if (!containerAnnotationType.isAnnotationType()) return; // Has deeper problems, will bark elsewhere. repeatableAnnotationType.setContainerAnnotationType(containerAnnotationType); // For now. May be reset later to PRB in case of problems. checkContainerAnnotationType(valuePairs[0], scope, containerAnnotationType, repeatableAnnotationType, false); // false => not use site, i.e declaration site error reporting requested. }
public void checkRepeatableMetaAnnotation(BlockScope scope) { // `this' is the @Repeatable meta annotation, its recipient is the *repeatable* annotation type - we are at the declaration site, not the repeating use site. ReferenceBinding repeatableAnnotationType = (ReferenceBinding) this.recipient; // know it to be an annotation type. On target miss we don't get here MemberValuePair[] valuePairs = this.memberValuePairs(); if (valuePairs == null || valuePairs.length != 1) return; Object value = valuePairs[0].compilerElementPair.value; if (!(value instanceof ReferenceBinding)) return; // Has deeper problems, will bark elsewhere. ReferenceBinding containerAnnotationType = (ReferenceBinding) value; if (!containerAnnotationType.isAnnotationType()) return; // Has deeper problems, will bark elsewhere. repeatableAnnotationType.setContainerAnnotationType(containerAnnotationType); // For now. May be reset later to PRB in case of problems. checkContainerAnnotationType(valuePairs[0], scope, containerAnnotationType, repeatableAnnotationType, false); // false => not use site, i.e declaration site error reporting requested. }
void addType(ReferenceBinding element) { if ((element.tagBits & TagBits.HasMissingType) == 0) clearMissingTagBit(); if (this.knownTypes == null) this.knownTypes = new HashtableOfType(25); this.knownTypes.put(element.compoundName[element.compoundName.length - 1], element); if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) if (element.isAnnotationType() || element instanceof UnresolvedReferenceBinding) // unresolved types don't yet have the modifiers set checkIfNullAnnotationType(element); }
private AnnotationMirrorImpl createAnnotationMirror(String annoTypeName, AnnotationBinding annoInstance) { ReferenceBinding binding = annoInstance.getAnnotationType(); if (binding != null && binding.isAnnotationType() ) { char[] qName; if (binding.isMemberType()) { annoTypeName = annoTypeName.replace('$', '.'); qName = CharOperation.concatWith(binding.enclosingType().compoundName, binding.sourceName, '.'); CharOperation.replace(qName, '$', '.'); } else { qName = CharOperation.concatWith(binding.compoundName, '.'); } if(annoTypeName.equals(new String(qName)) ){ return (AnnotationMirrorImpl)_env.getFactory().newAnnotationMirror(annoInstance); } } return null; }
private AnnotationMirrorImpl createAnnotationMirror(String annoTypeName, AnnotationBinding annoInstance) { ReferenceBinding binding = annoInstance.getAnnotationType(); if (binding != null && binding.isAnnotationType() ) { char[] qName; if (binding.isMemberType()) { annoTypeName = annoTypeName.replace('$', '.'); qName = CharOperation.concatWith(binding.enclosingType().compoundName, binding.sourceName, '.'); CharOperation.replace(qName, '$', '.'); } else { qName = CharOperation.concatWith(binding.compoundName, '.'); } if(annoTypeName.equals(new String(qName)) ){ return (AnnotationMirrorImpl)_env.getFactory().newAnnotationMirror(annoInstance); } } return null; }
private AnnotationMirrorImpl createAnnotationMirror(String annoTypeName, AnnotationBinding annoInstance) { ReferenceBinding binding = annoInstance.getAnnotationType(); if (binding != null && binding.isAnnotationType() ) { char[] qName; if (binding.isMemberType()) { annoTypeName = annoTypeName.replace('$', '.'); qName = CharOperation.concatWith(binding.enclosingType().compoundName, binding.sourceName, '.'); CharOperation.replace(qName, '$', '.'); } else { qName = CharOperation.concatWith(binding.compoundName, '.'); } if(annoTypeName.equals(new String(qName)) ){ return (AnnotationMirrorImpl)_env.getFactory().newAnnotationMirror(annoInstance); } } return null; }
void addType(ReferenceBinding element) { if ((element.tagBits & TagBits.HasMissingType) == 0) clearMissingTagBit(); if (this.knownTypes == null) this.knownTypes = new HashtableOfType(25); char [] name = element.compoundName[element.compoundName.length - 1]; ReferenceBinding priorType = this.knownTypes.getput(name, element); if (priorType != null && priorType.isUnresolvedType() && !element.isUnresolvedType()) { ((UnresolvedReferenceBinding) priorType).setResolvedType(element, this.environment); } if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) if (element.isAnnotationType() || element instanceof UnresolvedReferenceBinding) // unresolved types don't yet have the modifiers set checkIfNullAnnotationType(element); }
void addType(ReferenceBinding element) { if ((element.tagBits & TagBits.HasMissingType) == 0) clearMissingTagBit(); if (this.knownTypes == null) this.knownTypes = new HashtableOfType(25); char [] name = element.compoundName[element.compoundName.length - 1]; ReferenceBinding priorType = this.knownTypes.getput(name, element); if (priorType != null && priorType.isUnresolvedType() && !element.isUnresolvedType()) { ((UnresolvedReferenceBinding) priorType).setResolvedType(element, this.environment); } if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) if (element.isAnnotationType() || element instanceof UnresolvedReferenceBinding) // unresolved types don't yet have the modifiers set checkIfNullAnnotationType(element); }
void addType(ReferenceBinding element) { if ((element.tagBits & TagBits.HasMissingType) == 0) clearMissingTagBit(); if (this.knownTypes == null) this.knownTypes = new HashtableOfType(25); char [] name = element.compoundName[element.compoundName.length - 1]; ReferenceBinding priorType = this.knownTypes.getput(name, element); if (priorType != null && priorType.isUnresolvedType() && !element.isUnresolvedType()) { ((UnresolvedReferenceBinding) priorType).setResolvedType(element, this.environment); } if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) if (element.isAnnotationType() || element instanceof UnresolvedReferenceBinding) // unresolved types don't yet have the modifiers set checkIfNullAnnotationType(element); }
void addType(ReferenceBinding element) { if ((element.tagBits & TagBits.HasMissingType) == 0) clearMissingTagBit(); if (this.knownTypes == null) this.knownTypes = new HashtableOfType(25); char [] name = element.compoundName[element.compoundName.length - 1]; ReferenceBinding priorType = this.knownTypes.getput(name, element); if (priorType != null && priorType.isUnresolvedType() && !element.isUnresolvedType()) { ((UnresolvedReferenceBinding) priorType).setResolvedType(element, this.environment); } if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) if (element.isAnnotationType() || element instanceof UnresolvedReferenceBinding) // unresolved types don't yet have the modifiers set checkIfNullAnnotationType(element); }
void addType(ReferenceBinding element) { if ((element.tagBits & TagBits.HasMissingType) == 0) clearMissingTagBit(); if (this.knownTypes == null) this.knownTypes = new HashtableOfType(25); char [] name = element.compoundName[element.compoundName.length - 1]; ReferenceBinding priorType = this.knownTypes.getput(name, element); if (priorType != null && priorType.isUnresolvedType() && !element.isUnresolvedType()) { ((UnresolvedReferenceBinding) priorType).setResolvedType(element, this.environment); } if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) if (element.isAnnotationType() || element instanceof UnresolvedReferenceBinding) // unresolved types don't yet have the modifiers set checkIfNullAnnotationType(element); }
void addType(ReferenceBinding element) { if ((element.tagBits & TagBits.HasMissingType) == 0) clearMissingTagBit(); if (this.knownTypes == null) this.knownTypes = new HashtableOfType(25); char [] name = element.compoundName[element.compoundName.length - 1]; ReferenceBinding priorType = this.knownTypes.getput(name, element); if (priorType != null && priorType.isUnresolvedType() && !element.isUnresolvedType()) { ((UnresolvedReferenceBinding) priorType).setResolvedType(element, this.environment); } if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) if (element.isAnnotationType() || element instanceof UnresolvedReferenceBinding) // unresolved types don't yet have the modifiers set checkIfNullAnnotationType(element); }