4239752: FileSystem should be a platform-specific class to avoid native code
authordxu
Fri, 26 Oct 2012 11:21:02 +0100
changeset 14324 3510b4bf90ee
parent 14323 5acca3d1f124
child 14325 622c473a21aa
4239752: FileSystem should be a platform-specific class to avoid native code Reviewed-by: alanb, dholmes, erikj, jgish
jdk/make/java/java/Exportedfiles.gmk
jdk/make/java/java/FILES_c.gmk
jdk/make/java/java/FILES_java.gmk
jdk/make/java/java/mapfile-vers
jdk/makefiles/CompileJavaClasses.gmk
jdk/makefiles/mapfiles/libjava/mapfile-vers
jdk/src/share/classes/java/io/File.java
jdk/src/share/classes/java/io/FileSystem.java
jdk/src/solaris/classes/java/io/DefaultFileSystem.java
jdk/src/solaris/native/java/io/FileSystem_md.c
jdk/src/windows/classes/java/io/DefaultFileSystem.java
jdk/src/windows/native/java/io/FileSystem_md.c
--- a/jdk/make/java/java/Exportedfiles.gmk	Thu Oct 25 17:34:24 2012 -0700
+++ b/jdk/make/java/java/Exportedfiles.gmk	Fri Oct 26 11:21:02 2012 +0100
@@ -1,5 +1,5 @@
 #
-# 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.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,7 @@
     java/util/prefs/FileSystemPreferences.java \
     java/io/Console.java \
     java/io/FileDescriptor.java \
+    java/io/DefaultFileSystem.java \
     java/io/InputStream.java \
     java/io/FileInputStream.java \
     java/io/FileOutputStream.java \
@@ -142,6 +143,7 @@
     java/io/Console.java \
     java/io/FileSystem.java \
     java/io/FileDescriptor.java \
+    java/io/DefaultFileSystem.java \
     java/io/InputStream.java \
     java/io/FileInputStream.java \
     java/io/FileOutputStream.java \
--- a/jdk/make/java/java/FILES_c.gmk	Thu Oct 25 17:34:24 2012 -0700
+++ b/jdk/make/java/java/FILES_c.gmk	Fri Oct 26 11:21:02 2012 +0100
@@ -1,5 +1,5 @@
 #
-# 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.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@
 	Compiler.c \
 	Console_md.c \
 	Double.c \
-	FileSystem_md.c \
 	FileDescriptor_md.c \
 	FileInputStream.c \
 	FileInputStream_md.c \
--- a/jdk/make/java/java/FILES_java.gmk	Thu Oct 25 17:34:24 2012 -0700
+++ b/jdk/make/java/java/FILES_java.gmk	Fri Oct 26 11:21:02 2012 +0100
@@ -1,5 +1,5 @@
 #
-# 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.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -438,6 +438,7 @@
     java/io/File.java \
     java/io/FileSystem.java \
     java/io/FileDescriptor.java \
+    java/io/DefaultFileSystem.java \
     java/io/FilenameFilter.java \
     java/io/FileFilter.java \
     java/io/FilePermission.java \
--- a/jdk/make/java/java/mapfile-vers	Thu Oct 25 17:34:24 2012 -0700
+++ b/jdk/make/java/java/mapfile-vers	Fri Oct 26 11:21:02 2012 +0100
@@ -1,5 +1,5 @@
 #
-# 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.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,6 @@
 		Java_java_io_FileOutputStream_open;
 		Java_java_io_FileOutputStream_write;
 		Java_java_io_FileOutputStream_writeBytes;
-		Java_java_io_FileSystem_getFileSystem;
 		Java_java_io_ObjectInputStream_bytesToDoubles;
 		Java_java_io_ObjectInputStream_bytesToFloats;
 		Java_java_io_ObjectOutputStream_doublesToBytes;
--- a/jdk/makefiles/CompileJavaClasses.gmk	Thu Oct 25 17:34:24 2012 -0700
+++ b/jdk/makefiles/CompileJavaClasses.gmk	Fri Oct 26 11:21:02 2012 +0100
@@ -312,7 +312,8 @@
 JDK_BASE_HEADER_CLASSES:=java.lang.Integer \
 			 java.lang.Long \
 			 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,\
 				$(subst .,/,$(JDK_BASE_HEADER_CLASSES)))
--- a/jdk/makefiles/mapfiles/libjava/mapfile-vers	Thu Oct 25 17:34:24 2012 -0700
+++ b/jdk/makefiles/mapfiles/libjava/mapfile-vers	Fri Oct 26 11:21:02 2012 +0100
@@ -1,5 +1,5 @@
 #
-# 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.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,6 @@
 		Java_java_io_FileOutputStream_open;
 		Java_java_io_FileOutputStream_write;
 		Java_java_io_FileOutputStream_writeBytes;
-		Java_java_io_FileSystem_getFileSystem;
 		Java_java_io_ObjectInputStream_bytesToDoubles;
 		Java_java_io_ObjectInputStream_bytesToFloats;
 		Java_java_io_ObjectOutputStream_doublesToBytes;
--- a/jdk/src/share/classes/java/io/File.java	Thu Oct 25 17:34:24 2012 -0700
+++ b/jdk/src/share/classes/java/io/File.java	Fri Oct 26 11:21:02 2012 +0100
@@ -153,7 +153,7 @@
     /**
      * 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
--- a/jdk/src/share/classes/java/io/FileSystem.java	Thu Oct 25 17:34:24 2012 -0700
+++ b/jdk/src/share/classes/java/io/FileSystem.java	Fri Oct 26 11:21:02 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * 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.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,13 +32,6 @@
 
 abstract class FileSystem {
 
-    /**
-     * Return the FileSystem object representing this platform's local
-     * filesystem.
-     */
-    public static native FileSystem getFileSystem();
-
-
     /* -- Normalization and construction -- */
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/classes/java/io/DefaultFileSystem.java	Fri Oct 26 11:21:02 2012 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.io;
+
+/**
+ *
+ * @since 1.8
+ */
+class DefaultFileSystem {
+
+    /**
+     * Return the FileSystem object for Unix-based platform.
+     */
+    public static FileSystem getFileSystem() {
+        return new UnixFileSystem();
+    }
+}
--- a/jdk/src/solaris/native/java/io/FileSystem_md.c	Thu Oct 25 17:34:24 2012 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "jni.h"
-#include "jni_util.h"
-#include "java_io_FileSystem.h"
-
-
-JNIEXPORT jobject JNICALL
-Java_java_io_FileSystem_getFileSystem(JNIEnv *env, jclass ignored)
-{
-    return JNU_NewObjectByName(env, "java/io/UnixFileSystem", "()V");
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/windows/classes/java/io/DefaultFileSystem.java	Fri Oct 26 11:21:02 2012 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.io;
+
+/**
+ *
+ * @since 1.8
+ */
+class DefaultFileSystem {
+
+    /**
+     * Return the FileSystem object for Windows platform.
+     */
+    public static FileSystem getFileSystem() {
+        return new WinNTFileSystem();
+    }
+}
--- a/jdk/src/windows/native/java/io/FileSystem_md.c	Thu Oct 25 17:34:24 2012 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <windows.h>
-#include "jni.h"
-#include "jni_util.h"
-
-JNIEXPORT jobject JNICALL
-Java_java_io_FileSystem_getFileSystem(JNIEnv *env, jclass ignored)
-{
-    return JNU_NewObjectByName(env, "java/io/WinNTFileSystem", "()V");
-}