diff options
author | caramel <[email protected]> | 2024-10-21 07:46:50 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-21 00:46:50 +0200 |
commit | c13f9fd06a1d47ca163f5896528210f71dcc770e (patch) | |
tree | 3c31efd390d563be143b2dc5167d0e8dbc20746c | |
parent | 3b9db2b19422c8cd6f4c01cc0bdf40974712b744 (diff) | |
download | Paper-c13f9fd06a1d47ca163f5896528210f71dcc770e.tar.gz Paper-c13f9fd06a1d47ca163f5896528210f71dcc770e.zip |
Fix potential annotation testing interruption (#11460)
-rw-r--r-- | patches/api/0003-Test-changes.patch | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/patches/api/0003-Test-changes.patch b/patches/api/0003-Test-changes.patch index 4339385ed5..a94334f967 100644 --- a/patches/api/0003-Test-changes.patch +++ b/patches/api/0003-Test-changes.patch @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f + } +} diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java -index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa7ecefe86 100644 +index 64e7aef6220097edefdff3b98a771b988365930d..f8b8969ee7a0b6f7b3224ff081e35c14a398c9d0 100644 --- a/src/test/java/org/bukkit/AnnotationTest.java +++ b/src/test/java/org/bukkit/AnnotationTest.java @@ -29,7 +29,13 @@ public class AnnotationTest { @@ -108,8 +108,8 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa } + // Paper start - skip class if it's @NullMarked -+ if (isClassNullMarked(clazz)) { -+ return; ++ if (isClassNullMarked(clazz, foundClasses)) { ++ continue; + } + // Paper end - skip class if it's @NullMarked + @@ -187,12 +187,23 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa } private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException { -@@ -125,6 +186,12 @@ public class AnnotationTest { +@@ -125,6 +186,23 @@ public class AnnotationTest { } } + // Paper start - skip class if it's @NullMarked -+ private static boolean isClassNullMarked(@NotNull ClassNode clazz) { ++ private static boolean isClassNullMarked(@NotNull ClassNode clazz, @NotNull Map<String, ClassNode> allClasses) { ++ if (clazz.nestHostClass != null) { ++ final ClassNode nestHostNode = allClasses.get(clazz.nestHostClass); ++ if (nestHostNode != null) { ++ return isClassNullMarked0(nestHostNode); ++ } ++ } ++ ++ return isClassNullMarked0(clazz); ++ } ++ ++ private static boolean isClassNullMarked0(@NotNull ClassNode clazz) { + return clazz.visibleAnnotations != null && clazz.visibleAnnotations.stream().anyMatch(node -> "Lorg/jspecify/annotations/NullMarked;".equals(node.desc)); + } + // Paper end - skip class if it's @NullMarked @@ -200,7 +211,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa private static boolean isClassIncluded(@NotNull ClassNode clazz, @NotNull Map<String, ClassNode> allClasses) { // Exclude private, synthetic or deprecated classes and annotations, since their members can't be null if ((clazz.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED | Opcodes.ACC_ANNOTATION)) != 0) { -@@ -140,6 +207,11 @@ public class AnnotationTest { +@@ -140,6 +218,11 @@ public class AnnotationTest { // Exceptions are excluded return false; } @@ -212,7 +223,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa for (String excludedClass : EXCLUDED_CLASSES) { if (excludedClass.equals(clazz.name)) { -@@ -152,7 +224,7 @@ public class AnnotationTest { +@@ -152,7 +235,7 @@ public class AnnotationTest { private static boolean isMethodIncluded(@NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull Map<String, ClassNode> allClasses) { // Exclude private, synthetic and deprecated methods @@ -221,7 +232,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..7ff939ea41417bad3a436a87c89d5efa return false; } -@@ -170,11 +242,30 @@ public class AnnotationTest { +@@ -170,11 +253,30 @@ public class AnnotationTest { if ("<init>".equals(method.name) && isAnonymous(clazz)) { return false; } |