From 868626bb2e543632184f17d3d4971772ea716a5b Mon Sep 17 00:00:00 2001 From: Error Prone Team Date: Mon, 22 Jul 2024 12:41:25 -0700 Subject: [PATCH] Ban more class loading primitives No new violations are found after TGP. PiperOrigin-RevId: 654858529 --- .../java/com/google/errorprone/bugpatterns/BanClassLoader.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/BanClassLoader.java b/core/src/main/java/com/google/errorprone/bugpatterns/BanClassLoader.java index f7528a7dd9f..de59bde14b6 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/BanClassLoader.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/BanClassLoader.java @@ -48,6 +48,8 @@ public final class BanClassLoader extends AbstractBanUnsafeAPIChecker private static final Matcher METHOD_MATCHER = anyOf( anyMethod().onDescendantOf("java.lang.ClassLoader").named("defineClass"), + anyMethod().onDescendantOf("jdk.internal.misc.Unsafe").named("defineClass"), + anyMethod().onDescendantOf("jdk.internal.access.JavaLangAccess").named("defineClass"), anyMethod().onDescendantOf("java.lang.invoke.MethodHandles.Lookup").named("defineClass"), anyMethod() .onDescendantOf("java.rmi.server.RMIClassLoader")