use of org.eclipse.jdt.internal.compiler.codegen.TypeAnnotationCodeStream in project bazel-jdt-java-toolchain by salesforce.
the class ClassFile method generateTypeAnnotationsOnCodeAttribute.
public int generateTypeAnnotationsOnCodeAttribute() {
int attributesNumber = 0;
List<AnnotationContext> allTypeAnnotationContexts = ((TypeAnnotationCodeStream) this.codeStream).allTypeAnnotationContexts;
for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) {
LocalVariableBinding localVariable = this.codeStream.locals[i];
if (localVariable.isCatchParameter())
continue;
LocalDeclaration declaration = localVariable.declaration;
if (declaration == null || (declaration.isArgument() && ((declaration.bits & ASTNode.IsUnionType) == 0)) || (localVariable.initializationCount == 0) || ((declaration.bits & ASTNode.HasTypeAnnotations) == 0)) {
continue;
}
int targetType = ((localVariable.tagBits & TagBits.IsResource) == 0) ? AnnotationTargetTypeConstants.LOCAL_VARIABLE : AnnotationTargetTypeConstants.RESOURCE_VARIABLE;
declaration.getAllAnnotationContexts(targetType, localVariable, allTypeAnnotationContexts);
}
ExceptionLabel[] exceptionLabels = this.codeStream.exceptionLabels;
for (int i = 0, max = this.codeStream.exceptionLabelsCounter; i < max; i++) {
ExceptionLabel exceptionLabel = exceptionLabels[i];
if (exceptionLabel.exceptionTypeReference != null && (exceptionLabel.exceptionTypeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
exceptionLabel.exceptionTypeReference.getAllAnnotationContexts(AnnotationTargetTypeConstants.EXCEPTION_PARAMETER, i, allTypeAnnotationContexts, exceptionLabel.se7Annotations);
}
}
int size = allTypeAnnotationContexts.size();
attributesNumber = completeRuntimeTypeAnnotations(attributesNumber, null, (node) -> size > 0, () -> allTypeAnnotationContexts);
return attributesNumber;
}
Aggregations