Open BHNHAT opened 1 year ago
Do you have permission to use these samples in the first place?
It is extracted from a game so I don't know if it is legal or not. But this game has a lot of modded version thought.
I think I have a reproducible case that's related... compiling with java 21+
public static void test() {
switch ((TestInterface) TestEnum.B) {
case TestEnum.A -> System.out.println("A");
case TestEnum.B -> System.out.println("B");
case TestEnum.C -> System.out.println("C");
case null -> System.out.println("B");
}
}
enum TestEnum implements TestInterface {
A,
B,
C
}
sealed interface TestInterface permits TestEnum {
}
results in
// $VF: Couldn't be decompiled
// Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
// java.lang.IllegalStateException: Invalid switch case set: [[const(null)], [const(0)], [const(1)], [const(2)], [null]] for selector of type Lxyz/wagyourtail/downgradetest/TestSwitch$TestEnum;
// at org.jetbrains.java.decompiler.modules.decompiler.exps.SwitchHeadExprent.checkExprTypeBounds(SwitchHeadExprent.java:66)
// at org.jetbrains.java.decompiler.modules.decompiler.vars.VarTypeProcessor.checkTypeExpr(VarTypeProcessor.java:140)
// at org.jetbrains.java.decompiler.modules.decompiler.vars.VarTypeProcessor.checkTypeExprent(VarTypeProcessor.java:126)
// at org.jetbrains.java.decompiler.modules.decompiler.vars.VarTypeProcessor.lambda$processVarTypes$2(VarTypeProcessor.java:114)
// at org.jetbrains.java.decompiler.modules.decompiler.flow.DirectGraph.iterateExprents(DirectGraph.java:107)
// at org.jetbrains.java.decompiler.modules.decompiler.vars.VarTypeProcessor.processVarTypes(VarTypeProcessor.java:114)
// at org.jetbrains.java.decompiler.modules.decompiler.vars.VarTypeProcessor.calculateVarTypes(VarTypeProcessor.java:44)
// at org.jetbrains.java.decompiler.modules.decompiler.vars.VarVersionsProcessor.setVarVersions(VarVersionsProcessor.java:68)
// at org.jetbrains.java.decompiler.modules.decompiler.vars.VarProcessor.setVarVersions(VarProcessor.java:47)
// at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:295)
//
which is only slightly different in contents for the switch case set...
tested using VF IDEA plugin, on VF version 1.11.0-20240523.155640-28
WARN: Method g (Lce;)V in class an couldn't be decompiled. java.lang.IllegalStateException: Invalid switch case set: [[const(-128)], [const(-127)], [const(-126)], [const(-125)], [const(-124)], [const(-123)], [const(-122)], [const(-121)], [const(-120)], [const(-119)], [const(-117)], [const(-116)], [const(-113)], [const(-112)], [const(-111)], [const(-110)], [const(-109)], [const(-107)], [const(-106)], [const(-105)], [const(-104)], [const(-102)], [const(-101)], [const(-100)], [const(-99)], [const(-98)], [const(-97)], [const(-96)], [const(-95)], [const(-94)], [const(-92)], [const(-91)], [const(-90)], [const(-89)], [const(-87)], [const(-86)], [const(-85)], [const(-84)], [const(-83)], [const(-82)], [const(-81)], [const(-80)], [const(-78)], [const(-77)], [const(-76)], [const(-75)], [const(-74)], [const(-73)], [const(-72)], [const(-71)], [const(-69)], [const(-68)], [const(-65)], [const(-64)], [const(-63)], [const(-62)], [const(-61)], [const(-59)], [const(-58)], [const(-57)], [const(-56)], [const(-55)], [const(-54)], [const(115)], [null]] for selector of type Lbp;
The decompiler can decompile am.class which is the old version but It can't decompile the new one
class file links removed