-
-
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
7b70270
commit aaffd1d
Showing
4 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
java-api/src/java22/java/xyz/wagyourtail/jvmdg/j22/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,28 @@ | ||
package xyz.wagyourtail.jvmdg.j22.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.util.Utils; | ||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
import java.io.Console; | ||
import java.lang.invoke.MethodHandle; | ||
import java.lang.invoke.MethodHandles; | ||
import java.lang.invoke.MethodType; | ||
|
||
public class J_I_Console { | ||
private static final MethodHandles.Lookup IMPL_LOOKUP = Utils.getImplLookup(); | ||
private static final MethodHandle ISTTY; | ||
|
||
static { | ||
try { | ||
ISTTY = IMPL_LOOKUP.findStatic(Console.class, "istty", MethodType.methodType(boolean.class)); | ||
} catch (NoSuchMethodException | IllegalAccessException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@Stub | ||
public static boolean isTerminal(Console console) throws Throwable { | ||
return console.getClass().equals(Console.class) && (boolean) ISTTY.invokeExact(); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
java-api/src/java22/java/xyz/wagyourtail/jvmdg/j22/stub/java_base/J_L_Class.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.j22.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Ref; | ||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
public class J_L_Class { | ||
|
||
@Stub(ref = @Ref("java/lang/Class")) | ||
public static Class<?> forPrimitiveName(String name) { | ||
return switch (name) { | ||
case "boolean" -> boolean.class; | ||
case "byte" -> byte.class; | ||
case "char" -> char.class; | ||
case "short" -> short.class; | ||
case "int" -> int.class; | ||
case "long" -> long.class; | ||
case "float" -> float.class; | ||
case "double" -> double.class; | ||
default -> throw new IllegalArgumentException("Unknown primitive type: " + name); | ||
}; | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
java-api/src/java22/java/xyz/wagyourtail/jvmdg/j22/stub/java_base/J_N_F_Path.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,27 @@ | ||
package xyz.wagyourtail.jvmdg.j22.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
import java.nio.file.Path; | ||
|
||
public class J_N_F_Path { | ||
|
||
@Stub | ||
public static Path resolve(Path self, String first, String... more) { | ||
Path result = self.resolve(first); | ||
for (String path : more) { | ||
result = result.resolve(path); | ||
} | ||
return result; | ||
} | ||
|
||
@Stub | ||
public static Path resolve(Path self, Path first, Path... more) { | ||
Path result = self.resolve(first); | ||
for (Path path : more) { | ||
result = result.resolve(path); | ||
} | ||
return result; | ||
} | ||
|
||
} |
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