-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
java 23 support, and fix java 7 break on linux
- Loading branch information
1 parent
caf6d12
commit d526d54
Showing
11 changed files
with
216 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
java-api/src/java23/java/xyz/wagyourtail/jvmdg/j23/stub/java_base/J_I_Console.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package xyz.wagyourtail.jvmdg.j23.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
import java.io.Console; | ||
import java.io.PrintWriter; | ||
import java.util.Locale; | ||
|
||
public class J_I_Console { | ||
|
||
@Stub | ||
public Console format(Console console, Locale locale, String format, Object... args) { | ||
PrintWriter pw = console.writer(); | ||
pw.format(locale, format, args); | ||
pw.flush(); | ||
return console; | ||
} | ||
|
||
@Stub | ||
public Console printf(Console console, Locale locale, String format, Object... args) { | ||
PrintWriter pw = console.writer(); | ||
pw.printf(locale, format, args); | ||
pw.flush(); | ||
return console; | ||
} | ||
|
||
@Stub | ||
public String readLine(Console console, Locale locale, String format, Object... args) { | ||
PrintWriter pw = console.writer(); | ||
pw.printf(locale, format, args); | ||
pw.flush(); | ||
return console.readLine(); | ||
} | ||
|
||
@Stub | ||
public char[] readPassword(Console console, Locale locale, String format, Object... args) { | ||
PrintWriter pw = console.writer(); | ||
pw.printf(locale, format, args); | ||
pw.flush(); | ||
return console.readPassword(); | ||
} | ||
|
||
} |
121 changes: 121 additions & 0 deletions
121
...c/java23/java/xyz/wagyourtail/jvmdg/j23/stub/java_base/J_L_R_ExactConversionsSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
package xyz.wagyourtail.jvmdg.j23.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Ref; | ||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
public class J_L_R_ExactConversionsSupport { | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isDoubleToByteExact(double value) { | ||
return value == (byte) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isDoubleToCharExact(double value) { | ||
return value == (char) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isDoubleToFloatExact(double value) { | ||
return value == (float) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isDoubleToIntExact(double value) { | ||
return value == (int) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isDoubleToLongExact(double value) { | ||
return value == (long) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isDoubleToShortExact(double value) { | ||
return value == (short) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isFloatToByteExact(float value) { | ||
return value == (byte) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isFloatToCharExact(float value) { | ||
return value == (char) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isFloatToIntExact(float value) { | ||
return value == (int) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isFloatToLongExact(float value) { | ||
return value == (long) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isFloatToShortExact(float value) { | ||
return value == (short) value && isNotNegativeZero(value); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isIntToByteExact(int value) { | ||
return value == (byte) value; | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isIntToCharExact(int value) { | ||
return value == (char) value; | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isIntToFloatExact(int value) { | ||
return value == (float) value; | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isIntToShortExact(int value) { | ||
return value == (short) value; | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isLongToByteExact(long value) { | ||
return value == (byte) value; | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isLongToCharExact(long value) { | ||
return value == (char) value; | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isLongToDoubleExact(long value) { | ||
return value == (double) value; | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isLongToFloatExact(long value) { | ||
return value == (float) value; | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isLongToIntExact(long value) { | ||
return value == (int) value; | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/runtime/ExactConversionsSupport")) | ||
public static boolean isLongToShortExact(long value) { | ||
return value == (short) value; | ||
} | ||
|
||
private static boolean isNotNegativeZero(float value) { | ||
return Float.floatToRawIntBits(value) != Integer.MIN_VALUE; | ||
} | ||
|
||
private static boolean isNotNegativeZero(double value) { | ||
return Double.doubleToRawLongBits(value) != Long.MIN_VALUE; | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
java-api/src/java23/java/xyz/wagyourtail/jvmdg/j23/stub/java_base/J_T_Instant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package xyz.wagyourtail.jvmdg.j23.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
import java.time.Duration; | ||
import java.time.Instant; | ||
|
||
public class J_T_Instant { | ||
|
||
@Stub | ||
public static Duration until(Instant instant, Instant endExclusive) { | ||
return Duration.between(instant, endExclusive); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
java-api/src/main/java/xyz/wagyourtail/jvmdg/providers/Java23Downgrader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package xyz.wagyourtail.jvmdg.providers; | ||
|
||
import org.objectweb.asm.Opcodes; | ||
import xyz.wagyourtail.jvmdg.j23.stub.java_base.J_I_Console; | ||
import xyz.wagyourtail.jvmdg.j23.stub.java_base.J_L_R_ExactConversionsSupport; | ||
import xyz.wagyourtail.jvmdg.j23.stub.java_base.J_T_Instant; | ||
import xyz.wagyourtail.jvmdg.version.VersionProvider; | ||
|
||
public class Java23Downgrader extends VersionProvider { | ||
|
||
public Java23Downgrader() { | ||
super(Opcodes.V23, Opcodes.V22); | ||
} | ||
|
||
@Override | ||
public void init() { | ||
// -- java.base -- | ||
stub(J_I_Console.class); | ||
stub(J_L_R_ExactConversionsSupport.class); | ||
stub(J_T_Instant.class); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters