use of org.eclipse.jdt.internal.compiler.lookup.RecordComponentBinding in project bazel-jdt-java-toolchain by salesforce.
the class ClassFile method addComponentAttributes.
private int addComponentAttributes(RecordComponentBinding recordComponentBinding, int componetAttributeOffset) {
// See JVMS 14 Table 4.7-C - Record Preview for allowed attributes
int attributesNumber = 0;
// add signature attribute
char[] genericSignature = recordComponentBinding.genericSignature();
if (genericSignature != null) {
attributesNumber += generateSignatureAttribute(genericSignature);
}
RecordComponent recordComponent = recordComponentBinding.sourceRecordComponent();
if (recordComponent != null) {
Annotation[] annotations = recordComponent.annotations;
if (annotations != null) {
attributesNumber += generateRuntimeAnnotations(annotations, TagBits.AnnotationForRecordComponent);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
List<AnnotationContext> allTypeAnnotationContexts = new ArrayList<>();
if (annotations != null && (recordComponent.bits & ASTNode.HasTypeAnnotations) != 0) {
recordComponent.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts);
}
TypeReference recordComponentType = recordComponent.type;
if (recordComponentType != null && ((recordComponentType.bits & ASTNode.HasTypeAnnotations) != 0)) {
recordComponentType.getAllAnnotationContexts(AnnotationTargetTypeConstants.RECORD_COMPONENT, allTypeAnnotationContexts);
}
int size = allTypeAnnotationContexts.size();
attributesNumber = completeRuntimeTypeAnnotations(attributesNumber, null, (node) -> size > 0, () -> allTypeAnnotationContexts);
}
}
if ((recordComponentBinding.tagBits & TagBits.HasMissingType) != 0) {
this.missingTypes = recordComponentBinding.type.collectMissingTypes(this.missingTypes);
}
return attributesNumber;
}
use of org.eclipse.jdt.internal.compiler.lookup.RecordComponentBinding in project bazel-jdt-java-toolchain by salesforce.
the class AnnotationDiscoveryVisitor method visit.
@Override
public boolean visit(RecordComponent recordComponent, BlockScope scope) {
Annotation[] annotations = recordComponent.annotations;
if (annotations != null) {
RecordComponentBinding recordComponentBinding = recordComponent.binding;
if (recordComponentBinding == null) {
return false;
}
((SourceTypeBinding) recordComponentBinding.declaringRecord).resolveTypeFor(recordComponentBinding);
if (recordComponent.binding == null) {
return false;
}
this.resolveAnnotations(scope, annotations, recordComponentBinding);
}
return false;
}
use of org.eclipse.jdt.internal.compiler.lookup.RecordComponentBinding in project bazel-jdt-java-toolchain by salesforce.
the class ClassFile method getRecordComponent.
private RecordComponent getRecordComponent(ReferenceBinding declaringClass, char[] name) {
if (declaringClass instanceof SourceTypeBinding) {
SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) declaringClass;
RecordComponentBinding rcb = sourceTypeBinding.getRecordComponent(name);
if (rcb != null) {
RecordComponent recordComponent = rcb.sourceRecordComponent();
return recordComponent;
}
}
return null;
}
Aggregations