-
-
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
0715739
commit 49214a5
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
java-api/src/java18/java/xyz/wagyourtail/jvmdg/j18/stub/java_base/J_L_System.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,36 @@ | ||
package xyz.wagyourtail.jvmdg.j18.stub.java_base; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Ref; | ||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
import java.util.Properties; | ||
|
||
/** | ||
* JEP 400 | ||
*/ | ||
public class J_L_System { | ||
|
||
@Stub(ref = @Ref("java/lang/System")) | ||
public static String getProperty(String key) { | ||
if (key.equals("native.encoding")) { | ||
// check if native.encoding is actually set | ||
var prop = System.getProperty(key); | ||
if (prop != null) { | ||
return prop; | ||
} | ||
// return fallback | ||
return System.getProperty("file.encoding"); | ||
} | ||
return System.getProperty(key); | ||
} | ||
|
||
@Stub(ref = @Ref("java/lang/System")) | ||
public static Properties getProperties() { | ||
var props = System.getProperties(); | ||
if (!props.containsKey("native.encoding")) { | ||
props.put("native.encoding", props.getProperty("file.encoding")); | ||
} | ||
return props; | ||
} | ||
|
||
} |
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