瀏覽代碼

Code improvement

Lortseam 4 年之前
父節點
當前提交
a44c96d3ea
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      lib/src/main/java/me/lortseam/completeconfig/data/entry/EntryOrigin.java

+ 3 - 2
lib/src/main/java/me/lortseam/completeconfig/data/entry/EntryOrigin.java

@@ -26,10 +26,11 @@ public final class EntryOrigin {
     }
 
     public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
-        if (!field.isAnnotationPresent(annotationType)) {
+        A annotation = field.getDeclaredAnnotation(annotationType);
+        if (annotation == null) {
             throw new IllegalStateException("Missing required transformation annotation: " + annotationType);
         }
-        return field.getDeclaredAnnotation(annotationType);
+        return annotation;
     }
 
     public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {