use of com.oracle.svm.core.annotate.UnknownPrimitiveField in project graal by oracle.
the class Inflation method handleUnknownValueField.
private void handleUnknownValueField(AnalysisField field) {
if (handledUnknownValueFields.contains(field)) {
return;
}
UnknownObjectField unknownObjectField = field.getAnnotation(UnknownObjectField.class);
UnknownPrimitiveField unknownPrimitiveField = field.getAnnotation(UnknownPrimitiveField.class);
if (unknownObjectField != null) {
assert !Modifier.isFinal(field.getModifiers()) : "@UnknownObjectField annotated field " + field.format("%H.%n") + " cannot be final";
assert field.getJavaKind() == JavaKind.Object;
field.setCanBeNull(unknownObjectField.canBeNull());
List<AnalysisType> aAnnotationTypes = extractAnnotationTypes(field, unknownObjectField);
/*
* Only if an UnknownValue field is really accessed, we register all the field's
* sub-types as allocated.
*/
if (field.isAccessed()) {
for (AnalysisType type : aAnnotationTypes) {
type.registerAsAllocated(null);
}
}
/*
* Use the annotation types, instead of the declared type, in the UnknownObjectField
* annotated fields initialization.
*/
handleUnknownObjectField(field, aAnnotationTypes.toArray(new AnalysisType[aAnnotationTypes.size()]));
} else if (unknownPrimitiveField != null) {
assert !Modifier.isFinal(field.getModifiers()) : "@UnknownPrimitiveField annotated field " + field.format("%H.%n") + " cannot be final";
/*
* Register a primitive field as containing unknown values(s), i.e., is usually written
* only in hosted code.
*/
field.registerAsWritten(null);
}
handledUnknownValueFields.add(field);
}
Aggregations