Drop Annotations.findAnyAnnotation, DescriptorUtils.getAnnotationByFqName

This commit is contained in:
Alexander Udalov
2018-08-14 17:26:09 +02:00
parent 9d1baaeb56
commit 7271995ff0
9 changed files with 18 additions and 50 deletions
@@ -56,12 +56,8 @@ public abstract class AnnotationCodegen {
this.jvmFlag = jvmFlag;
}
public boolean hasAnnotation(@NotNull Annotated annotated) {
return Annotations.Companion.findAnyAnnotation(annotated.getAnnotations(), fqName) != null;
}
public int getJvmFlag() {
return jvmFlag;
public int getJvmFlag(@Nullable Annotated annotated) {
return annotated != null && annotated.getAnnotations().hasAnnotation(fqName) ? jvmFlag : 0;
}
}
@@ -225,9 +225,7 @@ public class AsmUtil {
int flags = getCommonCallableFlags(functionDescriptor, state);
for (AnnotationCodegen.JvmFlagAnnotation flagAnnotation : AnnotationCodegen.METHOD_FLAGS) {
if (flagAnnotation.hasAnnotation(functionDescriptor.getOriginal())) {
flags |= flagAnnotation.getJvmFlag();
}
flags |= flagAnnotation.getJvmFlag(functionDescriptor.getOriginal());
}
if (functionDescriptor.getOriginal().isExternal()) {
@@ -370,9 +370,7 @@ public class PropertyCodegen {
int modifiers = getDeprecatedAccessFlag(propertyDescriptor);
for (AnnotationCodegen.JvmFlagAnnotation flagAnnotation : AnnotationCodegen.FIELD_FLAGS) {
if (annotatedField != null && flagAnnotation.hasAnnotation(annotatedField)) {
modifiers |= flagAnnotation.getJvmFlag();
}
modifiers |= flagAnnotation.getJvmFlag(annotatedField);
}
if (kind == OwnerKind.PACKAGE) {