Skip to content

Commit 3afda64

Browse files
Implement java.io.File in JavaAPI with native support for ParparVM
- Added full implementation of `java.io.File` in `vm/JavaAPI` delegating to native methods. - Added native implementation in `vm/ByteCodeTranslator/src/java_io_File.m` supporting both iOS (`NSFileManager`) and Linux/POSIX. - Updated `ByteCodeTranslator` to package the new native source file. - Patched `vm/ByteCodeTranslator/src/nativeMethods.m` and `cn1_globals.m` to support compilation on Linux (added guards and stubs). - Added `vm/tests/src/test/java/com/codename1/tools/translator/FileClassIntegrationTest.java` to verify the implementation. - Fixed string concatenation issues in `vm/JavaAPI` exception constructors to resolve C compilation errors. - Added `vm/JavaAPI/src/java/util/Objects.java` to resolve missing dependency during integration tests. - Removed conflicting `java.util.Objects` stub generation from `LambdaIntegrationTest`.
1 parent aae07b0 commit 3afda64

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

vm/tests/src/test/java/com/codename1/tools/translator/LambdaIntegrationTest.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ private void compileJavaAPI(Path outputDir) throws Exception {
154154
// Add stubs for java.lang.invoke
155155
Path stubsDir = Files.createTempDirectory("java-lang-invoke-stubs");
156156
sources.addAll(generateJavaLangInvokeStubs(stubsDir));
157-
sources.addAll(generateJavaUtilStubs(stubsDir));
158157

159158
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
160159
List<String> args = new ArrayList<>();
@@ -177,22 +176,6 @@ private void compileJavaAPI(Path outputDir) throws Exception {
177176
assertEquals(0, result, "JavaAPI should compile");
178177
}
179178

180-
private List<String> generateJavaUtilStubs(Path stubsDir) throws IOException {
181-
List<String> stubFiles = new ArrayList<>();
182-
Path utilPkg = stubsDir.resolve("java/util");
183-
Files.createDirectories(utilPkg);
184-
185-
// Objects
186-
Path objs = utilPkg.resolve("Objects.java");
187-
Files.write(objs, ("package java.util;\n" +
188-
"public class Objects {\n" +
189-
" public static <T> T requireNonNull(T obj) { if (obj == null) throw new NullPointerException(); return obj; }\n" +
190-
"}").getBytes(StandardCharsets.UTF_8));
191-
stubFiles.add(objs.toString());
192-
193-
return stubFiles;
194-
}
195-
196179
private List<String> generateJavaLangInvokeStubs(Path stubsDir) throws IOException {
197180
List<String> stubFiles = new ArrayList<>();
198181
Path invokePkg = stubsDir.resolve("java/lang/invoke");

0 commit comments

Comments
 (0)