From d29dd1eaeed97d8d88728a57aecadcdda40310d6 Mon Sep 17 00:00:00 2001 From: erikj Date: Thu, 10 Jan 2013 12:23:15 +0100 Subject: [PATCH] 8005856: build-infra: Remove special handling of base module classes header generation Reviewed-by: alanb, tbell, ohair Contributed-by: fredrik.ohrstrom@oracle.com --- makefiles/CompileJavaClasses.gmk | 32 +------------------ src/share/classes/java/io/FileSystem.java | 21 ++++++------ src/share/classes/java/lang/Integer.java | 9 +++--- src/share/classes/java/lang/Long.java | 9 +++--- src/share/classes/java/net/SocketOptions.java | 30 +++++++++-------- src/share/classes/sun/nio/ch/IOStatus.java | 13 ++++---- .../classes/sun/nio/ch/PollArrayWrapper.java | 20 ++++++------ 7 files changed, 56 insertions(+), 78 deletions(-) diff --git a/makefiles/CompileJavaClasses.gmk b/makefiles/CompileJavaClasses.gmk index adf36ff64..abcbbfb9f 100644 --- a/makefiles/CompileJavaClasses.gmk +++ b/makefiles/CompileJavaClasses.gmk @@ -302,35 +302,6 @@ $(eval $(call SetupJavaCompilation,BUILD_JDK,\ COPY_FILES:=$(COPY_FILES),\ HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers)) -########################################################################################## -# Special handling of header file generation for classes in the jigsaw base module which -# currently can't add the annotaion GenerateNativeHeaders. For these specific classes the -# java file and the class have the same names which enables shortcutting the dependencies. - -JDK_BASE_HEADER_CLASSES:=java.lang.Integer \ - java.lang.Long \ - java.net.SocketOptions \ - sun.nio.ch.IOStatus \ - java.io.FileSystem - -JDK_BASE_HEADER_JAVA_FILES:=$(patsubst %,$(JDK_TOPDIR)/src/share/classes/%.java,\ - $(subst .,/,$(JDK_BASE_HEADER_CLASSES))) - -ifeq ($(OPENJDK_TARGET_OS),windows) - JDK_BASE_HEADER_CLASSES_WINDOWS:=sun.nio.ch.PollArrayWrapper - JDK_BASE_HEADER_CLASSES+=$(JDK_BASE_HEADER_CLASSES_WINDOWS) - JDK_BASE_HEADER_JAVA_FILES+=$(patsubst %,$(JDK_TOPDIR)/src/windows/classes/%.java,\ - $(subst .,/,$(JDK_BASE_HEADER_CLASSES_WINDOWS))) -endif - -# Set prereqs to the java files since make doesn't know about the class files. Add BUILD_JDK -# as an order only dependency to avoid race with the java compilation. -$(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers: $(JDK_BASE_HEADER_JAVA_FILES) | $(BUILD_JDK) - $(ECHO) Generating headers for jdk base classes - $(JAVAH) -bootclasspath $(JDK_OUTPUTDIR)/classes -d $(JDK_OUTPUTDIR)/gensrc_headers \ - $(JDK_BASE_HEADER_CLASSES) - $(TOUCH) $@ - ########################################################################################## ifndef OPENJDK @@ -395,7 +366,6 @@ endif # copy with -a to preserve timestamps so dependencies down the line aren't messed up all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \ - $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \ - $(JDK_OUTPUTDIR)/gensrc_headers/_the.jdk.base.headers + $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin .PHONY: all diff --git a/src/share/classes/java/io/FileSystem.java b/src/share/classes/java/io/FileSystem.java index 9baaa3cc1..96547bf0c 100644 --- a/src/share/classes/java/io/FileSystem.java +++ b/src/share/classes/java/io/FileSystem.java @@ -25,6 +25,7 @@ package java.io; +import java.lang.annotation.Native; /** * Package-private abstract class for the local filesystem abstraction. @@ -98,10 +99,10 @@ abstract class FileSystem { /* -- Attribute accessors -- */ /* Constants for simple boolean attributes */ - public static final int BA_EXISTS = 0x01; - public static final int BA_REGULAR = 0x02; - public static final int BA_DIRECTORY = 0x04; - public static final int BA_HIDDEN = 0x08; + @Native public static final int BA_EXISTS = 0x01; + @Native public static final int BA_REGULAR = 0x02; + @Native public static final int BA_DIRECTORY = 0x04; + @Native public static final int BA_HIDDEN = 0x08; /** * Return the simple boolean attributes for the file or directory denoted @@ -110,9 +111,9 @@ abstract class FileSystem { */ public abstract int getBooleanAttributes(File f); - public static final int ACCESS_READ = 0x04; - public static final int ACCESS_WRITE = 0x02; - public static final int ACCESS_EXECUTE = 0x01; + @Native public static final int ACCESS_READ = 0x04; + @Native public static final int ACCESS_WRITE = 0x02; + @Native public static final int ACCESS_EXECUTE = 0x01; /** * Check whether the file or directory denoted by the given abstract @@ -203,9 +204,9 @@ abstract class FileSystem { public abstract File[] listRoots(); /* -- Disk usage -- */ - public static final int SPACE_TOTAL = 0; - public static final int SPACE_FREE = 1; - public static final int SPACE_USABLE = 2; + @Native public static final int SPACE_TOTAL = 0; + @Native public static final int SPACE_FREE = 1; + @Native public static final int SPACE_USABLE = 2; public abstract long getSpace(File f, int t); diff --git a/src/share/classes/java/lang/Integer.java b/src/share/classes/java/lang/Integer.java index 3496d039c..6d12f880a 100644 --- a/src/share/classes/java/lang/Integer.java +++ b/src/share/classes/java/lang/Integer.java @@ -25,6 +25,7 @@ package java.lang; +import java.lang.annotation.Native; import java.util.Properties; /** @@ -54,13 +55,13 @@ public final class Integer extends Number implements Comparable { * A constant holding the minimum value an {@code int} can * have, -231. */ - public static final int MIN_VALUE = 0x80000000; + @Native public static final int MIN_VALUE = 0x80000000; /** * A constant holding the maximum value an {@code int} can * have, 231-1. */ - public static final int MAX_VALUE = 0x7fffffff; + @Native public static final int MAX_VALUE = 0x7fffffff; /** * The {@code Class} instance representing the primitive type @@ -1295,7 +1296,7 @@ public final class Integer extends Number implements Comparable { * * @since 1.5 */ - public static final int SIZE = 32; + @Native public static final int SIZE = 32; /** * The number of bytes used to represent a {@code int} value in two's @@ -1513,5 +1514,5 @@ public final class Integer extends Number implements Comparable { } /** use serialVersionUID from JDK 1.0.2 for interoperability */ - private static final long serialVersionUID = 1360826667806852920L; + @Native private static final long serialVersionUID = 1360826667806852920L; } diff --git a/src/share/classes/java/lang/Long.java b/src/share/classes/java/lang/Long.java index 6509f88f1..35cb2a4b6 100644 --- a/src/share/classes/java/lang/Long.java +++ b/src/share/classes/java/lang/Long.java @@ -25,6 +25,7 @@ package java.lang; +import java.lang.annotation.Native; import java.math.*; /** @@ -54,13 +55,13 @@ public final class Long extends Number implements Comparable { * A constant holding the minimum value a {@code long} can * have, -263. */ - public static final long MIN_VALUE = 0x8000000000000000L; + @Native public static final long MIN_VALUE = 0x8000000000000000L; /** * A constant holding the maximum value a {@code long} can * have, 263-1. */ - public static final long MAX_VALUE = 0x7fffffffffffffffL; + @Native public static final long MAX_VALUE = 0x7fffffffffffffffL; /** * The {@code Class} instance representing the primitive type @@ -1317,7 +1318,7 @@ public final class Long extends Number implements Comparable { * * @since 1.5 */ - public static final int SIZE = 64; + @Native public static final int SIZE = 64; /** * The number of bytes used to represent a {@code long} value in two's @@ -1540,5 +1541,5 @@ public final class Long extends Number implements Comparable { } /** use serialVersionUID from JDK 1.0.2 for interoperability */ - private static final long serialVersionUID = 4290774380558885855L; + @Native private static final long serialVersionUID = 4290774380558885855L; } diff --git a/src/share/classes/java/net/SocketOptions.java b/src/share/classes/java/net/SocketOptions.java index e57e8ab25..44dd1b9b4 100644 --- a/src/share/classes/java/net/SocketOptions.java +++ b/src/share/classes/java/net/SocketOptions.java @@ -25,6 +25,8 @@ package java.net; +import java.lang.annotation.Native; + /** * Interface of methods to get/set socket options. This interface is * implemented by: SocketImpl and DatagramSocketImpl. @@ -137,7 +139,7 @@ public interface SocketOptions { * @see Socket#getTcpNoDelay */ - public final static int TCP_NODELAY = 0x0001; + @Native public final static int TCP_NODELAY = 0x0001; /** * Fetch the local address binding of a socket (this option cannot @@ -158,7 +160,7 @@ public interface SocketOptions { * @see DatagramSocket#getLocalAddress */ - public final static int SO_BINDADDR = 0x000F; + @Native public final static int SO_BINDADDR = 0x000F; /** Sets SO_REUSEADDR for a socket. This is used only for MulticastSockets * in java, and it is set by default for MulticastSockets. @@ -166,7 +168,7 @@ public interface SocketOptions { * Valid for: DatagramSocketImpl */ - public final static int SO_REUSEADDR = 0x04; + @Native public final static int SO_REUSEADDR = 0x04; /** * Sets SO_BROADCAST for a socket. This option enables and disables @@ -177,7 +179,7 @@ public interface SocketOptions { * @since 1.4 */ - public final static int SO_BROADCAST = 0x0020; + @Native public final static int SO_BROADCAST = 0x0020; /** Set which outgoing interface on which to send multicast packets. * Useful on hosts with multiple network interfaces, where applications @@ -189,7 +191,7 @@ public interface SocketOptions { * @see MulticastSocket#getInterface() */ - public final static int IP_MULTICAST_IF = 0x10; + @Native public final static int IP_MULTICAST_IF = 0x10; /** Same as above. This option is introduced so that the behaviour * with IP_MULTICAST_IF will be kept the same as before, while @@ -201,7 +203,7 @@ public interface SocketOptions { * @see MulticastSocket#getNetworkInterface() * @since 1.4 */ - public final static int IP_MULTICAST_IF2 = 0x1f; + @Native public final static int IP_MULTICAST_IF2 = 0x1f; /** * This option enables or disables local loopback of multicast datagrams. @@ -209,7 +211,7 @@ public interface SocketOptions { * @since 1.4 */ - public final static int IP_MULTICAST_LOOP = 0x12; + @Native public final static int IP_MULTICAST_LOOP = 0x12; /** * This option sets the type-of-service or traffic class field @@ -217,7 +219,7 @@ public interface SocketOptions { * @since 1.4 */ - public final static int IP_TOS = 0x3; + @Native public final static int IP_TOS = 0x3; /** * Specify a linger-on-close timeout. This option disables/enables @@ -235,7 +237,7 @@ public interface SocketOptions { * @see Socket#setSoLinger * @see Socket#getSoLinger */ - public final static int SO_LINGER = 0x0080; + @Native public final static int SO_LINGER = 0x0080; /** Set a timeout on blocking Socket operations: *
@@ -256,7 +258,7 @@ public interface SocketOptions {
      * @see ServerSocket#setSoTimeout
      * @see DatagramSocket#setSoTimeout
      */
-    public final static int SO_TIMEOUT = 0x1006;
+    @Native public final static int SO_TIMEOUT = 0x1006;
 
     /**
      * Set a hint the size of the underlying buffers used by the
@@ -273,7 +275,7 @@ public interface SocketOptions {
      * @see DatagramSocket#setSendBufferSize
      * @see DatagramSocket#getSendBufferSize
      */
-    public final static int SO_SNDBUF = 0x1001;
+    @Native public final static int SO_SNDBUF = 0x1001;
 
     /**
      * Set a hint the size of the underlying buffers used by the
@@ -291,7 +293,7 @@ public interface SocketOptions {
      * @see DatagramSocket#setReceiveBufferSize
      * @see DatagramSocket#getReceiveBufferSize
      */
-    public final static int SO_RCVBUF = 0x1002;
+    @Native public final static int SO_RCVBUF = 0x1002;
 
     /**
      * When the keepalive option is set for a TCP socket and no data
@@ -314,7 +316,7 @@ public interface SocketOptions {
      * @see Socket#setKeepAlive
      * @see Socket#getKeepAlive
      */
-    public final static int SO_KEEPALIVE = 0x0008;
+    @Native public final static int SO_KEEPALIVE = 0x0008;
 
     /**
      * When the OOBINLINE option is set, any TCP urgent data received on
@@ -325,5 +327,5 @@ public interface SocketOptions {
      * @see Socket#setOOBInline
      * @see Socket#getOOBInline
      */
-    public final static int SO_OOBINLINE = 0x1003;
+    @Native public final static int SO_OOBINLINE = 0x1003;
 }
diff --git a/src/share/classes/sun/nio/ch/IOStatus.java b/src/share/classes/sun/nio/ch/IOStatus.java
index 2e6dead1f..856eb8bca 100644
--- a/src/share/classes/sun/nio/ch/IOStatus.java
+++ b/src/share/classes/sun/nio/ch/IOStatus.java
@@ -25,6 +25,7 @@
 
 package sun.nio.ch;
 
+import java.lang.annotation.Native;
 
 // Constants for reporting I/O status
 
@@ -32,12 +33,12 @@ public final class IOStatus {
 
     private IOStatus() { }
 
-    public static final int EOF = -1;              // End of file
-    public static final int UNAVAILABLE = -2;      // Nothing available (non-blocking)
-    public static final int INTERRUPTED = -3;      // System call interrupted
-    public static final int UNSUPPORTED = -4;      // Operation not supported
-    public static final int THROWN = -5;           // Exception thrown in JNI code
-    public static final int UNSUPPORTED_CASE = -6; // This case not supported
+    @Native public static final int EOF = -1;              // End of file
+    @Native public static final int UNAVAILABLE = -2;      // Nothing available (non-blocking)
+    @Native public static final int INTERRUPTED = -3;      // System call interrupted
+    @Native public static final int UNSUPPORTED = -4;      // Operation not supported
+    @Native public static final int THROWN = -5;           // Exception thrown in JNI code
+    @Native public static final int UNSUPPORTED_CASE = -6; // This case not supported
 
     // The following two methods are for use in try/finally blocks where a
     // status value needs to be normalized before being returned to the invoker
diff --git a/src/windows/classes/sun/nio/ch/PollArrayWrapper.java b/src/windows/classes/sun/nio/ch/PollArrayWrapper.java
index 294b9a975..894557694 100644
--- a/src/windows/classes/sun/nio/ch/PollArrayWrapper.java
+++ b/src/windows/classes/sun/nio/ch/PollArrayWrapper.java
@@ -28,6 +28,8 @@
 
 package sun.nio.ch;
 
+import java.lang.annotation.Native;
+
 /**
  * Manipulates a native array of structs corresponding to (fd, events) pairs.
  *
@@ -46,19 +48,19 @@ class PollArrayWrapper {
 
     long pollArrayAddress; // pollArrayAddress
 
-    private static final short FD_OFFSET     = 0; // fd offset in pollfd
-    private static final short EVENT_OFFSET  = 4; // events offset in pollfd
+    @Native private static final short FD_OFFSET     = 0; // fd offset in pollfd
+    @Native private static final short EVENT_OFFSET  = 4; // events offset in pollfd
 
     static short SIZE_POLLFD = 8; // sizeof pollfd struct
 
     // events masks
-    static final short POLLIN     = AbstractPollArrayWrapper.POLLIN;
-    static final short POLLOUT    = AbstractPollArrayWrapper.POLLOUT;
-    static final short POLLERR    = AbstractPollArrayWrapper.POLLERR;
-    static final short POLLHUP    = AbstractPollArrayWrapper.POLLHUP;
-    static final short POLLNVAL   = AbstractPollArrayWrapper.POLLNVAL;
-    static final short POLLREMOVE = AbstractPollArrayWrapper.POLLREMOVE;
-    static final short POLLCONN   = 0x0002;
+    @Native static final short POLLIN     = AbstractPollArrayWrapper.POLLIN;
+    @Native static final short POLLOUT    = AbstractPollArrayWrapper.POLLOUT;
+    @Native static final short POLLERR    = AbstractPollArrayWrapper.POLLERR;
+    @Native static final short POLLHUP    = AbstractPollArrayWrapper.POLLHUP;
+    @Native static final short POLLNVAL   = AbstractPollArrayWrapper.POLLNVAL;
+    @Native static final short POLLREMOVE = AbstractPollArrayWrapper.POLLREMOVE;
+    @Native static final short POLLCONN   = 0x0002;
 
     private int size; // Size of the pollArray
 
-- 
GitLab