@@ -295,6 +295,60 @@ private void writeMockJavaClasses(Path sourceDir) throws Exception {
295295 // java.io.Serializable
296296 Files .write (io .resolve ("Serializable.java" ), "package java.io; public interface Serializable {}" .getBytes (StandardCharsets .UTF_8 ));
297297
298+ // Minimal java.io.File to satisfy translator native headers
299+ Files .write (io .resolve ("File.java" ), ("package java.io;\n " +
300+ "public class File {\n " +
301+ " public static final String separator = \" /\" ;\n " +
302+ " public static final char separatorChar = '/';\n " +
303+ " public static final String pathSeparator = \" :\" ;\n " +
304+ " public static final char pathSeparatorChar = ':';\n " +
305+ " private String path;\n " +
306+ " public File(String pathname) { this.path = pathname == null ? \" \" : pathname; }\n " +
307+ " public File(File parent, String child) { this(parent == null ? child : parent.getPath() + separator + child); }\n " +
308+ " public File(String parent, String child) { this(parent == null ? child : parent + separator + child); }\n " +
309+ " public String getPath() { return path; }\n " +
310+ " public boolean exists() { return existsImpl(path); }\n " +
311+ " public boolean isDirectory() { return isDirectoryImpl(path); }\n " +
312+ " public boolean isFile() { return isFileImpl(path); }\n " +
313+ " public boolean isHidden() { return isHiddenImpl(path); }\n " +
314+ " public long lastModified() { return lastModifiedImpl(path); }\n " +
315+ " public long length() { return lengthImpl(path); }\n " +
316+ " public boolean createNewFile() { return createNewFileImpl(path); }\n " +
317+ " public boolean delete() { return deleteImpl(path); }\n " +
318+ " public String[] list() { return listImpl(path); }\n " +
319+ " public boolean mkdir() { return mkdirImpl(path); }\n " +
320+ " public boolean renameTo(File dest) { return renameToImpl(path, dest == null ? null : dest.getPath()); }\n " +
321+ " public boolean setReadOnly() { return setReadOnlyImpl(path); }\n " +
322+ " public boolean setWritable(boolean writable) { return setWritableImpl(path, writable); }\n " +
323+ " public boolean setReadable(boolean readable) { return setReadableImpl(path, readable); }\n " +
324+ " public boolean setExecutable(boolean executable) { return setExecutableImpl(path, executable); }\n " +
325+ " public long getTotalSpace() { return getTotalSpaceImpl(path); }\n " +
326+ " public long getFreeSpace() { return getFreeSpaceImpl(path); }\n " +
327+ " public long getUsableSpace() { return getUsableSpaceImpl(path); }\n " +
328+ " public String getAbsolutePath() { return getAbsolutePathImpl(path); }\n " +
329+ " public String getCanonicalPath() { return getCanonicalPathImpl(path); }\n " +
330+ " private native String getAbsolutePathImpl(String path);\n " +
331+ " private native String getCanonicalPathImpl(String path);\n " +
332+ " private native boolean existsImpl(String path);\n " +
333+ " private native boolean isDirectoryImpl(String path);\n " +
334+ " private native boolean isFileImpl(String path);\n " +
335+ " private native boolean isHiddenImpl(String path);\n " +
336+ " private native long lastModifiedImpl(String path);\n " +
337+ " private native long lengthImpl(String path);\n " +
338+ " private native boolean createNewFileImpl(String path);\n " +
339+ " private native boolean deleteImpl(String path);\n " +
340+ " private native String[] listImpl(String path);\n " +
341+ " private native boolean mkdirImpl(String path);\n " +
342+ " private native boolean renameToImpl(String source, String dest);\n " +
343+ " private native boolean setReadOnlyImpl(String path);\n " +
344+ " private native boolean setWritableImpl(String path, boolean writable);\n " +
345+ " private native boolean setReadableImpl(String path, boolean readable);\n " +
346+ " private native boolean setExecutableImpl(String path, boolean executable);\n " +
347+ " private native long getTotalSpaceImpl(String path);\n " +
348+ " private native long getFreeSpaceImpl(String path);\n " +
349+ " private native long getUsableSpaceImpl(String path);\n " +
350+ "}\n " ).getBytes (StandardCharsets .UTF_8 ));
351+
298352 // java.util.Collection
299353 Files .write (util .resolve ("Collection.java" ), "package java.util; public interface Collection<E> {}" .getBytes (StandardCharsets .UTF_8 ));
300354
0 commit comments