Skip to content

Commit 40e20cf

Browse files
authored
build: Bump to a minimum requirement of Java 17 (#113)
* build: Bump to a minimum requirement of Java 17 * Perform a patch tidy-up and basic warning pass This removes unused imports, resolves patch ordering issues, and deals with easily resolvable IDE warnings -- reducing noise during further development. We also ensure that patches are a linear progression that compiles at each commit.
1 parent ee4d12c commit 40e20cf

49 files changed

Lines changed: 646 additions & 1106 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.teamcity/settings.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ project {
3636
text("github_repository_name", "ForgeFlower", label = "The github repository name. Used to connect to it in VCS Roots.", description = "This is the repository slug on github. So for example `ForgeFlower` or `MinecraftForge`. It is interpolated into the global VCS Roots.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
3737
text("env.PUBLISHED_JAVA_ARTIFACT_ID", "forgeflower", label = "Published artifact id", description = "The maven coordinate artifact id that has been published by this build. Can not be empty.", allowEmpty = false)
3838
text("env.PUBLISHED_JAVA_GROUP", "net.minecraftforge", label = "Published group", description = "The maven coordinate group that has been published by this build. Can not be empty.", allowEmpty = false)
39-
text("docker_jdk_version", "8", label = "JDK version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
40-
text("docker_gradle_version", "7.4", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
39+
text("docker_jdk_version", "17", label = "JDK version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
40+
text("docker_gradle_version", "7.5.1", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
4141
text("env.EMAIL", "ForgeTC@MinecraftForge.net", label = "Git Email", description = "Git email for use in the fake repo", display = ParameterDisplay.HIDDEN, allowEmpty = false)
4242
checkbox("env.GITPATCHER_ADD_GIT_SAFEDIR", "true", label = "Add submodules as safedirs (Gitpatcher)", description = "Whether to add the submodule and patched repository as safe directories for git", checked = "true", unchecked = "false")
4343
checkbox(

FernFlower-Patches/0001-Git-filter-and-setup-backport-to-Java-8.patch renamed to FernFlower-Patches/0001-Git-filter-and-setup-cleanup-for-java-17.patch

Lines changed: 43 additions & 370 deletions
Large diffs are not rendered by default.

FernFlower-Patches/0002-Test-Framework-upgrades.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ index 4c5641fec76837a51094d4a54800d5b7475446ca..7d29c198014cbfee8092fd31461208ce
7171
private static boolean isTestDataDir(File dir) {
7272
return dir.isDirectory() && new File(dir, "classes").isDirectory() && new File(dir, "results").isDirectory();
7373
diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java
74-
index e64cf91c0674163f5c81b874e21e84da83fd264e..721a3606e209f4f803dcb6b513a5768c9c437c48 100644
74+
index e64cf91c0674163f5c81b874e21e84da83fd264e..8c4811fe2e4c46bf87bc0b4ac7752bae5243faf1 100644
7575
--- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java
7676
+++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java
77-
@@ -2,26 +2,14 @@
77+
@@ -2,27 +2,13 @@
7878
package org.jetbrains.java.decompiler;
7979

8080
import org.jetbrains.java.decompiler.main.DecompilerContext;
@@ -98,12 +98,12 @@ index e64cf91c0674163f5c81b874e21e84da83fd264e..721a3606e209f4f803dcb6b513a5768c
9898
-
9999
-public class SingleClassesTest {
100100
- private DecompilerTestFixture fixture;
101+
-
101102
+public class SingleClassesTest extends SingleClassesTestBase {
102-
+ protected DecompilerTestFixture fixture;
103-
104103
/*
105104
* Set individual test duration time limit to 60 seconds.
106-
@@ -30,19 +18,14 @@ public class SingleClassesTest {
105+
* This will help us to test bugs hanging decompiler.
106+
@@ -30,19 +16,14 @@ public class SingleClassesTest {
107107
@Rule
108108
public Timeout globalTimeout = Timeout.seconds(60);
109109

@@ -131,7 +131,7 @@ index e64cf91c0674163f5c81b874e21e84da83fd264e..721a3606e209f4f803dcb6b513a5768c
131131
}
132132

133133
@Test public void testPrimitiveNarrowing() { doTest("pkg/TestPrimitiveNarrowing"); }
134-
@@ -226,45 +209,4 @@ public class SingleClassesTest {
134+
@@ -226,45 +207,4 @@ public class SingleClassesTest {
135135

136136
@Test(expected = ClassFormatException.class)
137137
public void testUnsupportedConstantPoolEntry() { doTest("java11/TestUnsupportedConstantPoolEntry"); }

FernFlower-Patches/0003-Fix-initializers-for-anon-and-synthetic-classes.patch

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ index 804443bf66c6cc2a9cadf5ef11c44827257aaf53..a45067feeedaece4546ae2dbc5148fbf
5353
String enclClassName = entry.outerNameIdx != 0 ? entry.enclosingName : cl.qualifiedName;
5454
if (enclClassName == null || innerName.equals(enclClassName)) {
5555
diff --git a/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java b/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java
56-
index bc8992ff40bf8655077d2c01a7038bfbbfe999c0..4930acdf38046e1dfe3f04a7e68b4ff88c4ed594 100644
56+
index bc8992ff40bf8655077d2c01a7038bfbbfe999c0..34be3854cad1675d54a32929d5e1fe1641f1a929 100644
5757
--- a/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java
5858
+++ b/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java
5959
@@ -13,6 +13,9 @@ import org.jetbrains.java.decompiler.modules.decompiler.stats.Statements;
@@ -121,10 +121,3 @@ index bc8992ff40bf8655077d2c01a7038bfbbfe999c0..4930acdf38046e1dfe3f04a7e68b4ff8
121121
}
122122
}
123123
}
124-
@@ -248,4 +295,4 @@ public final class InitializerProcessor {
125-
126-
return true;
127-
}
128-
-}
129-
\ No newline at end of file
130-
+}

FernFlower-Patches/0005-Fix-output-discrepancies-to-produce-stable-output.patch renamed to FernFlower-Patches/0004-Fix-output-discrepancies-to-produce-stable-output.patch

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ index fe2d3b14c6e48dc08831123ef80902bc3126ceca..86cac9e08f0f0d3ebd43353b64eba956
191191
}
192192
else {
193193
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java
194-
index f7addc6af8928ee2b2d1b9a09d13750413d4721f..79dceb558c4b99591e87d917739bcf4c66bda292 100644
194+
index 939863351be0544adc7c4079dc2dbb18be877fb9..6216a80e20d1a1bbb80c5b343b743832e0421dbc 100644
195195
--- a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java
196196
+++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java
197-
@@ -933,6 +933,7 @@ public class ExprProcessor implements CodeConstants {
197+
@@ -932,6 +932,7 @@ public class ExprProcessor implements CodeConstants {
198198
}
199199

200200
TextBuffer buf = new TextBuffer();
@@ -203,14 +203,14 @@ index f7addc6af8928ee2b2d1b9a09d13750413d4721f..79dceb558c4b99591e87d917739bcf4c
203203
for (Exprent expr : lst) {
204204
if (buf.length() > 0 && expr.type == Exprent.EXPRENT_VAR && ((VarExprent)expr).isClassDef()) {
205205
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java
206-
index 13d747a5ec6b961763f70b9174efeaf976336dbc..5428c1d1b10e0fbaa7c3b62725acd34d0632f37c 100644
206+
index 13d747a5ec6b961763f70b9174efeaf976336dbc..ad41b185d8c830f26b4f598a6568b3272a11d86f 100644
207207
--- a/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java
208208
+++ b/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java
209209
@@ -480,10 +480,17 @@ public class FinallyProcessor {
210210
// so remove dummy exit
211211
startBlocks.remove(graph.getLast());
212212
startBlocks.removeAll(tryBlocks);
213-
+ List<BasicBlock> starts = new ArrayList<BasicBlock>(startBlocks);
213+
+ List<BasicBlock> starts = new ArrayList<>(startBlocks);
214214
+ Collections.sort(starts, new Comparator<BasicBlock>() {
215215
+ @Override
216216
+ public int compare(BasicBlock o1, BasicBlock o2) {
@@ -229,7 +229,7 @@ index 13d747a5ec6b961763f70b9174efeaf976336dbc..5428c1d1b10e0fbaa7c3b62725acd34d
229229
// DotExporter.toDotFile(graph, new File("c:\\Temp\\fern5.dot"), true);
230230
// } catch(Exception ex){ex.printStackTrace();}
231231

232-
+ List<Entry<BasicBlock, Boolean>> lasts = new ArrayList<Entry<BasicBlock, Boolean>>(mapLast.entrySet());
232+
+ List<Entry<BasicBlock, Boolean>> lasts = new ArrayList<>(mapLast.entrySet());
233233
+ // We must sort here to prevent decompile differences deriving from hash maps.
234234
+ Collections.sort(lasts, new Comparator<Entry<BasicBlock, Boolean>>() {
235235
+ @Override
@@ -338,10 +338,10 @@ index 82ae0a25a20d2727f611d359e699d6666d1e0ae4..a86f0d2887c6c19cb1d911ec43830eb6
338338

339339
return res;
340340
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java
341-
index 3882cfd68af7f55938311363a69a2dded3fffbab..48d38ff8657fd6d237fe2d75677d89b8bbd8852d 100644
341+
index a7033f507fd9667d773977803718c08810f0d750..3edae784f56848a5697879cfef9e05130ee38d34 100644
342342
--- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java
343343
+++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java
344-
@@ -220,7 +220,7 @@ public class ConstExprent extends Exprent {
344+
@@ -219,7 +219,7 @@ public class ConstExprent extends Exprent {
345345
else if (floatVal == Float.NEGATIVE_INFINITY) {
346346
return new TextBuffer("-1.0F / 0.0F");
347347
}
@@ -350,7 +350,7 @@ index 3882cfd68af7f55938311363a69a2dded3fffbab..48d38ff8657fd6d237fe2d75677d89b8
350350

351351
case CodeConstants.TYPE_DOUBLE:
352352
double doubleVal = (Double)value;
353-
@@ -251,15 +251,15 @@ public class ConstExprent extends Exprent {
353+
@@ -250,15 +250,15 @@ public class ConstExprent extends Exprent {
354354
}
355355
}
356356
else if (Double.isNaN(doubleVal)) {
@@ -370,7 +370,7 @@ index 3882cfd68af7f55938311363a69a2dded3fffbab..48d38ff8657fd6d237fe2d75677d89b8
370370

371371
case CodeConstants.TYPE_NULL:
372372
return new TextBuffer("null");
373-
@@ -277,6 +277,18 @@ public class ConstExprent extends Exprent {
373+
@@ -276,6 +276,18 @@ public class ConstExprent extends Exprent {
374374

375375
throw new RuntimeException("invalid constant type: " + constType);
376376
}
@@ -390,7 +390,7 @@ index 3882cfd68af7f55938311363a69a2dded3fffbab..48d38ff8657fd6d237fe2d75677d89b8
390390
private boolean inConstantVariable(String classSignature, String variableName) {
391391
ClassesProcessor.ClassNode node = (ClassesProcessor.ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE);
392392
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java
393-
index cc1f537e71af0748b7b97d7d8489198e2a677cc9..0994d9466eda95b46d3f234bf977e8e9aa0e0899 100644
393+
index cc1f537e71af0748b7b97d7d8489198e2a677cc9..9b1b3de632a63bbba1f5f7a99d5f75bf537bd171 100644
394394
--- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java
395395
+++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java
396396
@@ -15,7 +15,10 @@ import org.jetbrains.java.decompiler.struct.match.MatchEngine;
@@ -404,15 +404,16 @@ index cc1f537e71af0748b7b97d7d8489198e2a677cc9..0994d9466eda95b46d3f234bf977e8e9
404404
import java.util.HashSet;
405405
import java.util.List;
406406
import java.util.Map.Entry;
407-
@@ -131,6 +134,38 @@ public class Exprent implements IMatchable {
407+
@@ -131,6 +134,39 @@ public class Exprent implements IMatchable {
408408
}
409409
}
410410

411411
+ public static List<? extends Exprent> sortIndexed(List<? extends Exprent> lst) {
412-
+ List<Exprent> ret = new ArrayList<Exprent>();
413-
+ List<VarExprent> defs = new ArrayList<VarExprent>();
412+
+ List<Exprent> ret = new ArrayList<>();
413+
+ List<VarExprent> defs = new ArrayList<>();
414414
+
415-
+ Comparator<VarExprent> comp = new Comparator<VarExprent>() {
415+
+ Comparator<VarExprent> comp = new Comparator<>() {
416+
+ @Override
416417
+ public int compare(VarExprent o1, VarExprent o2) {
417418
+ return o1.getIndex() - o2.getIndex();
418419
+ }
@@ -439,7 +440,7 @@ index cc1f537e71af0748b7b97d7d8489198e2a677cc9..0994d9466eda95b46d3f234bf977e8e9
439440
+ }
440441
+ return ret;
441442
+ }
442-
+
443+
+
443444
// *****************************************************************************
444445
// IMatchable implementation
445446
// *****************************************************************************

0 commit comments

Comments
 (0)