Skip to content

Commit f8f0aea

Browse files
authored
Merge branch 'Konloch:master' into master
2 parents af78e3c + 47a99c4 commit f8f0aea

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
<smali.version>2.5.2</smali.version>
4444
<snakeyaml.version>1.29</snakeyaml.version>
4545
<xpp3.version>1.1.4c</xpp3.version>
46-
<jadx.version>f681c89</jadx.version>
47-
<dex2jar.version>v24</dex2jar.version>
46+
<jadx.version>8e89a2e</jadx.version>
47+
<dex2jar.version>v26</dex2jar.version>
4848
<darklaf.version>2.7.2</darklaf.version>
4949
<darklaf-extensions-rsta.version>0.3.4</darklaf-extensions-rsta.version>
5050
<webp-imageio.version>0.2.2</webp-imageio.version>
51-
<semantic-version.version>2.1.0</semantic-version.version>
51+
<semantic-version.version>2.1.1</semantic-version.version>
5252
<treelayout.version>1.0.3</treelayout.version>
5353
<antlr4.version>4.9.2</antlr4.version>
5454
<js.version>21.2.0</js.version>

src/main/java/the/bytecode/club/bytecodeviewer/decompilers/jdgui/JDGUIClassFileUtil.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.io.File;
66
import java.io.FileInputStream;
77
import java.io.IOException;
8-
import java.util.Objects;
98
import org.jd.core.v1.model.classfile.constant.Constant;
109
import org.jd.core.v1.model.classfile.constant.ConstantClass;
1110
import org.jd.core.v1.model.classfile.constant.ConstantUtf8;
@@ -29,8 +28,9 @@ public static String ExtractDirectoryPath(String pathToClass) {
2928
BufferedInputStream bis = new BufferedInputStream(fis);
3029
DataInputStream dis = new DataInputStream(bis)) {
3130
int magic = dis.readInt();
32-
if (magic != ClassFileReader.JAVA_MAGIC_NUMBER)
31+
if (magic != ClassFileReader.JAVA_MAGIC_NUMBER) {
3332
throw new ClassFileFormatException("Invalid Java .class file");
33+
}
3434

3535
/* int minor_version = */
3636
dis.readUnsignedShort();
@@ -43,16 +43,18 @@ public static String ExtractDirectoryPath(String pathToClass) {
4343
dis.readUnsignedShort();
4444
int this_class = dis.readUnsignedShort();
4545

46-
if (this_class > Objects.requireNonNull(constants).length) {
46+
if (this_class > constants.length) {
4747
throw new ClassFileFormatException("Unknown Java structure");
4848
}
4949
Constant c = constants[this_class];
50-
if ((c == null) || (c.getTag() != Constant.CONSTANT_Class))
50+
if ((c == null) || (c.getTag() != Constant.CONSTANT_Class)) {
5151
throw new ClassFileFormatException("Invalid constant pool");
52+
}
5253

5354
c = constants[((ConstantClass) c).getNameIndex()];
54-
if ((c == null) || (c.getTag() != Constant.CONSTANT_Utf8))
55+
if ((c == null) || (c.getTag() != Constant.CONSTANT_Utf8)) {
5556
throw new ClassFileFormatException("Invalid constant pool");
57+
}
5658

5759
String internalClassName = ((ConstantUtf8) c).getValue();
5860
String pathSuffix = internalClassName.replace(
@@ -61,8 +63,9 @@ public static String ExtractDirectoryPath(String pathToClass) {
6163

6264
int index = pathToClass.indexOf(pathSuffix);
6365

64-
if (index < 0)
66+
if (index < 0) {
6567
throw new ClassFileFormatException("Invalid internal class name");
68+
}
6669

6770
directoryPath = pathToClass.substring(0, index);
6871
} catch (IOException e) {
@@ -87,9 +90,6 @@ public static String ExtractInternalPath(
8790
private static Constant[] DeserializeConstants(DataInputStream dis)
8891
throws IOException {
8992
int count = dis.readUnsignedShort();
90-
if (count == 0)
91-
return null;
92-
9393
Constant[] constants = new Constant[count];
9494

9595
for (int i = 1; i < count; i++) {
@@ -112,12 +112,15 @@ private static Constant[] DeserializeConstants(DataInputStream dis)
112112
case Constant.CONSTANT_FieldRef:
113113
case Constant.CONSTANT_MethodRef:
114114
case Constant.CONSTANT_InterfaceMethodRef:
115+
case Constant.CONSTANT_InvokeDynamic:
115116
case Constant.CONSTANT_NameAndType:
116117
case Constant.CONSTANT_Integer:
117118
case Constant.CONSTANT_Float:
118119
dis.read();
120+
case Constant.CONSTANT_MethodHandle:
119121
dis.read();
120122
case Constant.CONSTANT_String:
123+
case Constant.CONSTANT_MethodType:
121124
dis.read();
122125
dis.read();
123126
break;

0 commit comments

Comments
 (0)