Date: Wed, 26 Nov 2014 15:28:46 +0800
Subject: [PATCH 13/37] 8061253: Spec cleanup for some security-related classes
Reviewed-by: mullan
---
.../share/classes/java/security/KeyStore.java | 3 +-
.../classes/java/security/Principal.java | 3 +-
.../javax/security/auth/Destroyable.java | 4 +-
.../security/auth/kerberos/EncryptionKey.java | 26 +++++++++----
.../auth/kerberos/KerberosCredMessage.java | 23 ++++++++++++
.../security/auth/kerberos/KerberosKey.java | 37 +++++++++++--------
.../auth/kerberos/KerberosPrincipal.java | 32 +++++++++-------
.../auth/kerberos/KerberosTicket.java | 31 +++++++++-------
.../javax/security/auth/kerberos/KeyTab.java | 29 +++++++++------
9 files changed, 122 insertions(+), 66 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/security/KeyStore.java b/jdk/src/java.base/share/classes/java/security/KeyStore.java
index 4278369e8be..53e787b7d98 100644
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java
@@ -416,7 +416,8 @@ public class KeyStore {
/**
* Retrieves the attributes associated with an entry.
- *
+ *
+ * @implSpec
* The default implementation returns an empty {@code Set}.
*
* @return an unmodifiable {@code Set} of attributes, possibly empty
diff --git a/jdk/src/java.base/share/classes/java/security/Principal.java b/jdk/src/java.base/share/classes/java/security/Principal.java
index a538e707ee7..db1e7d5fd02 100644
--- a/jdk/src/java.base/share/classes/java/security/Principal.java
+++ b/jdk/src/java.base/share/classes/java/security/Principal.java
@@ -74,7 +74,8 @@ public interface Principal {
/**
* Returns true if the specified subject is implied by this principal.
*
- *
The default implementation of this method returns true if
+ * @implSpec
+ * The default implementation of this method returns true if
* {@code subject} is non-null and contains at least one principal that
* is equal to this principal.
*
diff --git a/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java b/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java
index 15b92006cdf..4d1afe56fd5 100644
--- a/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java
+++ b/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java
@@ -41,7 +41,7 @@ public interface Destroyable {
* on this {@code Object} will result in an
* {@code IllegalStateException} being thrown.
*
- *
+ * @implSpec
* The default implementation throws {@code DestroyFailedException}.
*
* @exception DestroyFailedException if the destroy operation fails.
@@ -56,7 +56,7 @@ public interface Destroyable {
/**
* Determine if this {@code Object} has been destroyed.
*
- *
+ * @implSpec
* The default implementation returns false.
*
* @return true if this {@code Object} has been destroyed,
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java
index 22730b60844..08b9179a11f 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java
@@ -158,6 +158,11 @@ public final class EncryptionKey implements SecretKey {
return destroyed;
}
+ /**
+ * Returns an informative textual representation of this {@code EncryptionKey}.
+ *
+ * @return an informative textual representation of this {@code EncryptionKey}.
+ */
@Override
public String toString() {
if (destroyed) {
@@ -166,6 +171,11 @@ public final class EncryptionKey implements SecretKey {
return "key " + key.toString();
}
+ /**
+ * Returns a hash code for this {@code EncryptionKey}.
+ *
+ * @return a hash code for this {@code EncryptionKey}.
+ */
@Override
public int hashCode() {
int result = 17;
@@ -177,15 +187,17 @@ public final class EncryptionKey implements SecretKey {
}
/**
- * Compares the specified Object with this key for equality.
- * Returns true if the given object is also a
+ * Compares the specified object with this key for equality.
+ * Returns true if the given object is also an
* {@code EncryptionKey} and the two
- * {@code EncryptionKey} instances are equivalent.
+ * {@code EncryptionKey} instances are equivalent. More formally two
+ * {@code EncryptionKey} instances are equal if they have equal key types
+ * and key material.
+ * A destroyed {@code EncryptionKey} object is only equal to itself.
*
- * @param other the Object to compare to
- * @return true if the specified object is equal to this EncryptionKey,
- * false otherwise. NOTE: Returns false if either of the EncryptionKey
- * objects has been destroyed.
+ * @param other the object to compare to
+ * @return true if the specified object is equal to this
+ * {@code EncryptionKey}, false otherwise.
*/
@Override
public boolean equals(Object other) {
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java
index ee2010b1531..e45ae2a4cee 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java
@@ -130,6 +130,11 @@ public final class KerberosCredMessage implements Destroyable {
return destroyed;
}
+ /**
+ * Returns an informative textual representation of this {@code KerberosCredMessage}.
+ *
+ * @return an informative textual representation of this {@code KerberosCredMessage}.
+ */
@Override
public String toString() {
if (destroyed) {
@@ -140,6 +145,11 @@ public final class KerberosCredMessage implements Destroyable {
}
}
+ /**
+ * Returns a hash code for this {@code KerberosCredMessage}.
+ *
+ * @return a hash code for this {@code KerberosCredMessage}.
+ */
@Override
public int hashCode() {
if (isDestroyed()) {
@@ -149,6 +159,19 @@ public final class KerberosCredMessage implements Destroyable {
}
}
+ /**
+ * Compares the specified object with this {@code KerberosCredMessage}
+ * for equality. Returns true if the given object is also a
+ * {@code KerberosCredMessage} and the two {@code KerberosCredMessage}
+ * instances are equivalent. More formally two {@code KerberosCredMessage}
+ * instances are equal if they have equal sender, recipient, and encoded
+ * KRB_CRED messages.
+ * A destroyed {@code KerberosCredMessage} object is only equal to itself.
+ *
+ * @param other the object to compare to
+ * @return true if the specified object is equal to this
+ * {@code KerberosCredMessage}, false otherwise.
+ */
@Override
public boolean equals(Object other) {
if (other == this) {
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java
index b233052f44f..84a39e0e129 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java
@@ -61,10 +61,10 @@ import javax.security.auth.DestroyFailedException;
*
* It might be necessary for the application to be granted a
* {@link javax.security.auth.PrivateCredentialPermission
- * PrivateCredentialPermission} if it needs to access the KerberosKey
+ * PrivateCredentialPermission} if it needs to access the {@code KerberosKey}
* instance from a Subject. This permission is not needed when the
* application depends on the default JGSS Kerberos mechanism to access the
- * KerberosKey. In that case, however, the application will need an
+ * {@code KerberosKey}. In that case, however, the application will need an
* appropriate
* {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.
*
@@ -113,9 +113,9 @@ public class KerberosKey implements SecretKey {
private transient boolean destroyed = false;
/**
- * Constructs a KerberosKey from the given bytes when the key type and
- * key version number are known. This can be used when reading the secret
- * key information from a Kerberos "keytab".
+ * Constructs a {@code KerberosKey} from the given bytes when the key type
+ * and key version number are known. This can be used when reading the
+ * secret key information from a Kerberos "keytab".
*
* @param principal the principal that this secret key belongs to
* @param keyBytes the key material for the secret key
@@ -133,9 +133,9 @@ public class KerberosKey implements SecretKey {
}
/**
- * Constructs a KerberosKey from a principal's password using the specified
- * algorithm name. The algorithm name (case insensitive) should be provided
- * as the encryption type string defined on the IANA
+ * Constructs a {@code KerberosKey} from a principal's password using the
+ * specified algorithm name. The algorithm name (case insensitive) should
+ * be provided as the encryption type string defined on the IANA
* Kerberos Encryption Type Numbers
* page. The version number of the key generated will be 0.
*
@@ -261,6 +261,11 @@ public class KerberosKey implements SecretKey {
return destroyed;
}
+ /**
+ * Returns an informative textual representation of this {@code KerberosKey}.
+ *
+ * @return an informative textual representation of this {@code KerberosKey}.
+ */
public String toString() {
if (destroyed) {
return "Destroyed KerberosKey";
@@ -271,9 +276,9 @@ public class KerberosKey implements SecretKey {
}
/**
- * Returns a hashcode for this KerberosKey.
+ * Returns a hash code for this {@code KerberosKey}.
*
- * @return a hashCode() for the {@code KerberosKey}
+ * @return a hash code for this {@code KerberosKey}.
* @since 1.6
*/
public int hashCode() {
@@ -290,15 +295,15 @@ public class KerberosKey implements SecretKey {
}
/**
- * Compares the specified Object with this KerberosKey for equality.
- * Returns true if the given object is also a
+ * Compares the specified object with this {@code KerberosKey} for
+ * equality. Returns true if the given object is also a
* {@code KerberosKey} and the two
* {@code KerberosKey} instances are equivalent.
+ * A destroyed {@code KerberosKey} object is only equal to itself.
*
- * @param other the Object to compare to
- * @return true if the specified object is equal to this KerberosKey,
- * false otherwise. NOTE: Returns false if either of the KerberosKey
- * objects has been destroyed.
+ * @param other the object to compare to
+ * @return true if the specified object is equal to this {@code KerberosKey},
+ * false otherwise.
* @since 1.6
*/
public boolean equals(Object other) {
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java
index 1c033803cc7..3a1c2c4c41b 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java
@@ -88,8 +88,8 @@ public final class KerberosPrincipal
/**
- * Constructs a KerberosPrincipal from the provided string input. The
- * name type for this principal defaults to
+ * Constructs a {@code KerberosPrincipal} from the provided string input.
+ * The name type for this principal defaults to
* {@link #KRB_NT_PRINCIPAL KRB_NT_PRINCIPAL}
* This string is assumed to contain a name in the format
* that is specified in Section 2.1.1. (Kerberos Principal Name Form) of
@@ -127,7 +127,7 @@ public final class KerberosPrincipal
}
/**
- * Constructs a KerberosPrincipal from the provided string and
+ * Constructs a {@code KerberosPrincipal} from the provided string and
* name type input. The string is assumed to contain a name in the
* format that is specified in Section 2.1 (Mandatory Name Forms) of
* RFC 1964.
@@ -137,7 +137,7 @@ public final class KerberosPrincipal
* (for example, duke@FOO.COM, is a valid input string for the
* name type, KRB_NT_PRINCIPAL where duke
* represents a principal, and FOO.COM represents a realm).
-
+ *
*
If the input name does not contain a realm, the default realm
* is used. The default realm can be specified either in a Kerberos
* configuration file or via the java.security.krb5.realm
@@ -179,28 +179,28 @@ public final class KerberosPrincipal
}
/**
- * Returns a hashcode for this principal. The hash code is defined to
- * be the result of the following calculation:
+ * Returns a hash code for this {@code KerberosPrincipal}. The hash code
+ * is defined to be the result of the following calculation:
*
{@code
* hashCode = getName().hashCode();
* }
*
- * @return a hashCode() for the {@code KerberosPrincipal}
+ * @return a hash code for this {@code KerberosPrincipal}.
*/
public int hashCode() {
return getName().hashCode();
}
/**
- * Compares the specified Object with this Principal for equality.
+ * Compares the specified object with this principal for equality.
* Returns true if the given object is also a
* {@code KerberosPrincipal} and the two
* {@code KerberosPrincipal} instances are equivalent.
* More formally two {@code KerberosPrincipal} instances are equal
* if the values returned by {@code getName()} are equal.
*
- * @param other the Object to compare to
- * @return true if the Object passed in represents the same principal
+ * @param other the object to compare to
+ * @return true if the object passed in represents the same principal
* as this one, false otherwise.
*/
public boolean equals(Object other) {
@@ -217,11 +217,11 @@ public final class KerberosPrincipal
}
/**
- * Save the KerberosPrincipal object to a stream
+ * Save the {@code KerberosPrincipal} object to a stream
*
* @serialData this {@code KerberosPrincipal} is serialized
* by writing out the PrincipalName and the
- * realm in their DER-encoded form as specified in Section 5.2.2 of
+ * Realm in their DER-encoded form as specified in Section 5.2.2 of
* RFC4120.
*/
private void writeObject(ObjectOutputStream oos)
@@ -268,7 +268,7 @@ public final class KerberosPrincipal
}
/**
- * Returns the name type of the KerberosPrincipal. Valid name types
+ * Returns the name type of the {@code KerberosPrincipal}. Valid name types
* are specified in Section 6.2 of
* RFC4120.
*
@@ -278,7 +278,11 @@ public final class KerberosPrincipal
return nameType;
}
- // Inherits javadocs from Object
+ /**
+ * Returns an informative textual representation of this {@code KerberosPrincipal}.
+ *
+ * @return an informative textual representation of this {@code KerberosPrincipal}.
+ */
public String toString() {
return getName();
}
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java
index 513b49c1fc0..2be499ff80b 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java
@@ -53,10 +53,10 @@ import sun.misc.HexDumpEncoder;
*
* It might be necessary for the application to be granted a
* {@link javax.security.auth.PrivateCredentialPermission
- * PrivateCredentialPermission} if it needs to access a KerberosTicket
- * instance from a Subject. This permission is not needed when the
+ * PrivateCredentialPermission} if it needs to access a {@code KerberosTicket}
+ * instance from a {@code Subject}. This permission is not needed when the
* application depends on the default JGSS Kerberos mechanism to access the
- * KerberosTicket. In that case, however, the application will need an
+ * {@code KerberosTicket}. In that case, however, the application will need an
* appropriate
* {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.
*
@@ -193,7 +193,7 @@ public class KerberosTicket implements Destroyable, Refreshable,
private transient boolean destroyed = false;
/**
- * Constructs a KerberosTicket using credentials information that a
+ * Constructs a {@code KerberosTicket} using credentials information that a
* client either receives from a KDC or reads from a cache.
*
* @param asn1Encoding the ASN.1 encoding of the ticket as defined by
@@ -565,8 +565,8 @@ public class KerberosTicket implements Destroyable, Refreshable,
try {
krb5Creds = new sun.security.krb5.Credentials(asn1Encoding,
- client.toString(),
- server.toString(),
+ client.getName(),
+ server.getName(),
sessionKey.getEncoded(),
sessionKey.getKeyType(),
flags,
@@ -644,6 +644,11 @@ public class KerberosTicket implements Destroyable, Refreshable,
return destroyed;
}
+ /**
+ * Returns an informative textual representation of this {@code KerberosTicket}.
+ *
+ * @return an informative textual representation of this {@code KerberosTicket}.
+ */
public String toString() {
if (destroyed) {
return "Destroyed KerberosTicket";
@@ -677,9 +682,9 @@ public class KerberosTicket implements Destroyable, Refreshable,
}
/**
- * Returns a hashcode for this KerberosTicket.
+ * Returns a hash code for this {@code KerberosTicket}.
*
- * @return a hashCode() for the {@code KerberosTicket}
+ * @return a hash code for this {@code KerberosTicket}.
* @since 1.6
*/
public int hashCode() {
@@ -714,15 +719,15 @@ public class KerberosTicket implements Destroyable, Refreshable,
}
/**
- * Compares the specified Object with this KerberosTicket for equality.
+ * Compares the specified object with this {@code KerberosTicket} for equality.
* Returns true if the given object is also a
* {@code KerberosTicket} and the two
* {@code KerberosTicket} instances are equivalent.
+ * A destroyed {@code KerberosTicket} object is only equal to itself.
*
- * @param other the Object to compare to
- * @return true if the specified object is equal to this KerberosTicket,
- * false otherwise. NOTE: Returns false if either of the KerberosTicket
- * objects has been destroyed.
+ * @param other the object to compare to
+ * @return true if the specified object is equal to this {@code KerberosTicket},
+ * false otherwise.
* @since 1.6
*/
public boolean equals(Object other) {
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java
index db815395e3a..3b636077b08 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java
@@ -58,10 +58,10 @@ import sun.security.krb5.RealmException;
*
* It might be necessary for the application to be granted a
* {@link javax.security.auth.PrivateCredentialPermission
- * PrivateCredentialPermission} if it needs to access the KeyTab
- * instance from a Subject. This permission is not needed when the
+ * PrivateCredentialPermission} if it needs to access the {@code KeyTab}
+ * instance from a {@code Subject}. This permission is not needed when the
* application depends on the default JGSS Kerberos mechanism to access the
- * KeyTab. In that case, however, the application will need an appropriate
+ * {@code KeyTab}. In that case, however, the application will need an appropriate
* {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.
*
* The keytab file format is described at
@@ -249,7 +249,7 @@ public final class KeyTab {
* could potentially be expired.
*
* If there is any error (say, I/O error or format error)
- * during the reading process of the KeyTab file, a saved result should be
+ * during the reading process of the keytab file, a saved result should be
* returned. If there is no saved result (say, this is the first time this
* method is called, or, all previous read attempts failed), an empty array
* should be returned. This can make sure the result is not drastically
@@ -316,6 +316,11 @@ public final class KeyTab {
return !takeSnapshot().isMissing();
}
+ /**
+ * Returns an informative textual representation of this {@code KeyTab}.
+ *
+ * @return an informative textual representation of this {@code KeyTab}.
+ */
public String toString() {
String s = (file == null) ? "Default keytab" : file.toString();
if (!bound) return s;
@@ -324,22 +329,22 @@ public final class KeyTab {
}
/**
- * Returns a hashcode for this KeyTab.
+ * Returns a hash code for this {@code KeyTab}.
*
- * @return a hashCode() for the {@code KeyTab}
+ * @return a hash code for this {@code KeyTab}.
*/
public int hashCode() {
return Objects.hash(file, princ, bound);
}
/**
- * Compares the specified Object with this KeyTab for equality.
+ * Compares the specified object with this {@code KeyTab} for equality.
* Returns true if the given object is also a
* {@code KeyTab} and the two
* {@code KeyTab} instances are equivalent.
*
- * @param other the Object to compare to
- * @return true if the specified object is equal to this KeyTab
+ * @param other the object to compare to
+ * @return true if the specified object is equal to this {@code KeyTab}
*/
public boolean equals(Object other) {
if (other == this)
@@ -359,9 +364,9 @@ public final class KeyTab {
* Returns the service principal this {@code KeyTab} object
* is bound to. Returns {@code null} if it's not bound.
*
- * Please note the deprecated constructors create a KeyTab object bound for
- * some unknown principal. In this case, this method also returns null.
- * User can call {@link #isBound()} to verify this case.
+ * Please note the deprecated constructors create a {@code KeyTab} object
+ * bound for some unknown principal. In this case, this method also returns
+ * null. User can call {@link #isBound()} to verify this case.
* @return the service principal
* @since 1.8
*/
From 64bb4a891c9480523e1e07879909d19bd0612408 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Wed, 26 Nov 2014 15:15:27 +0100
Subject: [PATCH 14/37] 8065913: Various improvements in SetupNativeCompilation
Reviewed-by: erikj
---
jdk/make/launcher/Launcher-jdk.runtime.gmk | 2 +-
jdk/make/lib/LibCommon.gmk | 16 +++++++++-------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/jdk/make/launcher/Launcher-jdk.runtime.gmk b/jdk/make/launcher/Launcher-jdk.runtime.gmk
index a8b21fe42e7..af3fc299240 100644
--- a/jdk/make/launcher/Launcher-jdk.runtime.gmk
+++ b/jdk/make/launcher/Launcher-jdk.runtime.gmk
@@ -77,7 +77,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
EXE_OUT_OPTION := -Fe
# With the current way unpack200 is built, debug symbols aren't supported
# anyway.
- UNPACKEXE_DEBUG_SYMBOLS :=
+ UNPACKEXE_DEBUG_SYMBOLS := false
endif
# The linker on older SuSE distros (e.g. on SLES 10) complains with:
diff --git a/jdk/make/lib/LibCommon.gmk b/jdk/make/lib/LibCommon.gmk
index eede8fbd8de..fd6e3428715 100644
--- a/jdk/make/lib/LibCommon.gmk
+++ b/jdk/make/lib/LibCommon.gmk
@@ -45,15 +45,17 @@ endif
# elegant solution to this.
WIN_JAVA_LIB := $(JDK_OUTPUTDIR)/objs/libjava/java.lib
-# Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
-# not on other platforms.
-ifeq ($(OPENJDK_TARGET_OS), windows)
- DEBUG_ALL_BINARIES := true
-endif
-
-# Build everything with debugging on OpenJDK
ifdef OPENJDK
+ # Build everything with debugging on OpenJDK
DEBUG_ALL_BINARIES := true
+else
+ # Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
+ # not on other platforms.
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ DEBUG_ALL_BINARIES := true
+ else
+ DEBUG_ALL_BINARIES := false
+ endif
endif
################################################################################
From 13f3dfa073c624e5438beefb6041965bbf952314 Mon Sep 17 00:00:00 2001
From: Amy Lu
Date: Wed, 26 Nov 2014 11:12:19 -0800
Subject: [PATCH 15/37] 8060026: Update jdk/test/tools/launcher tests to
eliminate dependency on sun.tools.jar.Main
Reviewed-by: alanb, ksrini, psandoz
---
jdk/test/tools/launcher/TestHelper.java | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/jdk/test/tools/launcher/TestHelper.java b/jdk/test/tools/launcher/TestHelper.java
index 40737320d52..840e67ead20 100644
--- a/jdk/test/tools/launcher/TestHelper.java
+++ b/jdk/test/tools/launcher/TestHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, 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
@@ -50,6 +50,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Arrays;
import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;
@@ -333,15 +334,10 @@ public class TestHelper {
}
static void createJar(String... args) {
- sun.tools.jar.Main jarTool =
- new sun.tools.jar.Main(System.out, System.err, "JarCreator");
- if (!jarTool.run(args)) {
- String message = "jar creation failed with command:";
- for (String x : args) {
- message = message.concat(" " + x);
- }
- throw new RuntimeException(message);
- }
+ List cmdList = new ArrayList<>();
+ cmdList.add(jarCmd);
+ cmdList.addAll(Arrays.asList(args));
+ doExec(cmdList.toArray(new String[cmdList.size()]));
}
static void copyStream(InputStream in, OutputStream out) throws IOException {
From 6026dc63ea960a00d9c9ad85f513613b9b39ddf4 Mon Sep 17 00:00:00 2001
From: Daniel Fuchs
Date: Wed, 26 Nov 2014 20:10:48 +0100
Subject: [PATCH 16/37] 8065748: Add a test to verify that non ascii characters
in Encodings.properties do not cause issues
Reviewed-by: joehw
---
.../jaxp/Encodings/CheckEncodingPropertiesFile.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java b/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java
index e8f03021e08..88e9648f066 100644
--- a/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java
+++ b/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 8008738
+ * @bug 8008738 8065138
* @summary checks that the mapping implemented by
* com.sun.org.apache.xml.internal.serializer.Encodings
* correctly identifies valid Charset names and
@@ -64,6 +64,15 @@ public class CheckEncodingPropertiesFile {
props.load(is);
}
+ if (!props.containsKey("UTF8")) {
+ // If the test fails here - it may indicate that you stumbled on an
+ // issue similar to that fixed by JDK-8065138.
+ // Check that the content of the Encodings.properties included in
+ // the tested build image matches the content of the file in the source
+ // jaxp tree of the jdk forest.
+ throw new RuntimeException("UTF8 key missing in " + ClassLoader.getSystemResource(ENCODINGS_FILE));
+ }
+
//printAllCharsets();
test(props);
From f0b198804a1665117404295f0c5a2839d9766758 Mon Sep 17 00:00:00 2001
From: Alan Bateman
Date: Fri, 28 Nov 2014 14:58:10 +0000
Subject: [PATCH 17/37] 8062955: (fs spec) Files.setLastModifiedTime should
specify SecurityException more clearly 8062949: (fs)
Files.setLastModifiedTime(path, null) does not throw NPE
Reviewed-by: chegar
---
.../share/classes/java/nio/file/Files.java | 16 +--
.../java/nio/file/Files/FileAttributes.java | 6 -
.../nio/file/Files/SetLastModifiedTime.java | 118 ++++++++++++++++++
3 files changed, 126 insertions(+), 14 deletions(-)
create mode 100644 jdk/test/java/nio/file/Files/SetLastModifiedTime.java
diff --git a/jdk/src/java.base/share/classes/java/nio/file/Files.java b/jdk/src/java.base/share/classes/java/nio/file/Files.java
index 18ef214e9a0..4d0119393b6 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/Files.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java
@@ -1778,7 +1778,7 @@ public final class Files {
* @param options
* options indicating how symbolic links are handled
*
- * @return the {@code path} parameter
+ * @return the given path
*
* @throws UnsupportedOperationException
* if the attribute view is not available
@@ -2019,7 +2019,7 @@ public final class Files {
* @param perms
* The new set of permissions
*
- * @return The path
+ * @return The given path
*
* @throws UnsupportedOperationException
* if the associated file system does not support the {@code
@@ -2102,7 +2102,7 @@ public final class Files {
* @param owner
* The new file owner
*
- * @return The path
+ * @return The given path
*
* @throws UnsupportedOperationException
* if the associated file system does not support the {@code
@@ -2289,14 +2289,14 @@ public final class Files {
* @param time
* the new last modified time
*
- * @return the path
+ * @return the given path
*
* @throws IOException
* if an I/O error occurs
* @throws SecurityException
- * In the case of the default provider, the security manager's {@link
- * SecurityManager#checkWrite(String) checkWrite} method is invoked
- * to check write access to file
+ * In the case of the default provider, and a security manager is
+ * installed, its {@link SecurityManager#checkWrite(String)
+ * checkWrite} method denies write access to the file.
*
* @see BasicFileAttributeView#setTimes
*/
@@ -2304,7 +2304,7 @@ public final class Files {
throws IOException
{
getFileAttributeView(path, BasicFileAttributeView.class)
- .setTimes(time, null, null);
+ .setTimes(Objects.requireNonNull(time), null, null);
return path;
}
diff --git a/jdk/test/java/nio/file/Files/FileAttributes.java b/jdk/test/java/nio/file/Files/FileAttributes.java
index 8b179f8efeb..a993b81e149 100644
--- a/jdk/test/java/nio/file/Files/FileAttributes.java
+++ b/jdk/test/java/nio/file/Files/FileAttributes.java
@@ -52,12 +52,6 @@ public class FileAttributes {
}
}
- // checks that two time values are within 1s of each other
- static void checkNearEqual(FileTime t1, FileTime t2) {
- long diff = Math.abs(t1.toMillis() - t2.toMillis());
- assertTrue(diff <= 1000);
- }
-
// Exercise getAttribute/setAttribute/readAttributes on basic attributes
static void checkBasicAttributes(Path file, BasicFileAttributes attrs)
throws IOException
diff --git a/jdk/test/java/nio/file/Files/SetLastModifiedTime.java b/jdk/test/java/nio/file/Files/SetLastModifiedTime.java
new file mode 100644
index 00000000000..ef8cfaa0cec
--- /dev/null
+++ b/jdk/test/java/nio/file/Files/SetLastModifiedTime.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.FileTime;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+
+/**
+ * @test
+ * @bug 4313887 8062949
+ * @library ..
+ * @run testng SetLastModifiedTime
+ * @summary Unit test for Files.setLastModifiedTime
+ */
+
+public class SetLastModifiedTime {
+
+ static Path testDir;
+
+ @BeforeClass
+ void createTestDirectory() throws Exception {
+ testDir = TestUtil.createTemporaryDirectory();
+ }
+
+ @AfterClass
+ void removeTestDirectory() throws Exception {
+ TestUtil.removeAll(testDir);
+ }
+
+ /**
+ * Exercise Files.setLastModifiedTime on the given file
+ */
+ void test(Path path) throws Exception {
+ FileTime now = Files.getLastModifiedTime(path);
+ FileTime zero = FileTime.fromMillis(0L);
+
+ Path result = Files.setLastModifiedTime(path, zero);
+ assertTrue(result == path);
+ assertEquals(Files.getLastModifiedTime(path), zero);
+
+ result = Files.setLastModifiedTime(path, now);
+ assertTrue(result == path);
+ assertEquals(Files.getLastModifiedTime(path), now);
+ }
+
+ @Test
+ public void testRegularFile() throws Exception {
+ Path file = Files.createFile(testDir.resolve("file"));
+ test(file);
+ }
+
+ @Test
+ public void testDirectory() throws Exception {
+ Path dir = Files.createDirectory(testDir.resolve("dir"));
+ test(dir);
+ }
+
+ @Test
+ public void testSymbolicLink() throws Exception {
+ if (TestUtil.supportsLinks(testDir)) {
+ Path target = Files.createFile(testDir.resolve("target"));
+ Path link = testDir.resolve("link");
+ Files.createSymbolicLink(link, target);
+ test(link);
+ }
+ }
+
+ @Test
+ public void testNulls() throws Exception {
+ Path path = Paths.get("foo");
+ FileTime zero = FileTime.fromMillis(0L);
+
+ try {
+ Files.setLastModifiedTime(null, zero);
+ assertTrue(false);
+ } catch (NullPointerException expected) { }
+
+ try {
+ Files.setLastModifiedTime(path, null);
+ assertTrue(false);
+ } catch (NullPointerException expected) { }
+
+ try {
+ Files.setLastModifiedTime(null, null);
+ assertTrue(false);
+ } catch (NullPointerException expected) { }
+ }
+}
+
From db7c757726dddbb4342b2f2969f0b4cca12eabf6 Mon Sep 17 00:00:00 2001
From: Lance Andersen
Date: Sat, 29 Nov 2014 11:14:20 -0500
Subject: [PATCH 18/37] 8066188: BaseRowSet default value for escape processing
is not correct
Reviewed-by: alanb
---
.../share/classes/javax/sql/rowset/BaseRowSet.java | 2 +-
jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java
index 2998715e3c8..7f65c0eed9c 100644
--- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java
@@ -462,7 +462,7 @@ public abstract class BaseRowSet implements Serializable, Cloneable {
* false that it is not. The default is true.
* @serial
*/
- private boolean escapeProcessing;
+ private boolean escapeProcessing = true;
/**
* A constant indicating the isolation level of the connection
diff --git a/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java b/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java
index e1b5457bda8..8e92f20af33 100644
--- a/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java
+++ b/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java
@@ -186,11 +186,11 @@ public class BaseRowSetTests extends BaseTest {
}
/*
- * Validate that getEscapeProcessing() returns false by default
+ * Validate that getEscapeProcessing() returns true by default
*/
@Test
public void test08() throws Exception {
- assertFalse(brs.getEscapeProcessing());
+ assertTrue(brs.getEscapeProcessing());
}
/*
From 14ee08928760e5d97c574e746775d28c0ae552cb Mon Sep 17 00:00:00 2001
From: Alan Bateman
Date: Mon, 1 Dec 2014 13:44:57 +0000
Subject: [PATCH 19/37] 8066196: (fs) Typo in Path::normalize, empty path only
returned if path does not have a root component
Reviewed-by: dfuchs
---
jdk/src/java.base/share/classes/java/nio/file/Path.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/java.base/share/classes/java/nio/file/Path.java b/jdk/src/java.base/share/classes/java/nio/file/Path.java
index daa09f4cf87..9df57c120e0 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/Path.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/Path.java
@@ -325,7 +325,7 @@ public interface Path
*
* @return the resulting path or this path if it does not contain
* redundant name elements; an empty path is returned if this path
- * does have a root component and all name elements are redundant
+ * does not have a root component and all name elements are redundant
*
* @see #getParent
* @see #toRealPath
From 5f72abe97e68570cff5d58fe52b4efc3d38fa250 Mon Sep 17 00:00:00 2001
From: Lance Andersen
Date: Mon, 1 Dec 2014 11:34:44 -0500
Subject: [PATCH 20/37] 8066261: Typo in Connection.isValid
Reviewed-by: dfuchs
---
jdk/src/java.sql/share/classes/java/sql/Connection.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/java.sql/share/classes/java/sql/Connection.java b/jdk/src/java.sql/share/classes/java/sql/Connection.java
index ac73fde29dd..ac5d3158b6e 100644
--- a/jdk/src/java.sql/share/classes/java/sql/Connection.java
+++ b/jdk/src/java.sql/share/classes/java/sql/Connection.java
@@ -1116,7 +1116,7 @@ public interface Connection extends Wrapper, AutoCloseable {
*
* @return true if the connection is valid, false otherwise
* @exception SQLException if the value supplied for timeout
- * is less then 0
+ * is less than 0
* @since 1.6
*
* @see java.sql.DatabaseMetaData#getClientInfoProperties
From 392436eade0b7eef17305e45fd3de51128883bd8 Mon Sep 17 00:00:00 2001
From: Mark Sheppard
Date: Mon, 1 Dec 2014 17:20:06 +0000
Subject: [PATCH 21/37] 8066130: com.sun.net.httpserver stop() throws
NullPointerException if it is not started
Added null check on dispatcherThread variable in stop method
Reviewed-by: chegar
---
.../sun/net/httpserver/ServerImpl.java | 12 +++---
.../sun/net/httpserver/StopNoStartTest.java | 42 +++++++++++++++++++
2 files changed, 49 insertions(+), 5 deletions(-)
create mode 100644 jdk/test/com/sun/net/httpserver/StopNoStartTest.java
diff --git a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
index 5952c79ee87..24ab8b014db 100644
--- a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
+++ b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
@@ -206,11 +206,13 @@ class ServerImpl implements TimeSource {
if (timer1Enabled) {
timer1.cancel();
}
- try {
- dispatcherThread.join();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- logger.log(Level.FINER, "ServerImpl.stop: ", e);
+ if (dispatcherThread != null) {
+ try {
+ dispatcherThread.join();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ logger.log(Level.FINER, "ServerImpl.stop: ", e);
+ }
}
}
diff --git a/jdk/test/com/sun/net/httpserver/StopNoStartTest.java b/jdk/test/com/sun/net/httpserver/StopNoStartTest.java
new file mode 100644
index 00000000000..c10d767e7d7
--- /dev/null
+++ b/jdk/test/com/sun/net/httpserver/StopNoStartTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014 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.
+ *
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8066130
+ * @summary Test HttpServer stop method invocation before a start has been called
+ */
+
+import java.net.InetSocketAddress;
+import com.sun.net.httpserver.HttpServer;
+
+
+public class StopNoStartTest {
+
+ public static void main(String[] args) throws Exception {
+
+ InetSocketAddress serverAddr = new InetSocketAddress(0);
+ HttpServer server = HttpServer.create(serverAddr, 0);
+ server.stop(0);
+ }
+}
From 3e1d5786af201705d46af49159e3e74808e7dca9 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev
Date: Mon, 1 Dec 2014 21:56:54 +0300
Subject: [PATCH 22/37] 8066191: Introduce time limited test executor
Reviewed-by: vlivanov, psandoz
---
.../jdk/testlibrary/TimeLimitedRunner.java | 86 +++++++++++++++++++
1 file changed, 86 insertions(+)
create mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java
diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java b/jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java
new file mode 100644
index 00000000000..5cc98ea8f8a
--- /dev/null
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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 jdk.testlibrary;
+
+import java.util.Objects;
+import java.util.concurrent.Callable;
+
+/**
+ * Auxiliary class to run target w/ given timeout.
+ */
+public class TimeLimitedRunner implements Callable {
+ private final long stoptime;
+ private final long timeout;
+ private final double factor;
+ private final Callable target;
+
+ /**
+ * @param timeout a timeout. zero means no time limitation
+ * @param factor a multiplier used to estimate next iteration time
+ * @param target a target to run
+ * @throws NullPointerException if target is null
+ * @throws IllegalArgumentException if timeout is negative or
+ factor isn't positive
+ */
+ public TimeLimitedRunner(long timeout, double factor,
+ Callable target) {
+ Objects.requireNonNull(target, "target must not be null");
+ if (timeout < 0) {
+ throw new IllegalArgumentException("timeout[" + timeout + "] < 0");
+ }
+ if (factor <= 0d) {
+ throw new IllegalArgumentException("factor[" + factor + "] <= 0");
+ }
+ this.stoptime = System.currentTimeMillis() + timeout;
+ this.timeout = timeout;
+ this.factor = factor;
+ this.target = target;
+ }
+
+ /**
+ * Runs @{linkplan target} while it returns true and timeout isn't exceeded
+ */
+ @Override
+ public Void call() throws Exception {
+ long maxDuration = 0L;
+ long iterStart = System.currentTimeMillis();
+ if (timeout != 0 && iterStart > stoptime) {
+ return null;
+ }
+ while (target.call()) {
+ if (timeout != 0) {
+ long iterDuration = System.currentTimeMillis() - iterStart;
+ maxDuration = Math.max(maxDuration, iterDuration);
+ iterStart = System.currentTimeMillis();
+ if (iterStart + (maxDuration * factor) > stoptime) {
+ System.out.println("Not enough time to continue execution. "
+ + "Interrupted.");
+ break;
+ }
+ }
+ }
+ return null;
+ }
+
+}
From 7abe24d3ea017b431113c5a709f976519f7492c3 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev
Date: Mon, 1 Dec 2014 21:58:46 +0300
Subject: [PATCH 23/37] 8039953: [TESTBUG] Timeout
java/lang/invoke/MethodHandles/CatchExceptionTest.java
Reviewed-by: vlivanov, psandoz
---
.../MethodHandles/CatchExceptionTest.java | 22 ++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
index 52c41dfd991..996ed526413 100644
--- a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
+++ b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
@@ -24,6 +24,8 @@ package test.java.lang.invoke.MethodHandles;
import com.oracle.testlibrary.jsr292.Helper;
import jdk.testlibrary.Asserts;
+import jdk.testlibrary.TimeLimitedRunner;
+import jdk.testlibrary.Utils;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@@ -33,6 +35,7 @@ import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
+import java.util.concurrent.TimeUnit;
/* @test
* @library /lib/testlibrary/jsr292 /lib/testlibrary/
@@ -93,14 +96,23 @@ public class CatchExceptionTest {
}
public static void main(String[] args) throws Throwable {
+ TestFactory factory = new TestFactory();
+ long timeout = Helper.IS_THOROUGH ? 0L : Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT);
+ // substract vm init time and reserve time for vm exit
+ timeout *= 0.9;
+ TimeLimitedRunner runner = new TimeLimitedRunner(timeout, 2.0d,
+ () -> {
+ CatchExceptionTest test = factory.nextTest();
+ if (test != null) {
+ test.runTest();
+ return true;
+ }
+ return false;
+ });
for (CatchExceptionTest test : TestFactory.MANDATORY_TEST_CASES) {
test.runTest();
}
- TestFactory factory = new TestFactory();
- CatchExceptionTest test;
- while ((test = factory.nextTest()) != null ) {
- test.runTest();
- }
+ runner.call();
}
private List> getThrowerParams(boolean isVararg, int argsCount) {
From 3034f050f9c6a5d381c66b728796d42b9b9f127a Mon Sep 17 00:00:00 2001
From: Daniel Fuchs
Date: Mon, 1 Dec 2014 21:02:21 +0100
Subject: [PATCH 24/37] 8065552: setAccessible(true) on fields of Class may
throw a SecurityException
This fix hides the new private Class.classLoader field from reflection, rather than making it not accessible.
Reviewed-by: mchung, coffeys
---
.../share/classes/java/lang/Class.java | 2 +
.../java/lang/reflect/AccessibleObject.java | 7 -
.../share/classes/sun/reflect/Reflection.java | 1 +
.../ClassDeclaredFieldsTest.java | 205 ++++++++++++++++++
4 files changed, 208 insertions(+), 7 deletions(-)
create mode 100644 jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java
diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java
index ee24402ec8d..25ed5c47fec 100644
--- a/jdk/src/java.base/share/classes/java/lang/Class.java
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java
@@ -691,6 +691,8 @@ public final class Class implements java.io.Serializable,
ClassLoader getClassLoader0() { return classLoader; }
// Initialized in JVM not by private constructor
+ // This field is filtered from reflection access, i.e. getDeclaredField
+ // will throw NoSuchFieldException
private final ClassLoader classLoader;
/**
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
index 01a074f36e0..65755f09826 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
@@ -140,13 +140,6 @@ public class AccessibleObject implements AnnotatedElement {
throw new SecurityException("Cannot make a java.lang.Class" +
" constructor accessible");
}
- } else if (obj instanceof Field && flag == true) {
- Field f = (Field)obj;
- if (f.getDeclaringClass() == Class.class &&
- f.getName().equals("classLoader")) {
- throw new SecurityException("Cannot make java.lang.Class.classLoader" +
- " accessible");
- }
}
obj.override = flag;
}
diff --git a/jdk/src/java.base/share/classes/sun/reflect/Reflection.java b/jdk/src/java.base/share/classes/sun/reflect/Reflection.java
index 63baa42abae..bc3e13e23cb 100644
--- a/jdk/src/java.base/share/classes/sun/reflect/Reflection.java
+++ b/jdk/src/java.base/share/classes/sun/reflect/Reflection.java
@@ -46,6 +46,7 @@ public class Reflection {
map.put(Reflection.class,
new String[] {"fieldFilterMap", "methodFilterMap"});
map.put(System.class, new String[] {"security"});
+ map.put(Class.class, new String[] {"classLoader"});
fieldFilterMap = map;
methodFilterMap = new HashMap<>();
diff --git a/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java b/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java
new file mode 100644
index 00000000000..c05e1790d59
--- /dev/null
+++ b/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ReflectPermission;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * @test
+ * @bug 8065552
+ * @summary test that all fields returned by getDeclaredFields() can be
+ * set accessible if the right permission is granted; this test
+ * also verifies that Class.classLoader final private field is
+ * hidden from reflection access.
+ * @run main/othervm ClassDeclaredFieldsTest UNSECURE
+ * @run main/othervm ClassDeclaredFieldsTest SECURE
+ *
+ * @author danielfuchs
+ */
+public class ClassDeclaredFieldsTest {
+
+ // Test with or without a security manager
+ public static enum TestCase {
+ UNSECURE, SECURE;
+ public void run() throws Exception {
+ System.out.println("Running test case: " + name());
+ Configure.setUp(this);
+ test(this);
+ }
+ }
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String[] args) throws Exception {
+ System.out.println(System.getProperty("java.version"));
+ if (args == null || args.length == 0) {
+ args = new String[] { "SECURE" };
+ } else if (args.length != 1) {
+ throw new IllegalArgumentException("Only one arg expected: "
+ + Arrays.asList(args));
+ }
+ TestCase.valueOf(args[0]).run();
+ }
+
+ static void test(TestCase test) {
+ for (Field f : Class.class.getDeclaredFields()) {
+ f.setAccessible(true);
+ System.out.println("Field "+f.getName()+" is now accessible.");
+ if (f.getName().equals("classLoader")) {
+ throw new RuntimeException("Found "+f.getName()+" field!");
+ }
+ }
+ try {
+ Class.class.getDeclaredField("classLoader");
+ throw new RuntimeException("Expected NoSuchFieldException for"
+ + " 'classLoader' field not raised");
+ } catch(NoSuchFieldException x) {
+ System.out.println("Got expected exception: " + x);
+ }
+ System.out.println("Passed "+test);
+ }
+
+ // A helper class to configure the security manager for the test,
+ // and bypass it when needed.
+ static class Configure {
+ static Policy policy = null;
+ static final ThreadLocal allowAll = new ThreadLocal() {
+ @Override
+ protected AtomicBoolean initialValue() {
+ return new AtomicBoolean(false);
+ }
+ };
+ static void setUp(TestCase test) {
+ switch (test) {
+ case SECURE:
+ if (policy == null && System.getSecurityManager() != null) {
+ throw new IllegalStateException("SecurityManager already set");
+ } else if (policy == null) {
+ policy = new SimplePolicy(TestCase.SECURE, allowAll);
+ Policy.setPolicy(policy);
+ System.setSecurityManager(new SecurityManager());
+ }
+ if (System.getSecurityManager() == null) {
+ throw new IllegalStateException("No SecurityManager.");
+ }
+ if (policy == null) {
+ throw new IllegalStateException("policy not configured");
+ }
+ break;
+ case UNSECURE:
+ if (System.getSecurityManager() != null) {
+ throw new IllegalStateException("SecurityManager already set");
+ }
+ break;
+ default:
+ throw new InternalError("No such testcase: " + test);
+ }
+ }
+ static void doPrivileged(Runnable run) {
+ allowAll.get().set(true);
+ try {
+ run.run();
+ } finally {
+ allowAll.get().set(false);
+ }
+ }
+ }
+
+ // A Helper class to build a set of permissions.
+ final static class PermissionsBuilder {
+ final Permissions perms;
+ public PermissionsBuilder() {
+ this(new Permissions());
+ }
+ public PermissionsBuilder(Permissions perms) {
+ this.perms = perms;
+ }
+ public PermissionsBuilder add(Permission p) {
+ perms.add(p);
+ return this;
+ }
+ public PermissionsBuilder addAll(PermissionCollection col) {
+ if (col != null) {
+ for (Enumeration e = col.elements(); e.hasMoreElements(); ) {
+ perms.add(e.nextElement());
+ }
+ }
+ return this;
+ }
+ public Permissions toPermissions() {
+ final PermissionsBuilder builder = new PermissionsBuilder();
+ builder.addAll(perms);
+ return builder.perms;
+ }
+ }
+
+ // Policy for the test...
+ public static class SimplePolicy extends Policy {
+
+ final Permissions permissions;
+ final Permissions allPermissions;
+ final ThreadLocal allowAll; // actually: this should be in a thread locale
+ public SimplePolicy(TestCase test, ThreadLocal allowAll) {
+ this.allowAll = allowAll;
+ // we don't actually need any permission to create our
+ // FileHandlers because we're passing invalid parameters
+ // which will make the creation fail...
+ permissions = new Permissions();
+ permissions.add(new RuntimePermission("accessDeclaredMembers"));
+ permissions.add(new ReflectPermission("suppressAccessChecks"));
+
+ // these are used for configuring the test itself...
+ allPermissions = new Permissions();
+ allPermissions.add(new java.security.AllPermission());
+
+ }
+
+ @Override
+ public boolean implies(ProtectionDomain domain, Permission permission) {
+ if (allowAll.get().get()) return allPermissions.implies(permission);
+ return permissions.implies(permission);
+ }
+
+ @Override
+ public PermissionCollection getPermissions(CodeSource codesource) {
+ return new PermissionsBuilder().addAll(allowAll.get().get()
+ ? allPermissions : permissions).toPermissions();
+ }
+
+ @Override
+ public PermissionCollection getPermissions(ProtectionDomain domain) {
+ return new PermissionsBuilder().addAll(allowAll.get().get()
+ ? allPermissions : permissions).toPermissions();
+ }
+ }
+
+}
From 2f9a2c3c320a4413ad843f0c505a75c5792ad249 Mon Sep 17 00:00:00 2001
From: Stuart Marks
Date: Mon, 1 Dec 2014 17:59:39 -0800
Subject: [PATCH 25/37] 8035000: clean up ActivationLibrary.DestroyThread
Reviewed-by: lancea
---
.../checkActivateRef/CheckActivateRef.java | 4 +-
.../checkAnnotations/CheckAnnotations.java | 4 +-
.../CheckImplClassLoader.java | 4 +-
.../CheckRegisterInLog.java | 4 +-
.../CreatePrivateActivatable.java | 4 +-
.../DownloadParameterClass.java | 4 +-
.../ElucidateNoSuchMethod.java | 4 +-
.../extLoadedImpl/ExtLoadedImplTest.java | 4 +-
.../forceLogSnapshot/ForceLogSnapshot.java | 4 +-
.../inactiveGroup/InactiveGroup.java | 4 +-
.../LookupActivationSystem.java | 4 +-
.../nestedActivate/NestedActivate.java | 4 +-
.../NonExistentActivatable.java | 4 +-
.../RestartCrashedService.java | 4 +-
.../restartLatecomer/RestartLatecomer.java | 4 +-
.../restartService/RestartService.java | 4 +-
.../UnregisterInactive.java | 4 +-
.../activateFails/ActivateFails.java | 4 +-
.../DownloadActivationGroup.java | 4 +-
.../activeGroup/IdempotentActiveGroup.java | 4 +-
.../modifyDescriptor/ModifyDescriptor.java | 4 +-
.../StubClassesPermitted.java | 4 +-
.../unregisterGroup/UnregisterGroup.java | 4 +-
.../CommandEnvironment/SetChildEnv.java | 4 +-
.../InheritedChannelNotServerSocket.java | 4 +-
.../RmidViaInheritedChannel.java | 4 +-
.../AltSecurityManager.java | 7 -
.../activatable/UseCustomSocketFactory.java | 4 +-
.../rmi/testlibrary/ActivationLibrary.java | 64 ------
jdk/test/java/rmi/testlibrary/RMID.java | 216 +++++++++---------
30 files changed, 160 insertions(+), 235 deletions(-)
diff --git a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java
index dcd5990db63..f37fdec54dc 100644
--- a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java
+++ b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -262,7 +262,7 @@ public class CheckActivateRef
e.getClass().getName(), e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
obj = null;
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java
index d2a0bab342c..126fae1e521 100644
--- a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java
+++ b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -130,7 +130,7 @@ public class CheckAnnotations
myRMI = null;
System.err.println("rmid shut down");
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java
index 556e2895ca9..dc54f82459b 100644
--- a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java
+++ b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -112,7 +112,7 @@ public class CheckImplClassLoader {
myRMI = null;
System.err.println("rmid shut down");
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
TestLibrary.unexport(group);
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java
index c294a972d36..0d03562346c 100644
--- a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java
+++ b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -164,7 +164,7 @@ public class CheckRegisterInLog
throw new RuntimeException("CheckRegisterInLog got exception " +
e.getMessage());
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java
index 2900e80964a..414527dfa4b 100644
--- a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java
+++ b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -155,7 +155,7 @@ public class CreatePrivateActivatable
e.getClass().getName(), e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
obj = null;
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java
index 64f11681341..9f236978a4a 100644
--- a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java
+++ b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -138,7 +138,7 @@ public class DownloadParameterClass {
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java
index 29482121ffb..0e0efb52cd5 100644
--- a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java
+++ b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -135,7 +135,7 @@ public class ElucidateNoSuchMethod
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java
index 3fd009b611a..c46baeaf5e7 100644
--- a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java
+++ b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -69,7 +69,7 @@ public class ExtLoadedImplTest {
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java
index abbaadfb9f3..55ff0cfd14e 100644
--- a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java
+++ b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -248,7 +248,7 @@ public class ForceLogSnapshot
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
for (int i = 0 ; i < HOW_MANY ; i ++) {
TestLibrary.unexport(unicastObjs[i]);
}
diff --git a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java
index ad0b14e421a..145e6109df8 100644
--- a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java
+++ b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -176,7 +176,7 @@ public class InactiveGroup
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java b/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java
index ce154c4ca99..df778dc8e91 100644
--- a/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java
+++ b/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -118,7 +118,7 @@ public class LookupActivationSystem implements Remote, Serializable {
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java b/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java
index 48e3e2d701e..507912e90b5 100644
--- a/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java
+++ b/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -165,7 +165,7 @@ public class NestedActivate
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java
index 47ddd176ef8..df8ddbef82c 100644
--- a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java
+++ b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -139,7 +139,7 @@ public class NonExistentActivatable
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java
index 5700f3d72f2..c3026b02c93 100644
--- a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java
+++ b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -231,7 +231,7 @@ public class RestartCrashedService
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
TestLibrary.unexport(unicastObj);
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java
index 747eee68f3a..3bbe8a60c44 100644
--- a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java
+++ b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -247,7 +247,7 @@ public class RestartLatecomer
} catch (Exception e) {
TestLibrary.bomb(e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
TestLibrary.unexport(callbackObj);
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java b/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java
index e1f2eb554ee..468f5b239f1 100644
--- a/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java
+++ b/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -221,7 +221,7 @@ public class RestartService
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
TestLibrary.unexport(unicastObj);
}
}
diff --git a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java
index 455efd7d7f6..085120b159d 100644
--- a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java
+++ b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -125,7 +125,7 @@ public class UnregisterInactive
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java
index 6a2eba05864..6d9ccceb141 100644
--- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java
+++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -163,7 +163,7 @@ public class ActivateFails
} finally {
obj1 = obj2 = null;
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java
index f9aed42021d..2f025cf25b8 100644
--- a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java
+++ b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -156,7 +156,7 @@ public class DownloadActivationGroup
} catch (Exception e) {
TestLibrary.bomb(e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java
index f6c08178eec..058d3c7e2d9 100644
--- a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java
+++ b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -108,7 +108,7 @@ public class IdempotentActiveGroup {
} catch (NoSuchObjectException unexpected) {
throw new AssertionError(unexpected);
}
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
diff --git a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java
index ba376d1a8d9..53ff030e393 100644
--- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java
+++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -250,7 +250,7 @@ public class ModifyDescriptor
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java
index b7890e0ebe7..f4970da26ad 100644
--- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java
+++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -171,7 +171,7 @@ public class StubClassesPermitted
}
canCreateStubs = null;
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
System.err.println("rmid shut down");
}
}
diff --git a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java
index bc5976b74fe..94976dc0c6f 100644
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -156,7 +156,7 @@ public class UnregisterGroup extends Activatable implements ActivateMe
} catch (Exception e) {
TestLibrary.bomb("test failed", e);
} finally {
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
}
diff --git a/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java b/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java
index 7b1a9688ad4..69274a0a797 100644
--- a/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java
+++ b/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -203,7 +203,7 @@ public class SetChildEnv
actsys.unregisterGroup(gid);
Thread.sleep(5000);
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
public static class DebugExecWatcher
diff --git a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java
index 4611a83bda5..d375fc84611 100644
--- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java
+++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -121,7 +121,7 @@ public class InheritedChannelNotServerSocket {
if (obj != null) {
UnicastRemoteObject.unexportObject(obj, true);
}
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
diff --git a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java
index 6d81b0f1248..1f3cd6603d5 100644
--- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java
+++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -119,7 +119,7 @@ public class RmidViaInheritedChannel implements Callback {
if (obj != null) {
UnicastRemoteObject.unexportObject(obj, true);
}
- ActivationLibrary.rmidCleanup(rmid);
+ rmid.cleanup();
}
}
diff --git a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java
index 351042965de..ebad01300ae 100644
--- a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java
+++ b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java
@@ -104,13 +104,6 @@ public class AltSecurityManager implements Runnable {
utilityToStart + " to die");
if (time >= TIME_OUT) {
-
- // dont pollute other tests; increase the likelihood
- // that rmid will go away if it did not exit already.
- if (utility.equals(ACTIVATION)) {
- RMID.shutdown(port);
- }
-
TestLibrary.bomb(utilityToStart +
" took too long to die...");
} else {
diff --git a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java
index b300e1083bb..5157f789c75 100644
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -57,7 +57,7 @@ public class UseCustomSocketFactory {
RMID rmid = null;
try {
- rmid = RMID.createRMID(true);
+ rmid = RMID.createRMID();
rmid.addArguments(new String[] {
"-C-Djava.security.policy=" +
TestParams.defaultGroupPolicy +
diff --git a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java
index b33a3035c89..6a7a5b753d8 100644
--- a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java
+++ b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java
@@ -103,68 +103,4 @@ public class ActivationLibrary {
} catch (NoSuchObjectException e) {
}
}
-
- /** cleanup after rmid */
- public static void rmidCleanup(RMID rmid) {
- if (rmid != null) {
- if (!ActivationLibrary.safeDestroy(rmid, SAFE_WAIT_TIME)) {
- TestLibrary.bomb("rmid not destroyed in: " +
- SAFE_WAIT_TIME +
- " milliseconds");
- }
- }
- RMID.removeLog();
- }
-
- /**
- * Invoke shutdown on rmid in a way that will not cause a test
- * to hang.
- *
- * @return whether or not shutdown completed succesfully in the
- * timeAllowed
- */
- private static boolean safeDestroy(RMID rmid, long timeAllowed) {
- DestroyThread destroyThread = new DestroyThread(rmid);
- destroyThread.start();
-
- try {
- destroyThread.join(timeAllowed);
- } catch (InterruptedException ie) {
- Thread.currentThread().interrupt();
- }
-
- return destroyThread.shutdownSucceeded();
- }
-
- /**
- * Thread class to handle the destruction of rmid
- */
- private static class DestroyThread extends Thread {
- private final RMID rmid;
- private final int port;
- private boolean succeeded = false;
-
- DestroyThread(RMID rmid) {
- this.rmid = rmid;
- this.port = rmid.getPort();
- this.setDaemon(true);
- }
-
- public void run() {
- if (RMID.lookupSystem(port) != null) {
- rmid.destroy();
- synchronized (this) {
- // flag that the test was able to shutdown rmid
- succeeded = true;
- }
- mesg("finished destroying rmid");
- } else {
- mesg("tried to shutdown when rmid was not running");
- }
- }
-
- public synchronized boolean shutdownSucceeded() {
- return succeeded;
- }
- }
}
diff --git a/jdk/test/java/rmi/testlibrary/RMID.java b/jdk/test/java/rmi/testlibrary/RMID.java
index bdd8c829d89..29365e8125f 100644
--- a/jdk/test/java/rmi/testlibrary/RMID.java
+++ b/jdk/test/java/rmi/testlibrary/RMID.java
@@ -21,14 +21,11 @@
* questions.
*/
-/**
- *
- */
-
import java.io.*;
import java.rmi.*;
import java.rmi.activation.*;
import java.rmi.registry.*;
+import java.util.concurrent.TimeoutException;
/**
* Utility class that creates an instance of rmid with a policy
@@ -39,6 +36,14 @@ import java.rmi.registry.*;
*/
public class RMID extends JavaVM {
+ // TODO: adjust these based on the timeout factor
+ // such as jcov.sleep.multiplier; see start(long) method.
+ // Also consider the test.timeout.factor property (a float).
+ private static final long TIMEOUT_SHUTDOWN_MS = 60_000L;
+ private static final long TIMEOUT_DESTROY_MS = 10_000L;
+ private static final long STARTTIME_MS = 15_000L;
+ private static final long POLLTIME_MS = 100L;
+
private static final String SYSTEM_NAME = ActivationSystem.class.getName();
// "java.rmi.activation.ActivationSystem"
@@ -140,15 +145,8 @@ public class RMID extends JavaVM {
* policy file.
*/
public static RMID createRMID() {
- return createRMID(System.out, System.err, true);
- }
-
- public static RMID createRMID(boolean debugExec) {
- return createRMID(System.out, System.err, debugExec);
- }
-
- public static RMID createRMID(OutputStream out, OutputStream err) {
- return createRMID(out, err, true);
+ return createRMID(System.out, System.err, true, true,
+ TestLibrary.getUnusedRandomPort());
}
public static RMID createRMID(OutputStream out, OutputStream err,
@@ -173,24 +171,24 @@ public class RMID extends JavaVM {
/**
- * Test RMID should be created with the createRMID method.
+ * Private constructor. RMID instances should be created
+ * using the static factory methods.
*/
- protected RMID(String classname, String options, String args,
+ private RMID(String classname, String options, String args,
OutputStream out, OutputStream err, int port)
{
super(classname, options, args, out, err);
this.port = port;
}
+ /**
+ * Removes rmid's log file directory.
+ */
public static void removeLog() {
- /*
- * Remove previous log file directory before
- * starting up rmid.
- */
File f = new File(LOGDIR, log);
if (f.exists()) {
- mesg("removing rmid's old log file...");
+ mesg("Removing rmid's old log file.");
String[] files = f.list();
if (files != null) {
@@ -199,8 +197,8 @@ public class RMID extends JavaVM {
}
}
- if (f.delete() != true) {
- mesg("\t" + " unable to delete old log file.");
+ if (! f.delete()) {
+ mesg("Warning: unable to delete old log file.");
}
}
}
@@ -215,14 +213,6 @@ public class RMID extends JavaVM {
return TestLibrary.getExtraProperty("rmid.jcov.args","");
}
- public void start() throws IOException {
- start(10000);
- }
-
- public void slowStart() throws IOException {
- start(60000);
- }
-
/**
* Looks up the activation system in the registry on the given port,
* returning its stub, or null if it's not present. This method differs from
@@ -239,12 +229,24 @@ public class RMID extends JavaVM {
}
}
+ /**
+ * Starts rmid and waits up to the default timeout period
+ * to confirm that it's running.
+ */
+ public void start() throws IOException {
+ start(STARTTIME_MS);
+ }
+
+ /**
+ * Starts rmid and waits up to the given timeout period
+ * to confirm that it's running.
+ */
public void start(long waitTime) throws IOException {
// if rmid is already running, then the test will fail with
// a well recognized exception (port already in use...).
- mesg("starting rmid on port #" + port + "...");
+ mesg("Starting rmid on port " + port + ".");
super.start();
int slopFactor = 1;
@@ -254,20 +256,17 @@ public class RMID extends JavaVM {
} catch (NumberFormatException ignore) {}
waitTime = waitTime * slopFactor;
- // We check several times (as many as provides passed waitTime) to
- // see if Rmid is currently running. Waiting steps last 100 msecs.
- final long rmidStartSleepTime = 100;
+ // We check several times, for a maximum of waitTime, until we have
+ // verified that rmid is running.
do {
- // Sleeping for another rmidStartSleepTime time slice.
try {
- Thread.sleep(Math.min(waitTime, rmidStartSleepTime));
+ Thread.sleep(Math.min(waitTime, POLLTIME_MS));
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
- mesg("Thread interrupted while checking for start of Activation System. Giving up check.");
- mesg("Activation System state unknown");
+ mesg("Interrupted while starting activation system, giving up.");
return;
}
- waitTime -= rmidStartSleepTime;
+ waitTime -= POLLTIME_MS;
// Checking if rmid is present
if (lookupSystem(port) != null) {
@@ -279,7 +278,7 @@ public class RMID extends JavaVM {
* incorrect value.
*/
System.setProperty("java.rmi.activation.port", Integer.toString(port));
- mesg("finished starting rmid.");
+ mesg("Started successfully.");
return;
} else {
if (waitTime > 0) {
@@ -287,9 +286,15 @@ public class RMID extends JavaVM {
}
}
} while (waitTime > 0);
- TestLibrary.bomb("start rmid failed... giving up", null);
+ TestLibrary.bomb("Failed to start rmid, giving up.", null);
}
+ /**
+ * Destroys rmid and restarts it. Note that this does NOT clean up
+ * the log file, because it stores information about restartable
+ * and activatable objects that must be carried over to the new
+ * rmid instance.
+ */
public void restart() throws IOException {
destroy();
start();
@@ -298,30 +303,35 @@ public class RMID extends JavaVM {
/**
* Ask rmid to shutdown gracefully using a remote method call.
* catch any errors that might occur from rmid not being present
- * at time of shutdown invocation.
- *
- * Shutdown does not nullify possible references to the rmid
- * process object (destroy does though).
+ * at time of shutdown invocation. If the remote call is
+ * successful, wait for the process to terminate. Return true
+ * if the process terminated, otherwise return false.
*/
- public static void shutdown(int port) {
+ private boolean shutdown() throws InterruptedException {
+ mesg("shutdown()");
+ ActivationSystem system = lookupSystem(port);
+ if (system == null) {
+ mesg("lookupSystem() returned null");
+ return false;
+ }
try {
- ActivationSystem system = lookupSystem(port);
-
- if (system == null) {
- TestLibrary.bomb("reference to the activation system was null");
- }
-
+ mesg("ActivationSystem.shutdown()");
system.shutdown();
- } catch (RemoteException re) {
- mesg("shutting down the activation daemon failed");
} catch (Exception e) {
- mesg("caught exception trying to shutdown rmid");
- mesg(e.getMessage());
+ mesg("Caught exception from ActivationSystem.shutdown():");
e.printStackTrace();
}
- mesg("testlibrary finished shutting down rmid");
+ try {
+ waitFor(TIMEOUT_SHUTDOWN_MS);
+ mesg("Shutdown successful.");
+ return true;
+ } catch (TimeoutException ex) {
+ mesg("Shutdown timed out:");
+ ex.printStackTrace();
+ return false;
+ }
}
/**
@@ -330,60 +340,46 @@ public class RMID extends JavaVM {
* if rmid is a child process of the current VM.
*/
public void destroy() {
- // attempt graceful shutdown of the activation system
- shutdown(port);
-
- if (vm != null) {
- try {
- /* Waiting for distant RMID process to shutdown.
- * Waiting is bounded at a hardcoded max of 60 secs (1 min).
- * Waiting by steps of 200 msecs, thus at most 300 such attempts
- * for termination of distant RMID process. If process is not
- * known to be terminated properly after that time,
- * we give up for a gracefull termination, and thus go for
- * forcibly destroying the process.
- */
- boolean vmEnded = false;
- int waitingTrials = 0;
- final int maxTrials = 300;
- final long vmProcessEndWaitInterval = 200;
- int vmExitValue;
- do {
- try {
- Thread.sleep(vmProcessEndWaitInterval);
- waitingTrials++;
- vmExitValue = vm.exitValue();
- mesg("rmid exited on shutdown request");
- vmEnded = true;
- } catch (IllegalThreadStateException illegal) {
- mesg("RMID's process still not terminated after more than " +
- (waitingTrials * vmProcessEndWaitInterval) + " milliseconds");
- }
- }
- while (!vmEnded &&
- (waitingTrials < maxTrials));
-
- if (waitingTrials >= maxTrials) {
- mesg("RMID's process still not terminated after more than " +
- (waitingTrials * vmProcessEndWaitInterval) + " milliseconds." +
- "Givinp up gracefull termination...");
- mesg("destroying RMID's process using Process.destroy()");
- super.destroy();
- }
-
- } catch (InterruptedException ie) {
- Thread.currentThread().interrupt();
- mesg("Thread interrupted while checking for termination of distant rmid vm. Giving up check.");
- } catch (Exception e) {
- mesg("caught unexpected exception trying to destroy rmid: " +
- e.getMessage());
- e.printStackTrace();
- }
-
- // rmid will not restart if its process is not null
- vm = null;
+ if (vm == null) {
+ throw new IllegalStateException("can't wait for RMID that isn't running");
}
+
+ // First, attempt graceful shutdown of the activation system.
+ try {
+ if (! shutdown()) {
+ // Graceful shutdown failed, use Process.destroy().
+ mesg("Destroying RMID process.");
+ vm.destroy();
+ try {
+ waitFor(TIMEOUT_DESTROY_MS);
+ mesg("Destroy successful.");
+ } catch (TimeoutException ex) {
+ mesg("Destroy timed out, giving up.");
+ ex.printStackTrace();
+ }
+ }
+ } catch (InterruptedException ie) {
+ mesg("Shutdown/destroy interrupted, giving up.");
+ ie.printStackTrace();
+ Thread.currentThread().interrupt();
+ return;
+ }
+
+ vm = null;
}
- public int getPort() {return port;}
+ /**
+ * Shuts down rmid and then removes its log file.
+ */
+ public void cleanup() {
+ destroy();
+ RMID.removeLog();
+ }
+
+ /**
+ * Gets the port on which this rmid is listening.
+ */
+ public int getPort() {
+ return port;
+ }
}
From 56d2ce25a92347fae09657b5e413c4c1513ac337 Mon Sep 17 00:00:00 2001
From: Jan Lahoda
Date: Tue, 2 Dec 2014 15:12:40 +0100
Subject: [PATCH 26/37] 8065998: Avoid use of _ as a one-character identifier
Reviewed-by: alanb, chegar, darcy
---
jdk/test/java/io/readBytes/MemoryLeak.java | 2 +-
.../lang/Class/TypeCheckMicroBenchmark.java | 4 +-
.../java/lang/ProcessBuilder/Zombies.java | 6 +-
.../java/lang/invoke/6998541/Test6998541.java | 74 +++++++++----------
jdk/test/java/util/EnumSet/BogusEnumSet.java | 2 +-
5 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/jdk/test/java/io/readBytes/MemoryLeak.java b/jdk/test/java/io/readBytes/MemoryLeak.java
index ab099b16956..a9dd8e61209 100644
--- a/jdk/test/java/io/readBytes/MemoryLeak.java
+++ b/jdk/test/java/io/readBytes/MemoryLeak.java
@@ -40,7 +40,7 @@ public class MemoryLeak {
try {
s.read(bytes);
throw new Error("expected IOException");
- } catch (IOException _) {
+ } catch (IOException expected) {
/* OK */
} catch (OutOfMemoryError oome) {
System.out.printf("Got OutOfMemoryError, i=%d%n", i);
diff --git a/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java b/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java
index e406c4f3060..d82de6ed185 100644
--- a/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java
+++ b/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java
@@ -182,7 +182,7 @@ public class TypeCheckMicroBenchmark {
for (int i = 0; i < iterations; i++) {
for (Object x : list.toArray()) {
try { a[0] = x; }
- catch (ArrayStoreException _) {
+ catch (ArrayStoreException unused) {
throw new ClassCastException(); }}}}},
new Job("write into dynamic array") { void work() {
for (int i = 0; i < iterations; i++) {
@@ -190,7 +190,7 @@ public class TypeCheckMicroBenchmark {
Object[] a = (Object[])
java.lang.reflect.Array.newInstance(klazz, 1);
try { a[0] = x; }
- catch (ArrayStoreException _) {
+ catch (ArrayStoreException unused) {
throw new ClassCastException(); }}}}}
};
diff --git a/jdk/test/java/lang/ProcessBuilder/Zombies.java b/jdk/test/java/lang/ProcessBuilder/Zombies.java
index f8c3b627dd8..c417b696c2b 100644
--- a/jdk/test/java/lang/ProcessBuilder/Zombies.java
+++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java
@@ -47,17 +47,17 @@ public class Zombies {
try {
rt.exec("no-such-file");
throw new Error("expected IOException not thrown");
- } catch (IOException _) {/* OK */}
+ } catch (IOException expected) {/* OK */}
try {
rt.exec(".");
throw new Error("expected IOException not thrown");
- } catch (IOException _) {/* OK */}
+ } catch (IOException expected) {/* OK */}
try {
rt.exec(TrueCommand, null, new File("no-such-dir"));
throw new Error("expected IOException not thrown");
- } catch (IOException _) {/* OK */}
+ } catch (IOException expected) {/* OK */}
rt.exec(TrueCommand).waitFor();
diff --git a/jdk/test/java/lang/invoke/6998541/Test6998541.java b/jdk/test/java/lang/invoke/6998541/Test6998541.java
index e9f467be3f4..59d9d45bffb 100644
--- a/jdk/test/java/lang/invoke/6998541/Test6998541.java
+++ b/jdk/test/java/lang/invoke/6998541/Test6998541.java
@@ -214,13 +214,13 @@ public class Test6998541 {
}
private static void boolean2prim_invalid(boolean x) throws Throwable {
if (DO_CASTS) return;
- try { byte y = (byte) mh_bz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> byte
- try { char y = (char) mh_cz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> char
- try { short y = (short) mh_sz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> short
- try { int y = (int) mh_iz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> int
- try { long y = (long) mh_jz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> long
- try { float y = (float) mh_fz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> float
- try { double y = (double) mh_dz.invokeExact(x); fail(); } catch (ClassCastException _) {} // boolean -> double
+ try { byte y = (byte) mh_bz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> byte
+ try { char y = (char) mh_cz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> char
+ try { short y = (short) mh_sz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> short
+ try { int y = (int) mh_iz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> int
+ try { long y = (long) mh_jz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> long
+ try { float y = (float) mh_fz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> float
+ try { double y = (double) mh_dz.invokeExact(x); fail(); } catch (ClassCastException expected) {} // boolean -> double
}
private static MethodHandle mh_b(Class ret) { return mh(ret, byte.class); }
@@ -248,8 +248,8 @@ public class Test6998541 {
}
private static void byte2prim_invalid(byte x) throws Throwable {
if (DO_CASTS) return;
- try { char y = (char) mh_cb.invokeExact(x); fail(); } catch (ClassCastException _) {} // byte -> char
- try { boolean y = (boolean) mh_zb.invokeExact(x); fail(); } catch (ClassCastException _) {} // byte -> boolean
+ try { char y = (char) mh_cb.invokeExact(x); fail(); } catch (ClassCastException expected) {} // byte -> char
+ try { boolean y = (boolean) mh_zb.invokeExact(x); fail(); } catch (ClassCastException expected) {} // byte -> boolean
}
private static MethodHandle mh_c(Class ret) { return mh(ret, char.class); }
@@ -277,9 +277,9 @@ public class Test6998541 {
}
private static void char2prim_invalid(char x) throws Throwable {
if (DO_CASTS) return;
- try { boolean y = (boolean) mh_zc.invokeExact(x); fail(); } catch (ClassCastException _) {} // char -> boolean
- try { byte y = (byte) mh_bc.invokeExact(x); fail(); } catch (ClassCastException _) {} // char -> byte
- try { short y = (short) mh_sc.invokeExact(x); fail(); } catch (ClassCastException _) {} // char -> short
+ try { boolean y = (boolean) mh_zc.invokeExact(x); fail(); } catch (ClassCastException expected) {} // char -> boolean
+ try { byte y = (byte) mh_bc.invokeExact(x); fail(); } catch (ClassCastException expected) {} // char -> byte
+ try { short y = (short) mh_sc.invokeExact(x); fail(); } catch (ClassCastException expected) {} // char -> short
}
private static MethodHandle mh_s(Class ret) { return mh(ret, short.class); }
@@ -307,9 +307,9 @@ public class Test6998541 {
}
private static void short2prim_invalid(short x) throws Throwable {
if (DO_CASTS) return;
- try { boolean y = (boolean) mh_zs.invokeExact(x); fail(); } catch (ClassCastException _) {} // short -> boolean
- try { byte y = (byte) mh_bs.invokeExact(x); fail(); } catch (ClassCastException _) {} // short -> byte
- try { char y = (char) mh_cs.invokeExact(x); fail(); } catch (ClassCastException _) {} // short -> char
+ try { boolean y = (boolean) mh_zs.invokeExact(x); fail(); } catch (ClassCastException expected) {} // short -> boolean
+ try { byte y = (byte) mh_bs.invokeExact(x); fail(); } catch (ClassCastException expected) {} // short -> byte
+ try { char y = (char) mh_cs.invokeExact(x); fail(); } catch (ClassCastException expected) {} // short -> char
}
private static MethodHandle mh_i(Class ret) { return mh(ret, int.class); }
@@ -337,10 +337,10 @@ public class Test6998541 {
}
private static void int2prim_invalid(int x) throws Throwable {
if (DO_CASTS) return;
- try { boolean y = (boolean) mh_zi.invokeExact(x); fail(); } catch (ClassCastException _) {} // int -> boolean
- try { byte y = (byte) mh_bi.invokeExact(x); fail(); } catch (ClassCastException _) {} // int -> byte
- try { char y = (char) mh_ci.invokeExact(x); fail(); } catch (ClassCastException _) {} // int -> char
- try { short y = (short) mh_si.invokeExact(x); fail(); } catch (ClassCastException _) {} // int -> short
+ try { boolean y = (boolean) mh_zi.invokeExact(x); fail(); } catch (ClassCastException expected) {} // int -> boolean
+ try { byte y = (byte) mh_bi.invokeExact(x); fail(); } catch (ClassCastException expected) {} // int -> byte
+ try { char y = (char) mh_ci.invokeExact(x); fail(); } catch (ClassCastException expected) {} // int -> char
+ try { short y = (short) mh_si.invokeExact(x); fail(); } catch (ClassCastException expected) {} // int -> short
}
private static MethodHandle mh_j(Class ret) { return mh(ret, long.class); }
@@ -368,11 +368,11 @@ public class Test6998541 {
}
private static void long2prim_invalid(long x) throws Throwable {
if (DO_CASTS) return;
- try { boolean y = (boolean) mh_zj.invokeExact(x); fail(); } catch (ClassCastException _) {} // long -> boolean
- try { byte y = (byte) mh_bj.invokeExact(x); fail(); } catch (ClassCastException _) {} // long -> byte
- try { char y = (char) mh_cj.invokeExact(x); fail(); } catch (ClassCastException _) {} // long -> char
- try { short y = (short) mh_sj.invokeExact(x); fail(); } catch (ClassCastException _) {} // long -> short
- try { int y = (int) mh_ij.invokeExact(x); fail(); } catch (ClassCastException _) {} // long -> int
+ try { boolean y = (boolean) mh_zj.invokeExact(x); fail(); } catch (ClassCastException expected) {} // long -> boolean
+ try { byte y = (byte) mh_bj.invokeExact(x); fail(); } catch (ClassCastException expected) {} // long -> byte
+ try { char y = (char) mh_cj.invokeExact(x); fail(); } catch (ClassCastException expected) {} // long -> char
+ try { short y = (short) mh_sj.invokeExact(x); fail(); } catch (ClassCastException expected) {} // long -> short
+ try { int y = (int) mh_ij.invokeExact(x); fail(); } catch (ClassCastException expected) {} // long -> int
}
private static MethodHandle mh_f(Class ret) { return mh(ret, float.class); }
@@ -400,12 +400,12 @@ public class Test6998541 {
}
private static void float2prim_invalid(float x) throws Throwable {
if (DO_CASTS) return;
- try { boolean y = (boolean) mh_zf.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> boolean
- try { byte y = (byte) mh_bf.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> byte
- try { char y = (char) mh_cf.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> char
- try { short y = (short) mh_sf.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> short
- try { int y = (int) mh_if.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> int
- try { long y = (long) mh_jf.invokeExact(x); fail(); } catch (ClassCastException _) {} // float -> long
+ try { boolean y = (boolean) mh_zf.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> boolean
+ try { byte y = (byte) mh_bf.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> byte
+ try { char y = (char) mh_cf.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> char
+ try { short y = (short) mh_sf.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> short
+ try { int y = (int) mh_if.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> int
+ try { long y = (long) mh_jf.invokeExact(x); fail(); } catch (ClassCastException expected) {} // float -> long
}
private static MethodHandle mh_d(Class ret) { return mh(ret, double.class); }
@@ -433,13 +433,13 @@ public class Test6998541 {
}
private static void double2prim_invalid(double x) throws Throwable {
if (DO_CASTS) return;
- try { boolean y = (boolean) mh_zd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> boolean
- try { byte y = (byte) mh_bd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> byte
- try { char y = (char) mh_cd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> char
- try { short y = (short) mh_sd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> short
- try { int y = (int) mh_id.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> int
- try { long y = (long) mh_jd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> long
- try { float y = (float) mh_fd.invokeExact(x); fail(); } catch (ClassCastException _) {} // double -> float
+ try { boolean y = (boolean) mh_zd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> boolean
+ try { byte y = (byte) mh_bd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> byte
+ try { char y = (char) mh_cd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> char
+ try { short y = (short) mh_sd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> short
+ try { int y = (int) mh_id.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> int
+ try { long y = (long) mh_jd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> long
+ try { float y = (float) mh_fd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> float
}
private final static MethodHandle mh_zv = mh(boolean.class);
diff --git a/jdk/test/java/util/EnumSet/BogusEnumSet.java b/jdk/test/java/util/EnumSet/BogusEnumSet.java
index 1f52b90440a..9769cfebe2d 100644
--- a/jdk/test/java/util/EnumSet/BogusEnumSet.java
+++ b/jdk/test/java/util/EnumSet/BogusEnumSet.java
@@ -82,7 +82,7 @@ public class BogusEnumSet {
System.out.println("Set size: " + es.size()); // 64
System.out.println("Set: " + es); // Throws IndexOutOfBoundsException
throw new AssertionError("Expected exception InvalidObjectException not thrown");
- } catch (java.io.InvalidObjectException _) { /* OK */ }
+ } catch (java.io.InvalidObjectException expected) { /* OK */ }
}
private static Object deserialize(byte[] sf) throws Throwable {
From 31af33c0e2b113578b3447ecd1f508f9185d71a4 Mon Sep 17 00:00:00 2001
From: Shanliang Jiang
Date: Wed, 3 Dec 2014 11:38:56 +0100
Subject: [PATCH 27/37] 8065764:
javax/management/monitor/CounterMonitorTest.java hangs
Reviewed-by: jbachorik, dfuchs
---
.../monitor/CounterMonitorTest.java | 46 ++++++++++++++-----
1 file changed, 34 insertions(+), 12 deletions(-)
diff --git a/jdk/test/javax/management/monitor/CounterMonitorTest.java b/jdk/test/javax/management/monitor/CounterMonitorTest.java
index 6c4ea1022e3..939f1ece0df 100644
--- a/jdk/test/javax/management/monitor/CounterMonitorTest.java
+++ b/jdk/test/javax/management/monitor/CounterMonitorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, 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
@@ -26,7 +26,7 @@
* @bug 4981829
* @summary Test that the counter monitor, when running in difference mode,
* emits a notification every time the threshold is exceeded.
- * @author Luis-Miguel Alventosa
+ * @author Luis-Miguel Alventosa, Shanliang JIANG
* @run clean CounterMonitorTest
* @run build CounterMonitorTest
* @run main CounterMonitorTest
@@ -50,23 +50,31 @@ public class CounterMonitorTest implements NotificationListener {
private boolean notifyFlag = true;
// granularity period
- private int granularityperiod = 500;
+ private int granularityperiod = 10;
- // counter values
- private int[] values = new int[] {4, 6, 9, 11};
+ // derived gauge
+ private volatile int derivedGauge = 2;
// flag to notify that a message has been received
private volatile boolean messageReceived = false;
+ private volatile Object observedValue = null;
+
// MBean class
public class StdObservedObject implements StdObservedObjectMBean {
public Object getNbObjects() {
+ echo(">>> StdObservedObject.getNbObjects: " + count);
+ synchronized(CounterMonitorTest.class) {
+ observedValue = count;
+ CounterMonitorTest.class.notifyAll();
+ }
return count;
}
public void setNbObjects(Object n) {
+ echo(">>> StdObservedObject.setNbObjects: " + n);
count = n;
}
- private Object count= null;
+ private volatile Object count= null;
}
// MBean interface
@@ -166,18 +174,18 @@ public class CounterMonitorTest implements NotificationListener {
Attribute attrib = new Attribute("NbObjects", data);
server.setAttribute(stdObsObjName, attrib);
- // Wait for granularity period (multiplied by 2 for sure)
- //
- Thread.sleep(granularityperiod * 2);
+ waitObservation(data);
// Loop through the values
//
- for (int i = 0; i < values.length; i++) {
- data = new Integer(values[i]);
- echo(">>> Set data = " + data.intValue());
+ while (derivedGauge++ < 10) {
+ System.out.print(">>> Set data from " + data.intValue());
+ data = new Integer(data.intValue() + derivedGauge);
+ echo(" to " + data.intValue());
attrib = new Attribute("NbObjects", data);
server.setAttribute(stdObsObjName, attrib);
+ waitObservation(data);
echo("\tdoWait in Counter Monitor");
doWait();
@@ -214,6 +222,20 @@ public class CounterMonitorTest implements NotificationListener {
}
}
+ private void waitObservation(Object value) {
+ synchronized (CounterMonitorTest.class) {
+ while (value != observedValue) {
+ try {
+ CounterMonitorTest.class.wait();
+ } catch (InterruptedException e) {
+ System.err.println("Got unexpected exception: " + e);
+ e.printStackTrace();
+ break;
+ }
+ }
+ }
+ }
+
/*
* Print message
*/
From cec929efaf2cd44dcbd4f77842e87106293ebf6a Mon Sep 17 00:00:00 2001
From: Paul Sandoz
Date: Wed, 3 Dec 2014 12:00:26 +0100
Subject: [PATCH 28/37] 8066397: Remove network-related seed initialization
code in ThreadLocal/SplittableRandom
Reviewed-by: alanb, dl, chegar, rriggs, shade
---
.../classes/java/util/SplittableRandom.java | 39 +++----------------
.../util/concurrent/ThreadLocalRandom.java | 31 +--------------
2 files changed, 6 insertions(+), 64 deletions(-)
diff --git a/jdk/src/java.base/share/classes/java/util/SplittableRandom.java b/jdk/src/java.base/share/classes/java/util/SplittableRandom.java
index 00de113a6f8..285655d40c9 100644
--- a/jdk/src/java.base/share/classes/java/util/SplittableRandom.java
+++ b/jdk/src/java.base/share/classes/java/util/SplittableRandom.java
@@ -25,7 +25,6 @@
package java.util;
-import java.net.NetworkInterface;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.IntConsumer;
import java.util.function.LongConsumer;
@@ -140,11 +139,10 @@ public final class SplittableRandom {
* other cases, this split must be performed in a thread-safe
* manner, so we use an AtomicLong to represent the seed rather
* than use an explicit SplittableRandom. To bootstrap the
- * defaultGen, we start off using a seed based on current time and
- * network interface address unless the java.util.secureRandomSeed
- * property is set. This serves as a slimmed-down (and insecure)
- * variant of SecureRandom that also avoids stalls that may occur
- * when using /dev/random.
+ * defaultGen, we start off using a seed based on current time
+ * unless the java.util.secureRandomSeed property is set. This
+ * serves as a slimmed-down (and insecure) variant of SecureRandom
+ * that also avoids stalls that may occur when using /dev/random.
*
* It is a relatively simple matter to apply the basic design here
* to use 128 bit seeds. However, emulating 128bit arithmetic and
@@ -237,34 +235,7 @@ public final class SplittableRandom {
s = (s << 8) | ((long)(seedBytes[i]) & 0xffL);
return s;
}
- long h = 0L;
- try {
- Enumeration ifcs =
- NetworkInterface.getNetworkInterfaces();
- boolean retry = false; // retry once if getHardwareAddress is null
- while (ifcs.hasMoreElements()) {
- NetworkInterface ifc = ifcs.nextElement();
- if (!ifc.isVirtual()) { // skip fake addresses
- byte[] bs = ifc.getHardwareAddress();
- if (bs != null) {
- int n = bs.length;
- int m = Math.min(n >>> 1, 4);
- for (int i = 0; i < m; ++i)
- h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i];
- if (m < 4)
- h = (h << 8) ^ bs[n-1-m];
- h = mix64(h);
- break;
- }
- else if (!retry)
- retry = true;
- else
- break;
- }
- }
- } catch (Exception ignore) {
- }
- return (h ^ mix64(System.currentTimeMillis()) ^
+ return (mix64(System.currentTimeMillis()) ^
mix64(System.nanoTime()));
}
diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java
index 2606bed44be..95cc6549b9f 100644
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java
@@ -36,8 +36,6 @@
package java.util.concurrent;
import java.io.ObjectStreamField;
-import java.net.NetworkInterface;
-import java.util.Enumeration;
import java.util.Random;
import java.util.Spliterator;
import java.util.concurrent.atomic.AtomicInteger;
@@ -147,34 +145,7 @@ public class ThreadLocalRandom extends Random {
s = (s << 8) | ((long)(seedBytes[i]) & 0xffL);
return s;
}
- long h = 0L;
- try {
- Enumeration ifcs =
- NetworkInterface.getNetworkInterfaces();
- boolean retry = false; // retry once if getHardwareAddress is null
- while (ifcs.hasMoreElements()) {
- NetworkInterface ifc = ifcs.nextElement();
- if (!ifc.isVirtual()) { // skip fake addresses
- byte[] bs = ifc.getHardwareAddress();
- if (bs != null) {
- int n = bs.length;
- int m = Math.min(n >>> 1, 4);
- for (int i = 0; i < m; ++i)
- h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i];
- if (m < 4)
- h = (h << 8) ^ bs[n-1-m];
- h = mix64(h);
- break;
- }
- else if (!retry)
- retry = true;
- else
- break;
- }
- }
- } catch (Exception ignore) {
- }
- return (h ^ mix64(System.currentTimeMillis()) ^
+ return (mix64(System.currentTimeMillis()) ^
mix64(System.nanoTime()));
}
From b26d39ffd735316f3d6383f4a9a0dca30d44047d Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Wed, 3 Dec 2014 14:20:21 +0000
Subject: [PATCH 29/37] 8049367: Modular Run-Time Images
Co-authored-by: Alan Bateman
Co-authored-by: Alex Buckley
Co-authored-by: Bradford Wetmore
Co-authored-by: Erik Joelsson
Co-authored-by: James Laskey
Co-authored-by: Jonathan Gibbons
Co-authored-by: Karen Kinnear
Co-authored-by: Magnus Ihse Bursie
Co-authored-by: Mandy Chung
Co-authored-by: Mark Reinhold
Co-authored-by: Paul Sandoz
Co-authored-by: Sundararajan Athijegannathan
Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
---
Makefile | 36 +-
common/autoconf/boot-jdk.m4 | 14 -
common/autoconf/bootcycle-spec.gmk.in | 9 +-
common/autoconf/compare.sh.in | 1 +
common/autoconf/flags.m4 | 12 +-
common/autoconf/generated-configure.sh | 30 +-
common/autoconf/spec.gmk.in | 39 +-
common/bin/compare.sh | 217 +++--------
common/bin/compare_exceptions.sh.incl | 16 +
common/bin/unshuffle_list.txt | 2 +-
make/CompileJavaModules.gmk | 22 +-
make/Images.gmk | 496 +++++++++++++++++++++++++
make/Javadoc.gmk | 17 +-
make/JrtfsJar.gmk | 37 ++
make/MacBundles.gmk | 137 +++++++
make/Main.gmk | 306 ++++++++-------
make/MakeHelpers.gmk | 147 ++++++--
make/ModuleWrapper.gmk | 88 +++++
make/StripBinaries.gmk | 99 +++++
make/ZipSecurity.gmk | 104 ++++++
make/ZipSource.gmk | 88 +++++
make/common/JavaCompilation.gmk | 13 +-
make/common/Modules.gmk | 1 +
make/common/NativeCompilation.gmk | 109 +++---
make/common/SetupJavaCompilers.gmk | 11 +-
make/jprt.properties | 4 +-
modules.xml | 4 +
27 files changed, 1546 insertions(+), 513 deletions(-)
create mode 100644 make/Images.gmk
create mode 100644 make/JrtfsJar.gmk
create mode 100644 make/MacBundles.gmk
create mode 100644 make/ModuleWrapper.gmk
create mode 100644 make/StripBinaries.gmk
create mode 100644 make/ZipSecurity.gmk
create mode 100644 make/ZipSource.gmk
diff --git a/Makefile b/Makefile
index d4b36e4539d..15c4eaadf59 100644
--- a/Makefile
+++ b/Makefile
@@ -143,31 +143,37 @@ help:
$(info . make [default] # Compile all modules in langtools, hotspot, jaxp, jaxws,)
$(info . # corba and jdk and create a runnable "exploded" image)
$(info . make all # Compile everything, all repos, docs and images)
- $(info . make images # Create complete j2sdk and j2re images)
+ $(info . make images # Create complete jdk and jre images)
+ $(info . make # Compile the specified phase and everything it depends on)
+ $(info . # (gensrc, java, copy, libs, launchers, gendata, rmic))
+ $(info . make *-only # Applies to most targets and disables compling the)
+ $(info . # dependencies for the target. This is faster but may)
+ $(info . # result in incorrect build results!)
$(info . make docs # Create all docs)
$(info . make docs-javadoc # Create just javadocs, depends on less than full docs)
- $(info . make profiles # Create complete j2re compact profile images)
+ $(info . make profiles # Create complete jre compact profile images)
$(info . make bootcycle-images # Build images twice, second time with newly built JDK)
$(info . make install # Install the generated images locally)
$(info . make reconfigure # Rerun configure with the same arguments as last time)
- $(info . make clean # Remove all files generated by make, but not those)
- $(info . # generated by configure)
- $(info . make dist-clean # Remove all files, including configuration)
$(info . make help # Give some help on using make)
$(info . make test # Run tests, default is all tests (see TEST below))
$(info )
+ $(info Targets for cleaning)
+ $(info . make clean # Remove all files generated by make, but not those)
+ $(info . # generated by configure)
+ $(info . make dist-clean # Remove all files, including configuration)
+ $(info . make clean- # Remove the subdir in the output dir with the name)
+ $(info . make clean- # Remove all build results related to a certain build)
+ $(info . # phase (gensrc, java, libs, launchers))
+ $(info . make clean- # Remove all build results related to a certain module)
+ $(info . make clean-- # Remove all build results related to a certain)
+ $(info . # module and phase)
+ $(info )
$(info Targets for specific modules)
$(info . make # Build and everything it depends on. )
- $(info . make -only # Build only, without dependencies. This)
- $(info . # is faster but can result in incorrect build results!)
- $(info . make -java # Compile java classes for and everything it)
- $(info . # depends on)
- $(info . make -libs # Build native libraries for and everything it)
- $(info . # depends on)
- $(info . make -launchers# Build native executables for and everything it)
- $(info . # depends on)
- $(info . make -gensrc # Execute the gensrc step for and everything it)
- $(info . # depends on)
+ $(info . make - # Compile the specified phase for the specified module)
+ $(info . # and everything it depends on)
+ $(info . # (gensrc, java, copy, libs, launchers, gendata, rmic))
$(info )
$(info Useful make variables)
$(info . make CONF= # Build all configurations (note, assignment is empty))
diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4
index fbfa15c7b06..716a8c44c35 100644
--- a/common/autoconf/boot-jdk.m4
+++ b/common/autoconf/boot-jdk.m4
@@ -305,20 +305,6 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
AC_MSG_ERROR([Cannot continue])
fi
- # Setup proper paths for what we found
- BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
- if test ! -f "$BOOT_RTJAR"; then
- # On MacOSX it is called classes.jar
- BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
- if test -f "$BOOT_RTJAR"; then
- # Remove the ..
- BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
- fi
- fi
- BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
- BOOT_JDK="$BOOT_JDK"
- AC_SUBST(BOOT_RTJAR)
- AC_SUBST(BOOT_TOOLSJAR)
AC_SUBST(BOOT_JDK)
# Setup tools from the Boot JDK.
diff --git a/common/autoconf/bootcycle-spec.gmk.in b/common/autoconf/bootcycle-spec.gmk.in
index 87e6203fc88..e4fc779128f 100644
--- a/common/autoconf/bootcycle-spec.gmk.in
+++ b/common/autoconf/bootcycle-spec.gmk.in
@@ -42,13 +42,12 @@ endif
# Override specific values to do a boot cycle build
+# Use a different Boot JDK
+BOOT_JDK := $(JDK_IMAGE_DIR)
+
# The bootcycle build has a different output directory
BUILD_OUTPUT:=@BUILD_OUTPUT@/bootcycle-build
-
-# Use a different Boot JDK
-OLD_BOOT_JDK:=$(BOOT_JDK)
-BOOT_JDK:=@BUILD_OUTPUT@/images/j2sdk-image
-BOOT_RTJAR:=$(BOOT_JDK)/jre/lib/rt.jar
+SJAVAC_SERVER_DIR:=$(subst @BUILD_OUTPUT@,$(BUILD_OUTPUT),$(SJAVAC_SERVER_DIR))
JAVA_CMD:=$(BOOT_JDK)/bin/java
JAVAC_CMD:=$(BOOT_JDK)/bin/javac
diff --git a/common/autoconf/compare.sh.in b/common/autoconf/compare.sh.in
index 4c6207176c5..5b46e04b6d0 100644
--- a/common/autoconf/compare.sh.in
+++ b/common/autoconf/compare.sh.in
@@ -46,6 +46,7 @@ FILE="@FILE@"
FIND="@FIND@"
GREP="@GREP@"
JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
+JIMAGE="@FIXPATH@ @BUILD_OUTPUT@/jdk/bin/jimage"
LDD="@LDD@"
MKDIR="@MKDIR@"
NAWK="@NAWK@"
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
index cd2d4a38eaa..99a0ce5dc5c 100644
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -784,24 +784,24 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
LDFLAGS_JDKLIB_SUFFIX=""
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS} \
- -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
+ -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
# On some platforms (mac) the linker warns about non existing -L dirs.
# Add server first if available. Linking aginst client does not always produce the same results.
# Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
# Default to server for other variants.
if test "x$JVM_VARIANT_SERVER" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
else
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
fi
LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index ee4a8945ede..9d1100744df 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -820,8 +820,6 @@ JAVAH
JAVAC
JAVA
BOOT_JDK
-BOOT_TOOLSJAR
-BOOT_RTJAR
JAVA_CHECK
JAVAC_CHECK
COOKED_BUILD_NUMBER
@@ -4328,7 +4326,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1415179461
+DATE_WHEN_GENERATED=1416999037
###############################################################################
#
@@ -25533,20 +25531,6 @@ $as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&
as_fn_error $? "Cannot continue" "$LINENO" 5
fi
- # Setup proper paths for what we found
- BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
- if test ! -f "$BOOT_RTJAR"; then
- # On MacOSX it is called classes.jar
- BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
- if test -f "$BOOT_RTJAR"; then
- # Remove the ..
- BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
- fi
- fi
- BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
- BOOT_JDK="$BOOT_JDK"
-
-
# Setup tools from the Boot JDK.
@@ -42870,24 +42854,24 @@ $as_echo "$as_me: WARNING: $HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" >&2;}
LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
LDFLAGS_JDKLIB_SUFFIX=""
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS} \
- -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
+ -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
# On some platforms (mac) the linker warns about non existing -L dirs.
# Add server first if available. Linking aginst client does not always produce the same results.
# Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
# Default to server for other variants.
if test "x$JVM_VARIANT_SERVER" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
else
- LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
fi
LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index e5b43ecdafb..056d9edf8f5 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -236,31 +236,23 @@ BUILD_VARIANT_RELEASE:=@BUILD_VARIANT_RELEASE@
BUILD_OUTPUT:=@BUILD_OUTPUT@
# Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
-LANGTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/langtools
-CORBA_OUTPUTDIR=$(BUILD_OUTPUT)/corba
-JAXP_OUTPUTDIR=$(BUILD_OUTPUT)/jaxp
-JAXWS_OUTPUTDIR=$(BUILD_OUTPUT)/jaxws
+SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
+BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
+MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/makesupport
+
HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
-NASHORN_OUTPUTDIR=$(BUILD_OUTPUT)/nashorn
IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/testmake
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
-LANGTOOLS_DIST=$(LANGTOOLS_OUTPUTDIR)/dist
-CORBA_DIST=$(CORBA_OUTPUTDIR)/dist
-JAXP_DIST=$(JAXP_OUTPUTDIR)/dist
-JAXWS_DIST=$(JAXWS_OUTPUTDIR)/dist
HOTSPOT_DIST=@HOTSPOT_DIST@
-NASHORN_DIST=$(NASHORN_OUTPUTDIR)/dist
BUILD_HOTSPOT=@BUILD_HOTSPOT@
-# The boot jdk to use. These are overridden in bootcycle-spec.gmk. Make sure to keep
-# them in sync.
+# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
+# it in sync.
BOOT_JDK:=@BOOT_JDK@
-BOOT_RTJAR:=@BOOT_RTJAR@
-BOOT_TOOLSJAR=$(BOOT_JDK)/lib/tools.jar
# When compiling Java source to be run by the boot jdk
# use these extra flags, eg -source 6 -target 6
@@ -484,13 +476,14 @@ SJAVAC_SERVER_JAVA=@FIXPATH@ $(SJAVAC_SERVER_JAVA_CMD) $(SJAVAC_SERVER_JAVA_FLAG
JAVAC_FLAGS?=@JAVAC_FLAGS@
# You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
-INTERIM_LANGTOOLS_JAR := $(LANGTOOLS_OUTPUTDIR)/dist/interim_langtools.jar
-INTERIM_LANGTOOLS_ARGS := "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
+# Use = assignment to be able to override in bootcycle-spec.gmk
+INTERIM_LANGTOOLS_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_langtools.jar
+INTERIM_LANGTOOLS_ARGS = "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
NEW_JAVAC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javac.Main
NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javadoc.Main
# The interim corba jar is needed for running rmic
-INTERIM_CORBA_JAR := $(CORBA_OUTPUTDIR)/dist/interim_corba.jar
+INTERIM_CORBA_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_corba.jar
# Base flags for RC
# Guarding this against resetting value. Legacy make files include spec multiple
@@ -695,19 +688,15 @@ OS_VERSION_MINOR:=@OS_VERSION_MINOR@
OS_VERSION_MICRO:=@OS_VERSION_MICRO@
# Images directory definitions
-JDK_IMAGE_SUBDIR:=j2sdk-image
-JRE_IMAGE_SUBDIR:=j2re-image
-JDK_OVERLAY_IMAGE_SUBDIR:=j2sdk-overlay-image
-JRE_OVERLAY_IMAGE_SUBDIR:=j2re-overlay-image
+JDK_IMAGE_SUBDIR:=jdk
+JRE_IMAGE_SUBDIR:=jre
# Colon left out to be able to override output dir for bootcycle-images
JDK_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
-JDK_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_OVERLAY_IMAGE_SUBDIR)
-JRE_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_OVERLAY_IMAGE_SUBDIR)
# Macosx bundles directory definitions
-JDK_BUNDLE_SUBDIR=j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
-JRE_BUNDLE_SUBDIR=j2re-bundle/jre$(JDK_VERSION).jre/Contents
+JDK_BUNDLE_SUBDIR=jdk-bundle/jdk$(JDK_VERSION).jdk/Contents
+JRE_BUNDLE_SUBDIR=jre-bundle/jre$(JDK_VERSION).jre/Contents
JDK_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_BUNDLE_SUBDIR)
JRE_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_BUNDLE_SUBDIR)
diff --git a/common/bin/compare.sh b/common/bin/compare.sh
index 31ec560dd16..418ca1d3517 100644
--- a/common/bin/compare.sh
+++ b/common/bin/compare.sh
@@ -103,8 +103,8 @@ diff_text() {
-e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
-e thePoint -e aPoint -e setItemsPtr \
-e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then
- $JAVAP -c -constants -l -p ${OTHER_FILE} > ${OTHER_FILE}.javap
- $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
+ $JAVAP -c -constants -l -p "${OTHER_FILE}" > ${OTHER_FILE}.javap
+ $JAVAP -c -constants -l -p "${THIS_FILE}" > ${THIS_FILE}.javap
TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
@@ -298,7 +298,7 @@ compare_general_files() {
WORK_DIR=$3
GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
- ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
+ ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" ! -name "*.jimage" \
! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
@@ -395,8 +395,14 @@ compare_zip_file() {
$RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
$MKDIR -p $THIS_UNZIPDIR
$MKDIR -p $OTHER_UNZIPDIR
- (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
- (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
+ if [ "$TYPE" = "jimage" ]
+ then
+ (cd $THIS_UNZIPDIR && $JIMAGE extract $THIS_ZIP)
+ (cd $OTHER_UNZIPDIR && $JIMAGE extract $OTHER_ZIP)
+ else
+ (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
+ (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
+ fi
# Find all archives inside and unzip them as well to compare the contents rather than
# the archives. pie.jar.pack.gz i app3.war is corrupt, skip it.
@@ -525,7 +531,7 @@ compare_all_jar_files() {
# TODO filter?
ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" \
- | $SORT | $FILTER)
+ -o -name "*.jimage" | $SORT | $FILTER)
if [ -n "$ZIPS" ]; then
echo Jar files...
@@ -633,7 +639,7 @@ compare_bin_file() {
if cmp $OTHER_FILE $THIS_FILE > /dev/null; then
# The files were bytewise identical.
if [ -n "$VERBOSE" ]; then
- echo " : : : : : $BIN_FILE"
+ echo " : : : : : : $BIN_FILE"
fi
return 0
fi
@@ -1136,17 +1142,8 @@ fi
if [ "$SKIP_DEFAULT" != "true" ]; then
if [ -z "$OTHER" ]; then
- OTHER="$THIS/../$LEGACY_BUILD_DIR"
- if [ -d "$OTHER" ]; then
- OTHER="$( cd "$OTHER" && pwd )"
- else
- echo "Default old build directory does not exist:"
- echo "$OTHER"
- exit 1
- fi
- echo "Comparing to default old build:"
- echo "$OTHER"
- echo
+ echo "Nothing to compare to, set with -o"
+ exit 1
else
if [ ! -d "$OTHER" ]; then
echo "Other build directory does not exist:"
@@ -1160,90 +1157,36 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
fi
- # Figure out the layout of the this build. Which kinds of images have been produced
- if [ -d "$THIS/install/j2sdk-image" ]; then
- THIS_J2SDK="$THIS/install/j2sdk-image"
- THIS_J2RE="$THIS/install/j2re-image"
- echo "Selecting install images in this build"
- elif [ -d "$THIS/deploy/j2sdk-image" ]; then
- THIS_J2SDK="$THIS/deploy/j2sdk-image"
- THIS_J2RE="$THIS/deploy/j2re-image"
- echo "Selecting deploy images in this build"
- elif [ -d "$THIS/images/j2sdk-image" ]; then
- THIS_J2SDK="$THIS/images/j2sdk-image"
- THIS_J2RE="$THIS/images/j2re-image"
- echo "Selecting jdk images in this build"
+ # Find the common images to compare, prioritizing later build stages
+ if [ -d "$THIS/install/jdk" ] && [ -d "$OTHER/install/jdk" ]; then
+ THIS_J2SDK="$THIS/install/jdk"
+ THIS_J2RE="$THIS/install/jre"
+ OTHER_J2SDK="$OTHER/install/jdk"
+ OTHER_J2RE="$OTHER/install/jre"
+ echo "Selecting install images for compare"
+ elif [ -d "$THIS/deploy/jdk" ] && [ -d "$OTHER/deploy/jdk" ]; then
+ THIS_J2SDK="$THIS/deploy/jdk"
+ THIS_J2RE="$THIS/deploy/jre"
+ OTHER_J2SDK="$OTHER/deploy/jdk"
+ OTHER_J2RE="$OTHER/deploy/jre"
+ echo "Selecting deploy images for compare"
+ elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then
+ THIS_J2SDK="$THIS/images/jdk"
+ THIS_J2RE="$THIS/images/jre"
+ OTHER_J2SDK="$OTHER/images/jdk"
+ OTHER_J2RE="$OTHER/images/jre"
+ echo "Selecting jdk images for compare"
+ else
+ echo "No common images found."
+ exit 1
fi
- if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
- if [ -d "$THIS/install/j2sdk-image" ]; then
- # If there is an install image, prefer that, it's also overlay
- THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
- THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
- echo "Selecting install overlay images in this build"
- else
- THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
- THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
- echo "Selecting jdk overlay images in this build"
- fi
- fi
-
- if [ -d "$THIS/images/j2sdk-bundle" ]; then
- THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
- THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
- echo "Selecting bundles in this build"
- fi
-
- # Figure out the layout of the other build (old or new, normal or overlay image)
- if [ -d "$OTHER/j2sdk-image" ]; then
- if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
- OTHER_J2SDK="$OTHER/j2sdk-image"
- OTHER_J2RE="$OTHER/j2re-image"
- echo "Selecting old-style images in other build"
- else
- OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
- OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
- echo "Selecting overlay images in other build"
- fi
- elif [ -d "$OTHER/install/j2sdk-image" ]; then
- OTHER_J2SDK="$OTHER/install/j2sdk-image"
- OTHER_J2RE="$OTHER/install/j2re-image"
- echo "Selecting install images in other build"
- elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
- OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
- OTHER_J2RE="$OTHER/deploy/j2re-image"
- echo "Selecting deploy images in other build"
- elif [ -d "$OTHER/images/j2sdk-image" ]; then
- OTHER_J2SDK="$OTHER/images/j2sdk-image"
- OTHER_J2RE="$OTHER/images/j2re-image"
- echo "Selecting jdk images in other build"
- fi
-
- if [ -d "$OTHER/j2sdk-bundle" ]; then
- OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
- OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
- echo "Selecting bundles in other build"
- elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
- OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
- OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
- echo "Selecting jdk bundles in other build"
- fi
-
- if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
- if [ -z "$THIS_J2SDK_OVERLAY" ]; then
- echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
- exit 1
- fi
- fi
-
- if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
- echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
- exit 1
- fi
-
- if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
- echo "WARNING! OTHER build has bundles built while this build does not."
- echo "Skipping bundle compare!"
+ if [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
+ THIS_J2SDK_BUNDLE="$THIS/images/jdk-bundle"
+ THIS_J2RE_BUNDLE="$THIS/images/jre-bundle"
+ OTHER_J2SDK_BUNDLE="$OTHER/images/jdk-bundle"
+ OTHER_J2RE_BUNDLE="$OTHER/images/jre-bundle"
+ echo "Also comparing macosx bundles"
fi
if [ -d "$OTHER/images" ]; then
@@ -1266,22 +1209,13 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
fi
- if [ -d "$THIS/docs" ]; then
+ if [ -d "$THIS/docs" ] && [ -d "$OTHER/docs" ]; then
THIS_DOCS="$THIS/docs"
- fi
-
- if [ -d "$OTHER/docs" ]; then
OTHER_DOCS="$OTHER/docs"
- fi
-
- if [ -z "$THIS_DOCS" ]; then
+ echo "Also comparing docs"
+ else
echo "WARNING! Docs haven't been built and won't be compared."
fi
-
- if [ -z "$OTHER_DOCS" ]; then
- echo "WARNING! Other build doesn't contain docs, skipping doc compare."
- fi
-
fi
##########################################################################################
@@ -1299,27 +1233,16 @@ if [ "$CMP_NAMES" = "true" ]; then
echo -n "J2RE "
compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "J2SDK Overlay "
- compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- echo -n "J2RE Overlay "
- compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
-
- echo -n "J2SDK Overlay "
- compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- echo -n "J2RE Overlay "
- compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
- fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
- compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
echo -n "J2SDK Bundle "
- compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
echo -n "Docs "
@@ -1340,18 +1263,6 @@ if [ "$CMP_PERMS" = "true" ]; then
echo -n "J2RE "
compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "J2SDK Overlay "
- compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- echo -n "J2RE Overlay "
- compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
- fi
- if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
- echo -n "J2SDK Bundle "
- compare_permissions $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
- echo -n "J2RE Bundle "
- compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
- fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
@@ -1364,17 +1275,11 @@ if [ "$CMP_TYPES" = "true" ]; then
echo -n "J2RE "
compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "J2SDK Overlay "
- compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- echo -n "J2RE Overlay "
- compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
- fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
- compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
@@ -1388,17 +1293,11 @@ if [ "$CMP_GENERAL" = "true" ]; then
echo -n "J2RE "
compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "J2SDK Overlay "
- compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- echo -n "J2RE Overlay "
- compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
- fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
- compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+ compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
- compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+ compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
echo -n "Docs "
@@ -1454,10 +1353,6 @@ if [ "$CMP_LIBS" = "true" ]; then
compare_all_libs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "Bundle "
- compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
@@ -1467,10 +1362,6 @@ if [ "$CMP_EXECS" = "true" ]; then
if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
fi
- if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
- echo -n "Overlay "
- compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
- fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
diff --git a/common/bin/compare_exceptions.sh.incl b/common/bin/compare_exceptions.sh.incl
index cace701b788..96f7fb75cbb 100644
--- a/common/bin/compare_exceptions.sh.incl
+++ b/common/bin/compare_exceptions.sh.incl
@@ -84,7 +84,9 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@@ -171,7 +173,9 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@@ -314,7 +318,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@@ -453,7 +459,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/amd64/jconsole
./bin/amd64/jdb
./bin/amd64/jhat
+./bin/amd64/jimage
./bin/amd64/jinfo
+./bin/amd64/jjs
./bin/amd64/jmap
./bin/amd64/jps
./bin/amd64/jrunscript
@@ -611,7 +619,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@@ -755,7 +765,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/sparcv9/jconsole
./bin/sparcv9/jdb
./bin/sparcv9/jhat
+./bin/sparcv9/jimage
./bin/sparcv9/jinfo
+./bin/sparcv9/jjs
./bin/sparcv9/jmap
./bin/sparcv9/jps
./bin/sparcv9/jrunscript
@@ -836,7 +848,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole.exe
./bin/jdb.exe
./bin/jhat.exe
+./bin/jimage.exe
./bin/jinfo.exe
+./bin/jjs.exe
./bin/jmap.exe
./bin/jps.exe
./bin/jrunscript.exe
@@ -930,7 +944,9 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
+./bin/jimage
./bin/jinfo
+./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
diff --git a/common/bin/unshuffle_list.txt b/common/bin/unshuffle_list.txt
index f05bd5c0c0d..cd0749c7aa8 100644
--- a/common/bin/unshuffle_list.txt
+++ b/common/bin/unshuffle_list.txt
@@ -1212,6 +1212,7 @@ jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp : jdk/src/share/classes/sun
jdk/src/java.rmi/share/doc/stub/java/rmi/activation : jdk/src/share/doc/stub/java/rmi/activation
jdk/src/java.rmi/unix/bin/java-rmi.cgi.sh : jdk/src/solaris/bin/java-rmi.cgi.sh
jdk/src/java.scripting/share/classes/javax/script : jdk/src/share/classes/javax/script
+jdk/src/java.scripting/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
jdk/src/java.security.acl/share/classes/java/security/acl : jdk/src/share/classes/java/security/acl
jdk/src/java.security.acl/share/classes/sun/security/acl : jdk/src/share/classes/sun/security/acl
jdk/src/java.security.jgss/macosx/native/libosxkrb5/nativeccache.c : jdk/src/share/native/sun/security/krb5/nativeccache.c
@@ -1301,7 +1302,6 @@ jdk/src/jdk.deploy.osx/macosx/native/libosx/JavaAppLauncher.m : jdk/src/macosx/n
jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m : jdk/src/macosx/native/apple/security/KeystoreImpl.m
jdk/src/jdk.dev/share/classes/com/sun/jarsigner : jdk/src/share/classes/com/sun/jarsigner
jdk/src/jdk.dev/share/classes/com/sun/tools/hat : jdk/src/share/classes/com/sun/tools/hat
-jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner : jdk/src/share/classes/sun/security/tools/jarsigner
jdk/src/jdk.dev/share/classes/sun/tools/jar : jdk/src/share/classes/sun/tools/jar
jdk/src/jdk.dev/share/classes/sun/tools/native2ascii : jdk/src/share/classes/sun/tools/native2ascii
diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk
index 20ae9c9f073..009162f3a00 100644
--- a/make/CompileJavaModules.gmk
+++ b/make/CompileJavaModules.gmk
@@ -235,6 +235,11 @@ endif
################################################################################
+java.scripting_COPY := .js
+java.scripting_CLEAN := .properties
+
+################################################################################
+
java.sql_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
################################################################################
@@ -318,6 +323,9 @@ jdk.charsets_COPY := .dat
################################################################################
jdk.compiler_COPY := javax.tools.JavaCompilerTool
+jdk.compiler_CLEAN_FILES := $(wildcard \
+ $(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
+ sun/tools/serialver/resources))
################################################################################
@@ -366,12 +374,6 @@ jdk.jconsole_CLEAN_FILES := $(wildcard \
################################################################################
-jdk.compiler_CLEAN_FILES := $(wildcard \
- $(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
- sun/tools/serialver/resources))
-
-################################################################################
-
jdk.jdi_EXCLUDES += \
com/sun/tools/example/debug/bdi \
com/sun/tools/example/debug/event \
@@ -426,10 +428,8 @@ jdk.localedata_EXCLUDE_FILES += sun/text/resources/th/BreakIteratorRules_th.java
#
# To use this variable, use $(call ALL_SRC_DIRS,module) with no space.
GENERATED_SRC_DIRS += \
- $(JDK_OUTPUTDIR)/gensrc/$1 \
- $(LANGTOOLS_OUTPUTDIR)/gensrc/$1 \
- $(CORBA_OUTPUTDIR)/gensrc/$1 \
- $(JDK_OUTPUTDIR)/gensrc_no_srczip/$1 \
+ $(SUPPORT_OUTPUTDIR)/gensrc/$1 \
+ $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$1 \
#
OS_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS)/classes
@@ -488,7 +488,7 @@ define SetupModuleCompilation
SRC := $$(wildcard $$(call ALL_SRC_DIRS,$1)), \
INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
BIN := $(JDK_OUTPUTDIR)/modules/$1, \
- HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers/$1, \
+ HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \
ADD_JAVAC_FLAGS := $$($1_JAVAC_FLAGS)))
$1: $$($1) $$($1_COPY_EXTRA)
diff --git a/make/Images.gmk b/make/Images.gmk
new file mode 100644
index 00000000000..93a73a5b1b7
--- /dev/null
+++ b/make/Images.gmk
@@ -0,0 +1,496 @@
+#
+# Copyright (c) 2014, 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+TOOL_TARGETS :=
+JDK_TARGETS :=
+JRE_TARGETS :=
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , Images-pre.gmk))
+
+############################################################################
+
+MAIN_MODULES += java.se java.smartcardio jdk.httpserver jdk.sctp \
+ jdk.security.auth jdk.security.jgss jdk.runtime
+
+# providers
+PROVIDER_MODULES += jdk.charsets jdk.crypto.ec jdk.crypto.pkcs11 jdk.jvmstat jdk.localedata \
+ jdk.naming.dns jdk.naming.rmi jdk.scripting.nashorn jdk.zipfs
+
+# tools
+TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev jdk.javadoc jdk.jcmd jdk.jconsole \
+ jdk.hotspot.agent jdk.hprof.agent jdk.jdi jdk.jdwp.agent jdk.rmic \
+ jdk.xml.bind jdk.xml.ws
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ PROVIDER_MODULES += jdk.crypto.mscapi
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+ PROVIDER_MODULES += jdk.crypto.ucrypto
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ MAIN_MODULES += jdk.deploy.osx
+endif
+
+JRE_MODULES := $(MAIN_MODULES) $(PROVIDER_MODULES)
+JDK_MODULES := $(JRE_MODULES) $(TOOLS_MODULES)
+
+# compact3 builds have additional modules
+JDK_COMPACT3_MODULES := java.compact3 java.smartcardio jdk.httpserver jdk.naming.dns \
+ jdk.naming.rmi jdk.sctp jdk.security.auth
+
+# Replacing double-comma with a single comma is to workaround the issue
+# with some version of make on windows that doesn't substitute spaces
+# with one comma properly as with make 4.0
+define SubstComma
+ $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(strip $1)))
+endef
+JRE_MODULES_LIST := $(call SubstComma, $(JRE_MODULES))
+JDK_MODULES_LIST := $(call SubstComma, $(JDK_MODULES))
+
+################################################################################
+
+JRE_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/jre-sorted-modules
+JDK_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/jdk-sorted-modules
+JRE_COMPACT1_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact1-sorted-modules
+JRE_COMPACT2_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact2-sorted-modules
+JRE_COMPACT3_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact3-sorted-modules
+
+
+MODULES_CMDS := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
+MODULES_LIBS := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
+MODULES_CONF := $(SUPPORT_OUTPUTDIR)/modules_conf
+
+JIMAGE_TOOL := $(JAVA_SMALL) \
+ -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
+ -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.module.ImageBuilder \
+ --cmds $(MODULES_CMDS) \
+ --libs $(MODULES_LIBS) \
+ --configs $(MODULES_CONF) \
+ --classes $(JDK_OUTPUTDIR)/modules \
+ --endian $(OPENJDK_TARGET_CPU_ENDIAN) \
+ #
+
+MODULES_XML += $(SRC_ROOT)/modules.xml
+DEPENDENCIES := $(call CacheFind, \
+ $(SUPPORT_OUTPUTDIR)/modules_cmds \
+ $(SUPPORT_OUTPUTDIR)/modules_libs) \
+ $(wildcard $(JDK_OUTPUTDIR)/modules/*/_*) \
+ $(MODULES_XML)
+ #
+
+# Use this file inside the image as target for make rule
+JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX)
+
+$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+ $(ECHO) Creating jdk jimage
+ $(RM) -r $(JDK_IMAGE_DIR) $(JDK_SORTED_MODULES)
+ $(JIMAGE_TOOL) --mods $(JDK_MODULES_LIST) --output $(JDK_IMAGE_DIR) \
+ $(MODULES_XML) > $(JDK_SORTED_MODULES)
+ $(TOUCH) $@
+
+$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+ $(ECHO) Creating jre jimage
+ $(RM) -r $(JRE_IMAGE_DIR) $(JRE_SORTED_MODULES)
+ $(JIMAGE_TOOL) --mods $(JRE_MODULES_LIST) --output $(JRE_IMAGE_DIR) \
+ $(MODULES_XML) > $(JRE_SORTED_MODULES)
+ $(TOUCH) $@
+
+JRE_COMPACT1_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact1
+JRE_COMPACT2_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact2
+JRE_COMPACT3_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact3
+
+COMPACT_EXTRA_MODULES := jdk.localedata jdk.crypto.pkcs11 jdk.crypto.ec
+
+$(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+ $(ECHO) Creating jre compact1 jimage
+ $(RM) -r $(JRE_COMPACT1_IMAGE_DIR) $(JRE_COMPACT1_SORTED_MODULES)
+ $(JIMAGE_TOOL) \
+ --mods $(call SubstComma, java.compact1 $(COMPACT_EXTRA_MODULES)) \
+ --output $(JRE_COMPACT1_IMAGE_DIR) \
+ $(MODULES_XML) > $(JRE_COMPACT1_SORTED_MODULES)
+ $(TOUCH) $@
+
+$(JRE_COMPACT2_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+ $(ECHO) Creating jre compact2 jimage
+ $(RM) -r $(JRE_COMPACT2_IMAGE_DIR) $(JRE_COMPACT2_SORTED_MODULES)
+ $(JIMAGE_TOOL) \
+ --mods $(call SubstComma, java.compact2 $(COMPACT_EXTRA_MODULES)) \
+ --output $(JRE_COMPACT2_IMAGE_DIR) \
+ $(MODULES_XML) > $(JRE_COMPACT2_SORTED_MODULES)
+ $(TOUCH) $@
+
+$(JRE_COMPACT3_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+ $(ECHO) Creating jre compact3 jimage
+ $(RM) -r $(JRE_COMPACT3_IMAGE_DIR) $(JRE_COMPACT3_SORTED_MODULES)
+ $(JIMAGE_TOOL) \
+ --mods $(call SubstComma, $(JDK_COMPACT3_MODULES) $(COMPACT_EXTRA_MODULES)) \
+ --output $(JRE_COMPACT3_IMAGE_DIR) \
+ $(MODULES_XML) > $(JRE_COMPACT3_SORTED_MODULES)
+ $(TOUCH) $@
+
+TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JDK_TARGETS := $(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JRE_COMPACT1_TARGETS := $(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JRE_COMPACT2_TARGETS := $(JRE_COMPACT2_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JRE_COMPACT3_TARGETS := $(JRE_COMPACT3_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+
+################################################################################
+# /man dir
+#
+# All variables in this section are assigned with simple =, without :, to enable
+# more selective overriding from the custom version of this file.
+#
+# Avoid evaluating this whole section on windows for speed and stability
+ifneq ($(OPENJDK_TARGET_OS), windows)
+ JRE_MAN_PAGES += \
+ java.1 \
+ jjs.1 \
+ keytool.1 \
+ orbd.1 \
+ pack200.1 \
+ policytool.1 \
+ rmid.1 \
+ rmiregistry.1 \
+ servertool.1 \
+ tnameserv.1 \
+ unpack200.1
+
+ ifndef OPENJDK
+ ifneq ($(OPENJDK_TARGET_OS), solaris)
+ JRE_MAN_PAGES += javaws.1
+ endif
+ endif
+
+ JDK_MAN_PAGES += \
+ $(JRE_MAN_PAGES) \
+ appletviewer.1 \
+ idlj.1 \
+ jar.1 \
+ jarsigner.1 \
+ javac.1 \
+ javadoc.1 \
+ javah.1 \
+ javap.1 \
+ jconsole.1 \
+ jcmd.1 \
+ jdb.1 \
+ jdeps.1 \
+ jhat.1 \
+ jinfo.1 \
+ jmap.1 \
+ jps.1 \
+ jrunscript.1 \
+ jsadebugd.1 \
+ jstack.1 \
+ jstat.1 \
+ jstatd.1 \
+ native2ascii.1 \
+ rmic.1 \
+ schemagen.1 \
+ serialver.1 \
+ wsgen.1 \
+ wsimport.1 \
+ xjc.1
+
+ # This variable is potentially overridden in the closed makefile.
+ MAN_SRC_BASEDIR ?= $(JDK_TOPDIR)/src
+
+ ifeq ($(OPENJDK_TARGET_OS), linux)
+ MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/linux/doc
+ MAN1_SUBDIR = man
+ endif
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/solaris/doc
+ MAN1_SUBDIR = sun/man/man1
+ endif
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/bsd/doc
+ MAN1_SUBDIR = man
+ endif
+
+ $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
+ $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+
+ $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
+ $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+
+ define install-ja-manpage
+ $(MKDIR) -p $(@D)
+ $(CAT) $< \
+ | $(NATIVE2ASCII) -encoding eucJP \
+ | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
+ | $(NATIVE2ASCII) -reverse -encoding $1 \
+ > $@
+ endef
+
+ $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call install-ja-manpage, UTF-8)
+
+ $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call install-ja-manpage, UTF-8)
+
+ $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call install-ja-manpage, PCK)
+
+ $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call install-ja-manpage, PCK)
+
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+
+ $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+ $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+ endif
+
+ ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
+ $(JRE_IMAGE_DIR)/man/ja:
+ $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
+
+ $(JDK_IMAGE_DIR)/man/ja:
+ $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
+ endif
+
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
+ $(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/, $(JRE_MAN_PAGES)) \
+ $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
+ $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JRE_MAN_PAGES))
+
+ JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
+ $(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/, $(JDK_MAN_PAGES)) \
+ $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
+ $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JDK_MAN_PAGES))
+ endif
+
+ ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
+ JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
+ $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
+ $(JRE_IMAGE_DIR)/man/ja
+
+ JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
+ $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
+ $(JDK_IMAGE_DIR)/man/ja
+ endif
+
+ JRE_TARGETS += $(JRE_MAN_PAGE_LIST)
+ JDK_TARGETS += $(JDK_MAN_PAGE_LIST)
+endif # Windows
+
+################################################################################
+# /include dir
+
+$(eval $(call SetupCopyFiles,COPY_INCLUDES, \
+ SRC := $(JDK_OUTPUTDIR)/include, \
+ DEST := $(JDK_IMAGE_DIR)/include, \
+ FILES := $(call CacheFind,$(JDK_OUTPUTDIR)/include)))
+
+JDK_TARGETS += $(COPY_INCLUDES)
+
+################################################################################
+# doc files
+
+JRE_DOC_FILES ?= LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
+JDK_DOC_FILES ?= LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
+JRE_DOC_LOCATION ?= $(JDK_TOPDIR)
+JDK_DOC_LOCATION ?= $(JDK_TOPDIR)
+
+JRE_DOC_TARGETS := $(addprefix $(JRE_IMAGE_DIR)/, $(JRE_DOC_FILES))
+JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/, $(JDK_DOC_FILES))
+
+# Processing license files from source area to image area
+# These are modified to have the platform specific EOL chars.
+define process-doc-file
+ $(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ LC_ALL=C $(SED) 's/$$//g' $< > $@
+ $(CHMOD) 444 $@
+endef
+
+$(JRE_IMAGE_DIR)/%: $(JRE_DOC_LOCATION)/%
+ $(process-doc-file)
+
+$(JDK_IMAGE_DIR)/%: $(JDK_DOC_LOCATION)/%
+ $(process-doc-file)
+
+JRE_TARGETS += $(JRE_DOC_TARGETS)
+JDK_TARGETS += $(JDK_DOC_TARGETS)
+
+################################################################################
+# Release file
+
+JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
+JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release
+JRE_COMPACT1_INFO_FILE := $(JRE_COMPACT1_IMAGE_DIR)/release
+JRE_COMPACT2_INFO_FILE := $(JRE_COMPACT2_IMAGE_DIR)/release
+JRE_COMPACT3_INFO_FILE := $(JRE_COMPACT3_IMAGE_DIR)/release
+
+# Common way to emit a line into the release or info file
+define info-file-item # name value
+ $(PRINTF) '%s="%s"\n' $1 $2 >> $@
+endef
+
+# Param 1 - The file containing the MODULES list
+define create-info-file
+ $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
+ $(call info-file-item, "OS_NAME", "$(REQUIRED_OS_NAME)")
+ $(call info-file-item, "OS_VERSION", "$(REQUIRED_OS_VERSION)")
+ $(call info-file-item, "OS_ARCH", "$(OPENJDK_TARGET_CPU_LEGACY)")
+ $(if $(JDK_ARCH_ABI_PROP_NAME), \
+ $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
+ $(call info-file-item, "SOURCE", "$(ALL_SOURCE_TIPS)")
+ $(call info-file-item, "MODULES", "`$(CAT) $1`")
+endef
+
+ALL_SOURCE_TIPS = $(shell \
+ if [ -f $(SUPPORT_OUTPUTDIR)/source_tips ] ; then \
+ $(CAT) $(SUPPORT_OUTPUTDIR)/source_tips ; \
+ fi)
+
+$(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+ $(call create-info-file, $(JRE_SORTED_MODULES))
+
+$(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+ $(call create-info-file, $(JDK_SORTED_MODULES))
+
+$(JRE_COMPACT1_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+ $(call create-info-file, $(JRE_COMPACT1_SORTED_MODULES))
+ $(call info-file-item, "JAVA_PROFILE", "compact1")
+
+$(JRE_COMPACT2_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+ $(call create-info-file, $(JRE_COMPACT2_SORTED_MODULES))
+ $(call info-file-item, "JAVA_PROFILE", "compact2")
+
+$(JRE_COMPACT3_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+ $(call create-info-file, $(JRE_COMPACT3_SORTED_MODULES))
+ $(call info-file-item, "JAVA_PROFILE", "compact3")
+
+JRE_TARGETS += $(JRE_INFO_FILE)
+JDK_TARGETS += $(JDK_INFO_FILE)
+JRE_COMPACT1_TARGETS += $(JRE_COMPACT1_INFO_FILE)
+JRE_COMPACT2_TARGETS += $(JRE_COMPACT2_INFO_FILE)
+JRE_COMPACT3_TARGETS += $(JRE_COMPACT3_INFO_FILE)
+
+################################################################################
+# src.zip
+
+$(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
+ $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(install-file)
+
+JDK_TARGETS += $(JDK_IMAGE_DIR)/src.zip
+
+################################################################################
+# /demo dir
+
+# The db demo contains an empty dir that needs to be copied. The other
+# directories will always trigger the rule for recompile since
+# _the.list_of_packages files are touched.
+ifneq ($(findstring images, $(MAKECMDGOALS)), )
+ $(JDK_IMAGE_DIR)/demo/%: $(SUPPORT_OUTPUTDIR)/demo/image/%
+ if [ ! -d "$@" ]; then \
+ $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
+ $(MKDIR) -p $(@D); \
+ if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
+ fi
+
+ # Find all files including directories
+ JDK_DEMO_TARGETS := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demo/image), \
+ $(patsubst $(SUPPORT_OUTPUTDIR)/demo/image/%, $(JDK_IMAGE_DIR)/demo/%, \
+ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demo/image \
+ ! \( -name "_the*" -o -name "javac_state" \) )))
+
+ JDK_TARGETS += $(JDK_DEMO_TARGETS)
+endif
+
+################################################################################
+# /sample dir
+
+$(eval $(call SetupCopyFiles,COPY_SAMPLES, \
+ SRC := $(SUPPORT_OUTPUTDIR)/sample, \
+ DEST := $(JDK_IMAGE_DIR)/sample, \
+ FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample), \
+ $(call CacheFind,$(SUPPORT_OUTPUTDIR)/sample))))
+
+JDK_TARGETS += $(COPY_SAMPLES)
+
+################################################################################
+# jrt-fs.jar
+
+$(eval $(call SetupCopyFiles,COPY_JRTFS_JAR, \
+ SRC := $(SUPPORT_OUTPUTDIR), \
+ DEST := $(JDK_IMAGE_DIR), \
+ FILES := $(SUPPORT_OUTPUTDIR)/jrt-fs.jar))
+
+JDK_TARGETS += $(COPY_JRTFS_JAR)
+
+################################################################################
+
+# Include custom post hook here to make it possible to augment the target lists
+# before actual target prerequisites are declared.
+$(eval $(call IncludeCustomExtension, , Images-post.gmk))
+
+################################################################################
+
+$(JRE_TARGETS): $(TOOL_JRE_TARGETS)
+$(JDK_TARGETS): $(TOOL_JDK_TARGETS)
+
+jimages: $(TOOL_JRE_TARGETS) $(TOOL_JDK_TARGETS) $(JRE_TARGETS) $(JDK_TARGETS)
+
+
+$(JRE_COMPACT1_TARGETS): $(TOOL_JRE_COMPACT1_TARGETS)
+$(JRE_COMPACT2_TARGETS): $(TOOL_JRE_COMPACT2_TARGETS)
+$(JRE_COMPACT3_TARGETS): $(TOOL_JRE_COMPACT3_TARGETS)
+
+profiles: $(TOOL_JRE_COMPACT1_TARGETS) \
+ $(TOOL_JRE_COMPACT2_TARGETS) \
+ $(TOOL_JRE_COMPACT3_TARGETS) \
+ $(JRE_COMPACT1_TARGETS) \
+ $(JRE_COMPACT2_TARGETS) \
+ $(JRE_COMPACT3_TARGETS)
+
+.PHONY: default all jimages profiles
diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk
index 4ba011d15d8..78cd223a745 100644
--- a/make/Javadoc.gmk
+++ b/make/Javadoc.gmk
@@ -44,8 +44,8 @@ include NON_CORE_PKGS.gmk
# Definitions for directories
#
-DOCSDIR := $(OUTPUT_ROOT)/docs
-TEMPDIR := $(OUTPUT_ROOT)/docstemp
+DOCSDIR := $(IMAGES_OUTPUTDIR)/docs
+DOCSTMPDIR = $(SUPPORT_OUTPUTDIR)/docs
HOTSPOT_DOCS_IMPORT_PATH=$(HOTSPOT_OUTPUTDIR)/docs
@@ -142,9 +142,8 @@ ALL_SOURCE_DIRS := $(wildcard \
$(CORBA_TOPDIR)/src/*/share/classes \
$(JAXP_TOPDIR)/src/*/share/classes \
$(JAXWS_TOPDIR)/src/*/share/classes \
- $(JDK_OUTPUTDIR)/gensrc/j* \
- $(JDK_OUTPUTDIR)/gendocsrc_rmic \
- $(CORBA_OUTPUTDIR)/gensrc/j* \
+ $(SUPPORT_OUTPUTDIR)/gensrc/j* \
+ $(SUPPORT_OUTPUTDIR)/rmic/j* \
$(JDK_TOPDIR)/src/*/share/doc/stub \
) \
#
@@ -201,11 +200,6 @@ define JavadocSummary # optionsfile packagesfile
@($(ECHO) "# Packages (`$(BASENAME) $2`):";$(SED) -e 's@^@# @' $2) $(LOG_DEBUG)
endef
-#
-# Temporary directory for javadoc creation
-#
-DOCSTMPDIR = $(TEMPDIR)/doctmp
-
#
# Different api directories created from root directory
#
@@ -271,7 +265,6 @@ define COMMON_JAVADOCFLAGS
$(call OptionOnly,-quiet) ; \
$(call OptionOnly,-use) ; \
$(call OptionOnly,-keywords) ; \
- $(call OptionPair,-Xprofilespath,$(JDK_TOPDIR)/make/profile-rtjar-includes.txt) ; \
$(call OptionOnly,$(ADDITIONAL_JAVADOCFLAGS))
endef
@@ -668,7 +661,7 @@ ALL_OTHER_TARGETS += jdwpdocs
JDWP_DOCDIR = $(PLATFORM_DOCSDIR)/jpda/jdwp
jdwpdocs: $(JDWP_DOCDIR)/jdwp-protocol.html
-$(JDWP_DOCDIR)/jdwp-protocol.html : $(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html
+$(JDWP_DOCDIR)/jdwp-protocol.html : $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
diff --git a/make/JrtfsJar.gmk b/make/JrtfsJar.gmk
new file mode 100644
index 00000000000..2adf6c9dca5
--- /dev/null
+++ b/make/JrtfsJar.gmk
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2014, 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+$(eval $(call SetupArchive,JRTFS_JAR, , \
+ SRCS := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
+ JAR := $(SUPPORT_OUTPUTDIR)/jrt-fs.jar, \
+ MANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf))
+
+all: $(JRTFS_JAR)
diff --git a/make/MacBundles.gmk b/make/MacBundles.gmk
new file mode 100644
index 00000000000..8b1dddc34bf
--- /dev/null
+++ b/make/MacBundles.gmk
@@ -0,0 +1,137 @@
+#
+# Copyright (c) 2011, 2013, 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 $(SPEC)
+include MakeBase.gmk
+
+default: bundles
+
+# Only macosx has bundles defined.
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+ bundles: jre-bundle jdk-bundle
+
+ # JDK_BUNDLE_DIR and JRE_BUNDLE_DIR are defined in SPEC.
+
+ MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
+
+ # All these OPENJDK checks are needed since there is no coherency between
+ # these values in open and closed. Should probably be fixed.
+ ifndef OPENJDK
+ BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
+ else
+ BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE)
+ endif
+ BUNDLE_ID_JRE := $(BUNDLE_ID).jre
+ BUNDLE_ID_JDK := $(BUNDLE_ID).jdk
+
+ BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
+ BUNDLE_NAME_JRE := $(BUNDLE_NAME)
+ BUNDLE_NAME_JDK := $(BUNDLE_NAME)
+
+ ifndef OPENJDK
+ BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
+ else
+ BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) ($(JDK_VERSION))
+ endif
+ BUNDLE_INFO_JRE := $(BUNDLE_INFO)
+ BUNDLE_INFO_JDK := $(BUNDLE_INFO)
+
+ BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
+ BUNDLE_VERSION := $(JDK_VERSION)
+ ifeq ($(COMPANY_NAME), N/A)
+ BUNDLE_VENDOR := UNDEFINED
+ else
+ BUNDLE_VENDOR := $(COMPANY_NAME)
+ endif
+
+
+ JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
+ JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
+
+ JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
+ JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
+
+ # Copy empty directories (jre/lib/applet).
+ $(JDK_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
+ $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
+
+ $(JRE_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
+ $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
+
+ $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib:
+ $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(LN) -s ../Home/lib/jli/libjli.dylib $@
+
+ $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib:
+ $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(LN) -s ../Home/lib/jli/libjli.dylib $@
+
+ $(JDK_BUNDLE_DIR)/Info.plist: $(SPEC)
+ $(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" \
+ -e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" \
+ -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" \
+ -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
+ -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
+ -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
+ < $(MACOSX_PLIST_SRC)/JDK-Info.plist > $@
+
+ $(JRE_BUNDLE_DIR)/Info.plist: $(SPEC)
+ $(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(MKDIR) -p $(@D)
+ $(SED) -e "s/@@ID@@/$(BUNDLE_ID_JRE)/g" \
+ -e "s/@@NAME@@/$(BUNDLE_NAME_JRE)/g" \
+ -e "s/@@INFO@@/$(BUNDLE_INFO_JRE)/g" \
+ -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
+ -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
+ -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
+ < $(MACOSX_PLIST_SRC)/JRE-Info.plist > $@
+
+ jdk-bundle: $(JDK_TARGET_LIST) $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib \
+ $(JDK_BUNDLE_DIR)/Info.plist
+ $(SETFILE) -a B $(dir $(JDK_BUNDLE_DIR))
+
+ jre-bundle: $(JRE_TARGET_LIST) $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib \
+ $(JRE_BUNDLE_DIR)/Info.plist
+ $(SETFILE) -a B $(dir $(JRE_BUNDLE_DIR))
+
+else # Not macosx
+
+ bundles:
+ $(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
+
+endif # macosx
+
+.PHONY: jdk-bundle jre-bundle bundles
diff --git a/make/Main.gmk b/make/Main.gmk
index 96e322ef96d..441cca28171 100644
--- a/make/Main.gmk
+++ b/make/Main.gmk
@@ -39,9 +39,6 @@ include $(SRC_ROOT)/make/MakeHelpers.gmk
include $(SRC_ROOT)/make/common/MakeBase.gmk
include $(SRC_ROOT)/make/common/Modules.gmk
-# Load common profile names definitions
-include $(JDK_TOPDIR)/make/ProfileNames.gmk
-
# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
# valid top level targets. It's used to declare them all as PHONY and to
# generate the -only targets.
@@ -64,19 +61,23 @@ ALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
################################################################################
# Interim/build tools targets, compiling tools used during the build
+buildtools-langtools:
+ +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
+
interim-langtools:
+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
interim-corba:
- +($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileCorba.gmk)
+ +($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
interim-rmic:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
-build-tools-jdk:
+buildtools-jdk:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
-ALL_TARGETS += interim-langtools interim-corba build-tools-jdk
+ALL_TARGETS += buildtools-langtools interim-langtools interim-corba \
+ interim-rmic buildtools-jdk
################################################################################
# Special targets for certain modules
@@ -87,56 +88,42 @@ import-hotspot:
unpack-sec:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
-policy-jars:
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreatePolicyJars.gmk)
-
-ALL_TARGETS += import-hotspot unpack-sec policy-jars
+ALL_TARGETS += import-hotspot unpack-sec
################################################################################
# Gensrc targets, generating source before java compilation can be done
-JDK_GENSRC_MODULES := $(call FindModulesWithMakefileFor, gensrc, Gensrc)
-LANGTOOLS_GENSRC_MODULES := jdk.compiler.tools
-CORBA_GENSRC_MODULES := java.corba
-GENSRC_MODULES := $(JDK_GENSRC_MODULES) $(LANGTOOLS_GENSRC_MODULES) \
- $(CORBA_GENSRC_MODULES)
-JDK_GENSRC_TARGETS := $(addsuffix -gensrc, $(JDK_GENSRC_MODULES))
-LANGTOOLS_GENSRC_TARGETS := $(addsuffix -gensrc, $(LANGTOOLS_GENSRC_MODULES))
-CORBA_GENSRC_TARGETS := $(addsuffix -gensrc, $(CORBA_GENSRC_MODULES))
-GENSRC_TARGETS := $(addsuffix -gensrc, $(GENSRC_MODULES))
+$(eval $(call DeclareRecipesForPhase, GENSRC, \
+ TARGET_SUFFIX := gensrc, \
+ FILE_PREFIX := Gensrc, \
+ MAKE_SUBDIR := gensrc, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ MULTIPLE_MAKEFILES := true))
-jdk.compiler.tools-gensrc:
- +($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcLangtools.gmk)
-
-java.corba-gensrc:
- +($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcCorba.gmk)
-
-# Declare recipes for all jdk -gensrc targets
-$(foreach m, $(JDK_GENSRC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, gensrc, gensrc, Gensrc)))
+JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
+LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
+CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
ALL_TARGETS += $(GENSRC_TARGETS)
################################################################################
# Generate data targets
-GENDATA_MODULES := $(call FindModulesWithMakefileFor, gendata, Gendata)
-GENDATA_TARGETS := $(addsuffix -gendata, $(GENDATA_MODULES))
-
-# Declare recipes for all -gendata targets
-$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, gendata, gendata, Gendata)))
-
-$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareGendataRecipe,$m)))
+$(eval $(call DeclareRecipesForPhase, GENDATA, \
+ TARGET_SUFFIX := gendata, \
+ FILE_PREFIX := Gendata, \
+ MAKE_SUBDIR := gendata, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ USE_WRAPPER := true))
ALL_TARGETS += $(GENDATA_TARGETS)
################################################################################
# Copy files targets
-COPY_MODULES := $(call FindModulesWithMakefileFor, copy, Copy)
-COPY_TARGETS := $(addsuffix -copy, $(COPY_MODULES))
-
-# Declare recipes for all -copy targets
-$(foreach m, $(COPY_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, copy, copy, Copy)))
+$(eval $(call DeclareRecipesForPhase, COPY, \
+ TARGET_SUFFIX := copy, \
+ FILE_PREFIX := Copy, \
+ MAKE_SUBDIR := copy, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ USE_WRAPPER := true))
ALL_TARGETS += $(COPY_TARGETS)
@@ -163,36 +150,33 @@ ALL_TARGETS += $(JAVA_TARGETS)
################################################################################
# Targets for running rmic.
-RMIC_MODULES := $(call FindModulesWithMakefileFor, rmic, Rmic)
-RMIC_TARGETS := $(addsuffix -rmic, $(RMIC_MODULES))
-
-# Declare recipes for all -rmic targets
-$(foreach m, $(RMIC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, rmic, rmic, Rmic)))
+$(eval $(call DeclareRecipesForPhase, RMIC, \
+ TARGET_SUFFIX := rmic, \
+ FILE_PREFIX := Rmic, \
+ MAKE_SUBDIR := rmic, \
+ CHECK_MODULES := $(ALL_MODULES)))
ALL_TARGETS += $(RMIC_TARGETS)
################################################################################
# Targets for compiling native libraries
-ALL_LIB_MODULES := $(call FindModulesWithMakefileFor, lib, Lib)
-LIB_MODULES := $(filter $(ALL_MODULES), $(ALL_LIB_MODULES))
-LIB_TARGETS := $(addsuffix -libs, $(LIB_MODULES))
+$(eval $(call DeclareRecipesForPhase, LIBS, \
+ TARGET_SUFFIX := libs, \
+ FILE_PREFIX := Lib, \
+ MAKE_SUBDIR := lib, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ USE_WRAPPER := true))
-# Declare recipes for all -libs targets
-$(foreach m, $(LIB_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, libs, lib, Lib)))
-
-ALL_TARGETS += $(LIB_TARGETS)
+ALL_TARGETS += $(LIBS_TARGETS)
################################################################################
# Targets for compiling native executables
-ALL_LAUNCHER_MODULES := $(call FindModulesWithMakefileFor, launcher, Launcher)
-LAUNCHER_MODULES := $(filter $(ALL_MODULES), $(ALL_LAUNCHER_MODULES))
-LAUNCHER_TARGETS := $(addsuffix -launchers, $(LAUNCHER_MODULES))
-
-# Declare recipes for all -launchers targets
-$(foreach m, $(LAUNCHER_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
- $m, launchers, launcher, Launcher)))
+$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
+ TARGET_SUFFIX := launchers, \
+ FILE_PREFIX := Launcher, \
+ MAKE_SUBDIR := launcher, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ USE_WRAPPER := true))
ALL_TARGETS += $(LAUNCHER_TARGETS)
@@ -222,53 +206,40 @@ ALL_TARGETS += demos samples
# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
# used to track the exact sources used to build that image.
-source-tips: $(OUTPUT_ROOT)/source_tips
-$(OUTPUT_ROOT)/source_tips: FRC
+source-tips: $(SUPPORT_OUTPUTDIR)/source_tips
+$(SUPPORT_OUTPUTDIR)/source_tips: FRC
@$(MKDIR) -p $(@D)
@$(RM) $@
@$(call GetSourceTips)
-security-jars:
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateSecurityJars.gmk)
-
-nashorn-jar:
- +($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk all)
-
-# Creates the jar files (rt.jar resources.jar etc)
-main-jars:
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f CreateJars.gmk)
-
-# Creates the images (j2sdk-image j2re-image etc)
-images:
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f Images.gmk)
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk)
- endif
-
-# Create Compact Profile jars
-PROFILE_JARS_TARGETS := $(addsuffix -jars, $(ALL_PROFILES))
-$(PROFILE_JARS_TARGETS):
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-jars=%) -f CreateJars.gmk)
-
-# Create Compact Profile images
-PROFILE_IMAGES_TARGETS := $(addsuffix -images, $(ALL_PROFILES))
-$(PROFILE_IMAGES_TARGETS):
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-images=%) \
- JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/j2re-$(word $(call profile_number,$(@:%-images=%)),$(PROFILE_NAMES))-image \
- -f Images.gmk profile-image)
-
-profiles-oscheck:
- ifneq ($(OPENJDK_TARGET_OS), linux)
- @echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
- endif
-
+BOOTCYCLE_TARGET := images
bootcycle-images:
@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
- +$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk images
+ +$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
-ALL_TARGETS += source-tips security-jars nashorn-jar main-jars images \
- $(PROFILE_JARS_TARGETS) $(PROFILE_IMAGES_TARGETS) profiles-oscheck \
- bootcycle-images
+zip-security:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
+
+zip-source:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
+
+strip-binaries:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
+
+jrtfs-jar:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
+
+jimages:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
+
+profiles:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
+
+mac-bundles:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
+
+ALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
+ jrtfs-jar jimages profiles mac-bundles
################################################################################
# Docs targets
@@ -331,17 +302,19 @@ ALL_TARGETS += install
ifneq ($(findstring -only, $(MAKECMDGOALS)), )
.NOTPARALLEL:
else
+ $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
+
interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
- build-tools-jdk: interim-langtools
+ buildtools-jdk: interim-langtools
$(CORBA_GENSRC_TARGETS): interim-langtools
- $(JDK_GENSRC_TARGETS): interim-langtools build-tools-jdk
+ $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
interim-corba: $(CORBA_GENSRC_TARGETS)
- $(GENDATA_TARGETS): interim-langtools build-tools-jdk
+ $(GENDATA_TARGETS): interim-langtools buildtools-jdk
interim-rmic: interim-langtools
@@ -349,7 +322,7 @@ else
import-hotspot: hotspot
- $(LIB_TARGETS): import-hotspot
+ $(LIBS_TARGETS): import-hotspot
$(LAUNCHER_TARGETS): java.base-libs
@@ -371,55 +344,53 @@ else
# Declare dependencies from -lib to -java
# Skip jdk.jdwp.agent as it contains no java code.
- $(foreach m, $(filter-out jdk.jdwp.agent, $(LIB_MODULES)), $(eval $m-libs: $m-java))
+ $(foreach m, $(filter-out jdk.jdwp.agent, $(LIBS_MODULES)), $(eval $m-libs: $m-java))
# Declare dependencies from all other -lib to java.base-lib
- $(foreach t, $(filter-out java.base-libs, $(LIB_TARGETS)), \
+ $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
$(eval $t: java.base-libs))
# Declare the special case dependency for jdk.deploy.osx where libosx
# links against libosxapp.
jdk.deploy.osx-libs: java.desktop-libs
- # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
- # header file used by jdk.jdwp libs.
- jdk.jdwp.agent-libs: jdk.jdi-gensrc
+ # This dependency needs to be explicitly declared as jdk.jdi-gensrc generates a
+ # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
+ # virtual target.
+ jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
+
+ # Until the module system is in place, jdk.jdi-gensrc needs to combine service
+ # loader configuration with jdk.hotspot.agent so is dependent on importing
+ # hotspot.
+ jdk.jdi-gensrc-jdk: import-hotspot
# The swing beans need to have java base properly generated to avoid errors
# in javadoc.
- java.desktop-gensrc: java.base-gensrc
+ java.desktop-gensrc-jdk: java.base-gensrc
# Explicitly add dependencies for special targets
java.base-java: unpack-sec
jdk.dev-gendata: java rmic
- security-jars: java
+ zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
+ $(filter jdk.crypto%, $(JAVA_TARGETS))
- nashorn-jar: jdk.scripting.nashorn-java
+ zip-source: gensrc rmic
- main-jars: java rmic security-jars nashorn-jar policy-jars import-hotspot gendata
+ strip-binaries: libs launchers gendata copy
- # On windows, the jars target needs to wait for jgss libs to be built.
- # Should ideally split out the sec-bin zip file generation to avoid
- # this dependency.
- ifeq ($(OPENJDK_TARGET_OS), windows)
- main-jars: java.security.jgss-libs
- endif
+ jrtfs-jar: buildtools-jdk
- images: jars demos samples exploded-image verify-modules source-tips
+ jimages: exploded-image zip-source strip-binaries source-tips demos samples \
+ jrtfs-jar
- bootcycle-images: images
+ profiles: exploded-image strip-binaries source-tips
- # Need to depend on jars as otherwise there will a race between all the
- # invocations of CreateJars.gmk.
- $(PROFILE_JARS_TARGETS): jars profiles-oscheck
+ mac-bundles: jimages
- $(PROFILE_IMAGES_TARGETS): demos samples exploded-image source-tips
+ bootcycle-images: jimages
- # Declare dependencies from -images to -jars
- $(foreach p, $(ALL_PROFILES), $(eval $p-images: $p-jars))
-
- docs-javadoc: $(GENSRC_TARGETS) rmic
+ docs-javadoc: gensrc rmic
docs-jvmtidoc: hotspot
@@ -432,6 +403,9 @@ endif
################################################################################
# Virtual targets without recipes
+buildtools: buildtools-langtools interim-langtools interim-corba interim-rmic \
+ buildtools-jdk
+
gensrc: $(GENSRC_TARGETS)
gendata: $(GENDATA_TARGETS)
@@ -442,12 +416,13 @@ java: $(JAVA_TARGETS)
rmic: $(RMIC_TARGETS)
-libs: $(LIB_TARGETS)
+libs: $(LIBS_TARGETS)
launchers: $(LAUNCHER_TARGETS)
-# Explicitly add dependencies for these special targets
-java.base: import-hotspot policy-jars
+# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
+# is actually handled by jdk.jdi-gensrc
+jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
# Declare dependencies from to all the individual targets specific
# to that module -*.
@@ -455,34 +430,33 @@ $(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
-$(foreach m, $(LIB_MODULES), $(eval $m: $m-libs))
+$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
- $(GENDATA_MODULES) $(LIB_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
+ $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
exploded-image: $(ALL_MODULE_TARGETS)
# The old 'jdk' target most closely matches the new exploded-image. Keep an
# alias for ease of use.
jdk: exploded-image
-jars: main-jars nashorn-jar security-jars policy-jars
+images: jimages demos samples zip-security
-# Make each profile name a target that depends on it's images target.
-$(foreach p, $(ALL_PROFILES), $(eval $(p): $(p)-images $(p)-jars))
-
-profiles: $(ALL_PROFILES)
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ images: mac-bundles
+endif
docs: docs-javadoc docs-jvmtidoc
-ALL_TARGETS += gensrc gendata copy java rmic libs launchers \
- $(ALL_MODULE_TARGETS) exploded-image jdk jars \
- $(ALL_PROFILES) profiles docs
+ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
+ jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) exploded-image jdk images \
+ docs
################################################################################
-all: images docs
+all: images
default: exploded-image
ALL_TARGETS += default all
@@ -496,17 +470,38 @@ ALL_TARGETS += default all
# Clean targets are automatically run serially by the Makefile calling this
# file.
-CLEAN_COMPONENTS += langtools corba hotspot jdk nashorn images \
- bootcycle-build docs docstemp test make-support
-CLEAN_TARGETS := $(addprefix clean-, $(CLEAN_COMPONENTS))
+CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
+ images make-support
+CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
+CLEAN_PHASES := gensrc java native include
+CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
+CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
+# Construct targets of the form clean-$module-$phase
+CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
+ $(addprefix $m-, $(CLEAN_PHASES))))
# Remove everything, except the output from configure.
-clean: $(CLEAN_TARGETS)
- ($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
+clean: $(CLEAN_DIR_TARGETS)
+ ($(CD) $(OUTPUT_ROOT) && $(RM) -r source_tips build.log* build-trace*.log*)
$(ECHO) Cleaned all build artifacts.
-$(CLEAN_TARGETS):
- $(call CleanComponent,$(patsubst clean-%, %, $@))
+$(CLEAN_DIR_TARGETS):
+ $(call CleanDir,$(patsubst clean-%, %, $@))
+
+$(CLEAN_PHASE_TARGETS):
+ $(call Clean-$(patsubst clean-%,%, $@))
+
+$(CLEAN_MODULE_TARGETS):
+ $(call CleanModule,$(patsubst clean-%, %, $@))
+
+$(CLEAN_MODULE_PHASE_TARGETS):
+ $(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
+ $(word 2, $(subst -,$(SPACE),$@)))
+
+# When removing the support dir, we must also remove jdk. Building classes has
+# the side effect of generating native headers. The headers end up in support
+# while classes and touch files end up in jdk.
+clean-support: clean-jdk
clean-docs: clean-docstemp
@@ -525,7 +520,8 @@ dist-clean: clean
)
$(ECHO) Cleaned everything, you will have to re-run configure.
-ALL_TARGETS += clean dist-clean $(CLEAN_TARGETS)
+ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_PHASE_TARGETS) \
+ $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
################################################################################
@@ -557,7 +553,7 @@ ALL_TARGETS += reconfigure
# Declare *-only targets for each normal target
$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
-ALL_TARGETS += $(addsuffix -only, $(ALL_TARGETS))
+ALL_TARGETS += $(addsuffix -only, $(filter-out clean%, $(ALL_TARGETS)))
################################################################################
diff --git a/make/MakeHelpers.gmk b/make/MakeHelpers.gmk
index 62b9add30cd..d9146e200d9 100644
--- a/make/MakeHelpers.gmk
+++ b/make/MakeHelpers.gmk
@@ -46,7 +46,7 @@ list_alt_overrides_with_origins=$(filter ALT_%=environment ALT_%=command,$(forea
list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
# Store the build times in this directory.
-BUILDTIMESDIR=$(OUTPUT_ROOT)/tmp/buildtimes
+BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times
# Global targets are possible to run either with or without a SPEC. The prototypical
# global target is "help".
@@ -296,38 +296,139 @@ endef
### Convenience functions from Main.gmk
-# Cleans the component given as $1
-define CleanComponent
+# Cleans the dir given as $1
+define CleanDir
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
@($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
@$(PRINTF) " done\n"
endef
+define Clean-gensrc
+ @$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1)
+ @$(PRINTF) " done\n"
+endef
+
+define Clean-java
+ @$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
+ @$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1)
+ @$(PRINTF) " done\n"
+ @$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
+ @$(PRINTF) " done\n"
+endef
+
+define Clean-native
+ @$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..."
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
+ @$(PRINTF) " done\n"
+endef
+
+define Clean-include
+ @$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..."
+ @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
+ @$(PRINTF) " done\n"
+endef
+
+define CleanModule
+ $(call Clean-gensrc, $1)
+ $(call Clean-java, $1)
+ $(call Clean-native, $1)
+ $(call Clean-include, $1)
+endef
+
+
################################################################################
-MAKE_DIR_LIST := $(JDK_TOPDIR)/make
+MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR)
+MAKE_MAKEDIR_LIST := make
-# Find all modules that has a makefile for a certain build phase
-# Param 1: Make subdir to look in
-# Param 2: File prefix to look for
-FindModulesWithMakefileFor = $(sort $(foreach d, $(MAKE_DIR_LIST), \
- $(patsubst $d/$(strip $1)/$(strip $2)-%.gmk,%, \
- $(wildcard $d/$(strip $1)/$(strip $2)-*.gmk))))
-
-# Declare a recipe for calling such a makefile
-# Param 1: Module name
-# Param 2: Suffix for rule
-# Param 3: Make subdir
-# Param 4: Makefile prefix
+# Helper macro for DeclareRecipesForPhase
+# Declare a recipe for calling the module and phase specific makefile.
+# If there are multiple makefiles to call, create a rule for each topdir
+# that contains a makefile with the target $module-$suffix-$repodir,
+# (i.e: java.base-gensrc-jdk)
+# Normally there is only one makefile, and the target will just be
+# $module-$suffix
+# Param 1: Name of list to add targets to
+# Param 2: Module name
+# Param 3: Topdir
define DeclareRecipeForModuleMakefile
- $$(strip $1)-$$(strip $2):
- +($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix /$$(strip $3)/$$(strip $4)-$$(strip $1).gmk, \
- $(MAKE_DIR_LIST))))) \
+ ifeq ($$($1_MULTIPLE_MAKEFILES), true)
+ $2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
+ $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
+
+ $2-$$($1_TARGET_SUFFIX)-$$(notdir $3):
+ else
+ $2-$$($1_TARGET_SUFFIX):
+ endif
+ $(ECHO) $(LOG_INFO) "Building $$@"
+ ifeq ($$($1_USE_WRAPPER), true)
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
+ -f ModuleWrapper.gmk \
+ $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
+ $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
+ MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
+ else
+ +($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \
+ $3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \
&& $(MAKE) $(MAKE_ARGS) \
- -f $$(strip $4)-$$(strip $1).gmk \
- $$(addprefix -I, $$(wildcard $(MAKE_DIR_LIST) \
- $$(addsuffix /$$(strip $3), $(MAKE_DIR_LIST)))) \
- MODULE=$$(strip $1))
+ -f $$($1_FILE_PREFIX)-$2.gmk \
+ $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
+ $$(addsuffix /$3, $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
+ MODULE=$2)
+ endif
+
+endef
+
+# Helper macro for DeclareRecipesForPhase
+# Param 1: Name of list to add targets to
+# Param 2: Module name
+define DeclareRecipesForPhaseAndModule
+ $1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \
+ $$(patsubst $$d/%, $$d, $$(filter $$d/%, \
+ $$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \
+ $$(foreach s, $(MAKE_MAKEDIR_LIST), \
+ $$(addsuffix /$$s, $(MAKE_TOPDIR_LIST))))))))))
+
+ # Only declare recipes if there are makefiles to call
+ ifneq ($$($1_$2_TOPDIRS), )
+ $$(foreach d, $$($1_$2_TOPDIRS), \
+ $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d)))
+ $1 += $2-$$($1_TARGET_SUFFIX)
+ $1_MODULES += $2
+ endif
+endef
+
+# Declare recipes for a specific module and build phase if there are makefiles
+# present for the specific combination.
+# Param 1: Name of list to add targets to
+# Named params:
+# TARGET_SUFFIX : Suffix of target to create for recipe
+# MAKE_SUBDIR : Subdir for this build phase
+# FILE_PREFIX : File prefix for this build phase
+# USE_WRAPPER : Set to true to use ModuleWrapper.gmk
+# CHECK_MODULES : List of modules to try
+# MULTIPLE_MAKEFILES : Set to true to handle makefils for the same module in
+# phase in multiple repos
+# Exported variables:
+# $1_MODULES : All modules that had rules generated
+# $1_TARGETS : All targets generated
+define DeclareRecipesForPhase
+ $(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE))
+ $(if $(8),$(error Internal makefile error: Too many arguments to \
+ DeclareRecipesForPhase, please update MakeHelper.gmk))
+
+ $$(foreach m, $$($(strip $1)_CHECK_MODULES), \
+ $$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m)))
+
+ $(strip $1)_TARGETS := $$($(strip $1))
endef
################################################################################
diff --git a/make/ModuleWrapper.gmk b/make/ModuleWrapper.gmk
new file mode 100644
index 00000000000..40d2c837b97
--- /dev/null
+++ b/make/ModuleWrapper.gmk
@@ -0,0 +1,88 @@
+#
+# Copyright (c) 2014, 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.
+#
+
+################################################################################
+# This makefile is called from Main.gmk, through a macro in MakeHelpers.gmk
+# and wraps calls to makefiles for specific modules and build phases. Having
+# this wrapper reduces the need for boilerplate code. It also provides
+# opportunity for automatic copying of files to an interim exploded runnable
+# image.
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+# All makefiles should add the targets to be built to this variable.
+TARGETS :=
+
+# Include the file being wrapped.
+include $(MAKEFILE_PREFIX)-$(MODULE).gmk
+
+# Setup copy rules from the modules directories to the jdk image directory.
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
+
+ $(eval $(call SetupCopyFiles,COPY_LIBS_TO_BIN, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/bin, \
+ FILES := $(filter $(TO_BIN_FILTER), \
+ $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+ $(TARGETS)))))
+
+ $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/lib, \
+ FILES := $(filter-out $(TO_BIN_FILTER), \
+ $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+ $(TARGETS)))))
+
+else
+ $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/lib, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+ $(TARGETS))))
+endif
+
+$(eval $(call SetupCopyFiles,COPY_INCLUDE, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/include, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)/%, \
+ $(TARGETS))))
+
+$(eval $(call SetupCopyFiles,COPY_CMDS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/bin, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS))))
+
+$(eval $(call SetupCopyFiles,COPY_CONF, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/conf, \
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)/%, \
+ $(TARGETS))))
+
+all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
+ $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF)
diff --git a/make/StripBinaries.gmk b/make/StripBinaries.gmk
new file mode 100644
index 00000000000..92bb17159a2
--- /dev/null
+++ b/make/StripBinaries.gmk
@@ -0,0 +1,99 @@
+#
+# Copyright (c) 2014, 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+################################################################################
+# Copy native libraries and executables to a secondary location to strip them
+# and filter out files that shouldn't go into the image.
+
+MODULES_CMDS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
+MODULES_LIBS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
+
+ifneq ($(POST_STRIP_CMD), )
+ define StripRecipe
+ $(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
+ $(MKDIR) -p $(@D)
+ $(CP) $< $@.tmp
+ $(CHMOD) u+w $@.tmp
+ $(POST_STRIP_CMD) $@.tmp
+ $(if $(POST_MCS_CMD), $(POST_MCS_CMD) $@.tmp)
+ $(CHMOD) go-w $@.tmp
+ $(MV) $@.tmp $@
+ endef
+else
+ define StripRecipe
+ $(call install-file)
+ endef
+endif
+
+# Don't include debug info for executables.
+ALL_CMDS_SRC := $(filter-out %.debuginfo %.diz %.map %.pdb, \
+ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds -type f -o -type l))
+COPY_CMDS_SRC := $(filter %.cgi, $(ALL_CMDS_SRC))
+STRIP_CMDS_SRC := $(filter-out $(COPY_CMDS_SRC), $(ALL_CMDS_SRC))
+
+# Make sure symbolic links are copied and not stripped
+COPY_LIBS_SRC := \
+ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
+ \( ! -name '*$(SHARED_LIBRARY_SUFFIX)' -type f \) -o -type l)
+STRIP_LIBS_SRC := \
+ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
+ -name '*$(SHARED_LIBRARY_SUFFIX)' -type f)
+
+# On Windows, don't include debug info for libs either.
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ COPY_LIBS_SRC := $(filter-out %.diz %.map %.pdb, $(COPY_LIBS_SRC))
+endif
+
+$(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
+ DEST := $(MODULES_CMDS_STRIPPED), \
+ FILES := $(STRIP_CMDS_SRC), \
+ MACRO := StripRecipe))
+
+$(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
+ DEST := $(MODULES_CMDS_STRIPPED), \
+ FILES := $(COPY_CMDS_SRC)))
+
+$(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
+ DEST := $(MODULES_LIBS_STRIPPED), \
+ FILES := $(STRIP_LIBS_SRC), \
+ MACRO := StripRecipe))
+
+$(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
+ DEST := $(MODULES_LIBS_STRIPPED), \
+ FILES := $(COPY_LIBS_SRC)))
+
+TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
+ $(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
+
+all: $(TARGETS)
diff --git a/make/ZipSecurity.gmk b/make/ZipSecurity.gmk
new file mode 100644
index 00000000000..c894a8a33bb
--- /dev/null
+++ b/make/ZipSecurity.gmk
@@ -0,0 +1,104 @@
+#
+# Copyright (c) 2014, 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+##########################################################################################
+#
+# sec-bin.zip is used by builds where the corresponding sources are not available
+#
+$(eval $(call SetupZipArchive,BUILD_SEC_BIN_ZIP, \
+ SRC := $(JDK_OUTPUTDIR), \
+ INCLUDES := \
+ modules/java.base/javax/crypto \
+ modules/java.base/javax/crypto/spec \
+ modules/java.base/sun/security/internal/interfaces \
+ modules/java.base/sun/security/internal/spec \
+ modules/java.base/com/sun/crypto/provider \
+ modules/jdk.crypto.ec/sun/security/ec \
+ modules/jdk.crypto.mscapi/sun/security/mscapi \
+ modules/jdk.crypto.pkcs11/sun/security/pkcs11 \
+ modules/jdk.crypto.pkcs11/sun/security/pkcs11/wrapper \
+ modules/jdk.crypto.ucrypto/com/oracle/security/ucrypto \
+ modules/java.base/javax/net \
+ modules/java.base/javax/security/cert \
+ modules/java.base/com/sun/net/ssl \
+ modules/java.base/com/sun/security/cert \
+ modules/java.base/sun/net/www/protocol/https \
+ modules/java.base/sun/security/pkcs12 \
+ modules/java.base/sun/security/ssl \
+ modules/java.security.jgss/sun/security/krb5 \
+ modules/java.security.jgss/sun/security/krb5/internal \
+ modules/java.security.jgss/sun/security/krb5/internal/ccache \
+ modules/java.security.jgss/sun/security/krb5/internal/crypto \
+ modules/java.security.jgss/sun/security/krb5/internal/ktab \
+ modules/java.security.jgss/sun/security/krb5/internal/rcache \
+ modules/java.security.jgss/sun/security/krb5/internal/util, \
+ INCLUDE_FILES := modules/java.security.jgss/sun/security/jgss/spi/GSSContextSpi.class, \
+ EXCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
+ ZIP := $(IMAGES_OUTPUTDIR)/sec-bin.zip))
+
+TARGETS += $(IMAGES_OUTPUTDIR)/sec-bin.zip
+
+##########################################################################################
+#
+# Windows specific binary security packages.
+#
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ # sec-windows-bin.zip is used by builds where the corresponding sources are not available
+ $(eval $(call SetupZipArchive,BUILD_SEC_WINDOWS_BIN_ZIP, \
+ SRC := $(JDK_OUTPUTDIR), \
+ INCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
+ ZIP := $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip))
+
+ TARGETS += $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip
+
+ # JGSS files contain the native Kerberos library
+ ifeq ($(OPENJDK_TARGET_CPU), x86_64)
+ JGSS_ZIP_NAME = jgss-windows-x64-bin.zip
+ else
+ JGSS_ZIP_NAME = jgss-windows-i586-bin.zip
+ endif
+
+ $(eval $(call SetupZipArchive,BUILD_JGSS_BIN_ZIP, \
+ SRC := $(SUPPORT_OUTPUTDIR), \
+ INCLUDE_FILES := modules_libs/java.security.jgss/w2k_lsa_auth.dll \
+ modules_libs/java.security.jgss/w2k_lsa_auth.diz \
+ modules_libs/java.security.jgss/w2k_lsa_auth.map \
+ modules_libs/java.security.jgss/w2k_lsa_auth.pdb, \
+ ZIP := $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)))
+
+ TARGETS += $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)
+endif
+
+##########################################################################################
+
+all: $(TARGETS)
+
+.PHONY: default all
diff --git a/make/ZipSource.gmk b/make/ZipSource.gmk
new file mode 100644
index 00000000000..52bf6aa5149
--- /dev/null
+++ b/make/ZipSource.gmk
@@ -0,0 +1,88 @@
+#
+# Copyright (c) 2014, 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , ZipSource.gmk))
+
+################################################################################
+
+# Use ?= to enable override in custom makefile
+SRC_ZIP_INCLUDES ?= \
+ com \
+ java \
+ javax \
+ jdk \
+ org \
+ sun \
+ #
+
+SRC_ZIP_EXCLUDES ?=
+
+SRC_ZIP_SRCS += $(wildcard \
+ $(JDK_TOPDIR)/src/*/share/classes \
+ $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
+ $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \
+ $(LANGTOOLS_TOPDIR)/src/*/share/classes \
+ $(CORBA_TOPDIR)/src/*/share/classes \
+ $(JAXP_TOPDIR)/src/*/share/classes \
+ $(JAXWS_TOPDIR)/src/*/share/classes \
+ $(SUPPORT_OUTPUTDIR)/gensrc/j* \
+ $(SUPPORT_OUTPUTDIR)/rmic/j* \
+ ) \
+ #
+
+# Need to copy launcher src files into desired directory structure
+# before zipping the sources.
+$(eval $(call SetupCopyFiles,COPY_LAUNCHER_SRC, \
+ SRC := $(JDK_TOPDIR)/src/java.base, \
+ DEST := $(SUPPORT_OUTPUTDIR)/src/launcher, \
+ FLATTEN := true, \
+ FILES := $(wildcard \
+ $(JDK_TOPDIR)/src/java.base/share/native/launcher/* \
+ $(JDK_TOPDIR)/src/java.base/share/native/libjli/* \
+ $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/java_md*)))
+
+# This dir needs to exist before macro is evaluated to avoid warning from find.
+$(eval $(call MakeDir, $(SUPPORT_OUTPUTDIR)/src))
+$(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \
+ SRC := $(SRC_ZIP_SRCS) $(SUPPORT_OUTPUTDIR)/src, \
+ INCLUDES := $(SRC_ZIP_INCLUDES) launcher, \
+ EXCLUDES := $(SRC_ZIP_EXCLUDES), \
+ EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \
+ SUFFIXES := .java .c .h, \
+ ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \
+ EXTRA_DEPS := $(COPY_LAUNCHER_SRC)))
+
+################################################################################
+
+all: $(BUILD_SRC_ZIP)
+
+.PHONY: default all
diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk
index 5c3ea73ca7d..8a89c14a56b 100644
--- a/make/common/JavaCompilation.gmk
+++ b/make/common/JavaCompilation.gmk
@@ -325,10 +325,16 @@ define SetupZipArchive
$1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
endif
ifneq ($$($1_EXCLUDES),)
- $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
$1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
+ $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
endif
+ ifneq ($$($1_EXCLUDE_FILES),)
+ # Cannot precompute ZIP_EXCLUDE_FILES as it is dependent on which src root is being
+ # zipped at the moment.
+ $1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES)
+ $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDE_FILES), $$($1_ALL_SRCS))
+ endif
# Use a slightly shorter name for logging, but with enough path to identify this zip.
$1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
@@ -343,7 +349,10 @@ define SetupZipArchive
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
$(MKDIR) -p $$(@D)
$(ECHO) Updating $$($1_NAME)
- $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true
+ $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) \
+ $$($1_ZIP_EXCLUDES) -x \*_the.\* \
+ $$(addprefix -x$(SPACE), $$(patsubst $$i/%,%, $$($1_EXCLUDE_FILES))) \
+ || test "$$$$?" = "12" )$$(NEWLINE)) true
$(TOUCH) $$@
# Add zip to target list
diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk
index 16bb629313e..f1d9a27ce6f 100644
--- a/make/common/Modules.gmk
+++ b/make/common/Modules.gmk
@@ -64,6 +64,7 @@ $(eval $(call SetupJavaCompilation,BUILD_GENMODULESLIST, \
SETUP := BOOT_JAVAC, \
SRC := $(JDK_TOPDIR)/make/src/classes, \
INCLUDES := build/tools/module, \
+ EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
DISABLE_SJAVAC := true))
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
index fe82cd2730e..5a5bc99b38c 100644
--- a/make/common/NativeCompilation.gmk
+++ b/make/common/NativeCompilation.gmk
@@ -450,13 +450,11 @@ define SetupNativeCompilation
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
- # This dependency dance ensures that windows debug info files get rebuilt
- # properly if deleted.
- $$($1_TARGET): $$($1_DEBUGINFO_FILES)
- $$($1_DEBUGINFO_FILES): $$($1_EXPECTED_OBJS)
-
else ifeq ($(OPENJDK_TARGET_OS), solaris)
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
+ # Setup the command line creating debuginfo files, to be run after linking.
+ # It cannot be run separately since it updates the original target file
+ #
# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
# Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
# empty section headers until a fixed $(OBJCOPY) is available.
@@ -466,29 +464,34 @@ define SetupNativeCompilation
#
# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
- $$($1_DEBUGINFO_FILES): $$($1_TARGET) \
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
- $(RM) $$@
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
- $(OBJCOPY) --only-keep-debug $$< $$@
- $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
- $(TOUCH) $$@
+ $1_CREATE_DEBUGINFO_CMDS := \
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$($1_TARGET) $$(NEWLINE) \
+ $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+ $(CD) $$($1_OUTPUT_DIR) && \
+ $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$($1_DEBUGINFO_FILES) $$($1_TARGET)
+ $1_DEBUGINFO_EXTRA_DEPS := $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
else ifeq ($(OPENJDK_TARGET_OS), linux)
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
- $$($1_DEBUGINFO_FILES): $$($1_TARGET)
- $(RM) $$@
- $(OBJCOPY) --only-keep-debug $$< $$@
- $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
- $(TOUCH) $$@
+ # Setup the command line creating debuginfo files, to be run after linking.
+ # It cannot be run separately since it updates the original target file
+ $1_CREATE_DEBUGINFO_CMDS := \
+ $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+ $(CD) $$($1_OUTPUT_DIR) && \
+ $(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
endif # No MacOS X support
+ # This dependency dance ensures that debug info files get rebuilt
+ # properly if deleted.
+ $$($1_TARGET): $$($1_DEBUGINFO_FILES)
+ $$($1_DEBUGINFO_FILES): $$($1_EXPECTED_OBJS)
+
ifeq ($(ZIP_DEBUGINFO_FILES), true)
$1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
$1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
- # The dependency on TARGET is needed on windows for debuginfo files
+ # The dependency on TARGET is needed for debuginfo files
# to be rebuilt properly.
$$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
$(CD) $$($1_OBJECT_DIR) \
@@ -504,29 +507,31 @@ define SetupNativeCompilation
ifneq (,$$($1_LIBRARY))
# Generating a dynamic library.
- $1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
+ $1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
ifeq ($(OPENJDK_TARGET_OS), windows)
- $1_EXTRA_LDFLAGS+="-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
+ $1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
endif
$1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
- $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE)
- $$(call LINKING_MSG,$$($1_BASENAME))
- $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
- $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
- $$($1_EXTRA_LDFLAGS_SUFFIX)
- # Touch target to make sure it has a later time stamp than the debug
- # symbol files to avoid unnecessary relinking on rebuild.
- ifeq ($(OPENJDK_TARGET_OS), windows)
- $(TOUCH) $$@
- endif
+ $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \
+ $$($1_DEBUGINFO_EXTRA_DEPS)
+ $$(call LINKING_MSG,$$($1_BASENAME))
+ $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
+ $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
+ $$($1_EXTRA_LDFLAGS_SUFFIX)
+ $$($1_CREATE_DEBUGINFO_CMDS)
+ # Touch target to make sure it has a later time stamp than the debug
+ # symbol files to avoid unnecessary relinking on rebuild.
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $(TOUCH) $$@
+ endif
endif
ifneq (,$$($1_STATIC_LIBRARY))
# Generating a static library, ie object file archive.
- $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES)
+ $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES)
$$(call ARCHIVING_MSG,$$($1_LIBRARY))
$(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \
$$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
@@ -536,26 +541,28 @@ define SetupNativeCompilation
# A executable binary has been specified, setup the target for it.
$1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
- $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST)
- $$(call LINKING_EXE_MSG,$$($1_BASENAME))
- $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
- $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
- $$($1_EXTRA_LDFLAGS_SUFFIX)
- ifneq (,$$($1_GEN_MANIFEST))
- $(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
- endif
- # This only works if the openjdk_codesign identity is present on the system. Let
- # silently fail otherwise.
- ifneq (,$(CODESIGN))
- ifneq (,$$($1_CODESIGN))
- $(CODESIGN) -s openjdk_codesign $$@
- endif
- endif
- # Touch target to make sure it has a later time stamp than the debug
- # symbol files to avoid unnecessary relinking on rebuild.
- ifeq ($(OPENJDK_TARGET_OS), windows)
- $(TOUCH) $$@
- endif
+ $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST) \
+ $$($1_DEBUGINFO_EXTRA_DEPS)
+ $$(call LINKING_EXE_MSG,$$($1_BASENAME))
+ $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
+ $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
+ $$($1_EXTRA_LDFLAGS_SUFFIX)
+ ifneq (,$$($1_GEN_MANIFEST))
+ $(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
+ endif
+ # This only works if the openjdk_codesign identity is present on the system. Let
+ # silently fail otherwise.
+ ifneq (,$(CODESIGN))
+ ifneq (,$$($1_CODESIGN))
+ $(CODESIGN) -s openjdk_codesign $$@
+ endif
+ endif
+ $$($1_CREATE_DEBUGINFO_CMDS)
+ # Touch target to make sure it has a later time stamp than the debug
+ # symbol files to avoid unnecessary relinking on rebuild.
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $(TOUCH) $$@
+ endif
endif
endef
diff --git a/make/common/SetupJavaCompilers.gmk b/make/common/SetupJavaCompilers.gmk
index c9aa92075e5..1706dc91da7 100644
--- a/make/common/SetupJavaCompilers.gmk
+++ b/make/common/SetupJavaCompilers.gmk
@@ -48,10 +48,13 @@ $(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
# The generate old bytecode javac setup uses the new compiler to compile for the
# boot jdk to generate tools that need to be run with the boot jdk.
# Thus we force the target bytecode to the previous JDK version.
+# Add -Xlint:-options to avoid the warning about not setting -bootclasspath. Since
+# it's running on the boot jdk, the default bootclasspath is correct.
$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
JVM := $(JAVA_SMALL), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS), \
+ FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true \
+ $(DISABLE_WARNINGS) -Xlint:-options, \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -61,8 +64,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -source 9 -target 9 \
- -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS) \
- $(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
+ -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -72,8 +74,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -source 9 -target 9 \
- -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS) \
- $(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
+ -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
diff --git a/make/jprt.properties b/make/jprt.properties
index 1a268de8353..2254cfe823b 100644
--- a/make/jprt.properties
+++ b/make/jprt.properties
@@ -181,8 +181,8 @@ my.make.rule.test.targets.svc= \
${my.test.target.set:TESTNAME=jdk_instrument}, \
${my.test.target.set:TESTNAME=jdk_jmx}, \
${my.test.target.set:TESTNAME=jdk_jdi}, \
- ${my.test.target.set:TESTNAME=jdk_jfr}, \
- ${my.test.target.set:TESTNAME=svc_tools}
+ ${my.test.target.set:TESTNAME=svc_tools}, \
+ ${my.make.rule.test.targets.svc.extra}
# All vm test targets (testset=all)
my.test.targets.all= \
diff --git a/modules.xml b/modules.xml
index 6103b0aa875..8cfeb74f2b6 100644
--- a/modules.xml
+++ b/modules.xml
@@ -210,6 +210,10 @@
com.sun.security.ntlm
java.security.sasl
+
+ jdk.internal.jimage
+ jdk.dev
+
jdk.internal.org.objectweb.asm
jdk.jfr
From 92828b7e7cd070bc7e271df19ae984e7871241b6 Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Wed, 3 Dec 2014 14:20:24 +0000
Subject: [PATCH 30/37] 8049367: Modular Run-Time Images
Co-authored-by: Alan Bateman
Co-authored-by: Alex Buckley
Co-authored-by: Bradford Wetmore
Co-authored-by: Erik Joelsson
Co-authored-by: James Laskey
Co-authored-by: Jonathan Gibbons
Co-authored-by: Karen Kinnear
Co-authored-by: Magnus Ihse Bursie
Co-authored-by: Mandy Chung
Co-authored-by: Mark Reinhold
Co-authored-by: Paul Sandoz
Co-authored-by: Sundararajan Athijegannathan
Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
---
corba/make/CommonCorba.gmk | 53 ----------------
.../{CompileCorba.gmk => CompileInterim.gmk} | 19 ++----
corba/make/copy/Copy-java.corba.gmk | 34 +++++++++++
.../Gensrc-java.corba.gmk} | 60 ++++++++++---------
.../classes/sun/rmi/rmic/iiop/Generator.java | 2 +-
5 files changed, 72 insertions(+), 96 deletions(-)
delete mode 100644 corba/make/CommonCorba.gmk
rename corba/make/{CompileCorba.gmk => CompileInterim.gmk} (78%)
create mode 100644 corba/make/copy/Copy-java.corba.gmk
rename corba/make/{GensrcCorba.gmk => gensrc/Gensrc-java.corba.gmk} (81%)
diff --git a/corba/make/CommonCorba.gmk b/corba/make/CommonCorba.gmk
deleted file mode 100644
index 11b69b6f715..00000000000
--- a/corba/make/CommonCorba.gmk
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Copyright (c) 2014, 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.
-#
-
-################################################################################
-# The Corba sources are old and generates a LOT of warnings.
-# Disable these using Xlint, until someone cares to fix them.
-DISABLE_CORBA_WARNINGS := -Xlint:all,-deprecation,-unchecked,-serial,-fallthrough,-cast,-rawtypes,-static,-dep-ann
-
-# The "generate old bytecode" javac setup uses the new compiler to compile for the
-# boot jdk to generate tools that need to be run with the boot jdk.
-# Thus we force the target bytecode to the boot jdk bytecode.
-$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
- JVM := $(JAVA), \
- JAVAC := $(NEW_JAVAC), \
- FLAGS := $(BOOT_JDK_SOURCETARGET) \
- -bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(BOOT_TOOLSJAR)" \
- $(DISABLE_CORBA_WARNINGS), \
- SERVER_DIR := $(SJAVAC_SERVER_DIR), \
- SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-
-# The "generate new bytecode" uses the new compiler to generate bytecode
-# for the new jdk that is being built. The code compiled by this setup
-# cannot necessarily be run with the boot jdk.
-$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \
- JVM := $(JAVA), \
- JAVAC := $(NEW_JAVAC), \
- FLAGS := -cp $(BOOT_TOOLSJAR) -XDignore.symbol.file=true $(DISABLE_CORBA_WARNINGS), \
- SERVER_DIR := $(SJAVAC_SERVER_DIR), \
- SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-
-################################################################################
diff --git a/corba/make/CompileCorba.gmk b/corba/make/CompileInterim.gmk
similarity index 78%
rename from corba/make/CompileCorba.gmk
rename to corba/make/CompileInterim.gmk
index 3a03e800ec5..7f7e1fdfb98 100644
--- a/corba/make/CompileCorba.gmk
+++ b/corba/make/CompileInterim.gmk
@@ -29,16 +29,16 @@ default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
-
-include CommonCorba.gmk
+include SetupJavaCompilers.gmk
################################################################################
$(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes \
+ SRC := $(JDK_TOPDIR)/src/jdk.rmic/share/classes \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes \
$(CORBA_TOPDIR)/src/jdk.rmic/share/classes \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba, \
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
EXCLUDES := com/sun/corba/se/PortableActivationIDL, \
EXCLUDE_FILES := com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
@@ -47,16 +47,9 @@ $(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
com/sun/corba/se/impl/presentation/rmi/jndi.properties, \
COPY := .prp, \
CLEAN := .properties, \
- BIN := $(CORBA_OUTPUTDIR)/interim_classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_interim_classes, \
JAR := $(INTERIM_CORBA_JAR)))
################################################################################
-# Copy idl files straight to jdk/include.
-$(JDK_OUTPUTDIR)/include/%: $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/%
- $(install-file)
-IDL_TARGET_FILES := $(JDK_OUTPUTDIR)/include/orb.idl $(JDK_OUTPUTDIR)/include/ir.idl
-
-################################################################################
-
-all: $(BUILD_INTERIM_CORBA) $(IDL_TARGET_FILES)
+all: $(BUILD_INTERIM_CORBA)
diff --git a/corba/make/copy/Copy-java.corba.gmk b/corba/make/copy/Copy-java.corba.gmk
new file mode 100644
index 00000000000..fbc26a5833b
--- /dev/null
+++ b/corba/make/copy/Copy-java.corba.gmk
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2014, 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.
+#
+
+################################################################################
+# Copy idl files to jdk/lib.
+$(eval $(call SetupCopyFiles,COPY_IDL, \
+ SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl, \
+ DEST := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
+ FILES := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl))
+
+TARGETS := $(COPY_IDL)
diff --git a/corba/make/GensrcCorba.gmk b/corba/make/gensrc/Gensrc-java.corba.gmk
similarity index 81%
rename from corba/make/GensrcCorba.gmk
rename to corba/make/gensrc/Gensrc-java.corba.gmk
index 1951cd43e37..11e242afe32 100644
--- a/corba/make/GensrcCorba.gmk
+++ b/corba/make/gensrc/Gensrc-java.corba.gmk
@@ -29,35 +29,37 @@ include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include IdlCompilation.gmk
-
-include CommonCorba.gmk
+include SetupJavaCompilers.gmk
################################################################################
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_CORBA, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(CORBA_TOPDIR)/make/src/classes, \
- BIN := $(CORBA_OUTPUTDIR)/tools_classes))
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes))
-TOOL_LOGUTIL_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/tools_classes \
+TOOL_LOGUTIL_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes \
build.tools.logutil.MC
$(eval $(call SetupJavaCompilation,BUILD_IDLJ, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
- BIN := $(CORBA_OUTPUTDIR)/idlj_classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/idlj_classes, \
COPY := .prp, \
INCLUDES := com/sun/tools/corba/se/idl, \
EXCLUDE_FILES := ResourceBundleUtil.java))
# Force the language to english for predictable source code generation.
-TOOL_IDLJ_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/idlj_classes \
+TOOL_IDLJ_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/idlj_classes \
-Duser.language=en com.sun.tools.corba.se.idl.toJavaPortable.Compile
################################################################################
+EXCEPTION_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging
+LOGWRAPPER_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/_logwrappers
+
# Generate LogWrapper classes
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/%SystemException.java: \
+$(EXCEPTION_DIR)/%SystemException.java: \
$(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
$(BUILD_TOOLS_CORBA)
$(MKDIR) -p $(@D)
@@ -66,21 +68,21 @@ $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/%SystemExcept
$(TOOL_LOGUTIL_CMD) make-class $< $(@D)
# Generate LogWrapper properties file by concatening resource files
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/LogStrings.properties: \
- $(CORBA_OUTPUTDIR)/logwrappers/ActivationSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/IORSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/InterceptorsSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/NamingSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/OMGSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/ORBUtilSystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/POASystemException.resource \
- $(CORBA_OUTPUTDIR)/logwrappers/UtilSystemException.resource
+$(EXCEPTION_DIR)/LogStrings.properties: \
+ $(LOGWRAPPER_DIR)/ActivationSystemException.resource \
+ $(LOGWRAPPER_DIR)/IORSystemException.resource \
+ $(LOGWRAPPER_DIR)/InterceptorsSystemException.resource \
+ $(LOGWRAPPER_DIR)/NamingSystemException.resource \
+ $(LOGWRAPPER_DIR)/OMGSystemException.resource \
+ $(LOGWRAPPER_DIR)/ORBUtilSystemException.resource \
+ $(LOGWRAPPER_DIR)/POASystemException.resource \
+ $(LOGWRAPPER_DIR)/UtilSystemException.resource
$(MKDIR) -p $(@D)
$(ECHO) $(LOG_INFO) Concatenating 8 resource files into $(@F)
$(CAT) $^ > $@
# The resources files are generated from lisp-like .mc files.
-$(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource: \
+$(LOGWRAPPER_DIR)/%SystemException.resource: \
$(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
$(BUILD_TOOLS_CORBA)
$(MKDIR) -p $(@D)
@@ -90,15 +92,15 @@ $(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource: \
LOGWRAPPER_TARGETS := \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/ActivationSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/IORSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/InterceptorsSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/NamingSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/OMGSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/ORBUtilSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/POASystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/UtilSystemException.java \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/LogStrings.properties
+ $(EXCEPTION_DIR)/ActivationSystemException.java \
+ $(EXCEPTION_DIR)/IORSystemException.java \
+ $(EXCEPTION_DIR)/InterceptorsSystemException.java \
+ $(EXCEPTION_DIR)/NamingSystemException.java \
+ $(EXCEPTION_DIR)/OMGSystemException.java \
+ $(EXCEPTION_DIR)/ORBUtilSystemException.java \
+ $(EXCEPTION_DIR)/POASystemException.java \
+ $(EXCEPTION_DIR)/UtilSystemException.java \
+ $(EXCEPTION_DIR)/LogStrings.properties
################################################################################
# Build the IDLs.
@@ -215,7 +217,7 @@ IDL_DELETES := \
$(eval $(call SetupIdlCompilation,BUILD_IDLS, \
IDLJ := $(TOOL_IDLJ_CMD), \
SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
- BIN := $(CORBA_OUTPUTDIR)/gensrc/java.corba, \
+ BIN := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
EXCLUDES := com/sun/tools/corba/se/idl/% \
org/omg/CORBA/% \
com/sun/corba/se/GiopIDL/% \
@@ -230,12 +232,12 @@ $(BUILD_IDLS): $(BUILD_IDLJ)
################################################################################
# zh_HK is just a copy of zh_TW
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
+$(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
$(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
$(install-file)
################################################################################
all: $(BUILD_IDLS) $(LOGWRAPPER_TARGETS) \
- $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
diff --git a/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java b/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
index e775120460c..a19e1ea519f 100644
--- a/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
+++ b/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
@@ -352,7 +352,7 @@ public abstract class Generator implements sun.rmi.rmic.Generator,
env.output(Main.getText("rmic.generated", file.getPath(), Long.toString(duration)));
}
if (sourceFile) {
- env.parseFile(new ClassFile(file));
+ env.parseFile(ClassFile.newClassFile(file));
}
} catch (IOException e) {
env.error(0, "cant.write", file.toString());
From 393a39afe3f2ddc267d16238f8767fc9321200ea Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Wed, 3 Dec 2014 14:21:14 +0000
Subject: [PATCH 31/37] 8049367: Modular Run-Time Images
Co-authored-by: Alan Bateman
Co-authored-by: Alex Buckley
Co-authored-by: Bradford Wetmore
Co-authored-by: Erik Joelsson
Co-authored-by: James Laskey
Co-authored-by: Jonathan Gibbons
Co-authored-by: Karen Kinnear
Co-authored-by: Magnus Ihse Bursie
Co-authored-by: Mandy Chung
Co-authored-by: Mark Reinhold
Co-authored-by: Paul Sandoz
Co-authored-by: Sundararajan Athijegannathan
Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
---
hotspot/make/bsd/makefiles/sa.make | 6 +-
hotspot/src/os/aix/vm/os_aix.cpp | 15 +-
hotspot/src/os/bsd/vm/os_bsd.cpp | 24 +-
hotspot/src/os/linux/vm/os_linux.cpp | 15 +-
hotspot/src/os/solaris/vm/os_solaris.cpp | 20 +-
hotspot/src/os/windows/vm/os_windows.cpp | 30 +-
.../src/share/vm/classfile/classLoader.cpp | 119 +++++-
.../src/share/vm/classfile/classLoader.hpp | 27 +-
hotspot/src/share/vm/classfile/imageFile.cpp | 286 +++++++++++++++
hotspot/src/share/vm/classfile/imageFile.hpp | 343 ++++++++++++++++++
.../vm/classfile/sharedPathsMiscInfo.cpp | 2 +-
hotspot/src/share/vm/memory/filemap.cpp | 13 +-
hotspot/src/share/vm/memory/filemap.hpp | 7 +-
hotspot/src/share/vm/runtime/arguments.cpp | 152 +++++---
hotspot/src/share/vm/runtime/arguments.hpp | 13 +-
hotspot/src/share/vm/runtime/globals.hpp | 3 +
hotspot/src/share/vm/runtime/os.cpp | 12 +-
hotspot/src/share/vm/runtime/os.hpp | 1 +
hotspot/src/share/vm/runtime/statSampler.cpp | 2 -
19 files changed, 944 insertions(+), 146 deletions(-)
create mode 100644 hotspot/src/share/vm/classfile/imageFile.cpp
create mode 100644 hotspot/src/share/vm/classfile/imageFile.hpp
diff --git a/hotspot/make/bsd/makefiles/sa.make b/hotspot/make/bsd/makefiles/sa.make
index 11503127bbb..a67df867bc7 100644
--- a/hotspot/make/bsd/makefiles/sa.make
+++ b/hotspot/make/bsd/makefiles/sa.make
@@ -63,6 +63,10 @@ else
SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH))
endif
+ifneq ($(SA_CLASSPATH),)
+ SA_CLASSPATH_ARG := -classpath $(SA_CLASSPATH)
+endif
+
# TODO: if it's a modules image, check if SA module is installed.
MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
@@ -114,7 +118,7 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
# are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
- $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
+ $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) $(SA_CLASSPATH_ARG) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp
index d0765c4c1fc..a8f416e00a5 100644
--- a/hotspot/src/os/aix/vm/os_aix.cpp
+++ b/hotspot/src/os/aix/vm/os_aix.cpp
@@ -512,15 +512,13 @@ void os::init_system_properties_values() {
#define DEFAULT_LIBPATH "/usr/lib:/lib"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
// Buffer that fits several sprintfs.
// Note that the space for the trailing null is provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -571,15 +569,10 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef DEFAULT_LIBPATH
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@@ -2778,6 +2771,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return ::read(fd, buf, nBytes);
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ return ::pread(fd, buf, nBytes, offset);
+}
+
void os::naked_short_sleep(jlong ms) {
struct timespec req;
diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp
index a42e3bf19ba..716c7af9f9a 100644
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp
@@ -353,7 +353,6 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
#ifndef __APPLE__
@@ -361,9 +360,8 @@ void os::init_system_properties_values() {
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -425,10 +423,6 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#else // __APPLE__
@@ -445,9 +439,8 @@ void os::init_system_properties_values() {
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // for dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size, // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // for dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -525,10 +518,6 @@ void os::init_system_properties_values() {
user_home_dir, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef SYS_EXTENSIONS_DIR
@@ -538,7 +527,6 @@ void os::init_system_properties_values() {
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@@ -2576,6 +2564,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes));
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ RESTARTABLE_RETURN_INT(::pread(fd, buf, nBytes, offset));
+}
+
void os::naked_short_sleep(jlong ms) {
struct timespec req;
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 202e3612171..3204697bc27 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -337,15 +337,13 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -410,16 +408,11 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef DEFAULT_LIBPATH
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@@ -3783,6 +3776,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return ::read(fd, buf, nBytes);
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ return ::pread(fd, buf, nBytes, offset);
+}
+
// Short sleep, direct OS call.
//
// Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee
diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp
index 8fcc883f0a6..f32c23469c4 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp
@@ -609,17 +609,15 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/jdk/packages"
#define EXTENSIONS_DIR "/lib/ext"
-#define ENDORSED_DIR "/lib/endorsed"
char cpu_arch[12];
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
- MAX4((size_t)MAXPATHLEN, // For dll_dir & friends.
+ MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch), // invariant ld_library_path
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
- (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -765,15 +763,10 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
- // Endorsed standards default directory.
- sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
- Arguments::set_endorsed_dirs(buf);
-
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
}
void os::breakpoint() {
@@ -3164,6 +3157,15 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return res;
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ size_t res;
+ JavaThread* thread = (JavaThread*)Thread::current();
+ assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm");
+ ThreadBlockInVM tbiv(thread);
+ RESTARTABLE(::pread(fd, buf, (size_t) nBytes, offset), res);
+ return res;
+}
+
size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
size_t res;
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
index 4a3109bef47..b2841b4aa40 100644
--- a/hotspot/src/os/windows/vm/os_windows.cpp
+++ b/hotspot/src/os/windows/vm/os_windows.cpp
@@ -292,19 +292,6 @@ void os::init_system_properties_values() {
#undef BIN_DIR
#undef PACKAGE_DIR
- // Default endorsed standards directory.
- {
-#define ENDORSED_DIR "\\lib\\endorsed"
- size_t len = strlen(Arguments::get_java_home()) + sizeof(ENDORSED_DIR);
- char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal);
- sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR);
- Arguments::set_endorsed_dirs(buf);
- // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
- // duplicates the input.)
- FREE_C_HEAP_ARRAY(char, buf, mtInternal);
-#undef ENDORSED_DIR
- }
-
#ifndef _WIN64
// set our UnhandledExceptionFilter and save any previous one
prev_uef_handler = SetUnhandledExceptionFilter(Handle_FLT_Exception);
@@ -4376,6 +4363,23 @@ jlong os::lseek(int fd, jlong offset, int whence) {
return (jlong) ::_lseeki64(fd, offset, whence);
}
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+ OVERLAPPED ov;
+ DWORD nread;
+ BOOL result;
+
+ ZeroMemory(&ov, sizeof(ov));
+ ov.Offset = (DWORD)offset;
+ ov.OffsetHigh = (DWORD)(offset >> 32);
+
+ HANDLE h = (HANDLE)::_get_osfhandle(fd);
+
+ result = ReadFile(h, (LPVOID)buf, nBytes, &nread, &ov);
+
+ return result ? nread : 0;
+}
+
+
// This method is a slightly reworked copy of JDK's sysNativePath
// from src/windows/hpi/src/path_md.c
diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp
index 780fea1c2a3..619ee210a6d 100644
--- a/hotspot/src/share/vm/classfile/classLoader.cpp
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp
@@ -28,6 +28,7 @@
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/classLoaderData.inline.hpp"
+#include "classfile/imageFile.hpp"
#include "classfile/javaClasses.hpp"
#if INCLUDE_CDS
#include "classfile/sharedPathsMiscInfo.hpp"
@@ -67,7 +68,7 @@
#include "utilities/hashtable.hpp"
#include "utilities/hashtable.inline.hpp"
-// Entry points in zip.dll for loading zip/jar file entries
+// Entry points in zip.dll for loading zip/jar file entries and image file entries
typedef void * * (JNICALL *ZipOpen_t)(const char *name, char **pmsg);
typedef void (JNICALL *ZipClose_t)(jzfile *zip);
@@ -75,6 +76,7 @@ typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *siz
typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
+typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
typedef jint (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
static ZipOpen_t ZipOpen = NULL;
@@ -84,6 +86,7 @@ static ReadEntry_t ReadEntry = NULL;
static ReadMappedEntry_t ReadMappedEntry = NULL;
static GetNextEntry_t GetNextEntry = NULL;
static canonicalize_fn_t CanonicalizeEntry = NULL;
+static ZipInflateFully_t ZipInflateFully = NULL;
static Crc32_t Crc32 = NULL;
// Globals
@@ -322,6 +325,8 @@ LazyClassPathEntry::~LazyClassPathEntry() {
}
bool LazyClassPathEntry::is_jar_file() {
+ size_t len = strlen(_path);
+ if (len < 4 || strcmp(_path + len - 4, ".jar") != 0) return false;
return ((_st.st_mode & S_IFREG) == S_IFREG);
}
@@ -385,6 +390,78 @@ u1* LazyClassPathEntry::open_entry(const char* name, jint* filesize, bool nul_te
}
}
+ClassPathImageEntry::ClassPathImageEntry(char* name) : ClassPathEntry(), _image(new ImageFile(name)) {
+ bool opened = _image->open();
+ if (!opened) {
+ _image = NULL;
+ }
+}
+
+ClassPathImageEntry::~ClassPathImageEntry() {
+ if (_image) {
+ _image->close();
+ _image = NULL;
+ }
+}
+
+const char* ClassPathImageEntry::name() {
+ return _image ? _image->name() : "";
+}
+
+ClassFileStream* ClassPathImageEntry::open_stream(const char* name, TRAPS) {
+ u1* buffer;
+ u8 size;
+ _image->get_resource(name, buffer, size);
+
+ if (buffer) {
+ if (UsePerfData) {
+ ClassLoader::perf_sys_classfile_bytes_read()->inc(size);
+ }
+ return new ClassFileStream(buffer, (int)size, (char*)name); // Resource allocated
+ }
+
+ return NULL;
+}
+
+#ifndef PRODUCT
+void ClassPathImageEntry::compile_the_world(Handle loader, TRAPS) {
+ tty->print_cr("CompileTheWorld : Compiling all classes in %s", name());
+ tty->cr();
+ const ImageStrings strings = _image->get_strings();
+ // Retrieve each path component string.
+ u4 count = _image->get_location_count();
+ for (u4 i = 0; i < count; i++) {
+ u1* location_data = _image->get_location_data(i);
+
+ if (location_data) {
+ ImageLocation location(location_data);
+ const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+ const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+ const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+ assert((strlen(parent) + strlen(base) + strlen(extension)) < JVM_MAXPATHLEN, "path exceeds buffer");
+ char path[JVM_MAXPATHLEN];
+ strcpy(path, parent);
+ strcat(path, base);
+ strcat(path, extension);
+ ClassLoader::compile_the_world_in(path, loader, CHECK);
+ }
+ }
+ if (HAS_PENDING_EXCEPTION) {
+ if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
+ CLEAR_PENDING_EXCEPTION;
+ tty->print_cr("\nCompileTheWorld : Ran out of memory\n");
+ tty->print_cr("Increase class metadata storage if a limit was set");
+ } else {
+ tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n");
+ }
+ }
+}
+
+bool ClassPathImageEntry::is_jrt() {
+ return string_ends_with(name(), "bootmodules.jimage");
+}
+#endif
+
static void print_meta_index(LazyClassPathEntry* entry,
GrowableArray& meta_packages) {
tty->print("[Meta index for %s=", entry->name());
@@ -634,7 +711,7 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
}
ClassPathEntry* new_entry = NULL;
if ((st->st_mode & S_IFREG) == S_IFREG) {
- // Regular file, should be a zip file
+ // Regular file, should be a zip or image file
// Canonicalized filename
char canonical_path[JVM_MAXPATHLEN];
if (!get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
@@ -645,6 +722,11 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
return NULL;
}
}
+ // TODO - add proper criteria for selecting image file
+ ClassPathImageEntry* entry = new ClassPathImageEntry(canonical_path);
+ if (entry->is_open()) {
+ new_entry = entry;
+ } else {
char* error_msg = NULL;
jzfile* zip;
{
@@ -655,9 +737,6 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
}
if (zip != NULL && error_msg == NULL) {
new_entry = new ClassPathZipEntry(zip, path);
- if (TraceClassLoading || TraceClassPaths) {
- tty->print_cr("[Opened %s]", path);
- }
} else {
ResourceMark rm(thread);
char *msg;
@@ -675,10 +754,14 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
return NULL;
}
}
+ }
+ if (TraceClassLoading || TraceClassPaths) {
+ tty->print_cr("[Opened %s]", path);
+ }
} else {
// Directory
new_entry = new ClassPathDirEntry(path);
- if (TraceClassLoading || TraceClassPaths) {
+ if (TraceClassLoading) {
tty->print_cr("[Path %s]", path);
}
}
@@ -801,6 +884,7 @@ void ClassLoader::load_zip_library() {
ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
+ ZipInflateFully = CAST_TO_FN_PTR(ZipInflateFully_t, os::dll_lookup(handle, "ZIP_InflateFully"));
Crc32 = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
// ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
@@ -809,12 +893,20 @@ void ClassLoader::load_zip_library() {
vm_exit_during_initialization("Corrupted ZIP library", path);
}
+ if (ZipInflateFully == NULL) {
+ vm_exit_during_initialization("Corrupted ZIP library ZIP_InflateFully missing", path);
+ }
+
// Lookup canonicalize entry in libjava.dll
void *javalib_handle = os::native_java_library();
CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, os::dll_lookup(javalib_handle, "Canonicalize"));
// This lookup only works on 1.3. Do not check for non-null here
}
+jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {
+ return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
+}
+
int ClassLoader::crc32(int crc, const char* buf, int len) {
assert(Crc32 != NULL, "ZIP_CRC32 is not found");
return (*Crc32)(crc, (const jbyte*)buf, len);
@@ -1367,8 +1459,7 @@ void ClassPathDirEntry::compile_the_world(Handle loader, TRAPS) {
tty->cr();
}
-
-bool ClassPathDirEntry::is_rt_jar() {
+bool ClassPathDirEntry::is_jrt() {
return false;
}
@@ -1393,13 +1484,13 @@ void ClassPathZipEntry::compile_the_world(Handle loader, TRAPS) {
}
}
-bool ClassPathZipEntry::is_rt_jar() {
+bool ClassPathZipEntry::is_jrt() {
real_jzfile* zip = (real_jzfile*) _zip;
int len = (int)strlen(zip->name);
// Check whether zip name ends in "rt.jar"
// This will match other archives named rt.jar as well, but this is
// only used for debugging.
- return (len >= 6) && (strcasecmp(zip->name + len - 6, "rt.jar") == 0);
+ return string_ends_with(zip->name, "rt.jar");
}
void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
@@ -1409,7 +1500,7 @@ void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
}
}
-bool LazyClassPathEntry::is_rt_jar() {
+bool LazyClassPathEntry::is_jrt() {
Thread* THREAD = Thread::current();
ClassPathEntry* cpe = resolve_entry(THREAD);
return (cpe != NULL) ? cpe->is_jar_file() : false;
@@ -1428,7 +1519,7 @@ void ClassLoader::compile_the_world() {
jlong start = os::javaTimeMillis();
while (e != NULL) {
// We stop at rt.jar, unless it is the first bootstrap path entry
- if (e->is_rt_jar() && e != _first_entry) break;
+ if (e->is_jrt() && e != _first_entry) break;
e->compile_the_world(system_class_loader, CATCH);
e = e->next();
}
@@ -1476,9 +1567,9 @@ static bool can_be_compiled(methodHandle m, int comp_level) {
}
void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
- int len = (int)strlen(name);
- if (len > 6 && strcmp(".class", name + len - 6) == 0) {
+ if (string_ends_with(name, ".class")) {
// We have a .class file
+ int len = (int)strlen(name);
char buffer[2048];
strncpy(buffer, name, len - 6);
buffer[len-6] = 0;
diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp
index f69de2ec2cd..3c9d5fb3ae8 100644
--- a/hotspot/src/share/vm/classfile/classLoader.hpp
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp
@@ -66,7 +66,7 @@ class ClassPathEntry: public CHeapObj {
virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0;
// Debugging
NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;)
- NOT_PRODUCT(virtual bool is_rt_jar() = 0;)
+ NOT_PRODUCT(virtual bool is_jrt() = 0;)
};
@@ -80,7 +80,7 @@ class ClassPathDirEntry: public ClassPathEntry {
ClassFileStream* open_stream(const char* name, TRAPS);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
- NOT_PRODUCT(bool is_rt_jar();)
+ NOT_PRODUCT(bool is_jrt();)
};
@@ -112,7 +112,7 @@ class ClassPathZipEntry: public ClassPathEntry {
void contents_do(void f(const char* name, void* context), void* context);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
- NOT_PRODUCT(bool is_rt_jar();)
+ NOT_PRODUCT(bool is_jrt();)
};
@@ -138,7 +138,25 @@ class LazyClassPathEntry: public ClassPathEntry {
virtual bool is_lazy();
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
- NOT_PRODUCT(bool is_rt_jar();)
+ NOT_PRODUCT(bool is_jrt();)
+};
+
+// For java image files
+class ImageFile;
+class ClassPathImageEntry: public ClassPathEntry {
+private:
+ ImageFile *_image;
+public:
+ bool is_jar_file() { return false; }
+ bool is_open() { return _image != NULL; }
+ const char* name();
+ ClassPathImageEntry(char* name);
+ ~ClassPathImageEntry();
+ ClassFileStream* open_stream(const char* name, TRAPS);
+
+ // Debugging
+ NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
+ NOT_PRODUCT(bool is_jrt();)
};
class PackageHashtable;
@@ -226,6 +244,7 @@ class ClassLoader: AllStatic {
// to avoid confusing the zip library
static bool get_canonical_path(const char* orig, char* out, int len);
public:
+ static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
static int crc32(int crc, const char* buf, int len);
static bool update_class_path_entry_list(const char *path,
bool check_for_duplicates,
diff --git a/hotspot/src/share/vm/classfile/imageFile.cpp b/hotspot/src/share/vm/classfile/imageFile.cpp
new file mode 100644
index 00000000000..4d4370f6a63
--- /dev/null
+++ b/hotspot/src/share/vm/classfile/imageFile.cpp
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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 "precompiled.hpp"
+#include "classfile/imageFile.hpp"
+#include "runtime/os.inline.hpp"
+#include "utilities/bytes.hpp"
+
+
+// Compute the Perfect Hashing hash code for the supplied string.
+u4 ImageStrings::hash_code(const char* string, u4 seed) {
+ u1* bytes = (u1*)string;
+
+ // Compute hash code.
+ for (u1 byte = *bytes++; byte; byte = *bytes++) {
+ seed = (seed * HASH_MULTIPLIER) ^ byte;
+ }
+
+ // Ensure the result is unsigned.
+ return seed & 0x7FFFFFFF;
+}
+
+// Test to see if string begins with start. If so returns remaining portion
+// of string. Otherwise, NULL.
+const char* ImageStrings::starts_with(const char* string, const char* start) {
+ char ch1, ch2;
+
+ // Match up the strings the best we can.
+ while ((ch1 = *string) && (ch2 = *start)) {
+ if (ch1 != ch2) {
+ // Mismatch, return NULL.
+ return NULL;
+ }
+
+ string++, start++;
+ }
+
+ // Return remainder of string.
+ return string;
+}
+
+ImageLocation::ImageLocation(u1* data) {
+ // Deflate the attribute stream into an array of attributes.
+ memset(_attributes, 0, sizeof(_attributes));
+ u1 byte;
+
+ while ((byte = *data) != ATTRIBUTE_END) {
+ u1 kind = attribute_kind(byte);
+ u1 n = attribute_length(byte);
+ assert(kind < ATTRIBUTE_COUNT, "invalid image location attribute");
+ _attributes[kind] = attribute_value(data + 1, n);
+ data += n + 1;
+ }
+}
+
+ImageFile::ImageFile(const char* name) {
+ // Copy the image file name.
+ _name = NEW_C_HEAP_ARRAY(char, strlen(name)+1, mtClass);
+ strcpy(_name, name);
+
+ // Initialize for a closed file.
+ _fd = -1;
+ _memory_mapped = true;
+ _index_data = NULL;
+}
+
+ImageFile::~ImageFile() {
+ // Ensure file is closed.
+ close();
+
+ // Free up name.
+ FREE_C_HEAP_ARRAY(char, _name, mtClass);
+}
+
+bool ImageFile::open() {
+ // If file exists open for reading.
+ struct stat st;
+ if (os::stat(_name, &st) != 0 ||
+ (st.st_mode & S_IFREG) != S_IFREG ||
+ (_fd = os::open(_name, 0, O_RDONLY)) == -1) {
+ return false;
+ }
+
+ // Read image file header and verify.
+ u8 header_size = sizeof(ImageHeader);
+ if (os::read(_fd, &_header, header_size) != header_size ||
+ _header._magic != IMAGE_MAGIC ||
+ _header._major_version != MAJOR_VERSION ||
+ _header._minor_version != MINOR_VERSION) {
+ close();
+ return false;
+ }
+
+ // Memory map index.
+ _index_size = index_size();
+ _index_data = (u1*)os::map_memory(_fd, _name, 0, NULL, _index_size, true, false);
+
+ // Failing that, read index into C memory.
+ if (_index_data == NULL) {
+ _memory_mapped = false;
+ _index_data = NEW_RESOURCE_ARRAY(u1, _index_size);
+
+ if (os::seek_to_file_offset(_fd, 0) == -1) {
+ close();
+ return false;
+ }
+
+ if (os::read(_fd, _index_data, _index_size) != _index_size) {
+ close();
+ return false;
+ }
+
+ return true;
+ }
+
+// Used to advance a pointer, unstructured.
+#undef nextPtr
+#define nextPtr(base, fromType, count, toType) (toType*)((fromType*)(base) + (count))
+ // Pull tables out from the index.
+ _redirect_table = nextPtr(_index_data, u1, header_size, s4);
+ _offsets_table = nextPtr(_redirect_table, s4, _header._location_count, u4);
+ _location_bytes = nextPtr(_offsets_table, u4, _header._location_count, u1);
+ _string_bytes = nextPtr(_location_bytes, u1, _header._locations_size, u1);
+#undef nextPtr
+
+ // Successful open.
+ return true;
+}
+
+void ImageFile::close() {
+ // Dealllocate the index.
+ if (_index_data) {
+ if (_memory_mapped) {
+ os::unmap_memory((char*)_index_data, _index_size);
+ } else {
+ FREE_RESOURCE_ARRAY(u1, _index_data, _index_size);
+ }
+
+ _index_data = NULL;
+ }
+
+ // close file.
+ if (_fd != -1) {
+ os::close(_fd);
+ _fd = -1;
+ }
+
+}
+
+// Return the attribute stream for a named resourced.
+u1* ImageFile::find_location_data(const char* path) const {
+ // Compute hash.
+ u4 hash = ImageStrings::hash_code(path) % _header._location_count;
+ s4 redirect = _redirect_table[hash];
+
+ if (!redirect) {
+ return NULL;
+ }
+
+ u4 index;
+
+ if (redirect < 0) {
+ // If no collision.
+ index = -redirect - 1;
+ } else {
+ // If collision, recompute hash code.
+ index = ImageStrings::hash_code(path, redirect) % _header._location_count;
+ }
+
+ assert(index < _header._location_count, "index exceeds location count");
+ u4 offset = _offsets_table[index];
+ assert(offset < _header._locations_size, "offset exceeds location attributes size");
+
+ if (offset == 0) {
+ return NULL;
+ }
+
+ return _location_bytes + offset;
+}
+
+// Verify that a found location matches the supplied path.
+bool ImageFile::verify_location(ImageLocation& location, const char* path) const {
+ // Retrieve each path component string.
+ ImageStrings strings(_string_bytes, _header._strings_size);
+ // Match a path with each subcomponent without concatenation (copy).
+ // Match up path parent.
+ const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+ const char* next = ImageStrings::starts_with(path, parent);
+ // Continue only if a complete match.
+ if (!next) return false;
+ // Match up path base.
+ const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+ next = ImageStrings::starts_with(next, base);
+ // Continue only if a complete match.
+ if (!next) return false;
+ // Match up path extension.
+ const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+ next = ImageStrings::starts_with(next, extension);
+
+ // True only if complete match and no more characters.
+ return next && *next == '\0';
+}
+
+// Return the resource for the supplied location.
+u1* ImageFile::get_resource(ImageLocation& location) const {
+ // Retrieve the byte offset and size of the resource.
+ u8 offset = _index_size + location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
+ u8 size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+ u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
+ u8 read_size = compressed_size ? compressed_size : size;
+
+ // Allocate space for the resource.
+ u1* data = NEW_RESOURCE_ARRAY(u1, read_size);
+
+ bool is_read = os::read_at(_fd, data, read_size, offset) == read_size;
+ guarantee(is_read, "error reading from image or short read");
+
+ // If not compressed, just return the data.
+ if (!compressed_size) {
+ return data;
+ }
+
+ u1* uncompressed = NEW_RESOURCE_ARRAY(u1, size);
+ char* msg = NULL;
+ jboolean res = ClassLoader::decompress(data, compressed_size, uncompressed, size, &msg);
+ if (!res) warning("decompression failed due to %s\n", msg);
+ guarantee(res, "decompression failed");
+
+ return uncompressed;
+}
+
+void ImageFile::get_resource(const char* path, u1*& buffer, u8& size) const {
+ buffer = NULL;
+ size = 0;
+ u1* data = find_location_data(path);
+ if (data) {
+ ImageLocation location(data);
+ if (verify_location(location, path)) {
+ size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+ buffer = get_resource(location);
+ }
+ }
+}
+
+GrowableArray* ImageFile::packages(const char* name) {
+ char entry[JVM_MAXPATHLEN];
+ bool overflow = jio_snprintf(entry, sizeof(entry), "%s/packages.offsets", name) == -1;
+ guarantee(!overflow, "package name overflow");
+
+ u1* buffer;
+ u8 size;
+
+ get_resource(entry, buffer, size);
+ guarantee(buffer, "missing module packages reource");
+ ImageStrings strings(_string_bytes, _header._strings_size);
+ GrowableArray* pkgs = new GrowableArray();
+ int count = size / 4;
+ for (int i = 0; i < count; i++) {
+ u4 offset = Bytes::get_Java_u4(buffer + (i*4));
+ const char* p = strings.get(offset);
+ pkgs->append(p);
+ }
+
+ return pkgs;
+}
diff --git a/hotspot/src/share/vm/classfile/imageFile.hpp b/hotspot/src/share/vm/classfile/imageFile.hpp
new file mode 100644
index 00000000000..d5ae6d597af
--- /dev/null
+++ b/hotspot/src/share/vm/classfile/imageFile.hpp
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_IMAGEFILE_HPP
+#define SHARE_VM_CLASSFILE_IMAGEFILE_HPP
+
+#include "classfile/classLoader.hpp"
+#include "memory/allocation.hpp"
+#include "memory/allocation.inline.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+// Image files are an alternate file format for storing classes and resources. The
+// goal is to supply file access which is faster and smaller that the jar format.
+// It should be noted that unlike jars information stored in an image is in native
+// endian format. This allows the image to be memory mapped into memory without
+// endian translation. This also means that images are platform dependent.
+//
+// Image files are structured as three sections;
+//
+// +-----------+
+// | Header |
+// +-----------+
+// | |
+// | Directory |
+// | |
+// +-----------+
+// | |
+// | |
+// | Resources |
+// | |
+// | |
+// +-----------+
+//
+// The header contains information related to identification and description of
+// contents.
+//
+// +-------------------------+
+// | Magic (0xCAFEDADA) |
+// +------------+------------+
+// | Major Vers | Minor Vers |
+// +------------+------------+
+// | Location Count |
+// +-------------------------+
+// | Attributes Size |
+// +-------------------------+
+// | Strings Size |
+// +-------------------------+
+//
+// Magic - means of identifying validity of the file. This avoids requiring a
+// special file extension.
+// Major vers, minor vers - differences in version numbers indicate structural
+// changes in the image.
+// Location count - number of locations/resources in the file. This count is also
+// the length of lookup tables used in the directory.
+// Attributes size - number of bytes in the region used to store location attribute
+// streams.
+// Strings size - the size of the region used to store strings used by the
+// directory and meta data.
+//
+// The directory contains information related to resource lookup. The algorithm
+// used for lookup is "A Practical Minimal Perfect Hashing Method"
+// (http://homepages.dcc.ufmg.br/~nivio/papers/wea05.pdf). Given a path string
+// in the form /. return the resource location
+// information;
+//
+// redirectIndex = hash(path, DEFAULT_SEED) % count;
+// redirect = redirectTable[redirectIndex];
+// if (redirect == 0) return not found;
+// locationIndex = redirect < 0 ? -1 - redirect : hash(path, redirect) % count;
+// location = locationTable[locationIndex];
+// if (!verify(location, path)) return not found;
+// return location;
+//
+// Note: The hash function takes an initial seed value. A different seed value
+// usually returns a different result for strings that would otherwise collide with
+// other seeds. The verify function guarantees the found resource location is
+// indeed the resource we are looking for.
+//
+// The following is the format of the directory;
+//
+// +-------------------+
+// | Redirect Table |
+// +-------------------+
+// | Attribute Offsets |
+// +-------------------+
+// | Attribute Data |
+// +-------------------+
+// | Strings |
+// +-------------------+
+//
+// Redirect Table - Array of 32-bit signed values representing actions that
+// should take place for hashed strings that map to that
+// value. Negative values indicate no hash collision and can be
+// quickly converted to indices into attribute offsets. Positive
+// values represent a new seed for hashing an index into attribute
+// offsets. Zero indicates not found.
+// Attribute Offsets - Array of 32-bit unsigned values representing offsets into
+// attribute data. Attribute offsets can be iterated to do a
+// full survey of resources in the image.
+// Attribute Data - Bytes representing compact attribute data for locations. (See
+// comments in ImageLocation.)
+// Strings - Collection of zero terminated UTF-8 strings used by the directory and
+// image meta data. Each string is accessed by offset. Each string is
+// unique. Offset zero is reserved for the empty string.
+//
+// Note that the memory mapped directory assumes 32 bit alignment of the image
+// header, the redirect table and the attribute offsets.
+//
+
+
+// Manage image file string table.
+class ImageStrings {
+private:
+ // Data bytes for strings.
+ u1* _data;
+ // Number of bytes in the string table.
+ u4 _size;
+
+public:
+ // Prime used to generate hash for Perfect Hashing.
+ static const u4 HASH_MULTIPLIER = 0x01000193;
+
+ ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
+
+ // Return the UTF-8 string beginning at offset.
+ inline const char* get(u4 offset) const {
+ assert(offset < _size, "offset exceeds string table size");
+ return (const char*)(_data + offset);
+ }
+
+ // Compute the Perfect Hashing hash code for the supplied string.
+ inline static u4 hash_code(const char* string) {
+ return hash_code(string, HASH_MULTIPLIER);
+ }
+
+ // Compute the Perfect Hashing hash code for the supplied string, starting at seed.
+ static u4 hash_code(const char* string, u4 seed);
+
+ // Test to see if string begins with start. If so returns remaining portion
+ // of string. Otherwise, NULL. Used to test sections of a path without
+ // copying.
+ static const char* starts_with(const char* string, const char* start);
+
+};
+
+// Manage image file location attribute streams. Within an image, a location's
+// attributes are compressed into a stream of bytes. An attribute stream is
+// composed of individual attribute sequences. Each attribute sequence begins with
+// a header byte containing the attribute 'kind' (upper 5 bits of header) and the
+// 'length' less 1 (lower 3 bits of header) of bytes that follow containing the
+// attribute value. Attribute values present as most significant byte first.
+//
+// Ex. Container offset (ATTRIBUTE_OFFSET) 0x33562 would be represented as 0x22
+// (kind = 4, length = 3), 0x03, 0x35, 0x62.
+//
+// An attribute stream is terminated with a header kind of ATTRIBUTE_END (header
+// byte of zero.)
+//
+// ImageLocation inflates the stream into individual values stored in the long
+// array _attributes. This allows an attribute value can be quickly accessed by
+// direct indexing. Unspecified values default to zero.
+//
+// Notes:
+// - Even though ATTRIBUTE_END is used to mark the end of the attribute stream,
+// streams will contain zero byte values to represent lesser significant bits.
+// Thus, detecting a zero byte is not sufficient to detect the end of an attribute
+// stream.
+// - ATTRIBUTE_OFFSET represents the number of bytes from the beginning of the region
+// storing the resources. Thus, in an image this represents the number of bytes
+// after the directory.
+// - Currently, compressed resources are represented by having a non-zero
+// ATTRIBUTE_COMPRESSED value. This represents the number of bytes stored in the
+// image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
+// inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
+// of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
+// in memory. In the future, additional compression techniques will be used and
+// represented differently.
+// - Package strings include trailing slash and extensions include prefix period.
+//
+class ImageLocation {
+public:
+ // Attribute kind enumeration.
+ static const u1 ATTRIBUTE_END = 0; // End of attribute stream marker
+ static const u1 ATTRIBUTE_BASE = 1; // String table offset of resource path base
+ static const u1 ATTRIBUTE_PARENT = 2; // String table offset of resource path parent
+ static const u1 ATTRIBUTE_EXTENSION = 3; // String table offset of resource path extension
+ static const u1 ATTRIBUTE_OFFSET = 4; // Container byte offset of resource
+ static const u1 ATTRIBUTE_COMPRESSED = 5; // In image byte size of the compressed resource
+ static const u1 ATTRIBUTE_UNCOMPRESSED = 6; // In memory byte size of the uncompressed resource
+ static const u1 ATTRIBUTE_COUNT = 7; // Number of attribute kinds
+
+private:
+ // Values of inflated attributes.
+ u8 _attributes[ATTRIBUTE_COUNT];
+
+ // Return the attribute value number of bytes.
+ inline static u1 attribute_length(u1 data) {
+ return (data & 0x7) + 1;
+ }
+
+ // Return the attribute kind.
+ inline static u1 attribute_kind(u1 data) {
+ u1 kind = data >> 3;
+ assert(kind < ATTRIBUTE_COUNT, "invalid attribute kind");
+ return kind;
+ }
+
+ // Return the attribute length.
+ inline static u8 attribute_value(u1* data, u1 n) {
+ assert(0 < n && n <= 8, "invalid attribute value length");
+ u8 value = 0;
+
+ // Most significant bytes first.
+ for (u1 i = 0; i < n; i++) {
+ value <<= 8;
+ value |= data[i];
+ }
+
+ return value;
+ }
+
+public:
+ ImageLocation(u1* data);
+
+ // Retrieve an attribute value from the inflated array.
+ inline u8 get_attribute(u1 kind) const {
+ assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT, "invalid attribute kind");
+ return _attributes[kind];
+ }
+
+ // Retrieve an attribute string value from the inflated array.
+ inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
+ return strings.get((u4)get_attribute(kind));
+ }
+};
+
+// Manage the image file.
+class ImageFile: public CHeapObj {
+private:
+ // Image file marker.
+ static const u4 IMAGE_MAGIC = 0xCAFEDADA;
+ // Image file major version number.
+ static const u2 MAJOR_VERSION = 0;
+ // Image file minor version number.
+ static const u2 MINOR_VERSION = 1;
+
+ struct ImageHeader {
+ u4 _magic; // Image file marker
+ u2 _major_version; // Image file major version number
+ u2 _minor_version; // Image file minor version number
+ u4 _location_count; // Number of locations managed in index.
+ u4 _locations_size; // Number of bytes in attribute table.
+ u4 _strings_size; // Number of bytes in string table.
+ };
+
+ char* _name; // Name of image
+ int _fd; // File descriptor
+ bool _memory_mapped; // Is file memory mapped
+ ImageHeader _header; // Image header
+ u8 _index_size; // Total size of index
+ u1* _index_data; // Raw index data
+ s4* _redirect_table; // Perfect hash redirect table
+ u4* _offsets_table; // Location offset table
+ u1* _location_bytes; // Location attributes
+ u1* _string_bytes; // String table
+
+ // Compute number of bytes in image file index.
+ inline u8 index_size() {
+ return sizeof(ImageHeader) +
+ _header._location_count * sizeof(u4) * 2 +
+ _header._locations_size +
+ _header._strings_size;
+ }
+
+public:
+ ImageFile(const char* name);
+ ~ImageFile();
+
+ // Open image file for access.
+ bool open();
+ // Close image file.
+ void close();
+
+ // Retrieve name of image file.
+ inline const char* name() const {
+ return _name;
+ }
+
+ // Return a string table accessor.
+ inline const ImageStrings get_strings() const {
+ return ImageStrings(_string_bytes, _header._strings_size);
+ }
+
+ // Return number of locations in image file index.
+ inline u4 get_location_count() const {
+ return _header._location_count;
+ }
+
+ // Return location attribute stream for location i.
+ inline u1* get_location_data(u4 i) const {
+ u4 offset = _offsets_table[i];
+
+ return offset != 0 ? _location_bytes + offset : NULL;
+ }
+
+ // Return the attribute stream for a named resourced.
+ u1* find_location_data(const char* path) const;
+
+ // Verify that a found location matches the supplied path.
+ bool verify_location(ImageLocation& location, const char* path) const;
+
+ // Return the resource for the supplied location info.
+ u1* get_resource(ImageLocation& location) const;
+
+ // Return the resource associated with the path else NULL if not found.
+ void get_resource(const char* path, u1*& buffer, u8& size) const;
+
+ // Return an array of packages for a given module
+ GrowableArray* packages(const char* name);
+};
+
+#endif // SHARE_VM_CLASSFILE_IMAGEFILE_HPP
diff --git a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp
index 79457a0e5e2..9bb82f7fd19 100644
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp
@@ -110,7 +110,7 @@ bool SharedPathsMiscInfo::check() {
bool SharedPathsMiscInfo::check(jint type, const char* path) {
switch (type) {
case BOOT:
- if (strcmp(path, Arguments::get_sysclasspath()) != 0) {
+ if (os::file_name_strcmp(path, Arguments::get_sysclasspath()) != 0) {
return fail("[BOOT classpath mismatch, actual: -Dsun.boot.class.path=", Arguments::get_sysclasspath());
}
break;
diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp
index 07027b52c42..c344c0d8647 100644
--- a/hotspot/src/share/vm/memory/filemap.cpp
+++ b/hotspot/src/share/vm/memory/filemap.cpp
@@ -217,9 +217,14 @@ void FileMapInfo::allocate_classpath_entry_table() {
EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
SharedClassUtil::update_shared_classpath(cpe, ent, st.st_mtime, st.st_size, THREAD);
} else {
- ent->_filesize = -1;
- if (!os::dir_is_empty(name)) {
- ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
+ struct stat st;
+ if ((os::stat(name, &st) == 0) && ((st.st_mode & S_IFDIR) == S_IFDIR)) {
+ if (!os::dir_is_empty(name)) {
+ ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
+ }
+ ent->_filesize = -1;
+ } else {
+ ent->_filesize = -2;
}
}
ent->_name = strptr;
@@ -271,7 +276,7 @@ bool FileMapInfo::validate_classpath_entry_table() {
fail_continue("directory is not empty: %s", name);
ok = false;
}
- } else {
+ } else if (ent->is_jar()) {
if (ent->_timestamp != st.st_mtime ||
ent->_filesize != st.st_size) {
ok = false;
diff --git a/hotspot/src/share/vm/memory/filemap.hpp b/hotspot/src/share/vm/memory/filemap.hpp
index a84aa17457f..fe1627ef9a6 100644
--- a/hotspot/src/share/vm/memory/filemap.hpp
+++ b/hotspot/src/share/vm/memory/filemap.hpp
@@ -44,8 +44,11 @@ class Metaspace;
class SharedClassPathEntry VALUE_OBJ_CLASS_SPEC {
public:
const char *_name;
- time_t _timestamp; // jar timestamp, 0 if is directory
- long _filesize; // jar file size, -1 if is directory
+ time_t _timestamp; // jar timestamp, 0 if is directory or other
+ long _filesize; // jar file size, -1 if is directory, -2 if other
+ bool is_jar() {
+ return _timestamp != 0;
+ }
bool is_dir() {
return _filesize == -1;
}
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index ff2a25fe1bc..dde8a1bad8e 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -115,8 +115,6 @@ exit_hook_t Arguments::_exit_hook = NULL;
vfprintf_hook_t Arguments::_vfprintf_hook = NULL;
-SystemProperty *Arguments::_java_ext_dirs = NULL;
-SystemProperty *Arguments::_java_endorsed_dirs = NULL;
SystemProperty *Arguments::_sun_boot_library_path = NULL;
SystemProperty *Arguments::_java_library_path = NULL;
SystemProperty *Arguments::_java_home = NULL;
@@ -125,6 +123,7 @@ SystemProperty *Arguments::_sun_boot_class_path = NULL;
char* Arguments::_meta_index_path = NULL;
char* Arguments::_meta_index_dir = NULL;
+char* Arguments::_ext_dirs = NULL;
// Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string
@@ -184,8 +183,6 @@ void Arguments::init_system_properties() {
// Following are JVMTI agent writable properties.
// Properties values are set to NULL and they are
// os specific they are initialized in os::init_system_properties_values().
- _java_ext_dirs = new SystemProperty("java.ext.dirs", NULL, true);
- _java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL, true);
_sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL, true);
_java_library_path = new SystemProperty("java.library.path", NULL, true);
_java_home = new SystemProperty("java.home", NULL, true);
@@ -194,8 +191,6 @@ void Arguments::init_system_properties() {
_java_class_path = new SystemProperty("java.class.path", "", true);
// Add to System Property list.
- PropertyList_add(&_system_properties, _java_ext_dirs);
- PropertyList_add(&_system_properties, _java_endorsed_dirs);
PropertyList_add(&_system_properties, _sun_boot_library_path);
PropertyList_add(&_system_properties, _java_library_path);
PropertyList_add(&_system_properties, _java_home);
@@ -344,13 +339,9 @@ bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
// components, in order:
//
// prefix // from -Xbootclasspath/p:...
-// endorsed // the expansion of -Djava.endorsed.dirs=...
// base // from os::get_system_properties() or -Xbootclasspath=
// suffix // from -Xbootclasspath/a:...
//
-// java.endorsed.dirs is a list of directories; any jar or zip files in the
-// directories are added to the sysclasspath just before the base.
-//
// This could be AllStatic, but it isn't needed after argument processing is
// complete.
class SysClassPath: public StackObj {
@@ -364,16 +355,9 @@ public:
inline void add_suffix(const char* suffix);
inline void reset_path(const char* base);
- // Expand the jar/zip files in each directory listed by the java.endorsed.dirs
- // property. Must be called after all command-line arguments have been
- // processed (in particular, -Djava.endorsed.dirs=...) and before calling
- // combined_path().
- void expand_endorsed();
-
inline const char* get_base() const { return _items[_scp_base]; }
inline const char* get_prefix() const { return _items[_scp_prefix]; }
inline const char* get_suffix() const { return _items[_scp_suffix]; }
- inline const char* get_endorsed() const { return _items[_scp_endorsed]; }
// Combine all the components into a single c-heap-allocated string; caller
// must free the string if/when no longer needed.
@@ -390,20 +374,17 @@ private:
// base are allocated in the C heap and freed by this class.
enum {
_scp_prefix, // from -Xbootclasspath/p:...
- _scp_endorsed, // the expansion of -Djava.endorsed.dirs=...
_scp_base, // the default sysclasspath
_scp_suffix, // from -Xbootclasspath/a:...
_scp_nitems // the number of items, must be last.
};
const char* _items[_scp_nitems];
- DEBUG_ONLY(bool _expansion_done;)
};
SysClassPath::SysClassPath(const char* base) {
memset(_items, 0, sizeof(_items));
_items[_scp_base] = base;
- DEBUG_ONLY(_expansion_done = false;)
}
SysClassPath::~SysClassPath() {
@@ -411,7 +392,6 @@ SysClassPath::~SysClassPath() {
for (int i = 0; i < _scp_nitems; ++i) {
if (i != _scp_base) reset_item_at(i);
}
- DEBUG_ONLY(_expansion_done = false;)
}
inline void SysClassPath::set_base(const char* base) {
@@ -447,41 +427,11 @@ inline void SysClassPath::reset_path(const char* base) {
//------------------------------------------------------------------------------
-void SysClassPath::expand_endorsed() {
- assert(_items[_scp_endorsed] == NULL, "can only be called once.");
-
- const char* path = Arguments::get_property("java.endorsed.dirs");
- if (path == NULL) {
- path = Arguments::get_endorsed_dir();
- assert(path != NULL, "no default for java.endorsed.dirs");
- }
-
- char* expanded_path = NULL;
- const char separator = *os::path_separator();
- const char* const end = path + strlen(path);
- while (path < end) {
- const char* tmp_end = strchr(path, separator);
- if (tmp_end == NULL) {
- expanded_path = add_jars_to_path(expanded_path, path);
- path = end;
- } else {
- char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
- memcpy(dirpath, path, tmp_end - path);
- dirpath[tmp_end - path] = '\0';
- expanded_path = add_jars_to_path(expanded_path, dirpath);
- FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
- path = tmp_end + 1;
- }
- }
- _items[_scp_endorsed] = expanded_path;
- DEBUG_ONLY(_expansion_done = true;)
-}
// Combine the bootclasspath elements, some of which may be null, into a single
// c-heap-allocated string.
char* SysClassPath::combined_path() {
assert(_items[_scp_base] != NULL, "empty default sysclasspath");
- assert(_expansion_done, "must call expand_endorsed() first.");
size_t lengths[_scp_nitems];
size_t total_len = 0;
@@ -3084,6 +3034,20 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
#endif
// -D
} else if (match_option(option, "-D", &tail)) {
+ if (match_option(option, "-Djava.endorsed.dirs=", &tail)) {
+ // abort if -Djava.endorsed.dirs is set
+ jio_fprintf(defaultStream::output_stream(),
+ "-Djava.endorsed.dirs is not supported. Endorsed standards and standalone APIs\n"
+ "in modular form will be supported via the concept of upgradeable modules.\n");
+ return JNI_EINVAL;
+ }
+ if (match_option(option, "-Djava.ext.dirs=", &tail)) {
+ // abort if -Djava.ext.dirs is set
+ jio_fprintf(defaultStream::output_stream(),
+ "-Djava.ext.dirs is not supported. Use -classpath instead.\n");
+ return JNI_EINVAL;
+ }
+
if (!add_property(tail)) {
return JNI_ENOMEM;
}
@@ -3529,11 +3493,89 @@ void Arguments::fix_appclasspath() {
}
}
-jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
- // This must be done after all -D arguments have been processed.
- scp_p->expand_endorsed();
+static bool has_jar_files(const char* directory) {
+ DIR* dir = os::opendir(directory);
+ if (dir == NULL) return false;
- if (scp_assembly_required || scp_p->get_endorsed() != NULL) {
+ struct dirent *entry;
+ char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
+ bool hasJarFile = false;
+ while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
+ const char* name = entry->d_name;
+ const char* ext = name + strlen(name) - 4;
+ hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
+ }
+ FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+ os::closedir(dir);
+ return hasJarFile ;
+}
+
+static int check_non_empty_dirs(const char* path) {
+ const char separator = *os::path_separator();
+ const char* const end = path + strlen(path);
+ int nonEmptyDirs = 0;
+ while (path < end) {
+ const char* tmp_end = strchr(path, separator);
+ if (tmp_end == NULL) {
+ if (has_jar_files(path)) {
+ nonEmptyDirs++;
+ jio_fprintf(defaultStream::output_stream(),
+ "Non-empty directory: %s\n", path);
+ }
+ path = end;
+ } else {
+ char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
+ memcpy(dirpath, path, tmp_end - path);
+ dirpath[tmp_end - path] = '\0';
+ if (has_jar_files(dirpath)) {
+ nonEmptyDirs++;
+ jio_fprintf(defaultStream::output_stream(),
+ "Non-empty directory: %s\n", dirpath);
+ }
+ FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
+ path = tmp_end + 1;
+ }
+ }
+ return nonEmptyDirs;
+}
+
+jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
+ // check if the default lib/endorsed directory exists; if so, error
+ char path[JVM_MAXPATHLEN];
+ const char* fileSep = os::file_separator();
+ sprintf(path, "%s%slib%sendorsed", Arguments::get_java_home(), fileSep, fileSep);
+
+ if (CheckEndorsedAndExtDirs) {
+ int nonEmptyDirs = 0;
+ // check endorsed directory
+ nonEmptyDirs += check_non_empty_dirs(path);
+ // check the extension directories
+ nonEmptyDirs += check_non_empty_dirs(Arguments::get_ext_dirs());
+ if (nonEmptyDirs > 0) {
+ return JNI_ERR;
+ }
+ }
+
+ DIR* dir = os::opendir(path);
+ if (dir != NULL) {
+ jio_fprintf(defaultStream::output_stream(),
+ "/lib/endorsed is not supported. Endorsed standards and standalone APIs\n"
+ "in modular form will be supported via the concept of upgradeable modules.\n");
+ os::closedir(dir);
+ return JNI_ERR;
+ }
+
+ sprintf(path, "%s%slib%sext", Arguments::get_java_home(), fileSep, fileSep);
+ dir = os::opendir(path);
+ if (dir != NULL) {
+ jio_fprintf(defaultStream::output_stream(),
+ "/lib/ext exists, extensions mechanism no longer supported; "
+ "Use -classpath instead.\n.");
+ os::closedir(dir);
+ return JNI_ERR;
+ }
+
+ if (scp_assembly_required) {
// Assemble the bootclasspath elements into the final path.
Arguments::set_sysclasspath(scp_p->combined_path());
}
diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp
index 3c8ae0f5679..ae28c622ca2 100644
--- a/hotspot/src/share/vm/runtime/arguments.hpp
+++ b/hotspot/src/share/vm/runtime/arguments.hpp
@@ -254,8 +254,6 @@ class Arguments : AllStatic {
static SystemProperty* _system_properties;
// Quick accessor to System properties in the list:
- static SystemProperty *_java_ext_dirs;
- static SystemProperty *_java_endorsed_dirs;
static SystemProperty *_sun_boot_library_path;
static SystemProperty *_java_library_path;
static SystemProperty *_java_home;
@@ -266,6 +264,10 @@ class Arguments : AllStatic {
static char* _meta_index_path;
static char* _meta_index_dir;
+ // temporary: to emit warning if the default ext dirs are not empty.
+ // remove this variable when the warning is no longer needed.
+ static char* _ext_dirs;
+
// java.vendor.url.bug, bug reporting URL for fatal errors.
static const char* _java_vendor_url_bug;
@@ -586,8 +588,7 @@ class Arguments : AllStatic {
static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); }
static void set_java_home(char *value) { _java_home->set_value(value); }
static void set_library_path(char *value) { _java_library_path->set_value(value); }
- static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); }
- static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); }
+ static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); }
static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); }
static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) {
@@ -597,14 +598,14 @@ class Arguments : AllStatic {
static char* get_java_home() { return _java_home->value(); }
static char* get_dll_dir() { return _sun_boot_library_path->value(); }
- static char* get_endorsed_dir() { return _java_endorsed_dirs->value(); }
static char* get_sysclasspath() { return _sun_boot_class_path->value(); }
static char* get_meta_index_path() { return _meta_index_path; }
static char* get_meta_index_dir() { return _meta_index_dir; }
- static char* get_ext_dirs() { return _java_ext_dirs->value(); }
+ static char* get_ext_dirs() { return _ext_dirs; }
static char* get_appclasspath() { return _java_class_path->value(); }
static void fix_appclasspath();
+
// Operation modi
static Mode mode() { return _mode; }
static bool is_interpreter_only() { return mode() == _int; }
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index e74b9bbdf20..7e50e37468a 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -1233,6 +1233,9 @@ class CommandLineFlags {
product(bool, CheckJNICalls, false, \
"Verify all arguments to JNI calls") \
\
+ product(bool, CheckEndorsedAndExtDirs, false, \
+ "Verify the endorsed and extension directories are not used") \
+ \
product(bool, UseFastJNIAccessors, true, \
"Use optimized versions of GetField") \
\
diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp
index 1e632f4d543..1de280900df 100644
--- a/hotspot/src/share/vm/runtime/os.cpp
+++ b/hotspot/src/share/vm/runtime/os.cpp
@@ -1230,11 +1230,21 @@ bool os::set_boot_path(char fileSep, char pathSep) {
Arguments::set_meta_index_path(meta_index, meta_index_dir);
char* sysclasspath = NULL;
+ struct stat st;
+
+ // modular image if bootmodules.jimage exists
+ char* jimage = format_boot_path("%/lib/modules/bootmodules.jimage", home, home_len, fileSep, pathSep);
+ if (jimage == NULL) return false;
+ bool has_jimage = (os::stat(jimage, &st) == 0);
+ if (has_jimage) {
+ Arguments::set_sysclasspath(jimage);
+ return true;
+ }
+ FREE_C_HEAP_ARRAY(char, jimage, mtInternal);
// images build if rt.jar exists
char* rt_jar = format_boot_path("%/lib/rt.jar", home, home_len, fileSep, pathSep);
if (rt_jar == NULL) return false;
- struct stat st;
bool has_rt_jar = (os::stat(rt_jar, &st) == 0);
FREE_C_HEAP_ARRAY(char, rt_jar, mtInternal);
diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp
index fa15d25b6c6..e9ba0cc4b52 100644
--- a/hotspot/src/share/vm/runtime/os.hpp
+++ b/hotspot/src/share/vm/runtime/os.hpp
@@ -500,6 +500,7 @@ class os: AllStatic {
//File i/o operations
static size_t read(int fd, void *buf, unsigned int nBytes);
+ static size_t read_at(int fd, void *buf, unsigned int nBytes, jlong offset);
static size_t restartable_read(int fd, void *buf, unsigned int nBytes);
static size_t write(int fd, const void *buf, unsigned int nBytes);
diff --git a/hotspot/src/share/vm/runtime/statSampler.cpp b/hotspot/src/share/vm/runtime/statSampler.cpp
index 55fda6fb3f9..1e91e8fdecf 100644
--- a/hotspot/src/share/vm/runtime/statSampler.cpp
+++ b/hotspot/src/share/vm/runtime/statSampler.cpp
@@ -225,8 +225,6 @@ static const char* property_counters_ss[] = {
"java.vm.info",
"java.library.path",
"java.class.path",
- "java.endorsed.dirs",
- "java.ext.dirs",
"java.version",
"java.home",
NULL
From 3c5c554fadd3cfa8b7811959ed2897cb0f2559d9 Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Wed, 3 Dec 2014 14:22:17 +0000
Subject: [PATCH 32/37] 8049367: Modular Run-Time Images
Co-authored-by: Alan Bateman
Co-authored-by: Alex Buckley
Co-authored-by: Bradford Wetmore
Co-authored-by: Erik Joelsson
Co-authored-by: James Laskey
Co-authored-by: Jonathan Gibbons
Co-authored-by: Karen Kinnear
Co-authored-by: Magnus Ihse Bursie
Co-authored-by: Mandy Chung
Co-authored-by: Mark Reinhold
Co-authored-by: Paul Sandoz
Co-authored-by: Sundararajan Athijegannathan
Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
---
.../apache/bcel/internal/util/ClassPath.java | 22 ++-----------------
.../xalan/internal/utils/SecuritySupport.java | 13 ++++++-----
.../xalan/internal/xslt/EnvironmentCheck.java | 17 --------------
.../jaxp/datatype/DatatypeFactoryImpl.java | 2 +-
.../internal/utils/SecuritySupport.java | 13 ++++++-----
.../share/classes/javax/xml/XMLConstants.java | 6 ++---
.../javax/xml/datatype/DatatypeFactory.java | 2 +-
.../javax/xml/datatype/FactoryFinder.java | 10 ++++-----
.../xml/parsers/DocumentBuilderFactory.java | 2 +-
.../javax/xml/parsers/FactoryFinder.java | 10 ++++-----
.../javax/xml/parsers/SAXParserFactory.java | 2 +-
.../javax/xml/stream/FactoryFinder.java | 8 +++----
.../javax/xml/transform/FactoryFinder.java | 10 ++++-----
.../xml/transform/TransformerFactory.java | 2 +-
.../javax/xml/validation/SchemaFactory.java | 2 +-
.../xml/validation/SchemaFactoryFinder.java | 6 ++---
.../classes/javax/xml/xpath/XPathFactory.java | 2 +-
.../javax/xml/xpath/XPathFactoryFinder.java | 6 ++---
18 files changed, 53 insertions(+), 82 deletions(-)
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java
index ac4745ea97f..1c89a1049c9 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java
@@ -151,18 +151,17 @@ public class ClassPath implements Serializable {
}
/** Checks for class path components in the following properties:
- * "java.class.path", "sun.boot.class.path", "java.ext.dirs"
+ * "java.class.path", "sun.boot.class.path"
*
* @return class path as used by default by BCEL
*/
public static final String getClassPath() {
- String class_path, boot_path, ext_path;
+ String class_path, boot_path;
try {
class_path = SecuritySupport.getSystemProperty("java.class.path");
boot_path = SecuritySupport.getSystemProperty("sun.boot.class.path");
- ext_path = SecuritySupport.getSystemProperty("java.ext.dirs");
}
catch (SecurityException e) {
return "";
@@ -173,23 +172,6 @@ public class ClassPath implements Serializable {
getPathComponents(class_path, list);
getPathComponents(boot_path, list);
- ArrayList dirs = new ArrayList();
- getPathComponents(ext_path, dirs);
-
- for(Iterator e = dirs.iterator(); e.hasNext(); ) {
- File ext_dir = new File((String)e.next());
- String[] extensions = SecuritySupport.getFileList(ext_dir, new FilenameFilter() {
- public boolean accept(File dir, String name) {
- name = name.toLowerCase();
- return name.endsWith(".zip") || name.endsWith(".jar");
- }
- });
-
- if(extensions != null)
- for(int i=0; i < extensions.length; i++)
- list.add(ext_path + File.separatorChar + extensions[i]);
- }
-
StringBuffer buf = new StringBuffer();
for(Iterator e = list.iterator(); e.hasNext(); ) {
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
index e581f9a5b40..71570d68d08 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
@@ -243,6 +243,9 @@ public final class SecuritySupport {
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
+ } else if (protocol.equalsIgnoreCase("jrt")) {
+ // if the systemId is "jrt" then allow access if "file" allowed
+ protocol = "file";
}
}
@@ -278,7 +281,7 @@ public final class SecuritySupport {
/**
* Read JAXP system property in this order: system property,
- * $java.home/lib/jaxp.properties if the system property is not specified
+ * $java.home/conf/jaxp.properties if the system property is not specified
*
* @param propertyId the Id of the property
* @return the value of the property
@@ -292,7 +295,7 @@ public final class SecuritySupport {
}
/**
- * Read from $java.home/lib/jaxp.properties for the specified property
+ * Read from $java.home/conf/jaxp.properties for the specified property
* The program
*
* @param propertyId the Id of the property
@@ -306,7 +309,7 @@ public final class SecuritySupport {
synchronized (cacheProps) {
if (firstTime) {
String configFile = getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
if (getFileExists(f)) {
is = getFileInputStream(f);
@@ -332,12 +335,12 @@ public final class SecuritySupport {
}
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
static final Properties cacheProps = new Properties();
/**
- * Flag indicating if the program has tried reading java.home/lib/jaxp.properties
+ * Flag indicating if the program has tried reading java.home/conf/jaxp.properties
*/
static volatile boolean firstTime = true;
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
index a6b99891be4..6696d64447c 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
@@ -558,9 +558,6 @@ public class EnvironmentCheck
* Logs java.class.path and other likely paths; then attempts
* to search those paths for .jar files with Xalan-related classes.
*
- * //@todo NOTE: We don't actually search java.ext.dirs for
- * // *.jar files therein! This should be updated
- *
* @param h Hashtable to put information in
* @see #jarNames
* @see #checkPathForJars(String, String[])
@@ -615,20 +612,6 @@ public class EnvironmentCheck
h.put(FOUNDCLASSES + "sun.boot.class.path", classpathJars);
}
- //@todo NOTE: We don't actually search java.ext.dirs for
- // *.jar files therein! This should be updated
- othercp = SecuritySupport.getSystemProperty("java.ext.dirs");
-
- if (null != othercp)
- {
- h.put("java.ext.dirs", othercp);
-
- classpathJars = checkPathForJars(othercp, jarNames);
-
- if (null != classpathJars)
- h.put(FOUNDCLASSES + "java.ext.dirs", classpathJars);
- }
-
//@todo also check other System properties' paths?
// v2 = checkPathForJars(System.getProperty("sun.boot.library.path"), jarNames); // ?? may not be needed
// v3 = checkPathForJars(System.getProperty("java.library.path"), jarNames); // ?? may not be needed
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java
index aa993a299c5..a9baeac29ef 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java
@@ -41,7 +41,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
*
*
- * If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} Object.
+ * If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} Object.
* The Properties Object is then queried for the property as documented in the prior step
* and processed as documented in the prior step.
*
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
index 613d651594f..c25e552c4ff 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
@@ -237,6 +237,9 @@ public final class SecuritySupport {
if (protocol.equalsIgnoreCase("jar")) {
String path = url.getPath();
protocol = path.substring(0, path.indexOf(":"));
+ } else if (protocol.equalsIgnoreCase("jrt")) {
+ // if the systemId is "jrt" then allow access if "file" allowed
+ protocol = "file";
}
}
@@ -272,7 +275,7 @@ public final class SecuritySupport {
/**
* Read JAXP system property in this order: system property,
- * $java.home/lib/jaxp.properties if the system property is not specified
+ * $java.home/conf/jaxp.properties if the system property is not specified
*
* @param propertyId the Id of the property
* @return the value of the property
@@ -286,7 +289,7 @@ public final class SecuritySupport {
}
/**
- * Read from $java.home/lib/jaxp.properties for the specified property
+ * Read from $java.home/conf/jaxp.properties for the specified property
* The program
*
* @param propertyId the Id of the property
@@ -300,7 +303,7 @@ public final class SecuritySupport {
synchronized (cacheProps) {
if (firstTime) {
String configFile = getSystemProperty("java.home") + File.separator +
- "lib" + File.separator + "jaxp.properties";
+ "conf" + File.separator + "jaxp.properties";
File f = new File(configFile);
if (getFileExists(f)) {
is = getFileInputStream(f);
@@ -326,12 +329,12 @@ public final class SecuritySupport {
}
/**
- * Cache for properties in java.home/lib/jaxp.properties
+ * Cache for properties in java.home/conf/jaxp.properties
*/
static final Properties cacheProps = new Properties();
/**
- * Flag indicating if the program has tried reading java.home/lib/jaxp.properties
+ * Flag indicating if the program has tried reading java.home/conf/jaxp.properties
*/
static volatile boolean firstTime = true;
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
index 70b8bdfa812..4cb5800200d 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
@@ -247,7 +247,7 @@ public final class XMLConstants {
*
*
*
- * ${JAVA_HOME}/lib/jaxp.properties: This configuration file is in standard
+ * ${JAVA_HOME}/conf/jaxp.properties: This configuration file is in standard
* {@link java.util.Properties} format. If the file exists and the system property is specified,
* its value will be used to override the default of the property.
*
@@ -314,7 +314,7 @@ public final class XMLConstants {
*