use of com.strobel.decompiler.languages.java.ast.Annotation in project j2objc by google.
the class PackageInfoLookup method parseDataFromClassFile.
private PackageData parseDataFromClassFile(InputFile file) throws IOException {
PackageDataBuilder builder = new PackageDataBuilder();
ClassFile classFile = ClassFile.create(file);
TypeDeclaration typeDecl = classFile.getType();
for (Annotation annotation : typeDecl.getAnnotations()) {
String signature = annotation.getType().toTypeReference().getErasedSignature();
if (signature.equals("Lcom/google/j2objc/annotations/ObjectiveCName;")) {
for (Expression expr : annotation.getArguments()) {
if (expr instanceof MemberReferenceExpression) {
String value = ((MemberReferenceExpression) expr).getMemberName();
builder.setObjectiveCName(value);
} else if (expr instanceof PrimitiveExpression) {
Object value = ((PrimitiveExpression) expr).getValue();
builder.setObjectiveCName((String) value);
}
}
} else if (signature.equals("Ljavax/annotation/ParametersAreNonnullByDefault;")) {
builder.setParametersAreNonnullByDefault();
} else if (signature.equals("Lcom/google/j2objc/annotations/ReflectionSupport;")) {
for (Expression expr : annotation.getArguments()) {
if (expr instanceof MemberReferenceExpression) {
String value = ((MemberReferenceExpression) expr).getMemberName();
builder.setReflectionSupportLevel(ReflectionSupport.Level.valueOf(value));
}
}
}
}
return builder.build();
}
Aggregations