diff options
Diffstat (limited to 'patches/api/0003-Test-changes.patch')
-rw-r--r-- | patches/api/0003-Test-changes.patch | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/patches/api/0003-Test-changes.patch b/patches/api/0003-Test-changes.patch index 41dfb8bc77..7649a1904f 100644 --- a/patches/api/0003-Test-changes.patch +++ b/patches/api/0003-Test-changes.patch @@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f + } +} diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java -index 64e7aef6220097edefdff3b98a771b988365930d..f8b8969ee7a0b6f7b3224ff081e35c14a398c9d0 100644 +index 64e7aef6220097edefdff3b98a771b988365930d..07f904a78f51b220a5891aca1afffac4f46d58b4 100644 --- a/src/test/java/org/bukkit/AnnotationTest.java +++ b/src/test/java/org/bukkit/AnnotationTest.java @@ -29,7 +29,13 @@ public class AnnotationTest { @@ -200,7 +200,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..f8b8969ee7a0b6f7b3224ff081e35c14 ParameterNode paramNode = parameters == null ? null : parameters.get(i); String paramName = paramNode == null ? null : paramNode.name; -@@ -91,13 +147,18 @@ public class AnnotationTest { +@@ -91,17 +147,37 @@ public class AnnotationTest { Collections.sort(errors); @@ -223,7 +223,26 @@ index 64e7aef6220097edefdff3b98a771b988365930d..f8b8969ee7a0b6f7b3224ff081e35c14 } private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException { -@@ -125,6 +186,23 @@ public class AnnotationTest { + if (from.isDirectory()) { ++ // Paper start - skip packages with @NullMarked ++ final File packageInfo = new File(from, "package-info.class"); ++ if (packageInfo.exists()) { ++ try (final FileInputStream in = new FileInputStream(packageInfo)) { ++ final ClassReader cr = new ClassReader(in); ++ ++ final ClassNode node = new ClassNode(); ++ cr.accept(node, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); ++ ++ if (isClassNullMarked0(node)) { ++ return; // skip packages with @NullMarked ++ } ++ } ++ } ++ // Paper end - skip packages with @NullMarked + final File[] files = from.listFiles(); + assert files != null; + +@@ -125,6 +201,23 @@ public class AnnotationTest { } } @@ -247,7 +266,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..f8b8969ee7a0b6f7b3224ff081e35c14 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 +218,11 @@ public class AnnotationTest { +@@ -140,6 +233,11 @@ public class AnnotationTest { // Exceptions are excluded return false; } @@ -259,7 +278,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..f8b8969ee7a0b6f7b3224ff081e35c14 for (String excludedClass : EXCLUDED_CLASSES) { if (excludedClass.equals(clazz.name)) { -@@ -152,7 +235,7 @@ public class AnnotationTest { +@@ -152,7 +250,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 @@ -268,7 +287,7 @@ index 64e7aef6220097edefdff3b98a771b988365930d..f8b8969ee7a0b6f7b3224ff081e35c14 return false; } -@@ -170,11 +253,30 @@ public class AnnotationTest { +@@ -170,11 +268,30 @@ public class AnnotationTest { if ("<init>".equals(method.name) && isAnonymous(clazz)) { return false; } |