-
-
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.
- Loading branch information
1 parent
32965bc
commit 1814c15
Showing
59 changed files
with
2,514 additions
and
6 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
1 change: 0 additions & 1 deletion
1
java-api/src/java14/java/xyz/wagyourtail/jvmdg/j14/stub/java_base/J_I_PrintStream.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
21 changes: 21 additions & 0 deletions
21
java-api/src/java18/java/xyz/wagyourtail/jvmdg/j18/stub/java_base/J_I_PrintStream.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,21 @@ | ||
package xyz.wagyourtail.jvmdg.j18.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
import java.io.OutputStreamWriter; | ||
import java.io.PrintStream; | ||
import java.lang.reflect.Field; | ||
import java.nio.charset.Charset; | ||
|
||
public class J_I_PrintStream { | ||
|
||
@Stub | ||
public static Charset charset(PrintStream printStream) throws NoSuchFieldException, IllegalAccessException { | ||
Field charOut = printStream.getClass().getField("charOut"); | ||
charOut.setAccessible(true); | ||
OutputStreamWriter writer = (OutputStreamWriter) charOut.get(printStream); | ||
String encoding = writer.getEncoding(); | ||
return Charset.forName(encoding); | ||
} | ||
|
||
} |
129 changes: 129 additions & 0 deletions
129
java-api/src/java18/java/xyz/wagyourtail/jvmdg/j18/stub/java_base/J_L_Math.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,129 @@ | ||
package xyz.wagyourtail.jvmdg.j18.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Ref; | ||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
public class J_L_Math { | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static long floorDivExact(long x, long y) { | ||
final long q = x / y; | ||
if ((x & y & q) >= 0) { | ||
if ((x ^ y) < 0 && (q * y != x)) { | ||
return q - 1; | ||
} | ||
return q; | ||
} | ||
throw new ArithmeticException("long overflow"); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static int ceilDivExact(int x, int y) { | ||
final int q = x / y; | ||
if ((x & y & q) >= 0) { | ||
if ((x ^ y) >= 0 && (q * y != x)) { | ||
return q + 1; | ||
} | ||
return q; | ||
} | ||
throw new ArithmeticException("integer overflow"); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static int ceilDiv(int x, int y) { | ||
final int q = x / y; | ||
if ((x ^ y) >= 0 && (q * y != x)) { | ||
return q + 1; | ||
} | ||
return q; | ||
} | ||
|
||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static long divideExact(long x, long y) { | ||
long q = x / y; | ||
if ((x & y & q) >= 0) { | ||
return q; | ||
} | ||
throw new ArithmeticException("long overflow"); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static long ceilDiv(long x, long y) { | ||
final long q = x / y; | ||
if ((x ^ y) >= 0 && (q * y != x)) { | ||
return q + 1; | ||
} | ||
return q; | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static long unsignedMultiplyHigh(long x, long y) { | ||
long result = Math.multiplyHigh(x, y); | ||
result += (y & (x >> 63)); | ||
result += (x & (y >> 63)); | ||
return result; | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static long ceilMod(long x, long y) { | ||
final long r = x % y; | ||
if ((x ^ y) >= 0 && r != 0) { | ||
return r - y; | ||
} | ||
return r; | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static int ceilMod(long x, int y) { | ||
return (int) ceilMod(x, (long) y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static int floorDivExact(int x, int y) { | ||
final int q = x / y; | ||
if ((x & y & q) >= 0) { | ||
if ((x ^ y) < 0 && (q * y != x)) { | ||
return q - 1; | ||
} | ||
return q; | ||
} | ||
throw new ArithmeticException("integer overflow"); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static long ceilDivExact(long x, long y) { | ||
final long q = x / y; | ||
if ((x & y & q) >= 0) { | ||
if ((x ^ y) >= 0 && (q * y != x)) { | ||
return q + 1; | ||
} | ||
return q; | ||
} | ||
throw new ArithmeticException("long overflow"); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static int divideExact(int x, int y) { | ||
int q = x / y; | ||
if ((x & y & q) >= 0) { | ||
return q; | ||
} | ||
throw new ArithmeticException("integer overflow"); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static long ceilDiv(long x, int y) { | ||
return ceilDiv(x, (long) y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/Math;")) | ||
public static int ceilMod(int x, int y) { | ||
final int r = x % y; | ||
if ((x ^ y) >= 0 && r != 0) { | ||
return r - y; | ||
} | ||
return r; | ||
} | ||
|
||
} |
73 changes: 73 additions & 0 deletions
73
java-api/src/java18/java/xyz/wagyourtail/jvmdg/j18/stub/java_base/J_L_StrictMath.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,73 @@ | ||
package xyz.wagyourtail.jvmdg.j18.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Ref; | ||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
public class J_L_StrictMath { | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static long ceilDiv(long x, long y) { | ||
return J_L_Math.ceilDiv(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static long ceilDivExact(long x, long y) { | ||
return J_L_Math.ceilDivExact(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static long floorDivExact(long x, long y) { | ||
return J_L_Math.floorDivExact(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static long divideExact(long x, long y) { | ||
return J_L_Math.divideExact(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static int ceilMod(long x, int y) { | ||
return J_L_Math.ceilMod(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static long ceilMod(long x, long y) { | ||
return J_L_Math.ceilMod(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static long unsignedMultiplyHigh(long x, long y) { | ||
return J_L_Math.unsignedMultiplyHigh(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static int ceilDiv(int x, int y) { | ||
return J_L_Math.ceilDiv(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static int floorDivExact(int x, int y) { | ||
return J_L_Math.ceilDivExact(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static long ceilDiv(long x, int y) { | ||
return J_L_Math.ceilDiv(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static int ceilMod(int x, int y) { | ||
return J_L_Math.ceilMod(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static int ceilDivExact(int x, int y) { | ||
return J_L_Math.ceilDivExact(x, y); | ||
} | ||
|
||
@Stub(ref = @Ref("Ljava/lang/StrictMath;")) | ||
public static int divideExact(int x, int y) { | ||
return J_L_Math.divideExact(x, y); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
java-api/src/java18/java/xyz/wagyourtail/jvmdg/j18/stub/java_base/J_N_C_Charset.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,20 @@ | ||
package xyz.wagyourtail.jvmdg.j18.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Ref; | ||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
import java.nio.charset.Charset; | ||
import java.nio.charset.UnsupportedCharsetException; | ||
|
||
public class J_N_C_Charset { | ||
|
||
@Stub(ref = @Ref("Ljava/nio/charset/Charset;")) | ||
public static Charset forName(String name, Charset defaultCharset) { | ||
try { | ||
return Charset.forName(name); | ||
} catch (UnsupportedCharsetException e) { | ||
return defaultCharset; | ||
} | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
java-api/src/java18/java/xyz/wagyourtail/jvmdg/j18/stub/java_base/J_T_Duration.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,14 @@ | ||
package xyz.wagyourtail.jvmdg.j18.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
import java.time.Duration; | ||
|
||
public class J_T_Duration { | ||
|
||
@Stub | ||
public static boolean isPositive(Duration duration) { | ||
return !duration.isNegative() && !duration.isZero(); | ||
} | ||
|
||
} |
Oops, something went wrong.