From 70cf71602de11ff3e2fa8890d95c9f6fba811b9e Mon Sep 17 00:00:00 2001
From: Luck <git@lucko.me>
Date: Tue, 15 Jun 2021 20:06:17 +0100
Subject: Update ASM for full Java 16 support

---
 .../java/me/lucko/spark/common/util/MethodDisambiguator.java     | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

(limited to 'spark-common/src')

diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/MethodDisambiguator.java b/spark-common/src/main/java/me/lucko/spark/common/util/MethodDisambiguator.java
index a35bf08..c03e7cb 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/util/MethodDisambiguator.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/util/MethodDisambiguator.java
@@ -46,6 +46,7 @@ import java.util.concurrent.ConcurrentHashMap;
  */
 public final class MethodDisambiguator {
     private final Map<String, ComputedClass> cache = new ConcurrentHashMap<>();
+    private final ClassFinder classFinder = new ClassFinder();
 
     public Optional<MethodDescription> disambiguate(StackTraceNode element) {
         String desc = element.getMethodDescription();
@@ -80,7 +81,7 @@ public final class MethodDisambiguator {
         }
     }
 
-    private static ClassReader getClassReader(String className) throws IOException {
+    private ClassReader getClassReader(String className) throws IOException {
         String resource = className.replace('.', '/') + ".class";
 
         try (InputStream is = ClassLoader.getSystemResourceAsStream(resource)) {
@@ -89,15 +90,13 @@ public final class MethodDisambiguator {
             }
         }
 
-        try {
-            Class<?> clazz = Class.forName(className);
+        Class<?> clazz = this.classFinder.findClass(className);
+        if (clazz != null) {
             try (InputStream is = clazz.getClassLoader().getResourceAsStream(resource)) {
                 if (is != null) {
                     return new ClassReader(is);
                 }
             }
-        } catch (ClassNotFoundException e) {
-            // ignore
         }
 
         throw new IOException("Unable to get resource: " + className);
-- 
cgit