Skip to content

Commit

Permalink
Fix decompiler thread classes being excluded
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoPangxie732 committed Aug 31, 2024
1 parent a0145bb commit fedfa7a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void testFormatExtension() {
}

@Test
void testProcessor(@TempDir(cleanup = CleanupMode.ON_SUCCESS) Path tmp) throws IOException {
void testProcessorAndGenerator(@TempDir(cleanup = CleanupMode.ON_SUCCESS) Path tmp) throws IOException {
LOGGER.info(tmp.toString());
var is = getClass().getClassLoader().getResourceAsStream("parchment.json");
assertNotNull(is);
Expand Down
6 changes: 6 additions & 0 deletions modules/cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
<exclude>it/unimi/dsi/fastutil/**/*Big*</exclude>
</excludes>
</filter>
<filter>
<artifact>cn.maxpixel.minecraft-decompiler:decompiler</artifact>
<includes>
<include>**</include>
</includes>
</filter>
</filters>
<relocations>
<relocation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ExternalJarClassLoader(URL[] urls) {

@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
if(name.startsWith("cn.maxpixel.mcdecompiler.decompiler.thread")) {
if (name.startsWith("cn.maxpixel.mcdecompiler.decompiler.thread")) {
synchronized (getClassLoadingLock(name)) {
Class<?> c = findLoadedClass(name);
if (c == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public boolean canDetectHeader() {
}

@Override
public Pair<MappingFormat<?, ?>, Percentage> detectContent(List<String> contents) {
public Pair</*@Nullable*/ MappingFormat<?, ?>, /*@NotNull*/ Percentage> detectContent(List<String> contents) {
String s = contents.get(0);
if (s.startsWith("PK: ") || s.startsWith("CL: ") || s.startsWith("FD: ") || s.startsWith("MD: ")) return Pair.of(MappingFormats.SRG, Percentage.NINETY_NINE);
else if (s.endsWith(":")) return Pair.of(MappingFormats.PROGUARD, Percentage.NINETY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ default Predicate<String> getLineFilter() {
return Optional.empty();
}

Pair<MappingFormat<?, ?>, Percentage> detectContent(List<String> contents);
Pair</*@Nullable*/ MappingFormat<?, ?>, /*@NotNull*/ Percentage> detectContent(List<String> contents);

enum Percentage {
ZERO,
Expand Down

0 comments on commit fedfa7a

Please sign in to comment.