提交 30881c22 编写于 作者: D dxu

4239752: FileSystem should be a platform-specific class to avoid native code

Reviewed-by: alanb, dholmes, erikj, jgish
上级 e8b256a6
# #
# Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -66,6 +66,7 @@ FILES_export = \ ...@@ -66,6 +66,7 @@ FILES_export = \
java/util/prefs/FileSystemPreferences.java \ java/util/prefs/FileSystemPreferences.java \
java/io/Console.java \ java/io/Console.java \
java/io/FileDescriptor.java \ java/io/FileDescriptor.java \
java/io/DefaultFileSystem.java \
java/io/InputStream.java \ java/io/InputStream.java \
java/io/FileInputStream.java \ java/io/FileInputStream.java \
java/io/FileOutputStream.java \ java/io/FileOutputStream.java \
...@@ -142,6 +143,7 @@ FILES_export = \ ...@@ -142,6 +143,7 @@ FILES_export = \
java/io/Console.java \ java/io/Console.java \
java/io/FileSystem.java \ java/io/FileSystem.java \
java/io/FileDescriptor.java \ java/io/FileDescriptor.java \
java/io/DefaultFileSystem.java \
java/io/InputStream.java \ java/io/InputStream.java \
java/io/FileInputStream.java \ java/io/FileInputStream.java \
java/io/FileOutputStream.java \ java/io/FileOutputStream.java \
......
# #
# Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -32,7 +32,6 @@ FILES_c = \ ...@@ -32,7 +32,6 @@ FILES_c = \
Compiler.c \ Compiler.c \
Console_md.c \ Console_md.c \
Double.c \ Double.c \
FileSystem_md.c \
FileDescriptor_md.c \ FileDescriptor_md.c \
FileInputStream.c \ FileInputStream.c \
FileInputStream_md.c \ FileInputStream_md.c \
......
# #
# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -438,6 +438,7 @@ JAVA_JAVA_java = \ ...@@ -438,6 +438,7 @@ JAVA_JAVA_java = \
java/io/File.java \ java/io/File.java \
java/io/FileSystem.java \ java/io/FileSystem.java \
java/io/FileDescriptor.java \ java/io/FileDescriptor.java \
java/io/DefaultFileSystem.java \
java/io/FilenameFilter.java \ java/io/FilenameFilter.java \
java/io/FileFilter.java \ java/io/FileFilter.java \
java/io/FilePermission.java \ java/io/FilePermission.java \
......
# #
# Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -87,7 +87,6 @@ SUNWprivate_1.1 { ...@@ -87,7 +87,6 @@ SUNWprivate_1.1 {
Java_java_io_FileOutputStream_open; Java_java_io_FileOutputStream_open;
Java_java_io_FileOutputStream_write; Java_java_io_FileOutputStream_write;
Java_java_io_FileOutputStream_writeBytes; Java_java_io_FileOutputStream_writeBytes;
Java_java_io_FileSystem_getFileSystem;
Java_java_io_ObjectInputStream_bytesToDoubles; Java_java_io_ObjectInputStream_bytesToDoubles;
Java_java_io_ObjectInputStream_bytesToFloats; Java_java_io_ObjectInputStream_bytesToFloats;
Java_java_io_ObjectOutputStream_doublesToBytes; Java_java_io_ObjectOutputStream_doublesToBytes;
......
...@@ -312,7 +312,8 @@ $(eval $(call SetupJavaCompilation,BUILD_JDK,\ ...@@ -312,7 +312,8 @@ $(eval $(call SetupJavaCompilation,BUILD_JDK,\
JDK_BASE_HEADER_CLASSES:=java.lang.Integer \ JDK_BASE_HEADER_CLASSES:=java.lang.Integer \
java.lang.Long \ java.lang.Long \
java.net.SocketOptions \ java.net.SocketOptions \
sun.nio.ch.IOStatus sun.nio.ch.IOStatus \
java.io.FileSystem
JDK_BASE_HEADER_JAVA_FILES:=$(patsubst %,$(JDK_TOPDIR)/src/share/classes/%.java,\ JDK_BASE_HEADER_JAVA_FILES:=$(patsubst %,$(JDK_TOPDIR)/src/share/classes/%.java,\
$(subst .,/,$(JDK_BASE_HEADER_CLASSES))) $(subst .,/,$(JDK_BASE_HEADER_CLASSES)))
......
# #
# Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -87,7 +87,6 @@ SUNWprivate_1.1 { ...@@ -87,7 +87,6 @@ SUNWprivate_1.1 {
Java_java_io_FileOutputStream_open; Java_java_io_FileOutputStream_open;
Java_java_io_FileOutputStream_write; Java_java_io_FileOutputStream_write;
Java_java_io_FileOutputStream_writeBytes; Java_java_io_FileOutputStream_writeBytes;
Java_java_io_FileSystem_getFileSystem;
Java_java_io_ObjectInputStream_bytesToDoubles; Java_java_io_ObjectInputStream_bytesToDoubles;
Java_java_io_ObjectInputStream_bytesToFloats; Java_java_io_ObjectInputStream_bytesToFloats;
Java_java_io_ObjectOutputStream_doublesToBytes; Java_java_io_ObjectOutputStream_doublesToBytes;
......
...@@ -153,7 +153,7 @@ public class File ...@@ -153,7 +153,7 @@ public class File
/** /**
* The FileSystem object representing the platform's local file system. * The FileSystem object representing the platform's local file system.
*/ */
private static final FileSystem fs = FileSystem.getFileSystem(); private static final FileSystem fs = DefaultFileSystem.getFileSystem();
/** /**
* This abstract pathname's normalized pathname string. A normalized * This abstract pathname's normalized pathname string. A normalized
......
/* /*
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -32,13 +32,6 @@ package java.io; ...@@ -32,13 +32,6 @@ package java.io;
abstract class FileSystem { abstract class FileSystem {
/**
* Return the FileSystem object representing this platform's local
* filesystem.
*/
public static native FileSystem getFileSystem();
/* -- Normalization and construction -- */ /* -- Normalization and construction -- */
/** /**
......
/* /*
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,13 +23,18 @@ ...@@ -23,13 +23,18 @@
* questions. * questions.
*/ */
#include "jni.h" package java.io;
#include "jni_util.h"
#include "java_io_FileSystem.h"
/**
*
* @since 1.8
*/
class DefaultFileSystem {
JNIEXPORT jobject JNICALL /**
Java_java_io_FileSystem_getFileSystem(JNIEnv *env, jclass ignored) * Return the FileSystem object for Unix-based platform.
{ */
return JNU_NewObjectByName(env, "java/io/UnixFileSystem", "()V"); public static FileSystem getFileSystem() {
return new UnixFileSystem();
}
} }
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,12 +23,18 @@ ...@@ -23,12 +23,18 @@
* questions. * questions.
*/ */
#include <windows.h> package java.io;
#include "jni.h"
#include "jni_util.h"
JNIEXPORT jobject JNICALL /**
Java_java_io_FileSystem_getFileSystem(JNIEnv *env, jclass ignored) *
{ * @since 1.8
return JNU_NewObjectByName(env, "java/io/WinNTFileSystem", "()V"); */
class DefaultFileSystem {
/**
* Return the FileSystem object for Windows platform.
*/
public static FileSystem getFileSystem() {
return new WinNTFileSystem();
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册