From 5b01aed29a9f2ebb0cc4a62e184be195ec6785fa Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 10 Apr 2024 21:13:03 +0200 Subject: [PATCH] Added Java 22 version downgrader --- README.md | 2 +- .../javadowngrader/JavaDowngrader.java | 2 ++ .../transformer/j21/Java22ToJava21.java | 29 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/raphimc/javadowngrader/transformer/j21/Java22ToJava21.java diff --git a/README.md b/README.md index bf8bace..7e06bdf 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ To use JavaDowngrader as a library in your application, check out the [Usage (As If you just want to downgrade .jar files you can check out the [Usage (Standalone)](#usage-standalonebootstrap) section. ## Features -- Supports up to Java 21 and down to Java 8 +- Supports up to Java 22 and down to Java 8 - Downgrades language features - Downgrades important Java API calls - Can be applied during runtime diff --git a/src/main/java/net/raphimc/javadowngrader/JavaDowngrader.java b/src/main/java/net/raphimc/javadowngrader/JavaDowngrader.java index 7c752ed..f42ca79 100644 --- a/src/main/java/net/raphimc/javadowngrader/JavaDowngrader.java +++ b/src/main/java/net/raphimc/javadowngrader/JavaDowngrader.java @@ -30,6 +30,7 @@ import net.raphimc.javadowngrader.transformer.j18.Java19ToJava18; import net.raphimc.javadowngrader.transformer.j19.Java20ToJava19; import net.raphimc.javadowngrader.transformer.j20.Java21ToJava20; +import net.raphimc.javadowngrader.transformer.j21.Java22ToJava21; import net.raphimc.javadowngrader.transformer.j8.Java9ToJava8; import net.raphimc.javadowngrader.transformer.j9.Java10ToJava9; import org.objectweb.asm.tree.ClassNode; @@ -42,6 +43,7 @@ public class JavaDowngrader { private static final List TRANSFORMER = new ArrayList<>(); static { + TRANSFORMER.add(new Java22ToJava21()); TRANSFORMER.add(new Java21ToJava20()); TRANSFORMER.add(new Java20ToJava19()); TRANSFORMER.add(new Java19ToJava18()); diff --git a/src/main/java/net/raphimc/javadowngrader/transformer/j21/Java22ToJava21.java b/src/main/java/net/raphimc/javadowngrader/transformer/j21/Java22ToJava21.java new file mode 100644 index 0000000..5d75d4d --- /dev/null +++ b/src/main/java/net/raphimc/javadowngrader/transformer/j21/Java22ToJava21.java @@ -0,0 +1,29 @@ +/* + * This file is part of JavaDowngrader - https://github.com/RaphiMC/JavaDowngrader + * Copyright (C) 2023-2024 RK_01/RaphiMC and contributors + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package net.raphimc.javadowngrader.transformer.j21; + +import net.raphimc.javadowngrader.transformer.DowngradingTransformer; +import org.objectweb.asm.Opcodes; + +public class Java22ToJava21 extends DowngradingTransformer { + + public Java22ToJava21() { + super(Opcodes.V22, Opcodes.V21); + } + +}