diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/analysis/ParsedJar.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/analysis/ParsedJar.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/ParsedJar.java b/src/main/java/cuchaz/enigma/analysis/ParsedJar.java index 86655d0..ad3aceb 100644 --- a/src/main/java/cuchaz/enigma/analysis/ParsedJar.java +++ b/src/main/java/cuchaz/enigma/analysis/ParsedJar.java | |||
| @@ -12,11 +12,12 @@ | |||
| 12 | package cuchaz.enigma.analysis; | 12 | package cuchaz.enigma.analysis; |
| 13 | 13 | ||
| 14 | import com.google.common.io.ByteStreams; | 14 | import com.google.common.io.ByteStreams; |
| 15 | import cuchaz.enigma.mapping.entry.ClassEntry; | 15 | import cuchaz.enigma.translation.representation.entry.ClassEntry; |
| 16 | import org.objectweb.asm.ClassReader; | 16 | import org.objectweb.asm.ClassReader; |
| 17 | import org.objectweb.asm.ClassVisitor; | 17 | import org.objectweb.asm.ClassVisitor; |
| 18 | import org.objectweb.asm.tree.ClassNode; | 18 | import org.objectweb.asm.tree.ClassNode; |
| 19 | 19 | ||
| 20 | import javax.annotation.Nullable; | ||
| 20 | import java.io.BufferedInputStream; | 21 | import java.io.BufferedInputStream; |
| 21 | import java.io.IOException; | 22 | import java.io.IOException; |
| 22 | import java.io.InputStream; | 23 | import java.io.InputStream; |
| @@ -100,9 +101,14 @@ public class ParsedJar { | |||
| 100 | return entries; | 101 | return entries; |
| 101 | } | 102 | } |
| 102 | 103 | ||
| 104 | @Nullable | ||
| 103 | public ClassNode getClassNode(String name) { | 105 | public ClassNode getClassNode(String name) { |
| 104 | return nodeCache.computeIfAbsent(name, (n) -> { | 106 | return nodeCache.computeIfAbsent(name, (n) -> { |
| 105 | ClassReader reader = new ClassReader(classBytes.get(name)); | 107 | byte[] bytes = classBytes.get(name); |
| 108 | if (bytes == null) { | ||
| 109 | return null; | ||
| 110 | } | ||
| 111 | ClassReader reader = new ClassReader(bytes); | ||
| 106 | ClassNode node = new ClassNode(); | 112 | ClassNode node = new ClassNode(); |
| 107 | reader.accept(node, 0); | 113 | reader.accept(node, 0); |
| 108 | return node; | 114 | return node; |