From 4f7010b973432dbf1c09eb5ddbcb05cf484bd3cf Mon Sep 17 00:00:00 2001
From: Zhengyu Gu
Date: Tue, 25 Jun 2013 17:22:04 -0400
Subject: [PATCH 001/101] 8017478: Kitchensink crashed with SIGSEGV in
BaselineReporter::diff_callsites
Fixed possible NULL pointer that caused SIGSEGV
Reviewed-by: coleenp, acorn, ctornqvi
---
hotspot/src/share/vm/services/memReporter.cpp | 46 +++++++++++++------
1 file changed, 33 insertions(+), 13 deletions(-)
diff --git a/hotspot/src/share/vm/services/memReporter.cpp b/hotspot/src/share/vm/services/memReporter.cpp
index 573d9e03c14..9d0f45ada36 100644
--- a/hotspot/src/share/vm/services/memReporter.cpp
+++ b/hotspot/src/share/vm/services/memReporter.cpp
@@ -188,8 +188,8 @@ void BaselineReporter::diff_callsites(const MemBaseline& cur, const MemBaseline&
(MallocCallsitePointer*)prev_malloc_itr.current();
while (cur_malloc_callsite != NULL || prev_malloc_callsite != NULL) {
- if (prev_malloc_callsite == NULL ||
- cur_malloc_callsite->addr() < prev_malloc_callsite->addr()) {
+ if (prev_malloc_callsite == NULL) {
+ assert(cur_malloc_callsite != NULL, "sanity check");
// this is a new callsite
_outputer.diff_malloc_callsite(cur_malloc_callsite->addr(),
amount_in_current_scale(cur_malloc_callsite->amount()),
@@ -197,22 +197,42 @@ void BaselineReporter::diff_callsites(const MemBaseline& cur, const MemBaseline&
diff_in_current_scale(cur_malloc_callsite->amount(), 0),
diff(cur_malloc_callsite->count(), 0));
cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next();
- } else if (cur_malloc_callsite == NULL ||
- cur_malloc_callsite->addr() > prev_malloc_callsite->addr()) {
+ } else if (cur_malloc_callsite == NULL) {
+ assert(prev_malloc_callsite != NULL, "Sanity check");
// this callsite is already gone
_outputer.diff_malloc_callsite(prev_malloc_callsite->addr(),
- amount_in_current_scale(0), 0,
+ 0, 0,
diff_in_current_scale(0, prev_malloc_callsite->amount()),
diff(0, prev_malloc_callsite->count()));
prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next();
- } else { // the same callsite
- _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(),
- amount_in_current_scale(cur_malloc_callsite->amount()),
- cur_malloc_callsite->count(),
- diff_in_current_scale(cur_malloc_callsite->amount(), prev_malloc_callsite->amount()),
- diff(cur_malloc_callsite->count(), prev_malloc_callsite->count()));
- cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next();
- prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next();
+ } else {
+ assert(cur_malloc_callsite != NULL, "Sanity check");
+ assert(prev_malloc_callsite != NULL, "Sanity check");
+ if (cur_malloc_callsite->addr() < prev_malloc_callsite->addr()) {
+ // this is a new callsite
+ _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(),
+ amount_in_current_scale(cur_malloc_callsite->amount()),
+ cur_malloc_callsite->count(),
+ diff_in_current_scale(cur_malloc_callsite->amount(), 0),
+ diff(cur_malloc_callsite->count(), 0));
+ cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next();
+ } else if (cur_malloc_callsite->addr() > prev_malloc_callsite->addr()) {
+ // this callsite is already gone
+ _outputer.diff_malloc_callsite(prev_malloc_callsite->addr(),
+ 0, 0,
+ diff_in_current_scale(0, prev_malloc_callsite->amount()),
+ diff(0, prev_malloc_callsite->count()));
+ prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next();
+ } else {
+ // the same callsite
+ _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(),
+ amount_in_current_scale(cur_malloc_callsite->amount()),
+ cur_malloc_callsite->count(),
+ diff_in_current_scale(cur_malloc_callsite->amount(), prev_malloc_callsite->amount()),
+ diff(cur_malloc_callsite->count(), prev_malloc_callsite->count()));
+ cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next();
+ prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next();
+ }
}
}
From 08377de5aba4c0410a3c66a292080db1fd957a1c Mon Sep 17 00:00:00 2001
From: Kevin Walls
Date: Wed, 26 Jun 2013 00:01:20 +0100
Subject: [PATCH 002/101] 8010278: SA: provide mechanism for using an
alternative SA debugger back-end
Reviewed-by: sla, dsamersoff
---
.../share/classes/sun/jvm/hotspot/CLHSDB.java | 26 +++--
.../sun/jvm/hotspot/CommandProcessor.java | 9 +-
.../share/classes/sun/jvm/hotspot/HSDB.java | 48 +++++++--
.../classes/sun/jvm/hotspot/HotSpotAgent.java | 102 ++++++++++++++----
.../hotspot/debugger/linux/LinuxAddress.java | 4 +-
.../debugger/linux/LinuxOopHandle.java | 4 +-
.../classes/sun/jvm/hotspot/runtime/VM.java | 11 +-
.../jvm/hotspot/tools/ClassLoaderStats.java | 8 ++
.../sun/jvm/hotspot/tools/FinalizerInfo.java | 10 ++
.../sun/jvm/hotspot/tools/FlagDumper.java | 9 ++
.../sun/jvm/hotspot/tools/HeapDumper.java | 6 ++
.../sun/jvm/hotspot/tools/HeapSummary.java | 9 ++
.../classes/sun/jvm/hotspot/tools/JInfo.java | 9 ++
.../classes/sun/jvm/hotspot/tools/JMap.java | 5 +
.../classes/sun/jvm/hotspot/tools/JSnap.java | 10 ++
.../classes/sun/jvm/hotspot/tools/JStack.java | 6 ++
.../jvm/hotspot/tools/ObjectHistogram.java | 8 ++
.../classes/sun/jvm/hotspot/tools/PMap.java | 9 ++
.../classes/sun/jvm/hotspot/tools/PStack.java | 4 +
.../sun/jvm/hotspot/tools/StackTrace.java | 10 ++
.../sun/jvm/hotspot/tools/SysPropsDumper.java | 9 ++
.../classes/sun/jvm/hotspot/tools/Tool.java | 31 +++++-
.../jvm/hotspot/tools/jcore/ClassDump.java | 48 +++++----
.../sun/jvm/hotspot/tools/soql/JSDB.java | 10 ++
.../sun/jvm/hotspot/tools/soql/SOQL.java | 8 ++
25 files changed, 340 insertions(+), 73 deletions(-)
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java
index 5071235fa3e..9e8d016dcc2 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java
@@ -31,13 +31,19 @@ import java.io.*;
import java.util.*;
public class CLHSDB {
+
+ public CLHSDB(JVMDebugger d) {
+ jvmDebugger = d;
+ }
+
public static void main(String[] args) {
new CLHSDB(args).run();
}
- private void run() {
- // At this point, if pidText != null we are supposed to attach to it.
- // Else, if execPath != null, it is the path of a jdk/bin/java
+ public void run() {
+ // If jvmDebugger is already set, we have been given a JVMDebugger.
+ // Otherwise, if pidText != null we are supposed to attach to it.
+ // Finally, if execPath != null, it is the path of a jdk/bin/java
// and coreFilename is the pathname of a core file we are
// supposed to attach to.
@@ -49,7 +55,9 @@ public class CLHSDB {
}
});
- if (pidText != null) {
+ if (jvmDebugger != null) {
+ attachDebugger(jvmDebugger);
+ } else if (pidText != null) {
attachDebugger(pidText);
} else if (execPath != null) {
attachDebugger(execPath, coreFilename);
@@ -96,6 +104,7 @@ public class CLHSDB {
// Internals only below this point
//
private HotSpotAgent agent;
+ private JVMDebugger jvmDebugger;
private boolean attached;
// These had to be made data members because they are referenced in inner classes.
private String pidText;
@@ -120,7 +129,7 @@ public class CLHSDB {
case (1):
if (args[0].equals("help") || args[0].equals("-help")) {
doUsage();
- System.exit(0);
+ return;
}
// If all numbers, it is a PID to attach to
// Else, it is a pathname to a .../bin/java for a core file.
@@ -142,10 +151,15 @@ public class CLHSDB {
default:
System.out.println("HSDB Error: Too many options specified");
doUsage();
- System.exit(1);
+ return;
}
}
+ private void attachDebugger(JVMDebugger d) {
+ agent.attach(d);
+ attached = true;
+ }
+
/** NOTE we are in a different thread here than either the main
thread or the Swing/AWT event handler thread, so we must be very
careful when creating or removing widgets */
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java
index 2233844267c..1840caf9313 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java
@@ -101,6 +101,9 @@ import sun.jvm.hotspot.utilities.soql.JSJavaFactoryImpl;
import sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine;
public class CommandProcessor {
+
+ volatile boolean quit;
+
public abstract static class DebuggerInterface {
public abstract HotSpotAgent getAgent();
public abstract boolean isAttached();
@@ -1135,7 +1138,7 @@ public class CommandProcessor {
usage();
} else {
debugger.detach();
- System.exit(0);
+ quit = true;
}
}
},
@@ -1714,7 +1717,7 @@ public class CommandProcessor {
}
protected void quit() {
debugger.detach();
- System.exit(0);
+ quit = true;
}
protected BufferedReader getInputReader() {
return in;
@@ -1781,7 +1784,7 @@ public class CommandProcessor {
public void run(boolean prompt) {
// Process interactive commands.
- while (true) {
+ while (!quit) {
if (prompt) printPrompt();
String ln = null;
try {
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java
index 5143408c687..d50cbaa5140 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java
@@ -59,8 +59,11 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
// Internals only below this point
//
private HotSpotAgent agent;
+ private JVMDebugger jvmDebugger;
private JDesktopPane desktop;
private boolean attached;
+ private boolean argError;
+ private JFrame frame;
/** List */
private java.util.List attachMenuItems;
/** List */
@@ -85,6 +88,11 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
System.out.println(" path-to-corefile: Debug this corefile. The default is 'core'");
System.out.println(" If no arguments are specified, you can select what to do from the GUI.\n");
HotSpotAgent.showUsage();
+ argError = true;
+ }
+
+ public HSDB(JVMDebugger d) {
+ jvmDebugger = d;
}
private HSDB(String[] args) {
@@ -95,7 +103,6 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
case (1):
if (args[0].equals("help") || args[0].equals("-help")) {
doUsage();
- System.exit(0);
}
// If all numbers, it is a PID to attach to
// Else, it is a pathname to a .../bin/java for a core file.
@@ -117,24 +124,29 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
default:
System.out.println("HSDB Error: Too many options specified");
doUsage();
- System.exit(1);
}
}
- private void run() {
- // At this point, if pidText != null we are supposed to attach to it.
- // Else, if execPath != null, it is the path of a jdk/bin/java
- // and coreFilename is the pathname of a core file we are
- // supposed to attach to.
+ // close this tool without calling System.exit
+ protected void closeUI() {
+ workerThread.shutdown();
+ frame.dispose();
+ }
+
+ public void run() {
+ // Don't start the UI if there were bad arguments.
+ if (argError) {
+ return;
+ }
agent = new HotSpotAgent();
workerThread = new WorkerThread();
attachMenuItems = new java.util.ArrayList();
detachMenuItems = new java.util.ArrayList();
- JFrame frame = new JFrame("HSDB - HotSpot Debugger");
+ frame = new JFrame("HSDB - HotSpot Debugger");
frame.setSize(800, 600);
- frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
JMenuBar menuBar = new JMenuBar();
@@ -197,7 +209,7 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
item = createMenuItem("Exit",
new ActionListener() {
public void actionPerformed(ActionEvent e) {
- System.exit(0);
+ closeUI();
}
});
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
@@ -406,7 +418,15 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
}
});
- if (pidText != null) {
+ // If jvmDebugger is already set, we have been given a JVMDebugger.
+ // Otherwise, if pidText != null we are supposed to attach to it.
+ // Finally, if execPath != null, it is the path of a jdk/bin/java
+ // and coreFilename is the pathname of a core file we are
+ // supposed to attach to.
+
+ if (jvmDebugger != null) {
+ attach(jvmDebugger);
+ } else if (pidText != null) {
attach(pidText);
} else if (execPath != null) {
attach(execPath, coreFilename);
@@ -1113,6 +1133,12 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
});
}
+ // Attach to existing JVMDebugger, which should be already attached to a core/process.
+ private void attach(JVMDebugger d) {
+ attached = true;
+ showThreadsDialog();
+ }
+
/** NOTE we are in a different thread here than either the main
thread or the Swing/AWT event handler thread, so we must be very
careful when creating or removing widgets */
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java
index bdf9bd369e6..c963350591d 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java
@@ -25,6 +25,8 @@
package sun.jvm.hotspot;
import java.rmi.RemoteException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import sun.jvm.hotspot.debugger.Debugger;
import sun.jvm.hotspot.debugger.DebuggerException;
@@ -63,7 +65,6 @@ public class HotSpotAgent {
private String os;
private String cpu;
- private String fileSep;
// The system can work in several ways:
// - Attaching to local process
@@ -155,6 +156,14 @@ public class HotSpotAgent {
go();
}
+ /** This uses a JVMDebugger that is already attached to the core or process */
+ public synchronized void attach(JVMDebugger d)
+ throws DebuggerException {
+ debugger = d;
+ isServer = false;
+ go();
+ }
+
/** This attaches to a "debug server" on a remote machine; this
remote server has already attached to a process or opened a
core file and is waiting for RMI calls on the Debugger object to
@@ -303,28 +312,37 @@ public class HotSpotAgent {
// server, but not client attaching to server)
//
- try {
- os = PlatformInfo.getOS();
- cpu = PlatformInfo.getCPU();
- }
- catch (UnsupportedPlatformException e) {
- throw new DebuggerException(e);
- }
- fileSep = System.getProperty("file.separator");
+ // Handle existing or alternate JVMDebugger:
+ // these will set os, cpu independently of our PlatformInfo implementation.
+ String alternateDebugger = System.getProperty("sa.altDebugger");
+ if (debugger != null) {
+ setupDebuggerExisting();
+
+ } else if (alternateDebugger != null) {
+ setupDebuggerAlternate(alternateDebugger);
- if (os.equals("solaris")) {
- setupDebuggerSolaris();
- } else if (os.equals("win32")) {
- setupDebuggerWin32();
- } else if (os.equals("linux")) {
- setupDebuggerLinux();
- } else if (os.equals("bsd")) {
- setupDebuggerBsd();
- } else if (os.equals("darwin")) {
- setupDebuggerDarwin();
} else {
- // Add support for more operating systems here
- throw new DebuggerException("Operating system " + os + " not yet supported");
+ // Otherwise, os, cpu are those of our current platform:
+ try {
+ os = PlatformInfo.getOS();
+ cpu = PlatformInfo.getCPU();
+ } catch (UnsupportedPlatformException e) {
+ throw new DebuggerException(e);
+ }
+ if (os.equals("solaris")) {
+ setupDebuggerSolaris();
+ } else if (os.equals("win32")) {
+ setupDebuggerWin32();
+ } else if (os.equals("linux")) {
+ setupDebuggerLinux();
+ } else if (os.equals("bsd")) {
+ setupDebuggerBsd();
+ } else if (os.equals("darwin")) {
+ setupDebuggerDarwin();
+ } else {
+ // Add support for more operating systems here
+ throw new DebuggerException("Operating system " + os + " not yet supported");
+ }
}
if (isServer) {
@@ -423,6 +441,41 @@ public class HotSpotAgent {
// OS-specific debugger setup/connect routines
//
+ // Use the existing JVMDebugger, as passed to our constructor.
+ // Retrieve os and cpu from that debugger, not the current platform.
+ private void setupDebuggerExisting() {
+
+ os = debugger.getOS();
+ cpu = debugger.getCPU();
+ setupJVMLibNames(os);
+ machDesc = debugger.getMachineDescription();
+ }
+
+ // Given a classname, load an alternate implementation of JVMDebugger.
+ private void setupDebuggerAlternate(String alternateName) {
+
+ try {
+ Class c = Class.forName(alternateName);
+ Constructor cons = c.getConstructor();
+ debugger = (JVMDebugger) cons.newInstance();
+ attachDebugger();
+ setupDebuggerExisting();
+
+ } catch (ClassNotFoundException cnfe) {
+ throw new DebuggerException("Cannot find alternate SA Debugger: '" + alternateName + "'");
+ } catch (NoSuchMethodException nsme) {
+ throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' has missing constructor.");
+ } catch (InstantiationException ie) {
+ throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", ie);
+ } catch (IllegalAccessException iae) {
+ throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", iae);
+ } catch (InvocationTargetException iae) {
+ throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", iae);
+ }
+
+ System.err.println("Loaded alternate HotSpot SA Debugger: " + alternateName);
+ }
+
//
// Solaris
//
@@ -466,6 +519,11 @@ public class HotSpotAgent {
debugger = new RemoteDebuggerClient(remote);
machDesc = ((RemoteDebuggerClient) debugger).getMachineDescription();
os = debugger.getOS();
+ setupJVMLibNames(os);
+ cpu = debugger.getCPU();
+ }
+
+ private void setupJVMLibNames(String os) {
if (os.equals("solaris")) {
setupJVMLibNamesSolaris();
} else if (os.equals("win32")) {
@@ -479,8 +537,6 @@ public class HotSpotAgent {
} else {
throw new RuntimeException("Unknown OS type");
}
-
- cpu = debugger.getCPU();
}
private void setupJVMLibNamesSolaris() {
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java
index 9e85e133b3a..cff29ce8edc 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java
@@ -26,11 +26,11 @@ package sun.jvm.hotspot.debugger.linux;
import sun.jvm.hotspot.debugger.*;
-class LinuxAddress implements Address {
+public class LinuxAddress implements Address {
protected LinuxDebugger debugger;
protected long addr;
- LinuxAddress(LinuxDebugger debugger, long addr) {
+ public LinuxAddress(LinuxDebugger debugger, long addr) {
this.debugger = debugger;
this.addr = addr;
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java
index 310acb88ac7..99291aada29 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java
@@ -26,8 +26,8 @@ package sun.jvm.hotspot.debugger.linux;
import sun.jvm.hotspot.debugger.*;
-class LinuxOopHandle extends LinuxAddress implements OopHandle {
- LinuxOopHandle(LinuxDebugger debugger, long addr) {
+public class LinuxOopHandle extends LinuxAddress implements OopHandle {
+ public LinuxOopHandle(LinuxDebugger debugger, long addr) {
super(debugger, addr);
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
index 0a9d9436878..f84da894ac2 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
@@ -246,7 +246,7 @@ public class VM {
}
}
- private static final boolean disableDerivedPrinterTableCheck;
+ private static final boolean disableDerivedPointerTableCheck;
private static final Properties saProps;
static {
@@ -256,12 +256,12 @@ public class VM {
url = VM.class.getClassLoader().getResource("sa.properties");
saProps.load(new BufferedInputStream(url.openStream()));
} catch (Exception e) {
- throw new RuntimeException("Unable to load properties " +
+ System.err.println("Unable to load properties " +
(url == null ? "null" : url.toString()) +
": " + e.getMessage());
}
- disableDerivedPrinterTableCheck = System.getProperty("sun.jvm.hotspot.runtime.VM.disableDerivedPointerTableCheck") != null;
+ disableDerivedPointerTableCheck = System.getProperty("sun.jvm.hotspot.runtime.VM.disableDerivedPointerTableCheck") != null;
}
private VM(TypeDataBase db, JVMDebugger debugger, boolean isBigEndian) {
@@ -371,7 +371,8 @@ public class VM {
/** This is used by the debugging system */
public static void initialize(TypeDataBase db, JVMDebugger debugger) {
if (soleInstance != null) {
- throw new RuntimeException("Attempt to initialize VM twice");
+ // Using multiple SA Tool classes in the same process creates a call here.
+ return;
}
soleInstance = new VM(db, debugger, debugger.getMachineDescription().isBigEndian());
@@ -683,7 +684,7 @@ public class VM {
/** Returns true if C2 derived pointer table should be used, false otherwise */
public boolean useDerivedPointerTable() {
- return !disableDerivedPrinterTableCheck;
+ return !disableDerivedPointerTableCheck;
}
/** Returns the code cache; should not be used if is core build */
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java
index 77f0f800445..eeda376b1d6 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java
@@ -41,6 +41,14 @@ import sun.jvm.hotspot.utilities.*;
public class ClassLoaderStats extends Tool {
boolean verbose = true;
+ public ClassLoaderStats() {
+ super();
+ }
+
+ public ClassLoaderStats(JVMDebugger d) {
+ super(d);
+ }
+
public static void main(String[] args) {
ClassLoaderStats cls = new ClassLoaderStats();
cls.start(args);
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java
index 79e6784a63e..ed707b9ee8a 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java
@@ -24,6 +24,7 @@
package sun.jvm.hotspot.tools;
+import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.tools.*;
import sun.jvm.hotspot.oops.*;
@@ -42,6 +43,15 @@ import java.util.Comparator;
* summary of these objects in the form of a histogram.
*/
public class FinalizerInfo extends Tool {
+
+ public FinalizerInfo() {
+ super();
+ }
+
+ public FinalizerInfo(JVMDebugger d) {
+ super(d);
+ }
+
public static void main(String[] args) {
FinalizerInfo finfo = new FinalizerInfo();
finfo.start(args);
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java
index effeabb582a..c8db6d6b044 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java
@@ -25,10 +25,19 @@
package sun.jvm.hotspot.tools;
import java.io.PrintStream;
+import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.runtime.*;
public class FlagDumper extends Tool {
+ public FlagDumper() {
+ super();
+ }
+
+ public FlagDumper(JVMDebugger d) {
+ super(d);
+ }
+
public void run() {
VM.Flag[] flags = VM.getVM().getCommandLineFlags();
PrintStream out = System.out;
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java
index 5a7c06618b9..c5af0ed005d 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java
@@ -25,6 +25,7 @@
package sun.jvm.hotspot.tools;
import sun.jvm.hotspot.utilities.HeapHprofBinWriter;
+import sun.jvm.hotspot.debugger.JVMDebugger;
import java.io.IOException;
/*
@@ -42,6 +43,11 @@ public class HeapDumper extends Tool {
this.dumpFile = dumpFile;
}
+ public HeapDumper(String dumpFile, JVMDebugger d) {
+ super(d);
+ this.dumpFile = dumpFile;
+ }
+
protected void printFlagsUsage() {
System.out.println(" \tto dump heap to " +
DEFAULT_DUMP_FILE);
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
index 87621655269..a0123dd4c99 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
@@ -29,12 +29,21 @@ import sun.jvm.hotspot.gc_interface.*;
import sun.jvm.hotspot.gc_implementation.g1.*;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.*;
import sun.jvm.hotspot.gc_implementation.shared.*;
+import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.runtime.*;
public class HeapSummary extends Tool {
+ public HeapSummary() {
+ super();
+ }
+
+ public HeapSummary(JVMDebugger d) {
+ super(d);
+ }
+
public static void main(String[] args) {
HeapSummary hs = new HeapSummary();
hs.start(args);
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java
index a9f6c0e9c90..f2452420744 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java
@@ -25,12 +25,21 @@
package sun.jvm.hotspot.tools;
import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.debugger.JVMDebugger;
public class JInfo extends Tool {
+ public JInfo() {
+ super();
+ }
+
public JInfo(int m) {
mode = m;
}
+ public JInfo(JVMDebugger d) {
+ super(d);
+ }
+
protected boolean needsJavaPrefix() {
return false;
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java
index d9ea364edaa..f6f3c0741c0 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java
@@ -25,6 +25,7 @@
package sun.jvm.hotspot.tools;
import java.io.*;
+import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.utilities.*;
public class JMap extends Tool {
@@ -36,6 +37,10 @@ public class JMap extends Tool {
this(MODE_PMAP);
}
+ public JMap(JVMDebugger d) {
+ super(d);
+ }
+
protected boolean needsJavaPrefix() {
return false;
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java
index 95f46445f8a..9301f1059fd 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java
@@ -25,9 +25,19 @@
package sun.jvm.hotspot.tools;
import java.io.*;
+import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.runtime.*;
public class JSnap extends Tool {
+
+ public JSnap() {
+ super();
+ }
+
+ public JSnap(JVMDebugger d) {
+ super(d);
+ }
+
public void run() {
final PrintStream out = System.out;
if (PerfMemory.initialized()) {
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java
index 9e0688cf393..7cbe8f4d945 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java
@@ -24,6 +24,8 @@
package sun.jvm.hotspot.tools;
+import sun.jvm.hotspot.debugger.JVMDebugger;
+
public class JStack extends Tool {
public JStack(boolean mixedMode, boolean concurrentLocks) {
this.mixedMode = mixedMode;
@@ -34,6 +36,10 @@ public class JStack extends Tool {
this(true, true);
}
+ public JStack(JVMDebugger d) {
+ super(d);
+ }
+
protected boolean needsJavaPrefix() {
return false;
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java
index f03469e13f1..168202eec2c 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java
@@ -33,6 +33,14 @@ import java.io.PrintStream;
an object histogram from a remote or crashed VM. */
public class ObjectHistogram extends Tool {
+ public ObjectHistogram() {
+ super();
+ }
+
+ public ObjectHistogram(JVMDebugger d) {
+ super(d);
+ }
+
public void run() {
run(System.out, System.err);
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java
index 70bd55513b9..2a234130991 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java
@@ -31,6 +31,15 @@ import sun.jvm.hotspot.debugger.cdbg.*;
import sun.jvm.hotspot.runtime.*;
public class PMap extends Tool {
+
+ public PMap() {
+ super();
+ }
+
+ public PMap(JVMDebugger d) {
+ super(d);
+ }
+
public void run() {
run(System.out);
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java
index 0b3720ff594..7f10612b317 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java
@@ -45,6 +45,10 @@ public class PStack extends Tool {
this(true, true);
}
+ public PStack(JVMDebugger d) {
+ super(d);
+ }
+
public void run() {
run(System.out);
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java
index 83270bfdeff..eb0cc88d116 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java
@@ -45,6 +45,16 @@ public class StackTrace extends Tool {
run(System.out);
}
+ public StackTrace(JVMDebugger d) {
+ super(d);
+ }
+
+ public StackTrace(JVMDebugger d, boolean v, boolean concurrentLocks) {
+ super(d);
+ this.verbose = v;
+ this.concurrentLocks = concurrentLocks;
+ }
+
public void run(java.io.PrintStream tty) {
// Ready to go with the database...
try {
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java
index bb4f703c64b..d601fef4401 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java
@@ -27,10 +27,19 @@ package sun.jvm.hotspot.tools;
import java.io.PrintStream;
import java.util.*;
+import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.runtime.*;
public class SysPropsDumper extends Tool {
+ public SysPropsDumper() {
+ super();
+ }
+
+ public SysPropsDumper(JVMDebugger d) {
+ super(d);
+ }
+
public void run() {
Properties sysProps = VM.getVM().getSystemProperties();
PrintStream out = System.out;
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java
index 4279c425bd8..3021801c9dd 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java
@@ -35,6 +35,7 @@ import sun.jvm.hotspot.debugger.*;
public abstract class Tool implements Runnable {
private HotSpotAgent agent;
+ private JVMDebugger jvmDebugger;
private int debugeeType;
// debugeeType is one of constants below
@@ -42,6 +43,13 @@ public abstract class Tool implements Runnable {
protected static final int DEBUGEE_CORE = 1;
protected static final int DEBUGEE_REMOTE = 2;
+ public Tool() {
+ }
+
+ public Tool(JVMDebugger d) {
+ jvmDebugger = d;
+ }
+
public String getName() {
return getClass().getName();
}
@@ -90,7 +98,6 @@ public abstract class Tool implements Runnable {
protected void usage() {
printUsage();
- System.exit(1);
}
/*
@@ -106,13 +113,13 @@ public abstract class Tool implements Runnable {
protected void stop() {
if (agent != null) {
agent.detach();
- System.exit(0);
}
}
protected void start(String[] args) {
if ((args.length < 1) || (args.length > 2)) {
usage();
+ return;
}
// Attempt to handle -h or -help or some invalid flag
@@ -185,13 +192,31 @@ public abstract class Tool implements Runnable {
}
if (e.getMessage() != null) {
err.print(e.getMessage());
+ e.printStackTrace();
}
err.println();
- System.exit(1);
+ return;
}
err.println("Debugger attached successfully.");
+ startInternal();
+ }
+ // When using an existing JVMDebugger.
+ public void start() {
+
+ if (jvmDebugger == null) {
+ throw new RuntimeException("Tool.start() called with no JVMDebugger set.");
+ }
+ agent = new HotSpotAgent();
+ agent.attach(jvmDebugger);
+ startInternal();
+ }
+
+ // Remains of the start mechanism, common to both start methods.
+ private void startInternal() {
+
+ PrintStream err = System.err;
VM vm = VM.getVM();
if (vm.isCore()) {
err.println("Core build detected.");
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java
index 34ccc102acb..96817b26226 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java
@@ -25,6 +25,7 @@
package sun.jvm.hotspot.tools.jcore;
import java.io.*;
+import java.lang.reflect.Constructor;
import java.util.jar.JarOutputStream;
import java.util.jar.JarEntry;
import java.util.jar.Manifest;
@@ -38,6 +39,16 @@ public class ClassDump extends Tool {
private ClassFilter classFilter;
private String outputDirectory;
private JarOutputStream jarStream;
+ private String pkgList;
+
+ public ClassDump() {
+ super();
+ }
+
+ public ClassDump(JVMDebugger d, String pkgList) {
+ super(d);
+ this.pkgList = pkgList;
+ }
public void setClassFilter(ClassFilter cf) {
classFilter = cf;
@@ -63,6 +74,25 @@ public class ClassDump extends Tool {
public void run() {
// Ready to go with the database...
try {
+ // The name of the filter always comes from a System property.
+ // If we have a pkgList, pass it, otherwise let the filter read
+ // its own System property for the list of classes.
+ String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter",
+ "sun.jvm.hotspot.tools.jcore.PackageNameFilter");
+ try {
+ Class filterClass = Class.forName(filterClassName);
+ if (pkgList == null) {
+ classFilter = (ClassFilter) filterClass.newInstance();
+ } else {
+ Constructor con = filterClass.getConstructor(String.class);
+ classFilter = (ClassFilter) con.newInstance(pkgList);
+ }
+ } catch(Exception exp) {
+ System.err.println("Warning: Can not create class filter!");
+ }
+
+ String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir", ".");
+ setOutputDirectory(outputDirectory);
// walk through the system dictionary
SystemDictionary dict = VM.getVM().getSystemDictionary();
@@ -139,26 +169,8 @@ public class ClassDump extends Tool {
}
public static void main(String[] args) {
- // load class filters
- ClassFilter classFilter = null;
- String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter");
- if (filterClassName != null) {
- try {
- Class filterClass = Class.forName(filterClassName);
- classFilter = (ClassFilter) filterClass.newInstance();
- } catch(Exception exp) {
- System.err.println("Warning: Can not create class filter!");
- }
- }
-
- String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir");
- if (outputDirectory == null)
- outputDirectory = ".";
-
ClassDump cd = new ClassDump();
- cd.setClassFilter(classFilter);
- cd.setOutputDirectory(outputDirectory);
cd.start(args);
cd.stop();
}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java
index e46de0194d7..09874af178e 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java
@@ -24,12 +24,22 @@
package sun.jvm.hotspot.tools.soql;
+import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.tools.*;
import sun.jvm.hotspot.utilities.*;
import sun.jvm.hotspot.utilities.soql.*;
/** This is command line JavaScript debugger console */
public class JSDB extends Tool {
+
+ public JSDB() {
+ super();
+ }
+
+ public JSDB(JVMDebugger d) {
+ super(d);
+ }
+
public static void main(String[] args) {
JSDB jsdb = new JSDB();
jsdb.start(args);
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java
index 3a4c2470b1b..b3054b90bd0 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java
@@ -44,6 +44,14 @@ public class SOQL extends Tool {
soql.stop();
}
+ public SOQL() {
+ super();
+ }
+
+ public SOQL(JVMDebugger d) {
+ super(d);
+ }
+
protected SOQLEngine soqlEngine;
protected BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
protected PrintStream out = System.out;
From 8d048d554de09f44a53315991a6229a4595ee239 Mon Sep 17 00:00:00 2001
From: Ioi Lam
Date: Thu, 27 Jun 2013 10:03:21 -0700
Subject: [PATCH 003/101] 8016075: Win32 crash with CDS enabled and small heap
size
Fixed MetaspaceShared::is_in_shared_space
Reviewed-by: coleenp, hseigel
---
hotspot/src/share/vm/memory/filemap.cpp | 10 ++++++
hotspot/src/share/vm/memory/filemap.hpp | 1 +
.../src/share/vm/memory/metaspaceShared.cpp | 33 +++++--------------
3 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp
index dbc0c87edce..5dfaf6f9701 100644
--- a/hotspot/src/share/vm/memory/filemap.cpp
+++ b/hotspot/src/share/vm/memory/filemap.cpp
@@ -549,3 +549,13 @@ bool FileMapInfo::is_in_shared_space(const void* p) {
return false;
}
+
+void FileMapInfo::print_shared_spaces() {
+ gclog_or_tty->print_cr("Shared Spaces:");
+ for (int i = 0; i < MetaspaceShared::n_regions; i++) {
+ struct FileMapInfo::FileMapHeader::space_info* si = &_header._space[i];
+ gclog_or_tty->print(" %s " INTPTR_FORMAT "-" INTPTR_FORMAT,
+ shared_region_name[i],
+ si->_base, si->_base + si->_used);
+ }
+}
diff --git a/hotspot/src/share/vm/memory/filemap.hpp b/hotspot/src/share/vm/memory/filemap.hpp
index a11914b9c01..ee4ccec5bfe 100644
--- a/hotspot/src/share/vm/memory/filemap.hpp
+++ b/hotspot/src/share/vm/memory/filemap.hpp
@@ -149,6 +149,7 @@ public:
// Return true if given address is in the mapped shared space.
bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false);
+ void print_shared_spaces() NOT_CDS_RETURN;
};
#endif // SHARE_VM_MEMORY_FILEMAP_HPP
diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp
index d2c91827485..c7d61f7b732 100644
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp
@@ -826,35 +826,15 @@ public:
bool reading() const { return true; }
};
-
-// Save bounds of shared spaces mapped in.
-static char* _ro_base = NULL;
-static char* _rw_base = NULL;
-static char* _md_base = NULL;
-static char* _mc_base = NULL;
-
// Return true if given address is in the mapped shared space.
bool MetaspaceShared::is_in_shared_space(const void* p) {
- if (_ro_base == NULL || _rw_base == NULL) {
- return false;
- } else {
- return ((p >= _ro_base && p < (_ro_base + SharedReadOnlySize)) ||
- (p >= _rw_base && p < (_rw_base + SharedReadWriteSize)));
- }
+ return UseSharedSpaces && FileMapInfo::current_info()->is_in_shared_space(p);
}
void MetaspaceShared::print_shared_spaces() {
- gclog_or_tty->print_cr("Shared Spaces:");
- gclog_or_tty->print(" read-only " INTPTR_FORMAT "-" INTPTR_FORMAT,
- _ro_base, _ro_base + SharedReadOnlySize);
- gclog_or_tty->print(" read-write " INTPTR_FORMAT "-" INTPTR_FORMAT,
- _rw_base, _rw_base + SharedReadWriteSize);
- gclog_or_tty->cr();
- gclog_or_tty->print(" misc-data " INTPTR_FORMAT "-" INTPTR_FORMAT,
- _md_base, _md_base + SharedMiscDataSize);
- gclog_or_tty->print(" misc-code " INTPTR_FORMAT "-" INTPTR_FORMAT,
- _mc_base, _mc_base + SharedMiscCodeSize);
- gclog_or_tty->cr();
+ if (UseSharedSpaces) {
+ FileMapInfo::current_info()->print_shared_spaces();
+ }
}
@@ -874,6 +854,11 @@ bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) {
assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
+ char* _ro_base = NULL;
+ char* _rw_base = NULL;
+ char* _md_base = NULL;
+ char* _mc_base = NULL;
+
// Map each shared region
if ((_ro_base = mapinfo->map_region(ro)) != NULL &&
(_rw_base = mapinfo->map_region(rw)) != NULL &&
From 17ebe26fa04dc940965a15d4a54f79eda46e41da Mon Sep 17 00:00:00 2001
From: Lois Foltan
Date: Sun, 30 Jun 2013 09:59:08 -0400
Subject: [PATCH 004/101] 7007040: Check of capacity paramenters in
JNI_PushLocalFrame is wrong
Changed AND to OR
Reviewed-by: coleenp, hseigel
---
hotspot/src/share/vm/prims/jni.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp
index 85f3e2e0e41..f37ea34c46d 100644
--- a/hotspot/src/share/vm/prims/jni.cpp
+++ b/hotspot/src/share/vm/prims/jni.cpp
@@ -879,7 +879,7 @@ JNI_ENTRY(jint, jni_PushLocalFrame(JNIEnv *env, jint capacity))
env, capacity);
#endif /* USDT2 */
//%note jni_11
- if (capacity < 0 && capacity > MAX_REASONABLE_LOCAL_CAPACITY) {
+ if (capacity < 0 || capacity > MAX_REASONABLE_LOCAL_CAPACITY) {
#ifndef USDT2
DTRACE_PROBE1(hotspot_jni, PushLocalFrame__return, JNI_ERR);
#else /* USDT2 */
From 8ce6e0db3dd5ce8b8f00e86c91bb472341cdbc2b Mon Sep 17 00:00:00 2001
From: Volker Simonis
Date: Mon, 1 Jul 2013 09:13:19 +0000
Subject: [PATCH 005/101] 7060111: race condition in VMError::report_and_die()
Reviewed-by: zgu, coleenp
---
hotspot/src/share/vm/utilities/vmError.cpp | 18 +++++++++---------
hotspot/src/share/vm/utilities/vmError.hpp | 5 ++++-
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp
index f7b940b52e7..64f753bc75c 100644
--- a/hotspot/src/share/vm/utilities/vmError.cpp
+++ b/hotspot/src/share/vm/utilities/vmError.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -799,6 +799,14 @@ void VMError::report(outputStream* st) {
VMError* volatile VMError::first_error = NULL;
volatile jlong VMError::first_error_tid = -1;
+// An error could happen before tty is initialized or after it has been
+// destroyed. Here we use a very simple unbuffered fdStream for printing.
+// Only out.print_raw() and out.print_raw_cr() should be used, as other
+// printing methods need to allocate large buffer on stack. To format a
+// string, use jio_snprintf() with a static buffer or use staticBufferStream.
+fdStream VMError::out(defaultStream::output_fd());
+fdStream VMError::log; // error log used by VMError::report_and_die()
+
/** Expand a pattern into a buffer starting at pos and open a file using constructed path */
static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) {
int fd = -1;
@@ -853,13 +861,6 @@ void VMError::report_and_die() {
// Don't allocate large buffer on stack
static char buffer[O_BUFLEN];
- // An error could happen before tty is initialized or after it has been
- // destroyed. Here we use a very simple unbuffered fdStream for printing.
- // Only out.print_raw() and out.print_raw_cr() should be used, as other
- // printing methods need to allocate large buffer on stack. To format a
- // string, use jio_snprintf() with a static buffer or use staticBufferStream.
- static fdStream out(defaultStream::output_fd());
-
// How many errors occurred in error handler when reporting first_error.
static int recursive_error_count;
@@ -868,7 +869,6 @@ void VMError::report_and_die() {
static bool out_done = false; // done printing to standard out
static bool log_done = false; // done saving error log
static bool transmit_report_done = false; // done error reporting
- static fdStream log; // error log
// disble NMT to avoid further exception
MemTracker::shutdown(MemTracker::NMT_error_reporting);
diff --git a/hotspot/src/share/vm/utilities/vmError.hpp b/hotspot/src/share/vm/utilities/vmError.hpp
index f298c1edbf5..1b1608bdc90 100644
--- a/hotspot/src/share/vm/utilities/vmError.hpp
+++ b/hotspot/src/share/vm/utilities/vmError.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -96,6 +96,9 @@ class VMError : public StackObj {
return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR);
}
+ static fdStream out;
+ static fdStream log; // error log used by VMError::report_and_die()
+
public:
// Constructor for crashes
From 2977c8fca37be2ecedb504684daa93b3a6a7b89c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rickard=20B=C3=A4ckman?=
Date: Wed, 12 Jun 2013 09:49:42 +0200
Subject: [PATCH 006/101] 8016444: Duplicate zombie check in safe_for_sender
Reviewed-by: dholmes, sla
---
hotspot/src/cpu/sparc/vm/frame_sparc.cpp | 5 -----
hotspot/src/share/vm/memory/referenceProcessorStats.hpp | 2 +-
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp
index 55f344f55a1..ac9746679b3 100644
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp
@@ -257,11 +257,6 @@ bool frame::safe_for_sender(JavaThread *thread) {
return false;
}
- // Could be a zombie method
- if (sender_blob->is_zombie() || sender_blob->is_unloaded()) {
- return false;
- }
-
// It should be safe to construct the sender though it might not be valid
frame sender(_SENDER_SP, younger_sp, adjusted_stack);
diff --git a/hotspot/src/share/vm/memory/referenceProcessorStats.hpp b/hotspot/src/share/vm/memory/referenceProcessorStats.hpp
index 73208331bac..7497c09b92f 100644
--- a/hotspot/src/share/vm/memory/referenceProcessorStats.hpp
+++ b/hotspot/src/share/vm/memory/referenceProcessorStats.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
From 93241c0ecb0fc17b8999790d92f57b70c617ac6a Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Tue, 18 Jun 2013 18:43:05 +0530
Subject: [PATCH 007/101] 8012698: [nashorn] tests fail to run with agentvm or
samevm
Reviewed-by: hannesw, jlaskey
---
.../test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java | 2 +-
.../test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java | 2 +-
.../test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java | 2 +-
.../test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java | 2 +-
.../test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java | 2 +-
.../test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java
index 2cfdbf00046..b6e5bbcddc9 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java
@@ -39,7 +39,7 @@ import org.testng.annotations.Test;
/**
* @test
* @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.BooleanAccessTest
- * @run testng jdk.nashorn.api.javaaccess.BooleanAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.BooleanAccessTest
*/
public class BooleanAccessTest {
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java
index 69ca20c6c16..6de10a54783 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java
@@ -42,7 +42,7 @@ import org.testng.annotations.Test;
/**
* @test
* @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.MethodAccessTest
- * @run testng jdk.nashorn.api.javaaccess.MethodAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.MethodAccessTest
*/
public class MethodAccessTest {
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java
index 21994960176..0b7cb027b61 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java
@@ -39,7 +39,7 @@ import org.testng.annotations.Test;
/**
* @test
* @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberAccessTest
- * @run testng jdk.nashorn.api.javaaccess.NumberAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.NumberAccessTest
*/
public class NumberAccessTest {
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java
index ae719e7fb62..0302259e95b 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java
@@ -38,7 +38,7 @@ import org.testng.annotations.Test;
/**
* @test
* @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberBoxingTest
- * @run testng jdk.nashorn.api.javaaccess.NumberBoxingTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.NumberBoxingTest
*/
public class NumberBoxingTest {
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java
index 7172051416c..2a51e7a9ce1 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java
@@ -38,7 +38,7 @@ import org.testng.annotations.Test;
/**
* @test
* @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.ObjectAccessTest
- * @run testng jdk.nashorn.api.javaaccess.ObjectAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.ObjectAccessTest
*/
public class ObjectAccessTest {
diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java
index 6a7713bd6a4..dd4b5020787 100644
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java
@@ -38,7 +38,7 @@ import org.testng.annotations.Test;
/**
* @test
* @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.StringAccessTest
- * @run testng jdk.nashorn.api.javaaccess.StringAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.StringAccessTest
*/
public class StringAccessTest {
From d643a2fcd763aa3b4c7a0fc107d0b6a441b938ca Mon Sep 17 00:00:00 2001
From: James Laskey
Date: Wed, 19 Jun 2013 09:10:49 -0300
Subject: [PATCH 008/101] 8010697: DeletedArrayFilter seems to leak memory
Reviewed-by: hannesw, sundar
---
.../nashorn/internal/objects/NativeArray.java | 8 ++-
.../internal/runtime/arrays/ArrayData.java | 23 ++++++++
.../internal/runtime/arrays/ArrayFilter.java | 12 ++++
.../runtime/arrays/DeletedArrayFilter.java | 2 +
.../arrays/DeletedRangeArrayFilter.java | 3 +
.../runtime/arrays/ObjectArrayData.java | 16 ++++-
.../runtime/arrays/SparseArrayData.java | 12 ++++
nashorn/test/script/basic/JDK-8010697.js | 59 +++++++++++++++++++
.../test/script/basic/JDK-8010697.js.EXPECTED | 1 +
9 files changed, 133 insertions(+), 3 deletions(-)
create mode 100644 nashorn/test/script/basic/JDK-8010697.js
create mode 100644 nashorn/test/script/basic/JDK-8010697.js.EXPECTED
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java
index a480c590062..6eb3603784c 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java
@@ -856,8 +856,12 @@ public final class NativeArray extends ScriptObject {
}
// delete missing elements - which are at the end of sorted array
- sobj.setArray(array.delete(sorted.length, len - 1));
- }
+ if (sorted.length != len) {
+ array = array.delete(sorted.length, len - 1);
+ }
+
+ sobj.setArray(array);
+ }
return sobj;
} catch (final ClassCastException | NullPointerException e) {
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java
index fca724a8bf3..d11059b275d 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java
@@ -294,6 +294,29 @@ public abstract class ArrayData {
*/
public abstract ArrayData set(int index, double value, boolean strict);
+ /**
+ * Set an empty value at a given index. Should only affect Object array.
+ *
+ * @param index the index
+ * @return new array data (or same)
+ */
+ public ArrayData setEmpty(final int index) {
+ // Do nothing.
+ return this;
+ }
+
+ /**
+ * Set an empty value for a given range. Should only affect Object array.
+ *
+ * @param lo range low end
+ * @param hi range high end
+ * @return new array data (or same)
+ */
+ public ArrayData setEmpty(final long lo, final long hi) {
+ // Do nothing.
+ return this;
+ }
+
/**
* Get an int value from a given index
*
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java
index c347ed70e8b..7a20f788fda 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java
@@ -128,6 +128,18 @@ abstract class ArrayFilter extends ArrayData {
return this;
}
+ @Override
+ public ArrayData setEmpty(final int index) {
+ underlying.setEmpty(index);
+ return this;
+ }
+
+ @Override
+ public ArrayData setEmpty(final long lo, final long hi) {
+ underlying.setEmpty(lo, hi);
+ return this;
+ }
+
@Override
public int getInt(final int index) {
return underlying.getInt(index);
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java
index 57bea4cf1e6..b5f1f16d024 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java
@@ -142,6 +142,7 @@ final class DeletedArrayFilter extends ArrayFilter {
final long longIndex = ArrayIndex.toLongIndex(index);
assert longIndex >= 0 && longIndex < length();
deleted.set(longIndex);
+ underlying.setEmpty(index);
return this;
}
@@ -149,6 +150,7 @@ final class DeletedArrayFilter extends ArrayFilter {
public ArrayData delete(final long fromIndex, final long toIndex) {
assert fromIndex >= 0 && fromIndex <= toIndex && toIndex < length();
deleted.setRange(fromIndex, toIndex + 1);
+ underlying.setEmpty(fromIndex, toIndex);
return this;
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java
index 588252ac4f2..29c443bae10 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java
@@ -202,6 +202,8 @@ final class DeletedRangeArrayFilter extends ArrayFilter {
@Override
public ArrayData delete(final int index) {
final long longIndex = ArrayIndex.toLongIndex(index);
+ underlying.setEmpty(index);
+
if (longIndex + 1 == lo) {
lo = longIndex;
} else if (longIndex - 1 == hi) {
@@ -220,6 +222,7 @@ final class DeletedRangeArrayFilter extends ArrayFilter {
}
lo = Math.min(fromIndex, lo);
hi = Math.max(toIndex, hi);
+ underlying.setEmpty(lo, hi);
return this;
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java
index cb1e2fa03ba..4b1f58a430a 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java
@@ -138,6 +138,18 @@ final class ObjectArrayData extends ArrayData {
return this;
}
+ @Override
+ public ArrayData setEmpty(final int index) {
+ array[index] = ScriptRuntime.EMPTY;
+ return this;
+ }
+
+ @Override
+ public ArrayData setEmpty(final long lo, final long hi) {
+ Arrays.fill(array, (int)Math.max(lo, 0L), (int)Math.min(hi, (long)Integer.MAX_VALUE), ScriptRuntime.EMPTY);
+ return this;
+ }
+
@Override
public int getInt(final int index) {
return JSType.toInt32(array[index]);
@@ -165,11 +177,13 @@ final class ObjectArrayData extends ArrayData {
@Override
public ArrayData delete(final int index) {
+ setEmpty(index);
return new DeletedRangeArrayFilter(this, index, index);
}
@Override
public ArrayData delete(final long fromIndex, final long toIndex) {
+ setEmpty(fromIndex, toIndex);
return new DeletedRangeArrayFilter(this, fromIndex, toIndex);
}
@@ -181,7 +195,7 @@ final class ObjectArrayData extends ArrayData {
final int newLength = (int) (length() - 1);
final Object elem = array[newLength];
- array[newLength] = 0;
+ setEmpty(newLength);
setLength(newLength);
return elem;
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java
index fd52f22db83..0ccbb23c535 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java
@@ -203,6 +203,18 @@ class SparseArrayData extends ArrayData {
return this;
}
+ @Override
+ public ArrayData setEmpty(final int index) {
+ underlying.setEmpty(index);
+ return this;
+ }
+
+ @Override
+ public ArrayData setEmpty(final long lo, final long hi) {
+ underlying.setEmpty(lo, hi);
+ return this;
+ }
+
@Override
public int getInt(final int index) {
if (index >= 0 && index < maxDenseLength) {
diff --git a/nashorn/test/script/basic/JDK-8010697.js b/nashorn/test/script/basic/JDK-8010697.js
new file mode 100644
index 00000000000..c1b8e572937
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8010697.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8010697: DeletedArrayFilter seems to leak memory
+ *
+ * @test
+ * @run
+ */
+
+var N = 1000;
+
+var array = new Array(N);
+var WeakReferenceArray = Java.type("java.lang.ref.WeakReference[]");
+var refArray = new WeakReferenceArray(N);
+
+for (var i = 0; i < N; i ++) {
+ var object = new java.lang.Object();
+ array[i] = object;
+ refArray[i] = new java.lang.ref.WeakReference(object);
+}
+
+object = null;
+
+for (var i = 0; i < N; i ++) {
+ delete array[i];
+}
+
+java.lang.System.gc();
+java.lang.System.gc();
+
+for (var i = 0; i < N; i ++) {
+ if (refArray[i].get() != null) {
+ print("Reference found at " + i);
+ exit(0);
+ }
+}
+
+print("All references gone");
diff --git a/nashorn/test/script/basic/JDK-8010697.js.EXPECTED b/nashorn/test/script/basic/JDK-8010697.js.EXPECTED
new file mode 100644
index 00000000000..fe74109082d
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8010697.js.EXPECTED
@@ -0,0 +1 @@
+All references gone
From 1d927dd28e688ae698294beebd1b6ebc380e1595 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Wed, 19 Jun 2013 21:07:59 +0530
Subject: [PATCH 009/101] 8015347: Parsing issue with decodeURIComponent
Reviewed-by: jlaskey, hannesw
---
.../nashorn/internal/runtime/URIUtils.java | 68 +++++++++++--------
nashorn/test/script/basic/JDK-8015347.js | 39 +++++++++++
2 files changed, 80 insertions(+), 27 deletions(-)
create mode 100644 nashorn/test/script/basic/JDK-8015347.js
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/URIUtils.java b/nashorn/src/jdk/nashorn/internal/runtime/URIUtils.java
index 448d72c364f..2321353fbaa 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/URIUtils.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/URIUtils.java
@@ -27,8 +27,6 @@ package jdk.nashorn.internal.runtime;
import static jdk.nashorn.internal.runtime.ECMAErrors.uriError;
-import java.io.UnsupportedEncodingException;
-
/**
* URI handling global functions. ECMA 15.1.3 URI Handling Function Properties
*
@@ -127,6 +125,7 @@ public final class URIUtils {
k += 2;
char C;
+ // Most significant bit is zero
if ((B & 0x80) == 0) {
C = (char) B;
if (!component && URI_RESERVED.indexOf(C) >= 0) {
@@ -137,49 +136,68 @@ public final class URIUtils {
sb.append(C);
}
} else {
- int n;
- for (n = 1; n < 6; n++) {
- if (((B << n) & 0x80) == 0) {
- break;
- }
- }
+ // n is utf8 length, V is codepoint and minV is lower bound
+ int n, V, minV;
- if (n == 1 || n > 4) {
+ if ((B & 0xC0) == 0x80) {
+ // 10xxxxxx - illegal first byte
+ return error(string, k);
+ } else if ((B & 0x20) == 0) {
+ // 110xxxxx 10xxxxxx
+ n = 2;
+ V = B & 0x1F;
+ minV = 0x80;
+ } else if ((B & 0x10) == 0) {
+ // 1110xxxx 10xxxxxx 10xxxxxx
+ n = 3;
+ V = B & 0x0F;
+ minV = 0x800;
+ } else if ((B & 0x08) == 0) {
+ // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ n = 4;
+ V = B & 0x07;
+ minV = 0x10000;
+ } else if ((B & 0x04) == 0) {
+ // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+ n = 5;
+ V = B & 0x03;
+ minV = 0x200000;
+ } else if ((B & 0x02) == 0) {
+ // 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+ n = 6;
+ V = B & 0x01;
+ minV = 0x4000000;
+ } else {
return error(string, k);
}
- if ((k + (3 * (n - 1))) >= len) {
+ // check bound for sufficient chars
+ if (k + (3*(n-1)) >= len) {
return error(string, k);
}
- final byte[] bbuf = new byte[n];
- bbuf[0] = (byte) B;
-
for (int j = 1; j < n; j++) {
k++;
if (string.charAt(k) != '%') {
return error(string, k);
}
- if (k + 2 == len) {
- return error(string, k);
- }
-
B = toHexByte(string.charAt(k + 1), string.charAt(k + 2));
if (B < 0 || (B & 0xC0) != 0x80) {
return error(string, k + 1);
}
+ V = (V << 6) | (B & 0x3F);
k += 2;
- bbuf[j] = (byte) B;
}
- int V;
- try {
- V = ucs4Char(bbuf);
- } catch (final Exception e) {
- throw uriError(e, "bad.uri", string, Integer.toString(k));
+ // Check for overlongs and invalid codepoints.
+ // The high and low surrogate halves used by UTF-16
+ // (U+D800 through U+DFFF) are not legal Unicode values.
+ if ((V < minV) || (V >= 0xD800 && V <= 0xDFFF)) {
+ V = Integer.MAX_VALUE;
}
+
if (V < 0x10000) {
C = (char) V;
if (!component && URI_RESERVED.indexOf(C) >= 0) {
@@ -224,10 +242,6 @@ public final class URIUtils {
return -1;
}
- private static int ucs4Char(final byte[] utf8) throws UnsupportedEncodingException {
- return new String(utf8, "UTF-8").codePointAt(0);
- }
-
private static String toHexEscape(final int u0) {
int u = u0;
int len;
diff --git a/nashorn/test/script/basic/JDK-8015347.js b/nashorn/test/script/basic/JDK-8015347.js
new file mode 100644
index 00000000000..d5a8ba318c0
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8015347.js
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8015347: Parsing issue with decodeURIComponent
+ *
+ * @test
+ * @run
+ */
+
+try {
+ decodeURIComponent("%C0%80");
+ fail("Should have thrown URIError");
+} catch (e) {
+ if (! (e instanceof URIError)) {
+ fail("Expected URIError, but got " + e);
+ }
+}
+
From 1a284a49c94aacbcdd5f52ac71fb42abbe004813 Mon Sep 17 00:00:00 2001
From: Maurizio Cimadamore
Date: Thu, 20 Jun 2013 08:45:43 +0100
Subject: [PATCH 010/101] 8016613: javac should avoid source 8 only analysis
when compiling for source 7
Reviewed-by: jjg
---
.../com/sun/tools/javac/code/Kinds.java | 10 +-
.../com/sun/tools/javac/comp/Attr.java | 123 ++++++++++--------
.../sun/tools/javac/comp/DeferredAttr.java | 6 +-
.../com/sun/tools/javac/comp/MemberEnter.java | 15 ++-
4 files changed, 93 insertions(+), 61 deletions(-)
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
index 08fbd1a57e4..5defddfb508 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -73,9 +73,13 @@ public class Kinds {
*/
public final static int MTH = 1 << 4;
+ /** Poly kind, for deferred types.
+ */
+ public final static int POLY = 1 << 5;
+
/** The error kind, which includes all other kinds.
*/
- public final static int ERR = (1 << 5) - 1;
+ public final static int ERR = (1 << 6) - 1;
/** The set of all kinds.
*/
@@ -83,7 +87,7 @@ public class Kinds {
/** Kinds for erroneous symbols that complement the above
*/
- public static final int ERRONEOUS = 1 << 6;
+ public static final int ERRONEOUS = 1 << 7;
public static final int AMBIGUOUS = ERRONEOUS+1; // ambiguous reference
public static final int HIDDEN = ERRONEOUS+2; // hidden method or field
public static final int STATICERR = ERRONEOUS+3; // nonstatic member from static context
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
index e24a69a4d99..c940b5f75b7 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -134,6 +134,7 @@ public class Attr extends JCTree.Visitor {
allowAnonOuterThis = source.allowAnonOuterThis();
allowStringsInSwitch = source.allowStringsInSwitch();
allowPoly = source.allowPoly();
+ allowTypeAnnos = source.allowTypeAnnotations();
allowLambda = source.allowLambda();
allowDefaultMethods = source.allowDefaultMethods();
sourceName = source.name;
@@ -147,6 +148,7 @@ public class Attr extends JCTree.Visitor {
statInfo = new ResultInfo(NIL, Type.noType);
varInfo = new ResultInfo(VAR, Type.noType);
unknownExprInfo = new ResultInfo(VAL, Type.noType);
+ unknownAnyPolyInfo = new ResultInfo(VAL, Infer.anyPoly);
unknownTypeInfo = new ResultInfo(TYP, Type.noType);
unknownTypeExprInfo = new ResultInfo(Kinds.TYP | Kinds.VAL, Type.noType);
recoveryInfo = new RecoveryInfo(deferredAttr.emptyDeferredAttrContext);
@@ -160,6 +162,10 @@ public class Attr extends JCTree.Visitor {
*/
boolean allowPoly;
+ /** Switch: support type annotations.
+ */
+ boolean allowTypeAnnos;
+
/** Switch: support generics?
*/
boolean allowGenerics;
@@ -240,7 +246,7 @@ public class Attr extends JCTree.Visitor {
InferenceContext inferenceContext = resultInfo.checkContext.inferenceContext();
Type owntype = found;
if (!owntype.hasTag(ERROR) && !resultInfo.pt.hasTag(METHOD) && !resultInfo.pt.hasTag(FORALL)) {
- if (inferenceContext.free(found)) {
+ if (allowPoly && inferenceContext.free(found)) {
inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt), new FreeTypeListener() {
@Override
public void typesInferred(InferenceContext inferenceContext) {
@@ -558,6 +564,7 @@ public class Attr extends JCTree.Visitor {
final ResultInfo statInfo;
final ResultInfo varInfo;
+ final ResultInfo unknownAnyPolyInfo;
final ResultInfo unknownExprInfo;
final ResultInfo unknownTypeInfo;
final ResultInfo unknownTypeExprInfo;
@@ -664,17 +671,21 @@ public class Attr extends JCTree.Visitor {
attribStat(l.head, env);
}
- /** Attribute the arguments in a method call, returning a list of types.
+ /** Attribute the arguments in a method call, returning the method kind.
*/
- List attribArgs(List trees, Env env) {
- ListBuffer argtypes = new ListBuffer();
+ int attribArgs(List trees, Env env, ListBuffer argtypes) {
+ int kind = VAL;
for (JCExpression arg : trees) {
- Type argtype = allowPoly && deferredAttr.isDeferred(env, arg) ?
- deferredAttr.new DeferredType(arg, env) :
- chk.checkNonVoid(arg, attribExpr(arg, env, Infer.anyPoly));
+ Type argtype;
+ if (allowPoly && deferredAttr.isDeferred(env, arg)) {
+ argtype = deferredAttr.new DeferredType(arg, env);
+ kind |= POLY;
+ } else {
+ argtype = chk.checkNonVoid(arg, attribTree(arg, env, unknownAnyPolyInfo));
+ }
argtypes.append(argtype);
}
- return argtypes.toList();
+ return kind;
}
/** Attribute a type argument list, returning a list of types.
@@ -1739,6 +1750,7 @@ public class Attr extends JCTree.Visitor {
boolean isConstructorCall =
methName == names._this || methName == names._super;
+ ListBuffer argtypesBuf = ListBuffer.lb();
if (isConstructorCall) {
// We are seeing a ...this(...) or ...super(...) call.
// Check that this is the first statement in a constructor.
@@ -1749,7 +1761,8 @@ public class Attr extends JCTree.Visitor {
localEnv.info.isSelfCall = true;
// Attribute arguments, yielding list of argument types.
- argtypes = attribArgs(tree.args, localEnv);
+ attribArgs(tree.args, localEnv, argtypesBuf);
+ argtypes = argtypesBuf.toList();
typeargtypes = attribTypes(tree.typeargs, localEnv);
// Variable `site' points to the class in which the called
@@ -1821,7 +1834,8 @@ public class Attr extends JCTree.Visitor {
} else {
// Otherwise, we are seeing a regular method call.
// Attribute the arguments, yielding list of argument types, ...
- argtypes = attribArgs(tree.args, localEnv);
+ int kind = attribArgs(tree.args, localEnv, argtypesBuf);
+ argtypes = argtypesBuf.toList();
typeargtypes = attribAnyTypes(tree.typeargs, localEnv);
// ... and attribute the method using as a prototype a methodtype
@@ -1829,7 +1843,7 @@ public class Attr extends JCTree.Visitor {
// arguments (this will also set the method symbol).
Type mpt = newMethodTemplate(resultInfo.pt, argtypes, typeargtypes);
localEnv.info.pendingResolutionPhase = null;
- Type mtype = attribTree(tree.meth, localEnv, new ResultInfo(VAL, mpt, resultInfo.checkContext));
+ Type mtype = attribTree(tree.meth, localEnv, new ResultInfo(kind, mpt, resultInfo.checkContext));
// Compute the result type.
Type restype = mtype.getReturnType();
@@ -1999,7 +2013,9 @@ public class Attr extends JCTree.Visitor {
}
// Attribute constructor arguments.
- List argtypes = attribArgs(tree.args, localEnv);
+ ListBuffer argtypesBuf = ListBuffer.lb();
+ int pkind = attribArgs(tree.args, localEnv, argtypesBuf);
+ List argtypes = argtypesBuf.toList();
List typeargtypes = attribTypes(tree.typeargs, localEnv);
// If we have made no mistakes in the class type...
@@ -2086,11 +2102,16 @@ public class Attr extends JCTree.Visitor {
clazztype,
tree.constructor,
rsEnv,
- new ResultInfo(MTH, newMethodTemplate(syms.voidType, argtypes, typeargtypes)));
+ new ResultInfo(pkind, newMethodTemplate(syms.voidType, argtypes, typeargtypes)));
if (rsEnv.info.lastResolveVarargs())
Assert.check(tree.constructorType.isErroneous() || tree.varargsElement != null);
}
- findDiamondIfNeeded(localEnv, tree, clazztype);
+ if (cdef == null &&
+ !clazztype.isErroneous() &&
+ clazztype.getTypeArguments().nonEmpty() &&
+ findDiamonds) {
+ findDiamond(localEnv, tree, clazztype);
+ }
}
if (cdef != null) {
@@ -2157,7 +2178,7 @@ public class Attr extends JCTree.Visitor {
clazztype,
tree.constructor,
localEnv,
- new ResultInfo(VAL, newMethodTemplate(syms.voidType, argtypes, typeargtypes)));
+ new ResultInfo(pkind, newMethodTemplate(syms.voidType, argtypes, typeargtypes)));
} else {
if (tree.clazz.hasTag(ANNOTATED_TYPE)) {
checkForDeclarationAnnotations(((JCAnnotatedType) tree.clazz).annotations,
@@ -2172,32 +2193,27 @@ public class Attr extends JCTree.Visitor {
chk.validate(tree.typeargs, localEnv);
}
//where
- void findDiamondIfNeeded(Env env, JCNewClass tree, Type clazztype) {
- if (tree.def == null &&
- !clazztype.isErroneous() &&
- clazztype.getTypeArguments().nonEmpty() &&
- findDiamonds) {
- JCTypeApply ta = (JCTypeApply)tree.clazz;
- List prevTypeargs = ta.arguments;
- try {
- //create a 'fake' diamond AST node by removing type-argument trees
- ta.arguments = List.nil();
- ResultInfo findDiamondResult = new ResultInfo(VAL,
- resultInfo.checkContext.inferenceContext().free(resultInfo.pt) ? Type.noType : pt());
- Type inferred = deferredAttr.attribSpeculative(tree, env, findDiamondResult).type;
- Type polyPt = allowPoly ?
- syms.objectType :
- clazztype;
- if (!inferred.isErroneous() &&
- types.isAssignable(inferred, pt().hasTag(NONE) ? polyPt : pt(), types.noWarnings)) {
- String key = types.isSameType(clazztype, inferred) ?
- "diamond.redundant.args" :
- "diamond.redundant.args.1";
- log.warning(tree.clazz.pos(), key, clazztype, inferred);
- }
- } finally {
- ta.arguments = prevTypeargs;
+ void findDiamond(Env env, JCNewClass tree, Type clazztype) {
+ JCTypeApply ta = (JCTypeApply)tree.clazz;
+ List prevTypeargs = ta.arguments;
+ try {
+ //create a 'fake' diamond AST node by removing type-argument trees
+ ta.arguments = List.nil();
+ ResultInfo findDiamondResult = new ResultInfo(VAL,
+ resultInfo.checkContext.inferenceContext().free(resultInfo.pt) ? Type.noType : pt());
+ Type inferred = deferredAttr.attribSpeculative(tree, env, findDiamondResult).type;
+ Type polyPt = allowPoly ?
+ syms.objectType :
+ clazztype;
+ if (!inferred.isErroneous() &&
+ types.isAssignable(inferred, pt().hasTag(NONE) ? polyPt : pt(), types.noWarnings)) {
+ String key = types.isSameType(clazztype, inferred) ?
+ "diamond.redundant.args" :
+ "diamond.redundant.args.1";
+ log.warning(tree.clazz.pos(), key, clazztype, inferred);
}
+ } finally {
+ ta.arguments = prevTypeargs;
}
}
@@ -3051,7 +3067,7 @@ public class Attr extends JCTree.Visitor {
//should we propagate the target type?
final ResultInfo castInfo;
JCExpression expr = TreeInfo.skipParens(tree.expr);
- boolean isPoly = expr.hasTag(LAMBDA) || expr.hasTag(REFERENCE);
+ boolean isPoly = allowPoly && (expr.hasTag(LAMBDA) || expr.hasTag(REFERENCE));
if (isPoly) {
//expression is a poly - we need to propagate target type info
castInfo = new ResultInfo(VAL, clazztype, new Check.NestedCheckContext(resultInfo.checkContext) {
@@ -3440,10 +3456,14 @@ public class Attr extends JCTree.Visitor {
Symbol sym,
Env env,
ResultInfo resultInfo) {
- Type pt = resultInfo.pt.map(deferredAttr.new RecoveryDeferredTypeMap(AttrMode.SPECULATIVE, sym, env.info.pendingResolutionPhase));
- Type owntype = checkIdInternal(tree, site, sym, pt, env, resultInfo);
- resultInfo.pt.map(deferredAttr.new RecoveryDeferredTypeMap(AttrMode.CHECK, sym, env.info.pendingResolutionPhase));
- return owntype;
+ if ((resultInfo.pkind & POLY) != 0) {
+ Type pt = resultInfo.pt.map(deferredAttr.new RecoveryDeferredTypeMap(AttrMode.SPECULATIVE, sym, env.info.pendingResolutionPhase));
+ Type owntype = checkIdInternal(tree, site, sym, pt, env, resultInfo);
+ resultInfo.pt.map(deferredAttr.new RecoveryDeferredTypeMap(AttrMode.CHECK, sym, env.info.pendingResolutionPhase));
+ return owntype;
+ } else {
+ return checkIdInternal(tree, site, sym, resultInfo.pt, env, resultInfo);
+ }
}
Type checkIdInternal(JCTree tree,
@@ -3541,7 +3561,7 @@ public class Attr extends JCTree.Visitor {
break;
case MTH: {
owntype = checkMethod(site, sym,
- new ResultInfo(VAL, resultInfo.pt.getReturnType(), resultInfo.checkContext),
+ new ResultInfo(resultInfo.pkind, resultInfo.pt.getReturnType(), resultInfo.checkContext),
env, TreeInfo.args(env.tree), resultInfo.pt.getParameterTypes(),
resultInfo.pt.getTypeArguments());
break;
@@ -4289,12 +4309,13 @@ public class Attr extends JCTree.Visitor {
(c.flags() & ABSTRACT) == 0) {
checkSerialVersionUID(tree, c);
}
+ if (allowTypeAnnos) {
+ // Correctly organize the postions of the type annotations
+ TypeAnnotations.organizeTypeAnnotationsBodies(this.syms, this.names, this.log, tree);
- // Correctly organize the postions of the type annotations
- TypeAnnotations.organizeTypeAnnotationsBodies(this.syms, this.names, this.log, tree);
-
- // Check type annotations applicability rules
- validateTypeAnnotations(tree);
+ // Check type annotations applicability rules
+ validateTypeAnnotations(tree);
+ }
}
// where
/** get a diagnostic position for an attribute of Type t, or null if attribute missing */
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
index 0dd6fe3887a..7ebf375c5ee 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
@@ -959,10 +959,8 @@ public class DeferredAttr extends JCTree.Visitor {
if (sym.kind == Kinds.AMBIGUOUS) {
Resolve.AmbiguityError err = (Resolve.AmbiguityError)sym.baseSymbol();
result = ArgumentExpressionKind.PRIMITIVE;
- for (List ambigousSyms = err.ambiguousSyms ;
- ambigousSyms.nonEmpty() && !result.isPoly() ;
- ambigousSyms = ambigousSyms.tail) {
- Symbol s = ambigousSyms.head;
+ for (Symbol s : err.ambiguousSyms) {
+ if (result.isPoly()) break;
if (s.kind == Kinds.MTH) {
result = reduce(ArgumentExpressionKind.methodKind(s, types));
}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
index b3961a82939..9b3457c7c83 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
@@ -109,15 +109,20 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
source = Source.instance(context);
target = Target.instance(context);
deferredLintHandler = DeferredLintHandler.instance(context);
+ allowTypeAnnos = source.allowTypeAnnotations();
}
+ /** Switch: support type annotations.
+ */
+ boolean allowTypeAnnos;
+
/** A queue for classes whose members still need to be entered into the
* symbol table.
*/
ListBuffer> halfcompleted = new ListBuffer>();
/** Set to true only when the first of a set of classes is
- * processed from the halfcompleted queue.
+ * processed from the half completed queue.
*/
boolean isFirst = true;
@@ -1072,7 +1077,9 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
isFirst = true;
}
}
- TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree, annotate);
+ if (allowTypeAnnos) {
+ TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree, annotate);
+ }
}
/*
@@ -1117,7 +1124,9 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
}
public void typeAnnotate(final JCTree tree, final Env env, final Symbol sym) {
- tree.accept(new TypeAnnotate(env, sym));
+ if (allowTypeAnnos) {
+ tree.accept(new TypeAnnotate(env, sym));
+ }
}
/**
From 9e051832007aef670c22961aed2d8610ad892eb3 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Thu, 20 Jun 2013 13:45:38 +0530
Subject: [PATCH 011/101] 8017046: Cannot assign undefined to a function
argument if the function uses arguments object
Reviewed-by: hannesw
---
.../internal/objects/NativeArguments.java | 2 +-
nashorn/test/script/basic/JDK-8017046.js | 46 +++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletion(-)
create mode 100644 nashorn/test/script/basic/JDK-8017046.js
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java b/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java
index d92d7fb3ee7..dc95315d860 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java
@@ -125,7 +125,7 @@ public final class NativeArguments extends ScriptObject {
@Override
public void setArgument(final int key, final Object value) {
if (namedArgs.has(key)) {
- namedArgs.set(key, value, false);
+ namedArgs = namedArgs.set(key, value, false);
}
}
diff --git a/nashorn/test/script/basic/JDK-8017046.js b/nashorn/test/script/basic/JDK-8017046.js
new file mode 100644
index 00000000000..7097e9f5c79
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8017046.js
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8017046: Cannot assign undefined to a function argument if the function uses arguments object
+ *
+ * @test
+ * @run
+ */
+
+function assert(value, msg) {
+ if (! value) {
+ fail(msg);
+ }
+}
+
+function func(a) {
+ assert(a === arguments[0], "a !== arguments[0]");
+ assert(a === "hello", "a !== 'hello'");
+ a = undefined;
+ assert(a === arguments[0], "a !== arguments[0]");
+ assert(a === undefined, "a !== undefined");
+ assert(typeof(a) === 'undefined', "typeof(a) is not 'undefined'");
+}
+
+func("hello");
From bca53c33de896b2ce1eb0f220dea3755f50c678b Mon Sep 17 00:00:00 2001
From: Eric McCorkle
Date: Thu, 20 Jun 2013 19:01:20 -0400
Subject: [PATCH 012/101] 8007546: ClassCastException on JSR308 tests 8015993:
jck-compiler tests are failed with java.lang.ClassCastException
Fix ClassCastExceptions arising from addition of AnnotatedType.
Reviewed-by: jjg, abuckley
---
.../share/classes/com/sun/tools/javac/comp/Attr.java | 2 +-
.../share/classes/com/sun/tools/javac/jvm/Code.java | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
index c940b5f75b7..fafcdff9d43 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -3206,7 +3206,7 @@ public class Attr extends JCTree.Visitor {
if (skind == TYP) {
Type elt = site;
while (elt.hasTag(ARRAY))
- elt = ((ArrayType)elt).elemtype;
+ elt = ((ArrayType)elt.unannotatedType()).elemtype;
if (elt.hasTag(TYPEVAR)) {
log.error(tree.pos(), "type.var.cant.be.deref");
result = types.createErrorType(tree.type);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
index 63cff9ffba6..ca059a7f9f4 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
@@ -919,11 +919,15 @@ public class Code {
if (o instanceof Long) return syms.longType;
if (o instanceof Double) return syms.doubleType;
if (o instanceof ClassSymbol) return syms.classType;
- if (o instanceof Type.ArrayType) return syms.classType;
- if (o instanceof Type.MethodType) return syms.methodTypeType;
- if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
- throw new AssertionError(o);
+ if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
+ if (o instanceof Type) {
+ Type ty = ((Type)o).unannotatedType();
+
+ if (ty instanceof Type.ArrayType) return syms.classType;
+ if (ty instanceof Type.MethodType) return syms.methodTypeType;
+ }
+ throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
}
/** Emit an opcode with a one-byte operand field;
From 6f8f3be8c3aac40741cbfdbe2df044856ec51132 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Fri, 21 Jun 2013 16:55:18 +0530
Subject: [PATCH 013/101] 8017260: adjust lookup code in objects.* classes
Reviewed-by: hannesw, jlaskey
---
nashorn/src/jdk/nashorn/internal/objects/Global.java | 9 +++++++--
.../jdk/nashorn/internal/objects/NativeArguments.java | 9 +++++++--
.../src/jdk/nashorn/internal/objects/NativeError.java | 7 ++++++-
.../nashorn/internal/objects/NativeStrictArguments.java | 7 ++++++-
.../jdk/nashorn/internal/objects/PrototypeObject.java | 7 ++++++-
5 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/nashorn/src/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk/nashorn/internal/objects/Global.java
index 59a9dd34a20..8de71c887c1 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java
@@ -25,9 +25,9 @@
package jdk.nashorn.internal.objects;
+import static jdk.nashorn.internal.lookup.Lookup.MH;
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.io.IOException;
import java.io.PrintWriter;
@@ -43,6 +43,7 @@ import java.util.List;
import java.util.Map;
import jdk.internal.dynalink.linker.GuardedInvocation;
import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
import jdk.nashorn.internal.objects.annotations.Attribute;
import jdk.nashorn.internal.objects.annotations.Property;
import jdk.nashorn.internal.objects.annotations.ScriptClass;
@@ -1780,7 +1781,11 @@ public final class Global extends ScriptObject implements GlobalObject, Scope {
private static MethodHandle findOwnMH(final String name, final Class> rtype, final Class>... types) {
- return MH.findStatic(MethodHandles.publicLookup(), Global.class, name, MH.type(rtype, types));
+ try {
+ return MethodHandles.lookup().findStatic(Global.class, name, MH.type(rtype, types));
+ } catch (final NoSuchMethodException | IllegalAccessException e) {
+ throw new MethodHandleFactory.LookupException(e);
+ }
}
RegExpResult getLastRegExpResult() {
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java b/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java
index dc95315d860..4898c48b8ed 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java
@@ -25,9 +25,9 @@
package jdk.nashorn.internal.objects;
+import static jdk.nashorn.internal.lookup.Lookup.MH;
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@@ -42,6 +42,7 @@ import jdk.nashorn.internal.runtime.ScriptRuntime;
import jdk.nashorn.internal.runtime.arrays.ArrayData;
import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
import jdk.nashorn.internal.lookup.Lookup;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
/**
* ECMA 10.6 Arguments Object.
@@ -624,7 +625,11 @@ public final class NativeArguments extends ScriptObject {
}
private static MethodHandle findOwnMH(final String name, final Class> rtype, final Class>... types) {
- return MH.findStatic(MethodHandles.publicLookup(), NativeArguments.class, name, MH.type(rtype, types));
+ try {
+ return MethodHandles.lookup().findStatic(NativeArguments.class, name, MH.type(rtype, types));
+ } catch (final NoSuchMethodException | IllegalAccessException e) {
+ throw new MethodHandleFactory.LookupException(e);
+ }
}
}
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
index b10a1c40990..c31217be301 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
@@ -33,6 +33,7 @@ import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;
import jdk.nashorn.internal.codegen.CompilerConstants;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
import jdk.nashorn.internal.objects.annotations.Attribute;
import jdk.nashorn.internal.objects.annotations.Constructor;
import jdk.nashorn.internal.objects.annotations.Function;
@@ -328,6 +329,10 @@ public final class NativeError extends ScriptObject {
}
private static MethodHandle findOwnMH(final String name, final Class> rtype, final Class>... types) {
- return MH.findStatic(MethodHandles.publicLookup(), NativeError.class, name, MH.type(rtype, types));
+ try {
+ return MethodHandles.lookup().findStatic(NativeError.class, name, MH.type(rtype, types));
+ } catch (final NoSuchMethodException | IllegalAccessException e) {
+ throw new MethodHandleFactory.LookupException(e);
+ }
}
}
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java b/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java
index a643c190c5c..2a5756f7e81 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java
@@ -37,6 +37,7 @@ import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptObject;
import jdk.nashorn.internal.runtime.arrays.ArrayData;
import jdk.nashorn.internal.lookup.Lookup;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
/**
* ECMA 10.6 Arguments Object.
@@ -142,6 +143,10 @@ public final class NativeStrictArguments extends ScriptObject {
}
private static MethodHandle findOwnMH(final String name, final Class> rtype, final Class>... types) {
- return MH.findStatic(MethodHandles.publicLookup(), NativeStrictArguments.class, name, MH.type(rtype, types));
+ try {
+ return MethodHandles.lookup().findStatic(NativeStrictArguments.class, name, MH.type(rtype, types));
+ } catch (final NoSuchMethodException | IllegalAccessException e) {
+ throw new MethodHandleFactory.LookupException(e);
+ }
}
}
diff --git a/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java b/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java
index edcc3274064..d476a866dc9 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java
@@ -35,6 +35,7 @@ import jdk.nashorn.internal.runtime.PropertyMap;
import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptObject;
import jdk.nashorn.internal.lookup.Lookup;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
/**
* Instances of this class serve as "prototype" object for script functions.
@@ -106,6 +107,10 @@ public class PrototypeObject extends ScriptObject {
}
private static MethodHandle findOwnMH(final String name, final Class> rtype, final Class>... types) {
- return MH.findStatic(MethodHandles.publicLookup(), PrototypeObject.class, name, MH.type(rtype, types));
+ try {
+ return MethodHandles.lookup().findStatic(PrototypeObject.class, name, MH.type(rtype, types));
+ } catch (final NoSuchMethodException | IllegalAccessException e) {
+ throw new MethodHandleFactory.LookupException(e);
+ }
}
}
From 86ff93e544244f0158d129fd7a875f1b5d9aac50 Mon Sep 17 00:00:00 2001
From: James Laskey
Date: Fri, 21 Jun 2013 14:34:00 -0300
Subject: [PATCH 014/101] 8010732: BigDecimal, BigInteger and Long handling in
nashorn
Reviewed-by: sundar
---
nashorn/test/script/basic/JDK-8010732.js | 48 +++++++++++++++++++
.../test/script/basic/JDK-8010732.js.EXPECTED | 12 +++++
2 files changed, 60 insertions(+)
create mode 100644 nashorn/test/script/basic/JDK-8010732.js
create mode 100644 nashorn/test/script/basic/JDK-8010732.js.EXPECTED
diff --git a/nashorn/test/script/basic/JDK-8010732.js b/nashorn/test/script/basic/JDK-8010732.js
new file mode 100644
index 00000000000..166acb9e774
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8010732.js
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8010732: BigDecimal, BigInteger and Long handling in nashorn
+ *
+ * @test
+ * @run
+ */
+
+var x = new java.math.BigDecimal(1111.5);
+var y = new java.math.BigDecimal(2222.5);
+
+print(x);
+print(y);
+
+print(x + y);
+print(x - y);
+print(x * y);
+print(x / y);
+print(Math.sin(x));
+
+print(x.toString());
+print(y.toString());
+print(x.class);
+print(y.class);
+print(x.doubleValue() + y.doubleValue());
+
diff --git a/nashorn/test/script/basic/JDK-8010732.js.EXPECTED b/nashorn/test/script/basic/JDK-8010732.js.EXPECTED
new file mode 100644
index 00000000000..2e0b42fd073
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8010732.js.EXPECTED
@@ -0,0 +1,12 @@
+111.5
+2222.5
+3334
+-1111
+2470308.75
+0.5001124859392576
+-0.5841231854504038
+1111.5
+2222.5
+class java.math.BigDecimal
+class java.math.BigDecimal
+3334
From 2aad633d9b7602b7230b307d88032feec78031fd Mon Sep 17 00:00:00 2001
From: James Laskey
Date: Sat, 22 Jun 2013 10:12:19 -0300
Subject: [PATCH 015/101] 8017448: JDK-8010732.js.EXPECTED truncated
Reviewed-by: sundar
---
nashorn/test/script/basic/JDK-8010732.js.EXPECTED | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nashorn/test/script/basic/JDK-8010732.js.EXPECTED b/nashorn/test/script/basic/JDK-8010732.js.EXPECTED
index 2e0b42fd073..5df1cb1d956 100644
--- a/nashorn/test/script/basic/JDK-8010732.js.EXPECTED
+++ b/nashorn/test/script/basic/JDK-8010732.js.EXPECTED
@@ -1,4 +1,4 @@
-111.5
+1111.5
2222.5
3334
-1111
From 02e0b5c3f17ba897c3ed1b9bdad546447ff94f00 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Mon, 24 Jun 2013 19:06:01 +0530
Subject: [PATCH 016/101] 8015959: Can't call foreign constructor
Reviewed-by: jlaskey, hannesw
---
.../jdk/nashorn/api/scripting/JSObject.java | 16 ++++-
.../api/scripting/ScriptObjectMirror.java | 34 ++++++++-
.../internal/runtime/ScriptFunction.java | 10 +++
.../internal/runtime/ScriptFunctionData.java | 70 +++++++++++++++++++
.../internal/runtime/ScriptRuntime.java | 41 +++++++++++
.../runtime/linker/JSObjectLinker.java | 68 ++++--------------
nashorn/test/script/basic/JDK-8015959.js | 54 ++++++++++++++
.../test/script/basic/JDK-8015959.js.EXPECTED | 14 ++++
8 files changed, 245 insertions(+), 62 deletions(-)
create mode 100644 nashorn/test/script/basic/JDK-8015959.js
create mode 100644 nashorn/test/script/basic/JDK-8015959.js.EXPECTED
diff --git a/nashorn/src/jdk/nashorn/api/scripting/JSObject.java b/nashorn/src/jdk/nashorn/api/scripting/JSObject.java
index 583e8f7a199..4f3a8e88f93 100644
--- a/nashorn/src/jdk/nashorn/api/scripting/JSObject.java
+++ b/nashorn/src/jdk/nashorn/api/scripting/JSObject.java
@@ -30,13 +30,23 @@ package jdk.nashorn.api.scripting;
*/
public abstract class JSObject {
/**
- * Call a JavaScript method
+ * Call a JavaScript function
*
- * @param methodName name of method
+ * @param functionName name of function
* @param args arguments to method
* @return result of call
*/
- public abstract Object call(String methodName, Object args[]);
+ public abstract Object call(String functionName, Object... args);
+
+ /**
+ * Call a JavaScript method as a constructor. This is equivalent to
+ * calling new obj.Method(arg1, arg2...) in JavaScript.
+ *
+ * @param functionName name of function
+ * @param args arguments to method
+ * @return result of constructor call
+ */
+ public abstract Object newObject(String functionName, Object... args);
/**
* Evaluate a JavaScript expression
diff --git a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java
index 79e908db5d2..c7dbab5a184 100644
--- a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java
+++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java
@@ -102,7 +102,7 @@ public final class ScriptObjectMirror extends JSObject implements Bindings {
// JSObject methods
@Override
- public Object call(final String methodName, final Object args[]) {
+ public Object call(final String functionName, final Object... args) {
final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
final boolean globalChanged = (oldGlobal != global);
@@ -111,9 +111,9 @@ public final class ScriptObjectMirror extends JSObject implements Bindings {
NashornScriptEngine.setNashornGlobal(global);
}
- final Object val = sobj.get(methodName);
+ final Object val = functionName == null? sobj : sobj.get(functionName);
if (! (val instanceof ScriptFunction)) {
- throw new RuntimeException("No such method: " + methodName);
+ throw new RuntimeException("No such function " + ((functionName != null)? functionName : ""));
}
final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
@@ -129,6 +129,34 @@ public final class ScriptObjectMirror extends JSObject implements Bindings {
}
}
+ @Override
+ public Object newObject(final String functionName, final Object... args) {
+ final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
+ final boolean globalChanged = (oldGlobal != global);
+
+ try {
+ if (globalChanged) {
+ NashornScriptEngine.setNashornGlobal(global);
+ }
+
+ final Object val = functionName == null? sobj : sobj.get(functionName);
+ if (! (val instanceof ScriptFunction)) {
+ throw new RuntimeException("not a constructor " + ((functionName != null)? functionName : ""));
+ }
+
+ final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
+ return wrap(ScriptRuntime.checkAndConstruct((ScriptFunction)val, unwrapArray(modArgs, global)), global);
+ } catch (final RuntimeException | Error e) {
+ throw e;
+ } catch (final Throwable t) {
+ throw new RuntimeException(t);
+ } finally {
+ if (globalChanged) {
+ NashornScriptEngine.setNashornGlobal(oldGlobal);
+ }
+ }
+ }
+
@Override
public Object eval(final String s) {
return inGlobal(new Callable
+
+Nashorn script engine pre-defines two global variables named "context"
+and "engine". The "context" variable is of type javax.script.ScriptContext
+and refers to the current ScriptContext instance passed to script engine's
+eval method. The "engine" variable is of type javax.script.ScriptEngine and
+refers to the current nashorn script engine instance evaluating the script.
+Both of these variables are non-writable, non-enumerable and non-configurable
+- which implies script code can not write overwrite the value, for..loop iteration
+on global object will not iterate these variables and these variables can not be
+deleted by script.
// ScriptVars.java
diff --git a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java
index b05a4aee435..d38e63c88b8 100644
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java
@@ -71,6 +71,9 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
private final ScriptEngineFactory factory;
private final Context nashornContext;
private final ScriptObject global;
+ // initialized bit late to be made 'final'. Property object for "context"
+ // property of global object
+ private Property contextProperty;
// default options passed to Nashorn Options object
private static final String[] DEFAULT_OPTIONS = new String[] { "-scripting", "-doe" };
@@ -281,13 +284,16 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
nashornContext.initGlobal(newGlobal);
+ final int NON_ENUMERABLE_CONSTANT = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE;
// current ScriptContext exposed as "context"
- newGlobal.addOwnProperty("context", Property.NOT_ENUMERABLE, UNDEFINED);
+ // "context" is non-writable from script - but script engine still
+ // needs to set it and so save the context Property object
+ contextProperty = newGlobal.addOwnProperty("context", NON_ENUMERABLE_CONSTANT, UNDEFINED);
// current ScriptEngine instance exposed as "engine". We added @SuppressWarnings("LeakingThisInConstructor") as
// NetBeans identifies this assignment as such a leak - this is a false positive as we're setting this property
// in the Global of a Context we just created - both the Context and the Global were just created and can not be
// seen from another thread outside of this constructor.
- newGlobal.addOwnProperty("engine", Property.NOT_ENUMERABLE, this);
+ newGlobal.addOwnProperty("engine", NON_ENUMERABLE_CONSTANT, this);
// global script arguments with undefined value
newGlobal.addOwnProperty("arguments", Property.NOT_ENUMERABLE, UNDEFINED);
// file name default is null
@@ -322,9 +328,10 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C
// scripts should see "context" and "engine" as variables
private void setContextVariables(final ScriptContext ctxt) {
- ctxt.setAttribute("context", ctxt, ScriptContext.ENGINE_SCOPE);
final ScriptObject ctxtGlobal = getNashornGlobalFrom(ctxt);
- ctxtGlobal.set("context", ctxt, false);
+ // set "context" global variable via contextProperty - because this
+ // property is non-writable
+ contextProperty.setObjectValue(ctxtGlobal, ctxtGlobal, ctxt, false);
Object args = ScriptObjectMirror.unwrap(ctxt.getAttribute("arguments"), ctxtGlobal);
if (args == null || args == UNDEFINED) {
args = ScriptRuntime.EMPTY_ARRAY;
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java b/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java
index 13e9e1ce3bd..bfdfa71995d 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java
@@ -288,7 +288,7 @@ public class AccessorProperty extends Property {
}
@Override
- protected void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
+ public void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
if (isSpill()) {
self.spill[getSlot()] = value;
} else {
@@ -303,7 +303,7 @@ public class AccessorProperty extends Property {
}
@Override
- protected Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
+ public Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
if (isSpill()) {
return self.spill[getSlot()];
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Property.java b/nashorn/src/jdk/nashorn/internal/runtime/Property.java
index a5e46016a00..d516a78377b 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/Property.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Property.java
@@ -363,7 +363,7 @@ public abstract class Property {
* @param value the new property value
* @param strict is this a strict setter?
*/
- protected abstract void setObjectValue(ScriptObject self, ScriptObject owner, Object value, boolean strict);
+ public abstract void setObjectValue(ScriptObject self, ScriptObject owner, Object value, boolean strict);
/**
* Set the Object value of this property from {@code owner}. This allows to bypass creation of the
@@ -373,7 +373,7 @@ public abstract class Property {
* @param owner the owner object
* @return the property value
*/
- protected abstract Object getObjectValue(ScriptObject self, ScriptObject owner);
+ public abstract Object getObjectValue(ScriptObject self, ScriptObject owner);
/**
* Abstract method for retrieving the setter for the property. We do not know
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java
index 5159e6537b0..4371d7e8296 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java
@@ -158,12 +158,12 @@ public final class UserAccessorProperty extends Property {
}
@Override
- protected Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
+ public Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
return userAccessorGetter(owner, getGetterSlot(), self);
}
@Override
- protected void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
+ public void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
userAccessorSetter(owner, getSetterSlot(), strict ? getKey() : null, self, value);
}
diff --git a/nashorn/test/script/basic/JDK-8015969.js b/nashorn/test/script/basic/JDK-8015969.js
new file mode 100644
index 00000000000..a9813773dfa
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8015969.js
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8015969: Needs to enforce and document that global "context" and "engine" can't be modified when running via jsr223
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+var m = new javax.script.ScriptEngineManager();
+var e = m.getEngineByName("nashorn");
+
+e.eval(<
Date: Tue, 25 Jun 2013 16:12:53 +0100
Subject: [PATCH 019/101] 8017104: javac should have a class for primitive
types that inherits from Type
Reviewed-by: jjg
---
.../com/sun/tools/javac/api/JavacTrees.java | 8 +-
.../com/sun/tools/javac/code/Attribute.java | 4 +-
.../com/sun/tools/javac/code/Kinds.java | 6 +-
.../com/sun/tools/javac/code/Printer.java | 4 +-
.../com/sun/tools/javac/code/Symbol.java | 8 +-
.../com/sun/tools/javac/code/Symtab.java | 32 +-
.../com/sun/tools/javac/code/Type.java | 440 ++++++++++++++----
.../com/sun/tools/javac/code/TypeTag.java | 92 ++--
.../com/sun/tools/javac/code/Types.java | 200 ++++----
.../sun/tools/javac/comp/DeferredAttr.java | 7 +-
.../com/sun/tools/javac/comp/Infer.java | 2 +-
.../com/sun/tools/javac/comp/Resolve.java | 2 +-
.../classes/com/sun/tools/javac/jvm/Code.java | 2 +-
.../com/sun/tools/javac/model/JavacTypes.java | 2 +-
14 files changed, 517 insertions(+), 292 deletions(-)
diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
index 19dde2aef0d..ef03f718cc0 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
@@ -69,6 +69,7 @@ import com.sun.tools.javac.code.Type.ClassType;
import com.sun.tools.javac.code.Type.ErrorType;
import com.sun.tools.javac.code.Type.UnionClassType;
import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.code.TypeTag;
import com.sun.tools.javac.code.Types.TypeRelation;
import com.sun.tools.javac.comp.Attr;
import com.sun.tools.javac.comp.AttrContext;
@@ -653,8 +654,7 @@ public class JavacTrees extends DocTrees {
switch (t.getTag()) {
case BYTE: case CHAR: case SHORT: case INT: case LONG: case FLOAT:
case DOUBLE: case BOOLEAN: case VOID: case BOT: case NONE:
- return t.getTag() == s.getTag();
-
+ return t.hasTag(s.getTag());
default:
throw new AssertionError("fuzzyMatcher " + t.getTag());
}
@@ -668,7 +668,7 @@ public class JavacTrees extends DocTrees {
if (s.isPartial())
return visit(s, t);
- return s.getTag() == ARRAY
+ return s.hasTag(ARRAY)
&& visit(t.elemtype, types.elemtype(s));
}
@@ -685,7 +685,7 @@ public class JavacTrees extends DocTrees {
@Override
public Boolean visitErrorType(ErrorType t, Type s) {
- return s.getTag() == CLASS
+ return s.hasTag(CLASS)
&& t.tsym.name == ((ClassType) s).tsym.name;
}
};
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
index ec76bbf7637..bb29eeaa530 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
@@ -83,7 +83,7 @@ public abstract class Attribute implements AnnotationValue {
return v.visitString((String) value, p);
if (value instanceof Integer) {
int i = (Integer) value;
- switch (type.tag) {
+ switch (type.getTag()) {
case BOOLEAN: return v.visitBoolean(i != 0, p);
case CHAR: return v.visitChar((char) i, p);
case BYTE: return v.visitByte((byte) i, p);
@@ -91,7 +91,7 @@ public abstract class Attribute implements AnnotationValue {
case INT: return v.visitInt(i, p);
}
}
- switch (type.tag) {
+ switch (type.getTag()) {
case LONG: return v.visitLong((Long) value, p);
case FLOAT: return v.visitFloat((Float) value, p);
case DOUBLE: return v.visitDouble((Double) value, p);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
index 5defddfb508..1ea1d4e47f5 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java
@@ -218,10 +218,10 @@ public class Kinds {
/** A KindName representing the kind of a given class/interface type.
*/
public static KindName typeKindName(Type t) {
- if (t.tag == TYPEVAR ||
- t.tag == CLASS && (t.tsym.flags() & COMPOUND) != 0)
+ if (t.hasTag(TYPEVAR) ||
+ t.hasTag(CLASS) && (t.tsym.flags() & COMPOUND) != 0)
return KindName.BOUND;
- else if (t.tag == PACKAGE)
+ else if (t.hasTag(PACKAGE))
return KindName.PACKAGE;
else if ((t.tsym.flags_field & ANNOTATION) != 0)
return KindName.ANNOTATION;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java
index 76e54103062..be0b5038018 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java
@@ -215,7 +215,7 @@ public abstract class Printer implements Type.Visitor, Symbol.Vi
@Override
public String visitClassType(ClassType t, Locale locale) {
StringBuilder buf = new StringBuilder();
- if (t.getEnclosingType().tag == CLASS && t.tsym.owner.kind == Kinds.TYP) {
+ if (t.getEnclosingType().hasTag(CLASS) && t.tsym.owner.kind == Kinds.TYP) {
buf.append(visit(t.getEnclosingType(), locale));
buf.append('.');
buf.append(className(t, false, locale));
@@ -379,7 +379,7 @@ public abstract class Printer implements Type.Visitor, Symbol.Vi
? s.owner.name.toString()
: s.name.toString();
if (s.type != null) {
- if (s.type.tag == FORALL) {
+ if (s.type.hasTag(FORALL)) {
ms = "<" + visitTypes(s.type.getTypeArguments(), locale) + ">" + ms;
}
ms += "(" + printMethodArgs(
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
index 972210c66d8..e05418e4001 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
@@ -699,17 +699,17 @@ public abstract class Symbol implements Element {
public final boolean precedes(TypeSymbol that, Types types) {
if (this == that)
return false;
- if (this.type.tag == that.type.tag) {
- if (this.type.hasTag(CLASS)) {
+ if (type.hasTag(that.type.getTag())) {
+ if (type.hasTag(CLASS)) {
return
types.rank(that.type) < types.rank(this.type) ||
types.rank(that.type) == types.rank(this.type) &&
that.getQualifiedName().compareTo(this.getQualifiedName()) < 0;
- } else if (this.type.hasTag(TYPEVAR)) {
+ } else if (type.hasTag(TYPEVAR)) {
return types.isSubtype(this.type, that.type);
}
}
- return this.type.hasTag(TYPEVAR);
+ return type.hasTag(TYPEVAR);
}
@Override
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java
index 6f666825692..3130ad0d27e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java
@@ -28,7 +28,6 @@ package com.sun.tools.javac.code;
import java.util.*;
import javax.lang.model.element.ElementVisitor;
-import javax.lang.model.type.TypeVisitor;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type.*;
@@ -65,16 +64,16 @@ public class Symtab {
/** Builtin types.
*/
- public final Type byteType = new Type(BYTE, null);
- public final Type charType = new Type(CHAR, null);
- public final Type shortType = new Type(SHORT, null);
- public final Type intType = new Type(INT, null);
- public final Type longType = new Type(LONG, null);
- public final Type floatType = new Type(FLOAT, null);
- public final Type doubleType = new Type(DOUBLE, null);
- public final Type booleanType = new Type(BOOLEAN, null);
+ public final JCPrimitiveType byteType = new JCPrimitiveType(BYTE, null);
+ public final JCPrimitiveType charType = new JCPrimitiveType(CHAR, null);
+ public final JCPrimitiveType shortType = new JCPrimitiveType(SHORT, null);
+ public final JCPrimitiveType intType = new JCPrimitiveType(INT, null);
+ public final JCPrimitiveType longType = new JCPrimitiveType(LONG, null);
+ public final JCPrimitiveType floatType = new JCPrimitiveType(FLOAT, null);
+ public final JCPrimitiveType doubleType = new JCPrimitiveType(DOUBLE, null);
+ public final JCPrimitiveType booleanType = new JCPrimitiveType(BOOLEAN, null);
public final Type botType = new BottomType();
- public final JCNoType voidType = new JCNoType(VOID);
+ public final JCVoidType voidType = new JCVoidType();
private final Names names;
private final ClassReader reader;
@@ -208,7 +207,7 @@ public class Symtab {
public void initType(Type type, ClassSymbol c) {
type.tsym = c;
- typeOfTag[type.tag.ordinal()] = type;
+ typeOfTag[type.getTag().ordinal()] = type;
}
public void initType(Type type, String name) {
@@ -220,7 +219,7 @@ public class Symtab {
public void initType(Type type, String name, String bname) {
initType(type, name);
- boxedName[type.tag.ordinal()] = names.fromString("java.lang." + bname);
+ boxedName[type.getTag().ordinal()] = names.fromString("java.lang." + bname);
}
/** The class symbol that owns all predefined symbols.
@@ -330,7 +329,7 @@ public class Symtab {
}
public void synthesizeBoxTypeIfMissing(final Type type) {
- ClassSymbol sym = reader.enterClass(boxedName[type.tag.ordinal()]);
+ ClassSymbol sym = reader.enterClass(boxedName[type.getTag().ordinal()]);
final Completer completer = sym.completer;
if (completer != null) {
sym.completer = new Completer() {
@@ -388,12 +387,7 @@ public class Symtab {
target = Target.instance(context);
// Create the unknown type
- unknownType = new Type(UNKNOWN, null) {
- @Override
- public R accept(TypeVisitor v, P p) {
- return v.visitUnknown(this, p);
- }
- };
+ unknownType = new UnknownType();
// create the basic builtin symbols
rootPackage = new PackageSymbol(names.empty, null);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
index f868290b5b3..a89f86eed50 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
@@ -70,25 +70,19 @@ import static com.sun.tools.javac.code.TypeTag.*;
*
* @see TypeTag
*/
-public class Type implements PrimitiveType {
+public abstract class Type implements TypeMirror {
/** Constant type: no type at all. */
- public static final JCNoType noType = new JCNoType(NONE);
+ public static final JCNoType noType = new JCNoType();
/** Constant type: special type to be used during recovery of deferred expressions. */
- public static final JCNoType recoveryType = new JCNoType(NONE);
+ public static final JCNoType recoveryType = new JCNoType();
/** If this switch is turned on, the names of type variables
* and anonymous classes are printed with hashcodes appended.
*/
public static boolean moreInfo = false;
- /** The tag of this type.
- *
- * @see TypeTag
- */
- protected TypeTag tag;
-
/** The defining class / interface / package / type variable.
*/
public TypeSymbol tsym;
@@ -98,39 +92,37 @@ public class Type implements PrimitiveType {
* @return true if tag is equal to the current type tag.
*/
public boolean hasTag(TypeTag tag) {
- return this.tag == tag;
+ return tag == getTag();
}
/**
* Returns the current type tag.
* @return the value of the current type tag.
*/
- public TypeTag getTag() {
- return tag;
- }
+ public abstract TypeTag getTag();
public boolean isNumeric() {
- return tag.isNumeric;
+ return false;
}
public boolean isPrimitive() {
- return tag.isPrimitive;
+ return false;
}
public boolean isPrimitiveOrVoid() {
- return tag.isPrimitiveOrVoid;
+ return false;
}
public boolean isReference() {
- return tag.isReference;
+ return false;
}
public boolean isNullOrReference() {
- return (tag.isReference || tag == BOT);
+ return false;
}
public boolean isPartial() {
- return tag.isPartial;
+ return false;
}
/**
@@ -143,6 +135,18 @@ public class Type implements PrimitiveType {
return null;
}
+ /** Is this a constant type whose value is false?
+ */
+ public boolean isFalse() {
+ return false;
+ }
+
+ /** Is this a constant type whose value is true?
+ */
+ public boolean isTrue() {
+ return false;
+ }
+
/**
* Get the representation of this type used for modelling purposes.
* By default, this is itself. For ErrorType, a different value
@@ -153,7 +157,7 @@ public class Type implements PrimitiveType {
}
public static List getModelTypes(List ts) {
- ListBuffer lb = new ListBuffer();
+ ListBuffer lb = new ListBuffer<>();
for (Type t: ts)
lb.append(t.getModelType());
return lb.toList();
@@ -163,8 +167,7 @@ public class Type implements PrimitiveType {
/** Define a type given its tag and type symbol
*/
- public Type(TypeTag tag, TypeSymbol tsym) {
- this.tag = tag;
+ public Type(TypeSymbol tsym) {
this.tsym = tsym;
}
@@ -203,18 +206,7 @@ public class Type implements PrimitiveType {
* and with given constant value
*/
public Type constType(Object constValue) {
- final Object value = constValue;
- Assert.check(isPrimitive());
- return new Type(tag, tsym) {
- @Override
- public Object constValue() {
- return value;
- }
- @Override
- public Type baseType() {
- return tsym.type;
- }
- };
+ throw new AssertionError();
}
/**
@@ -272,7 +264,9 @@ public class Type implements PrimitiveType {
String s = (tsym == null || tsym.name == null)
? ""
: tsym.name.toString();
- if (moreInfo && tag == TYPEVAR) s = s + hashCode();
+ if (moreInfo && hasTag(TYPEVAR)) {
+ s = s + hashCode();
+ }
return s;
}
@@ -298,12 +292,7 @@ public class Type implements PrimitiveType {
*/
public String stringValue() {
Object cv = Assert.checkNonNull(constValue());
- if (tag == BOOLEAN)
- return ((Integer) cv).intValue() == 0 ? "false" : "true";
- else if (tag == CHAR)
- return String.valueOf((char) ((Integer) cv).intValue());
- else
- return cv.toString();
+ return cv.toString();
}
/**
@@ -321,24 +310,6 @@ public class Type implements PrimitiveType {
return super.hashCode();
}
- /** Is this a constant type whose value is false?
- */
- public boolean isFalse() {
- return
- tag == BOOLEAN &&
- constValue() != null &&
- ((Integer)constValue()).intValue() == 0;
- }
-
- /** Is this a constant type whose value is true?
- */
- public boolean isTrue() {
- return
- tag == BOOLEAN &&
- constValue() != null &&
- ((Integer)constValue()).intValue() != 0;
- }
-
public String argtypes(boolean varargs) {
List args = getParameterTypes();
if (!varargs) return args.toString();
@@ -348,7 +319,7 @@ public class Type implements PrimitiveType {
args = args.tail;
buf.append(',');
}
- if (args.head.unannotatedType().tag == ARRAY) {
+ if (args.head.unannotatedType().hasTag(ARRAY)) {
buf.append(((ArrayType)args.head.unannotatedType()).elemtype);
if (args.head.getAnnotationMirrors().nonEmpty()) {
buf.append(args.head.getAnnotationMirrors());
@@ -485,28 +456,122 @@ public class Type implements PrimitiveType {
return tsym;
}
+ @Override
public TypeKind getKind() {
- switch (tag) {
- case BYTE: return TypeKind.BYTE;
- case CHAR: return TypeKind.CHAR;
- case SHORT: return TypeKind.SHORT;
- case INT: return TypeKind.INT;
- case LONG: return TypeKind.LONG;
- case FLOAT: return TypeKind.FLOAT;
- case DOUBLE: return TypeKind.DOUBLE;
- case BOOLEAN: return TypeKind.BOOLEAN;
- case VOID: return TypeKind.VOID;
- case BOT: return TypeKind.NULL;
- case NONE: return TypeKind.NONE;
- default: return TypeKind.OTHER;
- }
+ return TypeKind.OTHER;
}
+ @Override
public R accept(TypeVisitor v, P p) {
- if (isPrimitive())
+ throw new AssertionError();
+ }
+
+ public static class JCPrimitiveType extends Type
+ implements javax.lang.model.type.PrimitiveType {
+
+ TypeTag tag;
+
+ public JCPrimitiveType(TypeTag tag, TypeSymbol tsym) {
+ super(tsym);
+ this.tag = tag;
+ Assert.check(tag.isPrimitive);
+ }
+
+ @Override
+ public boolean isNumeric() {
+ return tag != BOOLEAN;
+ }
+
+ @Override
+ public boolean isPrimitive() {
+ return true;
+ }
+
+ @Override
+ public TypeTag getTag() {
+ return tag;
+ }
+
+ @Override
+ public boolean isPrimitiveOrVoid() {
+ return true;
+ }
+
+ /** Define a constant type, of the same kind as this type
+ * and with given constant value
+ */
+ @Override
+ public Type constType(Object constValue) {
+ final Object value = constValue;
+ return new JCPrimitiveType(tag, tsym) {
+ @Override
+ public Object constValue() {
+ return value;
+ }
+ @Override
+ public Type baseType() {
+ return tsym.type;
+ }
+ };
+ }
+
+ /**
+ * The constant value of this type, converted to String
+ */
+ @Override
+ public String stringValue() {
+ Object cv = Assert.checkNonNull(constValue());
+ if (tag == BOOLEAN) {
+ return ((Integer) cv).intValue() == 0 ? "false" : "true";
+ }
+ else if (tag == CHAR) {
+ return String.valueOf((char) ((Integer) cv).intValue());
+ }
+ else {
+ return cv.toString();
+ }
+ }
+
+ /** Is this a constant type whose value is false?
+ */
+ @Override
+ public boolean isFalse() {
+ return
+ tag == BOOLEAN &&
+ constValue() != null &&
+ ((Integer)constValue()).intValue() == 0;
+ }
+
+ /** Is this a constant type whose value is true?
+ */
+ @Override
+ public boolean isTrue() {
+ return
+ tag == BOOLEAN &&
+ constValue() != null &&
+ ((Integer)constValue()).intValue() != 0;
+ }
+
+ @Override
+ public R accept(TypeVisitor v, P p) {
return v.visitPrimitive(this, p);
- else
+ }
+
+ @Override
+ public TypeKind getKind() {
+ switch (tag) {
+ case BYTE: return TypeKind.BYTE;
+ case CHAR: return TypeKind.CHAR;
+ case SHORT: return TypeKind.SHORT;
+ case INT: return TypeKind.INT;
+ case LONG: return TypeKind.LONG;
+ case FLOAT: return TypeKind.FLOAT;
+ case DOUBLE: return TypeKind.DOUBLE;
+ case BOOLEAN: return TypeKind.BOOLEAN;
+ }
throw new AssertionError();
+ }
+
}
public static class WildcardType extends Type
@@ -522,7 +587,7 @@ public class Type implements PrimitiveType {
}
public WildcardType(Type type, BoundKind kind, TypeSymbol tsym) {
- super(WILDCARD, tsym);
+ super(tsym);
this.type = Assert.checkNonNull(type);
this.kind = kind;
}
@@ -535,6 +600,12 @@ public class Type implements PrimitiveType {
this.bound = bound;
}
+ @Override
+ public TypeTag getTag() {
+ return WILDCARD;
+ }
+
+ @Override
public boolean contains(Type t) {
return kind != UNBOUND && type.contains(t);
}
@@ -551,6 +622,17 @@ public class Type implements PrimitiveType {
return kind == UNBOUND;
}
+ @Override
+ public boolean isReference() {
+ return true;
+ }
+
+ @Override
+ public boolean isNullOrReference() {
+ return true;
+ }
+
+ @Override
public Type withTypeVar(Type t) {
//-System.err.println(this+".withTypeVar("+t+");");//DEBUG
if (bound == t)
@@ -640,7 +722,7 @@ public class Type implements PrimitiveType {
public List all_interfaces_field;
public ClassType(Type outer, List typarams, TypeSymbol tsym) {
- super(CLASS, tsym);
+ super(tsym);
this.outer_field = outer;
this.typarams_field = typarams;
this.allparams_field = null;
@@ -657,6 +739,11 @@ public class Type implements PrimitiveType {
*/
}
+ @Override
+ public TypeTag getTag() {
+ return CLASS;
+ }
+
@Override
public R accept(Type.Visitor v, S s) {
return v.visitClassType(this, s);
@@ -680,7 +767,7 @@ public class Type implements PrimitiveType {
*/
public String toString() {
StringBuilder buf = new StringBuilder();
- if (getEnclosingType().tag == CLASS && tsym.owner.kind == TYP) {
+ if (getEnclosingType().hasTag(CLASS) && tsym.owner.kind == TYP) {
buf.append(getEnclosingType().toString());
buf.append(".");
buf.append(className(tsym, false));
@@ -765,6 +852,16 @@ public class Type implements PrimitiveType {
// optimization, was: allparams().nonEmpty();
}
+ @Override
+ public boolean isReference() {
+ return true;
+ }
+
+ @Override
+ public boolean isNullOrReference() {
+ return true;
+ }
+
/** A cache for the rank. */
int rank_field = -1;
@@ -909,11 +1006,15 @@ public class Type implements PrimitiveType {
public Type elemtype;
public ArrayType(Type elemtype, TypeSymbol arrayClass) {
- super(ARRAY, arrayClass);
+ super(arrayClass);
this.elemtype = elemtype;
}
@Override
+ public TypeTag getTag() {
+ return ARRAY;
+ }
+
public R accept(Type.Visitor v, S s) {
return v.visitArrayType(this, s);
}
@@ -947,6 +1048,16 @@ public class Type implements PrimitiveType {
return elemtype.isParameterized();
}
+ @Override
+ public boolean isReference() {
+ return true;
+ }
+
+ @Override
+ public boolean isNullOrReference() {
+ return true;
+ }
+
public boolean isRaw() {
return elemtype.isRaw();
}
@@ -1001,13 +1112,17 @@ public class Type implements PrimitiveType {
Type restype,
List thrown,
TypeSymbol methodClass) {
- super(METHOD, methodClass);
+ super(methodClass);
this.argtypes = argtypes;
this.restype = restype;
this.thrown = thrown;
}
@Override
+ public TypeTag getTag() {
+ return METHOD;
+ }
+
public R accept(Type.Visitor v, S s) {
return v.visitMethodType(this, s);
}
@@ -1077,7 +1192,12 @@ public class Type implements PrimitiveType {
public static class PackageType extends Type implements NoType {
PackageType(TypeSymbol tsym) {
- super(PACKAGE, tsym);
+ super(tsym);
+ }
+
+ @Override
+ public TypeTag getTag() {
+ return PACKAGE;
}
@Override
@@ -1120,17 +1240,22 @@ public class Type implements PrimitiveType {
public Type lower;
public TypeVar(Name name, Symbol owner, Type lower) {
- super(TYPEVAR, null);
+ super(null);
tsym = new TypeVariableSymbol(0, name, this, owner);
this.lower = lower;
}
public TypeVar(TypeSymbol tsym, Type bound, Type lower) {
- super(TYPEVAR, tsym);
+ super(tsym);
this.bound = bound;
this.lower = lower;
}
+ @Override
+ public TypeTag getTag() {
+ return TYPEVAR;
+ }
+
@Override
public R accept(Type.Visitor v, S s) {
return v.visitTypeVar(this, s);
@@ -1138,8 +1263,9 @@ public class Type implements PrimitiveType {
@Override
public Type getUpperBound() {
- if ((bound == null || bound.tag == NONE) && this != tsym.type)
+ if ((bound == null || bound.hasTag(NONE)) && this != tsym.type) {
bound = tsym.type.getUpperBound();
+ }
return bound;
}
@@ -1158,6 +1284,17 @@ public class Type implements PrimitiveType {
return false;
}
+ @Override
+ public boolean isReference() {
+ return true;
+ }
+
+ @Override
+ public boolean isNullOrReference() {
+ return true;
+ }
+
+ @Override
public R accept(TypeVisitor v, P p) {
return v.visitTypeVariable(this, p);
}
@@ -1203,10 +1340,13 @@ public class Type implements PrimitiveType {
public static abstract class DelegatedType extends Type {
public Type qtype;
+ public TypeTag tag;
public DelegatedType(TypeTag tag, Type qtype) {
- super(tag, qtype.tsym);
+ super(qtype.tsym);
+ this.tag = tag;
this.qtype = qtype;
}
+ public TypeTag getTag() { return tag; }
public String toString() { return qtype.toString(); }
public List getTypeArguments() { return qtype.getTypeArguments(); }
public Type getEnclosingType() { return qtype.getEnclosingType(); }
@@ -1340,6 +1480,12 @@ public class Type implements PrimitiveType {
else return qtype + "?";
}
+ @Override
+ public boolean isPartial() {
+ return true;
+ }
+
+ @Override
public Type baseType() {
if (inst != null) return inst.baseType();
else return this;
@@ -1439,21 +1585,21 @@ public class Type implements PrimitiveType {
}
}
- /** Represents VOID or NONE.
+ /** Represents NONE.
*/
- static class JCNoType extends Type implements NoType {
- public JCNoType(TypeTag tag) {
- super(tag, null);
+ public static class JCNoType extends Type implements NoType {
+ public JCNoType() {
+ super(null);
+ }
+
+ @Override
+ public TypeTag getTag() {
+ return NONE;
}
@Override
public TypeKind getKind() {
- switch (tag) {
- case VOID: return TypeKind.VOID;
- case NONE: return TypeKind.NONE;
- default:
- throw new AssertionError("Unexpected tag: " + tag);
- }
+ return TypeKind.NONE;
}
@Override
@@ -1462,9 +1608,43 @@ public class Type implements PrimitiveType {
}
}
+ /** Represents VOID.
+ */
+ public static class JCVoidType extends Type implements NoType {
+
+ public JCVoidType() {
+ super(null);
+ }
+
+ @Override
+ public TypeTag getTag() {
+ return VOID;
+ }
+
+ @Override
+ public TypeKind getKind() {
+ return TypeKind.VOID;
+ }
+
+ @Override
+ public R accept(TypeVisitor v, P p) {
+ return v.visitNoType(this, p);
+ }
+
+ @Override
+ public boolean isPrimitiveOrVoid() {
+ return true;
+ }
+ }
+
static class BottomType extends Type implements NullType {
public BottomType() {
- super(BOT, null);
+ super(null);
+ }
+
+ @Override
+ public TypeTag getTag() {
+ return BOT;
}
@Override
@@ -1486,6 +1666,12 @@ public class Type implements PrimitiveType {
public String stringValue() {
return "null";
}
+
+ @Override
+ public boolean isNullOrReference() {
+ return true;
+ }
+
}
public static class ErrorType extends ClassType
@@ -1495,7 +1681,6 @@ public class Type implements PrimitiveType {
public ErrorType(Type originalType, TypeSymbol tsym) {
super(noType, List.nil(), null);
- tag = ERROR;
this.tsym = tsym;
this.originalType = (originalType == null ? noType : originalType);
}
@@ -1507,6 +1692,26 @@ public class Type implements PrimitiveType {
c.members_field = new Scope.ErrorScope(c);
}
+ @Override
+ public TypeTag getTag() {
+ return ERROR;
+ }
+
+ @Override
+ public boolean isPartial() {
+ return true;
+ }
+
+ @Override
+ public boolean isReference() {
+ return true;
+ }
+
+ @Override
+ public boolean isNullOrReference() {
+ return true;
+ }
+
public ErrorType(Name name, TypeSymbol container, Type originalType) {
this(new ClassSymbol(PUBLIC|STATIC|ACYCLIC, name, null, container), originalType);
}
@@ -1559,7 +1764,7 @@ public class Type implements PrimitiveType {
public Type underlyingType;
public AnnotatedType(Type underlyingType) {
- super(underlyingType.tag, underlyingType.tsym);
+ super(underlyingType.tsym);
this.typeAnnotations = List.nil();
this.underlyingType = underlyingType;
Assert.check(!underlyingType.isAnnotated(),
@@ -1568,7 +1773,7 @@ public class Type implements PrimitiveType {
public AnnotatedType(List typeAnnotations,
Type underlyingType) {
- super(underlyingType.tag, underlyingType.tsym);
+ super(underlyingType.tsym);
this.typeAnnotations = typeAnnotations;
this.underlyingType = underlyingType;
Assert.check(!underlyingType.isAnnotated(),
@@ -1576,6 +1781,11 @@ public class Type implements PrimitiveType {
"; adding: " + typeAnnotations);
}
+ @Override
+ public TypeTag getTag() {
+ return underlyingType.getTag();
+ }
+
@Override
public boolean isAnnotated() {
return true;
@@ -1651,10 +1861,18 @@ public class Type implements PrimitiveType {
@Override
public List allparams() { return underlyingType.allparams(); }
@Override
+ public boolean isPrimitive() { return underlyingType.isPrimitive(); }
+ @Override
+ public boolean isPrimitiveOrVoid() { return underlyingType.isPrimitiveOrVoid(); }
+ @Override
public boolean isNumeric() { return underlyingType.isNumeric(); }
@Override
public boolean isReference() { return underlyingType.isReference(); }
@Override
+ public boolean isNullOrReference() { return underlyingType.isNullOrReference(); }
+ @Override
+ public boolean isPartial() { return underlyingType.isPartial(); }
+ @Override
public boolean isParameterized() { return underlyingType.isParameterized(); }
@Override
public boolean isRaw() { return underlyingType.isRaw(); }
@@ -1719,6 +1937,28 @@ public class Type implements PrimitiveType {
public TypeMirror getSuperBound() { return ((WildcardType)underlyingType).getSuperBound(); }
}
+ public static class UnknownType extends Type {
+
+ public UnknownType() {
+ super(null);
+ }
+
+ @Override
+ public TypeTag getTag() {
+ return UNKNOWN;
+ }
+
+ @Override
+ public R accept(TypeVisitor v, P p) {
+ return v.visitUnknown(this, p);
+ }
+
+ @Override
+ public boolean isPartial() {
+ return true;
+ }
+ }
+
/**
* A visitor for types. A visitor is used to implement operations
* (or relations) on types. Most common operations on types are
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java b/langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java
index 7fbfd8edbc1..418f1e13406 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java
@@ -42,132 +42,107 @@ import static com.sun.tools.javac.code.TypeTag.NumericClasses.*;
public enum TypeTag {
/** The tag of the basic type `byte'.
*/
- BYTE(BYTE_CLASS, BYTE_SUPERCLASSES,
- TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
+ BYTE(BYTE_CLASS, BYTE_SUPERCLASSES, true),
/** The tag of the basic type `char'.
*/
- CHAR(CHAR_CLASS, CHAR_SUPERCLASSES,
- TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
+ CHAR(CHAR_CLASS, CHAR_SUPERCLASSES, true),
/** The tag of the basic type `short'.
*/
- SHORT(SHORT_CLASS, SHORT_SUPERCLASSES,
- TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
-
- /** The tag of the basic type `int'.
- */
- INT(INT_CLASS, INT_SUPERCLASSES,
- TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
+ SHORT(SHORT_CLASS, SHORT_SUPERCLASSES, true),
/** The tag of the basic type `long'.
*/
- LONG(LONG_CLASS, LONG_SUPERCLASSES, TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
+ LONG(LONG_CLASS, LONG_SUPERCLASSES, true),
/** The tag of the basic type `float'.
*/
- FLOAT(FLOAT_CLASS, FLOAT_SUPERCLASSES, TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
-
+ FLOAT(FLOAT_CLASS, FLOAT_SUPERCLASSES, true),
+ /** The tag of the basic type `int'.
+ */
+ INT(INT_CLASS, INT_SUPERCLASSES, true),
/** The tag of the basic type `double'.
*/
- DOUBLE(DOUBLE_CLASS, DOUBLE_CLASS, TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC),
-
+ DOUBLE(DOUBLE_CLASS, DOUBLE_CLASS, true),
/** The tag of the basic type `boolean'.
*/
- BOOLEAN(TypeTagKind.PRIMITIVE),
+ BOOLEAN(0, 0, true),
/** The tag of the type `void'.
*/
- VOID(TypeTagKind.VOID),
+ VOID,
/** The tag of all class and interface types.
*/
- CLASS(TypeTagKind.REFERENCE),
+ CLASS,
/** The tag of all array types.
*/
- ARRAY(TypeTagKind.REFERENCE),
+ ARRAY,
/** The tag of all (monomorphic) method types.
*/
- METHOD(TypeTagKind.OTHER),
+ METHOD,
/** The tag of all package "types".
*/
- PACKAGE(TypeTagKind.OTHER),
+ PACKAGE,
/** The tag of all (source-level) type variables.
*/
- TYPEVAR(TypeTagKind.REFERENCE),
+ TYPEVAR,
/** The tag of all type arguments.
*/
- WILDCARD(TypeTagKind.REFERENCE),
+ WILDCARD,
/** The tag of all polymorphic (method-) types.
*/
- FORALL(TypeTagKind.OTHER),
+ FORALL,
/** The tag of deferred expression types in method context
*/
- DEFERRED(TypeTagKind.OTHER),
+ DEFERRED,
/** The tag of the bottom type {@code }.
*/
- BOT(TypeTagKind.OTHER),
+ BOT,
/** The tag of a missing type.
*/
- NONE(TypeTagKind.OTHER),
+ NONE,
/** The tag of the error type.
*/
- ERROR(TypeTagKind.REFERENCE | TypeTagKind.PARTIAL),
+ ERROR,
/** The tag of an unknown type
*/
- UNKNOWN(TypeTagKind.PARTIAL),
+ UNKNOWN,
/** The tag of all instantiatable type variables.
*/
- UNDETVAR(TypeTagKind.PARTIAL),
+ UNDETVAR,
/** Pseudo-types, these are special tags
*/
- UNINITIALIZED_THIS(TypeTagKind.OTHER),
+ UNINITIALIZED_THIS,
- UNINITIALIZED_OBJECT(TypeTagKind.OTHER);
+ UNINITIALIZED_OBJECT;
- final boolean isPrimitive;
- final boolean isNumeric;
- final boolean isPartial;
- final boolean isReference;
- final boolean isPrimitiveOrVoid;
final int superClasses;
final int numericClass;
+ final boolean isPrimitive;
- private TypeTag(int kind) {
- this(0, 0, kind);
+ private TypeTag() {
+ this(0, 0, false);
}
- private TypeTag(int numericClass, int superClasses, int kind) {
- isPrimitive = (kind & TypeTagKind.PRIMITIVE) != 0;
- isNumeric = (kind & TypeTagKind.NUMERIC) != 0;
- isPartial = (kind & TypeTagKind.PARTIAL) != 0;
- isReference = (kind & TypeTagKind.REFERENCE) != 0;
- isPrimitiveOrVoid = ((kind & TypeTagKind.PRIMITIVE) != 0) ||
- ((kind & TypeTagKind.VOID) != 0);
- this.superClasses = superClasses;
- this.numericClass = numericClass;
- }
-
- static class TypeTagKind {
- static final int PRIMITIVE = 1;
- static final int NUMERIC = 2;
- static final int REFERENCE = 4;
- static final int PARTIAL = 8;
- static final int OTHER = 16;
- static final int VOID = 32;
+ private TypeTag(int numericClass, int superClasses, boolean isPrimitive) {
+ this.superClasses = superClasses;
+ this.numericClass = numericClass;
+ this.isPrimitive = isPrimitive;
}
public static class NumericClasses {
@@ -261,4 +236,5 @@ public enum TypeTag {
throw new AssertionError("unknown primitive type " + this);
}
}
+
}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
index 331046e7b8c..c687ba9cd8e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
@@ -286,8 +286,9 @@ public class Types {
* conversion to s?
*/
public boolean isConvertible(Type t, Type s, Warner warn) {
- if (t.tag == ERROR)
+ if (t.hasTag(ERROR)) {
return true;
+ }
boolean tPrimitive = t.isPrimitive();
boolean sPrimitive = s.isPrimitive();
if (tPrimitive == sPrimitive) {
@@ -396,7 +397,8 @@ public class Types {
/**
* Compute the function descriptor associated with a given functional interface
*/
- public FunctionDescriptor findDescriptorInternal(TypeSymbol origin, CompoundScope membersCache) throws FunctionDescriptorLookupError {
+ public FunctionDescriptor findDescriptorInternal(TypeSymbol origin,
+ CompoundScope membersCache) throws FunctionDescriptorLookupError {
if (!origin.isInterface() || (origin.flags() & ANNOTATION) != 0) {
//t must be an interface
throw failure("not.a.functional.intf", origin);
@@ -655,17 +657,16 @@ public class Types {
}
} else if (isSubtype(t, s)) {
return true;
- }
- else if (t.tag == TYPEVAR) {
+ } else if (t.hasTag(TYPEVAR)) {
return isSubtypeUnchecked(t.getUpperBound(), s, warn);
- }
- else if (!s.isRaw()) {
+ } else if (!s.isRaw()) {
Type t2 = asSuper(t, s.tsym);
if (t2 != null && t2.isRaw()) {
- if (isReifiable(s))
+ if (isReifiable(s)) {
warn.silentWarn(LintCategory.UNCHECKED);
- else
+ } else {
warn.warn(LintCategory.UNCHECKED);
+ }
return true;
}
}
@@ -673,13 +674,14 @@ public class Types {
}
private void checkUnsafeVarargsConversion(Type t, Type s, Warner warn) {
- if (t.tag != ARRAY || isReifiable(t))
+ if (!t.hasTag(ARRAY) || isReifiable(t)) {
return;
+ }
t = t.unannotatedType();
s = s.unannotatedType();
ArrayType from = (ArrayType)t;
boolean shouldWarn = false;
- switch (s.tag) {
+ switch (s.getTag()) {
case ARRAY:
ArrayType to = (ArrayType)s;
shouldWarn = from.isVarargs() &&
@@ -735,8 +737,9 @@ public class Types {
// where
private TypeRelation isSubtype = new TypeRelation()
{
+ @Override
public Boolean visitType(Type t, Type s) {
- switch (t.tag) {
+ switch (t.getTag()) {
case BYTE:
return (!s.hasTag(CHAR) && t.getTag().isSubRangeOf(s.getTag()));
case CHAR:
@@ -756,7 +759,7 @@ public class Types {
case NONE:
return false;
default:
- throw new AssertionError("isSubtype " + t.tag);
+ throw new AssertionError("isSubtype " + t.getTag());
}
}
@@ -826,14 +829,14 @@ public class Types {
@Override
public Boolean visitArrayType(ArrayType t, Type s) {
- if (s.tag == ARRAY) {
+ if (s.hasTag(ARRAY)) {
if (t.elemtype.isPrimitive())
return isSameType(t.elemtype, elemtype(s));
else
return isSubtypeNoCapture(t.elemtype, elemtype(s));
}
- if (s.tag == CLASS) {
+ if (s.hasTag(CLASS)) {
Name sname = s.tsym.getQualifiedName();
return sname == names.java_lang_Object
|| sname == names.java_lang_Cloneable
@@ -846,9 +849,9 @@ public class Types {
@Override
public Boolean visitUndetVar(UndetVar t, Type s) {
//todo: test against origin needed? or replace with substitution?
- if (t == s || t.qtype == s || s.tag == ERROR || s.tag == UNKNOWN) {
+ if (t == s || t.qtype == s || s.hasTag(ERROR) || s.hasTag(UNKNOWN)) {
return true;
- } else if (s.tag == BOT) {
+ } else if (s.hasTag(BOT)) {
//if 's' is 'null' there's no instantiated type U for which
//U <: s (but 'null' itself, which is not a valid type)
return false;
@@ -913,15 +916,17 @@ public class Types {
* Is t a supertype of s?
*/
public boolean isSuperType(Type t, Type s) {
- switch (t.tag) {
+ switch (t.getTag()) {
case ERROR:
return true;
case UNDETVAR: {
UndetVar undet = (UndetVar)t;
if (t == s ||
undet.qtype == s ||
- s.tag == ERROR ||
- s.tag == BOT) return true;
+ s.hasTag(ERROR) ||
+ s.hasTag(BOT)) {
+ return true;
+ }
undet.addBound(InferenceBound.LOWER, s, this);
return true;
}
@@ -990,12 +995,12 @@ public class Types {
if (s.isPartial())
return visit(s, t);
- switch (t.tag) {
+ switch (t.getTag()) {
case BYTE: case CHAR: case SHORT: case INT: case LONG: case FLOAT:
case DOUBLE: case BOOLEAN: case VOID: case BOT: case NONE:
- return t.tag == s.tag;
+ return t.hasTag(s.getTag());
case TYPEVAR: {
- if (s.tag == TYPEVAR) {
+ if (s.hasTag(TYPEVAR)) {
//type-substitution does not preserve type-var types
//check that type var symbols and bounds are indeed the same
return sameTypeVars((TypeVar)t.unannotatedType(), (TypeVar)s.unannotatedType());
@@ -1009,7 +1014,7 @@ public class Types {
}
}
default:
- throw new AssertionError("isSameType " + t.tag);
+ throw new AssertionError("isSameType " + t.getTag());
}
}
@@ -1080,8 +1085,9 @@ public class Types {
@Override
public Boolean visitForAll(ForAll t, Type s) {
- if (s.tag != FORALL)
+ if (!s.hasTag(FORALL)) {
return false;
+ }
ForAll forAll = (ForAll)s;
return hasSameBounds(t, forAll)
@@ -1090,12 +1096,14 @@ public class Types {
@Override
public Boolean visitUndetVar(UndetVar t, Type s) {
- if (s.tag == WILDCARD)
+ if (s.hasTag(WILDCARD)) {
// FIXME, this might be leftovers from before capture conversion
return false;
+ }
- if (t == s || t.qtype == s || s.tag == ERROR || s.tag == UNKNOWN)
+ if (t == s || t.qtype == s || s.hasTag(ERROR) || s.hasTag(UNKNOWN)) {
return true;
+ }
t.addBound(InferenceBound.EQ, s, Types.this);
@@ -1171,9 +1179,9 @@ public class Types {
//
public boolean containedBy(Type t, Type s) {
- switch (t.tag) {
+ switch (t.getTag()) {
case UNDETVAR:
- if (s.tag == WILDCARD) {
+ if (s.hasTag(WILDCARD)) {
UndetVar undetvar = (UndetVar)t;
WildcardType wt = (WildcardType)s.unannotatedType();
switch(wt.kind) {
@@ -1241,7 +1249,7 @@ public class Types {
private TypeRelation containsType = new TypeRelation() {
private Type U(Type t) {
- while (t.tag == WILDCARD) {
+ while (t.hasTag(WILDCARD)) {
WildcardType w = (WildcardType)t.unannotatedType();
if (w.isSuperBound())
return w.bound == null ? syms.objectType : w.bound.bound;
@@ -1252,7 +1260,7 @@ public class Types {
}
private Type L(Type t) {
- while (t.tag == WILDCARD) {
+ while (t.hasTag(WILDCARD)) {
WildcardType w = (WildcardType)t.unannotatedType();
if (w.isExtendsBound())
return syms.botType;
@@ -1298,10 +1306,11 @@ public class Types {
@Override
public Boolean visitUndetVar(UndetVar t, Type s) {
- if (s.tag != WILDCARD)
+ if (!s.hasTag(WILDCARD)) {
return isSameType(t, s);
- else
+ } else {
return false;
+ }
}
@Override
@@ -1311,13 +1320,13 @@ public class Types {
};
public boolean isCaptureOf(Type s, WildcardType t) {
- if (s.tag != TYPEVAR || !((TypeVar)s.unannotatedType()).isCaptured())
+ if (!s.hasTag(TYPEVAR) || !((TypeVar)s.unannotatedType()).isCaptured())
return false;
return isSameWildcard(t, ((CapturedType)s.unannotatedType()).wildcard);
}
public boolean isSameWildcard(WildcardType t, Type s) {
- if (s.tag != WILDCARD)
+ if (!s.hasTag(WILDCARD))
return false;
WildcardType w = (WildcardType)s.unannotatedType();
return w.kind == t.kind && w.type == t.type;
@@ -1369,15 +1378,15 @@ public class Types {
private TypeRelation isCastable = new TypeRelation() {
public Boolean visitType(Type t, Type s) {
- if (s.tag == ERROR)
+ if (s.hasTag(ERROR))
return true;
- switch (t.tag) {
+ switch (t.getTag()) {
case BYTE: case CHAR: case SHORT: case INT: case LONG: case FLOAT:
case DOUBLE:
return s.isNumeric();
case BOOLEAN:
- return s.tag == BOOLEAN;
+ return s.hasTag(BOOLEAN);
case VOID:
return false;
case BOT:
@@ -1394,10 +1403,10 @@ public class Types {
@Override
public Boolean visitClassType(ClassType t, Type s) {
- if (s.tag == ERROR || s.tag == BOT)
+ if (s.hasTag(ERROR) || s.hasTag(BOT))
return true;
- if (s.tag == TYPEVAR) {
+ if (s.hasTag(TYPEVAR)) {
if (isCastable(t, s.getUpperBound(), noWarnings)) {
warnStack.head.warn(LintCategory.UNCHECKED);
return true;
@@ -1412,11 +1421,11 @@ public class Types {
visitIntersectionType((IntersectionClassType)t.unannotatedType(), s, false);
}
- if (s.tag == CLASS || s.tag == ARRAY) {
+ if (s.hasTag(CLASS) || s.hasTag(ARRAY)) {
boolean upcast;
if ((upcast = isSubtype(erasure(t), erasure(s)))
|| isSubtype(erasure(s), erasure(t))) {
- if (!upcast && s.tag == ARRAY) {
+ if (!upcast && s.hasTag(ARRAY)) {
if (!isReifiable(s))
warnStack.head.warn(LintCategory.UNCHECKED);
return true;
@@ -1469,7 +1478,7 @@ public class Types {
}
// Sidecast
- if (s.tag == CLASS) {
+ if (s.hasTag(CLASS)) {
if ((s.tsym.flags() & INTERFACE) != 0) {
return ((t.tsym.flags() & FINAL) == 0)
? sideCast(t, s, warnStack.head)
@@ -1501,7 +1510,7 @@ public class Types {
@Override
public Boolean visitArrayType(ArrayType t, Type s) {
- switch (s.tag) {
+ switch (s.getTag()) {
case ERROR:
case BOT:
return true;
@@ -1516,7 +1525,7 @@ public class Types {
return isSubtype(t, s);
case ARRAY:
if (elemtype(t).isPrimitive() || elemtype(s).isPrimitive()) {
- return elemtype(t).tag == elemtype(s).tag;
+ return elemtype(t).hasTag(elemtype(s).getTag());
} else {
return visit(elemtype(t), elemtype(s));
}
@@ -1527,7 +1536,7 @@ public class Types {
@Override
public Boolean visitTypeVar(TypeVar t, Type s) {
- switch (s.tag) {
+ switch (s.getTag()) {
case ERROR:
case BOT:
return true;
@@ -1579,8 +1588,9 @@ public class Types {
private Set cache = new HashSet();
+ @Override
public Boolean visitType(Type t, Type s) {
- if (s.tag == WILDCARD)
+ if (s.hasTag(WILDCARD))
return visit(s, t);
else
return notSoftSubtypeRecursive(t, s) || notSoftSubtypeRecursive(s, t);
@@ -1617,10 +1627,10 @@ public class Types {
if (t.isUnbound())
return false;
- if (s.tag != WILDCARD) {
+ if (!s.hasTag(WILDCARD)) {
if (t.isExtendsBound())
return notSoftSubtypeRecursive(s, t.type);
- else // isSuperBound()
+ else
return notSoftSubtypeRecursive(t.type, s);
}
@@ -1669,21 +1679,21 @@ public class Types {
*/
public boolean notSoftSubtype(Type t, Type s) {
if (t == s) return false;
- if (t.tag == TYPEVAR) {
+ if (t.hasTag(TYPEVAR)) {
TypeVar tv = (TypeVar) t;
return !isCastable(tv.bound,
relaxBound(s),
noWarnings);
}
- if (s.tag != WILDCARD)
+ if (!s.hasTag(WILDCARD))
s = upperBound(s);
return !isSubtype(t, relaxBound(s));
}
private Type relaxBound(Type t) {
- if (t.tag == TYPEVAR) {
- while (t.tag == TYPEVAR)
+ if (t.hasTag(TYPEVAR)) {
+ while (t.hasTag(TYPEVAR))
t = t.getUpperBound();
t = rewriteQuantifiers(t, true, true);
}
@@ -1732,16 +1742,16 @@ public class Types {
//
public boolean isArray(Type t) {
- while (t.tag == WILDCARD)
+ while (t.hasTag(WILDCARD))
t = upperBound(t);
- return t.tag == ARRAY;
+ return t.hasTag(ARRAY);
}
/**
* The element type of an array.
*/
public Type elemtype(Type t) {
- switch (t.tag) {
+ switch (t.getTag()) {
case WILDCARD:
return elemtype(upperBound(t));
case ARRAY:
@@ -1775,7 +1785,7 @@ public class Types {
*/
public int dimensions(Type t) {
int result = 0;
- while (t.tag == ARRAY) {
+ while (t.hasTag(ARRAY)) {
result++;
t = elemtype(t);
}
@@ -1789,8 +1799,7 @@ public class Types {
* @return the ArrayType for the given component
*/
public ArrayType makeArrayType(Type t) {
- if (t.tag == VOID ||
- t.tag == PACKAGE) {
+ if (t.hasTag(VOID) || t.hasTag(PACKAGE)) {
Assert.error("Type t must not be a VOID or PACKAGE type, " + t.toString());
}
return new ArrayType(t, syms.arrayClass);
@@ -1821,7 +1830,7 @@ public class Types {
return t;
Type st = supertype(t);
- if (st.tag == CLASS || st.tag == TYPEVAR || st.tag == ERROR) {
+ if (st.hasTag(CLASS) || st.hasTag(TYPEVAR) || st.hasTag(ERROR)) {
Type x = asSuper(st, sym);
if (x != null)
return x;
@@ -1863,13 +1872,13 @@ public class Types {
* @param sym a symbol
*/
public Type asOuterSuper(Type t, Symbol sym) {
- switch (t.tag) {
+ switch (t.getTag()) {
case CLASS:
do {
Type s = asSuper(t, sym);
if (s != null) return s;
t = t.getEnclosingType();
- } while (t.tag == CLASS);
+ } while (t.hasTag(CLASS));
return null;
case ARRAY:
return isSubtype(t, sym.type) ? sym.type : null;
@@ -1890,16 +1899,16 @@ public class Types {
* @param sym a symbol
*/
public Type asEnclosingSuper(Type t, Symbol sym) {
- switch (t.tag) {
+ switch (t.getTag()) {
case CLASS:
do {
Type s = asSuper(t, sym);
if (s != null) return s;
Type outer = t.getEnclosingType();
- t = (outer.tag == CLASS) ? outer :
+ t = (outer.hasTag(CLASS)) ? outer :
(t.tsym.owner.enclClass() != null) ? t.tsym.owner.enclClass().type :
Type.noType;
- } while (t.tag == CLASS);
+ } while (t.hasTag(CLASS));
return null;
case ARRAY:
return isSubtype(t, sym.type) ? sym.type : null;
@@ -1987,11 +1996,11 @@ public class Types {
* (not defined for Method and ForAll types)
*/
public boolean isAssignable(Type t, Type s, Warner warn) {
- if (t.tag == ERROR)
+ if (t.hasTag(ERROR))
return true;
- if (t.tag.isSubRangeOf(INT) && t.constValue() != null) {
+ if (t.getTag().isSubRangeOf(INT) && t.constValue() != null) {
int value = ((Number)t.constValue()).intValue();
- switch (s.tag) {
+ switch (s.getTag()) {
case BYTE:
if (Byte.MIN_VALUE <= value && value <= Byte.MAX_VALUE)
return true;
@@ -2007,7 +2016,7 @@ public class Types {
case INT:
return true;
case CLASS:
- switch (unboxedType(s).tag) {
+ switch (unboxedType(s).getTag()) {
case BYTE:
case CHAR:
case SHORT:
@@ -2135,7 +2144,7 @@ public class Types {
null,
syms.noSymbol);
bc.type = new IntersectionClassType(bounds, bc, allInterfaces);
- bc.erasure_field = (bounds.head.tag == TYPEVAR) ?
+ bc.erasure_field = (bounds.head.hasTag(TYPEVAR)) ?
syms.objectType : // error condition, recover
erasure(firstExplicitBound);
bc.members_field = new Scope(bc);
@@ -2198,7 +2207,7 @@ public class Types {
*/
@Override
public Type visitTypeVar(TypeVar t, Void ignored) {
- if (t.bound.tag == TYPEVAR ||
+ if (t.bound.hasTag(TYPEVAR) ||
(!t.bound.isCompound() && !t.bound.isInterface())) {
return t.bound;
} else {
@@ -2502,8 +2511,8 @@ public class Types {
}
private MethodSymbol implementationInternal(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter implFilter) {
- for (Type t = origin.type; t.tag == CLASS || t.tag == TYPEVAR; t = supertype(t)) {
- while (t.tag == TYPEVAR)
+ for (Type t = origin.type; t.hasTag(CLASS) || t.hasTag(TYPEVAR); t = supertype(t)) {
+ while (t.hasTag(TYPEVAR))
t = t.getUpperBound();
TypeSymbol c = t.tsym;
for (Scope.Entry e = c.members().lookup(ms.name, implFilter);
@@ -2684,13 +2693,13 @@ public class Types {
@Override
public Boolean visitMethodType(MethodType t, Type s) {
- return s.tag == METHOD
+ return s.hasTag(METHOD)
&& containsTypeEquivalent(t.argtypes, s.getParameterTypes());
}
@Override
public Boolean visitForAll(ForAll t, Type s) {
- if (s.tag != FORALL)
+ if (!s.hasTag(FORALL))
return strict ? false : visitMethodType(t.asMethodType(), s);
ForAll forAll = (ForAll)s;
@@ -3025,7 +3034,7 @@ public class Types {
*/
public int rank(Type t) {
t = t.unannotatedType();
- switch(t.tag) {
+ switch(t.getTag()) {
case CLASS: {
ClassType cls = (ClassType)t;
if (cls.rank_field < 0) {
@@ -3091,7 +3100,7 @@ public class Types {
*/
@Deprecated
public String toString(Type t) {
- if (t.tag == FORALL) {
+ if (t.hasTag(FORALL)) {
ForAll forAll = (ForAll)t;
return typaramsString(forAll.tvars) + forAll.qtype;
}
@@ -3157,9 +3166,9 @@ public class Types {
if (cl == null) {
Type st = supertype(t);
if (!t.isCompound()) {
- if (st.tag == CLASS) {
+ if (st.hasTag(CLASS)) {
cl = insert(closure(st), t);
- } else if (st.tag == TYPEVAR) {
+ } else if (st.hasTag(TYPEVAR)) {
cl = closure(st).prepend(t);
} else {
cl = List.of(t);
@@ -3219,7 +3228,7 @@ public class Types {
if (isSameType(cl1.head, cl2.head))
return intersect(cl1.tail, cl2.tail).prepend(cl1.head);
if (cl1.head.tsym == cl2.head.tsym &&
- cl1.head.tag == CLASS && cl2.head.tag == CLASS) {
+ cl1.head.hasTag(CLASS) && cl2.head.hasTag(CLASS)) {
if (cl1.head.isParameterized() && cl2.head.isParameterized()) {
Type merge = merge(cl1.head,cl2.head);
return intersect(cl1.tail, cl2.tail).prepend(merge);
@@ -3343,7 +3352,7 @@ public class Types {
final int CLASS_BOUND = 2;
int boundkind = 0;
for (Type t : ts) {
- switch (t.tag) {
+ switch (t.getTag()) {
case CLASS:
boundkind |= CLASS_BOUND;
break;
@@ -3353,8 +3362,8 @@ public class Types {
case TYPEVAR:
do {
t = t.getUpperBound();
- } while (t.tag == TYPEVAR);
- if (t.tag == ARRAY) {
+ } while (t.hasTag(TYPEVAR));
+ if (t.hasTag(ARRAY)) {
boundkind |= ARRAY_BOUND;
} else {
boundkind |= CLASS_BOUND;
@@ -3394,13 +3403,14 @@ public class Types {
case CLASS_BOUND:
// calculate lub(A, B)
- while (ts.head.tag != CLASS && ts.head.tag != TYPEVAR)
+ while (!ts.head.hasTag(CLASS) && !ts.head.hasTag(TYPEVAR)) {
ts = ts.tail;
+ }
Assert.check(!ts.isEmpty());
//step 1 - compute erased candidate set (EC)
List cl = erasedSupertypes(ts.head);
for (Type t : ts.tail) {
- if (t.tag == CLASS || t.tag == TYPEVAR)
+ if (t.hasTag(CLASS) || t.hasTag(TYPEVAR))
cl = intersect(cl, erasedSupertypes(t));
}
//step 2 - compute minimal erased candidate set (MEC)
@@ -3422,7 +3432,7 @@ public class Types {
// calculate lub(A, B[])
List classes = List.of(arraySuperType());
for (Type t : ts) {
- if (t.tag != ARRAY) // Filter out any arrays
+ if (!t.hasTag(ARRAY)) // Filter out any arrays
classes = classes.prepend(t);
}
// lub(A, B[]) is lub(A, arraySuperType)
@@ -3433,7 +3443,7 @@ public class Types {
List erasedSupertypes(Type t) {
ListBuffer buf = lb();
for (Type sup : closure(t)) {
- if (sup.tag == TYPEVAR) {
+ if (sup.hasTag(TYPEVAR)) {
buf.append(sup);
} else {
buf.append(erasure(sup));
@@ -3509,7 +3519,7 @@ public class Types {
private static final UnaryVisitor hashCode = new UnaryVisitor() {
public Integer visitType(Type t, Void ignored) {
- return t.tag.ordinal();
+ return t.getTag().ordinal();
}
@Override
@@ -3635,7 +3645,7 @@ public class Types {
* Return the class that boxes the given primitive.
*/
public ClassSymbol boxedClass(Type t) {
- return reader.enterClass(syms.boxedName[t.tag.ordinal()]);
+ return reader.enterClass(syms.boxedName[t.getTag().ordinal()]);
}
/**
@@ -3667,7 +3677,7 @@ public class Types {
*/
public Type unboxedTypeOrType(Type t) {
Type unboxedType = unboxedType(t);
- return unboxedType.tag == NONE ? t : unboxedType;
+ return unboxedType.hasTag(NONE) ? t : unboxedType;
}
//
@@ -3717,7 +3727,7 @@ public class Types {
return buf.reverse();
}
public Type capture(Type t) {
- if (t.tag != CLASS)
+ if (!t.hasTag(CLASS))
return t;
if (t.getEnclosingType() != Type.noType) {
Type capturedEncl = capture(t.getEnclosingType());
@@ -3783,7 +3793,7 @@ public class Types {
public List freshTypeVariables(List types) {
ListBuffer result = lb();
for (Type t : types) {
- if (t.tag == WILDCARD) {
+ if (t.hasTag(WILDCARD)) {
t = t.unannotatedType();
Type bound = ((WildcardType)t).getExtendsBound();
if (bound == null)
@@ -3953,14 +3963,14 @@ public class Types {
@Override
public Void visitClassType(ClassType source, Type target) throws AdaptFailure {
- if (target.tag == CLASS)
+ if (target.hasTag(CLASS))
adaptRecursive(source.allparams(), target.allparams());
return null;
}
@Override
public Void visitArrayType(ArrayType source, Type target) throws AdaptFailure {
- if (target.tag == ARRAY)
+ if (target.hasTag(ARRAY))
adaptRecursive(elemtype(source), elemtype(target));
return null;
}
@@ -4142,7 +4152,7 @@ public class Types {
}
Type B(Type t) {
- while (t.tag == WILDCARD) {
+ while (t.hasTag(WILDCARD)) {
WildcardType w = (WildcardType)t.unannotatedType();
t = high ?
w.getExtendsBound() :
@@ -4187,7 +4197,7 @@ public class Types {
* substituted by the wildcard
*/
private WildcardType makeSuperWildcard(Type bound, TypeVar formal) {
- if (bound.tag == BOT) {
+ if (bound.hasTag(BOT)) {
return new WildcardType(syms.objectType,
BoundKind.UNBOUND,
syms.boundClass,
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
index 7ebf375c5ee..27b0c606fc2 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
@@ -115,12 +115,17 @@ public class DeferredAttr extends JCTree.Visitor {
SpeculativeCache speculativeCache;
DeferredType(JCExpression tree, Env env) {
- super(DEFERRED, null);
+ super(null);
this.tree = tree;
this.env = env.dup(tree, env.info.dup());
this.speculativeCache = new SpeculativeCache();
}
+ @Override
+ public TypeTag getTag() {
+ return DEFERRED;
+ }
+
/**
* A speculative cache is used to keep track of all overload resolution rounds
* that triggered speculative attribution on a given deferred type. Each entry
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
index 5ae41d600f2..c5f4b271f2e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
@@ -96,7 +96,7 @@ public class Infer {
}
/** A value for prototypes that admit any type, including polymorphic ones. */
- public static final Type anyPoly = new Type(NONE, null);
+ public static final Type anyPoly = new JCNoType();
/**
* This exception class is design to store a list of diagnostics corresponding
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
index 42739986e90..ed6d880b13f 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
@@ -2843,7 +2843,7 @@ public class Resolve {
protected Symbol lookup(Env env, MethodResolutionPhase phase) {
Scope sc = new Scope(syms.arrayClass);
MethodSymbol arrayConstr = new MethodSymbol(PUBLIC, name, null, site.tsym);
- arrayConstr.type = new MethodType(List.of(syms.intType), site, List.nil(), syms.methodClass);
+ arrayConstr.type = new MethodType(List.of(syms.intType), site, List.nil(), syms.methodClass);
sc.enter(arrayConstr);
return findMethodInScope(env, site, name, argtypes, typeargtypes, sc, methodNotFound, phase.isBoxingRequired(), phase.isVarargsRequired(), false, false);
}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
index ca059a7f9f4..d151dd46172 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
@@ -1859,7 +1859,7 @@ public class Code {
}
}
- static final Type jsrReturnValue = new Type(INT, null);
+ static final Type jsrReturnValue = new JCPrimitiveType(INT, null);
/* **************************************************************************
diff --git a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java
index 76d29eb7531..14e377fb37f 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java
@@ -139,7 +139,7 @@ public class JavacTypes implements javax.lang.model.util.Types {
Type unboxed = types.unboxedType((Type) t);
if (! unboxed.isPrimitive()) // only true primitives, not void
throw new IllegalArgumentException(t.toString());
- return unboxed;
+ return (PrimitiveType)unboxed;
}
public TypeMirror capture(TypeMirror t) {
From fd80bae5c51bcc639f78c6e10cf6d142600e2ec9 Mon Sep 17 00:00:00 2001
From: Alexander Zuev
Date: Tue, 25 Jun 2013 20:08:52 +0400
Subject: [PATCH 020/101] 8006973: jtreg test fails:
test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java
Reviewed-by: ksrini
---
.../javac/warnings/AuxiliaryClass/SelfClassWithAux.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java b/langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java
index fdc5a8fad71..933dfa88268 100644
--- a/langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java
+++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java
@@ -34,11 +34,11 @@
*/
class SelfClassWithAux {
- Aux aux;
+ AuxClass aux;
ClassWithAuxiliary.NotAnAuxiliaryClass alfa;
ClassWithAuxiliary.NotAnAuxiliaryClassEither beta;
}
-class Aux {
- Aux aux;
+class AuxClass {
+ AuxClass aux;
}
From f4695eca85bd51546d6470da76b0146a4481644e Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Wed, 26 Jun 2013 16:36:13 +0530
Subject: [PATCH 021/101] 8017950: error.stack should be a string rather than
an array
Reviewed-by: hannesw, jlaskey
---
.../nashorn/internal/objects/NativeError.java | 80 ++++++++++++++-----
.../internal/runtime/ECMAException.java | 2 +-
nashorn/test/script/basic/JDK-8012164.js | 5 +-
.../test/script/basic/JDK-8012164.js.EXPECTED | 2 +-
nashorn/test/script/basic/JDK-8017950.js | 47 +++++++++++
.../test/script/basic/JDK-8017950.js.EXPECTED | 4 +
nashorn/test/script/basic/NASHORN-109.js | 5 +-
nashorn/test/script/basic/NASHORN-296.js | 4 +-
nashorn/test/script/basic/errorstack.js | 8 +-
9 files changed, 126 insertions(+), 31 deletions(-)
create mode 100644 nashorn/test/script/basic/JDK-8017950.js
create mode 100644 nashorn/test/script/basic/JDK-8017950.js.EXPECTED
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
index c31217be301..fa23597af90 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
@@ -143,6 +143,30 @@ public final class NativeError extends ScriptObject {
return ECMAException.printStackTrace((ScriptObject)self);
}
+ /**
+ * Nashorn extension: Error.prototype.getStackTrace()
+ * "stack" property is an array typed value containing {@link StackTraceElement}
+ * objects of JavaScript stack frames.
+ *
+ * @param self self reference
+ *
+ * @return stack trace as a script array.
+ */
+ @Function(attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getStackTrace(final Object self) {
+ Global.checkObject(self);
+ final ScriptObject sobj = (ScriptObject)self;
+ final Object exception = ECMAException.getException(sobj);
+ Object[] res;
+ if (exception instanceof Throwable) {
+ res = getScriptFrames((Throwable)exception);
+ } else {
+ res = ScriptRuntime.EMPTY_ARRAY;
+ }
+
+ return new NativeArray(res);
+ }
+
/**
* Nashorn extension: Error.prototype.lineNumber
*
@@ -229,8 +253,8 @@ public final class NativeError extends ScriptObject {
/**
* Nashorn extension: Error.prototype.stack
- * "stack" property is an array typed value containing {@link StackTraceElement}
- * objects of JavaScript stack frames.
+ * "stack" property is a string typed value containing JavaScript stack frames.
+ * Each frame information is separated bv "\n" character.
*
* @param self self reference
*
@@ -244,27 +268,28 @@ public final class NativeError extends ScriptObject {
}
final Object exception = ECMAException.getException(sobj);
- Object[] res;
+ final StringBuilder buf = new StringBuilder();
if (exception instanceof Throwable) {
- final StackTraceElement[] frames = ((Throwable)exception).getStackTrace();
- final List filtered = new ArrayList<>();
- for (final StackTraceElement st : frames) {
- if (ECMAErrors.isScriptFrame(st)) {
- final String className = "<" + st.getFileName() + ">";
- String methodName = st.getMethodName();
- if (methodName.equals(CompilerConstants.RUN_SCRIPT.symbolName())) {
- methodName = "";
- }
- filtered.add(new StackTraceElement(className, methodName,
- st.getFileName(), st.getLineNumber()));
- }
+ final Object[] frames = getScriptFrames((Throwable)exception);
+ for (final Object fr : frames) {
+ final StackTraceElement st = (StackTraceElement)fr;
+ buf.append(st.getMethodName());
+ buf.append(" @ ");
+ buf.append(st.getFileName());
+ buf.append(':');
+ buf.append(st.getLineNumber());
+ buf.append('\n');
}
- res = filtered.toArray();
+ final int len = buf.length();
+ // remove trailing '\n'
+ if (len > 0) {
+ assert buf.charAt(len - 1) == '\n';
+ buf.deleteCharAt(len - 1);
+ }
+ return buf.toString();
} else {
- res = ScriptRuntime.EMPTY_ARRAY;
+ return "";
}
-
- return new NativeArray(res);
}
/**
@@ -335,4 +360,21 @@ public final class NativeError extends ScriptObject {
throw new MethodHandleFactory.LookupException(e);
}
}
+
+ private static Object[] getScriptFrames(final Throwable exception) {
+ final StackTraceElement[] frames = ((Throwable)exception).getStackTrace();
+ final List filtered = new ArrayList<>();
+ for (final StackTraceElement st : frames) {
+ if (ECMAErrors.isScriptFrame(st)) {
+ final String className = "<" + st.getFileName() + ">";
+ String methodName = st.getMethodName();
+ if (methodName.equals(CompilerConstants.RUN_SCRIPT.symbolName())) {
+ methodName = "";
+ }
+ filtered.add(new StackTraceElement(className, methodName,
+ st.getFileName(), st.getLineNumber()));
+ }
+ }
+ return filtered.toArray();
+ }
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java b/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java
index a32e721cc46..bb4e49a0c1b 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java
@@ -51,7 +51,7 @@ public final class ECMAException extends NashornException {
/** Field handle to the{@link ECMAException#thrown} field, so that it can be accessed from generated code */
public static final FieldAccess THROWN = virtualField(ECMAException.class, "thrown", Object.class);
- private static final String EXCEPTION_PROPERTY = "nashornException";
+ public static final String EXCEPTION_PROPERTY = "nashornException";
/** Object thrown. */
public final Object thrown;
diff --git a/nashorn/test/script/basic/JDK-8012164.js b/nashorn/test/script/basic/JDK-8012164.js
index 6416cfadfdb..62bb09c4b23 100644
--- a/nashorn/test/script/basic/JDK-8012164.js
+++ b/nashorn/test/script/basic/JDK-8012164.js
@@ -37,8 +37,9 @@ function error() {
try {
throw new Error('foo');
} catch (e) {
- for (i in e.stack) {
- printFrame(e.stack[i]);
+ var frames = e.getStackTrace();
+ for (i in frames) {
+ printFrame(frames[i]);
}
}
}
diff --git a/nashorn/test/script/basic/JDK-8012164.js.EXPECTED b/nashorn/test/script/basic/JDK-8012164.js.EXPECTED
index e70edea3c8e..9912edcd509 100644
--- a/nashorn/test/script/basic/JDK-8012164.js.EXPECTED
+++ b/nashorn/test/script/basic/JDK-8012164.js.EXPECTED
@@ -1,3 +1,3 @@
.error(test/script/basic/JDK-8012164.js:38)
.func(test/script/basic/JDK-8012164.js:33)
-.(test/script/basic/JDK-8012164.js:46)
+.(test/script/basic/JDK-8012164.js:47)
diff --git a/nashorn/test/script/basic/JDK-8017950.js b/nashorn/test/script/basic/JDK-8017950.js
new file mode 100644
index 00000000000..c84eacc57f0
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8017950.js
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8017950: error.stack should be a string rather than an array
+ *
+ * @test
+ * @run
+ */
+
+function func() {
+ try {
+ throw new Error();
+ } catch (e){
+ print(e.stack.replace(/\\/g, '/'))
+ }
+}
+
+function f() {
+ func()
+}
+
+function g() {
+ f()
+}
+
+g()
diff --git a/nashorn/test/script/basic/JDK-8017950.js.EXPECTED b/nashorn/test/script/basic/JDK-8017950.js.EXPECTED
new file mode 100644
index 00000000000..e86d02ef604
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8017950.js.EXPECTED
@@ -0,0 +1,4 @@
+func @ test/script/basic/JDK-8017950.js:33
+f @ test/script/basic/JDK-8017950.js:40
+g @ test/script/basic/JDK-8017950.js:44
+ @ test/script/basic/JDK-8017950.js:47
diff --git a/nashorn/test/script/basic/NASHORN-109.js b/nashorn/test/script/basic/NASHORN-109.js
index b05e0f12e50..4667feb21de 100644
--- a/nashorn/test/script/basic/NASHORN-109.js
+++ b/nashorn/test/script/basic/NASHORN-109.js
@@ -33,8 +33,9 @@ try {
throw new Error("error");
}
} catch (e) {
- for (i in e.stack) {
- print(e.stack[i].methodName + ' ' + e.stack[i].lineNumber);
+ var frames = e.getStackTrace();
+ for (i in frames) {
+ print(frames[i].methodName + ' ' + frames[i].lineNumber);
}
}
diff --git a/nashorn/test/script/basic/NASHORN-296.js b/nashorn/test/script/basic/NASHORN-296.js
index cbb752fbcaa..26338e60f56 100644
--- a/nashorn/test/script/basic/NASHORN-296.js
+++ b/nashorn/test/script/basic/NASHORN-296.js
@@ -33,7 +33,7 @@ function test(name) {
load({ script: 'throw new Error()', name: name });
} catch(e) {
// normalize windows path separator to URL style
- var actual = e.stack[0].fileName;
+ var actual = e.getStackTrace()[0].fileName;
if (actual !== name) {
fail("expected file name to be " + name +
", actually got file name " + actual);
@@ -48,6 +48,6 @@ test("com/oracle/node/sample.js");
try {
throw new Error();
} catch (e) {
- test(e.stack[0].fileName.substring(6));
+ test(e.getStackTrace()[0].fileName.substring(6));
}
diff --git a/nashorn/test/script/basic/errorstack.js b/nashorn/test/script/basic/errorstack.js
index 7db53142c10..8fcd25a2e1b 100644
--- a/nashorn/test/script/basic/errorstack.js
+++ b/nashorn/test/script/basic/errorstack.js
@@ -22,7 +22,7 @@
*/
/**
- * "stack" property of Error objects. (nashorn extension).
+ * "getStackTrace()" method of Error objects. (nashorn extension).
*
* @test
* @run
@@ -43,9 +43,9 @@ function func3() {
try {
func1();
} catch (e) {
- // "stack" is java.lang.StackTraceElement object
- for (i in e.stack) {
- print(e.stack[i].methodName + " : " + e.stack[i].lineNumber);
+ var frames = e.getStackTrace();
+ for (i in frames) {
+ print(frames[i].methodName + " : " + frames[i].lineNumber);
}
}
From e628bb4979f37972407aa441f93cbf4ed3e44f4d Mon Sep 17 00:00:00 2001
From: James Laskey
Date: Wed, 26 Jun 2013 08:36:53 -0300
Subject: [PATCH 022/101] 8008458: Strict functions dont share property map
Reviewed-by: sundar, hannesw
---
.../objects/NativeStrictArguments.java | 6 +-
.../internal/objects/ScriptFunctionImpl.java | 23 +++--
.../internal/runtime/FindProperty.java | 6 +-
.../nashorn/internal/runtime/Property.java | 6 +-
.../nashorn/internal/runtime/PropertyMap.java | 17 +++-
.../internal/runtime/ScriptObject.java | 91 ++++++-------------
.../internal/runtime/SetMethodCreator.java | 5 +-
.../runtime/UserAccessorProperty.java | 28 ++----
8 files changed, 85 insertions(+), 97 deletions(-)
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java b/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java
index 2a5756f7e81..7f75b4eed20 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java
@@ -57,8 +57,10 @@ public final class NativeStrictArguments extends ScriptObject {
PropertyMap map = PropertyMap.newMap(NativeStrictArguments.class);
map = Lookup.newProperty(map, "length", Property.NOT_ENUMERABLE, G$LENGTH, S$LENGTH);
// In strict mode, the caller and callee properties should throw TypeError
- map = ScriptFunctionImpl.newThrowerProperty(map, "caller");
- map = ScriptFunctionImpl.newThrowerProperty(map, "callee");
+ // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors.
+ final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE;
+ map = map.addProperty(map.newUserAccessors("caller", flags));
+ map = map.addProperty(map.newUserAccessors("callee", flags));
nasgenmap$ = map;
}
diff --git a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
index 23a13f25931..9289320e1cf 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
@@ -155,8 +155,12 @@ public class ScriptFunctionImpl extends ScriptFunction {
Lookup.TYPE_ERROR_THROWER_GETTER, Lookup.TYPE_ERROR_THROWER_SETTER);
}
- private static PropertyMap createStrictModeMap(final PropertyMap functionMap) {
- return newThrowerProperty(newThrowerProperty(functionMap, "arguments"), "caller");
+ private static PropertyMap createStrictModeMap(PropertyMap map) {
+ final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE;
+ // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors.
+ map = map.addProperty(map.newUserAccessors("arguments", flags));
+ map = map.addProperty(map.newUserAccessors("caller", flags));
+ return map;
}
// Choose the map based on strict mode!
@@ -260,12 +264,15 @@ public class ScriptFunctionImpl extends ScriptFunction {
this.setProto(Global.instance().getFunctionPrototype());
this.prototype = LAZY_PROTOTYPE;
- if (isStrict()) {
- final ScriptFunction func = getTypeErrorThrower();
- // We have to fill user accessor functions late as these are stored
- // in this object rather than in the PropertyMap of this object.
- setUserAccessors("arguments", func, func);
- setUserAccessors("caller", func, func);
+ // We have to fill user accessor functions late as these are stored
+ // in this object rather than in the PropertyMap of this object.
+
+ if (findProperty("arguments", true) != null) {
+ setUserAccessors("arguments", getTypeErrorThrower(), getTypeErrorThrower());
+ }
+
+ if (findProperty("caller", true) != null) {
+ setUserAccessors("caller", getTypeErrorThrower(), getTypeErrorThrower());
}
}
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java b/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java
index 16165fe9caa..c14accb7c4e 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java
@@ -89,7 +89,7 @@ public final class FindProperty {
MethodHandle setter = property.getSetter(type, getOwner().getMap());
if (property instanceof UserAccessorProperty) {
final UserAccessorProperty uc = (UserAccessorProperty) property;
- setter = MH.insertArguments(setter, 0, (isInherited() ? getOwner() : null),
+ setter = MH.insertArguments(setter, 0, isInherited() ? getOwner() : null,
uc.getSetterSlot(), strict? property.getKey() : null);
}
@@ -109,7 +109,7 @@ public final class FindProperty {
* @return appropriate receiver
*/
public ScriptObject getGetterReceiver() {
- return property != null && property.hasGetterFunction() ? self : prototype;
+ return property != null && property.hasGetterFunction(prototype) ? self : prototype;
}
/**
@@ -117,7 +117,7 @@ public final class FindProperty {
* @return appropriate receiver
*/
public ScriptObject getSetterReceiver() {
- return property != null && property.hasSetterFunction() ? self : prototype;
+ return property != null && property.hasSetterFunction(prototype) ? self : prototype;
}
/**
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Property.java b/nashorn/src/jdk/nashorn/internal/runtime/Property.java
index d516a78377b..e2cc6cdec21 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/Property.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Property.java
@@ -180,17 +180,19 @@ public abstract class Property {
/**
* Check whether this property has a user defined getter function. See {@link UserAccessorProperty}
+ * @param obj object containing getter
* @return true if getter function exists, false is default
*/
- public boolean hasGetterFunction() {
+ public boolean hasGetterFunction(final ScriptObject obj) {
return false;
}
/**
* Check whether this property has a user defined setter function. See {@link UserAccessorProperty}
+ * @param obj object containing setter
* @return true if getter function exists, false is default
*/
- public boolean hasSetterFunction() {
+ public boolean hasSetterFunction(final ScriptObject obj) {
return false;
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java
index b7248166696..3c552daa118 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java
@@ -302,7 +302,7 @@ public final class PropertyMap implements Iterable
+ /**
+ * Can t and s be compared for equality? Any primitive ==
+ * primitive or primitive == object comparisons here are an error.
+ * Unboxing and correct primitive == primitive comparisons are
+ * already dealt with in Attr.visitBinary.
+ *
+ */
+ public boolean isEqualityComparable(Type s, Type t, Warner warn) {
+ if (t.isNumeric() && s.isNumeric())
+ return true;
+
+ boolean tPrimitive = t.isPrimitive();
+ boolean sPrimitive = s.isPrimitive();
+ if (!tPrimitive && !sPrimitive) {
+ return isCastable(s, t, warn) || isCastable(t, s, warn);
+ } else {
+ return false;
+ }
+ }
+
//
public boolean isCastable(Type t, Type s) {
return isCastable(t, s, noWarnings);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
index b4a4f4dc47e..1be8604319f 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -3010,6 +3010,8 @@ public class Attr extends JCTree.Visitor {
!left.isErroneous() &&
!right.isErroneous()) {
owntype = operator.type.getReturnType();
+ // This will figure out when unboxing can happen and
+ // choose the right comparison operator.
int opc = chk.checkOperator(tree.lhs.pos(),
(OperatorSymbol)operator,
tree.getTag(),
@@ -3037,9 +3039,11 @@ public class Attr extends JCTree.Visitor {
}
// Check that argument types of a reference ==, != are
- // castable to each other, (JLS???).
+ // castable to each other, (JLS 15.21). Note: unboxing
+ // comparisons will not have an acmp* opc at this point.
if ((opc == ByteCodes.if_acmpeq || opc == ByteCodes.if_acmpne)) {
- if (!types.isCastable(left, right, new Warner(tree.pos()))) {
+ if (!types.isEqualityComparable(left, right,
+ new Warner(tree.pos()))) {
log.error(tree.pos(), "incomparable.types", left, right);
}
}
diff --git a/langtools/test/tools/javac/lambda/LambdaConv01.java b/langtools/test/tools/javac/lambda/LambdaConv01.java
index 73436c2f509..582c99fd383 100644
--- a/langtools/test/tools/javac/lambda/LambdaConv01.java
+++ b/langtools/test/tools/javac/lambda/LambdaConv01.java
@@ -67,7 +67,7 @@ public class LambdaConv01 {
assertTrue(3 == f1.foo());
//Covariant returns:
TU f2 = (Integer x) -> x;
- assertTrue(3 == f2.foo(3));
+ assertTrue(3 == f2.foo(3).intValue());
//Method resolution with boxing:
int res = LambdaConv01.exec((Integer x) -> x, 3);
assertTrue(3 == res);
@@ -86,7 +86,7 @@ public class LambdaConv01 {
assertTrue(3 == f1.foo());
//Covariant returns:
TU f2 = (Integer x) -> x;
- assertTrue(3 == f2.foo(3));
+ assertTrue(3 == f2.foo(3).intValue());
//Method resolution with boxing:
int res = LambdaConv01.exec((Integer x) -> x, 3);
assertTrue(3 == res);
@@ -105,7 +105,7 @@ public class LambdaConv01 {
assertTrue(3 == f1.foo());
//Covariant returns:
TU f2 = (Integer x) -> x;
- assertTrue(3 == f2.foo(3));
+ assertTrue(3 == f2.foo(3).intValue());
//Method resolution with boxing:
int res = LambdaConv01.exec((Integer x) -> x, 3);
assertTrue(3 == res);
@@ -124,7 +124,7 @@ public class LambdaConv01 {
assertTrue(3 == f1.foo());
//Covariant returns:
TU f2 = (Integer x) -> x;
- assertTrue(3 == f2.foo(3));
+ assertTrue(3 == f2.foo(3).intValue());
//Method resolution with boxing:
int res = LambdaConv01.exec((Integer x) -> x, 3);
assertTrue(3 == res);
diff --git a/langtools/test/tools/javac/lambda/LambdaExpr15.java b/langtools/test/tools/javac/lambda/LambdaExpr15.java
index fd5f4e14bf0..af00ee5c5d8 100644
--- a/langtools/test/tools/javac/lambda/LambdaExpr15.java
+++ b/langtools/test/tools/javac/lambda/LambdaExpr15.java
@@ -48,7 +48,7 @@ public class LambdaExpr15 {
new Object() {
String get() { return ""; }
};
- assertTrue(t == 1);
+ assertTrue((Integer)t == 1);
};
ba1.apply(1);
@@ -58,7 +58,7 @@ public class LambdaExpr15 {
String get() { return ""; }
};
new A();
- assertTrue(t == 2);
+ assertTrue((Integer)t == 2);
};
ba2.apply(2);
assertTrue(assertionCount == 2);
diff --git a/langtools/test/tools/javac/lambda/typeInference/InferenceTest2b.java b/langtools/test/tools/javac/lambda/typeInference/InferenceTest2b.java
index 8ab215afbdb..2dbe880a50b 100644
--- a/langtools/test/tools/javac/lambda/typeInference/InferenceTest2b.java
+++ b/langtools/test/tools/javac/lambda/typeInference/InferenceTest2b.java
@@ -64,7 +64,7 @@ public class InferenceTest2b {
void m2(SAM6 super Integer> s) {
System.out.println("m2()");
- assertTrue(s.m6(1, 2) == 1);
+ assertTrue(s.m6(1, 2).equals(Integer.valueOf(1)));
}
void m3(SAM6 super Calendar> s) {
diff --git a/langtools/test/tools/javac/types/TestComparisons.java b/langtools/test/tools/javac/types/TestComparisons.java
new file mode 100644
index 00000000000..46f267b0401
--- /dev/null
+++ b/langtools/test/tools/javac/types/TestComparisons.java
@@ -0,0 +1,362 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 8013357
+ * @summary javac should correctly enforce binary comparison rules.
+ */
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.code.Symbol.*;
+import java.io.*;
+import java.lang.reflect.Array;
+import java.util.EnumSet;
+
+public class TestComparisons {
+
+ private int errors = 0;
+ private int testnum = 0;
+
+ static final File testdir = new File("8013357");
+
+ private enum CompareType {
+ BYTE_PRIM("byte"),
+ SHORT_PRIM("short"),
+ CHAR_PRIM("char"),
+ INTEGER_PRIM("int"),
+ LONG_PRIM("long"),
+ FLOAT_PRIM("float"),
+ DOUBLE_PRIM("double"),
+ BOOLEAN_PRIM("boolean"),
+
+ BYTE("Byte"),
+ SHORT("Short"),
+ CHAR("Character"),
+ INTEGER("Integer"),
+ LONG("Long"),
+ FLOAT("Float"),
+ DOUBLE("Double"),
+ BOOLEAN("Boolean"),
+
+ BYTE_SUPER("List super Byte>", true),
+ SHORT_SUPER("List super Short>", true),
+ CHAR_SUPER("List super Character>", true),
+ INTEGER_SUPER("List super Integer>", true),
+ LONG_SUPER("List super Long>", true),
+ FLOAT_SUPER("List super Float>", true),
+ DOUBLE_SUPER("List super Double>", true),
+ BOOLEAN_SUPER("List super Boolean>", true),
+
+ OBJECT("Object"),
+ NUMBER("Number"),
+ STRING("String");
+
+ public final boolean isList;
+ public final String name;
+
+ private CompareType(final String name, final boolean isList) {
+ this.isList = isList;
+ this.name = name;
+ }
+
+ private CompareType(final String name) {
+ this(name, false);
+ }
+ }
+
+ // The integers here refer to which subsection of JLS 15.21 is in
+ // effect. 0 means no comparison is allowed.
+ private static final int truthtab[][] = {
+ // byte, comparable to itself, any numeric type, or any boxed
+ // numeric type.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
+ 0, 0, 0, 0, 0, 0, 0, 0, // Captures
+ 0, 0, 0 // Reference types
+ },
+ // short, comparable to itself, any numeric type, or any boxed
+ // numeric type.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
+ 0, 0, 0, 0, 0, 0, 0, 0, // Captures
+ 0, 0, 0 // Reference types
+ },
+ // char, comparable to itself, any numeric type, or any boxed
+ // numeric type.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
+ 0, 0, 0, 0, 0, 0, 0, 0, // Captures
+ 0, 0, 0 // Reference types
+ },
+ // int, comparable to itself, any numeric type, or any boxed
+ // numeric type.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
+ 0, 0, 0, 0, 0, 0, 0, 0, // Captures
+ 0, 0, 0 // Reference types
+ },
+ // long, comparable to itself, any numeric type, or any boxed
+ // numeric type.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
+ 0, 0, 0, 0, 0, 0, 0, 0, // Captures
+ 0, 0, 0 // Reference types
+ },
+ // float, comparable to itself, any numeric type, or any boxed
+ // numeric type.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
+ 0, 0, 0, 0, 0, 0, 0, 0, // Captures
+ 0, 0, 0 // Reference types
+ },
+ // double, comparable to itself, any numeric type, or any boxed
+ // numeric type.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
+ 0, 0, 0, 0, 0, 0, 0, 0, // Captures
+ 0, 0, 0 // Reference types
+ },
+ // boolean, comparable only to itself and Boolean.
+ { 0, 0, 0, 0, 0, 0, 0, 2, // Primitives
+ 0, 0, 0, 0, 0, 0, 0, 2, // Boxed primitives
+ 0, 0, 0, 0, 0, 0, 0, 0, // Captures
+ 0, 0, 0 // Reference types
+ },
+ // Byte, comparable to itself, Number, Object, any numeric primitive,
+ // and any captures.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 3, 0, 0, 0, 0, 0, 0, 0, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 0 // Reference types
+ },
+ // Short, comparable to itself, Number, Object, any numeric primitive,
+ // and any captures.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 0, 3, 0, 0, 0, 0, 0, 0, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 0 // Reference types
+ },
+ // Character, comparable to itself, Object, any numeric primitive,
+ // and any captures.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 0, 0, 3, 0, 0, 0, 0, 0, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 0, 0 // Reference types
+ },
+ // Int, comparable to itself, Number, Object, any numeric primitive,
+ // and any captures.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 0, 0, 0, 3, 0, 0, 0, 0, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 0 // Reference types
+ },
+ // Long, comparable to itself, Number, Object, any numeric primitive,
+ // and any captures.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 0, 0, 0, 0, 3, 0, 0, 0, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 0 // Reference types
+ },
+ // Float, comparable to itself, Number, Object, any numeric primitive,
+ // and any captures.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 0, 0, 0, 0, 0, 3, 0, 0, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 0 // Reference types
+ },
+ // Double, comparable to itself, Number, Object, any numeric primitive,
+ // and any captures.
+ { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
+ 0, 0, 0, 0, 0, 0, 3, 0, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 0 // Reference types
+ },
+ // Boolean, to itself, any capture, Object, and boolean.
+ { 0, 0, 0, 0, 0, 0, 0, 2, // Primitives
+ 0, 0, 0, 0, 0, 0, 0, 2, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 0, 0 // Reference types
+ },
+ // Byte supertype wildcard, comparable to any reference type.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 3 // Reference types
+ },
+ // Short supertype wildcard, comparable to any reference type.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 3 // Reference types
+ },
+ // Character supertype wildcard, comparable to any reference type.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 3 // Reference types
+ },
+ // Integer supertype wildcard, comparable to any reference type.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 3 // Reference types
+ },
+ // Long supertype wildcard, comparable to any reference type.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 3 // Reference types
+ },
+ // Float supertype wildcard, comparable to any reference type.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 3 // Reference types
+ },
+ // Double supertype wildcard, comparable to any reference type.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 3 // Reference types
+ },
+ // Boolean supertype wildcard, comparable to any reference type.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 3 // Reference types
+ },
+ // Object, comparable to any reference type.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 3 // Reference types
+ },
+ // Number, comparable to Object, any of its subclasses.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 3, 3, 0, 3, 3, 3, 3, 0, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 3, 0 // Reference types
+ },
+ // String supertype wildcard, comparable to any reference type.
+ // and any captures.
+ { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
+ 0, 0, 0, 0, 0, 0, 0, 0, // Boxed primitives
+ 3, 3, 3, 3, 3, 3, 3, 3, // Captures
+ 3, 0, 3 // Reference types
+ }
+ };
+
+ private void assert_compile_fail(final File file, final String body) {
+ final String filename = file.getPath();
+ final String[] args = { filename };
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
+ final int rc = com.sun.tools.javac.Main.compile(args, pw);
+ pw.close();
+ if (rc == 0) {
+ System.err.println("Compilation of " + file.getName() +
+ " didn't fail as expected.\nFile:\n" +
+ body + "\nOutput:\n" + sw.toString());
+ errors++;
+ }
+ }
+
+ private void assert_compile_succeed(final File file, final String body) {
+ final String filename = file.getPath();
+ final String[] args = { filename };
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
+ final int rc = com.sun.tools.javac.Main.compile(args, pw);
+ pw.close();
+ if (rc != 0) {
+ System.err.println("Compilation of " + file.getName() +
+ " didn't succeed as expected.\nFile:\n" +
+ body + "\nOutput:\n" +
+ sw.toString());
+ errors++;
+ }
+ }
+
+ private String makeBody(final int num,
+ final CompareType left,
+ final CompareType right) {
+ return "import java.util.List;\n" +
+ "public class Test" + num + " {\n" +
+ " public boolean test(" + left.name +
+ " left, " + right.name + " right) {\n" +
+ " return left" + (left.isList ? ".get(0)" : "") +
+ " == right" + (right.isList ? ".get(0)" : "") + ";\n" +
+ " }\n" +
+ "}\n";
+ }
+
+ private File writeFile(final String filename,
+ final String body)
+ throws IOException {
+ final File f = new File(testdir, filename);
+ f.getParentFile().mkdirs();
+ final FileWriter out = new FileWriter(f);
+ out.write(body);
+ out.close();
+ return f;
+ }
+
+ private void test(final CompareType left, final CompareType right)
+ throws IOException {
+ final int num = testnum++;
+ final String filename = "Test" + num + ".java";
+ final String body = makeBody(num, left, right);
+ final File file = writeFile(filename, body);
+ if (truthtab[left.ordinal()][right.ordinal()] != 0)
+ assert_compile_succeed(file, body);
+ else
+ assert_compile_fail(file, body);
+ }
+
+ void run() throws Exception {
+ testdir.mkdir();
+
+ for(CompareType left : CompareType.values())
+ for(CompareType right : CompareType.values())
+ test(left, right);
+
+ if (errors != 0)
+ throw new Exception("ObjectZeroCompare test failed with " +
+ errors + " errors.");
+ }
+
+ public static void main(String... args) throws Exception {
+ new TestComparisons().run();
+ }
+}
From 13bcac6e93ca3927ed49920e3f0e8621a3aa1900 Mon Sep 17 00:00:00 2001
From: Alejandro Murillo
Date: Fri, 28 Jun 2013 02:33:13 -0700
Subject: [PATCH 044/101] 8019302: new hotspot build - hs25-b40
Reviewed-by: jcoomes
---
hotspot/make/hotspot_version | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version
index 17088cd02f9..b597ff990be 100644
--- a/hotspot/make/hotspot_version
+++ b/hotspot/make/hotspot_version
@@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013
HS_MAJOR_VER=25
HS_MINOR_VER=0
-HS_BUILD_NUMBER=39
+HS_BUILD_NUMBER=40
JDK_MAJOR_VER=1
JDK_MINOR_VER=8
From 95e39e6039882c00d063382f694b5b7ed7438a42 Mon Sep 17 00:00:00 2001
From: Eric McCorkle
Date: Fri, 28 Jun 2013 06:54:58 -0400
Subject: [PATCH 045/101] 8016760: Failure of regression test
langtools/tools/javac/T6725036.java
Marking the failing test @ignore; the proposed change for 8015666 addresses the underlying issue
Reviewed-by: jjg
---
langtools/test/tools/javac/T6725036.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/langtools/test/tools/javac/T6725036.java b/langtools/test/tools/javac/T6725036.java
index b27ad886d13..24ea34798da 100644
--- a/langtools/test/tools/javac/T6725036.java
+++ b/langtools/test/tools/javac/T6725036.java
@@ -24,6 +24,7 @@
/*
* @test
* @bug 6725036
+ * @ignore 8016760: failure of regression test langtools/tools/javac/T6725036.java
* @summary javac returns incorrect value for lastModifiedTime() when
* source is a zip file archive
*/
From e8952a4764636c9248af7495d4b14f14340da481 Mon Sep 17 00:00:00 2001
From: Vicente Romero
Date: Fri, 28 Jun 2013 13:20:44 +0100
Subject: [PATCH 046/101] 6473148: TreePath.iterator() should document the
iteration order
Reviewed-by: mcimadamore
---
.../src/share/classes/com/sun/source/util/TreePath.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/langtools/src/share/classes/com/sun/source/util/TreePath.java b/langtools/src/share/classes/com/sun/source/util/TreePath.java
index d7df6a96b03..1d23b08fde6 100644
--- a/langtools/src/share/classes/com/sun/source/util/TreePath.java
+++ b/langtools/src/share/classes/com/sun/source/util/TreePath.java
@@ -125,18 +125,25 @@ public class TreePath implements Iterable {
return parent;
}
+ /**
+ * Iterates from leaves to root.
+ */
+ @Override
public Iterator iterator() {
return new Iterator() {
+ @Override
public boolean hasNext() {
return next != null;
}
+ @Override
public Tree next() {
Tree t = next.leaf;
next = next.parent;
return t;
}
+ @Override
public void remove() {
throw new UnsupportedOperationException();
}
From 39673a6ee96c0819add57510786b1470ca53ee8c Mon Sep 17 00:00:00 2001
From: Vicente Romero
Date: Fri, 28 Jun 2013 14:36:06 +0100
Subject: [PATCH 047/101] 8005552:
c.s.t.javap.AttributeWriter.visitLocalVariableTable() uses incorrect format
string
Reviewed-by: mcimadamore
---
.../share/classes/com/sun/tools/javap/AttributeWriter.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
index 94aeb019658..b292139c9f3 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
@@ -365,8 +365,7 @@ public class AttributeWriter extends BasicWriter
indent(+1);
println("Start Length Slot Name Signature");
for (LocalVariableTable_attribute.Entry entry : attr.local_variable_table) {
- Formatter formatter = new Formatter();
- println(formatter.format("%8d %7d %5d %5s %s",
+ println(String.format("%5d %7d %5d %5s %s",
entry.start_pc, entry.length, entry.index,
constantWriter.stringValue(entry.name_index),
constantWriter.stringValue(entry.descriptor_index)));
@@ -609,7 +608,8 @@ public class AttributeWriter extends BasicWriter
public Void visit_append_frame(StackMapTable_attribute.append_frame frame, Void p) {
printHeader(frame);
println(" /* append */");
- println(" offset_delta = " + frame.offset_delta);
+ indent(+1);
+ println("offset_delta = " + frame.offset_delta);
printMap("locals", frame.locals);
return null;
}
From 0eb7f23c990e2498e709dfebc404156e1f500cad Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Fri, 28 Jun 2013 19:36:26 +0530
Subject: [PATCH 048/101] 8019365: Error stack format
Reviewed-by: hannesw
---
.../src/jdk/nashorn/api/scripting/NashornException.java | 5 +++--
.../src/jdk/nashorn/internal/objects/NativeError.java | 8 ++++++--
nashorn/test/script/basic/JDK-8014781.js.EXPECTED | 7 ++++---
nashorn/test/script/basic/JDK-8017950.js.EXPECTED | 9 +++++----
nashorn/test/script/basic/JDK-8019226.js | 2 +-
nashorn/test/script/basic/JDK-8019226.js.EXPECTED | 7 ++++---
6 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/nashorn/src/jdk/nashorn/api/scripting/NashornException.java b/nashorn/src/jdk/nashorn/api/scripting/NashornException.java
index 0b479856630..3cd687cce08 100644
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornException.java
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornException.java
@@ -172,12 +172,13 @@ public abstract class NashornException extends RuntimeException {
final StringBuilder buf = new StringBuilder();
final StackTraceElement[] frames = getScriptFrames((Throwable)exception);
for (final StackTraceElement st : frames) {
+ buf.append("\tat ");
buf.append(st.getMethodName());
- buf.append(" @ ");
+ buf.append(" (");
buf.append(st.getFileName());
buf.append(':');
buf.append(st.getLineNumber());
- buf.append('\n');
+ buf.append(")\n");
}
final int len = buf.length();
// remove trailing '\n'
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
index 12029ad091b..25a3f3c74a6 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
@@ -129,7 +129,7 @@ public final class NativeError extends ScriptObject {
Global.checkObject(errorObj);
final ScriptObject sobj = (ScriptObject)errorObj;
final ECMAException exp = new ECMAException(sobj, null);
- sobj.set("stack", NashornException.getScriptStackString(exp), false);
+ sobj.set("stack", getScriptStackString(sobj, exp), false);
return UNDEFINED;
}
@@ -288,7 +288,7 @@ public final class NativeError extends ScriptObject {
final Object exception = ECMAException.getException(sobj);
if (exception instanceof Throwable) {
- return NashornException.getScriptStackString((Throwable)exception);
+ return getScriptStackString(sobj, (Throwable)exception);
} else {
return "";
}
@@ -362,4 +362,8 @@ public final class NativeError extends ScriptObject {
throw new MethodHandleFactory.LookupException(e);
}
}
+
+ private static String getScriptStackString(final ScriptObject sobj, final Throwable exp) {
+ return JSType.toString(sobj) + "\n" + NashornException.getScriptStackString(exp);
+ }
}
diff --git a/nashorn/test/script/basic/JDK-8014781.js.EXPECTED b/nashorn/test/script/basic/JDK-8014781.js.EXPECTED
index 073d3b78bc8..d3586c0ee67 100644
--- a/nashorn/test/script/basic/JDK-8014781.js.EXPECTED
+++ b/nashorn/test/script/basic/JDK-8014781.js.EXPECTED
@@ -1,3 +1,4 @@
-MyError @ test/script/basic/JDK-8014781.js:32
-func @ test/script/basic/JDK-8014781.js:36
- @ test/script/basic/JDK-8014781.js:39
+[object Object]
+ at MyError (test/script/basic/JDK-8014781.js:32)
+ at func (test/script/basic/JDK-8014781.js:36)
+ at (test/script/basic/JDK-8014781.js:39)
diff --git a/nashorn/test/script/basic/JDK-8017950.js.EXPECTED b/nashorn/test/script/basic/JDK-8017950.js.EXPECTED
index e86d02ef604..8c34d21343f 100644
--- a/nashorn/test/script/basic/JDK-8017950.js.EXPECTED
+++ b/nashorn/test/script/basic/JDK-8017950.js.EXPECTED
@@ -1,4 +1,5 @@
-func @ test/script/basic/JDK-8017950.js:33
-f @ test/script/basic/JDK-8017950.js:40
-g @ test/script/basic/JDK-8017950.js:44
- @ test/script/basic/JDK-8017950.js:47
+Error
+ at func (test/script/basic/JDK-8017950.js:33)
+ at f (test/script/basic/JDK-8017950.js:40)
+ at g (test/script/basic/JDK-8017950.js:44)
+ at (test/script/basic/JDK-8017950.js:47)
diff --git a/nashorn/test/script/basic/JDK-8019226.js b/nashorn/test/script/basic/JDK-8019226.js
index 67bb67ae4ed..3a1cf2f901b 100644
--- a/nashorn/test/script/basic/JDK-8019226.js
+++ b/nashorn/test/script/basic/JDK-8019226.js
@@ -30,7 +30,7 @@
function func1() { func2() }
-function func2() { throw new Error() }
+function func2() { throw new Error("failed!") }
try {
func1()
diff --git a/nashorn/test/script/basic/JDK-8019226.js.EXPECTED b/nashorn/test/script/basic/JDK-8019226.js.EXPECTED
index 7833bb54706..002a3ddbf0e 100644
--- a/nashorn/test/script/basic/JDK-8019226.js.EXPECTED
+++ b/nashorn/test/script/basic/JDK-8019226.js.EXPECTED
@@ -1,3 +1,4 @@
-func2 @ test/script/basic/JDK-8019226.js:33
-func1 @ test/script/basic/JDK-8019226.js:31
- @ test/script/basic/JDK-8019226.js:36
+Error: failed!
+ at func2 (test/script/basic/JDK-8019226.js:33)
+ at func1 (test/script/basic/JDK-8019226.js:31)
+ at (test/script/basic/JDK-8019226.js:36)
From 36967c98e4a86c50a94cc5c4edee952008574f6f Mon Sep 17 00:00:00 2001
From: Per Liden
Date: Sun, 30 Jun 2013 21:42:07 +0200
Subject: [PATCH 049/101] 8014022: G1: Non Java threads should lock the shared
SATB queue lock without safepoint checks
Reviewed-by: tschatzl, brutisso, jmasa, ysr
---
.../share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
index 9cee1eb1ba2..218be0c0e40 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
@@ -47,7 +47,7 @@ void G1SATBCardTableModRefBS::enqueue(oop pre_val) {
JavaThread* jt = (JavaThread*)thr;
jt->satb_mark_queue().enqueue(pre_val);
} else {
- MutexLocker x(Shared_SATB_Q_lock);
+ MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);
JavaThread::satb_mark_queue_set().shared_satb_queue()->enqueue(pre_val);
}
}
From f93ee2a9ddd0e83d187b283c16c7c40a5166efb3 Mon Sep 17 00:00:00 2001
From: John Cuthbertson
Date: Mon, 1 Jul 2013 09:30:23 -0700
Subject: [PATCH 050/101] 8017070: G1: assert(_card_counts[card_num] <=
G1ConcRSHotCardLimit) failed
The assert is invalid when a card is being refined by two different threads and its count crosses the hot threshold - the refinement count will be updated once by each thread triggering the assert. Remove the assert and update the count using a bounded expression.
Reviewed-by: jmasa, tamao, brutisso
---
hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp
index 00ea5b54850..f75e518facc 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp
@@ -152,12 +152,9 @@ uint G1CardCounts::add_card_count(jbyte* card_ptr) {
if (card_num < _committed_max_card_num) {
count = (uint) _card_counts[card_num];
if (count < G1ConcRSHotCardLimit) {
- _card_counts[card_num] += 1;
+ _card_counts[card_num] =
+ (jubyte)(MIN2((uintx)(_card_counts[card_num] + 1), G1ConcRSHotCardLimit));
}
- assert(_card_counts[card_num] <= G1ConcRSHotCardLimit,
- err_msg("Refinement count overflow? "
- "new count: "UINT32_FORMAT,
- (uint) _card_counts[card_num]));
}
}
return count;
From 7109e85e4301779f00bbfb190b11cd6dab078937 Mon Sep 17 00:00:00 2001
From: Tao Mao
Date: Fri, 28 Jun 2013 20:18:04 -0700
Subject: [PATCH 051/101] 8017611: Auto corrector for mistyped vm options
The auto corrector for mistyped vm options fuzzy-matches existing flags based on string similarity (Dice's coefficient).
Reviewed-by: kvn, dsamersoff, hseigel, johnc
---
hotspot/src/share/vm/runtime/arguments.cpp | 10 ++-
hotspot/src/share/vm/runtime/globals.cpp | 50 +++++++++++++-
hotspot/src/share/vm/runtime/globals.hpp | 3 +-
.../TestUnrecognizedVMOptionsHandling.java | 69 +++++++++++++++++++
4 files changed, 128 insertions(+), 4 deletions(-)
create mode 100644 hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index 3fc9761f787..fe3ab30e043 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -849,7 +849,7 @@ bool Arguments::process_argument(const char* arg,
arg_len = equal_sign - argname;
}
- Flag* found_flag = Flag::find_flag((char*)argname, arg_len, true);
+ Flag* found_flag = Flag::find_flag((const char*)argname, arg_len, true);
if (found_flag != NULL) {
char locked_message_buf[BUFLEN];
found_flag->get_locked_message(locked_message_buf, BUFLEN);
@@ -870,6 +870,14 @@ bool Arguments::process_argument(const char* arg,
} else {
jio_fprintf(defaultStream::error_stream(),
"Unrecognized VM option '%s'\n", argname);
+ Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true);
+ if (fuzzy_matched != NULL) {
+ jio_fprintf(defaultStream::error_stream(),
+ "Did you mean '%s%s%s'?\n",
+ (fuzzy_matched->is_bool()) ? "(+/-)" : "",
+ fuzzy_matched->name,
+ (fuzzy_matched->is_bool()) ? "" : "=");
+ }
}
// allow for commandline "commenting out" options like -XX:#+Verbose
diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp
index b45e15c9560..a6c47bfe1de 100644
--- a/hotspot/src/share/vm/runtime/globals.cpp
+++ b/hotspot/src/share/vm/runtime/globals.cpp
@@ -276,14 +276,14 @@ static Flag flagTable[] = {
Flag* Flag::flags = flagTable;
size_t Flag::numFlags = (sizeof(flagTable) / sizeof(Flag));
-inline bool str_equal(const char* s, char* q, size_t len) {
+inline bool str_equal(const char* s, const char* q, size_t len) {
// s is null terminated, q is not!
if (strlen(s) != (unsigned int) len) return false;
return strncmp(s, q, len) == 0;
}
// Search the flag table for a named flag
-Flag* Flag::find_flag(char* name, size_t length, bool allow_locked) {
+Flag* Flag::find_flag(const char* name, size_t length, bool allow_locked) {
for (Flag* current = &flagTable[0]; current->name != NULL; current++) {
if (str_equal(current->name, name, length)) {
// Found a matching entry. Report locked flags only if allowed.
@@ -301,6 +301,52 @@ Flag* Flag::find_flag(char* name, size_t length, bool allow_locked) {
return NULL;
}
+// Compute string similarity based on Dice's coefficient
+static float str_similar(const char* str1, const char* str2, size_t len2) {
+ int len1 = (int) strlen(str1);
+ int total = len1 + (int) len2;
+
+ int hit = 0;
+
+ for (int i = 0; i < len1 -1; ++i) {
+ for (int j = 0; j < (int) len2 -1; ++j) {
+ if ((str1[i] == str2[j]) && (str1[i+1] == str2[j+1])) {
+ ++hit;
+ break;
+ }
+ }
+ }
+
+ return 2.0f * (float) hit / (float) total;
+}
+
+Flag* Flag::fuzzy_match(const char* name, size_t length, bool allow_locked) {
+ float VMOptionsFuzzyMatchSimilarity = 0.7f;
+ Flag* match = NULL;
+ float score;
+ float max_score = -1;
+
+ for (Flag* current = &flagTable[0]; current->name != NULL; current++) {
+ score = str_similar(current->name, name, length);
+ if (score > max_score) {
+ max_score = score;
+ match = current;
+ }
+ }
+
+ if (!(match->is_unlocked() || match->is_unlocker())) {
+ if (!allow_locked) {
+ return NULL;
+ }
+ }
+
+ if (max_score < VMOptionsFuzzyMatchSimilarity) {
+ return NULL;
+ }
+
+ return match;
+}
+
// Returns the address of the index'th element
static Flag* address_of_flag(CommandLineFlagWithType flag) {
assert((size_t)flag < Flag::numFlags, "bad command line flag index");
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index b1adcf7fce1..a8383d9a5af 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -220,7 +220,8 @@ struct Flag {
// number of flags
static size_t numFlags;
- static Flag* find_flag(char* name, size_t length, bool allow_locked = false);
+ static Flag* find_flag(const char* name, size_t length, bool allow_locked = false);
+ static Flag* fuzzy_match(const char* name, size_t length, bool allow_locked = false);
bool is_bool() const { return strcmp(type, "bool") == 0; }
bool get_bool() const { return *((bool*) addr); }
diff --git a/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java b/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java
new file mode 100644
index 00000000000..a61b5f30940
--- /dev/null
+++ b/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 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.
+*
+* 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 TestUnrecognizedVMOptionsHandling
+ * @key gc
+ * @bug 8017611
+ * @summary Tests handling unrecognized VM options
+ * @library /testlibrary
+ * @run main/othervm TestUnrecognizedVMOptionsHandling
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class TestUnrecognizedVMOptionsHandling {
+
+ public static void main(String args[]) throws Exception {
+ // The first two JAVA processes are expected to fail, but with a correct VM option suggestion
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+PrintGc",
+ "-version"
+ );
+ OutputAnalyzer outputWithError = new OutputAnalyzer(pb.start());
+ outputWithError.shouldContain("Did you mean '(+/-)PrintGC'?");
+ if (outputWithError.getExitValue() == 0) {
+ throw new RuntimeException("Not expected to get exit value 0");
+ }
+
+ pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:MaxiumHeapSize=500m",
+ "-version"
+ );
+ outputWithError = new OutputAnalyzer(pb.start());
+ outputWithError.shouldContain("Did you mean 'MaxHeapSize='?");
+ if (outputWithError.getExitValue() == 0) {
+ throw new RuntimeException("Not expected to get exit value 0");
+ }
+
+ // The last JAVA process should run successfully for the purpose of sanity check
+ pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+PrintGC",
+ "-version"
+ );
+ OutputAnalyzer outputWithNoError = new OutputAnalyzer(pb.start());
+ outputWithNoError.shouldNotContain("Did you mean '(+/-)PrintGC'?");
+ outputWithNoError.shouldHaveExitValue(0);
+ }
+}
+
From a33129c6af1ef2d75f264bb21316440df844d10b Mon Sep 17 00:00:00 2001
From: Vicente Romero
Date: Sat, 29 Jun 2013 20:12:24 +0100
Subject: [PATCH 052/101] 6983646: javap should identify why a DefaultAttribute
is being used
Reviewed-by: jjg
---
.../com/sun/tools/classfile/Attribute.java | 10 ++++++++--
.../sun/tools/classfile/DefaultAttribute.java | 16 +++++++++++++++-
.../com/sun/tools/javap/AttributeWriter.java | 3 +++
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
index 3f854395f9b..dc4fc9d0137 100644
--- a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
@@ -77,10 +77,12 @@ public abstract class Attribute {
public Attribute createAttribute(ClassReader cr, int name_index, byte[] data)
throws IOException {
- if (standardAttributes == null)
+ if (standardAttributes == null) {
init();
+ }
ConstantPool cp = cr.getConstantPool();
+ String reasonForDefaultAttr;
try {
String name = cp.getUTF8Value(name_index);
Class extends Attribute> attrClass = standardAttributes.get(name);
@@ -90,14 +92,18 @@ public abstract class Attribute {
Constructor extends Attribute> constr = attrClass.getDeclaredConstructor(constrArgTypes);
return constr.newInstance(new Object[] { cr, name_index, data.length });
} catch (Throwable t) {
+ reasonForDefaultAttr = t.toString();
// fall through and use DefaultAttribute
// t.printStackTrace();
}
+ } else {
+ reasonForDefaultAttr = "unknown attribute";
}
} catch (ConstantPoolException e) {
+ reasonForDefaultAttr = e.toString();
// fall through and use DefaultAttribute
}
- return new DefaultAttribute(cr, name_index, data);
+ return new DefaultAttribute(cr, name_index, data, reasonForDefaultAttr);
}
protected void init() {
diff --git a/langtools/src/share/classes/com/sun/tools/classfile/DefaultAttribute.java b/langtools/src/share/classes/com/sun/tools/classfile/DefaultAttribute.java
index fba1700f35e..16fdeb9824d 100644
--- a/langtools/src/share/classes/com/sun/tools/classfile/DefaultAttribute.java
+++ b/langtools/src/share/classes/com/sun/tools/classfile/DefaultAttribute.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -33,13 +33,24 @@ package com.sun.tools.classfile;
*/
public class DefaultAttribute extends Attribute {
DefaultAttribute(ClassReader cr, int name_index, byte[] data) {
+ this(cr, name_index, data, null);
+ }
+
+ DefaultAttribute(ClassReader cr, int name_index, byte[] data, String reason) {
super(name_index, data.length);
info = data;
+ this.reason = reason;
}
public DefaultAttribute(ConstantPool constant_pool, int name_index, byte[] info) {
+ this(constant_pool, name_index, info, null);
+ }
+
+ public DefaultAttribute(ConstantPool constant_pool, int name_index,
+ byte[] info, String reason) {
super(name_index, info.length);
this.info = info;
+ this.reason = reason;
}
public R accept(Visitor visitor, P p) {
@@ -47,4 +58,7 @@ public class DefaultAttribute extends Attribute {
}
public final byte[] info;
+ /** Why did we need to generate a DefaultAttribute
+ */
+ public final String reason;
}
diff --git a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
index b292139c9f3..c77d09628da 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
@@ -114,6 +114,9 @@ public class AttributeWriter extends BasicWriter
}
public Void visitDefault(DefaultAttribute attr, Void ignore) {
+ if (attr.reason != null) {
+ report(attr.reason);
+ }
byte[] data = attr.info;
int i = 0;
int j = 0;
From 1a0fc187f41987e3f460c27e39afb1e09d7aa229 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Mon, 1 Jul 2013 12:38:01 +0530
Subject: [PATCH 053/101] 8019473: Parser issues related to functions and
blocks
Reviewed-by: lagergren
---
.../jdk/nashorn/internal/parser/Parser.java | 8 ++-
nashorn/test/script/basic/JDK-8019473.js | 62 +++++++++++++++++++
2 files changed, 67 insertions(+), 3 deletions(-)
create mode 100644 nashorn/test/script/basic/JDK-8019473.js
diff --git a/nashorn/src/jdk/nashorn/internal/parser/Parser.java b/nashorn/src/jdk/nashorn/internal/parser/Parser.java
index 0c2c1633591..3c609cc9be3 100644
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java
@@ -767,8 +767,6 @@ loop:
case LBRACE:
block();
break;
- case RBRACE:
- break;
case VAR:
variableStatement(true);
break;
@@ -1267,6 +1265,7 @@ loop:
case RBRACE:
case SEMICOLON:
case EOL:
+ case EOF:
break;
default:
@@ -1314,6 +1313,7 @@ loop:
case RBRACE:
case SEMICOLON:
case EOL:
+ case EOF:
break;
default:
@@ -1368,6 +1368,7 @@ loop:
case RBRACE:
case SEMICOLON:
case EOL:
+ case EOF:
break;
default:
@@ -1403,6 +1404,7 @@ loop:
case RBRACE:
case SEMICOLON:
case EOL:
+ case EOF:
break;
default:
@@ -2566,7 +2568,7 @@ loop:
*/
// just expression as function body
- final Node expr = expression();
+ final Node expr = assignmentExpression(true);
assert lc.getCurrentBlock() == lc.getFunctionBody(functionNode);
// create a return statement - this creates code in itself and does not need to be
// wrapped into an ExecuteNode
diff --git a/nashorn/test/script/basic/JDK-8019473.js b/nashorn/test/script/basic/JDK-8019473.js
new file mode 100644
index 00000000000..5001f3d7311
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8019473.js
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8019473: Parser issues related to functions and blocks
+ *
+ * @test
+ * @run
+ */
+
+function checkNoError(code) {
+ try {
+ Function(code);
+ } catch (e) {
+ print("no error expected for: " + code + " , got " + e);
+ }
+}
+
+// implicit newlines at EOF should be accepted
+checkNoError("for(;;) continue")
+checkNoError("return")
+checkNoError("yield")
+checkNoError("for(;;) break")
+
+function checkError(code) {
+ try {
+ eval(code);
+ print("SyntaxError expected for: " + code);
+ } catch (e) {
+ if (! (e instanceof SyntaxError)) {
+ fail("SyntaxError expected, got " + e);
+ }
+ }
+}
+
+checkError("function f() { case0: }");
+checkError("function f() { if(0) }");
+checkError("function f() { if(0); else }");
+checkError("function f() { while(0) }");
+
+// comma expression as closure expression
+checkError("function sq(x) x, x*x");
From 1a074a8b66c98e9ff2ae56dde9ff0d2626154d20 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Mon, 1 Jul 2013 14:15:07 +0530
Subject: [PATCH 054/101] 8019478:
Object.prototype.toString.call(/a/.exec("a")) === "[object Array]" should be
true
Reviewed-by: hannesw
---
.../objects/NativeRegExpExecResult.java | 5 +++
nashorn/test/script/basic/JDK-8019478.js | 33 +++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 nashorn/test/script/basic/JDK-8019478.js
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java
index 6b75e70cf16..667205528ed 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java
@@ -61,6 +61,11 @@ public final class NativeRegExpExecResult extends ScriptObject {
this.input = result.getInput();
}
+ @Override
+ public String getClassName() {
+ return "Array";
+ }
+
/**
* Length getter
* @param self self reference
diff --git a/nashorn/test/script/basic/JDK-8019478.js b/nashorn/test/script/basic/JDK-8019478.js
new file mode 100644
index 00000000000..f5e2a645214
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8019478.js
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8019478: Object.prototype.toString.call(/a/.exec("a")) === "[object Array]" should be true
+ *
+ * @test
+ * @run
+ */
+
+if (Object.prototype.toString.call(/a/.exec("a")) !== "[object Array]") {
+ fail("Object.prototype.toString.call(/a/.exec('a')) !== '[object Array]'");
+}
From 135ccaceef2558ab4d4c369adced5ef100057a02 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Mon, 1 Jul 2013 17:21:09 +0530
Subject: [PATCH 055/101] 8019482: Number("0x0.0p0") should evaluate to NaN
Reviewed-by: lagergren
---
.../nashorn/internal/objects/NativeError.java | 5 +--
.../internal/runtime/ECMAException.java | 2 +-
.../jdk/nashorn/internal/runtime/JSType.java | 2 +-
nashorn/test/script/basic/JDK-8019482.js | 41 +++++++++++++++++++
4 files changed, 44 insertions(+), 6 deletions(-)
create mode 100644 nashorn/test/script/basic/JDK-8019482.js
diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
index 25a3f3c74a6..07f5d65aa7b 100644
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java
@@ -30,10 +30,7 @@ import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.List;
import jdk.nashorn.api.scripting.NashornException;
-import jdk.nashorn.internal.codegen.CompilerConstants;
import jdk.nashorn.internal.lookup.MethodHandleFactory;
import jdk.nashorn.internal.objects.annotations.Attribute;
import jdk.nashorn.internal.objects.annotations.Constructor;
@@ -41,7 +38,6 @@ import jdk.nashorn.internal.objects.annotations.Function;
import jdk.nashorn.internal.objects.annotations.Property;
import jdk.nashorn.internal.objects.annotations.ScriptClass;
import jdk.nashorn.internal.objects.annotations.Where;
-import jdk.nashorn.internal.runtime.ECMAErrors;
import jdk.nashorn.internal.runtime.ECMAException;
import jdk.nashorn.internal.runtime.JSType;
import jdk.nashorn.internal.runtime.PropertyMap;
@@ -123,6 +119,7 @@ public final class NativeError extends ScriptObject {
* Nashorn extension: Error.captureStackTrace. Capture stack trace at the point of call into the Error object provided.
*
* @param self self reference
+ * @return undefined
*/
@Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
public static Object captureStackTrace(final Object self, final Object errorObj) {
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java b/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java
index bb4e49a0c1b..a32e721cc46 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java
@@ -51,7 +51,7 @@ public final class ECMAException extends NashornException {
/** Field handle to the{@link ECMAException#thrown} field, so that it can be accessed from generated code */
public static final FieldAccess THROWN = virtualField(ECMAException.class, "thrown", Object.class);
- public static final String EXCEPTION_PROPERTY = "nashornException";
+ private static final String EXCEPTION_PROPERTY = "nashornException";
/** Object thrown. */
public final Object thrown;
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java
index 8f1f1e9e616..9507f0d3205 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java
@@ -911,7 +911,7 @@ public enum JSType {
for (int i = start; i < length ; i++) {
if (digit(chars[i], radix) == -1) {
- break;
+ return Double.NaN;
}
pos++;
}
diff --git a/nashorn/test/script/basic/JDK-8019482.js b/nashorn/test/script/basic/JDK-8019482.js
new file mode 100644
index 00000000000..09f91e42ea9
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8019482.js
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8019482: Number("0x0.0p0") should evaluate to NaN
+ *
+ * @test
+ * @run
+ */
+
+function checkHexLiteral(str) {
+ if (! isNaN(Number(str))) {
+ fail("Number(" + str + ") is not NaN");
+ }
+}
+
+checkHexLiteral("0x0.0");
+checkHexLiteral("0x0.0p");
+checkHexLiteral("0x12tu");
+checkHexLiteral("0x12.2e22");
+checkHexLiteral("0xtu");
From 1c13f5e4cbf6621689c53e2b6258989c5b65e1de Mon Sep 17 00:00:00 2001
From: Maurizio Cimadamore
Date: Mon, 1 Jul 2013 14:57:03 +0100
Subject: [PATCH 056/101] 7034798: Ambiguity error for abstract method call is
too eager
Javac should wait and see if ambiguous methods can be reconciled at the end of an overload resolution round
Reviewed-by: jjg, vromero
---
.../com/sun/tools/javac/comp/Resolve.java | 91 +++++++++------
.../tools/javac/resolve/ResolveHarness.java | 33 +++---
.../javac/resolve/tests/AbstractMerge.java | 107 ++++++++++++++++++
.../javac/resolve/tests/InnerOverOuter.java | 3 +-
4 files changed, 179 insertions(+), 55 deletions(-)
create mode 100644 langtools/test/tools/javac/resolve/tests/AbstractMerge.java
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
index ed6d880b13f..14f9d4bd2b6 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
@@ -1573,7 +1573,6 @@ public class Resolve {
allowBoxing,
useVarargs,
operator);
- reportVerboseResolutionDiagnostic(env.tree.pos(), name, site, argtypes, typeargtypes, bestSoFar);
return bestSoFar;
}
// where
@@ -2224,7 +2223,7 @@ public class Resolve {
return lookupMethod(env, pos, env.enclClass.sym, resolveMethodCheck,
new BasicLookupHelper(name, env.enclClass.sym.type, argtypes, typeargtypes) {
@Override
- Symbol lookup(Env env, MethodResolutionPhase phase) {
+ Symbol doLookup(Env env, MethodResolutionPhase phase) {
return findFun(env, name, argtypes, typeargtypes,
phase.isBoxingRequired(),
phase.isVarargsRequired());
@@ -2256,7 +2255,7 @@ public class Resolve {
List typeargtypes) {
return lookupMethod(env, pos, location, resolveContext, new BasicLookupHelper(name, site, argtypes, typeargtypes) {
@Override
- Symbol lookup(Env env, MethodResolutionPhase phase) {
+ Symbol doLookup(Env env, MethodResolutionPhase phase) {
return findMethod(env, site, name, argtypes, typeargtypes,
phase.isBoxingRequired(),
phase.isVarargsRequired(), false);
@@ -2355,7 +2354,7 @@ public class Resolve {
List typeargtypes) {
return lookupMethod(env, pos, site.tsym, resolveContext, new BasicLookupHelper(names.init, site, argtypes, typeargtypes) {
@Override
- Symbol lookup(Env env, MethodResolutionPhase phase) {
+ Symbol doLookup(Env env, MethodResolutionPhase phase) {
return findConstructor(pos, env, site, argtypes, typeargtypes,
phase.isBoxingRequired(),
phase.isVarargsRequired());
@@ -2413,7 +2412,7 @@ public class Resolve {
return lookupMethod(env, pos, site.tsym, resolveMethodCheck,
new BasicLookupHelper(names.init, site, argtypes, typeargtypes) {
@Override
- Symbol lookup(Env env, MethodResolutionPhase phase) {
+ Symbol doLookup(Env env, MethodResolutionPhase phase) {
return findDiamond(env, site, argtypes, typeargtypes,
phase.isBoxingRequired(),
phase.isVarargsRequired());
@@ -2503,7 +2502,7 @@ public class Resolve {
return lookupMethod(env, pos, syms.predefClass, currentResolutionContext,
new BasicLookupHelper(name, syms.predefClass.type, argtypes, null, BOX) {
@Override
- Symbol lookup(Env env, MethodResolutionPhase phase) {
+ Symbol doLookup(Env env, MethodResolutionPhase phase) {
return findMethod(env, site, name, argtypes, typeargtypes,
phase.isBoxingRequired(),
phase.isVarargsRequired(), true);
@@ -2668,6 +2667,13 @@ public class Resolve {
*/
abstract Symbol lookup(Env env, MethodResolutionPhase phase);
+ /**
+ * Dump overload resolution info
+ */
+ void debug(DiagnosticPosition pos, Symbol sym) {
+ //do nothing
+ }
+
/**
* Validate the result of the lookup
*/
@@ -2685,17 +2691,30 @@ public class Resolve {
}
@Override
- Symbol access(Env env, DiagnosticPosition pos, Symbol location, Symbol sym) {
+ final Symbol lookup(Env env, MethodResolutionPhase phase) {
+ Symbol sym = doLookup(env, phase);
if (sym.kind == AMBIGUOUS) {
AmbiguityError a_err = (AmbiguityError)sym;
sym = a_err.mergeAbstracts(site);
}
+ return sym;
+ }
+
+ abstract Symbol doLookup(Env env, MethodResolutionPhase phase);
+
+ @Override
+ Symbol access(Env env, DiagnosticPosition pos, Symbol location, Symbol sym) {
if (sym.kind >= AMBIGUOUS) {
//if nothing is found return the 'first' error
sym = accessMethod(sym, pos, location, site, name, true, argtypes, typeargtypes);
}
return sym;
}
+
+ @Override
+ void debug(DiagnosticPosition pos, Symbol sym) {
+ reportVerboseResolutionDiagnostic(pos, name, site, argtypes, typeargtypes, sym);
+ }
}
/**
@@ -2924,7 +2943,9 @@ public class Resolve {
MethodResolutionPhase prevPhase = currentResolutionContext.step;
Symbol prevBest = bestSoFar;
currentResolutionContext.step = phase;
- bestSoFar = phase.mergeResults(bestSoFar, lookupHelper.lookup(env, phase));
+ Symbol sym = lookupHelper.lookup(env, phase);
+ lookupHelper.debug(pos, sym);
+ bestSoFar = phase.mergeResults(bestSoFar, sym);
env.info.pendingResolutionPhase = (prevBest == bestSoFar) ? prevPhase : phase;
}
return lookupHelper.access(env, pos, location, bestSoFar);
@@ -3630,35 +3651,39 @@ public class Resolve {
* is more specific than the others, attempt to merge their signatures.
*/
Symbol mergeAbstracts(Type site) {
- Symbol fst = ambiguousSyms.last();
- Symbol res = fst;
- for (Symbol s : ambiguousSyms.reverse()) {
- Type mt1 = types.memberType(site, res);
- Type mt2 = types.memberType(site, s);
- if ((s.flags() & ABSTRACT) == 0 ||
- !types.overrideEquivalent(mt1, mt2) ||
- !types.isSameTypes(fst.erasure(types).getParameterTypes(),
- s.erasure(types).getParameterTypes())) {
- //ambiguity cannot be resolved
- return this;
- } else {
- Type mst = mostSpecificReturnType(mt1, mt2);
- if (mst == null) {
- // Theoretically, this can't happen, but it is possible
- // due to error recovery or mixing incompatible class files
+ List ambiguousInOrder = ambiguousSyms.reverse();
+ for (Symbol s : ambiguousInOrder) {
+ Type mt = types.memberType(site, s);
+ boolean found = true;
+ List allThrown = mt.getThrownTypes();
+ for (Symbol s2 : ambiguousInOrder) {
+ Type mt2 = types.memberType(site, s2);
+ if ((s2.flags() & ABSTRACT) == 0 ||
+ !types.overrideEquivalent(mt, mt2) ||
+ !types.isSameTypes(s.erasure(types).getParameterTypes(),
+ s2.erasure(types).getParameterTypes())) {
+ //ambiguity cannot be resolved
return this;
}
- Symbol mostSpecific = mst == mt1 ? res : s;
- List allThrown = chk.intersect(mt1.getThrownTypes(), mt2.getThrownTypes());
- Type newSig = types.createMethodTypeWithThrown(mostSpecific.type, allThrown);
- res = new MethodSymbol(
- mostSpecific.flags(),
- mostSpecific.name,
- newSig,
- mostSpecific.owner);
+ Type mst = mostSpecificReturnType(mt, mt2);
+ if (mst == null || mst != mt) {
+ found = false;
+ break;
+ }
+ allThrown = chk.intersect(allThrown, mt2.getThrownTypes());
+ }
+ if (found) {
+ //all ambiguous methods were abstract and one method had
+ //most specific return type then others
+ return (allThrown == mt.getThrownTypes()) ?
+ s : new MethodSymbol(
+ s.flags(),
+ s.name,
+ types.createMethodTypeWithThrown(mt, allThrown),
+ s.owner);
}
}
- return res;
+ return this;
}
@Override
diff --git a/langtools/test/tools/javac/resolve/ResolveHarness.java b/langtools/test/tools/javac/resolve/ResolveHarness.java
index 8db063cdf09..5f761c3b351 100644
--- a/langtools/test/tools/javac/resolve/ResolveHarness.java
+++ b/langtools/test/tools/javac/resolve/ResolveHarness.java
@@ -32,6 +32,8 @@
import com.sun.source.util.JavacTask;
import com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Type.MethodType;
import com.sun.tools.javac.util.JCDiagnostic;
@@ -154,7 +156,7 @@ public class ResolveHarness implements javax.tools.DiagnosticListener entry : candidatesMap.entrySet()) {
if (!seenCandidates.contains(entry.getKey())) {
- error("Redundant @Candidate annotation on method " + entry.getKey().elem);
+ error("Redundant @Candidate annotation on method " + entry.getKey().elem + " sig = " + entry.getKey().elem.asType());
}
}
}
@@ -250,7 +252,7 @@ public class ResolveHarness implements javax.tools.DiagnosticListener diagnostic) {
Element siteSym = getSiteSym(diagnostic);
if (siteSym.getSimpleName().length() != 0 &&
- siteSym.getAnnotation(TraceResolve.class) == null) {
+ ((Symbol)siteSym).outermostClass().getAnnotation(TraceResolve.class) == null) {
return;
}
int candidateIdx = 0;
@@ -308,7 +310,11 @@ public class ResolveHarness implements javax.tools.DiagnosticListener diagnostic) {
- Element methodSym = methodSym(diagnostic);
+ Symbol methodSym = (Symbol)methodSym(diagnostic);
+ if ((methodSym.flags() & Flags.GENERATEDCONSTR) != 0) {
+ //skip resolution of default constructor (put there by javac)
+ return;
+ }
Candidate c = getCandidateAtPos(methodSym,
asJCDiagnostic(diagnostic).getLineNumber(),
asJCDiagnostic(diagnostic).getColumnNumber());
@@ -470,23 +476,10 @@ public class ResolveHarness implements javax.tools.DiagnosticListener.");
- String replacedName = predefTranslationMap.get(e.getSimpleName().toString());
- buf.append(e.toString().replace(e.getSimpleName().toString(), replacedName));
- } else if (e.getSimpleName().toString().startsWith("_")) {
- buf.append(".");
- buf.append(e.toString());
- } else {
- while (e != null) {
- buf.append(e.toString());
- e = e.getEnclosingElement();
- }
- buf.append(jfo.getName());
- }
- return buf.toString();
+ String simpleName = e.getSimpleName().toString();
+ String opName = predefTranslationMap.get(simpleName);
+ String name = opName != null ? opName : simpleName;
+ return name + e.asType();
}
@Override
diff --git a/langtools/test/tools/javac/resolve/tests/AbstractMerge.java b/langtools/test/tools/javac/resolve/tests/AbstractMerge.java
new file mode 100644
index 00000000000..e6feb08949b
--- /dev/null
+++ b/langtools/test/tools/javac/resolve/tests/AbstractMerge.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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.
+ */
+@TraceResolve
+class AbstractMerge {
+
+ interface A {
+ @Candidate(applicable=Phase.BASIC)
+ java.io.Serializable m1();
+ @Candidate(applicable=Phase.BASIC)
+ java.io.Serializable m2();
+ @Candidate(applicable=Phase.BASIC)
+ java.io.Serializable m3();
+ @Candidate(applicable=Phase.BASIC)
+ java.io.Serializable m4();
+ @Candidate(applicable=Phase.BASIC)
+ java.io.Serializable m5();
+ @Candidate(applicable=Phase.BASIC)
+ java.io.Serializable m6();
+ }
+
+ interface B {
+ @Candidate(applicable=Phase.BASIC)
+ Cloneable m1();
+ @Candidate(applicable=Phase.BASIC)
+ Cloneable m2();
+ @Candidate(applicable=Phase.BASIC)
+ Cloneable m3();
+ @Candidate(applicable=Phase.BASIC)
+ Cloneable m4();
+ @Candidate(applicable=Phase.BASIC)
+ Cloneable m5();
+ @Candidate(applicable=Phase.BASIC)
+ Cloneable m6();
+ }
+
+ interface C {
+ @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+ Object[] m1();
+ @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+ Object[] m2();
+ @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+ Object[] m3();
+ @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+ Object[] m4();
+ @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+ Object[] m5();
+ @Candidate(applicable=Phase.BASIC, mostSpecific=true)
+ Object[] m6();
+ }
+
+ interface ABC extends A, B, C { }
+ interface ACB extends A, C, B { }
+ interface BAC extends B, A, C { }
+ interface BCA extends B, C, A { }
+ interface CAB extends C, A, B { }
+ interface CBA extends C, B, A { }
+
+ {
+ ABC abc = null;
+ abc.m1();
+ }
+
+ {
+ ACB acb = null;
+ acb.m2();
+ }
+
+ {
+ BAC bac = null;
+ bac.m3();
+ }
+
+ {
+ BCA bca = null;
+ bca.m4();
+ }
+
+ {
+ CAB cab = null;
+ cab.m5();
+ }
+
+ {
+ CBA cba = null;
+ cba.m6();
+ }
+}
diff --git a/langtools/test/tools/javac/resolve/tests/InnerOverOuter.java b/langtools/test/tools/javac/resolve/tests/InnerOverOuter.java
index 2574c61ab55..9bf72a3fa53 100644
--- a/langtools/test/tools/javac/resolve/tests/InnerOverOuter.java
+++ b/langtools/test/tools/javac/resolve/tests/InnerOverOuter.java
@@ -21,7 +21,7 @@
* questions.
*/
-@TraceResolve
+@TraceResolve(keys={"compiler.err.cant.apply.symbol"})
class Test {
//no annotation here - this should NOT even be considered!
@@ -30,7 +30,6 @@ class Test {
//no annotation here - this should NOT even be considered!
void m(Object... o) { }
- @TraceResolve(keys={"compiler.err.cant.apply.symbol"})
class Inner {
@Candidate
void m(String s) {
From c6b05141128414a3909efaf26c6d7af51cd36840 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan
Date: Mon, 1 Jul 2013 19:52:07 +0530
Subject: [PATCH 057/101] 8019488: switch on literals result in
NoSuchMethodError or VerifyError
Reviewed-by: hannesw
---
.../internal/codegen/CodeGenerator.java | 3 +-
.../internal/runtime/ScriptRuntime.java | 11 +++
nashorn/test/script/basic/JDK-8019488.js | 68 +++++++++++++++++++
3 files changed, 81 insertions(+), 1 deletion(-)
create mode 100644 nashorn/test/script/basic/JDK-8019488.js
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
index c4b0af9938b..6205888f1ff 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -1845,7 +1845,8 @@ final class CodeGenerator extends NodeOperatorVisitor
Date: Mon, 1 Jul 2013 23:36:40 +0530
Subject: [PATCH 058/101] 8019508: Comma handling in object literal parsing is
wrong
Reviewed-by: hannesw
---
.../jdk/nashorn/internal/parser/Parser.java | 5 +-
.../runtime/resources/Messages.properties | 1 +
nashorn/test/script/basic/JDK-8019508.js | 56 +++++++++++++++++++
.../test/script/basic/JDK-8019508.js.EXPECTED | 12 ++++
4 files changed, 73 insertions(+), 1 deletion(-)
create mode 100644 nashorn/test/script/basic/JDK-8019508.js
create mode 100644 nashorn/test/script/basic/JDK-8019508.js.EXPECTED
diff --git a/nashorn/src/jdk/nashorn/internal/parser/Parser.java b/nashorn/src/jdk/nashorn/internal/parser/Parser.java
index 3c609cc9be3..bc3b7598896 100644
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java
@@ -1930,7 +1930,7 @@ loop:
// Object context.
// Prepare to accumulate elements.
- // final List elements = new ArrayList<>();
+ // final List elements = new ArrayList<>();
final Map map = new LinkedHashMap<>();
// Create a block for the object literal.
@@ -1943,6 +1943,9 @@ loop:
break loop;
case COMMARIGHT:
+ if (commaSeen) {
+ throw error(AbstractParser.message("expected.property.id", type.getNameOrType()));
+ }
next();
commaSeen = true;
break;
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
index f058fa3354f..a9c6c589093 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
@@ -42,6 +42,7 @@ parser.error.expected.literal=Expected a literal but found {0}
parser.error.expected.operand=Expected an operand but found {0}
parser.error.expected.stmt=Expected statement but found {0}
parser.error.expected.comma=Expected comma but found {0}
+parser.error.expected.property.id=Expected property id but found {0}
parser.error.expected=Expected {0} but found {1}
parser.error.invalid.return=Invalid return statement
parser.error.no.func.decl.here=Function declarations can only occur at program or function body level. You should use a function expression here instead.
diff --git a/nashorn/test/script/basic/JDK-8019508.js b/nashorn/test/script/basic/JDK-8019508.js
new file mode 100644
index 00000000000..d23035c638a
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8019508.js
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8019508: Comma handling in object literal parsing is wrong
+ *
+ * @test
+ * @run
+ */
+
+function checkObjLiteral(str) {
+ try {
+ eval(str);
+ fail("SyntaxError expected for: " + str);
+ } catch (e) {
+ if (! (e instanceof SyntaxError)) {
+ fail("expected SyntaxError, got " + e);
+ }
+ print(e.message.replace(/\\/g, '/'));
+ }
+}
+
+// only comma
+checkObjLiteral("({,})");
+
+// starting with comma
+checkObjLiteral("({, a:2 })");
+
+// consecutive commas
+checkObjLiteral("({a:3,,})");
+
+// missing comma
+checkObjLiteral("({a:3 b:2}");
+
+// single trailing comma is okay!
+var obj = { a: 3, };
diff --git a/nashorn/test/script/basic/JDK-8019508.js.EXPECTED b/nashorn/test/script/basic/JDK-8019508.js.EXPECTED
new file mode 100644
index 00000000000..d5f81409803
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8019508.js.EXPECTED
@@ -0,0 +1,12 @@
+test/script/basic/JDK-8019508.js#33:1:2 Expected property id but found ,
+({,})
+ ^
+test/script/basic/JDK-8019508.js#33:1:2 Expected property id but found ,
+({, a:2 })
+ ^
+test/script/basic/JDK-8019508.js#33:1:6 Expected property id but found ,
+({a:3,,})
+ ^
+test/script/basic/JDK-8019508.js#33:1:6 Expected comma but found ident
+({a:3 b:2}
+ ^
From 547a050fe1913f29dd17f7680a0b8abe189486de Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Mon, 1 Jul 2013 11:58:45 -0700
Subject: [PATCH 059/101] 7162089: Add support for repeating annotations to
javax.annotation.processing
Reviewed-by: abuckley, jjg, jfranck
---
.../JavacProcessingEnvironment.java | 25 ++++++--
.../processing/JavacRoundEnvironment.java | 15 ++++-
.../processing/AbstractProcessor.java | 2 +-
.../annotation/processing/Processor.java | 61 ++++++++++++++-----
.../round/TestElementsAnnotatedWith.java | 2 +
.../processing/environment/round/TpAnno.java | 29 +++++++++
.../round/TypeParameterAnnotations.java | 37 +++++++++++
7 files changed, 149 insertions(+), 22 deletions(-)
create mode 100644 langtools/test/tools/javac/processing/environment/round/TpAnno.java
create mode 100644 langtools/test/tools/javac/processing/environment/round/TypeParameterAnnotations.java
diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
index 83b1ee23bb9..4e966f9b716 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
@@ -36,10 +36,7 @@ import java.util.regex.*;
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
-import javax.lang.model.element.AnnotationMirror;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.PackageElement;
-import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.*;
import javax.lang.model.util.*;
import javax.tools.DiagnosticListener;
import javax.tools.JavaFileManager;
@@ -762,12 +759,30 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
}
@Override
- public Set scan(Element e, Set p) {
+ public Set visitType(TypeElement e, Set p) {
+ // Type parameters are not considered to be enclosed by a type
+ scan(e.getTypeParameters(), p);
+ return scan(e.getEnclosedElements(), p);
+ }
+
+ @Override
+ public Set visitExecutable(ExecutableElement e, Set p) {
+ // Type parameters are not considered to be enclosed by an executable
+ scan(e.getTypeParameters(), p);
+ return scan(e.getEnclosedElements(), p);
+ }
+
+ void addAnnotations(Element e, Set p) {
for (AnnotationMirror annotationMirror :
elements.getAllAnnotationMirrors(e) ) {
Element e2 = annotationMirror.getAnnotationType().asElement();
p.add((TypeElement) e2);
}
+ }
+
+ @Override
+ public Set scan(Element e, Set p) {
+ addAnnotations(e, p);
return super.scan(e, p);
}
}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java
index 157f7eb0125..42d9d44cfa2 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java
@@ -146,6 +146,20 @@ public class JavacRoundEnvironment implements RoundEnvironment {
this.typeUtil = typeUtil;
}
+ @Override
+ public Set visitType(TypeElement e, DeclaredType p) {
+ // Type parameters are not considered to be enclosed by a type
+ scan(e.getTypeParameters(), p);
+ return scan(e.getEnclosedElements(), p);
+ }
+
+ @Override
+ public Set visitExecutable(ExecutableElement e, DeclaredType p) {
+ // Type parameters are not considered to be enclosed by an executable
+ scan(e.getTypeParameters(), p);
+ return scan(e.getEnclosedElements(), p);
+ }
+
@Override
public Set scan(Element e, DeclaredType p) {
java.util.List extends AnnotationMirror> annotationMirrors =
@@ -157,7 +171,6 @@ public class JavacRoundEnvironment implements RoundEnvironment {
e.accept(this, p);
return annotatedElements;
}
-
}
/**
diff --git a/langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java b/langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java
index eea03b8c526..0ec4b71b341 100644
--- a/langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java
+++ b/langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java
@@ -38,7 +38,7 @@ import javax.tools.Diagnostic;
* superclass for most concrete annotation processors. This class
* examines annotation values to compute the {@linkplain
* #getSupportedOptions options}, {@linkplain
- * #getSupportedAnnotationTypes annotations}, and {@linkplain
+ * #getSupportedAnnotationTypes annotation types}, and {@linkplain
* #getSupportedSourceVersion source version} supported by its
* subtypes.
*
diff --git a/langtools/src/share/classes/javax/annotation/processing/Processor.java b/langtools/src/share/classes/javax/annotation/processing/Processor.java
index a466bdd711f..c898e74255f 100644
--- a/langtools/src/share/classes/javax/annotation/processing/Processor.java
+++ b/langtools/src/share/classes/javax/annotation/processing/Processor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -26,6 +26,8 @@
package javax.annotation.processing;
import java.util.Set;
+import javax.lang.model.util.Elements;
+import javax.lang.model.AnnotatedConstruct;
import javax.lang.model.element.*;
import javax.lang.model.SourceVersion;
@@ -88,23 +90,52 @@ import javax.lang.model.SourceVersion;
* configuration mechanisms, such as command line options; for
* details, refer to the particular tool's documentation. Which
* processors the tool asks to {@linkplain #process run} is a function
- * of what annotations are present on the {@linkplain
+ * of the types of the annotations {@linkplain AnnotatedConstruct present}
+ * on the {@linkplain
* RoundEnvironment#getRootElements root elements}, what {@linkplain
* #getSupportedAnnotationTypes annotation types a processor
- * processes}, and whether or not a processor {@linkplain #process
- * claims the annotations it processes}. A processor will be asked to
+ * supports}, and whether or not a processor {@linkplain #process
+ * claims the annotation types it processes}. A processor will be asked to
* process a subset of the annotation types it supports, possibly an
* empty set.
*
- * For a given round, the tool computes the set of annotation types on
- * the root elements. If there is at least one annotation type
- * present, as processors claim annotation types, they are removed
- * from the set of unmatched annotations. When the set is empty or no
- * more processors are available, the round has run to completion. If
+ * For a given round, the tool computes the set of annotation types
+ * that are present on the elements enclosed within the root elements.
+ * If there is at least one annotation type present, then as
+ * processors claim annotation types, they are removed from the set of
+ * unmatched annotation types. When the set is empty or no more
+ * processors are available, the round has run to completion. If
* there are no annotation types present, annotation processing still
* occurs but only universal processors which support
- * processing {@code "*"} can claim the (empty) set of annotation
- * types.
+ * processing all annotation types, {@code "*"}, can claim the (empty)
+ * set of annotation types.
+ *
+ *
An annotation type is considered present if there is at least
+ * one annotation of that type present on an element enclosed within
+ * the root elements of a round. For this purpose, a type parameter is
+ * considered to be enclosed by its {@linkplain
+ * TypeParameterElement#getGenericElement generic
+ * element}. Annotations on {@linkplain
+ * java.lang.annotation.ElementType#TYPE_USE type uses}, as opposed to
+ * annotations on elements, are ignored when computing whether or not
+ * an annotation type is present.
+ *
+ *
An annotation is present if it meets the definition of being
+ * present given in {@link AnnotatedConstruct}. In brief, an
+ * annotation is considered present for the purposes of discovery if
+ * it is directly present or present via inheritance. An annotation is
+ * not considered present by virtue of being wrapped by a
+ * container annotation. Operationally, this is equivalent to an
+ * annotation being present on an element if and only if it would be
+ * included in the results of {@link
+ * Elements#getAllAnnotationMirrors(Element)} called on that element. Since
+ * annotations inside container annotations are not considered
+ * present, to properly process {@linkplain
+ * java.lang.annotation.Repeatable repeatable annotation types},
+ * processors are advised to include both the repeatable annotation
+ * type and its containing annotation type in the set of {@linkplain
+ * #getSupportedAnnotationTypes() supported annotation types} of a
+ * processor.
*
*
Note that if a processor supports {@code "*"} and returns {@code
* true}, all annotations are claimed. Therefore, a universal
@@ -257,10 +288,10 @@ public interface Processor {
/**
* Processes a set of annotation types on type elements
* originating from the prior round and returns whether or not
- * these annotations are claimed by this processor. If {@code
- * true} is returned, the annotations are claimed and subsequent
+ * these annotation types are claimed by this processor. If {@code
+ * true} is returned, the annotation types are claimed and subsequent
* processors will not be asked to process them; if {@code false}
- * is returned, the annotations are unclaimed and subsequent
+ * is returned, the annotation types are unclaimed and subsequent
* processors may be asked to process them. A processor may
* always return the same boolean value or may vary the result
* based on chosen criteria.
@@ -271,7 +302,7 @@ public interface Processor {
*
* @param annotations the annotation types requested to be processed
* @param roundEnv environment for information about the current and prior round
- * @return whether or not the set of annotations are claimed by this processor
+ * @return whether or not the set of annotation types are claimed by this processor
*/
boolean process(Set extends TypeElement> annotations,
RoundEnvironment roundEnv);
diff --git a/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java b/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java
index 71367233484..6ba6ff689e6 100644
--- a/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java
+++ b/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java
@@ -30,11 +30,13 @@
* @build JavacTestingAbstractProcessor
* @compile TestElementsAnnotatedWith.java
* @compile InheritedAnnotation.java
+ * @compile TpAnno.java
* @compile -processor TestElementsAnnotatedWith -proc:only SurfaceAnnotations.java
* @compile -processor TestElementsAnnotatedWith -proc:only BuriedAnnotations.java
* @compile -processor TestElementsAnnotatedWith -proc:only Part1.java Part2.java
* @compile -processor TestElementsAnnotatedWith -proc:only C2.java
* @compile -processor TestElementsAnnotatedWith -proc:only Foo.java
+ * @compile -processor TestElementsAnnotatedWith -proc:only TypeParameterAnnotations.java
* @compile Foo.java
* @compile/process -processor TestElementsAnnotatedWith -proc:only Foo
*/
diff --git a/langtools/test/tools/javac/processing/environment/round/TpAnno.java b/langtools/test/tools/javac/processing/environment/round/TpAnno.java
new file mode 100644
index 00000000000..c8cf52c30c9
--- /dev/null
+++ b/langtools/test/tools/javac/processing/environment/round/TpAnno.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+@Retention(RUNTIME)
+@Target(ElementType.TYPE_PARAMETER)
+public @interface TpAnno {}
diff --git a/langtools/test/tools/javac/processing/environment/round/TypeParameterAnnotations.java b/langtools/test/tools/javac/processing/environment/round/TypeParameterAnnotations.java
new file mode 100644
index 00000000000..0b3ef05ceef
--- /dev/null
+++ b/langtools/test/tools/javac/processing/environment/round/TypeParameterAnnotations.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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.
+ */
+
+/**
+ * Class to hold annotations for ElementsAnnotatedWithTest.
+ */
+
+@AnnotatedElementInfo(annotationName="TpAnno",
+ expectedSize=4,
+ names={"T", "A", "B", "C"})
+public class TypeParameterAnnotations<@TpAnno T> {
+ private <@TpAnno A> TypeParameterAnnotations(A a) {;}
+
+ public <@TpAnno B> void foo(B b) {return;}
+
+ public static <@TpAnno C> void bar(C b) {return;}
+}
From 68c516f654b888ccdec31b126b4c13caab7ff387 Mon Sep 17 00:00:00 2001
From: Filipp Zhinkin
Date: Mon, 1 Jul 2013 12:22:34 -0700
Subject: [PATCH 060/101] 8006629: NEED_TEST: need test for JDK-8001071
Added regression test
Reviewed-by: kvn, coleenp
---
hotspot/test/runtime/8001071/Test8001071.java | 45 +++++++++++++
hotspot/test/runtime/8001071/Test8001071.sh | 63 +++++++++++++++++++
2 files changed, 108 insertions(+)
create mode 100644 hotspot/test/runtime/8001071/Test8001071.java
create mode 100644 hotspot/test/runtime/8001071/Test8001071.sh
diff --git a/hotspot/test/runtime/8001071/Test8001071.java b/hotspot/test/runtime/8001071/Test8001071.java
new file mode 100644
index 00000000000..df03e197de8
--- /dev/null
+++ b/hotspot/test/runtime/8001071/Test8001071.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 sun.misc.Unsafe;
+import java.lang.reflect.Field;
+
+@SuppressWarnings("sunapi")
+public class Test8001071 {
+ public static Unsafe unsafe;
+
+ static {
+ try {
+ Field f = Unsafe.class.getDeclaredField("theUnsafe");
+ f.setAccessible(true);
+ unsafe = (Unsafe) f.get(null);
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String args[]) {
+ unsafe.getObject(new Test8001071(), Short.MAX_VALUE);
+ }
+
+}
diff --git a/hotspot/test/runtime/8001071/Test8001071.sh b/hotspot/test/runtime/8001071/Test8001071.sh
new file mode 100644
index 00000000000..79ba2fe503d
--- /dev/null
+++ b/hotspot/test/runtime/8001071/Test8001071.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# Copyright (c) 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.
+
+# 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 8001071
+## @summary Add simple range check into VM implemenation of Unsafe access methods
+## @compile Test8001071.java
+## @run shell Test8001071.sh
+## @author filipp.zhinkin@oracle.com
+
+VERSION=`${TESTJAVA}/bin/java ${TESTVMOPTS} -version 2>&1`
+
+if [ -n "`echo $VERSION | grep debug`" -o -n "`echo $VERSION | grep jvmg`" ]; then
+ echo "Build type check passed"
+ echo "Continue testing"
+else
+ echo "Fastdebug build is required for this test"
+ exit 0
+fi
+
+${TESTJAVA}/bin/java -cp ${TESTCLASSES} ${TESTVMOPTS} Test8001071 2>&1
+
+HS_ERR_FILE=hs_err_pid*.log
+
+if [ ! -f $HS_ERR_FILE ]
+then
+ echo "hs_err_pid log file was not found"
+ echo "Test failed"
+ exit 1
+fi
+
+grep "assert(byte_offset < p_size) failed: Unsafe access: offset.*> object's size.*" $HS_ERR_FILE
+
+if [ "0" = "$?" ];
+then
+ echo "Range check assertion failed as expected"
+ echo "Test passed"
+ exit 0
+else
+ echo "Range check assertion was not failed"
+ echo "Test failed"
+ exit 1
+fi
From 425681caeccd3664771ff346e44725769f199690 Mon Sep 17 00:00:00 2001
From: Tomas Hurka
Date: Mon, 1 Jul 2013 14:13:12 -0700
Subject: [PATCH 061/101] 8009204: [dtrace] signatures returned by Java 7
jstack() are corrupted on Solaris
The fix is basically a backport of JDK-7019165 (pstack issue) to jhelper.d.
Reviewed-by: coleenp, sspitsyn
---
hotspot/src/os/solaris/dtrace/jhelper.d | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hotspot/src/os/solaris/dtrace/jhelper.d b/hotspot/src/os/solaris/dtrace/jhelper.d
index 976a832107f..752f5ae535e 100644
--- a/hotspot/src/os/solaris/dtrace/jhelper.d
+++ b/hotspot/src/os/solaris/dtrace/jhelper.d
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -332,12 +332,15 @@ dtrace:helper:ustack:
this->nameSymbol = copyin_ptr(this->constantPool +
this->nameIndex * sizeof (pointer) + SIZE_ConstantPool);
+ /* The symbol is a CPSlot and has lower bit set to indicate metadata */
+ this->nameSymbol &= (~1); /* remove metadata lsb */
this->nameSymbolLength = copyin_uint16(this->nameSymbol +
OFFSET_Symbol_length);
this->signatureSymbol = copyin_ptr(this->constantPool +
this->signatureIndex * sizeof (pointer) + SIZE_ConstantPool);
+ this->signatureSymbol &= (~1); /* remove metadata lsb */
this->signatureSymbolLength = copyin_uint16(this->signatureSymbol +
OFFSET_Symbol_length);
From 7936ee54bfa34a853cadd66f7efe3fccda923287 Mon Sep 17 00:00:00 2001
From: Volker Simonis
Date: Mon, 1 Jul 2013 14:14:16 -0700
Subject: [PATCH 062/101] 8019382: PPC64: Fix bytecodeInterpreter to compile
with '-Wunused-value'
Cast the offending expressions to (void)
Reviewed-by: kvn, coleenp
---
.../src/share/vm/interpreter/bytecodeInterpreter.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
index b51ba870568..538b836f08a 100644
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
@@ -1581,7 +1581,7 @@ run:
#define ARRAY_LOADTO32(T, T2, format, stackRes, extra) \
{ \
ARRAY_INTRO(-2); \
- extra; \
+ (void)extra; \
SET_ ## stackRes(*(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)), \
-2); \
UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); \
@@ -1592,8 +1592,8 @@ run:
{ \
ARRAY_INTRO(-2); \
SET_ ## stackRes(*(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)), -1); \
- extra; \
- UPDATE_PC_AND_CONTINUE(1); \
+ (void)extra; \
+ UPDATE_PC_AND_CONTINUE(1); \
}
CASE(_iaload):
@@ -1617,7 +1617,7 @@ run:
#define ARRAY_STOREFROM32(T, T2, format, stackSrc, extra) \
{ \
ARRAY_INTRO(-3); \
- extra; \
+ (void)extra; \
*(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)) = stackSrc( -1); \
UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3); \
}
@@ -1626,7 +1626,7 @@ run:
#define ARRAY_STOREFROM64(T, T2, stackSrc, extra) \
{ \
ARRAY_INTRO(-4); \
- extra; \
+ (void)extra; \
*(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)) = stackSrc( -1); \
UPDATE_PC_AND_TOS_AND_CONTINUE(1, -4); \
}
From ba85477f84dec059039fa46f83f73a088c0439c9 Mon Sep 17 00:00:00 2001
From: Dmytro Sheyko
Date: Tue, 2 Jul 2013 10:21:41 +0100
Subject: [PATCH 063/101] 8019397: javap does not show SourceDebugExtension
properly
Reviewed-by: jjg
---
.../classfile/SourceDebugExtension_attribute.java | 12 +++++-------
.../classes/com/sun/tools/javap/AttributeWriter.java | 7 ++++++-
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/langtools/src/share/classes/com/sun/tools/classfile/SourceDebugExtension_attribute.java b/langtools/src/share/classes/com/sun/tools/classfile/SourceDebugExtension_attribute.java
index ba1f2aa870f..6744500f1c2 100644
--- a/langtools/src/share/classes/com/sun/tools/classfile/SourceDebugExtension_attribute.java
+++ b/langtools/src/share/classes/com/sun/tools/classfile/SourceDebugExtension_attribute.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -28,6 +28,7 @@ package com.sun.tools.classfile;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
+import java.nio.charset.Charset;
/**
* See JVMS, section 4.8.15.
@@ -38,6 +39,8 @@ import java.io.IOException;
* deletion without notice.
*/
public class SourceDebugExtension_attribute extends Attribute {
+ private static final Charset UTF8 = Charset.forName("UTF-8");
+
SourceDebugExtension_attribute(ClassReader cr, int name_index, int length) throws IOException {
super(name_index, length);
debug_extension = new byte[attribute_length];
@@ -55,12 +58,7 @@ public class SourceDebugExtension_attribute extends Attribute {
}
public String getValue() {
- DataInputStream d = new DataInputStream(new ByteArrayInputStream(debug_extension));
- try {
- return d.readUTF();
- } catch (IOException e) {
- return null;
- }
+ return new String(debug_extension, UTF8);
}
public R accept(Visitor visitor, D data) {
diff --git a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
index c77d09628da..02795a57233 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
@@ -513,7 +513,12 @@ public class AttributeWriter extends BasicWriter
}
public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr, Void ignore) {
- println("SourceDebugExtension: " + attr.getValue());
+ println("SourceDebugExtension:");
+ indent(+1);
+ for (String s: attr.getValue().split("[\r\n]+")) {
+ println(s);
+ }
+ indent(-1);
return null;
}
From bab861035d27a6ac7284b0fd6f548fac68a6c7d1 Mon Sep 17 00:00:00 2001
From: Kumar Srinivasan
Date: Mon, 1 Jul 2013 16:36:08 -0700
Subject: [PATCH 064/101] 8019460: tests in changeset do not have @bug tag
Reviewed-by: darcy
---
.../warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.java | 1 +
.../warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.out | 2 +-
.../javac/warnings/AuxiliaryClass/ClassUsingAuxiliary.java | 1 +
.../javac/warnings/AuxiliaryClass/ClassUsingAuxiliary1.out | 2 +-
.../javac/warnings/AuxiliaryClass/ClassUsingAuxiliary2.out | 2 +-
.../tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java | 1 +
6 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.java b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.java
index 07ed640a415..d5c3660fb72 100644
--- a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.java
+++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.java
@@ -23,6 +23,7 @@
/**
* @test
+ * @bug 7153951
* @compile ClassUsingAnotherAuxiliary.java NotAClassName.java
* @compile -Xlint:auxiliaryclass ClassUsingAnotherAuxiliary.java NotAClassName.java
* @compile/fail/ref=ClassUsingAnotherAuxiliary.out -XDrawDiagnostics -Werror -Xlint:auxiliaryclass ClassUsingAnotherAuxiliary.java NotAClassName.java
diff --git a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.out b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.out
index 57123508721..5df6bdb1b0d 100644
--- a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.out
+++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.out
@@ -1,4 +1,4 @@
-ClassUsingAnotherAuxiliary.java:32:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AnAuxiliaryClass, NotAClassName.java
+ClassUsingAnotherAuxiliary.java:33:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AnAuxiliaryClass, NotAClassName.java
- compiler.err.warnings.and.werror
1 error
1 warning
diff --git a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary.java b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary.java
index 9d22ba780e7..605eb8017cb 100644
--- a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary.java
+++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary.java
@@ -23,6 +23,7 @@
/**
* @test
+ * @bug 7153951
* @clean ClassUsingAuxiliary ClassWithAuxiliary AuxiliaryClass ClassWithAuxiliary$NotAnAuxiliaryClass ClassWithAuxiliary$NotAnAuxiliaryClassEither
* @run compile ClassUsingAuxiliary.java ClassWithAuxiliary.java
* @run compile/fail/ref=ClassUsingAuxiliary1.out -XDrawDiagnostics -Werror -Xlint:auxiliaryclass ClassUsingAuxiliary.java ClassWithAuxiliary.java
diff --git a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary1.out b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary1.out
index e0f30900377..d319c0b08e3 100644
--- a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary1.out
+++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary1.out
@@ -1,4 +1,4 @@
-ClassUsingAuxiliary.java:33:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AuxiliaryClass, ClassWithAuxiliary.java
+ClassUsingAuxiliary.java:34:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AuxiliaryClass, ClassWithAuxiliary.java
- compiler.err.warnings.and.werror
1 error
1 warning
diff --git a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary2.out b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary2.out
index e0f30900377..d319c0b08e3 100644
--- a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary2.out
+++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary2.out
@@ -1,4 +1,4 @@
-ClassUsingAuxiliary.java:33:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AuxiliaryClass, ClassWithAuxiliary.java
+ClassUsingAuxiliary.java:34:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AuxiliaryClass, ClassWithAuxiliary.java
- compiler.err.warnings.and.werror
1 error
1 warning
diff --git a/langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java b/langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java
index 933dfa88268..398315dcb4b 100644
--- a/langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java
+++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java
@@ -29,6 +29,7 @@
/*
* @test
+ * @bug 7153951
* @run compile -Werror -Xlint:auxiliaryclass SelfClassWithAux.java ClassWithAuxiliary.java
* @run compile -Werror -Xlint:auxiliaryclass SelfClassWithAux.java
*/
From bf2a400ca2e78e4e9ec6564df9cae11c75ae5800 Mon Sep 17 00:00:00 2001
From: Jiangli Zhou
Date: Mon, 1 Jul 2013 19:44:37 -0400
Subject: [PATCH 065/101] 8006023: Embedded Builds fail management test because
of requirement for UsePerfData being enabled
Added -XX:+UsePerfData to Test7196045.java.
Reviewed-by: dholmes, collins
---
hotspot/test/runtime/7196045/Test7196045.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hotspot/test/runtime/7196045/Test7196045.java b/hotspot/test/runtime/7196045/Test7196045.java
index 59704f72590..4c6fcc8c072 100644
--- a/hotspot/test/runtime/7196045/Test7196045.java
+++ b/hotspot/test/runtime/7196045/Test7196045.java
@@ -26,7 +26,7 @@
* @test
* @bug 7196045
* @summary Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
- * @run main/othervm Test7196045
+ * @run main/othervm -XX:+UsePerfData Test7196045
*/
import java.lang.management.ManagementFactory;
From fc1302ea9569cce3957223185d79c902460f9e3a Mon Sep 17 00:00:00 2001
From: Vladimir Kozlov
Date: Tue, 2 Jul 2013 10:30:49 -0700
Subject: [PATCH 066/101] 8019247: SIGSEGV in compiled method
c8e.e.t_.getArray(Ljava/lang/Class;)[Ljava/lang/Object
Undo recent changes (and add more comments) in Ideal_allocation().
Reviewed-by: roland
---
hotspot/src/share/vm/opto/graphKit.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp
index 590770b7c72..a363b11a5b8 100644
--- a/hotspot/src/share/vm/opto/graphKit.cpp
+++ b/hotspot/src/share/vm/opto/graphKit.cpp
@@ -3332,9 +3332,14 @@ AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) {
if (ptr == NULL) { // reduce dumb test in callers
return NULL;
}
- ptr = ptr->uncast(); // strip a raw-to-oop cast
- if (ptr == NULL) return NULL;
-
+ if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast
+ ptr = ptr->in(1);
+ if (ptr == NULL) return NULL;
+ }
+ // Return NULL for allocations with several casts:
+ // j.l.reflect.Array.newInstance(jobject, jint)
+ // Object.clone()
+ // to keep more precise type from last cast.
if (ptr->is_Proj()) {
Node* allo = ptr->in(0);
if (allo != NULL && allo->is_Allocate()) {
From 386e37ba15ba121ea16eeb0d9e98162d283c9462 Mon Sep 17 00:00:00 2001
From: Albert Noll
Date: Tue, 2 Jul 2013 07:51:31 +0200
Subject: [PATCH 067/101] 8014972: Crash with specific values for
-XX:InitialCodeCacheSize=500K -XX:ReservedCodeCacheSize=500k
Introduce a minimum code cache size that guarantees that the VM can startup.
Reviewed-by: kvn, twisti
---
hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp | 5 ++--
hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp | 3 +-
hotspot/src/cpu/x86/vm/c1_globals_x86.hpp | 5 ++--
hotspot/src/cpu/x86/vm/c2_globals_x86.hpp | 3 +-
.../src/cpu/zero/vm/shark_globals_zero.hpp | 4 ++-
hotspot/src/share/vm/runtime/arguments.cpp | 29 +++++++++++++++++--
hotspot/src/share/vm/runtime/globals.hpp | 3 ++
7 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp
index a43a9cee538..c6cf521272d 100644
--- a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp
+++ b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp
@@ -49,8 +49,9 @@ define_pd_global(intx, FreqInlineSize, 325 );
define_pd_global(bool, ResizeTLAB, true );
define_pd_global(intx, ReservedCodeCacheSize, 32*M );
define_pd_global(intx, CodeCacheExpansionSize, 32*K );
-define_pd_global(uintx,CodeCacheMinBlockLength, 1);
-define_pd_global(uintx,MetaspaceSize, 12*M );
+define_pd_global(uintx, CodeCacheMinBlockLength, 1);
+define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
+define_pd_global(uintx, MetaspaceSize, 12*M );
define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(intx, NewSizeThreadIncrease, 16*K );
define_pd_global(uint64_t,MaxRAM, 1ULL*G);
diff --git a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp
index c642e915fe1..e32094deb06 100644
--- a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp
+++ b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp
@@ -86,7 +86,8 @@ define_pd_global(intx, CodeCacheExpansionSize, 32*K);
// Ergonomics related flags
define_pd_global(uint64_t,MaxRAM, 4ULL*G);
#endif
-define_pd_global(uintx,CodeCacheMinBlockLength, 4);
+define_pd_global(uintx, CodeCacheMinBlockLength, 4);
+define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
// Heap related flags
define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M));
diff --git a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp
index 98e02b16cd0..13f3df82c29 100644
--- a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp
@@ -50,8 +50,9 @@ define_pd_global(intx, InitialCodeCacheSize, 160*K);
define_pd_global(intx, ReservedCodeCacheSize, 32*M );
define_pd_global(bool, ProfileInterpreter, false);
define_pd_global(intx, CodeCacheExpansionSize, 32*K );
-define_pd_global(uintx,CodeCacheMinBlockLength, 1);
-define_pd_global(uintx,MetaspaceSize, 12*M );
+define_pd_global(uintx, CodeCacheMinBlockLength, 1);
+define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
+define_pd_global(uintx, MetaspaceSize, 12*M );
define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(uint64_t,MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true );
diff --git a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp
index f63b8c46d58..ce92123e818 100644
--- a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp
@@ -85,7 +85,8 @@ define_pd_global(bool, OptoScheduling, false);
define_pd_global(bool, OptoBundling, false);
define_pd_global(intx, ReservedCodeCacheSize, 48*M);
-define_pd_global(uintx,CodeCacheMinBlockLength, 4);
+define_pd_global(uintx, CodeCacheMinBlockLength, 4);
+define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
// Heap related flags
define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M));
diff --git a/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp
index 1d17143761a..c04b225b830 100644
--- a/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp
+++ b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp
@@ -58,7 +58,9 @@ define_pd_global(intx, ReservedCodeCacheSize, 32*M );
define_pd_global(bool, ProfileInterpreter, false);
define_pd_global(intx, CodeCacheExpansionSize, 32*K );
define_pd_global(uintx, CodeCacheMinBlockLength, 1 );
-define_pd_global(uintx, MetaspaceSize, 12*M );
+define_pd_global(uintx, CodeCacheMinimumUseSpace, 200*K);
+
+define_pd_global(uintx, MetaspaceSize, 12*M );
define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true );
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index 625feda03f9..b00beff9a22 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -2211,11 +2211,24 @@ bool Arguments::check_vm_args_consistency() {
status = false;
}
- if (ReservedCodeCacheSize < InitialCodeCacheSize) {
+ // Check lower bounds of the code cache
+ // Template Interpreter code is approximately 3X larger in debug builds.
+ uint min_code_cache_size = (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)) + CodeCacheMinimumFreeSpace;
+ if (InitialCodeCacheSize < (uintx)os::vm_page_size()) {
jio_fprintf(defaultStream::error_stream(),
- "Invalid ReservedCodeCacheSize: %dK. Should be greater than InitialCodeCacheSize=%dK\n",
+ "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K,
+ os::vm_page_size()/K);
+ status = false;
+ } else if (ReservedCodeCacheSize < InitialCodeCacheSize) {
+ jio_fprintf(defaultStream::error_stream(),
+ "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
status = false;
+ } else if (ReservedCodeCacheSize < min_code_cache_size) {
+ jio_fprintf(defaultStream::error_stream(),
+ "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
+ min_code_cache_size/K);
+ status = false;
}
return status;
@@ -2616,10 +2629,20 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
// -Xoss
} else if (match_option(option, "-Xoss", &tail)) {
// HotSpot does not have separate native and Java stacks, ignore silently for compatibility
- // -Xmaxjitcodesize
+ } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) {
+ julong long_CodeCacheExpansionSize = 0;
+ ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
+ if (errcode != arg_in_range) {
+ jio_fprintf(defaultStream::error_stream(),
+ "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
+ os::vm_page_size()/K);
+ return JNI_EINVAL;
+ }
+ FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize);
} else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
julong long_ReservedCodeCacheSize = 0;
+
ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index b1adcf7fce1..c94f6bdbb17 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -3160,6 +3160,9 @@ class CommandLineFlags {
product_pd(uintx, InitialCodeCacheSize, \
"Initial code cache size (in bytes)") \
\
+ develop_pd(uintx, CodeCacheMinimumUseSpace, \
+ "Minimum code cache size (in bytes) required to start VM.") \
+ \
product_pd(uintx, ReservedCodeCacheSize, \
"Reserved code cache size (in bytes) - maximum code cache size") \
\
From e8a1440b915ef8825198fef6c3286fd8b94fbef0 Mon Sep 17 00:00:00 2001
From: Eugene Drobitko
Date: Tue, 2 Jul 2013 07:45:16 -0300
Subject: [PATCH 068/101] 8019580: Build Script Change for Nashorn promotion
testing
Reviewed-by: jlaskey
---
nashorn/make/build.xml | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml
index 7c05e789fe9..7e2d999d328 100644
--- a/nashorn/make/build.xml
+++ b/nashorn/make/build.xml
@@ -124,7 +124,7 @@
-
+
@@ -139,7 +139,13 @@
-
+
+
+
+
+
+
+
Builds the javafx shell.
@@ -238,7 +244,7 @@
-
+
@@ -462,24 +468,24 @@
-
+
-
+
-
+
-
+
-
+
From 518a9bf3d069b990f4f91ccf67040f06123c2c2b Mon Sep 17 00:00:00 2001
From: Marcus Lagergren
Date: Tue, 2 Jul 2013 13:50:19 +0200
Subject: [PATCH 069/101] 8016667: Wrong bytecode when testing/setting due to
null check shortcut checking against primitive too
Reviewed-by: jlaskey, sundar
---
.../internal/codegen/CodeGenerator.java | 4 ++-
nashorn/test/script/basic/JDK-8016667.js | 34 +++++++++++++++++++
2 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 nashorn/test/script/basic/JDK-8016667.js
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
index 6205888f1ff..1b25bd1b697 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -1462,7 +1462,9 @@ final class CodeGenerator extends NodeOperatorVisitor
Date: Tue, 2 Jul 2013 18:00:15 +0530
Subject: [PATCH 070/101] 8019553: NPE on illegal l-value for increment and
decrement
Reviewed-by: jlaskey, attila, lagergren
---
.../jdk/nashorn/internal/parser/Parser.java | 29 +++---
.../runtime/resources/Messages.properties | 1 +
nashorn/test/script/basic/JDK-8019553.js | 43 +++++++++
.../test/script/basic/JDK-8019553.js.EXPECTED | 12 +++
nashorn/test/script/basic/NASHORN-51.js | 8 +-
.../test/script/basic/NASHORN-51.js.EXPECTED | 96 ++++++++++++++-----
.../test/script/error/NASHORN-57.js.EXPECTED | 2 +-
7 files changed, 150 insertions(+), 41 deletions(-)
create mode 100644 nashorn/test/script/basic/JDK-8019553.js
create mode 100644 nashorn/test/script/basic/JDK-8019553.js.EXPECTED
diff --git a/nashorn/src/jdk/nashorn/internal/parser/Parser.java b/nashorn/src/jdk/nashorn/internal/parser/Parser.java
index bc3b7598896..181dcf83dd4 100644
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java
@@ -535,15 +535,12 @@ loop:
if (!(lhs instanceof AccessNode ||
lhs instanceof IndexNode ||
lhs instanceof IdentNode)) {
- if (env._early_lvalue_error) {
- throw error(JSErrorType.REFERENCE_ERROR, AbstractParser.message("invalid.lvalue"), lhs.getToken());
- }
- return referenceError(lhs, rhs);
+ return referenceError(lhs, rhs, env._early_lvalue_error);
}
if (lhs instanceof IdentNode) {
if (!checkIdentLValue((IdentNode)lhs)) {
- return referenceError(lhs, rhs);
+ return referenceError(lhs, rhs, false);
}
verifyStrictIdent((IdentNode)lhs, "assignment");
}
@@ -2617,7 +2614,10 @@ loop:
}
}
- private static RuntimeNode referenceError(final Node lhs, final Node rhs) {
+ private RuntimeNode referenceError(final Node lhs, final Node rhs, final boolean earlyError) {
+ if (earlyError) {
+ throw error(JSErrorType.REFERENCE_ERROR, AbstractParser.message("invalid.lvalue"), lhs.getToken());
+ }
final ArrayList args = new ArrayList<>();
args.add(lhs);
if (rhs == null) {
@@ -2695,18 +2695,18 @@ loop:
final Node lhs = leftHandSideExpression();
// ++, -- without operand..
if (lhs == null) {
- // error would have been issued when looking for 'lhs'
- return null;
+ throw error(AbstractParser.message("expected.lvalue", type.getNameOrType()));
}
+
if (!(lhs instanceof AccessNode ||
lhs instanceof IndexNode ||
lhs instanceof IdentNode)) {
- return referenceError(lhs, null);
+ return referenceError(lhs, null, env._early_lvalue_error);
}
if (lhs instanceof IdentNode) {
if (!checkIdentLValue((IdentNode)lhs)) {
- return referenceError(lhs, null);
+ return referenceError(lhs, null, false);
}
verifyStrictIdent((IdentNode)lhs, "operand for " + opType.getName() + " operator");
}
@@ -2725,16 +2725,21 @@ loop:
case DECPREFIX:
final TokenType opType = type;
final Node lhs = expression;
+ // ++, -- without operand..
+ if (lhs == null) {
+ throw error(AbstractParser.message("expected.lvalue", type.getNameOrType()));
+ }
+
if (!(lhs instanceof AccessNode ||
lhs instanceof IndexNode ||
lhs instanceof IdentNode)) {
next();
- return referenceError(lhs, null);
+ return referenceError(lhs, null, env._early_lvalue_error);
}
if (lhs instanceof IdentNode) {
if (!checkIdentLValue((IdentNode)lhs)) {
next();
- return referenceError(lhs, null);
+ return referenceError(lhs, null, false);
}
verifyStrictIdent((IdentNode)lhs, "operand for " + opType.getName() + " operator");
}
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
index a9c6c589093..83c0a5abb00 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
@@ -43,6 +43,7 @@ parser.error.expected.operand=Expected an operand but found {0}
parser.error.expected.stmt=Expected statement but found {0}
parser.error.expected.comma=Expected comma but found {0}
parser.error.expected.property.id=Expected property id but found {0}
+parser.error.expected.lvalue=Expected l-value but found {0}
parser.error.expected=Expected {0} but found {1}
parser.error.invalid.return=Invalid return statement
parser.error.no.func.decl.here=Function declarations can only occur at program or function body level. You should use a function expression here instead.
diff --git a/nashorn/test/script/basic/JDK-8019553.js b/nashorn/test/script/basic/JDK-8019553.js
new file mode 100644
index 00000000000..d754618718a
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8019553.js
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * JDK-8019553: NPE on illegal l-value for increment and decrement
+ *
+ * @test
+ * @run
+ */
+
+function check(str) {
+ try {
+ eval(str);
+ fail("SyntaxError expected for: " + str);
+ } catch (e) {
+ print(e.toString().replace(/\\/g, '/'));
+ }
+}
+
+check("++ +3");
+check("++ -7");
+check("-- +2");
+check("-- -8");
diff --git a/nashorn/test/script/basic/JDK-8019553.js.EXPECTED b/nashorn/test/script/basic/JDK-8019553.js.EXPECTED
new file mode 100644
index 00000000000..78d22beac0f
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8019553.js.EXPECTED
@@ -0,0 +1,12 @@
+SyntaxError: test/script/basic/JDK-8019553.js#33:1:3 Expected l-value but found +
+++ +3
+ ^
+SyntaxError: test/script/basic/JDK-8019553.js#33:1:3 Expected l-value but found -
+++ -7
+ ^
+SyntaxError: test/script/basic/JDK-8019553.js#33:1:3 Expected l-value but found +
+-- +2
+ ^
+SyntaxError: test/script/basic/JDK-8019553.js#33:1:3 Expected l-value but found -
+-- -8
+ ^
diff --git a/nashorn/test/script/basic/NASHORN-51.js b/nashorn/test/script/basic/NASHORN-51.js
index 044bce94062..bc41d79bebf 100644
--- a/nashorn/test/script/basic/NASHORN-51.js
+++ b/nashorn/test/script/basic/NASHORN-51.js
@@ -35,28 +35,28 @@ for (i in literals) {
eval(literals[i] + "++");
print("ERROR!! post increment : " + literals[i]);
} catch (e) {
- print(e);
+ print(e.toString().replace(/\\/g, '/'));
}
try {
eval(literals[i] + "--");
print("ERROR!! post decrement : " + literals[i]);
} catch (e) {
- print(e);
+ print(e.toString().replace(/\\/g, '/'));
}
try {
eval("++" + literals[i]);
print("ERROR!! pre increment : " + literals[i]);
} catch (e) {
- print(e);
+ print(e.toString().replace(/\\/g, '/'));
}
try {
eval("--" + literals[i]);
print("ERROR!! pre decrement : " + literals[i]);
} catch (e) {
- print(e);
+ print(e.toString().replace(/\\/g, '/'));
}
}
diff --git a/nashorn/test/script/basic/NASHORN-51.js.EXPECTED b/nashorn/test/script/basic/NASHORN-51.js.EXPECTED
index 9fc05c3f1b4..9479f7e1995 100644
--- a/nashorn/test/script/basic/NASHORN-51.js.EXPECTED
+++ b/nashorn/test/script/basic/NASHORN-51.js.EXPECTED
@@ -1,24 +1,72 @@
-ReferenceError: "1" can not be used as the left-hand side of assignment
-ReferenceError: "1" can not be used as the left-hand side of assignment
-ReferenceError: "1" can not be used as the left-hand side of assignment
-ReferenceError: "1" can not be used as the left-hand side of assignment
-ReferenceError: "0" can not be used as the left-hand side of assignment
-ReferenceError: "0" can not be used as the left-hand side of assignment
-ReferenceError: "0" can not be used as the left-hand side of assignment
-ReferenceError: "0" can not be used as the left-hand side of assignment
-ReferenceError: "3.14" can not be used as the left-hand side of assignment
-ReferenceError: "3.14" can not be used as the left-hand side of assignment
-ReferenceError: "3.14" can not be used as the left-hand side of assignment
-ReferenceError: "3.14" can not be used as the left-hand side of assignment
-ReferenceError: "true" can not be used as the left-hand side of assignment
-ReferenceError: "true" can not be used as the left-hand side of assignment
-ReferenceError: "true" can not be used as the left-hand side of assignment
-ReferenceError: "true" can not be used as the left-hand side of assignment
-ReferenceError: "false" can not be used as the left-hand side of assignment
-ReferenceError: "false" can not be used as the left-hand side of assignment
-ReferenceError: "false" can not be used as the left-hand side of assignment
-ReferenceError: "false" can not be used as the left-hand side of assignment
-ReferenceError: "null" can not be used as the left-hand side of assignment
-ReferenceError: "null" can not be used as the left-hand side of assignment
-ReferenceError: "null" can not be used as the left-hand side of assignment
-ReferenceError: "null" can not be used as the left-hand side of assignment
+ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
+1++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
+1--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
+++1
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
+--1
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
+0++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
+0--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
+++0
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
+--0
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
+3.14++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
+3.14--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
+++3.14
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
+--3.14
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
+true++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
+true--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
+++true
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
+--true
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
+false++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
+false--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
+++false
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
+--false
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
+null++
+^
+ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
+null--
+^
+ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
+++null
+ ^
+ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
+--null
+ ^
diff --git a/nashorn/test/script/error/NASHORN-57.js.EXPECTED b/nashorn/test/script/error/NASHORN-57.js.EXPECTED
index 5a93b597c0e..c9c51de1292 100644
--- a/nashorn/test/script/error/NASHORN-57.js.EXPECTED
+++ b/nashorn/test/script/error/NASHORN-57.js.EXPECTED
@@ -1,3 +1,3 @@
-test/script/error/NASHORN-57.js:35:2 Expected statement but found ;
+test/script/error/NASHORN-57.js:35:2 Expected l-value but found ;
++;
^
From 1e7c006d39af10810f916e1c05e9c7b970d9f6aa Mon Sep 17 00:00:00 2001
From: Coleen Phillimore
Date: Tue, 2 Jul 2013 08:42:37 -0400
Subject: [PATCH 071/101] 8015391: NPG: With -XX:+UseCompressedKlassPointers
OOME due to exhausted metadata space could occur when metaspace is almost
empty
Allocate medium chunks for class metaspace when class loader has lots of classes
Reviewed-by: mgerdin, jmasa
---
hotspot/src/share/vm/memory/metaspace.cpp | 74 ++++++++++++----------
hotspot/src/share/vm/memory/universe.cpp | 16 +++--
hotspot/src/share/vm/memory/universe.hpp | 13 ++--
hotspot/src/share/vm/runtime/vmStructs.cpp | 4 --
4 files changed, 61 insertions(+), 46 deletions(-)
diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
index c840b9363ef..07aa706d5fc 100644
--- a/hotspot/src/share/vm/memory/metaspace.cpp
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
@@ -70,7 +70,7 @@ enum ChunkSizes { // in words.
SpecializedChunk = 128,
ClassSmallChunk = 256,
SmallChunk = 512,
- ClassMediumChunk = 1 * K,
+ ClassMediumChunk = 4 * K,
MediumChunk = 8 * K,
HumongousChunkGranularity = 8
};
@@ -580,7 +580,6 @@ class SpaceManager : public CHeapObj {
// Number of small chunks to allocate to a manager
// If class space manager, small chunks are unlimited
static uint const _small_chunk_limit;
- bool has_small_chunk_limit() { return !vs_list()->is_class(); }
// Sum of all space in allocated chunks
size_t _allocated_blocks_words;
@@ -1298,13 +1297,18 @@ size_t MetaspaceGC::delta_capacity_until_GC(size_t word_size) {
bool MetaspaceGC::should_expand(VirtualSpaceList* vsl, size_t word_size) {
- size_t committed_capacity_bytes = MetaspaceAux::allocated_capacity_bytes();
// If the user wants a limit, impose one.
- size_t max_metaspace_size_bytes = MaxMetaspaceSize;
- size_t metaspace_size_bytes = MetaspaceSize;
- if (!FLAG_IS_DEFAULT(MaxMetaspaceSize) &&
- MetaspaceAux::reserved_in_bytes() >= MaxMetaspaceSize) {
- return false;
+ // The reason for someone using this flag is to limit reserved space. So
+ // for non-class virtual space, compare against virtual spaces that are reserved.
+ // For class virtual space, we only compare against the committed space, not
+ // reserved space, because this is a larger space prereserved for compressed
+ // class pointers.
+ if (!FLAG_IS_DEFAULT(MaxMetaspaceSize)) {
+ size_t real_allocated = Metaspace::space_list()->virtual_space_total() +
+ MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType);
+ if (real_allocated >= MaxMetaspaceSize) {
+ return false;
+ }
}
// Class virtual space should always be expanded. Call GC for the other
@@ -1318,11 +1322,12 @@ bool MetaspaceGC::should_expand(VirtualSpaceList* vsl, size_t word_size) {
}
-
// If the capacity is below the minimum capacity, allow the
// expansion. Also set the high-water-mark (capacity_until_GC)
// to that minimum capacity so that a GC will not be induced
// until that minimum capacity is exceeded.
+ size_t committed_capacity_bytes = MetaspaceAux::allocated_capacity_bytes();
+ size_t metaspace_size_bytes = MetaspaceSize;
if (committed_capacity_bytes < metaspace_size_bytes ||
capacity_until_GC() == 0) {
set_capacity_until_GC(metaspace_size_bytes);
@@ -1866,13 +1871,11 @@ size_t SpaceManager::sum_waste_in_chunks_in_use(ChunkIndex index) const {
Metachunk* chunk = chunks_in_use(index);
// Count the free space in all the chunk but not the
// current chunk from which allocations are still being done.
- if (chunk != NULL) {
- Metachunk* prev = chunk;
- while (chunk != NULL && chunk != current_chunk()) {
+ while (chunk != NULL) {
+ if (chunk != current_chunk()) {
result += chunk->free_word_size();
- prev = chunk;
- chunk = chunk->next();
}
+ chunk = chunk->next();
}
return result;
}
@@ -1961,8 +1964,7 @@ size_t SpaceManager::calc_chunk_size(size_t word_size) {
// chunks will be allocated.
size_t chunk_word_size;
if (chunks_in_use(MediumIndex) == NULL &&
- (!has_small_chunk_limit() ||
- sum_count_in_chunks_in_use(SmallIndex) < _small_chunk_limit)) {
+ sum_count_in_chunks_in_use(SmallIndex) < _small_chunk_limit) {
chunk_word_size = (size_t) small_chunk_size();
if (word_size + Metachunk::overhead() > small_chunk_size()) {
chunk_word_size = medium_chunk_size();
@@ -2671,10 +2673,10 @@ void MetaspaceAux::print_on(outputStream* out, Metaspace::MetadataType mdtype) {
// Print total fragmentation for class and data metaspaces separately
void MetaspaceAux::print_waste(outputStream* out) {
- size_t specialized_waste = 0, small_waste = 0, medium_waste = 0, large_waste = 0;
- size_t specialized_count = 0, small_count = 0, medium_count = 0, large_count = 0;
- size_t cls_specialized_waste = 0, cls_small_waste = 0, cls_medium_waste = 0, cls_large_waste = 0;
- size_t cls_specialized_count = 0, cls_small_count = 0, cls_medium_count = 0, cls_large_count = 0;
+ size_t specialized_waste = 0, small_waste = 0, medium_waste = 0;
+ size_t specialized_count = 0, small_count = 0, medium_count = 0, humongous_count = 0;
+ size_t cls_specialized_waste = 0, cls_small_waste = 0, cls_medium_waste = 0;
+ size_t cls_specialized_count = 0, cls_small_count = 0, cls_medium_count = 0, cls_humongous_count = 0;
ClassLoaderDataGraphMetaspaceIterator iter;
while (iter.repeat()) {
@@ -2686,8 +2688,7 @@ void MetaspaceAux::print_waste(outputStream* out) {
small_count += msp->vsm()->sum_count_in_chunks_in_use(SmallIndex);
medium_waste += msp->vsm()->sum_waste_in_chunks_in_use(MediumIndex);
medium_count += msp->vsm()->sum_count_in_chunks_in_use(MediumIndex);
- large_waste += msp->vsm()->sum_waste_in_chunks_in_use(HumongousIndex);
- large_count += msp->vsm()->sum_count_in_chunks_in_use(HumongousIndex);
+ humongous_count += msp->vsm()->sum_count_in_chunks_in_use(HumongousIndex);
cls_specialized_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(SpecializedIndex);
cls_specialized_count += msp->class_vsm()->sum_count_in_chunks_in_use(SpecializedIndex);
@@ -2695,20 +2696,23 @@ void MetaspaceAux::print_waste(outputStream* out) {
cls_small_count += msp->class_vsm()->sum_count_in_chunks_in_use(SmallIndex);
cls_medium_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(MediumIndex);
cls_medium_count += msp->class_vsm()->sum_count_in_chunks_in_use(MediumIndex);
- cls_large_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(HumongousIndex);
- cls_large_count += msp->class_vsm()->sum_count_in_chunks_in_use(HumongousIndex);
+ cls_humongous_count += msp->class_vsm()->sum_count_in_chunks_in_use(HumongousIndex);
}
}
out->print_cr("Total fragmentation waste (words) doesn't count free space");
out->print_cr(" data: " SIZE_FORMAT " specialized(s) " SIZE_FORMAT ", "
SIZE_FORMAT " small(s) " SIZE_FORMAT ", "
- SIZE_FORMAT " medium(s) " SIZE_FORMAT,
+ SIZE_FORMAT " medium(s) " SIZE_FORMAT ", "
+ "large count " SIZE_FORMAT,
specialized_count, specialized_waste, small_count,
- small_waste, medium_count, medium_waste);
+ small_waste, medium_count, medium_waste, humongous_count);
out->print_cr(" class: " SIZE_FORMAT " specialized(s) " SIZE_FORMAT ", "
- SIZE_FORMAT " small(s) " SIZE_FORMAT,
+ SIZE_FORMAT " small(s) " SIZE_FORMAT ", "
+ SIZE_FORMAT " medium(s) " SIZE_FORMAT ", "
+ "large count " SIZE_FORMAT,
cls_specialized_count, cls_specialized_waste,
- cls_small_count, cls_small_waste);
+ cls_small_count, cls_small_waste,
+ cls_medium_count, cls_medium_waste, cls_humongous_count);
}
// Dump global metaspace things from the end of ClassLoaderDataGraph
@@ -3049,18 +3053,24 @@ Metablock* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
if (Verbose && TraceMetadataChunkAllocation) {
gclog_or_tty->print_cr("Metaspace allocation failed for size "
SIZE_FORMAT, word_size);
- if (loader_data->metaspace_or_null() != NULL) loader_data->metaspace_or_null()->dump(gclog_or_tty);
+ if (loader_data->metaspace_or_null() != NULL) loader_data->dump(gclog_or_tty);
MetaspaceAux::dump(gclog_or_tty);
}
// -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
- report_java_out_of_memory("Metadata space");
+ const char* space_string = (mdtype == ClassType) ? "Class Metadata space" :
+ "Metadata space";
+ report_java_out_of_memory(space_string);
if (JvmtiExport::should_post_resource_exhausted()) {
JvmtiExport::post_resource_exhausted(
JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR,
- "Metadata space");
+ space_string);
+ }
+ if (mdtype == ClassType) {
+ THROW_OOP_0(Universe::out_of_memory_error_class_metaspace());
+ } else {
+ THROW_OOP_0(Universe::out_of_memory_error_metaspace());
}
- THROW_OOP_0(Universe::out_of_memory_error_perm_gen());
}
}
return Metablock::initialize(result, word_size);
diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp
index 2b3576d6784..fe91faa9922 100644
--- a/hotspot/src/share/vm/memory/universe.cpp
+++ b/hotspot/src/share/vm/memory/universe.cpp
@@ -110,7 +110,8 @@ LatestMethodOopCache* Universe::_finalizer_register_cache = NULL;
LatestMethodOopCache* Universe::_loader_addClass_cache = NULL;
ActiveMethodOopsCache* Universe::_reflect_invoke_cache = NULL;
oop Universe::_out_of_memory_error_java_heap = NULL;
-oop Universe::_out_of_memory_error_perm_gen = NULL;
+oop Universe::_out_of_memory_error_metaspace = NULL;
+oop Universe::_out_of_memory_error_class_metaspace = NULL;
oop Universe::_out_of_memory_error_array_size = NULL;
oop Universe::_out_of_memory_error_gc_overhead_limit = NULL;
objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL;
@@ -179,7 +180,8 @@ void Universe::oops_do(OopClosure* f, bool do_all) {
f->do_oop((oop*)&_the_null_string);
f->do_oop((oop*)&_the_min_jint_string);
f->do_oop((oop*)&_out_of_memory_error_java_heap);
- f->do_oop((oop*)&_out_of_memory_error_perm_gen);
+ f->do_oop((oop*)&_out_of_memory_error_metaspace);
+ f->do_oop((oop*)&_out_of_memory_error_class_metaspace);
f->do_oop((oop*)&_out_of_memory_error_array_size);
f->do_oop((oop*)&_out_of_memory_error_gc_overhead_limit);
f->do_oop((oop*)&_preallocated_out_of_memory_error_array);
@@ -561,7 +563,8 @@ bool Universe::should_fill_in_stack_trace(Handle throwable) {
// a potential loop which could happen if an out of memory occurs when attempting
// to allocate the backtrace.
return ((throwable() != Universe::_out_of_memory_error_java_heap) &&
- (throwable() != Universe::_out_of_memory_error_perm_gen) &&
+ (throwable() != Universe::_out_of_memory_error_metaspace) &&
+ (throwable() != Universe::_out_of_memory_error_class_metaspace) &&
(throwable() != Universe::_out_of_memory_error_array_size) &&
(throwable() != Universe::_out_of_memory_error_gc_overhead_limit));
}
@@ -1011,7 +1014,8 @@ bool universe_post_init() {
k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_OutOfMemoryError(), true, CHECK_false);
k_h = instanceKlassHandle(THREAD, k);
Universe::_out_of_memory_error_java_heap = k_h->allocate_instance(CHECK_false);
- Universe::_out_of_memory_error_perm_gen = k_h->allocate_instance(CHECK_false);
+ Universe::_out_of_memory_error_metaspace = k_h->allocate_instance(CHECK_false);
+ Universe::_out_of_memory_error_class_metaspace = k_h->allocate_instance(CHECK_false);
Universe::_out_of_memory_error_array_size = k_h->allocate_instance(CHECK_false);
Universe::_out_of_memory_error_gc_overhead_limit =
k_h->allocate_instance(CHECK_false);
@@ -1044,7 +1048,9 @@ bool universe_post_init() {
java_lang_Throwable::set_message(Universe::_out_of_memory_error_java_heap, msg());
msg = java_lang_String::create_from_str("Metadata space", CHECK_false);
- java_lang_Throwable::set_message(Universe::_out_of_memory_error_perm_gen, msg());
+ java_lang_Throwable::set_message(Universe::_out_of_memory_error_metaspace, msg());
+ msg = java_lang_String::create_from_str("Class Metadata space", CHECK_false);
+ java_lang_Throwable::set_message(Universe::_out_of_memory_error_class_metaspace, msg());
msg = java_lang_String::create_from_str("Requested array size exceeds VM limit", CHECK_false);
java_lang_Throwable::set_message(Universe::_out_of_memory_error_array_size, msg());
diff --git a/hotspot/src/share/vm/memory/universe.hpp b/hotspot/src/share/vm/memory/universe.hpp
index b9ff266a008..23a29489193 100644
--- a/hotspot/src/share/vm/memory/universe.hpp
+++ b/hotspot/src/share/vm/memory/universe.hpp
@@ -177,10 +177,12 @@ class Universe: AllStatic {
static LatestMethodOopCache* _finalizer_register_cache; // static method for registering finalizable objects
static LatestMethodOopCache* _loader_addClass_cache; // method for registering loaded classes in class loader vector
static ActiveMethodOopsCache* _reflect_invoke_cache; // method for security checks
- static oop _out_of_memory_error_java_heap; // preallocated error object (no backtrace)
- static oop _out_of_memory_error_perm_gen; // preallocated error object (no backtrace)
- static oop _out_of_memory_error_array_size;// preallocated error object (no backtrace)
- static oop _out_of_memory_error_gc_overhead_limit; // preallocated error object (no backtrace)
+ // preallocated error objects (no backtrace)
+ static oop _out_of_memory_error_java_heap;
+ static oop _out_of_memory_error_metaspace;
+ static oop _out_of_memory_error_class_metaspace;
+ static oop _out_of_memory_error_array_size;
+ static oop _out_of_memory_error_gc_overhead_limit;
static Array* _the_empty_int_array; // Canonicalized int array
static Array* _the_empty_short_array; // Canonicalized short array
@@ -348,7 +350,8 @@ class Universe: AllStatic {
// may or may not have a backtrace. If error has a backtrace then the stack trace is already
// filled in.
static oop out_of_memory_error_java_heap() { return gen_out_of_memory_error(_out_of_memory_error_java_heap); }
- static oop out_of_memory_error_perm_gen() { return gen_out_of_memory_error(_out_of_memory_error_perm_gen); }
+ static oop out_of_memory_error_metaspace() { return gen_out_of_memory_error(_out_of_memory_error_metaspace); }
+ static oop out_of_memory_error_class_metaspace() { return gen_out_of_memory_error(_out_of_memory_error_class_metaspace); }
static oop out_of_memory_error_array_size() { return gen_out_of_memory_error(_out_of_memory_error_array_size); }
static oop out_of_memory_error_gc_overhead_limit() { return gen_out_of_memory_error(_out_of_memory_error_gc_overhead_limit); }
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index dff270f1631..232577f9b51 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -437,10 +437,6 @@ typedef BinaryTreeDictionary MetablockTreeDictionary;
static_field(Universe, _main_thread_group, oop) \
static_field(Universe, _system_thread_group, oop) \
static_field(Universe, _the_empty_class_klass_array, objArrayOop) \
- static_field(Universe, _out_of_memory_error_java_heap, oop) \
- static_field(Universe, _out_of_memory_error_perm_gen, oop) \
- static_field(Universe, _out_of_memory_error_array_size, oop) \
- static_field(Universe, _out_of_memory_error_gc_overhead_limit, oop) \
static_field(Universe, _null_ptr_exception_instance, oop) \
static_field(Universe, _arithmetic_exception_instance, oop) \
static_field(Universe, _vm_exception, oop) \
From 8ff9291b055305538c1b550d6a34f12aa8950bc1 Mon Sep 17 00:00:00 2001
From: Marcus Lagergren
Date: Tue, 2 Jul 2013 14:50:39 +0200
Subject: [PATCH 072/101] 8017082: Long array literals were slightly broken
Reviewed-by: sundar, attila
---
.../internal/codegen/CodeGenerator.java | 2 +-
.../nashorn/internal/codegen/types/Type.java | 10 +++---
.../jdk/nashorn/internal/ir/LiteralNode.java | 25 +++++++++++++-
nashorn/test/script/basic/JDK-8017082.js | 33 +++++++++++++++++++
4 files changed, 64 insertions(+), 6 deletions(-)
create mode 100644 nashorn/test/script/basic/JDK-8017082.js
diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
index 1b25bd1b697..414d1bb8bc3 100644
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -1110,7 +1110,7 @@ final class CodeGenerator extends NodeOperatorVisitor, BytecodeOps {
@Override
public Type aload(final MethodVisitor method) {
- method.visitInsn(IALOAD);
- return INT;
+ method.visitInsn(LALOAD);
+ return LONG;
}
@Override
public Type newarray(final MethodVisitor method) {
- method.visitIntInsn(NEWARRAY, T_INT);
+ method.visitIntInsn(NEWARRAY, T_LONG);
return this;
}
@Override
public Type getElementType() {
- return INT;
+ return LONG;
}
};
diff --git a/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java b/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java
index c34f9d94c5b..a7cea66a256 100644
--- a/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java
+++ b/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java
@@ -621,8 +621,10 @@ public abstract class LiteralNode extends Node implements PropertyKey {
elementType = Type.INT;
analyzeElements();
- if (elementType == Type.INT) {
+ if (elementType.isInteger()) {
presetIntArray();
+ } else if (elementType.isLong()) {
+ presetLongArray();
} else if (elementType.isNumeric()) {
presetNumberArray();
} else {
@@ -649,6 +651,25 @@ public abstract class LiteralNode extends Node implements PropertyKey {
postsets = Arrays.copyOf(computed, nComputed);
}
+ private void presetLongArray() {
+ final long[] array = new long[value.length];
+ final int[] computed = new int[value.length];
+ int nComputed = 0;
+
+ for (int i = 0; i < value.length; i++) {
+ final Object element = objectAsConstant(value[i]);
+
+ if (element instanceof Number) {
+ array[i] = ((Number)element).longValue();
+ } else {
+ computed[nComputed++] = i;
+ }
+ }
+
+ presets = array;
+ postsets = Arrays.copyOf(computed, nComputed);
+ }
+
private void presetNumberArray() {
final double[] array = new double[value.length];
final int[] computed = new int[value.length];
@@ -746,6 +767,8 @@ public abstract class LiteralNode extends Node implements PropertyKey {
public Type getType() {
if (elementType.isInteger()) {
return Type.INT_ARRAY;
+ } else if (elementType.isLong()) {
+ return Type.LONG_ARRAY;
} else if (elementType.isNumeric()) {
return Type.NUMBER_ARRAY;
} else {
diff --git a/nashorn/test/script/basic/JDK-8017082.js b/nashorn/test/script/basic/JDK-8017082.js
new file mode 100644
index 00000000000..5ac96324fcc
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8017082.js
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+/**
+ * Long array literals were broken
+ *
+ * @test
+ * @run
+ */
+function f() {
+ var z= c>>e>>>0;
+ var x = [z];
+}
From ea2c99f5bbade0a5ffae2d178d957162bf66424d Mon Sep 17 00:00:00 2001
From: Vicente Romero
Date: Tue, 2 Jul 2013 22:49:40 +0100
Subject: [PATCH 073/101] 6326693: variable x might already have been assigned,
when assignment is in catch block
Reviewed-by: mcimadamore
---
.../com/sun/tools/javac/comp/Flow.java | 11 ++-
...nalVariableAssignedToInCatchBlockTest.java | 94 +++++++++++++++++++
...inalVariableAssignedToInCatchBlockTest.out | 3 +
3 files changed, 106 insertions(+), 2 deletions(-)
create mode 100644 langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.java
create mode 100644 langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.out
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
index d1280935955..df66e345703 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
@@ -1945,10 +1945,17 @@ public class Flow {
}
}
+ /* The analysis of each catch should be independent.
+ * Each one should have the same initial values of inits and
+ * uninits.
+ */
+ final Bits initsCatchPrev = new Bits(initsTry);
+ final Bits uninitsCatchPrev = new Bits(uninitsTry);
+
for (List l = tree.catchers; l.nonEmpty(); l = l.tail) {
JCVariableDecl param = l.head.param;
- inits.assign(initsTry);
- uninits.assign(uninitsTry);
+ inits.assign(initsCatchPrev);
+ uninits.assign(uninitsCatchPrev);
scan(param);
inits.incl(param.sym.adr);
uninits.excl(param.sym.adr);
diff --git a/langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.java b/langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.java
new file mode 100644
index 00000000000..ec1caf3523c
--- /dev/null
+++ b/langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 6356530
+ * @summary -Xlint:serial does not flag abstract classes with concrete methods/members
+ * @compile/fail/ref=FinalVariableAssignedToInCatchBlockTest.out -XDrawDiagnostics FinalVariableAssignedToInCatchBlockTest.java
+ */
+
+import java.io.IOException;
+
+public class FinalVariableAssignedToInCatchBlockTest {
+ public void m1(int o)
+ {
+ final int i;
+ try {
+ if (o == 1) {
+ throw new IOException();
+ } else if (o == 2) {
+ throw new InterruptedException();
+ } else {
+ throw new Exception();
+ }
+ } catch (IOException e) {
+ i = 1;
+ } catch (InterruptedException ie) {
+ i = 2;
+ } catch (Exception e) {
+ i = 3;
+ } finally {
+ i = 4;
+ }
+ }
+
+ public void m2(int o)
+ {
+ final int i;
+ try {
+ if (o == 1) {
+ throw new IOException();
+ } else if (o == 2) {
+ throw new InterruptedException();
+ } else {
+ throw new Exception();
+ }
+ } catch (IOException e) {
+ i = 1;
+ } catch (InterruptedException ie) {
+ i = 2;
+ } catch (Exception e) {
+ i = 3;
+ }
+ }
+
+ public void m3(int o) throws Exception
+ {
+ final int i;
+ try {
+ if (o == 1) {
+ throw new IOException();
+ } else if (o == 2) {
+ throw new InterruptedException();
+ } else {
+ throw new Exception();
+ }
+ } catch (IOException e) {
+ i = 1;
+ } catch (InterruptedException ie) {
+ i = 2;
+ }
+ i = 3;
+ }
+}
diff --git a/langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.out b/langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.out
new file mode 100644
index 00000000000..58ed58efe31
--- /dev/null
+++ b/langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.out
@@ -0,0 +1,3 @@
+FinalVariableAssignedToInCatchBlockTest.java:52:13: compiler.err.var.might.already.be.assigned: i
+FinalVariableAssignedToInCatchBlockTest.java:92:9: compiler.err.var.might.already.be.assigned: i
+2 errors
From 9a359984c2c0f2e44abca5f6b0d405a99a7b647d Mon Sep 17 00:00:00 2001
From: David Chase
Date: Tue, 2 Jul 2013 20:42:12 -0400
Subject: [PATCH 074/101] 7088419: Use x86 Hardware CRC32 Instruction with
java.util.zip.CRC32
Add intrinsics using new instruction to interpreter, C1, C2, for suitable x86; add test
Reviewed-by: kvn, twisti
---
.../cpu/sparc/vm/c1_LIRAssembler_sparc.cpp | 5 +-
.../cpu/sparc/vm/c1_LIRGenerator_sparc.cpp | 6 +-
hotspot/src/cpu/x86/vm/assembler_x86.cpp | 49 ++-
hotspot/src/cpu/x86/vm/assembler_x86.hpp | 12 +
.../src/cpu/x86/vm/c1_LIRAssembler_x86.cpp | 18 +-
.../src/cpu/x86/vm/c1_LIRGenerator_x86.cpp | 77 +++-
hotspot/src/cpu/x86/vm/globals_x86.hpp | 3 +
.../cpu/x86/vm/interpreterGenerator_x86.hpp | 4 +-
hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp | 198 +++++++++-
hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp | 27 +-
.../src/cpu/x86/vm/stubGenerator_x86_32.cpp | 61 +++-
.../src/cpu/x86/vm/stubGenerator_x86_64.cpp | 45 ++-
hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp | 130 +++++++
hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp | 45 +++
.../src/cpu/x86/vm/stubRoutines_x86_32.cpp | 4 +-
.../src/cpu/x86/vm/stubRoutines_x86_32.hpp | 9 +-
.../src/cpu/x86/vm/stubRoutines_x86_64.cpp | 5 +-
.../src/cpu/x86/vm/stubRoutines_x86_64.hpp | 12 +-
.../cpu/x86/vm/templateInterpreter_x86_32.cpp | 141 +++++++-
.../cpu/x86/vm/templateInterpreter_x86_64.cpp | 139 +++++++-
hotspot/src/cpu/x86/vm/vm_version_x86.cpp | 24 +-
hotspot/src/cpu/x86/vm/vm_version_x86.hpp | 11 +-
hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 10 +-
hotspot/src/share/vm/c1/c1_LIR.cpp | 32 ++
hotspot/src/share/vm/c1/c1_LIR.hpp | 28 +-
hotspot/src/share/vm/c1/c1_LIRAssembler.hpp | 3 +-
hotspot/src/share/vm/c1/c1_LIRGenerator.cpp | 6 +
hotspot/src/share/vm/c1/c1_LIRGenerator.hpp | 3 +-
hotspot/src/share/vm/c1/c1_Runtime1.cpp | 1 +
hotspot/src/share/vm/classfile/vmSymbols.hpp | 11 +
.../vm/interpreter/abstractInterpreter.hpp | 5 +-
.../src/share/vm/interpreter/interpreter.cpp | 16 +-
.../vm/interpreter/templateInterpreter.cpp | 8 +-
hotspot/src/share/vm/opto/escape.cpp | 1 +
hotspot/src/share/vm/opto/library_call.cpp | 337 ++++++++++++------
hotspot/src/share/vm/opto/runtime.cpp | 24 +-
hotspot/src/share/vm/opto/runtime.hpp | 4 +-
hotspot/src/share/vm/runtime/globals.hpp | 3 +
hotspot/src/share/vm/runtime/stubRoutines.cpp | 5 +-
hotspot/src/share/vm/runtime/stubRoutines.hpp | 6 +
hotspot/test/compiler/7088419/CRCTest.java | 132 +++++++
41 files changed, 1487 insertions(+), 173 deletions(-)
create mode 100644 hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp
create mode 100644 hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp
create mode 100644 hotspot/test/compiler/7088419/CRCTest.java
diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
index 1cbc5c41316..64745015923 100644
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -2946,6 +2946,9 @@ void LIR_Assembler::monitor_address(int monitor_no, LIR_Opr dst_opr) {
}
}
+void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) {
+ fatal("CRC32 intrinsic is not implemented on this platform");
+}
void LIR_Assembler::emit_lock(LIR_OpLock* op) {
Register obj = op->obj_opr()->as_register();
diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp
index 82cc696e8b7..dc3bc8691ac 100644
--- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -784,6 +784,10 @@ void LIRGenerator::do_ArrayCopy(Intrinsic* x) {
set_no_result(x);
}
+void LIRGenerator::do_update_CRC32(Intrinsic* x) {
+ fatal("CRC32 intrinsic is not implemented on this platform");
+}
+
// _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f
// _i2b, _i2c, _i2s
void LIRGenerator::do_Convert(Convert* x) {
diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp
index 02a438f2f40..761b5c3259f 100644
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1673,6 +1673,11 @@ void Assembler::movdqa(XMMRegister dst, XMMRegister src) {
emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_66);
}
+void Assembler::movdqa(XMMRegister dst, Address src) {
+ NOT_LP64(assert(VM_Version::supports_sse2(), ""));
+ emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_66);
+}
+
void Assembler::movdqu(XMMRegister dst, Address src) {
NOT_LP64(assert(VM_Version::supports_sse2(), ""));
emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_F3);
@@ -2286,6 +2291,38 @@ void Assembler::pcmpestri(XMMRegister dst, XMMRegister src, int imm8) {
emit_int8(imm8);
}
+void Assembler::pextrd(Register dst, XMMRegister src, int imm8) {
+ assert(VM_Version::supports_sse4_1(), "");
+ int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, false);
+ emit_int8(0x16);
+ emit_int8((unsigned char)(0xC0 | encode));
+ emit_int8(imm8);
+}
+
+void Assembler::pextrq(Register dst, XMMRegister src, int imm8) {
+ assert(VM_Version::supports_sse4_1(), "");
+ int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, true);
+ emit_int8(0x16);
+ emit_int8((unsigned char)(0xC0 | encode));
+ emit_int8(imm8);
+}
+
+void Assembler::pinsrd(XMMRegister dst, Register src, int imm8) {
+ assert(VM_Version::supports_sse4_1(), "");
+ int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, false);
+ emit_int8(0x22);
+ emit_int8((unsigned char)(0xC0 | encode));
+ emit_int8(imm8);
+}
+
+void Assembler::pinsrq(XMMRegister dst, Register src, int imm8) {
+ assert(VM_Version::supports_sse4_1(), "");
+ int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, true);
+ emit_int8(0x22);
+ emit_int8((unsigned char)(0xC0 | encode));
+ emit_int8(imm8);
+}
+
void Assembler::pmovzxbw(XMMRegister dst, Address src) {
assert(VM_Version::supports_sse4_1(), "");
InstructionMark im(this);
@@ -3691,6 +3728,16 @@ void Assembler::vpbroadcastd(XMMRegister dst, XMMRegister src) {
emit_int8((unsigned char)(0xC0 | encode));
}
+// Carry-Less Multiplication Quadword
+void Assembler::vpclmulqdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int mask) {
+ assert(VM_Version::supports_avx() && VM_Version::supports_clmul(), "");
+ bool vector256 = false;
+ int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_3A);
+ emit_int8(0x44);
+ emit_int8((unsigned char)(0xC0 | encode));
+ emit_int8((unsigned char)mask);
+}
+
void Assembler::vzeroupper() {
assert(VM_Version::supports_avx(), "");
(void)vex_prefix_and_encode(xmm0, xmm0, xmm0, VEX_SIMD_NONE);
diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp
index 97a5bfc0368..31481b5808f 100644
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp
@@ -1266,6 +1266,7 @@ private:
// Move Aligned Double Quadword
void movdqa(XMMRegister dst, XMMRegister src);
+ void movdqa(XMMRegister dst, Address src);
// Move Unaligned Double Quadword
void movdqu(Address dst, XMMRegister src);
@@ -1404,6 +1405,14 @@ private:
void pcmpestri(XMMRegister xmm1, XMMRegister xmm2, int imm8);
void pcmpestri(XMMRegister xmm1, Address src, int imm8);
+ // SSE 4.1 extract
+ void pextrd(Register dst, XMMRegister src, int imm8);
+ void pextrq(Register dst, XMMRegister src, int imm8);
+
+ // SSE 4.1 insert
+ void pinsrd(XMMRegister dst, Register src, int imm8);
+ void pinsrq(XMMRegister dst, Register src, int imm8);
+
// SSE4.1 packed move
void pmovzxbw(XMMRegister dst, XMMRegister src);
void pmovzxbw(XMMRegister dst, Address src);
@@ -1764,6 +1773,9 @@ private:
// duplicate 4-bytes integer data from src into 8 locations in dest
void vpbroadcastd(XMMRegister dst, XMMRegister src);
+ // Carry-Less Multiplication Quadword
+ void vpclmulqdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int mask);
+
// AVX instruction which is used to clear upper 128 bits of YMM registers and
// to avoid transaction penalty between AVX and SSE states. There is no
// penalty if legacy SSE instructions are encoded using VEX prefix because
diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
index a99d7939373..b5bceeb60c6 100644
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -3512,6 +3512,22 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ bind(*stub->continuation());
}
+void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) {
+ assert(op->crc()->is_single_cpu(), "crc must be register");
+ assert(op->val()->is_single_cpu(), "byte value must be register");
+ assert(op->result_opr()->is_single_cpu(), "result must be register");
+ Register crc = op->crc()->as_register();
+ Register val = op->val()->as_register();
+ Register res = op->result_opr()->as_register();
+
+ assert_different_registers(val, crc, res);
+
+ __ lea(res, ExternalAddress(StubRoutines::crc_table_addr()));
+ __ notl(crc); // ~crc
+ __ update_byte_crc32(crc, val, res);
+ __ notl(crc); // ~crc
+ __ mov(res, crc);
+}
void LIR_Assembler::emit_lock(LIR_OpLock* op) {
Register obj = op->obj_opr()->as_register(); // may not be an oop
diff --git a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
index 6810ae54216..e6638581bcf 100644
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -932,6 +932,81 @@ void LIRGenerator::do_ArrayCopy(Intrinsic* x) {
__ arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(), length.result(), tmp, expected_type, flags, info); // does add_safepoint
}
+void LIRGenerator::do_update_CRC32(Intrinsic* x) {
+ assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support");
+ // Make all state_for calls early since they can emit code
+ LIR_Opr result = rlock_result(x);
+ int flags = 0;
+ switch (x->id()) {
+ case vmIntrinsics::_updateCRC32: {
+ LIRItem crc(x->argument_at(0), this);
+ LIRItem val(x->argument_at(1), this);
+ crc.load_item();
+ val.load_item();
+ __ update_crc32(crc.result(), val.result(), result);
+ break;
+ }
+ case vmIntrinsics::_updateBytesCRC32:
+ case vmIntrinsics::_updateByteBufferCRC32: {
+ bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32);
+
+ LIRItem crc(x->argument_at(0), this);
+ LIRItem buf(x->argument_at(1), this);
+ LIRItem off(x->argument_at(2), this);
+ LIRItem len(x->argument_at(3), this);
+ buf.load_item();
+ off.load_nonconstant();
+
+ LIR_Opr index = off.result();
+ int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
+ if(off.result()->is_constant()) {
+ index = LIR_OprFact::illegalOpr;
+ offset += off.result()->as_jint();
+ }
+ LIR_Opr base_op = buf.result();
+
+#ifndef _LP64
+ if (!is_updateBytes) { // long b raw address
+ base_op = new_register(T_INT);
+ __ convert(Bytecodes::_l2i, buf.result(), base_op);
+ }
+#else
+ if (index->is_valid()) {
+ LIR_Opr tmp = new_register(T_LONG);
+ __ convert(Bytecodes::_i2l, index, tmp);
+ index = tmp;
+ }
+#endif
+
+ LIR_Address* a = new LIR_Address(base_op,
+ index,
+ LIR_Address::times_1,
+ offset,
+ T_BYTE);
+ BasicTypeList signature(3);
+ signature.append(T_INT);
+ signature.append(T_ADDRESS);
+ signature.append(T_INT);
+ CallingConvention* cc = frame_map()->c_calling_convention(&signature);
+ const LIR_Opr result_reg = result_register_for(x->type());
+
+ LIR_Opr addr = new_pointer_register();
+ __ leal(LIR_OprFact::address(a), addr);
+
+ crc.load_item_force(cc->at(0));
+ __ move(addr, cc->at(1));
+ len.load_item_force(cc->at(2));
+
+ __ call_runtime_leaf(StubRoutines::updateBytesCRC32(), getThreadTemp(), result_reg, cc->args());
+ __ move(result_reg, result);
+
+ break;
+ }
+ default: {
+ ShouldNotReachHere();
+ }
+ }
+}
// _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f
// _i2b, _i2c, _i2s
diff --git a/hotspot/src/cpu/x86/vm/globals_x86.hpp b/hotspot/src/cpu/x86/vm/globals_x86.hpp
index 07ab0cfcdce..c47f7d1c193 100644
--- a/hotspot/src/cpu/x86/vm/globals_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp
@@ -96,6 +96,9 @@ define_pd_global(uintx, CMSYoungGenPerWorker, 64*M); // default max size of CMS
product(intx, UseAVX, 99, \
"Highest supported AVX instructions set on x86/x64") \
\
+ product(bool, UseCLMUL, false, \
+ "Control whether CLMUL instructions can be used on x86/x64") \
+ \
diagnostic(bool, UseIncDec, true, \
"Use INC, DEC instructions on x86") \
\
diff --git a/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp b/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp
index 13786e4149a..08f47708cdc 100644
--- a/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -39,6 +39,8 @@
address generate_empty_entry(void);
address generate_accessor_entry(void);
address generate_Reference_get_entry();
+ address generate_CRC32_update_entry();
+ address generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind);
void lock_method(void);
void generate_stack_overflow_check(void);
diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
index 98c93f99a0f..8aad6965156 100644
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -2794,6 +2794,15 @@ void MacroAssembler::movdqu(XMMRegister dst, AddressLiteral src) {
}
}
+void MacroAssembler::movdqa(XMMRegister dst, AddressLiteral src) {
+ if (reachable(src)) {
+ Assembler::movdqa(dst, as_Address(src));
+ } else {
+ lea(rscratch1, src);
+ Assembler::movdqa(dst, Address(rscratch1, 0));
+ }
+}
+
void MacroAssembler::movsd(XMMRegister dst, AddressLiteral src) {
if (reachable(src)) {
Assembler::movsd(dst, as_Address(src));
@@ -6388,6 +6397,193 @@ void MacroAssembler::encode_iso_array(Register src, Register dst, Register len,
bind(L_done);
}
+/**
+ * Emits code to update CRC-32 with a byte value according to constants in table
+ *
+ * @param [in,out]crc Register containing the crc.
+ * @param [in]val Register containing the byte to fold into the CRC.
+ * @param [in]table Register containing the table of crc constants.
+ *
+ * uint32_t crc;
+ * val = crc_table[(val ^ crc) & 0xFF];
+ * crc = val ^ (crc >> 8);
+ *
+ */
+void MacroAssembler::update_byte_crc32(Register crc, Register val, Register table) {
+ xorl(val, crc);
+ andl(val, 0xFF);
+ shrl(crc, 8); // unsigned shift
+ xorl(crc, Address(table, val, Address::times_4, 0));
+}
+
+/**
+ * Fold 128-bit data chunk
+ */
+void MacroAssembler::fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, Register buf, int offset) {
+ vpclmulhdq(xtmp, xK, xcrc); // [123:64]
+ vpclmulldq(xcrc, xK, xcrc); // [63:0]
+ vpxor(xcrc, xcrc, Address(buf, offset), false /* vector256 */);
+ pxor(xcrc, xtmp);
+}
+
+void MacroAssembler::fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, XMMRegister xbuf) {
+ vpclmulhdq(xtmp, xK, xcrc);
+ vpclmulldq(xcrc, xK, xcrc);
+ pxor(xcrc, xbuf);
+ pxor(xcrc, xtmp);
+}
+
+/**
+ * 8-bit folds to compute 32-bit CRC
+ *
+ * uint64_t xcrc;
+ * timesXtoThe32[xcrc & 0xFF] ^ (xcrc >> 8);
+ */
+void MacroAssembler::fold_8bit_crc32(XMMRegister xcrc, Register table, XMMRegister xtmp, Register tmp) {
+ movdl(tmp, xcrc);
+ andl(tmp, 0xFF);
+ movdl(xtmp, Address(table, tmp, Address::times_4, 0));
+ psrldq(xcrc, 1); // unsigned shift one byte
+ pxor(xcrc, xtmp);
+}
+
+/**
+ * uint32_t crc;
+ * timesXtoThe32[crc & 0xFF] ^ (crc >> 8);
+ */
+void MacroAssembler::fold_8bit_crc32(Register crc, Register table, Register tmp) {
+ movl(tmp, crc);
+ andl(tmp, 0xFF);
+ shrl(crc, 8);
+ xorl(crc, Address(table, tmp, Address::times_4, 0));
+}
+
+/**
+ * @param crc register containing existing CRC (32-bit)
+ * @param buf register pointing to input byte buffer (byte*)
+ * @param len register containing number of bytes
+ * @param table register that will contain address of CRC table
+ * @param tmp scratch register
+ */
+void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, Register table, Register tmp) {
+ assert_different_registers(crc, buf, len, table, tmp, rax);
+
+ Label L_tail, L_tail_restore, L_tail_loop, L_exit, L_align_loop, L_aligned;
+ Label L_fold_tail, L_fold_128b, L_fold_512b, L_fold_512b_loop, L_fold_tail_loop;
+
+ lea(table, ExternalAddress(StubRoutines::crc_table_addr()));
+ notl(crc); // ~crc
+ cmpl(len, 16);
+ jcc(Assembler::less, L_tail);
+
+ // Align buffer to 16 bytes
+ movl(tmp, buf);
+ andl(tmp, 0xF);
+ jccb(Assembler::zero, L_aligned);
+ subl(tmp, 16);
+ addl(len, tmp);
+
+ align(4);
+ BIND(L_align_loop);
+ movsbl(rax, Address(buf, 0)); // load byte with sign extension
+ update_byte_crc32(crc, rax, table);
+ increment(buf);
+ incrementl(tmp);
+ jccb(Assembler::less, L_align_loop);
+
+ BIND(L_aligned);
+ movl(tmp, len); // save
+ shrl(len, 4);
+ jcc(Assembler::zero, L_tail_restore);
+
+ // Fold crc into first bytes of vector
+ movdqa(xmm1, Address(buf, 0));
+ movdl(rax, xmm1);
+ xorl(crc, rax);
+ pinsrd(xmm1, crc, 0);
+ addptr(buf, 16);
+ subl(len, 4); // len > 0
+ jcc(Assembler::less, L_fold_tail);
+
+ movdqa(xmm2, Address(buf, 0));
+ movdqa(xmm3, Address(buf, 16));
+ movdqa(xmm4, Address(buf, 32));
+ addptr(buf, 48);
+ subl(len, 3);
+ jcc(Assembler::lessEqual, L_fold_512b);
+
+ // Fold total 512 bits of polynomial on each iteration,
+ // 128 bits per each of 4 parallel streams.
+ movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr() + 32));
+
+ align(32);
+ BIND(L_fold_512b_loop);
+ fold_128bit_crc32(xmm1, xmm0, xmm5, buf, 0);
+ fold_128bit_crc32(xmm2, xmm0, xmm5, buf, 16);
+ fold_128bit_crc32(xmm3, xmm0, xmm5, buf, 32);
+ fold_128bit_crc32(xmm4, xmm0, xmm5, buf, 48);
+ addptr(buf, 64);
+ subl(len, 4);
+ jcc(Assembler::greater, L_fold_512b_loop);
+
+ // Fold 512 bits to 128 bits.
+ BIND(L_fold_512b);
+ movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr() + 16));
+ fold_128bit_crc32(xmm1, xmm0, xmm5, xmm2);
+ fold_128bit_crc32(xmm1, xmm0, xmm5, xmm3);
+ fold_128bit_crc32(xmm1, xmm0, xmm5, xmm4);
+
+ // Fold the rest of 128 bits data chunks
+ BIND(L_fold_tail);
+ addl(len, 3);
+ jccb(Assembler::lessEqual, L_fold_128b);
+ movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr() + 16));
+
+ BIND(L_fold_tail_loop);
+ fold_128bit_crc32(xmm1, xmm0, xmm5, buf, 0);
+ addptr(buf, 16);
+ decrementl(len);
+ jccb(Assembler::greater, L_fold_tail_loop);
+
+ // Fold 128 bits in xmm1 down into 32 bits in crc register.
+ BIND(L_fold_128b);
+ movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr()));
+ vpclmulqdq(xmm2, xmm0, xmm1, 0x1);
+ vpand(xmm3, xmm0, xmm2, false /* vector256 */);
+ vpclmulqdq(xmm0, xmm0, xmm3, 0x1);
+ psrldq(xmm1, 8);
+ psrldq(xmm2, 4);
+ pxor(xmm0, xmm1);
+ pxor(xmm0, xmm2);
+
+ // 8 8-bit folds to compute 32-bit CRC.
+ for (int j = 0; j < 4; j++) {
+ fold_8bit_crc32(xmm0, table, xmm1, rax);
+ }
+ movdl(crc, xmm0); // mov 32 bits to general register
+ for (int j = 0; j < 4; j++) {
+ fold_8bit_crc32(crc, table, rax);
+ }
+
+ BIND(L_tail_restore);
+ movl(len, tmp); // restore
+ BIND(L_tail);
+ andl(len, 0xf);
+ jccb(Assembler::zero, L_exit);
+
+ // Fold the rest of bytes
+ align(4);
+ BIND(L_tail_loop);
+ movsbl(rax, Address(buf, 0)); // load byte with sign extension
+ update_byte_crc32(crc, rax, table);
+ increment(buf);
+ decrementl(len);
+ jccb(Assembler::greater, L_tail_loop);
+
+ BIND(L_exit);
+ notl(crc); // ~c
+}
+
#undef BIND
#undef BLOCK_COMMENT
diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp
index e9f409dc500..3acef073c0e 100644
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -899,6 +899,11 @@ public:
void movdqu(XMMRegister dst, XMMRegister src) { Assembler::movdqu(dst, src); }
void movdqu(XMMRegister dst, AddressLiteral src);
+ // Move Aligned Double Quadword
+ void movdqa(XMMRegister dst, Address src) { Assembler::movdqa(dst, src); }
+ void movdqa(XMMRegister dst, XMMRegister src) { Assembler::movdqa(dst, src); }
+ void movdqa(XMMRegister dst, AddressLiteral src);
+
void movsd(XMMRegister dst, XMMRegister src) { Assembler::movsd(dst, src); }
void movsd(Address dst, XMMRegister src) { Assembler::movsd(dst, src); }
void movsd(XMMRegister dst, Address src) { Assembler::movsd(dst, src); }
@@ -1027,6 +1032,16 @@ public:
Assembler::vinsertf128h(dst, nds, src);
}
+ // Carry-Less Multiplication Quadword
+ void vpclmulldq(XMMRegister dst, XMMRegister nds, XMMRegister src) {
+ // 0x00 - multiply lower 64 bits [0:63]
+ Assembler::vpclmulqdq(dst, nds, src, 0x00);
+ }
+ void vpclmulhdq(XMMRegister dst, XMMRegister nds, XMMRegister src) {
+ // 0x11 - multiply upper 64 bits [64:127]
+ Assembler::vpclmulqdq(dst, nds, src, 0x11);
+ }
+
// Data
void cmov32( Condition cc, Register dst, Address src);
@@ -1143,6 +1158,16 @@ public:
XMMRegister tmp1, XMMRegister tmp2, XMMRegister tmp3,
XMMRegister tmp4, Register tmp5, Register result);
+ // CRC32 code for java.util.zip.CRC32::updateBytes() instrinsic.
+ void update_byte_crc32(Register crc, Register val, Register table);
+ void kernel_crc32(Register crc, Register buf, Register len, Register table, Register tmp);
+ // Fold 128-bit data chunk
+ void fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, Register buf, int offset);
+ void fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, XMMRegister xbuf);
+ // Fold 8-bit data
+ void fold_8bit_crc32(Register crc, Register table, Register tmp);
+ void fold_8bit_crc32(XMMRegister crc, Register table, XMMRegister xtmp, Register tmp);
+
#undef VIRTUAL
};
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
index f24c5fdb38d..82e4183ef47 100644
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -2713,6 +2713,59 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
+ /**
+ * Arguments:
+ *
+ * Inputs:
+ * rsp(4) - int crc
+ * rsp(8) - byte* buf
+ * rsp(12) - int length
+ *
+ * Ouput:
+ * rax - int crc result
+ */
+ address generate_updateBytesCRC32() {
+ assert(UseCRC32Intrinsics, "need AVX and CLMUL instructions");
+
+ __ align(CodeEntryAlignment);
+ StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32");
+
+ address start = __ pc();
+
+ const Register crc = rdx; // crc
+ const Register buf = rsi; // source java byte array address
+ const Register len = rcx; // length
+ const Register table = rdi; // crc_table address (reuse register)
+ const Register tmp = rbx;
+ assert_different_registers(crc, buf, len, table, tmp, rax);
+
+ BLOCK_COMMENT("Entry:");
+ __ enter(); // required for proper stackwalking of RuntimeStub frame
+ __ push(rsi);
+ __ push(rdi);
+ __ push(rbx);
+
+ Address crc_arg(rbp, 8 + 0);
+ Address buf_arg(rbp, 8 + 4);
+ Address len_arg(rbp, 8 + 8);
+
+ // Load up:
+ __ movl(crc, crc_arg);
+ __ movptr(buf, buf_arg);
+ __ movl(len, len_arg);
+
+ __ kernel_crc32(crc, buf, len, table, tmp);
+
+ __ movl(rax, crc);
+ __ pop(rbx);
+ __ pop(rdi);
+ __ pop(rsi);
+ __ leave(); // required for proper stackwalking of RuntimeStub frame
+ __ ret(0);
+
+ return start;
+ }
+
public:
// Information about frame layout at time of blocking runtime call.
@@ -2887,6 +2940,12 @@ class StubGenerator: public StubCodeGenerator {
// Build this early so it's available for the interpreter
StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError));
+
+ if (UseCRC32Intrinsics) {
+ // set table address before stub generation which use it
+ StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table;
+ StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32();
+ }
}
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
index 7b8408d7131..2d94642f828 100644
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -3584,7 +3584,45 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
+ /**
+ * Arguments:
+ *
+ * Inputs:
+ * c_rarg0 - int crc
+ * c_rarg1 - byte* buf
+ * c_rarg2 - int length
+ *
+ * Ouput:
+ * rax - int crc result
+ */
+ address generate_updateBytesCRC32() {
+ assert(UseCRC32Intrinsics, "need AVX and CLMUL instructions");
+ __ align(CodeEntryAlignment);
+ StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32");
+
+ address start = __ pc();
+ // Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
+ // Unix: rdi, rsi, rdx, rcx, r8, r9 (c_rarg0, c_rarg1, ...)
+ // rscratch1: r10
+ const Register crc = c_rarg0; // crc
+ const Register buf = c_rarg1; // source java byte array address
+ const Register len = c_rarg2; // length
+ const Register table = c_rarg3; // crc_table address (reuse register)
+ const Register tmp = r11;
+ assert_different_registers(crc, buf, len, table, tmp, rax);
+
+ BLOCK_COMMENT("Entry:");
+ __ enter(); // required for proper stackwalking of RuntimeStub frame
+
+ __ kernel_crc32(crc, buf, len, table, tmp);
+
+ __ movl(rax, crc);
+ __ leave(); // required for proper stackwalking of RuntimeStub frame
+ __ ret(0);
+
+ return start;
+ }
#undef __
#define __ masm->
@@ -3736,6 +3774,11 @@ class StubGenerator: public StubCodeGenerator {
CAST_FROM_FN_PTR(address,
SharedRuntime::
throw_StackOverflowError));
+ if (UseCRC32Intrinsics) {
+ // set table address before stub generation which use it
+ StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table;
+ StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32();
+ }
}
void generate_all() {
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp
new file mode 100644
index 00000000000..200f2aff80d
--- /dev/null
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 "runtime/deoptimization.hpp"
+#include "runtime/frame.inline.hpp"
+#include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
+
+// Implementation of the platform-specific part of StubRoutines - for
+// a description of how to extend it, see the stubRoutines.hpp file.
+
+address StubRoutines::x86::_verify_mxcsr_entry = NULL;
+address StubRoutines::x86::_key_shuffle_mask_addr = NULL;
+
+uint64_t StubRoutines::x86::_crc_by128_masks[] =
+{
+ /* The fields in this structure are arranged so that they can be
+ * picked up two at a time with 128-bit loads.
+ *
+ * Because of flipped bit order for this CRC polynomials
+ * the constant for X**N is left-shifted by 1. This is because
+ * a 64 x 64 polynomial multiply produces a 127-bit result
+ * but the highest term is always aligned to bit 0 in the container.
+ * Pre-shifting by one fixes this, at the cost of potentially making
+ * the 32-bit constant no longer fit in a 32-bit container (thus the
+ * use of uint64_t, though this is also the size used by the carry-
+ * less multiply instruction.
+ *
+ * In addition, the flipped bit order and highest-term-at-least-bit
+ * multiply changes the constants used. The 96-bit result will be
+ * aligned to the high-term end of the target 128-bit container,
+ * not the low-term end; that is, instead of a 512-bit or 576-bit fold,
+ * instead it is a 480 (=512-32) or 544 (=512+64-32) bit fold.
+ *
+ * This cause additional problems in the 128-to-64-bit reduction; see the
+ * code for details. By storing a mask in the otherwise unused half of
+ * a 128-bit constant, bits can be cleared before multiplication without
+ * storing and reloading. Note that staying on a 128-bit datapath means
+ * that some data is uselessly stored and some unused data is intersected
+ * with an irrelevant constant.
+ */
+
+ ((uint64_t) 0xffffffffUL), /* low of K_M_64 */
+ ((uint64_t) 0xb1e6b092U << 1), /* high of K_M_64 */
+ ((uint64_t) 0xba8ccbe8U << 1), /* low of K_160_96 */
+ ((uint64_t) 0x6655004fU << 1), /* high of K_160_96 */
+ ((uint64_t) 0xaa2215eaU << 1), /* low of K_544_480 */
+ ((uint64_t) 0xe3720acbU << 1) /* high of K_544_480 */
+};
+
+/**
+ * crc_table[] from jdk/src/share/native/java/util/zip/zlib-1.2.5/crc32.h
+ */
+juint StubRoutines::x86::_crc_table[] =
+{
+ 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
+ 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
+ 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
+ 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
+ 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
+ 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
+ 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
+ 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
+ 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
+ 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
+ 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
+ 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
+ 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
+ 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
+ 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
+ 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
+ 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
+ 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
+ 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
+ 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
+ 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
+ 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
+ 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
+ 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
+ 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
+ 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
+ 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
+ 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
+ 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
+ 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
+ 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
+ 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
+ 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
+ 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
+ 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
+ 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
+ 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
+ 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
+ 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
+ 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
+ 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
+ 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
+ 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
+ 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
+ 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
+ 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
+ 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
+ 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
+ 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
+ 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
+ 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
+ 0x2d02ef8dUL
+};
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp
new file mode 100644
index 00000000000..d8e52ab3b11
--- /dev/null
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 CPU_X86_VM_STUBROUTINES_X86_HPP
+#define CPU_X86_VM_STUBROUTINES_X86_HPP
+
+// This file holds the platform specific parts of the StubRoutines
+// definition. See stubRoutines.hpp for a description on how to
+// extend it.
+
+ private:
+ static address _verify_mxcsr_entry;
+ // shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers
+ static address _key_shuffle_mask_addr;
+ // masks and table for CRC32
+ static uint64_t _crc_by128_masks[];
+ static juint _crc_table[];
+
+ public:
+ static address verify_mxcsr_entry() { return _verify_mxcsr_entry; }
+ static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; }
+ static address crc_by128_masks_addr() { return (address)_crc_by128_masks; }
+
+#endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp
index 65e773ed53c..53464dcccdf 100644
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -31,6 +31,4 @@
// Implementation of the platform-specific part of StubRoutines - for
// a description of how to extend it, see the stubRoutines.hpp file.
-address StubRoutines::x86::_verify_mxcsr_entry = NULL;
address StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = NULL;
-address StubRoutines::x86::_key_shuffle_mask_addr = NULL;
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp
index d53124fc6c8..bca5d493ce4 100644
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -39,15 +39,12 @@ class x86 {
friend class VMStructs;
private:
- static address _verify_mxcsr_entry;
static address _verify_fpu_cntrl_wrd_entry;
- // shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers
- static address _key_shuffle_mask_addr;
public:
- static address verify_mxcsr_entry() { return _verify_mxcsr_entry; }
static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; }
- static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; }
+
+# include "stubRoutines_x86.hpp"
};
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp
index 9f0a94200a5..5c11734cc97 100644
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -34,8 +34,6 @@
address StubRoutines::x86::_get_previous_fp_entry = NULL;
address StubRoutines::x86::_get_previous_sp_entry = NULL;
-address StubRoutines::x86::_verify_mxcsr_entry = NULL;
-
address StubRoutines::x86::_f2i_fixup = NULL;
address StubRoutines::x86::_f2l_fixup = NULL;
address StubRoutines::x86::_d2i_fixup = NULL;
@@ -45,4 +43,3 @@ address StubRoutines::x86::_float_sign_flip = NULL;
address StubRoutines::x86::_double_sign_mask = NULL;
address StubRoutines::x86::_double_sign_flip = NULL;
address StubRoutines::x86::_mxcsr_std = NULL;
-address StubRoutines::x86::_key_shuffle_mask_addr = NULL;
diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp
index c3efeecb759..d63e9fdf57f 100644
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -42,7 +42,6 @@ class x86 {
private:
static address _get_previous_fp_entry;
static address _get_previous_sp_entry;
- static address _verify_mxcsr_entry;
static address _f2i_fixup;
static address _f2l_fixup;
@@ -54,8 +53,6 @@ class x86 {
static address _double_sign_mask;
static address _double_sign_flip;
static address _mxcsr_std;
- // shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers
- static address _key_shuffle_mask_addr;
public:
@@ -69,11 +66,6 @@ class x86 {
return _get_previous_sp_entry;
}
- static address verify_mxcsr_entry()
- {
- return _verify_mxcsr_entry;
- }
-
static address f2i_fixup()
{
return _f2i_fixup;
@@ -119,7 +111,7 @@ class x86 {
return _mxcsr_std;
}
- static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; }
+# include "stubRoutines_x86.hpp"
};
diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
index 3908a8c09da..2efa59f8b33 100644
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
@@ -868,6 +868,120 @@ address InterpreterGenerator::generate_Reference_get_entry(void) {
return generate_accessor_entry();
}
+/**
+ * Method entry for static native methods:
+ * int java.util.zip.CRC32.update(int crc, int b)
+ */
+address InterpreterGenerator::generate_CRC32_update_entry() {
+ if (UseCRC32Intrinsics) {
+ address entry = __ pc();
+
+ // rbx,: Method*
+ // rsi: senderSP must preserved for slow path, set SP to it on fast path
+ // rdx: scratch
+ // rdi: scratch
+
+ Label slow_path;
+ // If we need a safepoint check, generate full interpreter entry.
+ ExternalAddress state(SafepointSynchronize::address_of_state());
+ __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
+ SafepointSynchronize::_not_synchronized);
+ __ jcc(Assembler::notEqual, slow_path);
+
+ // We don't generate local frame and don't align stack because
+ // we call stub code and there is no safepoint on this path.
+
+ // Load parameters
+ const Register crc = rax; // crc
+ const Register val = rdx; // source java byte value
+ const Register tbl = rdi; // scratch
+
+ // Arguments are reversed on java expression stack
+ __ movl(val, Address(rsp, wordSize)); // byte value
+ __ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC
+
+ __ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr()));
+ __ notl(crc); // ~crc
+ __ update_byte_crc32(crc, val, tbl);
+ __ notl(crc); // ~crc
+ // result in rax
+
+ // _areturn
+ __ pop(rdi); // get return address
+ __ mov(rsp, rsi); // set sp to sender sp
+ __ jmp(rdi);
+
+ // generate a vanilla native entry as the slow path
+ __ bind(slow_path);
+
+ (void) generate_native_entry(false);
+
+ return entry;
+ }
+ return generate_native_entry(false);
+}
+
+/**
+ * Method entry for static native methods:
+ * int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len)
+ * int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
+ */
+address InterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
+ if (UseCRC32Intrinsics) {
+ address entry = __ pc();
+
+ // rbx,: Method*
+ // rsi: senderSP must preserved for slow path, set SP to it on fast path
+ // rdx: scratch
+ // rdi: scratch
+
+ Label slow_path;
+ // If we need a safepoint check, generate full interpreter entry.
+ ExternalAddress state(SafepointSynchronize::address_of_state());
+ __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
+ SafepointSynchronize::_not_synchronized);
+ __ jcc(Assembler::notEqual, slow_path);
+
+ // We don't generate local frame and don't align stack because
+ // we call stub code and there is no safepoint on this path.
+
+ // Load parameters
+ const Register crc = rax; // crc
+ const Register buf = rdx; // source java byte array address
+ const Register len = rdi; // length
+
+ // Arguments are reversed on java expression stack
+ __ movl(len, Address(rsp, wordSize)); // Length
+ // Calculate address of start element
+ if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
+ __ movptr(buf, Address(rsp, 3*wordSize)); // long buf
+ __ addptr(buf, Address(rsp, 2*wordSize)); // + offset
+ __ movl(crc, Address(rsp, 5*wordSize)); // Initial CRC
+ } else {
+ __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array
+ __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
+ __ addptr(buf, Address(rsp, 2*wordSize)); // + offset
+ __ movl(crc, Address(rsp, 4*wordSize)); // Initial CRC
+ }
+
+ __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
+ // result in rax
+
+ // _areturn
+ __ pop(rdi); // get return address
+ __ mov(rsp, rsi); // set sp to sender sp
+ __ jmp(rdi);
+
+ // generate a vanilla native entry as the slow path
+ __ bind(slow_path);
+
+ (void) generate_native_entry(false);
+
+ return entry;
+ }
+ return generate_native_entry(false);
+}
+
//
// Interpreter stub for calling a native method. (asm interpreter)
// This sets up a somewhat different looking stack for calling the native method
@@ -1501,15 +1615,16 @@ address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter:
// determine code generation flags
bool synchronized = false;
address entry_point = NULL;
+ InterpreterGenerator* ig_this = (InterpreterGenerator*)this;
switch (kind) {
- case Interpreter::zerolocals : break;
- case Interpreter::zerolocals_synchronized: synchronized = true; break;
- case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break;
- case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break;
- case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break;
- case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break;
- case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break;
+ case Interpreter::zerolocals : break;
+ case Interpreter::zerolocals_synchronized: synchronized = true; break;
+ case Interpreter::native : entry_point = ig_this->generate_native_entry(false); break;
+ case Interpreter::native_synchronized : entry_point = ig_this->generate_native_entry(true); break;
+ case Interpreter::empty : entry_point = ig_this->generate_empty_entry(); break;
+ case Interpreter::accessor : entry_point = ig_this->generate_accessor_entry(); break;
+ case Interpreter::abstract : entry_point = ig_this->generate_abstract_entry(); break;
case Interpreter::java_lang_math_sin : // fall thru
case Interpreter::java_lang_math_cos : // fall thru
@@ -1519,9 +1634,15 @@ address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter:
case Interpreter::java_lang_math_log10 : // fall thru
case Interpreter::java_lang_math_sqrt : // fall thru
case Interpreter::java_lang_math_pow : // fall thru
- case Interpreter::java_lang_math_exp : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break;
+ case Interpreter::java_lang_math_exp : entry_point = ig_this->generate_math_entry(kind); break;
case Interpreter::java_lang_ref_reference_get
- : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
+ : entry_point = ig_this->generate_Reference_get_entry(); break;
+ case Interpreter::java_util_zip_CRC32_update
+ : entry_point = ig_this->generate_CRC32_update_entry(); break;
+ case Interpreter::java_util_zip_CRC32_updateBytes
+ : // fall thru
+ case Interpreter::java_util_zip_CRC32_updateByteBuffer
+ : entry_point = ig_this->generate_CRC32_updateBytes_entry(kind); break;
default:
fatal(err_msg("unexpected method kind: %d", kind));
break;
@@ -1529,7 +1650,7 @@ address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter:
if (entry_point) return entry_point;
- return ((InterpreterGenerator*)this)->generate_normal_entry(synchronized);
+ return ig_this->generate_normal_entry(synchronized);
}
diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
index 50bb8a968f6..f0a2258a70e 100644
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
@@ -840,6 +840,117 @@ address InterpreterGenerator::generate_Reference_get_entry(void) {
return generate_accessor_entry();
}
+/**
+ * Method entry for static native methods:
+ * int java.util.zip.CRC32.update(int crc, int b)
+ */
+address InterpreterGenerator::generate_CRC32_update_entry() {
+ if (UseCRC32Intrinsics) {
+ address entry = __ pc();
+
+ // rbx,: Method*
+ // rsi: senderSP must preserved for slow path, set SP to it on fast path
+ // rdx: scratch
+ // rdi: scratch
+
+ Label slow_path;
+ // If we need a safepoint check, generate full interpreter entry.
+ ExternalAddress state(SafepointSynchronize::address_of_state());
+ __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
+ SafepointSynchronize::_not_synchronized);
+ __ jcc(Assembler::notEqual, slow_path);
+
+ // We don't generate local frame and don't align stack because
+ // we call stub code and there is no safepoint on this path.
+
+ // Load parameters
+ const Register crc = rax; // crc
+ const Register val = rdx; // source java byte value
+ const Register tbl = rdi; // scratch
+
+ // Arguments are reversed on java expression stack
+ __ movl(val, Address(rsp, wordSize)); // byte value
+ __ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC
+
+ __ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr()));
+ __ notl(crc); // ~crc
+ __ update_byte_crc32(crc, val, tbl);
+ __ notl(crc); // ~crc
+ // result in rax
+
+ // _areturn
+ __ pop(rdi); // get return address
+ __ mov(rsp, rsi); // set sp to sender sp
+ __ jmp(rdi);
+
+ // generate a vanilla native entry as the slow path
+ __ bind(slow_path);
+
+ (void) generate_native_entry(false);
+
+ return entry;
+ }
+ return generate_native_entry(false);
+}
+
+/**
+ * Method entry for static native methods:
+ * int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len)
+ * int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
+ */
+address InterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
+ if (UseCRC32Intrinsics) {
+ address entry = __ pc();
+
+ // rbx,: Method*
+ // r13: senderSP must preserved for slow path, set SP to it on fast path
+
+ Label slow_path;
+ // If we need a safepoint check, generate full interpreter entry.
+ ExternalAddress state(SafepointSynchronize::address_of_state());
+ __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
+ SafepointSynchronize::_not_synchronized);
+ __ jcc(Assembler::notEqual, slow_path);
+
+ // We don't generate local frame and don't align stack because
+ // we call stub code and there is no safepoint on this path.
+
+ // Load parameters
+ const Register crc = c_rarg0; // crc
+ const Register buf = c_rarg1; // source java byte array address
+ const Register len = c_rarg2; // length
+
+ // Arguments are reversed on java expression stack
+ __ movl(len, Address(rsp, wordSize)); // Length
+ // Calculate address of start element
+ if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
+ __ movptr(buf, Address(rsp, 3*wordSize)); // long buf
+ __ addptr(buf, Address(rsp, 2*wordSize)); // + offset
+ __ movl(crc, Address(rsp, 5*wordSize)); // Initial CRC
+ } else {
+ __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array
+ __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
+ __ addptr(buf, Address(rsp, 2*wordSize)); // + offset
+ __ movl(crc, Address(rsp, 4*wordSize)); // Initial CRC
+ }
+
+ __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
+ // result in rax
+
+ // _areturn
+ __ pop(rdi); // get return address
+ __ mov(rsp, r13); // set sp to sender sp
+ __ jmp(rdi);
+
+ // generate a vanilla native entry as the slow path
+ __ bind(slow_path);
+
+ (void) generate_native_entry(false);
+
+ return entry;
+ }
+ return generate_native_entry(false);
+}
// Interpreter stub for calling a native method. (asm interpreter)
// This sets up a somewhat different looking stack for calling the
@@ -1510,15 +1621,16 @@ address AbstractInterpreterGenerator::generate_method_entry(
// determine code generation flags
bool synchronized = false;
address entry_point = NULL;
+ InterpreterGenerator* ig_this = (InterpreterGenerator*)this;
switch (kind) {
- case Interpreter::zerolocals : break;
- case Interpreter::zerolocals_synchronized: synchronized = true; break;
- case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break;
- case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break;
- case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break;
- case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break;
- case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break;
+ case Interpreter::zerolocals : break;
+ case Interpreter::zerolocals_synchronized: synchronized = true; break;
+ case Interpreter::native : entry_point = ig_this->generate_native_entry(false); break;
+ case Interpreter::native_synchronized : entry_point = ig_this->generate_native_entry(true); break;
+ case Interpreter::empty : entry_point = ig_this->generate_empty_entry(); break;
+ case Interpreter::accessor : entry_point = ig_this->generate_accessor_entry(); break;
+ case Interpreter::abstract : entry_point = ig_this->generate_abstract_entry(); break;
case Interpreter::java_lang_math_sin : // fall thru
case Interpreter::java_lang_math_cos : // fall thru
@@ -1528,9 +1640,15 @@ address AbstractInterpreterGenerator::generate_method_entry(
case Interpreter::java_lang_math_log10 : // fall thru
case Interpreter::java_lang_math_sqrt : // fall thru
case Interpreter::java_lang_math_pow : // fall thru
- case Interpreter::java_lang_math_exp : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break;
+ case Interpreter::java_lang_math_exp : entry_point = ig_this->generate_math_entry(kind); break;
case Interpreter::java_lang_ref_reference_get
- : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
+ : entry_point = ig_this->generate_Reference_get_entry(); break;
+ case Interpreter::java_util_zip_CRC32_update
+ : entry_point = ig_this->generate_CRC32_update_entry(); break;
+ case Interpreter::java_util_zip_CRC32_updateBytes
+ : // fall thru
+ case Interpreter::java_util_zip_CRC32_updateByteBuffer
+ : entry_point = ig_this->generate_CRC32_updateBytes_entry(kind); break;
default:
fatal(err_msg("unexpected method kind: %d", kind));
break;
@@ -1540,8 +1658,7 @@ address AbstractInterpreterGenerator::generate_method_entry(
return entry_point;
}
- return ((InterpreterGenerator*) this)->
- generate_normal_entry(synchronized);
+ return ig_this->generate_normal_entry(synchronized);
}
// These should never be compiled since the interpreter will prefer
diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
index 90066c1041a..de38b4a3a53 100644
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -446,6 +446,7 @@ void VM_Version::get_processor_features() {
(supports_avx() ? ", avx" : ""),
(supports_avx2() ? ", avx2" : ""),
(supports_aes() ? ", aes" : ""),
+ (supports_clmul() ? ", clmul" : ""),
(supports_erms() ? ", erms" : ""),
(supports_mmx_ext() ? ", mmxext" : ""),
(supports_3dnow_prefetch() ? ", 3dnowpref" : ""),
@@ -489,6 +490,27 @@ void VM_Version::get_processor_features() {
FLAG_SET_DEFAULT(UseAES, false);
}
+ // Use CLMUL instructions if available.
+ if (supports_clmul()) {
+ if (FLAG_IS_DEFAULT(UseCLMUL)) {
+ UseCLMUL = true;
+ }
+ } else if (UseCLMUL) {
+ if (!FLAG_IS_DEFAULT(UseCLMUL))
+ warning("CLMUL instructions not available on this CPU (AVX may also be required)");
+ FLAG_SET_DEFAULT(UseCLMUL, false);
+ }
+
+ if (UseCLMUL && (UseAVX > 0) && (UseSSE > 2)) {
+ if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
+ UseCRC32Intrinsics = true;
+ }
+ } else if (UseCRC32Intrinsics) {
+ if (!FLAG_IS_DEFAULT(UseCRC32Intrinsics))
+ warning("CRC32 Intrinsics requires AVX and CLMUL instructions (not available on this CPU)");
+ FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
+ }
+
// The AES intrinsic stubs require AES instruction support (of course)
// but also require sse3 mode for instructions it use.
if (UseAES && (UseSSE > 2)) {
diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp
index ec8caba23f0..86e9b662d52 100644
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -61,7 +61,8 @@ public:
uint32_t value;
struct {
uint32_t sse3 : 1,
- : 2,
+ clmul : 1,
+ : 1,
monitor : 1,
: 1,
vmx : 1,
@@ -249,7 +250,8 @@ protected:
CPU_AVX = (1 << 17),
CPU_AVX2 = (1 << 18),
CPU_AES = (1 << 19),
- CPU_ERMS = (1 << 20) // enhanced 'rep movsb/stosb' instructions
+ CPU_ERMS = (1 << 20), // enhanced 'rep movsb/stosb' instructions
+ CPU_CLMUL = (1 << 21) // carryless multiply for CRC
} cpuFeatureFlags;
enum {
@@ -429,6 +431,8 @@ protected:
result |= CPU_AES;
if (_cpuid_info.sef_cpuid7_ebx.bits.erms != 0)
result |= CPU_ERMS;
+ if (_cpuid_info.std_cpuid1_ecx.bits.clmul != 0)
+ result |= CPU_CLMUL;
// AMD features.
if (is_amd()) {
@@ -555,6 +559,7 @@ public:
static bool supports_tsc() { return (_cpuFeatures & CPU_TSC) != 0; }
static bool supports_aes() { return (_cpuFeatures & CPU_AES) != 0; }
static bool supports_erms() { return (_cpuFeatures & CPU_ERMS) != 0; }
+ static bool supports_clmul() { return (_cpuFeatures & CPU_CLMUL) != 0; }
// Intel features
static bool is_intel_family_core() { return is_intel() &&
diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
index 8d7619eedd6..b84c8911e4c 100644
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -3461,6 +3461,14 @@ bool GraphBuilder::try_inline_intrinsics(ciMethod* callee) {
preserves_state = true;
break;
+ case vmIntrinsics::_updateCRC32:
+ case vmIntrinsics::_updateBytesCRC32:
+ case vmIntrinsics::_updateByteBufferCRC32:
+ if (!UseCRC32Intrinsics) return false;
+ cantrap = false;
+ preserves_state = true;
+ break;
+
case vmIntrinsics::_loadFence :
case vmIntrinsics::_storeFence:
case vmIntrinsics::_fullFence :
diff --git a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp
index e2611534ea1..cb0ceab90c0 100644
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp
@@ -430,6 +430,11 @@ LIR_OpArrayCopy::LIR_OpArrayCopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_
_stub = new ArrayCopyStub(this);
}
+LIR_OpUpdateCRC32::LIR_OpUpdateCRC32(LIR_Opr crc, LIR_Opr val, LIR_Opr res)
+ : LIR_Op(lir_updatecrc32, res, NULL)
+ , _crc(crc)
+ , _val(val) {
+}
//-------------------verify--------------------------
@@ -876,6 +881,20 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
}
+// LIR_OpUpdateCRC32
+ case lir_updatecrc32: {
+ assert(op->as_OpUpdateCRC32() != NULL, "must be");
+ LIR_OpUpdateCRC32* opUp = (LIR_OpUpdateCRC32*)op;
+
+ assert(opUp->_crc->is_valid(), "used"); do_input(opUp->_crc); do_temp(opUp->_crc);
+ assert(opUp->_val->is_valid(), "used"); do_input(opUp->_val); do_temp(opUp->_val);
+ assert(opUp->_result->is_valid(), "used"); do_output(opUp->_result);
+ assert(opUp->_info == NULL, "no info for LIR_OpUpdateCRC32");
+
+ break;
+ }
+
+
// LIR_OpLock
case lir_lock:
case lir_unlock: {
@@ -1056,6 +1075,10 @@ void LIR_OpArrayCopy::emit_code(LIR_Assembler* masm) {
masm->emit_code_stub(stub());
}
+void LIR_OpUpdateCRC32::emit_code(LIR_Assembler* masm) {
+ masm->emit_updatecrc32(this);
+}
+
void LIR_Op0::emit_code(LIR_Assembler* masm) {
masm->emit_op0(this);
}
@@ -1763,6 +1786,8 @@ const char * LIR_Op::name() const {
case lir_dynamic_call: s = "dynamic"; break;
// LIR_OpArrayCopy
case lir_arraycopy: s = "arraycopy"; break;
+ // LIR_OpUpdateCRC32
+ case lir_updatecrc32: s = "updatecrc32"; break;
// LIR_OpLock
case lir_lock: s = "lock"; break;
case lir_unlock: s = "unlock"; break;
@@ -1815,6 +1840,13 @@ void LIR_OpArrayCopy::print_instr(outputStream* out) const {
tmp()->print(out); out->print(" ");
}
+// LIR_OpUpdateCRC32
+void LIR_OpUpdateCRC32::print_instr(outputStream* out) const {
+ crc()->print(out); out->print(" ");
+ val()->print(out); out->print(" ");
+ result_opr()->print(out); out->print(" ");
+}
+
// LIR_OpCompareAndSwap
void LIR_OpCompareAndSwap::print_instr(outputStream* out) const {
addr()->print(out); out->print(" ");
diff --git a/hotspot/src/share/vm/c1/c1_LIR.hpp b/hotspot/src/share/vm/c1/c1_LIR.hpp
index 61dd59e3fe9..fab85e5750f 100644
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -877,6 +877,7 @@ class LIR_OpCall;
class LIR_OpJavaCall;
class LIR_OpRTCall;
class LIR_OpArrayCopy;
+class LIR_OpUpdateCRC32;
class LIR_OpLock;
class LIR_OpTypeCheck;
class LIR_OpCompareAndSwap;
@@ -982,6 +983,9 @@ enum LIR_Code {
, begin_opArrayCopy
, lir_arraycopy
, end_opArrayCopy
+ , begin_opUpdateCRC32
+ , lir_updatecrc32
+ , end_opUpdateCRC32
, begin_opLock
, lir_lock
, lir_unlock
@@ -1137,6 +1141,7 @@ class LIR_Op: public CompilationResourceObj {
virtual LIR_Op2* as_Op2() { return NULL; }
virtual LIR_Op3* as_Op3() { return NULL; }
virtual LIR_OpArrayCopy* as_OpArrayCopy() { return NULL; }
+ virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return NULL; }
virtual LIR_OpTypeCheck* as_OpTypeCheck() { return NULL; }
virtual LIR_OpCompareAndSwap* as_OpCompareAndSwap() { return NULL; }
virtual LIR_OpProfileCall* as_OpProfileCall() { return NULL; }
@@ -1293,6 +1298,25 @@ public:
void print_instr(outputStream* out) const PRODUCT_RETURN;
};
+// LIR_OpUpdateCRC32
+class LIR_OpUpdateCRC32: public LIR_Op {
+ friend class LIR_OpVisitState;
+
+private:
+ LIR_Opr _crc;
+ LIR_Opr _val;
+
+public:
+
+ LIR_OpUpdateCRC32(LIR_Opr crc, LIR_Opr val, LIR_Opr res);
+
+ LIR_Opr crc() const { return _crc; }
+ LIR_Opr val() const { return _val; }
+
+ virtual void emit_code(LIR_Assembler* masm);
+ virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return this; }
+ void print_instr(outputStream* out) const PRODUCT_RETURN;
+};
// --------------------------------------------------
// LIR_Op0
@@ -2212,6 +2236,8 @@ class LIR_List: public CompilationResourceObj {
void arraycopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_Opr dst_pos, LIR_Opr length, LIR_Opr tmp, ciArrayKlass* expected_type, int flags, CodeEmitInfo* info) { append(new LIR_OpArrayCopy(src, src_pos, dst, dst_pos, length, tmp, expected_type, flags, info)); }
+ void update_crc32(LIR_Opr crc, LIR_Opr val, LIR_Opr res) { append(new LIR_OpUpdateCRC32(crc, val, res)); }
+
void fpop_raw() { append(new LIR_Op0(lir_fpop_raw)); }
void instanceof(LIR_Opr result, LIR_Opr object, ciKlass* klass, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check, CodeEmitInfo* info_for_patch, ciMethod* profiled_method, int profiled_bci);
diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
index 87dd8dbae15..4ced297c07b 100644
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -195,6 +195,7 @@ class LIR_Assembler: public CompilationResourceObj {
void emit_opBranch(LIR_OpBranch* op);
void emit_opLabel(LIR_OpLabel* op);
void emit_arraycopy(LIR_OpArrayCopy* op);
+ void emit_updatecrc32(LIR_OpUpdateCRC32* op);
void emit_opConvert(LIR_OpConvert* op);
void emit_alloc_obj(LIR_OpAllocObj* op);
void emit_alloc_array(LIR_OpAllocArray* op);
diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
index fcd6910ed95..3af2d23b7d6 100644
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
@@ -2994,6 +2994,12 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) {
do_Reference_get(x);
break;
+ case vmIntrinsics::_updateCRC32:
+ case vmIntrinsics::_updateBytesCRC32:
+ case vmIntrinsics::_updateByteBufferCRC32:
+ do_update_CRC32(x);
+ break;
+
default: ShouldNotReachHere(); break;
}
}
diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
index d3c76865dbd..0a029207308 100644
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -247,6 +247,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
void do_NIOCheckIndex(Intrinsic* x);
void do_FPIntrinsics(Intrinsic* x);
void do_Reference_get(Intrinsic* x);
+ void do_update_CRC32(Intrinsic* x);
void do_UnsafePrefetch(UnsafePrefetch* x, bool is_store);
diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp
index 53d1f5326a8..908571f6cc4 100644
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp
@@ -299,6 +299,7 @@ const char* Runtime1::name_for_address(address entry) {
#ifdef TRACE_HAVE_INTRINSICS
FUNCTION_CASE(entry, TRACE_TIME_METHOD);
#endif
+ FUNCTION_CASE(entry, StubRoutines::updateBytesCRC32());
#undef FUNCTION_CASE
diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp
index 49def1e8d26..7ec43bd7e86 100644
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp
@@ -771,6 +771,17 @@
do_name( decrypt_name, "decrypt") \
do_signature(byteArray_int_int_byteArray_int_signature, "([BII[BI)V") \
\
+ /* support for java.util.zip */ \
+ do_class(java_util_zip_CRC32, "java/util/zip/CRC32") \
+ do_intrinsic(_updateCRC32, java_util_zip_CRC32, update_name, int2_int_signature, F_SN) \
+ do_name( update_name, "update") \
+ do_intrinsic(_updateBytesCRC32, java_util_zip_CRC32, updateBytes_name, updateBytes_signature, F_SN) \
+ do_name( updateBytes_name, "updateBytes") \
+ do_signature(updateBytes_signature, "(I[BII)I") \
+ do_intrinsic(_updateByteBufferCRC32, java_util_zip_CRC32, updateByteBuffer_name, updateByteBuffer_signature, F_SN) \
+ do_name( updateByteBuffer_name, "updateByteBuffer") \
+ do_signature(updateByteBuffer_signature, "(IJII)I") \
+ \
/* support for sun.misc.Unsafe */ \
do_class(sun_misc_Unsafe, "sun/misc/Unsafe") \
\
diff --git a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
index 264d4fffbf6..77471ad3d5f 100644
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -102,6 +102,9 @@ class AbstractInterpreter: AllStatic {
java_lang_math_pow, // implementation of java.lang.Math.pow (x,y)
java_lang_math_exp, // implementation of java.lang.Math.exp (x)
java_lang_ref_reference_get, // implementation of java.lang.ref.Reference.get()
+ java_util_zip_CRC32_update, // implementation of java.util.zip.CRC32.update()
+ java_util_zip_CRC32_updateBytes, // implementation of java.util.zip.CRC32.updateBytes()
+ java_util_zip_CRC32_updateByteBuffer, // implementation of java.util.zip.CRC32.updateByteBuffer()
number_of_method_entries,
invalid = -1
};
diff --git a/hotspot/src/share/vm/interpreter/interpreter.cpp b/hotspot/src/share/vm/interpreter/interpreter.cpp
index 06554172bf1..dfd8b5b145a 100644
--- a/hotspot/src/share/vm/interpreter/interpreter.cpp
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -195,6 +195,17 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(methodHandle m)
return kind;
}
+#ifndef CC_INTERP
+ if (UseCRC32Intrinsics && m->is_native()) {
+ // Use optimized stub code for CRC32 native methods.
+ switch (m->intrinsic_id()) {
+ case vmIntrinsics::_updateCRC32 : return java_util_zip_CRC32_update;
+ case vmIntrinsics::_updateBytesCRC32 : return java_util_zip_CRC32_updateBytes;
+ case vmIntrinsics::_updateByteBufferCRC32 : return java_util_zip_CRC32_updateByteBuffer;
+ }
+ }
+#endif
+
// Native method?
// Note: This test must come _before_ the test for intrinsic
// methods. See also comments below.
@@ -297,6 +308,9 @@ void AbstractInterpreter::print_method_kind(MethodKind kind) {
case java_lang_math_sqrt : tty->print("java_lang_math_sqrt" ); break;
case java_lang_math_log : tty->print("java_lang_math_log" ); break;
case java_lang_math_log10 : tty->print("java_lang_math_log10" ); break;
+ case java_util_zip_CRC32_update : tty->print("java_util_zip_CRC32_update"); break;
+ case java_util_zip_CRC32_updateBytes : tty->print("java_util_zip_CRC32_updateBytes"); break;
+ case java_util_zip_CRC32_updateByteBuffer : tty->print("java_util_zip_CRC32_updateByteBuffer"); break;
default:
if (kind >= method_handle_invoke_FIRST &&
kind <= method_handle_invoke_LAST) {
diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp
index 53e50b1c7fe..9f7ed4c7e97 100644
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -373,6 +373,12 @@ void TemplateInterpreterGenerator::generate_all() {
method_entry(java_lang_math_pow )
method_entry(java_lang_ref_reference_get)
+ if (UseCRC32Intrinsics) {
+ method_entry(java_util_zip_CRC32_update)
+ method_entry(java_util_zip_CRC32_updateBytes)
+ method_entry(java_util_zip_CRC32_updateByteBuffer)
+ }
+
initialize_method_handle_entries();
// all native method kinds (must be one contiguous block)
diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp
index fd561a0c20c..c95226f110c 100644
--- a/hotspot/src/share/vm/opto/escape.cpp
+++ b/hotspot/src/share/vm/opto/escape.cpp
@@ -933,6 +933,7 @@ void ConnectionGraph::process_call_arguments(CallNode *call) {
(call->as_CallLeaf()->_name != NULL &&
(strcmp(call->as_CallLeaf()->_name, "g1_wb_pre") == 0 ||
strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 ||
+ strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||
strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 ||
strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 ||
strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 ||
diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index 728d892534b..df84634832a 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -291,6 +291,9 @@ class LibraryCallKit : public GraphKit {
Node* inline_cipherBlockChaining_AESCrypt_predicate(bool decrypting);
Node* get_key_start_from_aescrypt_object(Node* aescrypt_object);
bool inline_encodeISOArray();
+ bool inline_updateCRC32();
+ bool inline_updateBytesCRC32();
+ bool inline_updateByteBufferCRC32();
};
@@ -488,6 +491,12 @@ CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
is_predicted = true;
break;
+ case vmIntrinsics::_updateCRC32:
+ case vmIntrinsics::_updateBytesCRC32:
+ case vmIntrinsics::_updateByteBufferCRC32:
+ if (!UseCRC32Intrinsics) return NULL;
+ break;
+
default:
assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility");
assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?");
@@ -807,6 +816,13 @@ bool LibraryCallKit::try_to_inline() {
case vmIntrinsics::_encodeISOArray:
return inline_encodeISOArray();
+ case vmIntrinsics::_updateCRC32:
+ return inline_updateCRC32();
+ case vmIntrinsics::_updateBytesCRC32:
+ return inline_updateBytesCRC32();
+ case vmIntrinsics::_updateByteBufferCRC32:
+ return inline_updateByteBufferCRC32();
+
default:
// If you get here, it may be that someone has added a new intrinsic
// to the list in vmSymbols.hpp without implementing it here.
@@ -884,7 +900,7 @@ Node* LibraryCallKit::generate_guard(Node* test, RegionNode* region, float true_
IfNode* iff = create_and_map_if(control(), test, true_prob, COUNT_UNKNOWN);
- Node* if_slow = _gvn.transform( new (C) IfTrueNode(iff) );
+ Node* if_slow = _gvn.transform(new (C) IfTrueNode(iff));
if (if_slow == top()) {
// The slow branch is never taken. No need to build this guard.
return NULL;
@@ -893,7 +909,7 @@ Node* LibraryCallKit::generate_guard(Node* test, RegionNode* region, float true_
if (region != NULL)
region->add_req(if_slow);
- Node* if_fast = _gvn.transform( new (C) IfFalseNode(iff) );
+ Node* if_fast = _gvn.transform(new (C) IfFalseNode(iff));
set_control(if_fast);
return if_slow;
@@ -912,8 +928,8 @@ inline Node* LibraryCallKit::generate_negative_guard(Node* index, RegionNode* re
return NULL; // already stopped
if (_gvn.type(index)->higher_equal(TypeInt::POS)) // [0,maxint]
return NULL; // index is already adequately typed
- Node* cmp_lt = _gvn.transform( new (C) CmpINode(index, intcon(0)) );
- Node* bol_lt = _gvn.transform( new (C) BoolNode(cmp_lt, BoolTest::lt) );
+ Node* cmp_lt = _gvn.transform(new (C) CmpINode(index, intcon(0)));
+ Node* bol_lt = _gvn.transform(new (C) BoolNode(cmp_lt, BoolTest::lt));
Node* is_neg = generate_guard(bol_lt, region, PROB_MIN);
if (is_neg != NULL && pos_index != NULL) {
// Emulate effect of Parse::adjust_map_after_if.
@@ -930,9 +946,9 @@ inline Node* LibraryCallKit::generate_nonpositive_guard(Node* index, bool never_
return NULL; // already stopped
if (_gvn.type(index)->higher_equal(TypeInt::POS1)) // [1,maxint]
return NULL; // index is already adequately typed
- Node* cmp_le = _gvn.transform( new (C) CmpINode(index, intcon(0)) );
+ Node* cmp_le = _gvn.transform(new (C) CmpINode(index, intcon(0)));
BoolTest::mask le_or_eq = (never_negative ? BoolTest::eq : BoolTest::le);
- Node* bol_le = _gvn.transform( new (C) BoolNode(cmp_le, le_or_eq) );
+ Node* bol_le = _gvn.transform(new (C) BoolNode(cmp_le, le_or_eq));
Node* is_notp = generate_guard(bol_le, NULL, PROB_MIN);
if (is_notp != NULL && pos_index != NULL) {
// Emulate effect of Parse::adjust_map_after_if.
@@ -968,9 +984,9 @@ inline Node* LibraryCallKit::generate_limit_guard(Node* offset,
return NULL; // common case of whole-array copy
Node* last = subseq_length;
if (!zero_offset) // last += offset
- last = _gvn.transform( new (C) AddINode(last, offset));
- Node* cmp_lt = _gvn.transform( new (C) CmpUNode(array_length, last) );
- Node* bol_lt = _gvn.transform( new (C) BoolNode(cmp_lt, BoolTest::lt) );
+ last = _gvn.transform(new (C) AddINode(last, offset));
+ Node* cmp_lt = _gvn.transform(new (C) CmpUNode(array_length, last));
+ Node* bol_lt = _gvn.transform(new (C) BoolNode(cmp_lt, BoolTest::lt));
Node* is_over = generate_guard(bol_lt, region, PROB_MIN);
return is_over;
}
@@ -1151,8 +1167,8 @@ bool LibraryCallKit::inline_string_equals() {
Node* argument_cnt = load_String_length(no_ctrl, argument);
// Check for receiver count != argument count
- Node* cmp = _gvn.transform( new(C) CmpINode(receiver_cnt, argument_cnt) );
- Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::ne) );
+ Node* cmp = _gvn.transform(new(C) CmpINode(receiver_cnt, argument_cnt));
+ Node* bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::ne));
Node* if_ne = generate_slow_guard(bol, NULL);
if (if_ne != NULL) {
phi->init_req(4, intcon(0));
@@ -1258,7 +1274,7 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar
Node* sourceOffset = load_String_offset(no_ctrl, string_object);
Node* sourceCount = load_String_length(no_ctrl, string_object);
- Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) );
+ Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)));
jint target_length = target_array->length();
const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin));
const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot);
@@ -1365,8 +1381,8 @@ bool LibraryCallKit::inline_string_indexOf() {
Node* substr_cnt = load_String_length(no_ctrl, arg);
// Check for substr count > string count
- Node* cmp = _gvn.transform( new(C) CmpINode(substr_cnt, source_cnt) );
- Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::gt) );
+ Node* cmp = _gvn.transform(new(C) CmpINode(substr_cnt, source_cnt));
+ Node* bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::gt));
Node* if_gt = generate_slow_guard(bol, NULL);
if (if_gt != NULL) {
result_phi->init_req(2, intcon(-1));
@@ -1375,8 +1391,8 @@ bool LibraryCallKit::inline_string_indexOf() {
if (!stopped()) {
// Check for substr count == 0
- cmp = _gvn.transform( new(C) CmpINode(substr_cnt, intcon(0)) );
- bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::eq) );
+ cmp = _gvn.transform(new(C) CmpINode(substr_cnt, intcon(0)));
+ bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::eq));
Node* if_zero = generate_slow_guard(bol, NULL);
if (if_zero != NULL) {
result_phi->init_req(3, intcon(0));
@@ -1552,7 +1568,7 @@ bool LibraryCallKit::inline_trig(vmIntrinsics::ID id) {
// Check PI/4 : abs(arg)
Node *cmp = _gvn.transform(new (C) CmpDNode(pi4,abs));
// Check: If PI/4 < abs(arg) then go slow
- Node *bol = _gvn.transform( new (C) BoolNode( cmp, BoolTest::lt ) );
+ Node *bol = _gvn.transform(new (C) BoolNode( cmp, BoolTest::lt ));
// Branch either way
IfNode *iff = create_and_xform_if(control(),bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN);
set_control(opt_iff(r,iff));
@@ -1617,8 +1633,8 @@ void LibraryCallKit::finish_pow_exp(Node* result, Node* x, Node* y, const TypeFu
// to the runtime to properly handle corner cases
IfNode* iff = create_and_xform_if(control(), bolisnum, PROB_STATIC_FREQUENT, COUNT_UNKNOWN);
- Node* if_slow = _gvn.transform( new (C) IfFalseNode(iff) );
- Node* if_fast = _gvn.transform( new (C) IfTrueNode(iff) );
+ Node* if_slow = _gvn.transform(new (C) IfFalseNode(iff));
+ Node* if_fast = _gvn.transform(new (C) IfTrueNode(iff));
if (!if_slow->is_top()) {
RegionNode* result_region = new (C) RegionNode(3);
@@ -1704,42 +1720,42 @@ bool LibraryCallKit::inline_pow() {
// Check x:0
Node *cmp = _gvn.transform(new (C) CmpDNode(x, zeronode));
// Check: If (x<=0) then go complex path
- Node *bol1 = _gvn.transform( new (C) BoolNode( cmp, BoolTest::le ) );
+ Node *bol1 = _gvn.transform(new (C) BoolNode( cmp, BoolTest::le ));
// Branch either way
IfNode *if1 = create_and_xform_if(control(),bol1, PROB_STATIC_INFREQUENT, COUNT_UNKNOWN);
// Fast path taken; set region slot 3
- Node *fast_taken = _gvn.transform( new (C) IfFalseNode(if1) );
+ Node *fast_taken = _gvn.transform(new (C) IfFalseNode(if1));
r->init_req(3,fast_taken); // Capture fast-control
// Fast path not-taken, i.e. slow path
- Node *complex_path = _gvn.transform( new (C) IfTrueNode(if1) );
+ Node *complex_path = _gvn.transform(new (C) IfTrueNode(if1));
// Set fast path result
- Node *fast_result = _gvn.transform( new (C) PowDNode(C, control(), x, y) );
+ Node *fast_result = _gvn.transform(new (C) PowDNode(C, control(), x, y));
phi->init_req(3, fast_result);
// Complex path
// Build the second if node (if y is long)
// Node for (long)y
- Node *longy = _gvn.transform( new (C) ConvD2LNode(y));
+ Node *longy = _gvn.transform(new (C) ConvD2LNode(y));
// Node for (double)((long) y)
- Node *doublelongy= _gvn.transform( new (C) ConvL2DNode(longy));
+ Node *doublelongy= _gvn.transform(new (C) ConvL2DNode(longy));
// Check (double)((long) y) : y
Node *cmplongy= _gvn.transform(new (C) CmpDNode(doublelongy, y));
// Check if (y isn't long) then go to slow path
- Node *bol2 = _gvn.transform( new (C) BoolNode( cmplongy, BoolTest::ne ) );
+ Node *bol2 = _gvn.transform(new (C) BoolNode( cmplongy, BoolTest::ne ));
// Branch either way
IfNode *if2 = create_and_xform_if(complex_path,bol2, PROB_STATIC_INFREQUENT, COUNT_UNKNOWN);
- Node* ylong_path = _gvn.transform( new (C) IfFalseNode(if2));
+ Node* ylong_path = _gvn.transform(new (C) IfFalseNode(if2));
- Node *slow_path = _gvn.transform( new (C) IfTrueNode(if2) );
+ Node *slow_path = _gvn.transform(new (C) IfTrueNode(if2));
// Calculate DPow(abs(x), y)*(1 & (long)y)
// Node for constant 1
Node *conone = longcon(1);
// 1& (long)y
- Node *signnode= _gvn.transform( new (C) AndLNode(conone, longy) );
+ Node *signnode= _gvn.transform(new (C) AndLNode(conone, longy));
// A huge number is always even. Detect a huge number by checking
// if y + 1 == y and set integer to be tested for parity to 0.
@@ -1747,9 +1763,9 @@ bool LibraryCallKit::inline_pow() {
// (long)9.223372036854776E18 = max_jlong
// (double)(long)9.223372036854776E18 = 9.223372036854776E18
// max_jlong is odd but 9.223372036854776E18 is even
- Node* yplus1 = _gvn.transform( new (C) AddDNode(y, makecon(TypeD::make(1))));
+ Node* yplus1 = _gvn.transform(new (C) AddDNode(y, makecon(TypeD::make(1))));
Node *cmpyplus1= _gvn.transform(new (C) CmpDNode(yplus1, y));
- Node *bolyplus1 = _gvn.transform( new (C) BoolNode( cmpyplus1, BoolTest::eq ) );
+ Node *bolyplus1 = _gvn.transform(new (C) BoolNode( cmpyplus1, BoolTest::eq ));
Node* correctedsign = NULL;
if (ConditionalMoveLimit != 0) {
correctedsign = _gvn.transform( CMoveNode::make(C, NULL, bolyplus1, signnode, longcon(0), TypeLong::LONG));
@@ -1757,8 +1773,8 @@ bool LibraryCallKit::inline_pow() {
IfNode *ifyplus1 = create_and_xform_if(ylong_path,bolyplus1, PROB_FAIR, COUNT_UNKNOWN);
RegionNode *r = new (C) RegionNode(3);
Node *phi = new (C) PhiNode(r, TypeLong::LONG);
- r->init_req(1, _gvn.transform( new (C) IfFalseNode(ifyplus1)));
- r->init_req(2, _gvn.transform( new (C) IfTrueNode(ifyplus1)));
+ r->init_req(1, _gvn.transform(new (C) IfFalseNode(ifyplus1)));
+ r->init_req(2, _gvn.transform(new (C) IfTrueNode(ifyplus1)));
phi->init_req(1, signnode);
phi->init_req(2, longcon(0));
correctedsign = _gvn.transform(phi);
@@ -1771,11 +1787,11 @@ bool LibraryCallKit::inline_pow() {
// Check (1&(long)y)==0?
Node *cmpeq1 = _gvn.transform(new (C) CmpLNode(correctedsign, conzero));
// Check if (1&(long)y)!=0?, if so the result is negative
- Node *bol3 = _gvn.transform( new (C) BoolNode( cmpeq1, BoolTest::ne ) );
+ Node *bol3 = _gvn.transform(new (C) BoolNode( cmpeq1, BoolTest::ne ));
// abs(x)
- Node *absx=_gvn.transform( new (C) AbsDNode(x));
+ Node *absx=_gvn.transform(new (C) AbsDNode(x));
// abs(x)^y
- Node *absxpowy = _gvn.transform( new (C) PowDNode(C, control(), absx, y) );
+ Node *absxpowy = _gvn.transform(new (C) PowDNode(C, control(), absx, y));
// -abs(x)^y
Node *negabsxpowy = _gvn.transform(new (C) NegDNode (absxpowy));
// (1&(long)y)==1?-DPow(abs(x), y):DPow(abs(x), y)
@@ -1786,8 +1802,8 @@ bool LibraryCallKit::inline_pow() {
IfNode *ifyeven = create_and_xform_if(ylong_path,bol3, PROB_FAIR, COUNT_UNKNOWN);
RegionNode *r = new (C) RegionNode(3);
Node *phi = new (C) PhiNode(r, Type::DOUBLE);
- r->init_req(1, _gvn.transform( new (C) IfFalseNode(ifyeven)));
- r->init_req(2, _gvn.transform( new (C) IfTrueNode(ifyeven)));
+ r->init_req(1, _gvn.transform(new (C) IfFalseNode(ifyeven)));
+ r->init_req(2, _gvn.transform(new (C) IfTrueNode(ifyeven)));
phi->init_req(1, absxpowy);
phi->init_req(2, negabsxpowy);
signresult = _gvn.transform(phi);
@@ -1920,7 +1936,7 @@ LibraryCallKit::generate_min_max(vmIntrinsics::ID id, Node* x0, Node* y0) {
int cmp_op = Op_CmpI;
Node* xkey = xvalue;
Node* ykey = yvalue;
- Node* ideal_cmpxy = _gvn.transform( new(C) CmpINode(xkey, ykey) );
+ Node* ideal_cmpxy = _gvn.transform(new(C) CmpINode(xkey, ykey));
if (ideal_cmpxy->is_Cmp()) {
// E.g., if we have CmpI(length - offset, count),
// it might idealize to CmpI(length, count + offset)
@@ -2013,7 +2029,7 @@ LibraryCallKit::generate_min_max(vmIntrinsics::ID id, Node* x0, Node* y0) {
default:
if (cmpxy == NULL)
cmpxy = ideal_cmpxy;
- best_bol = _gvn.transform( new(C) BoolNode(cmpxy, BoolTest::lt) );
+ best_bol = _gvn.transform(new(C) BoolNode(cmpxy, BoolTest::lt));
// and fall through:
case BoolTest::lt: // x < y
case BoolTest::le: // x <= y
@@ -2073,7 +2089,7 @@ LibraryCallKit::classify_unsafe_addr(Node* &base, Node* &offset) {
return Type::AnyPtr;
} else if (base_type == TypePtr::NULL_PTR) {
// Since this is a NULL+long form, we have to switch to a rawptr.
- base = _gvn.transform( new (C) CastX2PNode(offset) );
+ base = _gvn.transform(new (C) CastX2PNode(offset));
offset = MakeConX(0);
return Type::RawPtr;
} else if (base_type->base() == Type::RawPtr) {
@@ -2467,7 +2483,7 @@ bool LibraryCallKit::inline_unsafe_access(bool is_native_ptr, bool is_store, Bas
case T_ADDRESS:
// Repackage the long as a pointer.
val = ConvL2X(val);
- val = _gvn.transform( new (C) CastX2PNode(val) );
+ val = _gvn.transform(new (C) CastX2PNode(val));
break;
}
@@ -2775,7 +2791,7 @@ bool LibraryCallKit::inline_unsafe_load_store(BasicType type, LoadStoreKind kind
// SCMemProjNodes represent the memory state of a LoadStore. Their
// main role is to prevent LoadStore nodes from being optimized away
// when their results aren't used.
- Node* proj = _gvn.transform( new (C) SCMemProjNode(load_store));
+ Node* proj = _gvn.transform(new (C) SCMemProjNode(load_store));
set_memory(proj, alias_idx);
// Add the trailing membar surrounding the access
@@ -3010,8 +3026,8 @@ bool LibraryCallKit::inline_native_isInterrupted() {
Node* rec_thr = argument(0);
Node* tls_ptr = NULL;
Node* cur_thr = generate_current_thread(tls_ptr);
- Node* cmp_thr = _gvn.transform( new (C) CmpPNode(cur_thr, rec_thr) );
- Node* bol_thr = _gvn.transform( new (C) BoolNode(cmp_thr, BoolTest::ne) );
+ Node* cmp_thr = _gvn.transform(new (C) CmpPNode(cur_thr, rec_thr));
+ Node* bol_thr = _gvn.transform(new (C) BoolNode(cmp_thr, BoolTest::ne));
generate_slow_guard(bol_thr, slow_region);
@@ -3022,36 +3038,36 @@ bool LibraryCallKit::inline_native_isInterrupted() {
// Set the control input on the field _interrupted read to prevent it floating up.
Node* int_bit = make_load(control(), p, TypeInt::BOOL, T_INT);
- Node* cmp_bit = _gvn.transform( new (C) CmpINode(int_bit, intcon(0)) );
- Node* bol_bit = _gvn.transform( new (C) BoolNode(cmp_bit, BoolTest::ne) );
+ Node* cmp_bit = _gvn.transform(new (C) CmpINode(int_bit, intcon(0)));
+ Node* bol_bit = _gvn.transform(new (C) BoolNode(cmp_bit, BoolTest::ne));
IfNode* iff_bit = create_and_map_if(control(), bol_bit, PROB_UNLIKELY_MAG(3), COUNT_UNKNOWN);
// First fast path: if (!TLS._interrupted) return false;
- Node* false_bit = _gvn.transform( new (C) IfFalseNode(iff_bit) );
+ Node* false_bit = _gvn.transform(new (C) IfFalseNode(iff_bit));
result_rgn->init_req(no_int_result_path, false_bit);
result_val->init_req(no_int_result_path, intcon(0));
// drop through to next case
- set_control( _gvn.transform(new (C) IfTrueNode(iff_bit)) );
+ set_control( _gvn.transform(new (C) IfTrueNode(iff_bit)));
// (c) Or, if interrupt bit is set and clear_int is false, use 2nd fast path.
Node* clr_arg = argument(1);
- Node* cmp_arg = _gvn.transform( new (C) CmpINode(clr_arg, intcon(0)) );
- Node* bol_arg = _gvn.transform( new (C) BoolNode(cmp_arg, BoolTest::ne) );
+ Node* cmp_arg = _gvn.transform(new (C) CmpINode(clr_arg, intcon(0)));
+ Node* bol_arg = _gvn.transform(new (C) BoolNode(cmp_arg, BoolTest::ne));
IfNode* iff_arg = create_and_map_if(control(), bol_arg, PROB_FAIR, COUNT_UNKNOWN);
// Second fast path: ... else if (!clear_int) return true;
- Node* false_arg = _gvn.transform( new (C) IfFalseNode(iff_arg) );
+ Node* false_arg = _gvn.transform(new (C) IfFalseNode(iff_arg));
result_rgn->init_req(no_clear_result_path, false_arg);
result_val->init_req(no_clear_result_path, intcon(1));
// drop through to next case
- set_control( _gvn.transform(new (C) IfTrueNode(iff_arg)) );
+ set_control( _gvn.transform(new (C) IfTrueNode(iff_arg)));
// (d) Otherwise, go to the slow path.
slow_region->add_req(control());
- set_control( _gvn.transform(slow_region) );
+ set_control( _gvn.transform(slow_region));
if (stopped()) {
// There is no slow path.
@@ -3107,7 +3123,7 @@ Node* LibraryCallKit::load_klass_from_mirror_common(Node* mirror,
if (region == NULL) never_see_null = true;
Node* p = basic_plus_adr(mirror, offset);
const TypeKlassPtr* kls_type = TypeKlassPtr::OBJECT_OR_NULL;
- Node* kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type) );
+ Node* kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type));
Node* null_ctl = top();
kls = null_check_oop(kls, &null_ctl, never_see_null);
if (region != NULL) {
@@ -3129,9 +3145,9 @@ Node* LibraryCallKit::generate_access_flags_guard(Node* kls, int modifier_mask,
Node* mods = make_load(NULL, modp, TypeInt::INT, T_INT);
Node* mask = intcon(modifier_mask);
Node* bits = intcon(modifier_bits);
- Node* mbit = _gvn.transform( new (C) AndINode(mods, mask) );
- Node* cmp = _gvn.transform( new (C) CmpINode(mbit, bits) );
- Node* bol = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ne) );
+ Node* mbit = _gvn.transform(new (C) AndINode(mods, mask));
+ Node* cmp = _gvn.transform(new (C) CmpINode(mbit, bits));
+ Node* bol = _gvn.transform(new (C) BoolNode(cmp, BoolTest::ne));
return generate_fair_guard(bol, region);
}
Node* LibraryCallKit::generate_interface_guard(Node* kls, RegionNode* region) {
@@ -3282,7 +3298,7 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) {
phi->add_req(makecon(TypeInstPtr::make(env()->Object_klass()->java_mirror())));
// If we fall through, it's a plain class. Get its _super.
p = basic_plus_adr(kls, in_bytes(Klass::super_offset()));
- kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL) );
+ kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL));
null_ctl = top();
kls = null_check_oop(kls, &null_ctl);
if (null_ctl != top()) {
@@ -3395,8 +3411,8 @@ bool LibraryCallKit::inline_native_subtype_check() {
set_control(region->in(_prim_0_path)); // go back to first null check
if (!stopped()) {
// Since superc is primitive, make a guard for the superc==subc case.
- Node* cmp_eq = _gvn.transform( new (C) CmpPNode(args[0], args[1]) );
- Node* bol_eq = _gvn.transform( new (C) BoolNode(cmp_eq, BoolTest::eq) );
+ Node* cmp_eq = _gvn.transform(new (C) CmpPNode(args[0], args[1]));
+ Node* bol_eq = _gvn.transform(new (C) BoolNode(cmp_eq, BoolTest::eq));
generate_guard(bol_eq, region, PROB_FAIR);
if (region->req() == PATH_LIMIT+1) {
// A guard was added. If the added guard is taken, superc==subc.
@@ -3461,11 +3477,11 @@ Node* LibraryCallKit::generate_array_guard_common(Node* kls, RegionNode* region,
? ((jint)Klass::_lh_array_tag_type_value
<< Klass::_lh_array_tag_shift)
: Klass::_lh_neutral_value);
- Node* cmp = _gvn.transform( new(C) CmpINode(layout_val, intcon(nval)) );
+ Node* cmp = _gvn.transform(new(C) CmpINode(layout_val, intcon(nval)));
BoolTest::mask btest = BoolTest::lt; // correct for testing is_[obj]array
// invert the test if we are looking for a non-array
if (not_array) btest = BoolTest(btest).negate();
- Node* bol = _gvn.transform( new(C) BoolNode(cmp, btest) );
+ Node* bol = _gvn.transform(new(C) BoolNode(cmp, btest));
return generate_fair_guard(bol, region);
}
@@ -3525,7 +3541,7 @@ bool LibraryCallKit::inline_native_newArray() {
// Return the combined state.
set_i_o( _gvn.transform(result_io) );
- set_all_memory( _gvn.transform(result_mem) );
+ set_all_memory( _gvn.transform(result_mem));
C->set_has_split_ifs(true); // Has chance for split-if optimization
set_result(result_reg, result_val);
@@ -3678,8 +3694,8 @@ Node* LibraryCallKit::generate_virtual_guard(Node* obj_klass,
const TypePtr* native_call_addr = TypeMetadataPtr::make(method);
Node* native_call = makecon(native_call_addr);
- Node* chk_native = _gvn.transform( new(C) CmpPNode(target_call, native_call) );
- Node* test_native = _gvn.transform( new(C) BoolNode(chk_native, BoolTest::ne) );
+ Node* chk_native = _gvn.transform(new(C) CmpPNode(target_call, native_call));
+ Node* test_native = _gvn.transform(new(C) BoolNode(chk_native, BoolTest::ne));
return generate_slow_guard(test_native, slow_region);
}
@@ -3800,10 +3816,10 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) {
// Test the header to see if it is unlocked.
Node *lock_mask = _gvn.MakeConX(markOopDesc::biased_lock_mask_in_place);
- Node *lmasked_header = _gvn.transform( new (C) AndXNode(header, lock_mask) );
+ Node *lmasked_header = _gvn.transform(new (C) AndXNode(header, lock_mask));
Node *unlocked_val = _gvn.MakeConX(markOopDesc::unlocked_value);
- Node *chk_unlocked = _gvn.transform( new (C) CmpXNode( lmasked_header, unlocked_val));
- Node *test_unlocked = _gvn.transform( new (C) BoolNode( chk_unlocked, BoolTest::ne) );
+ Node *chk_unlocked = _gvn.transform(new (C) CmpXNode( lmasked_header, unlocked_val));
+ Node *test_unlocked = _gvn.transform(new (C) BoolNode( chk_unlocked, BoolTest::ne));
generate_slow_guard(test_unlocked, slow_region);
@@ -3813,17 +3829,17 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) {
// vm: see markOop.hpp.
Node *hash_mask = _gvn.intcon(markOopDesc::hash_mask);
Node *hash_shift = _gvn.intcon(markOopDesc::hash_shift);
- Node *hshifted_header= _gvn.transform( new (C) URShiftXNode(header, hash_shift) );
+ Node *hshifted_header= _gvn.transform(new (C) URShiftXNode(header, hash_shift));
// This hack lets the hash bits live anywhere in the mark object now, as long
// as the shift drops the relevant bits into the low 32 bits. Note that
// Java spec says that HashCode is an int so there's no point in capturing
// an 'X'-sized hashcode (32 in 32-bit build or 64 in 64-bit build).
hshifted_header = ConvX2I(hshifted_header);
- Node *hash_val = _gvn.transform( new (C) AndINode(hshifted_header, hash_mask) );
+ Node *hash_val = _gvn.transform(new (C) AndINode(hshifted_header, hash_mask));
Node *no_hash_val = _gvn.intcon(markOopDesc::no_hash);
- Node *chk_assigned = _gvn.transform( new (C) CmpINode( hash_val, no_hash_val));
- Node *test_assigned = _gvn.transform( new (C) BoolNode( chk_assigned, BoolTest::eq) );
+ Node *chk_assigned = _gvn.transform(new (C) CmpINode( hash_val, no_hash_val));
+ Node *test_assigned = _gvn.transform(new (C) BoolNode( chk_assigned, BoolTest::eq));
generate_slow_guard(test_assigned, slow_region);
@@ -3854,7 +3870,7 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) {
// Return the combined state.
set_i_o( _gvn.transform(result_io) );
- set_all_memory( _gvn.transform(result_mem) );
+ set_all_memory( _gvn.transform(result_mem));
set_result(result_reg, result_val);
return true;
@@ -3982,7 +3998,7 @@ bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) {
Node *opt_isnan = _gvn.transform(ifisnan);
assert( opt_isnan->is_If(), "Expect an IfNode");
IfNode *opt_ifisnan = (IfNode*)opt_isnan;
- Node *iftrue = _gvn.transform( new (C) IfTrueNode(opt_ifisnan) );
+ Node *iftrue = _gvn.transform(new (C) IfTrueNode(opt_ifisnan));
set_control(iftrue);
@@ -4023,7 +4039,7 @@ bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) {
Node *opt_isnan = _gvn.transform(ifisnan);
assert( opt_isnan->is_If(), "Expect an IfNode");
IfNode *opt_ifisnan = (IfNode*)opt_isnan;
- Node *iftrue = _gvn.transform( new (C) IfTrueNode(opt_ifisnan) );
+ Node *iftrue = _gvn.transform(new (C) IfTrueNode(opt_ifisnan));
set_control(iftrue);
@@ -4152,8 +4168,8 @@ void LibraryCallKit::copy_to_clone(Node* obj, Node* alloc_obj, Node* obj_size, b
// Compute the length also, if needed:
Node* countx = size;
- countx = _gvn.transform( new (C) SubXNode(countx, MakeConX(base_off)) );
- countx = _gvn.transform( new (C) URShiftXNode(countx, intcon(LogBytesPerLong) ));
+ countx = _gvn.transform(new (C) SubXNode(countx, MakeConX(base_off)));
+ countx = _gvn.transform(new (C) URShiftXNode(countx, intcon(LogBytesPerLong) ));
const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
bool disjoint_bases = true;
@@ -4357,9 +4373,9 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) {
}
// Return the combined state.
- set_control( _gvn.transform(result_reg) );
- set_i_o( _gvn.transform(result_i_o) );
- set_all_memory( _gvn.transform(result_mem) );
+ set_control( _gvn.transform(result_reg));
+ set_i_o( _gvn.transform(result_i_o));
+ set_all_memory( _gvn.transform(result_mem));
} // original reexecute is set back here
set_result(_gvn.transform(result_val));
@@ -4684,8 +4700,8 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type,
// are dest_head = dest[0..off] and dest_tail = dest[off+len..dest.length].
Node* dest_size = alloc->in(AllocateNode::AllocSize);
Node* dest_length = alloc->in(AllocateNode::ALength);
- Node* dest_tail = _gvn.transform( new(C) AddINode(dest_offset,
- copy_length) );
+ Node* dest_tail = _gvn.transform(new(C) AddINode(dest_offset,
+ copy_length));
// If there is a head section that needs zeroing, do it now.
if (find_int_con(dest_offset, -1) != 0) {
@@ -4701,8 +4717,8 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type,
// the copy to a more hardware-friendly word size of 64 bits.
Node* tail_ctl = NULL;
if (!stopped() && !dest_tail->eqv_uncast(dest_length)) {
- Node* cmp_lt = _gvn.transform( new(C) CmpINode(dest_tail, dest_length) );
- Node* bol_lt = _gvn.transform( new(C) BoolNode(cmp_lt, BoolTest::lt) );
+ Node* cmp_lt = _gvn.transform(new(C) CmpINode(dest_tail, dest_length));
+ Node* bol_lt = _gvn.transform(new(C) BoolNode(cmp_lt, BoolTest::lt));
tail_ctl = generate_slow_guard(bol_lt, NULL);
assert(tail_ctl != NULL || !stopped(), "must be an outcome");
}
@@ -4745,7 +4761,7 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type,
dest_size);
done_ctl->init_req(2, control());
done_mem->init_req(2, memory(adr_type));
- set_control( _gvn.transform(done_ctl) );
+ set_control( _gvn.transform(done_ctl));
set_memory( _gvn.transform(done_mem), adr_type );
}
}
@@ -4832,18 +4848,18 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type,
// Clean up after the checked call.
// The returned value is either 0 or -1^K,
// where K = number of partially transferred array elements.
- Node* cmp = _gvn.transform( new(C) CmpINode(checked_value, intcon(0)) );
- Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::eq) );
+ Node* cmp = _gvn.transform(new(C) CmpINode(checked_value, intcon(0)));
+ Node* bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::eq));
IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN);
// If it is 0, we are done, so transfer to the end.
- Node* checks_done = _gvn.transform( new(C) IfTrueNode(iff) );
+ Node* checks_done = _gvn.transform(new(C) IfTrueNode(iff));
result_region->init_req(checked_path, checks_done);
result_i_o ->init_req(checked_path, checked_i_o);
result_memory->init_req(checked_path, checked_mem);
// If it is not zero, merge into the slow call.
- set_control( _gvn.transform( new(C) IfFalseNode(iff) ));
+ set_control( _gvn.transform(new(C) IfFalseNode(iff) ));
RegionNode* slow_reg2 = new(C) RegionNode(3);
PhiNode* slow_i_o2 = new(C) PhiNode(slow_reg2, Type::ABIO);
PhiNode* slow_mem2 = new(C) PhiNode(slow_reg2, Type::MEMORY, adr_type);
@@ -4866,16 +4882,16 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type,
} else {
// We must continue the copy exactly where it failed, or else
// another thread might see the wrong number of writes to dest.
- Node* checked_offset = _gvn.transform( new(C) XorINode(checked_value, intcon(-1)) );
+ Node* checked_offset = _gvn.transform(new(C) XorINode(checked_value, intcon(-1)));
Node* slow_offset = new(C) PhiNode(slow_reg2, TypeInt::INT);
slow_offset->init_req(1, intcon(0));
slow_offset->init_req(2, checked_offset);
slow_offset = _gvn.transform(slow_offset);
// Adjust the arguments by the conditionally incoming offset.
- Node* src_off_plus = _gvn.transform( new(C) AddINode(src_offset, slow_offset) );
- Node* dest_off_plus = _gvn.transform( new(C) AddINode(dest_offset, slow_offset) );
- Node* length_minus = _gvn.transform( new(C) SubINode(copy_length, slow_offset) );
+ Node* src_off_plus = _gvn.transform(new(C) AddINode(src_offset, slow_offset));
+ Node* dest_off_plus = _gvn.transform(new(C) AddINode(dest_offset, slow_offset));
+ Node* length_minus = _gvn.transform(new(C) SubINode(copy_length, slow_offset));
// Tweak the node variables to adjust the code produced below:
src_offset = src_off_plus;
@@ -4914,7 +4930,7 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type,
}
// Finished; return the combined state.
- set_control( _gvn.transform(result_region) );
+ set_control( _gvn.transform(result_region));
set_i_o( _gvn.transform(result_i_o) );
set_memory( _gvn.transform(result_memory), adr_type );
@@ -5096,10 +5112,10 @@ LibraryCallKit::generate_clear_array(const TypePtr* adr_type,
int end_round = (-1 << scale) & (BytesPerLong - 1);
Node* end = ConvI2X(slice_len);
if (scale != 0)
- end = _gvn.transform( new(C) LShiftXNode(end, intcon(scale) ));
+ end = _gvn.transform(new(C) LShiftXNode(end, intcon(scale) ));
end_base += end_round;
- end = _gvn.transform( new(C) AddXNode(end, MakeConX(end_base)) );
- end = _gvn.transform( new(C) AndXNode(end, MakeConX(~end_round)) );
+ end = _gvn.transform(new(C) AddXNode(end, MakeConX(end_base)));
+ end = _gvn.transform(new(C) AndXNode(end, MakeConX(~end_round)));
mem = ClearArrayNode::clear_memory(control(), mem, dest,
start_con, end, &_gvn);
} else if (start_con < 0 && dest_size != top()) {
@@ -5108,8 +5124,8 @@ LibraryCallKit::generate_clear_array(const TypePtr* adr_type,
Node* start = slice_idx;
start = ConvI2X(start);
if (scale != 0)
- start = _gvn.transform( new(C) LShiftXNode( start, intcon(scale) ));
- start = _gvn.transform( new(C) AddXNode(start, MakeConX(abase)) );
+ start = _gvn.transform(new(C) LShiftXNode( start, intcon(scale) ));
+ start = _gvn.transform(new(C) AddXNode(start, MakeConX(abase)));
if ((bump_bit | clear_low) != 0) {
int to_clear = (bump_bit | clear_low);
// Align up mod 8, then store a jint zero unconditionally
@@ -5120,14 +5136,14 @@ LibraryCallKit::generate_clear_array(const TypePtr* adr_type,
assert((abase & to_clear) == 0, "array base must be long-aligned");
} else {
// Bump 'start' up to (or past) the next jint boundary:
- start = _gvn.transform( new(C) AddXNode(start, MakeConX(bump_bit)) );
+ start = _gvn.transform(new(C) AddXNode(start, MakeConX(bump_bit)));
assert((abase & clear_low) == 0, "array base must be int-aligned");
}
// Round bumped 'start' down to jlong boundary in body of array.
- start = _gvn.transform( new(C) AndXNode(start, MakeConX(~to_clear)) );
+ start = _gvn.transform(new(C) AndXNode(start, MakeConX(~to_clear)));
if (bump_bit != 0) {
// Store a zero to the immediately preceding jint:
- Node* x1 = _gvn.transform( new(C) AddXNode(start, MakeConX(-bump_bit)) );
+ Node* x1 = _gvn.transform(new(C) AddXNode(start, MakeConX(-bump_bit)));
Node* p1 = basic_plus_adr(dest, x1);
mem = StoreNode::make(_gvn, control(), mem, p1, adr_type, intcon(0), T_INT);
mem = _gvn.transform(mem);
@@ -5194,8 +5210,8 @@ LibraryCallKit::generate_block_arraycopy(const TypePtr* adr_type,
Node* sptr = basic_plus_adr(src, src_off);
Node* dptr = basic_plus_adr(dest, dest_off);
Node* countx = dest_size;
- countx = _gvn.transform( new (C) SubXNode(countx, MakeConX(dest_off)) );
- countx = _gvn.transform( new (C) URShiftXNode(countx, intcon(LogBytesPerLong)) );
+ countx = _gvn.transform(new (C) SubXNode(countx, MakeConX(dest_off)));
+ countx = _gvn.transform(new (C) URShiftXNode(countx, intcon(LogBytesPerLong)));
bool disjoint_bases = true; // since alloc != NULL
generate_unchecked_arraycopy(adr_type, T_LONG, disjoint_bases,
@@ -5360,6 +5376,117 @@ bool LibraryCallKit::inline_encodeISOArray() {
return true;
}
+/**
+ * Calculate CRC32 for byte.
+ * int java.util.zip.CRC32.update(int crc, int b)
+ */
+bool LibraryCallKit::inline_updateCRC32() {
+ assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support");
+ assert(callee()->signature()->size() == 2, "update has 2 parameters");
+ // no receiver since it is static method
+ Node* crc = argument(0); // type: int
+ Node* b = argument(1); // type: int
+
+ /*
+ * int c = ~ crc;
+ * b = timesXtoThe32[(b ^ c) & 0xFF];
+ * b = b ^ (c >>> 8);
+ * crc = ~b;
+ */
+
+ Node* M1 = intcon(-1);
+ crc = _gvn.transform(new (C) XorINode(crc, M1));
+ Node* result = _gvn.transform(new (C) XorINode(crc, b));
+ result = _gvn.transform(new (C) AndINode(result, intcon(0xFF)));
+
+ Node* base = makecon(TypeRawPtr::make(StubRoutines::crc_table_addr()));
+ Node* offset = _gvn.transform(new (C) LShiftINode(result, intcon(0x2)));
+ Node* adr = basic_plus_adr(top(), base, ConvI2X(offset));
+ result = make_load(control(), adr, TypeInt::INT, T_INT);
+
+ crc = _gvn.transform(new (C) URShiftINode(crc, intcon(8)));
+ result = _gvn.transform(new (C) XorINode(crc, result));
+ result = _gvn.transform(new (C) XorINode(result, M1));
+ set_result(result);
+ return true;
+}
+
+/**
+ * Calculate CRC32 for byte[] array.
+ * int java.util.zip.CRC32.updateBytes(int crc, byte[] buf, int off, int len)
+ */
+bool LibraryCallKit::inline_updateBytesCRC32() {
+ assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support");
+ assert(callee()->signature()->size() == 4, "updateBytes has 4 parameters");
+ // no receiver since it is static method
+ Node* crc = argument(0); // type: int
+ Node* src = argument(1); // type: oop
+ Node* offset = argument(2); // type: int
+ Node* length = argument(3); // type: int
+
+ const Type* src_type = src->Value(&_gvn);
+ const TypeAryPtr* top_src = src_type->isa_aryptr();
+ if (top_src == NULL || top_src->klass() == NULL) {
+ // failed array check
+ return false;
+ }
+
+ // Figure out the size and type of the elements we will be copying.
+ BasicType src_elem = src_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
+ if (src_elem != T_BYTE) {
+ return false;
+ }
+
+ // 'src_start' points to src array + scaled offset
+ Node* src_start = array_element_address(src, offset, src_elem);
+
+ // We assume that range check is done by caller.
+ // TODO: generate range check (offset+length < src.length) in debug VM.
+
+ // Call the stub.
+ address stubAddr = StubRoutines::updateBytesCRC32();
+ const char *stubName = "updateBytesCRC32";
+
+ Node* call = make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::updateBytesCRC32_Type(),
+ stubAddr, stubName, TypePtr::BOTTOM,
+ crc, src_start, length);
+ Node* result = _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms));
+ set_result(result);
+ return true;
+}
+
+/**
+ * Calculate CRC32 for ByteBuffer.
+ * int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
+ */
+bool LibraryCallKit::inline_updateByteBufferCRC32() {
+ assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support");
+ assert(callee()->signature()->size() == 5, "updateByteBuffer has 4 parameters and one is long");
+ // no receiver since it is static method
+ Node* crc = argument(0); // type: int
+ Node* src = argument(1); // type: long
+ Node* offset = argument(3); // type: int
+ Node* length = argument(4); // type: int
+
+ src = ConvL2X(src); // adjust Java long to machine word
+ Node* base = _gvn.transform(new (C) CastX2PNode(src));
+ offset = ConvI2X(offset);
+
+ // 'src_start' points to src array + scaled offset
+ Node* src_start = basic_plus_adr(top(), base, offset);
+
+ // Call the stub.
+ address stubAddr = StubRoutines::updateBytesCRC32();
+ const char *stubName = "updateBytesCRC32";
+
+ Node* call = make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::updateBytesCRC32_Type(),
+ stubAddr, stubName, TypePtr::BOTTOM,
+ crc, src_start, length);
+ Node* result = _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms));
+ set_result(result);
+ return true;
+}
+
//----------------------------inline_reference_get----------------------------
// public T java.lang.ref.Reference.get();
bool LibraryCallKit::inline_reference_get() {
diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp
index d0aefad66b7..9a278c5ac1c 100644
--- a/hotspot/src/share/vm/opto/runtime.cpp
+++ b/hotspot/src/share/vm/opto/runtime.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -829,6 +829,28 @@ const TypeFunc* OptoRuntime::aescrypt_block_Type() {
return TypeFunc::make(domain, range);
}
+/**
+ * int updateBytesCRC32(int crc, byte* b, int len)
+ */
+const TypeFunc* OptoRuntime::updateBytesCRC32_Type() {
+ // create input type (domain)
+ int num_args = 3;
+ int argcnt = num_args;
+ const Type** fields = TypeTuple::fields(argcnt);
+ int argp = TypeFunc::Parms;
+ fields[argp++] = TypeInt::INT; // crc
+ fields[argp++] = TypePtr::NOTNULL; // src
+ fields[argp++] = TypeInt::INT; // len
+ assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
+ const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
+
+ // result type needed
+ fields = TypeTuple::fields(1);
+ fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result
+ const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields);
+ return TypeFunc::make(domain, range);
+}
+
// for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning void
const TypeFunc* OptoRuntime::cipherBlockChaining_aescrypt_Type() {
// create input type (domain)
diff --git a/hotspot/src/share/vm/opto/runtime.hpp b/hotspot/src/share/vm/opto/runtime.hpp
index 295b7123757..b3f7ff4cb1a 100644
--- a/hotspot/src/share/vm/opto/runtime.hpp
+++ b/hotspot/src/share/vm/opto/runtime.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -284,6 +284,8 @@ private:
static const TypeFunc* aescrypt_block_Type();
static const TypeFunc* cipherBlockChaining_aescrypt_Type();
+ static const TypeFunc* updateBytesCRC32_Type();
+
// leaf on stack replacement interpreter accessor types
static const TypeFunc* osr_end_Type();
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index c94f6bdbb17..1ae802302e0 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -644,6 +644,9 @@ class CommandLineFlags {
product(bool, UseAESIntrinsics, false, \
"use intrinsics for AES versions of crypto") \
\
+ product(bool, UseCRC32Intrinsics, false, \
+ "use intrinsics for java.util.zip.CRC32") \
+ \
develop(bool, TraceCallFixup, false, \
"traces all call fixups") \
\
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.cpp b/hotspot/src/share/vm/runtime/stubRoutines.cpp
index c559865b821..a1179acd543 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -125,6 +125,9 @@ address StubRoutines::_aescrypt_decryptBlock = NULL;
address StubRoutines::_cipherBlockChaining_encryptAESCrypt = NULL;
address StubRoutines::_cipherBlockChaining_decryptAESCrypt = NULL;
+address StubRoutines::_updateBytesCRC32 = NULL;
+address StubRoutines::_crc_table_adr = NULL;
+
double (* StubRoutines::_intrinsic_log )(double) = NULL;
double (* StubRoutines::_intrinsic_log10 )(double) = NULL;
double (* StubRoutines::_intrinsic_exp )(double) = NULL;
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp
index 7ad66371300..b8d61ea0cbf 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp
@@ -204,6 +204,9 @@ class StubRoutines: AllStatic {
static address _cipherBlockChaining_encryptAESCrypt;
static address _cipherBlockChaining_decryptAESCrypt;
+ static address _updateBytesCRC32;
+ static address _crc_table_adr;
+
// These are versions of the java.lang.Math methods which perform
// the same operations as the intrinsic version. They are used for
// constant folding in the compiler to ensure equivalence. If the
@@ -342,6 +345,9 @@ class StubRoutines: AllStatic {
static address cipherBlockChaining_encryptAESCrypt() { return _cipherBlockChaining_encryptAESCrypt; }
static address cipherBlockChaining_decryptAESCrypt() { return _cipherBlockChaining_decryptAESCrypt; }
+ static address updateBytesCRC32() { return _updateBytesCRC32; }
+ static address crc_table_addr() { return _crc_table_adr; }
+
static address select_fill_function(BasicType t, bool aligned, const char* &name);
static address zero_aligned_words() { return _zero_aligned_words; }
diff --git a/hotspot/test/compiler/7088419/CRCTest.java b/hotspot/test/compiler/7088419/CRCTest.java
new file mode 100644
index 00000000000..fa1f520cca8
--- /dev/null
+++ b/hotspot/test/compiler/7088419/CRCTest.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 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.
+ *
+ * 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 7088419
+ @run main CRCTest
+ @summary Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32 and java.util.zip.Adler32
+ */
+
+import java.nio.ByteBuffer;
+import java.util.zip.CRC32;
+import java.util.zip.Checksum;
+
+public class CRCTest {
+
+ public static void main(String[] args) throws Exception {
+
+ byte[] b = initializedBytes(4096 * 4096);
+
+ {
+ CRC32 crc1 = new CRC32();
+ CRC32 crc2 = new CRC32();
+ CRC32 crc3 = new CRC32();
+ CRC32 crc4 = new CRC32();
+
+ crc1.update(b, 0, b.length);
+ updateSerial(crc2, b, 0, b.length);
+ updateDirect(crc3, b, 0, b.length);
+ updateSerialSlow(crc4, b, 0, b.length);
+
+ check(crc1, crc2);
+ check(crc3, crc4);
+ check(crc1, crc3);
+
+ crc1.update(17);
+ crc2.update(17);
+ crc3.update(17);
+ crc4.update(17);
+
+ crc1.update(b, 1, b.length-2);
+ updateSerial(crc2, b, 1, b.length-2);
+ updateDirect(crc3, b, 1, b.length-2);
+ updateSerialSlow(crc4, b, 1, b.length-2);
+
+ check(crc1, crc2);
+ check(crc3, crc4);
+ check(crc1, crc3);
+
+ report("finished huge crc", crc1, crc2, crc3, crc4);
+
+ for (int i = 0; i < 256; i++) {
+ for (int j = 0; j < 256; j += 1) {
+ crc1.update(b, i, j);
+ updateSerial(crc2, b, i, j);
+ updateDirect(crc3, b, i, j);
+ updateSerialSlow(crc4, b, i, j);
+
+ check(crc1, crc2);
+ check(crc3, crc4);
+ check(crc1, crc3);
+
+ }
+ }
+
+ report("finished small survey crc", crc1, crc2, crc3, crc4);
+ }
+
+ }
+
+ private static void report(String s, Checksum crc1, Checksum crc2,
+ Checksum crc3, Checksum crc4) {
+ System.out.println(s + ", crc1 = " + crc1.getValue() +
+ ", crc2 = " + crc2.getValue()+
+ ", crc3 = " + crc3.getValue()+
+ ", crc4 = " + crc4.getValue());
+ }
+
+ private static void check(Checksum crc1, Checksum crc2) throws Exception {
+ if (crc1.getValue() != crc2.getValue()) {
+ String s = "value 1 = " + crc1.getValue() + ", value 2 = " + crc2.getValue();
+ System.err.println(s);
+ throw new Exception(s);
+ }
+ }
+
+ private static byte[] initializedBytes(int M) {
+ byte[] bytes = new byte[M];
+ for (int i = 0; i < bytes.length; i++) {
+ bytes[i] = (byte) i;
+ }
+ return bytes;
+ }
+
+ private static void updateSerial(Checksum crc, byte[] b, int start, int length) {
+ for (int i = 0; i < length; i++)
+ crc.update(b[i+start]);
+ }
+
+ private static void updateSerialSlow(Checksum crc, byte[] b, int start, int length) {
+ for (int i = 0; i < length; i++)
+ crc.update(b[i+start]);
+ crc.getValue();
+ }
+
+ private static void updateDirect(CRC32 crc3, byte[] b, int start, int length) {
+ ByteBuffer buf = ByteBuffer.allocateDirect(length);
+ buf.put(b, start, length);
+ buf.flip();
+ crc3.update(buf);
+ }
+}
From 90c790728d4e081f71af85ee0b7b1e53d681a892 Mon Sep 17 00:00:00 2001
From: Christian Thalinger
Date: Tue, 2 Jul 2013 20:27:00 -0700
Subject: [PATCH 075/101] 8017571: JSR292: JVM crashing on assert "cast to
instanceKlass" while producing MethodHandle for array methods with
MethodHandle.findVirtual
Reviewed-by: kvn
---
hotspot/src/share/vm/prims/methodHandles.cpp | 7 ++++++-
hotspot/src/share/vm/runtime/reflection.cpp | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp
index bb9da0034e4..ac1c796eb31 100644
--- a/hotspot/src/share/vm/prims/methodHandles.cpp
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp
@@ -1137,7 +1137,12 @@ JVM_ENTRY(jobject, MHN_resolve_Mem(JNIEnv *env, jobject igcls, jobject mname_jh,
if (VerifyMethodHandles && caller_jh != NULL &&
java_lang_invoke_MemberName::clazz(mname()) != NULL) {
Klass* reference_klass = java_lang_Class::as_Klass(java_lang_invoke_MemberName::clazz(mname()));
- if (reference_klass != NULL) {
+ if (reference_klass != NULL && reference_klass->oop_is_objArray()) {
+ reference_klass = ObjArrayKlass::cast(reference_klass)->bottom_klass();
+ }
+
+ // Reflection::verify_class_access can only handle instance classes.
+ if (reference_klass != NULL && reference_klass->oop_is_instance()) {
// Emulate LinkResolver::check_klass_accessability.
Klass* caller = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(caller_jh));
if (!Reflection::verify_class_access(caller,
diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp
index 15869cc5c0e..f06a7f922aa 100644
--- a/hotspot/src/share/vm/runtime/reflection.cpp
+++ b/hotspot/src/share/vm/runtime/reflection.cpp
@@ -458,7 +458,7 @@ bool Reflection::verify_class_access(Klass* current_class, Klass* new_class, boo
// doesn't have a classloader.
if ((current_class == NULL) ||
(current_class == new_class) ||
- (InstanceKlass::cast(new_class)->is_public()) ||
+ (new_class->is_public()) ||
is_same_class_package(current_class, new_class)) {
return true;
}
From 36a8e303163c1c19e6ae1027566bf15ddf1070fc Mon Sep 17 00:00:00 2001
From: Christine Lu
Date: Thu, 4 Jul 2013 01:00:06 -0700
Subject: [PATCH 076/101] Added tag jdk8-b97 for changeset 1c0d035d6968
---
.hgtags-top-repo | 1 +
1 file changed, 1 insertion(+)
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 03af8b5ef30..64129189d67 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -218,3 +218,4 @@ cb51fb4789ac0b8be4056482077ddfb8f3bd3805 jdk8-b91
50d2bde060f2a9bbbe4da0c8986e20aca61f2e2e jdk8-b94
785d07fe38901ecc1b7e0145e53e1c3da9361fee jdk8-b95
c156084add486f941c12d886a0b1b2854795d557 jdk8-b96
+a1c1e8bf71f354f3aec0214cf13d6668811e021d jdk8-b97
From 4f3801a66f45f2efe4f106b482c97dc2bc0fdd1b Mon Sep 17 00:00:00 2001
From: Christine Lu
Date: Thu, 4 Jul 2013 01:00:08 -0700
Subject: [PATCH 077/101] Added tag jdk8-b97 for changeset 1ebe717664d4
---
corba/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/corba/.hgtags b/corba/.hgtags
index 77bfead7060..28f0b92d88b 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -218,3 +218,4 @@ c8286839d0df04aba819ec4bef12b86babccf30e jdk8-b90
22f5d7f261d9d61a953d2d9a53f2e9ce0ca361d1 jdk8-b94
2cf36f43df36137980d9828cec27003ec10daeee jdk8-b95
3357c2776431d51a8de326a85e0f41420e40774f jdk8-b96
+469995a8e97424f450c880606d689bf345277b19 jdk8-b97
From 8007f4f434cc3eaf9110c1a4f16b3da302681892 Mon Sep 17 00:00:00 2001
From: Christine Lu
Date: Thu, 4 Jul 2013 01:00:19 -0700
Subject: [PATCH 078/101] Added tag jdk8-b97 for changeset 3a6f15473944
---
hotspot/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 0363e7ebd3e..5488b90fb22 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -355,3 +355,4 @@ b786c04b7be15194febe88dc1f0c9443e737a84b hs25-b35
2cc5a9d1ba66dfdff578918b393c727bd9450210 hs25-b38
e6a4b8c71fa6f225bd989a34de2d0d0a656a8be8 jdk8-b96
2b9380b0bf0b649f40704735773e8956c2d88ba0 hs25-b39
+d197d377ab2e016d024e8c86cb06a57bd7eae590 jdk8-b97
From a3d4e7121cceed0f08f9f263d94681493de2afaa Mon Sep 17 00:00:00 2001
From: Christine Lu
Date: Thu, 4 Jul 2013 01:00:34 -0700
Subject: [PATCH 079/101] Added tag jdk8-b97 for changeset 611e21a147b1
---
jaxp/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 81a40076854..ed78f7ecae7 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -218,3 +218,4 @@ d583a491d63c49eeda4869525048075da1cb596e jdk8-b93
c84658e1740df64931005a9bc4c8ecef38eb47c3 jdk8-b94
b8c5f4b6f0fffb44618fc609a584953c4ed67c0b jdk8-b95
6121efd299235b057f3de94b0a4158c388c2907c jdk8-b96
+6c830db28d21108f32af990ecf4d80a75887980d jdk8-b97
From 9731e207951eda4946c997bd283e5c057e389b43 Mon Sep 17 00:00:00 2001
From: Christine Lu
Date: Thu, 4 Jul 2013 01:00:38 -0700
Subject: [PATCH 080/101] Added tag jdk8-b97 for changeset f5105d95c3a3
---
jaxws/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index f358e9135cf..fff5bca7aab 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -218,3 +218,4 @@ a0f604766ca14818e2a7b1558cc399499caabf75 jdk8-b92
254c53fd97ab24942043adcfa5c1a0a38a3b274e jdk8-b94
1468c94135f978dd29d03bce2f7d7e952154d144 jdk8-b95
690d34b326bc78a6f5f225522695b41c7f7f70e8 jdk8-b96
+dcde7f049111353ad23175f54985a4f6bfea720c jdk8-b97
From 7b58133588f82a14b6c75358f5c014bf8db4bbee Mon Sep 17 00:00:00 2001
From: Christine Lu
Date: Thu, 4 Jul 2013 01:01:07 -0700
Subject: [PATCH 081/101] Added tag jdk8-b97 for changeset 6774fe79db80
---
langtools/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/langtools/.hgtags b/langtools/.hgtags
index 9cd182f694a..d8403722780 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -218,3 +218,4 @@ e19283cd30a43fca94d8f7639c73ef66db493b1e jdk8-b90
48c6e6ab7c815fd41d747f0218f8041c22f3a460 jdk8-b94
4cb1136231275a1f8af53f5bfdef0b488e4b5bab jdk8-b95
988aef3a8c3adac482363293f65e77ec4c5ce98d jdk8-b96
+6a11a81a8824c17f6cd2ec8f8492e1229b694e96 jdk8-b97
From 277da6e5173728b810f197b2a6440cd2b95d6573 Mon Sep 17 00:00:00 2001
From: Christine Lu
Date: Thu, 4 Jul 2013 01:01:10 -0700
Subject: [PATCH 082/101] Added tag jdk8-b97 for changeset f9f7fb94f515
---
nashorn/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index d23a6e85666..cbbd166c330 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -206,3 +206,4 @@ ddbf41575a2bdb12ccb9f91e169018bf04073038 jdk8-b93
d92b756bc73966f1bfd111f44f3216cea3bba129 jdk8-b94
cbc9926f5b40a24025c1e15d8870157d651a9ff7 jdk8-b95
d6bd440ac5b97bb1205b6c3274569c1cfe626723 jdk8-b96
+1bf1d6ce30427e1f9dc1ada18db409d1f14d99fe jdk8-b97
From f2930397a1e5272e04339a92e3ac3b1ff1670d16 Mon Sep 17 00:00:00 2001
From: Alejandro Murillo
Date: Thu, 4 Jul 2013 14:45:58 -0700
Subject: [PATCH 083/101] Added tag hs25-b40 for changeset d5b4e1fe16bd
---
hotspot/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 5488b90fb22..89d305f1d94 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -356,3 +356,4 @@ b786c04b7be15194febe88dc1f0c9443e737a84b hs25-b35
e6a4b8c71fa6f225bd989a34de2d0d0a656a8be8 jdk8-b96
2b9380b0bf0b649f40704735773e8956c2d88ba0 hs25-b39
d197d377ab2e016d024e8c86cb06a57bd7eae590 jdk8-b97
+c9dd82da51ed34a28f7c6b3245163ee962e94572 hs25-b40
From 7ca1f129930b435222f07cde92142c8149175f2b Mon Sep 17 00:00:00 2001
From: Petr Pchelko
Date: Mon, 8 Jul 2013 07:20:44 -0700
Subject: [PATCH 084/101] 8012925: [parfait] Missing return value in
jdk/src/macosx/native/sun/awt/AWTEvent.m
Reviewed-by: katleman, leonidr
---
jdk/src/macosx/native/sun/awt/AWTEvent.m | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/macosx/native/sun/awt/AWTEvent.m b/jdk/src/macosx/native/sun/awt/AWTEvent.m
index fd3caa6051f..b2d54f7e705 100644
--- a/jdk/src/macosx/native/sun/awt/AWTEvent.m
+++ b/jdk/src/macosx/native/sun/awt/AWTEvent.m
@@ -382,7 +382,7 @@ static unichar NsGetDeadKeyChar(unsigned short keyCode)
{
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
CFDataRef uchr = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData);
- if (uchr == nil) { return; }
+ if (uchr == nil) { return 0; }
const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr);
// Carbon modifiers should be used instead of NSEvent modifiers
UInt32 modifierKeyState = (GetCurrentEventKeyModifiers() >> 8) & 0xFF;
From da494c8bc9535ab6c9a3b58824a6a96e7c162f25 Mon Sep 17 00:00:00 2001
From: Tim Bell
Date: Tue, 9 Jul 2013 08:35:20 -0700
Subject: [PATCH 085/101] 8009315: F# on PATH breaks Cygwin tools (mkdir, echo,
mktemp ...)
Reviewed-by: erikj
---
common/autoconf/generated-configure.sh | 491 +++++++++++++------------
common/autoconf/toolchain_windows.m4 | 2 +
2 files changed, 260 insertions(+), 233 deletions(-)
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index b9c2b38a47e..1f084da68c9 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for OpenJDK jdk8.
+# Generated by GNU Autoconf 2.68 for OpenJDK jdk8.
#
# Report bugs to .
#
@@ -91,6 +91,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -216,11 +217,18 @@ IFS=$as_save_IFS
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
+ # Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+ case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+ esac
+ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
fi
if test x$as_have_required = xno; then :
@@ -1461,7 +1469,7 @@ Try \`$0 --help' for more information"
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
@@ -1897,7 +1905,7 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
OpenJDK configure jdk8
-generated by GNU Autoconf 2.67
+generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
@@ -1943,7 +1951,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
@@ -1981,7 +1989,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_compile
@@ -2019,7 +2027,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_objc_try_compile
@@ -2056,7 +2064,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
@@ -2093,7 +2101,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_cpp
@@ -2106,10 +2114,10 @@ fi
ac_fn_cxx_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if eval "test \"\${$3+set}\"" = set; then :
+ if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
@@ -2176,7 +2184,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
@@ -2185,7 +2193,7 @@ eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_cxx_check_header_mongrel
@@ -2226,7 +2234,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_run
@@ -2240,7 +2248,7 @@ ac_fn_cxx_check_header_compile ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2258,7 +2266,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_cxx_check_header_compile
@@ -2435,7 +2443,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
rm -f conftest.val
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_compute_int
@@ -2481,7 +2489,7 @@ fi
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_link
@@ -2494,7 +2502,7 @@ ac_fn_cxx_check_func ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2549,7 +2557,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_cxx_check_func
@@ -2562,7 +2570,7 @@ ac_fn_c_check_header_compile ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2580,7 +2588,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
cat >config.log <<_ACEOF
@@ -2588,7 +2596,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by OpenJDK $as_me jdk8, which was
-generated by GNU Autoconf 2.67. Invocation command line was
+generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2846,7 +2854,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
fi
done
@@ -3786,7 +3794,7 @@ fi
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1372770384
+DATE_WHEN_GENERATED=1373384053
###############################################################################
#
@@ -3824,7 +3832,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BASENAME+set}" = set; then :
+if ${ac_cv_path_BASENAME+:} false; then :
$as_echo_n "(cached) " >&6
else
case $BASENAME in
@@ -3883,7 +3891,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BASH+set}" = set; then :
+if ${ac_cv_path_BASH+:} false; then :
$as_echo_n "(cached) " >&6
else
case $BASH in
@@ -3942,7 +3950,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CAT+set}" = set; then :
+if ${ac_cv_path_CAT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CAT in
@@ -4001,7 +4009,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHMOD+set}" = set; then :
+if ${ac_cv_path_CHMOD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CHMOD in
@@ -4060,7 +4068,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CMP+set}" = set; then :
+if ${ac_cv_path_CMP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CMP in
@@ -4119,7 +4127,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_COMM+set}" = set; then :
+if ${ac_cv_path_COMM+:} false; then :
$as_echo_n "(cached) " >&6
else
case $COMM in
@@ -4178,7 +4186,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CP+set}" = set; then :
+if ${ac_cv_path_CP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CP in
@@ -4237,7 +4245,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CPIO+set}" = set; then :
+if ${ac_cv_path_CPIO+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CPIO in
@@ -4296,7 +4304,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CUT+set}" = set; then :
+if ${ac_cv_path_CUT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CUT in
@@ -4355,7 +4363,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DATE+set}" = set; then :
+if ${ac_cv_path_DATE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $DATE in
@@ -4414,7 +4422,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DIFF+set}" = set; then :
+if ${ac_cv_path_DIFF+:} false; then :
$as_echo_n "(cached) " >&6
else
case $DIFF in
@@ -4473,7 +4481,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DIRNAME+set}" = set; then :
+if ${ac_cv_path_DIRNAME+:} false; then :
$as_echo_n "(cached) " >&6
else
case $DIRNAME in
@@ -4532,7 +4540,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ECHO+set}" = set; then :
+if ${ac_cv_path_ECHO+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ECHO in
@@ -4591,7 +4599,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_EXPR+set}" = set; then :
+if ${ac_cv_path_EXPR+:} false; then :
$as_echo_n "(cached) " >&6
else
case $EXPR in
@@ -4650,7 +4658,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FILE+set}" = set; then :
+if ${ac_cv_path_FILE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $FILE in
@@ -4709,7 +4717,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FIND+set}" = set; then :
+if ${ac_cv_path_FIND+:} false; then :
$as_echo_n "(cached) " >&6
else
case $FIND in
@@ -4768,7 +4776,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_HEAD+set}" = set; then :
+if ${ac_cv_path_HEAD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $HEAD in
@@ -4827,7 +4835,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LN+set}" = set; then :
+if ${ac_cv_path_LN+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LN in
@@ -4886,7 +4894,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LS+set}" = set; then :
+if ${ac_cv_path_LS+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LS in
@@ -4945,7 +4953,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MKDIR+set}" = set; then :
+if ${ac_cv_path_MKDIR+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MKDIR in
@@ -5004,7 +5012,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MKTEMP+set}" = set; then :
+if ${ac_cv_path_MKTEMP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MKTEMP in
@@ -5063,7 +5071,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MV+set}" = set; then :
+if ${ac_cv_path_MV+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MV in
@@ -5122,7 +5130,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PRINTF+set}" = set; then :
+if ${ac_cv_path_PRINTF+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PRINTF in
@@ -5181,7 +5189,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_RM+set}" = set; then :
+if ${ac_cv_path_RM+:} false; then :
$as_echo_n "(cached) " >&6
else
case $RM in
@@ -5240,7 +5248,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SH+set}" = set; then :
+if ${ac_cv_path_SH+:} false; then :
$as_echo_n "(cached) " >&6
else
case $SH in
@@ -5299,7 +5307,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SORT+set}" = set; then :
+if ${ac_cv_path_SORT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $SORT in
@@ -5358,7 +5366,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TAIL+set}" = set; then :
+if ${ac_cv_path_TAIL+:} false; then :
$as_echo_n "(cached) " >&6
else
case $TAIL in
@@ -5417,7 +5425,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TAR+set}" = set; then :
+if ${ac_cv_path_TAR+:} false; then :
$as_echo_n "(cached) " >&6
else
case $TAR in
@@ -5476,7 +5484,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TEE+set}" = set; then :
+if ${ac_cv_path_TEE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $TEE in
@@ -5535,7 +5543,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TOUCH+set}" = set; then :
+if ${ac_cv_path_TOUCH+:} false; then :
$as_echo_n "(cached) " >&6
else
case $TOUCH in
@@ -5594,7 +5602,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TR+set}" = set; then :
+if ${ac_cv_path_TR+:} false; then :
$as_echo_n "(cached) " >&6
else
case $TR in
@@ -5653,7 +5661,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UNAME+set}" = set; then :
+if ${ac_cv_path_UNAME+:} false; then :
$as_echo_n "(cached) " >&6
else
case $UNAME in
@@ -5712,7 +5720,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UNIQ+set}" = set; then :
+if ${ac_cv_path_UNIQ+:} false; then :
$as_echo_n "(cached) " >&6
else
case $UNIQ in
@@ -5771,7 +5779,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_WC+set}" = set; then :
+if ${ac_cv_path_WC+:} false; then :
$as_echo_n "(cached) " >&6
else
case $WC in
@@ -5830,7 +5838,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_WHICH+set}" = set; then :
+if ${ac_cv_path_WHICH+:} false; then :
$as_echo_n "(cached) " >&6
else
case $WHICH in
@@ -5889,7 +5897,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XARGS+set}" = set; then :
+if ${ac_cv_path_XARGS+:} false; then :
$as_echo_n "(cached) " >&6
else
case $XARGS in
@@ -5949,7 +5957,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
@@ -5999,7 +6007,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
@@ -6074,7 +6082,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -6153,7 +6161,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
$as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then :
+if ${ac_cv_path_FGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -6232,7 +6240,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
$as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then :
+if ${ac_cv_path_SED+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -6318,7 +6326,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_NAWK+set}" = set; then :
+if ${ac_cv_path_NAWK+:} false; then :
$as_echo_n "(cached) " >&6
else
case $NAWK in
@@ -6382,7 +6390,7 @@ THEPWDCMD=pwd
set dummy cygpath; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CYGPATH+set}" = set; then :
+if ${ac_cv_path_CYGPATH+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CYGPATH in
@@ -6422,7 +6430,7 @@ fi
set dummy readlink; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_READLINK+set}" = set; then :
+if ${ac_cv_path_READLINK+:} false; then :
$as_echo_n "(cached) " >&6
else
case $READLINK in
@@ -6462,7 +6470,7 @@ fi
set dummy df; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DF+set}" = set; then :
+if ${ac_cv_path_DF+:} false; then :
$as_echo_n "(cached) " >&6
else
case $DF in
@@ -6502,7 +6510,7 @@ fi
set dummy SetFile; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SETFILE+set}" = set; then :
+if ${ac_cv_path_SETFILE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $SETFILE in
@@ -6548,7 +6556,7 @@ $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then :
+if ${ac_cv_build+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_build_alias=$build_alias
@@ -6564,7 +6572,7 @@ fi
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
@@ -6582,7 +6590,7 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then :
+if ${ac_cv_host+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$host_alias" = x; then
@@ -6597,7 +6605,7 @@ fi
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
@@ -6615,7 +6623,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
$as_echo_n "checking target system type... " >&6; }
-if test "${ac_cv_target+set}" = set; then :
+if ${ac_cv_target+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$target_alias" = x; then
@@ -6630,7 +6638,7 @@ fi
$as_echo "$ac_cv_target" >&6; }
case $ac_cv_target in
*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
esac
target=$ac_cv_target
ac_save_IFS=$IFS; IFS='-'
@@ -8156,7 +8164,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PKGHANDLER+set}" = set; then :
+if ${ac_cv_prog_PKGHANDLER+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$PKGHANDLER"; then
@@ -8521,7 +8529,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHECK_GMAKE+set}" = set; then :
+if ${ac_cv_path_CHECK_GMAKE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CHECK_GMAKE in
@@ -8875,7 +8883,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHECK_MAKE+set}" = set; then :
+if ${ac_cv_path_CHECK_MAKE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CHECK_MAKE in
@@ -9234,7 +9242,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHECK_TOOLSDIR_GMAKE+set}" = set; then :
+if ${ac_cv_path_CHECK_TOOLSDIR_GMAKE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CHECK_TOOLSDIR_GMAKE in
@@ -9587,7 +9595,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHECK_TOOLSDIR_MAKE+set}" = set; then :
+if ${ac_cv_path_CHECK_TOOLSDIR_MAKE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CHECK_TOOLSDIR_MAKE in
@@ -9983,7 +9991,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UNZIP+set}" = set; then :
+if ${ac_cv_path_UNZIP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $UNZIP in
@@ -10042,7 +10050,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ZIP+set}" = set; then :
+if ${ac_cv_path_ZIP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ZIP in
@@ -10101,7 +10109,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
set dummy ldd; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LDD+set}" = set; then :
+if ${ac_cv_path_LDD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LDD in
@@ -10147,7 +10155,7 @@ fi
set dummy otool; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_OTOOL+set}" = set; then :
+if ${ac_cv_path_OTOOL+:} false; then :
$as_echo_n "(cached) " >&6
else
case $OTOOL in
@@ -10192,7 +10200,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_READELF+set}" = set; then :
+if ${ac_cv_path_READELF+:} false; then :
$as_echo_n "(cached) " >&6
else
case $READELF in
@@ -10235,7 +10243,7 @@ done
set dummy hg; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_HG+set}" = set; then :
+if ${ac_cv_path_HG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $HG in
@@ -10275,7 +10283,7 @@ fi
set dummy stat; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_STAT+set}" = set; then :
+if ${ac_cv_path_STAT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $STAT in
@@ -10315,7 +10323,7 @@ fi
set dummy time; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TIME+set}" = set; then :
+if ${ac_cv_path_TIME+:} false; then :
$as_echo_n "(cached) " >&6
else
case $TIME in
@@ -10368,7 +10376,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_COMM+set}" = set; then :
+if ${ac_cv_path_COMM+:} false; then :
$as_echo_n "(cached) " >&6
else
case $COMM in
@@ -10430,7 +10438,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XATTR+set}" = set; then :
+if ${ac_cv_path_XATTR+:} false; then :
$as_echo_n "(cached) " >&6
else
case $XATTR in
@@ -10486,7 +10494,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
set dummy codesign; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CODESIGN+set}" = set; then :
+if ${ac_cv_path_CODESIGN+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CODESIGN in
@@ -10550,7 +10558,7 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
@@ -10593,7 +10601,7 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_PKG_CONFIG in
@@ -10766,7 +10774,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_BDEPS_UNZIP+set}" = set; then :
+if ${ac_cv_prog_BDEPS_UNZIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$BDEPS_UNZIP"; then
@@ -10812,7 +10820,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_BDEPS_FTP+set}" = set; then :
+if ${ac_cv_prog_BDEPS_FTP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$BDEPS_FTP"; then
@@ -12108,7 +12116,7 @@ $as_echo "$BOOT_JDK_VERSION" >&6; }
set dummy javac; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_JAVAC_CHECK+set}" = set; then :
+if ${ac_cv_path_JAVAC_CHECK+:} false; then :
$as_echo_n "(cached) " >&6
else
case $JAVAC_CHECK in
@@ -12148,7 +12156,7 @@ fi
set dummy java; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_JAVA_CHECK+set}" = set; then :
+if ${ac_cv_path_JAVA_CHECK+:} false; then :
$as_echo_n "(cached) " >&6
else
case $JAVA_CHECK in
@@ -16477,7 +16485,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_JTREGEXE+set}" = set; then :
+if ${ac_cv_path_JTREGEXE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $JTREGEXE in
@@ -16545,7 +16553,7 @@ if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
set dummy link; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CYGWIN_LINK+set}" = set; then :
+if ${ac_cv_path_CYGWIN_LINK+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CYGWIN_LINK in
@@ -17319,6 +17327,8 @@ $as_echo "ok" >&6; }
# Remove any trailing \ from INCLUDE and LIB to avoid trouble in spec.gmk.
VS_INCLUDE=`$ECHO "$INCLUDE" | $SED 's/\\\\$//'`
VS_LIB=`$ECHO "$LIB" | $SED 's/\\\\$//'`
+ # Remove any paths containing # (typically F#) as that messes up make
+ PATH=`$ECHO "$PATH" | $SED 's/[^:#]*#[^:]*://g'`
VS_PATH="$PATH"
@@ -17986,7 +17996,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BUILD_CC+set}" = set; then :
+if ${ac_cv_path_BUILD_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
case $BUILD_CC in
@@ -18297,7 +18307,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BUILD_CXX+set}" = set; then :
+if ${ac_cv_path_BUILD_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
case $BUILD_CXX in
@@ -18606,7 +18616,7 @@ $as_echo "$as_me: Rewriting BUILD_CXX to \"$new_complete\"" >&6;}
set dummy ld; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BUILD_LD+set}" = set; then :
+if ${ac_cv_path_BUILD_LD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $BUILD_LD in
@@ -19113,7 +19123,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TOOLS_DIR_CC+set}" = set; then :
+if ${ac_cv_path_TOOLS_DIR_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
case $TOOLS_DIR_CC in
@@ -19165,7 +19175,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_POTENTIAL_CC+set}" = set; then :
+if ${ac_cv_path_POTENTIAL_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
case $POTENTIAL_CC in
@@ -19578,7 +19588,7 @@ $as_echo "yes, trying to find proper $COMPILER_NAME compiler" >&6; }
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PROPER_COMPILER_CC+set}" = set; then :
+if ${ac_cv_prog_PROPER_COMPILER_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$PROPER_COMPILER_CC"; then
@@ -19622,7 +19632,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_PROPER_COMPILER_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_PROPER_COMPILER_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_PROPER_COMPILER_CC"; then
@@ -20072,7 +20082,7 @@ if test -n "$ac_tool_prefix"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -20116,7 +20126,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -20169,7 +20179,7 @@ fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -20284,7 +20294,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -20327,7 +20337,7 @@ else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -20386,7 +20396,7 @@ $as_echo "$ac_try_echo"; } >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
fi
fi
fi
@@ -20397,7 +20407,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -20438,7 +20448,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
@@ -20448,7 +20458,7 @@ OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -20485,7 +20495,7 @@ ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
@@ -20563,7 +20573,7 @@ else
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
@@ -20686,7 +20696,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TOOLS_DIR_CXX+set}" = set; then :
+if ${ac_cv_path_TOOLS_DIR_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
case $TOOLS_DIR_CXX in
@@ -20738,7 +20748,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_POTENTIAL_CXX+set}" = set; then :
+if ${ac_cv_path_POTENTIAL_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
case $POTENTIAL_CXX in
@@ -21151,7 +21161,7 @@ $as_echo "yes, trying to find proper $COMPILER_NAME compiler" >&6; }
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PROPER_COMPILER_CXX+set}" = set; then :
+if ${ac_cv_prog_PROPER_COMPILER_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$PROPER_COMPILER_CXX"; then
@@ -21195,7 +21205,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_PROPER_COMPILER_CXX+set}" = set; then :
+if ${ac_cv_prog_ac_ct_PROPER_COMPILER_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_PROPER_COMPILER_CXX"; then
@@ -21649,7 +21659,7 @@ if test -z "$CXX"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then :
+if ${ac_cv_prog_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CXX"; then
@@ -21693,7 +21703,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CXX"; then
@@ -21771,7 +21781,7 @@ done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -21808,7 +21818,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
$as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if test "${ac_cv_prog_cxx_g+set}" = set; then :
+if ${ac_cv_prog_cxx_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
@@ -21906,7 +21916,7 @@ if test -n "$ac_tool_prefix"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJC+set}" = set; then :
+if ${ac_cv_prog_OBJC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OBJC"; then
@@ -21950,7 +21960,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OBJC"; then
@@ -22026,7 +22036,7 @@ done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Objective C compiler" >&5
$as_echo_n "checking whether we are using the GNU Objective C compiler... " >&6; }
-if test "${ac_cv_objc_compiler_gnu+set}" = set; then :
+if ${ac_cv_objc_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -22063,7 +22073,7 @@ ac_test_OBJCFLAGS=${OBJCFLAGS+set}
ac_save_OBJCFLAGS=$OBJCFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $OBJC accepts -g" >&5
$as_echo_n "checking whether $OBJC accepts -g... " >&6; }
-if test "${ac_cv_prog_objc_g+set}" = set; then :
+if ${ac_cv_prog_objc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_objc_werror_flag=$ac_objc_werror_flag
@@ -22439,7 +22449,7 @@ if test "x$OPENJDK_TARGET_OS" != xwindows; then
set dummy ${ac_tool_prefix}ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then :
+if ${ac_cv_prog_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AR"; then
@@ -22479,7 +22489,7 @@ if test -z "$ac_cv_prog_AR"; then
set dummy ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_AR"; then
@@ -22821,7 +22831,7 @@ if test "x$OPENJDK_TARGET_OS" = xwindows; then :
set dummy link; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_WINLD+set}" = set; then :
+if ${ac_cv_prog_WINLD+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$WINLD"; then
@@ -23160,7 +23170,7 @@ $as_echo "yes" >&6; }
set dummy mt; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_MT+set}" = set; then :
+if ${ac_cv_prog_MT+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$MT"; then
@@ -23481,7 +23491,7 @@ $as_echo "$as_me: Rewriting MT to \"$new_complete\"" >&6;}
set dummy rc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RC+set}" = set; then :
+if ${ac_cv_prog_RC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$RC"; then
@@ -23873,7 +23883,7 @@ fi
set dummy lib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_WINAR+set}" = set; then :
+if ${ac_cv_prog_WINAR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$WINAR"; then
@@ -24179,7 +24189,7 @@ $as_echo "$as_me: Rewriting WINAR to \"$new_complete\"" >&6;}
set dummy dumpbin; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_DUMPBIN+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$DUMPBIN"; then
@@ -24498,7 +24508,7 @@ if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then :
+ if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
@@ -24614,7 +24624,7 @@ else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=cpp
@@ -24898,7 +24908,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
if test -z "$CXXCPP"; then
- if test "${ac_cv_prog_CXXCPP+set}" = set; then :
+ if ${ac_cv_prog_CXXCPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CXXCPP needs to be expanded
@@ -25014,7 +25024,7 @@ else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=cpp
@@ -25316,7 +25326,7 @@ if test "x$OPENJDK_TARGET_OS" = xsolaris; then
set dummy as; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_AS+set}" = set; then :
+if ${ac_cv_path_AS+:} false; then :
$as_echo_n "(cached) " >&6
else
case $AS in
@@ -25628,7 +25638,7 @@ if test "x$OPENJDK_TARGET_OS" = xsolaris; then
set dummy nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_NM+set}" = set; then :
+if ${ac_cv_path_NM+:} false; then :
$as_echo_n "(cached) " >&6
else
case $NM in
@@ -25934,7 +25944,7 @@ $as_echo "$as_me: Rewriting NM to \"$new_complete\"" >&6;}
set dummy gnm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GNM+set}" = set; then :
+if ${ac_cv_path_GNM+:} false; then :
$as_echo_n "(cached) " >&6
else
case $GNM in
@@ -26240,7 +26250,7 @@ $as_echo "$as_me: Rewriting GNM to \"$new_complete\"" >&6;}
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_STRIP+set}" = set; then :
+if ${ac_cv_path_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $STRIP in
@@ -26546,7 +26556,7 @@ $as_echo "$as_me: Rewriting STRIP to \"$new_complete\"" >&6;}
set dummy mcs; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MCS+set}" = set; then :
+if ${ac_cv_path_MCS+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MCS in
@@ -26854,7 +26864,7 @@ elif test "x$OPENJDK_TARGET_OS" != xwindows; then
set dummy ${ac_tool_prefix}nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NM+set}" = set; then :
+if ${ac_cv_prog_NM+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$NM"; then
@@ -26894,7 +26904,7 @@ if test -z "$ac_cv_prog_NM"; then
set dummy nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NM+set}" = set; then :
+if ${ac_cv_prog_ac_ct_NM+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_NM"; then
@@ -27214,7 +27224,7 @@ $as_echo "$as_me: Rewriting NM to \"$new_complete\"" >&6;}
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$STRIP"; then
@@ -27254,7 +27264,7 @@ if test -z "$ac_cv_prog_STRIP"; then
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_STRIP"; then
@@ -27579,7 +27589,7 @@ if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux;
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJCOPY+set}" = set; then :
+if ${ac_cv_prog_OBJCOPY+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OBJCOPY"; then
@@ -27623,7 +27633,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJCOPY+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJCOPY+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OBJCOPY"; then
@@ -27950,7 +27960,7 @@ if test -n "$ac_tool_prefix"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_OBJDUMP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OBJDUMP"; then
@@ -27994,7 +28004,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OBJDUMP"; then
@@ -28318,7 +28328,7 @@ if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
set dummy lipo; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LIPO+set}" = set; then :
+if ${ac_cv_path_LIPO+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LIPO in
@@ -28635,7 +28645,7 @@ PATH="$OLD_PATH"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -28812,7 +28822,7 @@ fi
for ac_header in stdio.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdio_h" = x""yes; then :
+if test "x$ac_cv_header_stdio_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STDIO_H 1
_ACEOF
@@ -28841,7 +28851,7 @@ done
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int *" >&5
$as_echo_n "checking size of int *... " >&6; }
-if test "${ac_cv_sizeof_int_p+set}" = set; then :
+if ${ac_cv_sizeof_int_p+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (int *))" "ac_cv_sizeof_int_p" "$ac_includes_default"; then :
@@ -28851,7 +28861,7 @@ else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (int *)
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_int_p=0
fi
@@ -28898,7 +28908,7 @@ $as_echo "$OPENJDK_TARGET_CPU_BITS bits" >&6; }
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
-if test "${ac_cv_c_bigendian+set}" = set; then :
+if ${ac_cv_c_bigendian+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_c_bigendian=unknown
@@ -30074,8 +30084,8 @@ if test "x$with_x" = xno; then
have_x=disabled
else
case $x_includes,$x_libraries in #(
- *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5 ;; #(
- *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then :
+ *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #(
+ *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then :
$as_echo_n "(cached) " >&6
else
# One or both of the vars are not set, and there is no cached value.
@@ -30352,7 +30362,7 @@ if ac_fn_cxx_try_link "$LINENO"; then :
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5
$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; }
-if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then :
+if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -30386,14 +30396,14 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; }
-if test "x$ac_cv_lib_dnet_dnet_ntoa" = x""yes; then :
+if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then :
X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
fi
if test $ac_cv_lib_dnet_dnet_ntoa = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5
$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; }
-if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then :
+if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -30427,7 +30437,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; }
-if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = x""yes; then :
+if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then :
X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
fi
@@ -30446,14 +30456,14 @@ rm -f core conftest.err conftest.$ac_objext \
# The functions gethostbyname, getservbyname, and inet_addr are
# in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
ac_fn_cxx_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
-if test "x$ac_cv_func_gethostbyname" = x""yes; then :
+if test "x$ac_cv_func_gethostbyname" = xyes; then :
fi
if test $ac_cv_func_gethostbyname = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5
$as_echo_n "checking for gethostbyname in -lnsl... " >&6; }
-if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then :
+if ${ac_cv_lib_nsl_gethostbyname+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -30487,14 +30497,14 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5
$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; }
-if test "x$ac_cv_lib_nsl_gethostbyname" = x""yes; then :
+if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then :
X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
fi
if test $ac_cv_lib_nsl_gethostbyname = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5
$as_echo_n "checking for gethostbyname in -lbsd... " >&6; }
-if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then :
+if ${ac_cv_lib_bsd_gethostbyname+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -30528,7 +30538,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5
$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; }
-if test "x$ac_cv_lib_bsd_gethostbyname" = x""yes; then :
+if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then :
X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
fi
@@ -30543,14 +30553,14 @@ fi
# must be given before -lnsl if both are needed. We assume that
# if connect needs -lnsl, so does gethostbyname.
ac_fn_cxx_check_func "$LINENO" "connect" "ac_cv_func_connect"
-if test "x$ac_cv_func_connect" = x""yes; then :
+if test "x$ac_cv_func_connect" = xyes; then :
fi
if test $ac_cv_func_connect = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
$as_echo_n "checking for connect in -lsocket... " >&6; }
-if test "${ac_cv_lib_socket_connect+set}" = set; then :
+if ${ac_cv_lib_socket_connect+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -30584,7 +30594,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5
$as_echo "$ac_cv_lib_socket_connect" >&6; }
-if test "x$ac_cv_lib_socket_connect" = x""yes; then :
+if test "x$ac_cv_lib_socket_connect" = xyes; then :
X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
fi
@@ -30592,14 +30602,14 @@ fi
# Guillermo Gomez says -lposix is necessary on A/UX.
ac_fn_cxx_check_func "$LINENO" "remove" "ac_cv_func_remove"
-if test "x$ac_cv_func_remove" = x""yes; then :
+if test "x$ac_cv_func_remove" = xyes; then :
fi
if test $ac_cv_func_remove = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5
$as_echo_n "checking for remove in -lposix... " >&6; }
-if test "${ac_cv_lib_posix_remove+set}" = set; then :
+if ${ac_cv_lib_posix_remove+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -30633,7 +30643,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5
$as_echo "$ac_cv_lib_posix_remove" >&6; }
-if test "x$ac_cv_lib_posix_remove" = x""yes; then :
+if test "x$ac_cv_lib_posix_remove" = xyes; then :
X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
fi
@@ -30641,14 +30651,14 @@ fi
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
ac_fn_cxx_check_func "$LINENO" "shmat" "ac_cv_func_shmat"
-if test "x$ac_cv_func_shmat" = x""yes; then :
+if test "x$ac_cv_func_shmat" = xyes; then :
fi
if test $ac_cv_func_shmat = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5
$as_echo_n "checking for shmat in -lipc... " >&6; }
-if test "${ac_cv_lib_ipc_shmat+set}" = set; then :
+if ${ac_cv_lib_ipc_shmat+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -30682,7 +30692,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5
$as_echo "$ac_cv_lib_ipc_shmat" >&6; }
-if test "x$ac_cv_lib_ipc_shmat" = x""yes; then :
+if test "x$ac_cv_lib_ipc_shmat" = xyes; then :
X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
fi
@@ -30700,7 +30710,7 @@ fi
# John Interrante, Karl Berry
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5
$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; }
-if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then :
+if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -30734,7 +30744,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; }
-if test "x$ac_cv_lib_ICE_IceConnectionNumber" = x""yes; then :
+if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then :
X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
fi
@@ -31752,7 +31762,7 @@ $as_echo "$FREETYPE2_FOUND" >&6; }
LDFLAGS="$FREETYPE2_LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FT_Init_FreeType in -lfreetype" >&5
$as_echo_n "checking for FT_Init_FreeType in -lfreetype... " >&6; }
-if test "${ac_cv_lib_freetype_FT_Init_FreeType+set}" = set; then :
+if ${ac_cv_lib_freetype_FT_Init_FreeType+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -31786,7 +31796,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_freetype_FT_Init_FreeType" >&5
$as_echo "$ac_cv_lib_freetype_FT_Init_FreeType" >&6; }
-if test "x$ac_cv_lib_freetype_FT_Init_FreeType" = x""yes; then :
+if test "x$ac_cv_lib_freetype_FT_Init_FreeType" = xyes; then :
FREETYPE2_FOUND=true
else
as_fn_error $? "Could not find freetype2! $HELP_MSG " "$LINENO" 5
@@ -32074,7 +32084,7 @@ fi
for ac_header in alsa/asoundlib.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "alsa/asoundlib.h" "ac_cv_header_alsa_asoundlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_alsa_asoundlib_h" = x""yes; then :
+if test "x$ac_cv_header_alsa_asoundlib_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_ALSA_ASOUNDLIB_H 1
_ACEOF
@@ -32133,7 +32143,7 @@ fi
USE_EXTERNAL_LIBJPEG=true
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ljpeg" >&5
$as_echo_n "checking for main in -ljpeg... " >&6; }
-if test "${ac_cv_lib_jpeg_main+set}" = set; then :
+if ${ac_cv_lib_jpeg_main+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -32161,7 +32171,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_main" >&5
$as_echo "$ac_cv_lib_jpeg_main" >&6; }
-if test "x$ac_cv_lib_jpeg_main" = x""yes; then :
+if test "x$ac_cv_lib_jpeg_main" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBJPEG 1
_ACEOF
@@ -32210,7 +32220,7 @@ if test "x${with_giflib}" = "xbundled"; then
USE_EXTERNAL_LIBGIF=false
elif test "x${with_giflib}" = "xsystem"; then
ac_fn_cxx_check_header_mongrel "$LINENO" "gif_lib.h" "ac_cv_header_gif_lib_h" "$ac_includes_default"
-if test "x$ac_cv_header_gif_lib_h" = x""yes; then :
+if test "x$ac_cv_header_gif_lib_h" = xyes; then :
else
as_fn_error $? "--with-giflib=system specified, but gif_lib.h not found!" "$LINENO" 5
@@ -32219,7 +32229,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DGifGetCode in -lgif" >&5
$as_echo_n "checking for DGifGetCode in -lgif... " >&6; }
-if test "${ac_cv_lib_gif_DGifGetCode+set}" = set; then :
+if ${ac_cv_lib_gif_DGifGetCode+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -32253,7 +32263,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gif_DGifGetCode" >&5
$as_echo "$ac_cv_lib_gif_DGifGetCode" >&6; }
-if test "x$ac_cv_lib_gif_DGifGetCode" = x""yes; then :
+if test "x$ac_cv_lib_gif_DGifGetCode" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBGIF 1
_ACEOF
@@ -32285,7 +32295,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress in -lz" >&5
$as_echo_n "checking for compress in -lz... " >&6; }
-if test "${ac_cv_lib_z_compress+set}" = set; then :
+if ${ac_cv_lib_z_compress+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -32319,7 +32329,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress" >&5
$as_echo "$ac_cv_lib_z_compress" >&6; }
-if test "x$ac_cv_lib_z_compress" = x""yes; then :
+if test "x$ac_cv_lib_z_compress" = xyes; then :
ZLIB_FOUND=yes
else
ZLIB_FOUND=no
@@ -32412,7 +32422,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
$as_echo_n "checking for cos in -lm... " >&6; }
-if test "${ac_cv_lib_m_cos+set}" = set; then :
+if ${ac_cv_lib_m_cos+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -32446,7 +32456,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
$as_echo "$ac_cv_lib_m_cos" >&6; }
-if test "x$ac_cv_lib_m_cos" = x""yes; then :
+if test "x$ac_cv_lib_m_cos" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBM 1
_ACEOF
@@ -32470,7 +32480,7 @@ save_LIBS="$LIBS"
LIBS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -32504,7 +32514,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBDL 1
_ACEOF
@@ -32734,7 +32744,7 @@ and LIBFFI_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see .
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
else
LIBFFI_CFLAGS=$pkg_cv_LIBFFI_CFLAGS
LIBFFI_LIBS=$pkg_cv_LIBFFI_LIBS
@@ -32750,7 +32760,7 @@ if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
set dummy llvm-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LLVM_CONFIG+set}" = set; then :
+if ${ac_cv_prog_LLVM_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$LLVM_CONFIG"; then
@@ -33366,7 +33376,7 @@ fi
set dummy ccache; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CCACHE+set}" = set; then :
+if ${ac_cv_path_CCACHE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CCACHE in
@@ -33628,10 +33638,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
+ if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -33663,7 +33684,7 @@ LTLIBOBJS=$ac_ltlibobjs
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -33764,6 +33785,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -34071,7 +34093,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling.
ac_log="
This file was extended by OpenJDK $as_me jdk8, which was
-generated by GNU Autoconf 2.67. Invocation command line was
+generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -34134,7 +34156,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
OpenJDK config.status jdk8
-configured by $0, generated by GNU Autoconf 2.67,
+configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -34263,7 +34285,7 @@ do
"$OUTPUT_ROOT/spec.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.sh:$AUTOCONF_DIR/spec.sh.in" ;;
"$OUTPUT_ROOT/Makefile") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in" ;;
- *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
@@ -34285,9 +34307,10 @@ fi
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- tmp=
+ tmp= ac_tmp=
trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
@@ -34295,12 +34318,13 @@ $debug ||
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
+ test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
@@ -34322,7 +34346,7 @@ else
ac_cs_awk_cr=$ac_cr
fi
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
@@ -34350,7 +34374,7 @@ done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
@@ -34398,7 +34422,7 @@ t delim
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
@@ -34430,7 +34454,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
@@ -34464,7 +34488,7 @@ fi # test -n "$CONFIG_FILES"
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
@@ -34476,8 +34500,8 @@ _ACEOF
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
- ac_t=`sed -n "/$ac_delim/p" confdefs.h`
- if test -z "$ac_t"; then
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
@@ -34578,7 +34602,7 @@ do
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -34597,7 +34621,7 @@ do
for ac_f
do
case $ac_f in
- -) ac_f="$tmp/stdin";;
+ -) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
@@ -34606,7 +34630,7 @@ do
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
@@ -34632,8 +34656,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
esac
case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin" \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
@@ -34758,21 +34782,22 @@ s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
$ac_datarootdir_hack
"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&2;}
- rm -f "$tmp/stdin"
+ rm -f "$ac_tmp/stdin"
case $ac_file in
- -) cat "$tmp/out" && rm -f "$tmp/out";;
- *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
@@ -34783,20 +34808,20 @@ which seems to be undefined. Please make sure it is defined" >&2;}
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
- } >"$tmp/config.h" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
- if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
- mv "$tmp/config.h" "$ac_file" \
+ mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
diff --git a/common/autoconf/toolchain_windows.m4 b/common/autoconf/toolchain_windows.m4
index 966c0133995..e5d4fff38f9 100644
--- a/common/autoconf/toolchain_windows.m4
+++ b/common/autoconf/toolchain_windows.m4
@@ -208,6 +208,8 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
# Remove any trailing \ from INCLUDE and LIB to avoid trouble in spec.gmk.
VS_INCLUDE=`$ECHO "$INCLUDE" | $SED 's/\\\\$//'`
VS_LIB=`$ECHO "$LIB" | $SED 's/\\\\$//'`
+ # Remove any paths containing # (typically F#) as that messes up make
+ PATH=`$ECHO "$PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
VS_PATH="$PATH"
AC_SUBST(VS_INCLUDE)
AC_SUBST(VS_LIB)
From dc7547e0c046afca3db2114298b59fc1b2864f78 Mon Sep 17 00:00:00 2001
From: "J. Duke"
Date: Wed, 5 Jul 2017 19:02:09 +0200
Subject: [PATCH 086/101] Added tag jdk8-b97 for changeset 0a85476a0b9c
---
.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/.hgtags b/.hgtags
index 1e4981545c3..a470c9afa31 100644
--- a/.hgtags
+++ b/.hgtags
@@ -218,3 +218,4 @@ b72ae39e1329fefae50d4690db4fde43f3841a95 jdk8-b93
0d804e3b955dce406af6a79ac1cc35c696aff7fb jdk8-b94
49fe9c8049132647ad38837a877dd473e6c9b0e5 jdk8-b95
ea73f01b9053e7165e7ba80f242bafecbc6af712 jdk8-b96
+0a85476a0b9cb876d5666d45097dac68bef3fce1 jdk8-b97
From 51ac0c583fed380001f8d13cc3573f1771657fcd Mon Sep 17 00:00:00 2001
From: David Katleman
Date: Thu, 11 Jul 2013 10:13:49 -0700
Subject: [PATCH 087/101] Added tag jdk8-b98 for changeset 5b24b75e2710
---
jdk/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/jdk/.hgtags b/jdk/.hgtags
index e86f63c268a..45fbf746c13 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -219,3 +219,4 @@ a2a2a91075ad85becbe10a39d7fd04ef9bea8df5 jdk8-b92
42aa9f1828852bb8b77e98ec695211493ae0759d jdk8-b95
4a5d3cf2b3af1660db0237e8da324c140e534fa4 jdk8-b96
978a95239044f26dcc8a6d59246be07ad6ca6be2 jdk8-b97
+c4908732fef5235f1b98cafe0ce507771ef7892c jdk8-b98
From 381356dde36bc8d587ff5b1b97b84c411d577ef2 Mon Sep 17 00:00:00 2001
From: Robert Field
Date: Thu, 11 Jul 2013 14:02:20 +0100
Subject: [PATCH 088/101] 8016281: The SAM method should be passed to the
metafactory as a MethodType not a MethodHandle 8020010: Move lambda bridge
creation from metafactory and VM to compiler
JDK/metafactory component of the bridge fix and and MethodType vs. MethodHandle changes.
Reviewed-by: twisti, briangoetz, forax
---
.../AbstractValidatingLambdaMetafactory.java | 209 +++++-----------
.../invoke/InnerClassLambdaMetafactory.java | 224 ++++++++++--------
.../java/lang/invoke/LambdaMetafactory.java | 177 +++++++++-----
.../java/lang/invoke/SerializedLambda.java | 67 +++---
4 files changed, 340 insertions(+), 337 deletions(-)
diff --git a/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java b/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
index 892a9dd5316..79b3b69fcf3 100644
--- a/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
+++ b/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
@@ -24,24 +24,23 @@
*/
package java.lang.invoke;
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
import sun.invoke.util.Wrapper;
-import static sun.invoke.util.Wrapper.*;
+
+import static sun.invoke.util.Wrapper.forPrimitiveType;
+import static sun.invoke.util.Wrapper.forWrapperType;
+import static sun.invoke.util.Wrapper.isWrapperType;
/**
- * Abstract implementation of a lambda metafactory which provides parameter unrolling and input validation.
+ * Abstract implementation of a lambda metafactory which provides parameter
+ * unrolling and input validation.
*
* @see LambdaMetafactory
*/
/* package */ abstract class AbstractValidatingLambdaMetafactory {
/*
- * For context, the comments for the following fields are marked in quotes with their values, given this program:
+ * For context, the comments for the following fields are marked in quotes
+ * with their values, given this program:
* interface II { Object foo(T x); }
* interface JJ extends II { }
* class CC { String impl(int i) { return "impl:"+i; }}
@@ -54,9 +53,7 @@ import static sun.invoke.util.Wrapper.*;
final Class> targetClass; // The class calling the meta-factory via invokedynamic "class X"
final MethodType invokedType; // The type of the invoked method "(CC)II"
final Class> samBase; // The type of the returned instance "interface JJ"
- final MethodHandle samMethod; // Raw method handle for the functional interface method
- final MethodHandleInfo samInfo; // Info about the SAM method handle "MethodHandleInfo[9 II.foo(Object)Object]"
- final Class> samClass; // Interface containing the SAM method "interface II"
+ final String samMethodName; // Name of the SAM method "foo"
final MethodType samMethodType; // Type of the SAM method "(Object)Object"
final MethodHandle implMethod; // Raw method handle for the implementation method
final MethodHandleInfo implInfo; // Info about the implementation method handle "MethodHandleInfo[5 CC.impl(int)String]"
@@ -67,44 +64,64 @@ import static sun.invoke.util.Wrapper.*;
final MethodType instantiatedMethodType; // Instantiated erased functional interface method type "(Integer)Object"
final boolean isSerializable; // Should the returned instance be serializable
final Class>[] markerInterfaces; // Additional marker interfaces to be implemented
+ final MethodType[] additionalBridges; // Signatures of additional methods to bridge
/**
* Meta-factory constructor.
*
- * @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges
- * of the caller.
- * @param invokedType Stacked automatically by VM; the signature of the invoked method, which includes the
- * expected static type of the returned lambda object, and the static types of the captured
- * arguments for the lambda. In the event that the implementation method is an instance method,
- * the first argument in the invocation signature will correspond to the receiver.
- * @param samMethod The primary method in the functional interface to which the lambda or method reference is
- * being converted, represented as a method handle.
- * @param implMethod The implementation method which should be called (with suitable adaptation of argument
- * types, return types, and adjustment for captured arguments) when methods of the resulting
- * functional interface instance are invoked.
- * @param instantiatedMethodType The signature of the primary functional interface method after type variables
- * are substituted with their instantiation from the capture site
+ * @param caller Stacked automatically by VM; represents a lookup context
+ * with the accessibility privileges of the caller.
+ * @param invokedType Stacked automatically by VM; the signature of the
+ * invoked method, which includes the expected static
+ * type of the returned lambda object, and the static
+ * types of the captured arguments for the lambda. In
+ * the event that the implementation method is an
+ * instance method, the first argument in the invocation
+ * signature will correspond to the receiver.
+ * @param samMethodName Name of the method in the functional interface to
+ * which the lambda or method reference is being
+ * converted, represented as a String.
+ * @param samMethodType Type of the method in the functional interface to
+ * which the lambda or method reference is being
+ * converted, represented as a MethodType.
+ * @param implMethod The implementation method which should be called
+ * (with suitable adaptation of argument types, return
+ * types, and adjustment for captured arguments) when
+ * methods of the resulting functional interface instance
+ * are invoked.
+ * @param instantiatedMethodType The signature of the primary functional
+ * interface method after type variables are
+ * substituted with their instantiation from
+ * the capture site
+ * @param isSerializable Should the lambda be made serializable? If set,
+ * either the target type or one of the additional SAM
+ * types must extend {@code Serializable}.
+ * @param markerInterfaces Additional interfaces which the lambda object
+ * should implement.
+ * @param additionalBridges Method types for additional signatures to be
+ * bridged to the implementation method
* @throws ReflectiveOperationException
- * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated
+ * @throws LambdaConversionException If any of the meta-factory protocol
+ * invariants are violated
*/
AbstractValidatingLambdaMetafactory(MethodHandles.Lookup caller,
MethodType invokedType,
- MethodHandle samMethod,
+ String samMethodName,
+ MethodType samMethodType,
MethodHandle implMethod,
MethodType instantiatedMethodType,
- int flags,
- Class>[] markerInterfaces)
+ boolean isSerializable,
+ Class>[] markerInterfaces,
+ MethodType[] additionalBridges)
throws ReflectiveOperationException, LambdaConversionException {
this.targetClass = caller.lookupClass();
this.invokedType = invokedType;
this.samBase = invokedType.returnType();
- this.samMethod = samMethod;
- this.samInfo = new MethodHandleInfo(samMethod);
- this.samClass = samInfo.getDeclaringClass();
- this.samMethodType = samInfo.getMethodType();
+ this.samMethodName = samMethodName;
+ this.samMethodType = samMethodType;
this.implMethod = implMethod;
this.implInfo = new MethodHandleInfo(implMethod);
@@ -118,32 +135,24 @@ import static sun.invoke.util.Wrapper.*;
implKind == MethodHandleInfo.REF_invokeInterface;
this.implDefiningClass = implInfo.getDeclaringClass();
this.implMethodType = implInfo.getMethodType();
-
this.instantiatedMethodType = instantiatedMethodType;
+ this.isSerializable = isSerializable;
+ this.markerInterfaces = markerInterfaces;
+ this.additionalBridges = additionalBridges;
- if (!samClass.isInterface()) {
+ if (!samBase.isInterface()) {
throw new LambdaConversionException(String.format(
"Functional interface %s is not an interface",
- samClass.getName()));
+ samBase.getName()));
}
- boolean foundSerializableSupertype = Serializable.class.isAssignableFrom(samBase);
for (Class> c : markerInterfaces) {
if (!c.isInterface()) {
throw new LambdaConversionException(String.format(
"Marker interface %s is not an interface",
c.getName()));
}
- foundSerializableSupertype |= Serializable.class.isAssignableFrom(c);
}
- this.isSerializable = ((flags & LambdaMetafactory.FLAG_SERIALIZABLE) != 0)
- || foundSerializableSupertype;
-
- if (isSerializable && !foundSerializableSupertype) {
- markerInterfaces = Arrays.copyOf(markerInterfaces, markerInterfaces.length + 1);
- markerInterfaces[markerInterfaces.length-1] = Serializable.class;
- }
- this.markerInterfaces = markerInterfaces;
}
/**
@@ -153,20 +162,14 @@ import static sun.invoke.util.Wrapper.*;
* functional interface
* @throws ReflectiveOperationException
*/
- abstract CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException;
+ abstract CallSite buildCallSite()
+ throws ReflectiveOperationException, LambdaConversionException;
/**
* Check the meta-factory arguments for errors
* @throws LambdaConversionException if there are improper conversions
*/
void validateMetafactoryArgs() throws LambdaConversionException {
- // Check target type is a subtype of class where SAM method is defined
- if (!samClass.isAssignableFrom(samBase)) {
- throw new LambdaConversionException(
- String.format("Invalid target type %s for lambda conversion; not a subtype of functional interface %s",
- samBase.getName(), samClass.getName()));
- }
-
switch (implKind) {
case MethodHandleInfo.REF_invokeInterface:
case MethodHandleInfo.REF_invokeVirtual:
@@ -265,9 +268,9 @@ import static sun.invoke.util.Wrapper.*;
}
/**
- * Check type adaptability
- * @param fromType
- * @param toType
+ * Check type adaptability for parameter types.
+ * @param fromType Type to convert from
+ * @param toType Type to convert to
* @param strict If true, do strict checks, else allow that fromType may be parameterized
* @return True if 'fromType' can be passed to an argument of 'toType'
*/
@@ -299,15 +302,14 @@ import static sun.invoke.util.Wrapper.*;
}
} else {
// both are reference types: fromType should be a superclass of toType.
- return strict? toType.isAssignableFrom(fromType) : true;
+ return !strict || toType.isAssignableFrom(fromType);
}
}
}
/**
- * Check type adaptability for return types -- special handling of void type) and parameterized fromType
- * @param fromType
- * @param toType
+ * Check type adaptability for return types --
+ * special handling of void type) and parameterized fromType
* @return True if 'fromType' can be converted to 'toType'
*/
private boolean isAdaptableToAsReturn(Class> fromType, Class> toType) {
@@ -338,89 +340,4 @@ import static sun.invoke.util.Wrapper.*;
}
***********************/
- /**
- * Find the functional interface method and corresponding abstract methods
- * which should be bridged. The functional interface method and those to be
- * bridged will have the same name and number of parameters. Check for
- * matching default methods (non-abstract), the VM will create bridges for
- * default methods; We don't have enough readily available type information
- * to distinguish between where the functional interface method should be
- * bridged and where the default method should be bridged; This situation is
- * flagged.
- */
- class MethodAnalyzer {
- private final Method[] methods = samBase.getMethods();
-
- private Method samMethod = null;
- private final List methodsToBridge = new ArrayList<>(methods.length);
- private boolean conflictFoundBetweenDefaultAndBridge = false;
-
- MethodAnalyzer() {
- String samMethodName = samInfo.getName();
- Class>[] samParamTypes = samMethodType.parameterArray();
- int samParamLength = samParamTypes.length;
- Class> samReturnType = samMethodType.returnType();
- Class> objectClass = Object.class;
- List defaultMethods = new ArrayList<>(methods.length);
-
- for (Method m : methods) {
- if (m.getName().equals(samMethodName) && m.getDeclaringClass() != objectClass) {
- Class>[] mParamTypes = m.getParameterTypes();
- if (mParamTypes.length == samParamLength) {
- // Method matches name and parameter length -- and is not Object
- if (Modifier.isAbstract(m.getModifiers())) {
- // Method is abstract
- if (m.getReturnType().equals(samReturnType)
- && Arrays.equals(mParamTypes, samParamTypes)) {
- // Exact match, this is the SAM method signature
- samMethod = m;
- } else if (!hasMatchingBridgeSignature(m)) {
- // Record bridges, exclude methods with duplicate signatures
- methodsToBridge.add(m);
- }
- } else {
- // Record default methods for conflict testing
- defaultMethods.add(m);
- }
- }
- }
- }
- for (Method dm : defaultMethods) {
- if (hasMatchingBridgeSignature(dm)) {
- conflictFoundBetweenDefaultAndBridge = true;
- break;
- }
- }
- }
-
- Method getSamMethod() {
- return samMethod;
- }
-
- List getMethodsToBridge() {
- return methodsToBridge;
- }
-
- boolean conflictFoundBetweenDefaultAndBridge() {
- return conflictFoundBetweenDefaultAndBridge;
- }
-
- /**
- * Search the list of previously found bridge methods to determine if there is a method with the same signature
- * (return and parameter types) as the specified method.
- *
- * @param m The method to match
- * @return True if the method was found, False otherwise
- */
- private boolean hasMatchingBridgeSignature(Method m) {
- Class>[] ptypes = m.getParameterTypes();
- Class> rtype = m.getReturnType();
- for (Method md : methodsToBridge) {
- if (md.getReturnType().equals(rtype) && Arrays.equals(ptypes, md.getParameterTypes())) {
- return true;
- }
- }
- return false;
- }
- }
}
diff --git a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
index 0b6f4016b1d..f74678e1bae 100644
--- a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
+++ b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
@@ -25,22 +25,26 @@
package java.lang.invoke;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.security.ProtectionDomain;
-import java.util.concurrent.atomic.AtomicInteger;
import jdk.internal.org.objectweb.asm.*;
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
import sun.misc.Unsafe;
+
+import java.lang.reflect.Constructor;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static jdk.internal.org.objectweb.asm.Opcodes.*;
/**
- * Lambda metafactory implementation which dynamically creates an inner-class-like class per lambda callsite.
+ * Lambda metafactory implementation which dynamically creates an
+ * inner-class-like class per lambda callsite.
*
* @see LambdaMetafactory
*/
/* package */ final class InnerClassLambdaMetafactory extends AbstractValidatingLambdaMetafactory {
+ private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+
private static final int CLASSFILE_VERSION = 51;
private static final String METHOD_DESCRIPTOR_VOID = Type.getMethodDescriptor(Type.VOID_TYPE);
private static final String NAME_MAGIC_ACCESSOR_IMPL = "java/lang/invoke/MagicLambdaImpl";
@@ -54,7 +58,7 @@ import java.security.PrivilegedAction;
private static final String DESCR_CTOR_SERIALIZED_LAMBDA
= MethodType.methodType(void.class,
Class.class,
- int.class, String.class, String.class, String.class,
+ String.class, String.class, String.class,
int.class, String.class, String.class, String.class,
String.class,
Object[].class).toMethodDescriptorString();
@@ -77,36 +81,56 @@ import java.security.PrivilegedAction;
private final Type[] instantiatedArgumentTypes; // ASM types for the functional interface arguments
/**
- * General meta-factory constructor, standard cases and allowing for uncommon options such as serialization.
+ * General meta-factory constructor, supporting both standard cases and
+ * allowing for uncommon options such as serialization or bridging.
*
- * @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges
- * of the caller.
- * @param invokedType Stacked automatically by VM; the signature of the invoked method, which includes the
- * expected static type of the returned lambda object, and the static types of the captured
- * arguments for the lambda. In the event that the implementation method is an instance method,
- * the first argument in the invocation signature will correspond to the receiver.
- * @param samMethod The primary method in the functional interface to which the lambda or method reference is
- * being converted, represented as a method handle.
- * @param implMethod The implementation method which should be called (with suitable adaptation of argument
- * types, return types, and adjustment for captured arguments) when methods of the resulting
- * functional interface instance are invoked.
- * @param instantiatedMethodType The signature of the primary functional interface method after type variables
- * are substituted with their instantiation from the capture site
- * @param flags A bitmask containing flags that may influence the translation of this lambda expression. Defined
- * fields include FLAG_SERIALIZABLE.
- * @param markerInterfaces Additional interfaces which the lambda object should implement.
+ * @param caller Stacked automatically by VM; represents a lookup context
+ * with the accessibility privileges of the caller.
+ * @param invokedType Stacked automatically by VM; the signature of the
+ * invoked method, which includes the expected static
+ * type of the returned lambda object, and the static
+ * types of the captured arguments for the lambda. In
+ * the event that the implementation method is an
+ * instance method, the first argument in the invocation
+ * signature will correspond to the receiver.
+ * @param samMethodName Name of the method in the functional interface to
+ * which the lambda or method reference is being
+ * converted, represented as a String.
+ * @param samMethodType Type of the method in the functional interface to
+ * which the lambda or method reference is being
+ * converted, represented as a MethodType.
+ * @param implMethod The implementation method which should be called (with
+ * suitable adaptation of argument types, return types,
+ * and adjustment for captured arguments) when methods of
+ * the resulting functional interface instance are invoked.
+ * @param instantiatedMethodType The signature of the primary functional
+ * interface method after type variables are
+ * substituted with their instantiation from
+ * the capture site
+ * @param isSerializable Should the lambda be made serializable? If set,
+ * either the target type or one of the additional SAM
+ * types must extend {@code Serializable}.
+ * @param markerInterfaces Additional interfaces which the lambda object
+ * should implement.
+ * @param additionalBridges Method types for additional signatures to be
+ * bridged to the implementation method
* @throws ReflectiveOperationException
- * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated
+ * @throws LambdaConversionException If any of the meta-factory protocol
+ * invariants are violated
*/
public InnerClassLambdaMetafactory(MethodHandles.Lookup caller,
MethodType invokedType,
- MethodHandle samMethod,
+ String samMethodName,
+ MethodType samMethodType,
MethodHandle implMethod,
MethodType instantiatedMethodType,
- int flags,
- Class>[] markerInterfaces)
+ boolean isSerializable,
+ Class>[] markerInterfaces,
+ MethodType[] additionalBridges)
throws ReflectiveOperationException, LambdaConversionException {
- super(caller, invokedType, samMethod, implMethod, instantiatedMethodType, flags, markerInterfaces);
+ super(caller, invokedType, samMethodName, samMethodType,
+ implMethod, instantiatedMethodType,
+ isSerializable, markerInterfaces, additionalBridges);
implMethodClassName = implDefiningClass.getName().replace('.', '/');
implMethodName = implInfo.getName();
implMethodDesc = implMethodType.toMethodDescriptorString();
@@ -124,7 +148,8 @@ import java.security.PrivilegedAction;
for (int i = 0; i < argTypes.length; i++) {
argNames[i] = "arg$" + (i + 1);
}
- instantiatedArgumentTypes = Type.getArgumentTypes(instantiatedMethodType.toMethodDescriptorString());
+ instantiatedArgumentTypes = Type.getArgumentTypes(
+ instantiatedMethodType.toMethodDescriptorString());
}
/**
@@ -136,7 +161,8 @@ import java.security.PrivilegedAction;
* @return a CallSite, which, when invoked, will return an instance of the
* functional interface
* @throws ReflectiveOperationException
- * @throws LambdaConversionException If properly formed functional interface is not found
+ * @throws LambdaConversionException If properly formed functional interface
+ * is not found
*/
@Override
CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException {
@@ -167,8 +193,8 @@ import java.security.PrivilegedAction;
} else {
return new ConstantCallSite(
MethodHandles.Lookup.IMPL_LOOKUP
- .findConstructor(innerClass, constructorType)
- .asType(constructorType.changeReturnType(samBase)));
+ .findConstructor(innerClass, constructorType)
+ .asType(constructorType.changeReturnType(samBase)));
}
}
@@ -176,13 +202,20 @@ import java.security.PrivilegedAction;
* Generate a class file which implements the functional
* interface, define and return the class.
*
+ * @implNote The class that is generated does not include signature
+ * information for exceptions that may be present on the SAM method.
+ * This is to reduce classfile size, and is harmless as checked exceptions
+ * are erased anyway, no one will ever compile against this classfile,
+ * and we make no guarantees about the reflective properties of lambda
+ * objects.
+ *
* @return a Class which implements the functional interface
- * @throws LambdaConversionException If properly formed functional interface is not found
+ * @throws LambdaConversionException If properly formed functional interface
+ * is not found
*/
private Class> spinInnerClass() throws LambdaConversionException {
- String samName = samBase.getName().replace('.', '/');
String[] interfaces = new String[markerInterfaces.length + 1];
- interfaces[0] = samName;
+ interfaces[0] = samBase.getName().replace('.', '/');
for (int i=0; i) Unsafe.getUnsafe().defineClass(lambdaClassName, classBytes, 0, classBytes.length,
- loader, pd);
+ return UNSAFE.defineClass(lambdaClassName,
+ classBytes, 0, classBytes.length,
+ loader, pd);
}
/**
@@ -258,19 +293,23 @@ import java.security.PrivilegedAction;
*/
private void generateConstructor() {
// Generate constructor
- MethodVisitor ctor = cw.visitMethod(ACC_PRIVATE, NAME_CTOR, constructorDesc, null, null);
+ MethodVisitor ctor = cw.visitMethod(ACC_PRIVATE, NAME_CTOR,
+ constructorDesc, null, null);
ctor.visitCode();
ctor.visitVarInsn(ALOAD, 0);
- ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR, METHOD_DESCRIPTOR_VOID);
+ ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR,
+ METHOD_DESCRIPTOR_VOID);
int lvIndex = 0;
for (int i = 0; i < argTypes.length; i++) {
ctor.visitVarInsn(ALOAD, 0);
ctor.visitVarInsn(argTypes[i].getOpcode(ILOAD), lvIndex + 1);
lvIndex += argTypes[i].getSize();
- ctor.visitFieldInsn(PUTFIELD, lambdaClassName, argNames[i], argTypes[i].getDescriptor());
+ ctor.visitFieldInsn(PUTFIELD, lambdaClassName, argNames[i],
+ argTypes[i].getDescriptor());
}
ctor.visitInsn(RETURN);
- ctor.visitMaxs(-1, -1); // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored
+ // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored
+ ctor.visitMaxs(-1, -1);
ctor.visitEnd();
}
@@ -279,18 +318,18 @@ import java.security.PrivilegedAction;
*/
private void generateWriteReplace() {
TypeConvertingMethodAdapter mv
- = new TypeConvertingMethodAdapter(cw.visitMethod(ACC_PRIVATE + ACC_FINAL,
- NAME_METHOD_WRITE_REPLACE, DESCR_METHOD_WRITE_REPLACE,
- null, null));
+ = new TypeConvertingMethodAdapter(
+ cw.visitMethod(ACC_PRIVATE + ACC_FINAL,
+ NAME_METHOD_WRITE_REPLACE, DESCR_METHOD_WRITE_REPLACE,
+ null, null));
mv.visitCode();
mv.visitTypeInsn(NEW, NAME_SERIALIZED_LAMBDA);
- mv.visitInsn(DUP);;
+ mv.visitInsn(DUP);
mv.visitLdcInsn(Type.getType(targetClass));
- mv.visitLdcInsn(samInfo.getReferenceKind());
mv.visitLdcInsn(invokedType.returnType().getName().replace('.', '/'));
- mv.visitLdcInsn(samInfo.getName());
- mv.visitLdcInsn(samInfo.getMethodType().toMethodDescriptorString());
+ mv.visitLdcInsn(samMethodName);
+ mv.visitLdcInsn(samMethodType.toMethodDescriptorString());
mv.visitLdcInsn(implInfo.getReferenceKind());
mv.visitLdcInsn(implInfo.getDeclaringClass().getName().replace('.', '/'));
mv.visitLdcInsn(implInfo.getName());
@@ -303,35 +342,19 @@ import java.security.PrivilegedAction;
mv.visitInsn(DUP);
mv.iconst(i);
mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], argTypes[i].getDescriptor());
+ mv.visitFieldInsn(GETFIELD, lambdaClassName, argNames[i],
+ argTypes[i].getDescriptor());
mv.boxIfTypePrimitive(argTypes[i]);
mv.visitInsn(AASTORE);
}
mv.visitMethodInsn(INVOKESPECIAL, NAME_SERIALIZED_LAMBDA, NAME_CTOR,
DESCR_CTOR_SERIALIZED_LAMBDA);
mv.visitInsn(ARETURN);
- mv.visitMaxs(-1, -1); // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored
+ // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored
+ mv.visitMaxs(-1, -1);
mv.visitEnd();
}
- /**
- * Generate a method which calls the lambda implementation method,
- * converting arguments, as needed.
- * @param m The method whose signature should be generated
- * @param isBridge True if this methods should be flagged as a bridge
- */
- private void generateForwardingMethod(Method m, boolean isBridge) {
- Class>[] exceptionTypes = m.getExceptionTypes();
- String[] exceptionNames = new String[exceptionTypes.length];
- for (int i = 0; i < exceptionTypes.length; i++) {
- exceptionNames[i] = exceptionTypes[i].getName().replace('.', '/');
- }
- String methodDescriptor = Type.getMethodDescriptor(m);
- int access = isBridge? ACC_PUBLIC | ACC_BRIDGE : ACC_PUBLIC;
- MethodVisitor mv = cw.visitMethod(access, m.getName(), methodDescriptor, null, exceptionNames);
- new ForwardingMethodGenerator(mv).generate(m);
- }
-
/**
* This class generates a method body which calls the lambda implementation
* method, converting arguments, as needed.
@@ -342,36 +365,39 @@ import java.security.PrivilegedAction;
super(mv);
}
- void generate(Method m) throws InternalError {
+ void generate(String methodDescriptor) {
visitCode();
if (implKind == MethodHandleInfo.REF_newInvokeSpecial) {
visitTypeInsn(NEW, implMethodClassName);
- visitInsn(DUP);;
+ visitInsn(DUP);
}
for (int i = 0; i < argTypes.length; i++) {
visitVarInsn(ALOAD, 0);
- visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], argTypes[i].getDescriptor());
+ visitFieldInsn(GETFIELD, lambdaClassName, argNames[i],
+ argTypes[i].getDescriptor());
}
- convertArgumentTypes(Type.getArgumentTypes(m));
+ convertArgumentTypes(Type.getArgumentTypes(methodDescriptor));
// Invoke the method we want to forward to
visitMethodInsn(invocationOpcode(), implMethodClassName, implMethodName, implMethodDesc);
// Convert the return value (if any) and return it
- // Note: if adapting from non-void to void, the 'return' instruction will pop the unneeded result
- Type samReturnType = Type.getReturnType(m);
+ // Note: if adapting from non-void to void, the 'return'
+ // instruction will pop the unneeded result
+ Type samReturnType = Type.getReturnType(methodDescriptor);
convertType(implMethodReturnType, samReturnType, samReturnType);
visitInsn(samReturnType.getOpcode(Opcodes.IRETURN));
-
- visitMaxs(-1, -1); // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored
+ // Maxs computed by ClassWriter.COMPUTE_MAXS,these arguments ignored
+ visitMaxs(-1, -1);
visitEnd();
}
private void convertArgumentTypes(Type[] samArgumentTypes) {
int lvIndex = 0;
- boolean samIncludesReceiver = implIsInstanceMethod && argTypes.length == 0;
+ boolean samIncludesReceiver = implIsInstanceMethod &&
+ argTypes.length == 0;
int samReceiverLength = samIncludesReceiver ? 1 : 0;
if (samIncludesReceiver) {
// push receiver
@@ -395,7 +421,9 @@ import java.security.PrivilegedAction;
}
private void convertType(Type argType, Type targetType, Type functionalType) {
- convertType(argType.getDescriptor(), targetType.getDescriptor(), functionalType.getDescriptor());
+ convertType(argType.getDescriptor(),
+ targetType.getDescriptor(),
+ functionalType.getDescriptor());
}
private int invocationOpcode() throws InternalError {
diff --git a/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java b/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java
index e03dda002d1..87c7923d9ba 100644
--- a/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java
+++ b/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java
@@ -25,6 +25,9 @@
package java.lang.invoke;
+import java.io.Serializable;
+import java.util.Arrays;
+
/**
*
Bootstrap methods for converting lambda expressions and method references to functional interface objects.
When parameterized types are used, the instantiated type of the functional interface method may be different
* from that in the functional interface. For example, consider
- * interface I<T> { int m(T x); } if this functional interface type is used in a lambda
- * I<Byte> v = ..., we need both the actual functional interface method which has the signature
- * (Object)int and the erased instantiated type of the functional interface method (or simply
+ * {@code interface I { int m(T x); }} if this functional interface type is used in a lambda
+ * {@code I; v = ...}, we need both the actual functional interface method which has the signature
+ * {@code (Object)int} and the erased instantiated type of the functional interface method (or simply
* instantiated method type), which has signature
- * (Byte)int.
- *
- *
While functional interfaces only have a single abstract method from the language perspective (concrete
- * methods in Object are and default methods may be present), at the bytecode level they may actually have multiple
- * methods because of the need for bridge methods. Invoking any of these methods on the lambda object will result
- * in invoking the implementation method.
+ * {@code (Byte)int}.
*
*
The argument list of the implementation method and the argument list of the functional interface method(s)
* may differ in several ways. The implementation methods may have additional arguments to accommodate arguments
@@ -137,108 +135,147 @@ package java.lang.invoke;
*
*
*
- * The default bootstrap ({@link #metaFactory}) represents the common cases and uses an optimized protocol.
- * Alternate bootstraps (e.g., {@link #altMetaFactory}) exist to support uncommon cases such as serialization
+ * The default bootstrap ({@link #metafactory}) represents the common cases and uses an optimized protocol.
+ * Alternate bootstraps (e.g., {@link #altMetafactory}) exist to support uncommon cases such as serialization
* or additional marker superinterfaces.
*
*/
public class LambdaMetafactory {
- /** Flag for alternate metafactories indicating the lambda object is must to be serializable */
+ /** Flag for alternate metafactories indicating the lambda object is
+ * must to be serializable */
public static final int FLAG_SERIALIZABLE = 1 << 0;
/**
- * Flag for alternate metafactories indicating the lambda object implements other marker interfaces
+ * Flag for alternate metafactories indicating the lambda object implements
+ * other marker interfaces
* besides Serializable
*/
public static final int FLAG_MARKERS = 1 << 1;
+ /**
+ * Flag for alternate metafactories indicating the lambda object requires
+ * additional bridge methods
+ */
+ public static final int FLAG_BRIDGES = 1 << 2;
+
private static final Class>[] EMPTY_CLASS_ARRAY = new Class>[0];
+ private static final MethodType[] EMPTY_MT_ARRAY = new MethodType[0];
/**
- * Standard meta-factory for conversion of lambda expressions or method references to functional interfaces.
+ * Standard meta-factory for conversion of lambda expressions or method
+ * references to functional interfaces.
*
- * @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges
- * of the caller.
- * @param invokedName Stacked automatically by VM; the name of the invoked method as it appears at the call site.
- * Currently unused.
- * @param invokedType Stacked automatically by VM; the signature of the invoked method, which includes the
- * expected static type of the returned lambda object, and the static types of the captured
- * arguments for the lambda. In the event that the implementation method is an instance method,
- * the first argument in the invocation signature will correspond to the receiver.
- * @param samMethod The primary method in the functional interface to which the lambda or method reference is
- * being converted, represented as a method handle.
- * @param implMethod The implementation method which should be called (with suitable adaptation of argument
- * types, return types, and adjustment for captured arguments) when methods of the resulting
- * functional interface instance are invoked.
- * @param instantiatedMethodType The signature of the primary functional interface method after type variables
- * are substituted with their instantiation from the capture site
- * @return a CallSite, which, when invoked, will return an instance of the functional interface
- * @throws ReflectiveOperationException if the caller is not able to reconstruct one of the method handles
- * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated
+ * @param caller Stacked automatically by VM; represents a lookup context
+ * with the accessibility privileges of the caller.
+ * @param invokedName Stacked automatically by VM; the name of the invoked
+ * method as it appears at the call site.
+ * Used as the name of the functional interface method
+ * to which the lambda or method reference is being
+ * converted.
+ * @param invokedType Stacked automatically by VM; the signature of the
+ * invoked method, which includes the expected static
+ * type of the returned lambda object, and the static
+ * types of the captured arguments for the lambda.
+ * In the event that the implementation method is an
+ * instance method, the first argument in the invocation
+ * signature will correspond to the receiver.
+ * @param samMethodType MethodType of the method in the functional interface
+ * to which the lambda or method reference is being
+ * converted, represented as a MethodType.
+ * @param implMethod The implementation method which should be called
+ * (with suitable adaptation of argument types, return
+ * types, and adjustment for captured arguments) when
+ * methods of the resulting functional interface instance
+ * are invoked.
+ * @param instantiatedMethodType The signature of the primary functional
+ * interface method after type variables
+ * are substituted with their instantiation
+ * from the capture site
+ * @return a CallSite, which, when invoked, will return an instance of the
+ * functional interface
+ * @throws ReflectiveOperationException if the caller is not able to
+ * reconstruct one of the method handles
+ * @throws LambdaConversionException If any of the meta-factory protocol
+ * invariants are violated
*/
- public static CallSite metaFactory(MethodHandles.Lookup caller,
+ public static CallSite metafactory(MethodHandles.Lookup caller,
String invokedName,
MethodType invokedType,
- MethodHandle samMethod,
+ MethodType samMethodType,
MethodHandle implMethod,
MethodType instantiatedMethodType)
throws ReflectiveOperationException, LambdaConversionException {
AbstractValidatingLambdaMetafactory mf;
- mf = new InnerClassLambdaMetafactory(caller, invokedType, samMethod, implMethod, instantiatedMethodType,
- 0, EMPTY_CLASS_ARRAY);
+ mf = new InnerClassLambdaMetafactory(caller, invokedType,
+ invokedName, samMethodType,
+ implMethod, instantiatedMethodType,
+ false, EMPTY_CLASS_ARRAY, EMPTY_MT_ARRAY);
mf.validateMetafactoryArgs();
return mf.buildCallSite();
}
/**
- * Alternate meta-factory for conversion of lambda expressions or method references to functional interfaces,
- * which supports serialization and other uncommon options.
+ * Alternate meta-factory for conversion of lambda expressions or method
+ * references to functional interfaces, which supports serialization and
+ * other uncommon options.
*
* The declared argument list for this method is:
*
- * CallSite altMetaFactory(MethodHandles.Lookup caller,
+ * CallSite altMetafactory(MethodHandles.Lookup caller,
* String invokedName,
* MethodType invokedType,
* Object... args)
*
* but it behaves as if the argument list is:
*
- * CallSite altMetaFactory(MethodHandles.Lookup caller,
+ * CallSite altMetafactory(MethodHandles.Lookup caller,
* String invokedName,
* MethodType invokedType,
- * MethodHandle samMethod
+ * MethodType samMethodType
* MethodHandle implMethod,
* MethodType instantiatedMethodType,
* int flags,
* int markerInterfaceCount, // IF flags has MARKERS set
* Class... markerInterfaces // IF flags has MARKERS set
+ * int bridgeCount, // IF flags has BRIDGES set
+ * MethodType... bridges // IF flags has BRIDGES set
* )
*
*
- * @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges
- * of the caller.
- * @param invokedName Stacked automatically by VM; the name of the invoked method as it appears at the call site.
- * Currently unused.
- * @param invokedType Stacked automatically by VM; the signature of the invoked method, which includes thefu
- * expected static type of the returned lambda object, and the static types of the captured
- * arguments for the lambda. In the event that the implementation method is an instance method,
- * the first argument in the invocation signature will correspond to the receiver.
- * @param args argument to pass, flags, marker interface count, and marker interfaces as described above
- * @return a CallSite, which, when invoked, will return an instance of the functional interface
- * @throws ReflectiveOperationException if the caller is not able to reconstruct one of the method handles
- * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated
+ * @param caller Stacked automatically by VM; represents a lookup context
+ * with the accessibility privileges of the caller.
+ * @param invokedName Stacked automatically by VM; the name of the invoked
+ * method as it appears at the call site.
+ * Used as the name of the functional interface method
+ * to which the lambda or method reference is being
+ * converted.
+ * @param invokedType Stacked automatically by VM; the signature of the
+ * invoked method, which includes the expected static
+ * type of the returned lambda object, and the static
+ * types of the captured arguments for the lambda.
+ * In the event that the implementation method is an
+ * instance method, the first argument in the invocation
+ * signature will correspond to the receiver.
+ * @param args flags and optional arguments, as described above
+ * @return a CallSite, which, when invoked, will return an instance of the
+ * functional interface
+ * @throws ReflectiveOperationException if the caller is not able to
+ * reconstruct one of the method handles
+ * @throws LambdaConversionException If any of the meta-factory protocol
+ * invariants are violated
*/
- public static CallSite altMetaFactory(MethodHandles.Lookup caller,
+ public static CallSite altMetafactory(MethodHandles.Lookup caller,
String invokedName,
MethodType invokedType,
Object... args)
throws ReflectiveOperationException, LambdaConversionException {
- MethodHandle samMethod = (MethodHandle)args[0];
+ MethodType samMethodType = (MethodType)args[0];
MethodHandle implMethod = (MethodHandle)args[1];
MethodType instantiatedMethodType = (MethodType)args[2];
int flags = (Integer) args[3];
Class>[] markerInterfaces;
+ MethodType[] bridges;
int argIndex = 4;
if ((flags & FLAG_MARKERS) != 0) {
int markerCount = (Integer) args[argIndex++];
@@ -248,9 +285,33 @@ public class LambdaMetafactory {
}
else
markerInterfaces = EMPTY_CLASS_ARRAY;
- AbstractValidatingLambdaMetafactory mf;
- mf = new InnerClassLambdaMetafactory(caller, invokedType, samMethod, implMethod, instantiatedMethodType,
- flags, markerInterfaces);
+ if ((flags & FLAG_BRIDGES) != 0) {
+ int bridgeCount = (Integer) args[argIndex++];
+ bridges = new MethodType[bridgeCount];
+ System.arraycopy(args, argIndex, bridges, 0, bridgeCount);
+ argIndex += bridgeCount;
+ }
+ else
+ bridges = EMPTY_MT_ARRAY;
+
+ boolean foundSerializableSupertype = Serializable.class.isAssignableFrom(invokedType.returnType());
+ for (Class> c : markerInterfaces)
+ foundSerializableSupertype |= Serializable.class.isAssignableFrom(c);
+ boolean isSerializable = ((flags & LambdaMetafactory.FLAG_SERIALIZABLE) != 0)
+ || foundSerializableSupertype;
+
+ if (isSerializable && !foundSerializableSupertype) {
+ markerInterfaces = Arrays.copyOf(markerInterfaces, markerInterfaces.length + 1);
+ markerInterfaces[markerInterfaces.length-1] = Serializable.class;
+ }
+
+ AbstractValidatingLambdaMetafactory mf
+ = new InnerClassLambdaMetafactory(caller, invokedType,
+ invokedName, samMethodType,
+ implMethod,
+ instantiatedMethodType,
+ isSerializable,
+ markerInterfaces, bridges);
mf.validateMetafactoryArgs();
return mf.buildCallSite();
}
diff --git a/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java b/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java
index 558fa5ab6ee..a775fc43e34 100644
--- a/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java
+++ b/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java
@@ -44,7 +44,6 @@ public final class SerializedLambda implements Serializable {
private final String functionalInterfaceClass;
private final String functionalInterfaceMethodName;
private final String functionalInterfaceMethodSignature;
- private final int functionalInterfaceMethodKind;
private final String implClass;
private final String implMethodName;
private final String implMethodSignature;
@@ -53,28 +52,32 @@ public final class SerializedLambda implements Serializable {
private final Object[] capturedArgs;
/**
- * Create a {@code SerializedLambda} from the low-level information present at the lambda factory site.
+ * Create a {@code SerializedLambda} from the low-level information present
+ * at the lambda factory site.
*
* @param capturingClass The class in which the lambda expression appears
- * @param functionalInterfaceMethodKind Method handle kind (see {@link MethodHandleInfo}) for the
- * functional interface method handle present at the lambda factory site
- * @param functionalInterfaceClass Name, in slash-delimited form, for the functional interface class present at the
- * lambda factory site
- * @param functionalInterfaceMethodName Name of the primary method for the functional interface present at the
+ * @param functionalInterfaceClass Name, in slash-delimited form, of static
+ * type of the returned lambda object
+ * @param functionalInterfaceMethodName Name of the functional interface
+ * method for the present at the
* lambda factory site
- * @param functionalInterfaceMethodSignature Signature of the primary method for the functional interface present
- * at the lambda factory site
+ * @param functionalInterfaceMethodSignature Signature of the functional
+ * interface method present at
+ * the lambda factory site
* @param implMethodKind Method handle kind for the implementation method
- * @param implClass Name, in slash-delimited form, for the class holding the implementation method
+ * @param implClass Name, in slash-delimited form, for the class holding
+ * the implementation method
* @param implMethodName Name of the implementation method
* @param implMethodSignature Signature of the implementation method
- * @param instantiatedMethodType The signature of the primary functional interface method after type variables
- * are substituted with their instantiation from the capture site
- * @param capturedArgs The dynamic arguments to the lambda factory site, which represent variables captured by
+ * @param instantiatedMethodType The signature of the primary functional
+ * interface method after type variables
+ * are substituted with their instantiation
+ * from the capture site
+ * @param capturedArgs The dynamic arguments to the lambda factory site,
+ * which represent variables captured by
* the lambda
*/
public SerializedLambda(Class> capturingClass,
- int functionalInterfaceMethodKind,
String functionalInterfaceClass,
String functionalInterfaceMethodName,
String functionalInterfaceMethodSignature,
@@ -85,7 +88,6 @@ public final class SerializedLambda implements Serializable {
String instantiatedMethodType,
Object[] capturedArgs) {
this.capturingClass = capturingClass;
- this.functionalInterfaceMethodKind = functionalInterfaceMethodKind;
this.functionalInterfaceClass = functionalInterfaceClass;
this.functionalInterfaceMethodName = functionalInterfaceMethodName;
this.functionalInterfaceMethodSignature = functionalInterfaceMethodSignature;
@@ -106,10 +108,10 @@ public final class SerializedLambda implements Serializable {
}
/**
- * Get the name of the functional interface class to which this
+ * Get the name of the invoked type to which this
* lambda has been converted
- * @return the name of the functional interface this lambda has
- * been converted to
+ * @return the name of the functional interface class to which
+ * this lambda has been converted
*/
public String getFunctionalInterfaceClass() {
return functionalInterfaceClass;
@@ -134,17 +136,6 @@ public final class SerializedLambda implements Serializable {
return functionalInterfaceMethodSignature;
}
- /**
- * Get the method handle kind (see {@link MethodHandleInfo}) of
- * the primary method for the functional interface to which this
- * lambda has been converted
- * @return the method handle kind of the primary method of
- * functional interface
- */
- public int getFunctionalInterfaceMethodKind() {
- return functionalInterfaceMethodKind;
- }
-
/**
* Get the name of the class containing the implementation
* method.
@@ -234,11 +225,17 @@ public final class SerializedLambda implements Serializable {
@Override
public String toString() {
- return String.format("SerializedLambda[capturingClass=%s, functionalInterfaceMethod=%s %s.%s:%s, " +
- "implementation=%s %s.%s:%s, instantiatedMethodType=%s, numCaptured=%d]",
- capturingClass, MethodHandleInfo.getReferenceKindString(functionalInterfaceMethodKind),
- functionalInterfaceClass, functionalInterfaceMethodName, functionalInterfaceMethodSignature,
- MethodHandleInfo.getReferenceKindString(implMethodKind), implClass, implMethodName,
- implMethodSignature, instantiatedMethodType, capturedArgs.length);
+ String implKind=MethodHandleInfo.getReferenceKindString(implMethodKind);
+ return String.format("SerializedLambda[%s=%s, %s=%s.%s:%s, " +
+ "%s=%s %s.%s:%s, %s=%s, %s=%d]",
+ "capturingClass", capturingClass,
+ "functionalInterfaceMethod", functionalInterfaceClass,
+ functionalInterfaceMethodName,
+ functionalInterfaceMethodSignature,
+ "implementation",
+ implKind,
+ implClass, implMethodName, implMethodSignature,
+ "instantiatedMethodType", instantiatedMethodType,
+ "numCaptured", capturedArgs.length);
}
}
From f76ebb663cf8a7ef922fe8d69d7751acbda1839c Mon Sep 17 00:00:00 2001
From: Jason Uh
Date: Tue, 16 Jul 2013 12:19:41 -0700
Subject: [PATCH 089/101] 8020557: javadoc cleanup in javax.security
Reviewed-by: darcy
---
.../javax/security/auth/AuthPermission.java | 54 +--
.../security/auth/DestroyFailedException.java | 6 +-
.../javax/security/auth/Destroyable.java | 14 +-
.../classes/javax/security/auth/Policy.java | 72 +--
.../auth/PrivateCredentialPermission.java | 82 ++--
.../security/auth/RefreshFailedException.java | 6 +-
.../javax/security/auth/Refreshable.java | 10 +-
.../classes/javax/security/auth/Subject.java | 452 +++++++++---------
.../security/auth/SubjectDomainCombiner.java | 62 +--
.../security/auth/callback/Callback.java | 8 +-
.../auth/callback/CallbackHandler.java | 28 +-
.../auth/callback/ChoiceCallback.java | 40 +-
.../auth/callback/ConfirmationCallback.java | 236 ++++-----
.../auth/callback/LanguageCallback.java | 18 +-
.../security/auth/callback/NameCallback.java | 26 +-
.../auth/callback/PasswordCallback.java | 12 +-
.../auth/callback/TextInputCallback.java | 26 +-
.../auth/callback/TextOutputCallback.java | 24 +-
.../UnsupportedCallbackException.java | 16 +-
.../security/auth/callback/package-info.java | 35 ++
.../javax/security/auth/callback/package.html | 57 ---
.../auth/kerberos/DelegationPermission.java | 18 +-
.../security/auth/kerberos/KerberosKey.java | 10 +-
.../auth/kerberos/KerberosPrincipal.java | 20 +-
.../auth/kerberos/KerberosTicket.java | 10 +-
.../javax/security/auth/kerberos/KeyImpl.java | 4 +-
.../javax/security/auth/kerberos/KeyTab.java | 8 +-
.../auth/kerberos/ServicePermission.java | 12 +-
.../security/auth/kerberos/package-info.java | 53 ++
.../javax/security/auth/kerberos/package.html | 74 ---
.../auth/login/AccountExpiredException.java | 6 +-
.../auth/login/AppConfigurationEntry.java | 56 +--
.../security/auth/login/Configuration.java | 74 +--
.../security/auth/login/ConfigurationSpi.java | 10 +-
.../login/CredentialExpiredException.java | 12 +-
.../auth/login/FailedLoginException.java | 4 +-
.../security/auth/login/LoginContext.java | 220 ++++-----
.../security/auth/login/package-info.java | 39 ++
.../javax/security/auth/login/package.html | 54 ---
.../javax/security/auth/package-info.java | 38 ++
.../classes/javax/security/auth/package.html | 61 ---
.../javax/security/auth/spi/LoginModule.java | 142 +++---
.../javax/security/auth/spi/package-info.java | 32 ++
.../javax/security/auth/spi/package.html | 53 --
.../security/auth/x500/X500Principal.java | 110 ++---
.../auth/x500/X500PrivateCredential.java | 12 +-
.../security/auth/x500/package-info.java | 49 ++
.../javax/security/auth/x500/package.html | 64 ---
.../javax/security/cert/Certificate.java | 10 +-
.../cert/CertificateEncodingException.java | 6 +-
.../security/cert/CertificateException.java | 6 +-
.../cert/CertificateExpiredException.java | 10 +-
.../cert/CertificateNotYetValidException.java | 10 +-
.../cert/CertificateParsingException.java | 6 +-
.../javax/security/cert/X509Certificate.java | 42 +-
.../javax/security/cert/package-info.java | 40 ++
.../classes/javax/security/cert/package.html | 65 ---
.../sasl/AuthenticationException.java | 8 +-
.../security/sasl/AuthorizeCallback.java | 12 +-
.../javax/security/sasl/RealmCallback.java | 14 +-
.../security/sasl/RealmChoiceCallback.java | 16 +-
.../classes/javax/security/sasl/Sasl.java | 188 ++++----
.../javax/security/sasl/SaslClient.java | 50 +-
.../security/sasl/SaslClientFactory.java | 34 +-
.../javax/security/sasl/SaslException.java | 8 +-
.../javax/security/sasl/SaslServer.java | 46 +-
.../security/sasl/SaslServerFactory.java | 42 +-
.../javax/security/sasl/package-info.java | 103 ++++
.../classes/javax/security/sasl/package.html | 114 -----
69 files changed, 1603 insertions(+), 1756 deletions(-)
create mode 100644 jdk/src/share/classes/javax/security/auth/callback/package-info.java
delete mode 100644 jdk/src/share/classes/javax/security/auth/callback/package.html
create mode 100644 jdk/src/share/classes/javax/security/auth/kerberos/package-info.java
delete mode 100644 jdk/src/share/classes/javax/security/auth/kerberos/package.html
create mode 100644 jdk/src/share/classes/javax/security/auth/login/package-info.java
delete mode 100644 jdk/src/share/classes/javax/security/auth/login/package.html
create mode 100644 jdk/src/share/classes/javax/security/auth/package-info.java
delete mode 100644 jdk/src/share/classes/javax/security/auth/package.html
create mode 100644 jdk/src/share/classes/javax/security/auth/spi/package-info.java
delete mode 100644 jdk/src/share/classes/javax/security/auth/spi/package.html
create mode 100644 jdk/src/share/classes/javax/security/auth/x500/package-info.java
delete mode 100644 jdk/src/share/classes/javax/security/auth/x500/package.html
create mode 100644 jdk/src/share/classes/javax/security/cert/package-info.java
delete mode 100644 jdk/src/share/classes/javax/security/cert/package.html
create mode 100644 jdk/src/share/classes/javax/security/sasl/package-info.java
delete mode 100644 jdk/src/share/classes/javax/security/sasl/package.html
diff --git a/jdk/src/share/classes/javax/security/auth/AuthPermission.java b/jdk/src/share/classes/javax/security/auth/AuthPermission.java
index a5a40d87f5d..b1973e1286f 100644
--- a/jdk/src/share/classes/javax/security/auth/AuthPermission.java
+++ b/jdk/src/share/classes/javax/security/auth/AuthPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -41,10 +41,10 @@ package javax.security.auth;
*
*
* doAs - allow the caller to invoke the
- * Subject.doAs methods.
+ * {@code Subject.doAs} methods.
*
* doAsPrivileged - allow the caller to invoke the
- * Subject.doAsPrivileged methods.
+ * {@code Subject.doAsPrivileged} methods.
*
* getSubject - allow for the retrieval of the
* Subject(s) associated with the
@@ -52,39 +52,39 @@ package javax.security.auth;
*
* getSubjectFromDomainCombiner - allow for the retrieval of the
* Subject associated with the
- * a SubjectDomainCombiner.
+ * a {@code SubjectDomainCombiner}.
*
* setReadOnly - allow the caller to set a Subject
* to be read-only.
*
- * modifyPrincipals - allow the caller to modify the Set
+ * modifyPrincipals - allow the caller to modify the {@code Set}
* of Principals associated with a
- * Subject
+ * {@code Subject}
*
* modifyPublicCredentials - allow the caller to modify the
- * Set of public credentials
- * associated with a Subject
+ * {@code Set} of public credentials
+ * associated with a {@code Subject}
*
* modifyPrivateCredentials - allow the caller to modify the
- * Set of private credentials
- * associated with a Subject
+ * {@code Set} of private credentials
+ * associated with a {@code Subject}
*
- * refreshCredential - allow code to invoke the refresh
+ * refreshCredential - allow code to invoke the {@code refresh}
* method on a credential which implements
- * the Refreshable interface.
+ * the {@code Refreshable} interface.
*
- * destroyCredential - allow code to invoke the destroy
- * method on a credential object
- * which implements the Destroyable
+ * destroyCredential - allow code to invoke the {@code destroy}
+ * method on a credential {@code object}
+ * which implements the {@code Destroyable}
* interface.
*
* createLoginContext.{name} - allow code to instantiate a
- * LoginContext with the
+ * {@code LoginContext} with the
* specified name. name
* is used as the index into the installed login
- * Configuration
+ * {@code Configuration}
* (that returned by
- * Configuration.getConfiguration()).
+ * {@code Configuration.getConfiguration()}).
* name can be wildcarded (set to '*')
* to allow for any name.
*
@@ -93,7 +93,7 @@ package javax.security.auth;
*
* createLoginConfiguration.{type} - allow code to obtain a Configuration
* object via
- * Configuration.getInstance.
+ * {@code Configuration.getInstance}.
*
* setLoginConfiguration - allow for the setting of the system-wide
* login Configuration.
@@ -103,15 +103,15 @@ package javax.security.auth;
*
*
*
The following target name has been deprecated in favor of
- * createLoginContext.{name}.
+ * {@code createLoginContext.{name}}.
*
*
* createLoginContext - allow code to instantiate a
- * LoginContext.
+ * {@code LoginContext}.
*
*
- *
javax.security.auth.Policy has been
- * deprecated in favor of java.security.Policy.
+ *
{@code javax.security.auth.Policy} has been
+ * deprecated in favor of {@code java.security.Policy}.
* Therefore, the following target names have also been deprecated:
*
*
@@ -139,8 +139,8 @@ java.security.BasicPermission {
*
* @param name the name of the AuthPermission
*
- * @throws NullPointerException if name is null.
- * @throws IllegalArgumentException if name is empty.
+ * @throws NullPointerException if {@code name} is {@code null}.
+ * @throws IllegalArgumentException if {@code name} is empty.
*/
public AuthPermission(String name) {
// for backwards compatibility --
@@ -160,8 +160,8 @@ java.security.BasicPermission {
*
* @param actions should be null.
*
- * @throws NullPointerException if name is null.
- * @throws IllegalArgumentException if name is empty.
+ * @throws NullPointerException if {@code name} is {@code null}.
+ * @throws IllegalArgumentException if {@code name} is empty.
*/
public AuthPermission(String name, String actions) {
// for backwards compatibility --
diff --git a/jdk/src/share/classes/javax/security/auth/DestroyFailedException.java b/jdk/src/share/classes/javax/security/auth/DestroyFailedException.java
index 16888fd068e..41e99a33192 100644
--- a/jdk/src/share/classes/javax/security/auth/DestroyFailedException.java
+++ b/jdk/src/share/classes/javax/security/auth/DestroyFailedException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,10 +26,10 @@
package javax.security.auth;
/**
- * Signals that a destroy operation failed.
+ * Signals that a {@code destroy} operation failed.
*
*
This exception is thrown by credentials implementing
- * the Destroyable interface when the destroy
+ * the {@code Destroyable} interface when the {@code destroy}
* method fails.
*
*/
diff --git a/jdk/src/share/classes/javax/security/auth/Destroyable.java b/jdk/src/share/classes/javax/security/auth/Destroyable.java
index 5afb6aa810b..15b92006cdf 100644
--- a/jdk/src/share/classes/javax/security/auth/Destroyable.java
+++ b/jdk/src/share/classes/javax/security/auth/Destroyable.java
@@ -34,12 +34,12 @@ package javax.security.auth;
public interface Destroyable {
/**
- * Destroy this Object.
+ * Destroy this {@code Object}.
*
- *
Sensitive information associated with this Object
+ *
Sensitive information associated with this {@code Object}
* is destroyed or cleared. Subsequent calls to certain methods
- * on this Object will result in an
- * IllegalStateException being thrown.
+ * on this {@code Object} will result in an
+ * {@code IllegalStateException} being thrown.
*
*
* The default implementation throws {@code DestroyFailedException}.
@@ -47,19 +47,19 @@ public interface Destroyable {
* @exception DestroyFailedException if the destroy operation fails.
*
* @exception SecurityException if the caller does not have permission
- * to destroy this Object.
+ * to destroy this {@code Object}.
*/
public default void destroy() throws DestroyFailedException {
throw new DestroyFailedException();
}
/**
- * Determine if this Object has been destroyed.
+ * Determine if this {@code Object} has been destroyed.
*
*
* The default implementation returns false.
*
- * @return true if this Object has been destroyed,
+ * @return true if this {@code Object} has been destroyed,
* false otherwise.
*/
public default boolean isDestroyed() {
diff --git a/jdk/src/share/classes/javax/security/auth/Policy.java b/jdk/src/share/classes/javax/security/auth/Policy.java
index 5fd27ee071e..a32339ca78c 100644
--- a/jdk/src/share/classes/javax/security/auth/Policy.java
+++ b/jdk/src/share/classes/javax/security/auth/Policy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -32,11 +32,11 @@ import sun.security.util.Debug;
*
This is an abstract class for representing the system policy for
* Subject-based authorization. A subclass implementation
* of this class provides a means to specify a Subject-based
- * access control Policy.
+ * access control {@code Policy}.
*
- *
A Policy object can be queried for the set of
+ *
A {@code Policy} object can be queried for the set of
* Permissions granted to code running as a
- * Principal in the following manner:
+ * {@code Principal} in the following manner:
*
*
*
- * The Policy object consults the local policy and returns
- * and appropriate Permissions object with the
+ * The {@code Policy} object consults the local policy and returns
+ * and appropriate {@code Permissions} object with the
* Permissions granted to the Principals associated with the
* provided subject, and granted to the code specified
* by the provided codeSource.
*
- *
A Policy contains the following information.
+ *
A {@code Policy} contains the following information.
* Note that this example only represents the syntax for the default
- * Policy implementation. Subclass implementations of this class
+ * {@code Policy} implementation. Subclass implementations of this class
* may implement alternative syntaxes and may retrieve the
- * Policy from any source such as files, databases,
+ * {@code Policy} from any source such as files, databases,
* or servers.
*
- *
Each entry in the Policy is represented as
+ *
Each entry in the {@code Policy} is represented as
* a grant entry. Each grant entry
* specifies a codebase, code signers, and Principals triplet,
* as well as the Permissions granted to that triplet.
@@ -84,23 +84,23 @@ import sun.security.util.Debug;
*
*
* This grant entry specifies that code from "foo.com",
- * signed by "foo', and running as a SolarisPrincipal with the
- * name, duke, has one Permission. This Permission
+ * signed by "foo', and running as a {@code SolarisPrincipal} with the
+ * name, duke, has one {@code Permission}. This {@code Permission}
* permits the executing code to read and write files in the directory,
* "/home/duke".
*
- *
To "run" as a particular Principal,
- * code invokes the Subject.doAs(subject, ...) method.
+ *
To "run" as a particular {@code Principal},
+ * code invokes the {@code Subject.doAs(subject, ...)} method.
* After invoking that method, the code runs as all the Principals
- * associated with the specified Subject.
- * Note that this Policy (and the Permissions
- * granted in this Policy) only become effective
- * after the call to Subject.doAs has occurred.
+ * associated with the specified {@code Subject}.
+ * Note that this {@code Policy} (and the Permissions
+ * granted in this {@code Policy}) only become effective
+ * after the call to {@code Subject.doAs} has occurred.
*
*
Multiple Principals may be listed within one grant entry.
* All the Principals in the grant entry must be associated with
- * the Subject provided to Subject.doAs
- * for that Subject to be granted the specified Permissions.
+ * the {@code Subject} provided to {@code Subject.doAs}
+ * for that {@code Subject} to be granted the specified Permissions.
*
*
* grant Principal com.sun.security.auth.SolarisPrincipal "duke",
@@ -115,7 +115,7 @@ import sun.security.util.Debug;
* as well as permission to make socket connections to "duke.com".
*
*
Note that non Principal-based grant entries are not permitted
- * in this Policy. Therefore, grant entries such as:
+ * in this {@code Policy}. Therefore, grant entries such as:
*
*
*
* are rejected. Such permission must be listed in the
- * java.security.Policy.
+ * {@code java.security.Policy}.
*
*
The default {@code Policy} implementation can be changed by
* setting the value of the {@code auth.policy.provider} security property to
@@ -179,14 +179,14 @@ public abstract class Policy {
/**
* Returns the installed Policy object.
* This method first calls
- * SecurityManager.checkPermission with the
- * AuthPermission("getPolicy") permission
+ * {@code SecurityManager.checkPermission} with the
+ * {@code AuthPermission("getPolicy")} permission
* to ensure the caller has permission to get the Policy object.
*
*
*
* @return the installed Policy. The return value cannot be
- * null.
+ * {@code null}.
*
* @exception java.lang.SecurityException if the current thread does not
* have permission to get the Policy object.
@@ -252,8 +252,8 @@ public abstract class Policy {
/**
* Sets the system-wide Policy object. This method first calls
- * SecurityManager.checkPermission with the
- * AuthPermission("setPolicy")
+ * {@code SecurityManager.checkPermission} with the
+ * {@code AuthPermission("setPolicy")}
* permission to ensure the caller has permission to set the Policy.
*
*
@@ -313,25 +313,25 @@ public abstract class Policy {
/**
* Retrieve the Permissions granted to the Principals associated with
- * the specified CodeSource.
+ * the specified {@code CodeSource}.
*
*
*
- * @param subject the Subject
+ * @param subject the {@code Subject}
* whose associated Principals,
* in conjunction with the provided
- * CodeSource, determines the Permissions
+ * {@code CodeSource}, determines the Permissions
* returned by this method. This parameter
- * may be null.
+ * may be {@code null}.
*
- * @param cs the code specified by its CodeSource
+ * @param cs the code specified by its {@code CodeSource}
* that determines, in conjunction with the provided
- * Subject, the Permissions
+ * {@code Subject}, the Permissions
* returned by this method. This parameter may be
- * null.
+ * {@code null}.
*
* @return the Collection of Permissions granted to all the
- * Subject and code specified in
+ * {@code Subject} and code specified in
* the provided subject and cs
* parameters.
*/
@@ -345,7 +345,7 @@ public abstract class Policy {
*
This method causes this object to refresh/reload its current
* Policy. This is implementation-dependent.
* For example, if the Policy object is stored in
- * a file, calling refresh will cause the file to be re-read.
+ * a file, calling {@code refresh} will cause the file to be re-read.
*
*
*
diff --git a/jdk/src/share/classes/javax/security/auth/PrivateCredentialPermission.java b/jdk/src/share/classes/javax/security/auth/PrivateCredentialPermission.java
index 3f5e708f5ca..810cff2228a 100644
--- a/jdk/src/share/classes/javax/security/auth/PrivateCredentialPermission.java
+++ b/jdk/src/share/classes/javax/security/auth/PrivateCredentialPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -34,10 +34,10 @@ import sun.security.util.ResourcesMgr;
/**
* This class is used to protect access to private Credentials
- * belonging to a particular Subject. The Subject
+ * belonging to a particular {@code Subject}. The {@code Subject}
* is represented by a Set of Principals.
*
- *
The target name of this Permission specifies
+ *
The target name of this {@code Permission} specifies
* a Credential class name, and a Set of Principals.
* The only valid value for this Permission's actions is, "read".
* The target name must abide by the following syntax:
@@ -65,12 +65,12 @@ import sun.security.util.ResourcesMgr;
*
* If CredentialClass is "*", then access is granted to
* all private Credentials belonging to the specified
- * Subject.
+ * {@code Subject}.
* If "PrincipalName" is "*", then access is granted to the
- * specified Credential owned by any Subject that has the
- * specified Principal (the actual PrincipalName doesn't matter).
+ * specified Credential owned by any {@code Subject} that has the
+ * specified {@code Principal} (the actual PrincipalName doesn't matter).
* For example, the following grants access to the
- * a.b.Credential owned by any Subject that has
+ * a.b.Credential owned by any {@code Subject} that has
* an a.b.Principal.
*
*
@@ -83,7 +83,7 @@ import sun.security.util.ResourcesMgr;
*
* If both the PrincipalClass and "PrincipalName" are "*",
* then access is granted to the specified Credential owned by
- * any Subject.
+ * any {@code Subject}.
*
*
In addition, the PrincipalClass/PrincipalName pairing may be repeated:
*
@@ -96,7 +96,7 @@ import sun.security.util.ResourcesMgr;
*
*
* The above grants access to the private Credential, "a.b.Credential",
- * belonging to a Subject with at least two associated Principals:
+ * belonging to a {@code Subject} with at least two associated Principals:
* "a.b.Principal" with the name, "duke", and "c.d.Principal", with the name,
* "dukette".
*
@@ -115,7 +115,7 @@ public final class PrivateCredentialPermission extends Permission {
/**
* @serial The Principals associated with this permission.
* The set contains elements of type,
- * PrivateCredentialPermission.CredOwner.
+ * {@code PrivateCredentialPermission.CredOwner}.
*/
private Set principals; // ignored - kept around for compatibility
private transient CredOwner[] credOwners;
@@ -126,8 +126,8 @@ public final class PrivateCredentialPermission extends Permission {
private boolean testing = false;
/**
- * Create a new PrivateCredentialPermission
- * with the specified credentialClass and Principals.
+ * Create a new {@code PrivateCredentialPermission}
+ * with the specified {@code credentialClass} and Principals.
*/
PrivateCredentialPermission(String credentialClass,
Set principals) {
@@ -153,19 +153,19 @@ public final class PrivateCredentialPermission extends Permission {
}
/**
- * Creates a new PrivateCredentialPermission
- * with the specified name. The name
- * specifies both a Credential class and a Principal Set.
+ * Creates a new {@code PrivateCredentialPermission}
+ * with the specified {@code name}. The {@code name}
+ * specifies both a Credential class and a {@code Principal} Set.
*
*
*
* @param name the name specifying the Credential class and
- * Principal Set.
+ * {@code Principal} Set.
*
* @param actions the actions specifying that the Credential can be read.
*
- * @throws IllegalArgumentException if name does not conform
- * to the correct syntax or if actions is not "read".
+ * @throws IllegalArgumentException if {@code name} does not conform
+ * to the correct syntax or if {@code actions} is not "read".
*/
public PrivateCredentialPermission(String name, String actions) {
super(name);
@@ -178,34 +178,34 @@ public final class PrivateCredentialPermission extends Permission {
/**
* Returns the Class name of the Credential associated with this
- * PrivateCredentialPermission.
+ * {@code PrivateCredentialPermission}.
*
*
*
* @return the Class name of the Credential associated with this
- * PrivateCredentialPermission.
+ * {@code PrivateCredentialPermission}.
*/
public String getCredentialClass() {
return credentialClass;
}
/**
- * Returns the Principal classes and names
- * associated with this PrivateCredentialPermission.
+ * Returns the {@code Principal} classes and names
+ * associated with this {@code PrivateCredentialPermission}.
* The information is returned as a two-dimensional array (array[x][y]).
- * The 'x' value corresponds to the number of Principal
+ * The 'x' value corresponds to the number of {@code Principal}
* class and name pairs. When (y==0), it corresponds to
- * the Principal class value, and when (y==1),
- * it corresponds to the Principal name value.
+ * the {@code Principal} class value, and when (y==1),
+ * it corresponds to the {@code Principal} name value.
* For example, array[0][0] corresponds to the class name of
- * the first Principal in the array. array[0][1]
- * corresponds to the Principal name of the
- * first Principal in the array.
+ * the first {@code Principal} in the array. array[0][1]
+ * corresponds to the {@code Principal} name of the
+ * first {@code Principal} in the array.
*
*
*
- * @return the Principal class and names associated
- * with this PrivateCredentialPermission.
+ * @return the {@code Principal} class and names associated
+ * with this {@code PrivateCredentialPermission}.
*/
public String[][] getPrincipals() {
@@ -222,8 +222,8 @@ public final class PrivateCredentialPermission extends Permission {
}
/**
- * Checks if this PrivateCredentialPermission implies
- * the specified Permission.
+ * Checks if this {@code PrivateCredentialPermission} implies
+ * the specified {@code Permission}.
*
*
*
@@ -241,10 +241,10 @@ public final class PrivateCredentialPermission extends Permission {
*
*
*
- * @param p the Permission to check against.
+ * @param p the {@code Permission} to check against.
*
- * @return true if this PrivateCredentialPermission implies
- * the specified Permission, false if not.
+ * @return true if this {@code PrivateCredentialPermission} implies
+ * the specified {@code Permission}, false if not.
*/
public boolean implies(Permission p) {
@@ -260,9 +260,9 @@ public final class PrivateCredentialPermission extends Permission {
}
/**
- * Checks two PrivateCredentialPermission objects for
+ * Checks two {@code PrivateCredentialPermission} objects for
* equality. Checks that obj is a
- * PrivateCredentialPermission,
+ * {@code PrivateCredentialPermission},
* and has the same credential class as this object,
* as well as the same Principals as this object.
* The order of the Principals in the respective Permission's
@@ -272,7 +272,7 @@ public final class PrivateCredentialPermission extends Permission {
*
* @param obj the object we are testing for equality with this object.
*
- * @return true if obj is a PrivateCredentialPermission,
+ * @return true if obj is a {@code PrivateCredentialPermission},
* has the same credential class as this object,
* and has the same Principals as this object.
*/
@@ -311,9 +311,9 @@ public final class PrivateCredentialPermission extends Permission {
/**
* Return a homogeneous collection of PrivateCredentialPermissions
- * in a PermissionCollection.
- * No such PermissionCollection is defined,
- * so this method always returns null.
+ * in a {@code PermissionCollection}.
+ * No such {@code PermissionCollection} is defined,
+ * so this method always returns {@code null}.
*
*
*
diff --git a/jdk/src/share/classes/javax/security/auth/RefreshFailedException.java b/jdk/src/share/classes/javax/security/auth/RefreshFailedException.java
index 3c51f1a9cf0..86c3245a807 100644
--- a/jdk/src/share/classes/javax/security/auth/RefreshFailedException.java
+++ b/jdk/src/share/classes/javax/security/auth/RefreshFailedException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,10 +26,10 @@
package javax.security.auth;
/**
- * Signals that a refresh operation failed.
+ * Signals that a {@code refresh} operation failed.
*
*
This exception is thrown by credentials implementing
- * the Refreshable interface when the refresh
+ * the {@code Refreshable} interface when the {@code refresh}
* method fails.
*
*/
diff --git a/jdk/src/share/classes/javax/security/auth/Refreshable.java b/jdk/src/share/classes/javax/security/auth/Refreshable.java
index 23ea81cff80..9ed85ace547 100644
--- a/jdk/src/share/classes/javax/security/auth/Refreshable.java
+++ b/jdk/src/share/classes/javax/security/auth/Refreshable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -37,24 +37,24 @@ package javax.security.auth;
public interface Refreshable {
/**
- * Determine if this Object is current.
+ * Determine if this {@code Object} is current.
*
*
*
- * @return true if this Object is currently current,
+ * @return true if this {@code Object} is currently current,
* false otherwise.
*/
boolean isCurrent();
/**
* Update or extend the validity period for this
- * Object.
+ * {@code Object}.
*
*
*
* @exception SecurityException if the caller does not have permission
* to update or extend the validity period for this
- * Object.
A Subject represents a grouping of related information
+ *
A {@code Subject} represents a grouping of related information
* for a single entity, such as a person.
* Such information includes the Subject's identities as well as
* its security-related attributes
* (passwords and cryptographic keys, for example).
*
*
Subjects may potentially have multiple identities.
- * Each identity is represented as a Principal
- * within the Subject. Principals simply bind names to a
- * Subject. For example, a Subject that happens
+ * Each identity is represented as a {@code Principal}
+ * within the {@code Subject}. Principals simply bind names to a
+ * {@code Subject}. For example, a {@code Subject} that happens
* to be a person, Alice, might have two Principals:
* one which binds "Alice Bar", the name on her driver license,
- * to the Subject, and another which binds,
+ * to the {@code Subject}, and another which binds,
* "999-99-9999", the number on her student identification card,
- * to the Subject. Both Principals refer to the same
- * Subject even though each has a different name.
+ * to the {@code Subject}. Both Principals refer to the same
+ * {@code Subject} even though each has a different name.
*
- *
A Subject may also own security-related attributes,
+ *
A {@code Subject} may also own security-related attributes,
* which are referred to as credentials.
* Sensitive credentials that require special protection, such as
* private cryptographic keys, are stored within a private credential
- * Set. Credentials intended to be shared, such as
+ * {@code Set}. Credentials intended to be shared, such as
* public key certificates or Kerberos server tickets are stored
- * within a public credential Set. Different permissions
+ * within a public credential {@code Set}. Different permissions
* are required to access and modify the different credential Sets.
*
- *
To retrieve all the Principals associated with a Subject,
- * invoke the getPrincipals method. To retrieve
- * all the public or private credentials belonging to a Subject,
- * invoke the getPublicCredentials method or
- * getPrivateCredentials method, respectively.
- * To modify the returned Set of Principals and credentials,
- * use the methods defined in the Set class.
+ *
To retrieve all the Principals associated with a {@code Subject},
+ * invoke the {@code getPrincipals} method. To retrieve
+ * all the public or private credentials belonging to a {@code Subject},
+ * invoke the {@code getPublicCredentials} method or
+ * {@code getPrivateCredentials} method, respectively.
+ * To modify the returned {@code Set} of Principals and credentials,
+ * use the methods defined in the {@code Set} class.
* For example:
*
This Subject class implements Serializable.
- * While the Principals associated with the Subject are serialized,
- * the credentials associated with the Subject are not.
- * Note that the java.security.Principal class
- * does not implement Serializable. Therefore all concrete
- * Principal implementations associated with Subjects
- * must implement Serializable.
+ *
This {@code Subject} class implements {@code Serializable}.
+ * While the Principals associated with the {@code Subject} are serialized,
+ * the credentials associated with the {@code Subject} are not.
+ * Note that the {@code java.security.Principal} class
+ * does not implement {@code Serializable}. Therefore all concrete
+ * {@code Principal} implementations associated with Subjects
+ * must implement {@code Serializable}.
*
* @see java.security.Principal
* @see java.security.DomainCombiner
@@ -102,14 +102,14 @@ public final class Subject implements java.io.Serializable {
private static final long serialVersionUID = -8308522755600156056L;
/**
- * A Set that provides a view of all of this
+ * A {@code Set} that provides a view of all of this
* Subject's Principals
*
*
*
* @serial Each element in this set is a
- * java.security.Principal.
- * The set is a Subject.SecureSet.
+ * {@code java.security.Principal}.
+ * The set is a {@code Subject.SecureSet}.
*/
Set principals;
@@ -135,21 +135,21 @@ public final class Subject implements java.io.Serializable {
= new ProtectionDomain[0];
/**
- * Create an instance of a Subject
- * with an empty Set of Principals and empty
+ * Create an instance of a {@code Subject}
+ * with an empty {@code Set} of Principals and empty
* Sets of public and private credentials.
*
- *
The newly constructed Sets check whether this Subject
+ *
The newly constructed Sets check whether this {@code Subject}
* has been set read-only before permitting subsequent modifications.
* The newly created Sets also prevent illegal modifications
* by ensuring that callers have sufficient permissions.
*
*
To modify the Principals Set, the caller must have
- * AuthPermission("modifyPrincipals").
+ * {@code AuthPermission("modifyPrincipals")}.
* To modify the public credential Set, the caller must have
- * AuthPermission("modifyPublicCredentials").
+ * {@code AuthPermission("modifyPublicCredentials")}.
* To modify the private credential Set, the caller must have
- * AuthPermission("modifyPrivateCredentials").
+ * {@code AuthPermission("modifyPrivateCredentials")}.
*/
public Subject() {
@@ -162,39 +162,39 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Create an instance of a Subject with
+ * Create an instance of a {@code Subject} with
* Principals and credentials.
*
*
The Principals and credentials from the specified Sets
* are copied into newly constructed Sets.
- * These newly created Sets check whether this Subject
+ * These newly created Sets check whether this {@code Subject}
* has been set read-only before permitting subsequent modifications.
* The newly created Sets also prevent illegal modifications
* by ensuring that callers have sufficient permissions.
*
*
To modify the Principals Set, the caller must have
- * AuthPermission("modifyPrincipals").
+ * {@code AuthPermission("modifyPrincipals")}.
* To modify the public credential Set, the caller must have
- * AuthPermission("modifyPublicCredentials").
+ * {@code AuthPermission("modifyPublicCredentials")}.
* To modify the private credential Set, the caller must have
- * AuthPermission("modifyPrivateCredentials").
+ * {@code AuthPermission("modifyPrivateCredentials")}.
*
*
- * @param readOnly true if the Subject is to be read-only,
+ * @param readOnly true if the {@code Subject} is to be read-only,
* and false otherwise.
*
- * @param principals the Set of Principals
- * to be associated with this Subject.
+ * @param principals the {@code Set} of Principals
+ * to be associated with this {@code Subject}.
*
- * @param pubCredentials the Set of public credentials
- * to be associated with this Subject.
+ * @param pubCredentials the {@code Set} of public credentials
+ * to be associated with this {@code Subject}.
*
- * @param privCredentials the Set of private credentials
- * to be associated with this Subject.
+ * @param privCredentials the {@code Set} of private credentials
+ * to be associated with this {@code Subject}.
*
* @exception NullPointerException if the specified
- * principals, pubCredentials,
- * or privCredentials are null.
+ * {@code principals}, {@code pubCredentials},
+ * or {@code privCredentials} are {@code null}.
*/
public Subject(boolean readOnly, Set extends Principal> principals,
Set> pubCredentials, Set> privCredentials)
@@ -216,24 +216,24 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Set this Subject to be read-only.
+ * Set this {@code Subject} to be read-only.
*
*
Modifications (additions and removals) to this Subject's
- * PrincipalSet and
+ * {@code Principal} {@code Set} and
* credential Sets will be disallowed.
- * The destroy operation on this Subject's credentials will
+ * The {@code destroy} operation on this Subject's credentials will
* still be permitted.
*
- *
Subsequent attempts to modify the Subject's Principal
+ *
Subsequent attempts to modify the Subject's {@code Principal}
* and credential Sets will result in an
- * IllegalStateException being thrown.
- * Also, once a Subject is read-only,
+ * {@code IllegalStateException} being thrown.
+ * Also, once a {@code Subject} is read-only,
* it can not be reset to being writable again.
*
*
*
* @exception SecurityException if the caller does not have permission
- * to set this Subject to be read-only.
+ * to set this {@code Subject} to be read-only.
*/
public void setReadOnly() {
java.lang.SecurityManager sm = System.getSecurityManager();
@@ -245,40 +245,40 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Query whether this Subject is read-only.
+ * Query whether this {@code Subject} is read-only.
*
*
*
- * @return true if this Subject is read-only, false otherwise.
+ * @return true if this {@code Subject} is read-only, false otherwise.
*/
public boolean isReadOnly() {
return this.readOnly;
}
/**
- * Get the Subject associated with the provided
- * AccessControlContext.
+ * Get the {@code Subject} associated with the provided
+ * {@code AccessControlContext}.
*
- *
The AccessControlContext may contain many
- * Subjects (from nested doAs calls).
- * In this situation, the most recent Subject associated
- * with the AccessControlContext is returned.
+ *
The {@code AccessControlContext} may contain many
+ * Subjects (from nested {@code doAs} calls).
+ * In this situation, the most recent {@code Subject} associated
+ * with the {@code AccessControlContext} is returned.
*
*
*
- * @param acc the AccessControlContext from which to retrieve
- * the Subject.
+ * @param acc the {@code AccessControlContext} from which to retrieve
+ * the {@code Subject}.
*
- * @return the Subject associated with the provided
- * AccessControlContext, or null
- * if no Subject is associated
- * with the provided AccessControlContext.
+ * @return the {@code Subject} associated with the provided
+ * {@code AccessControlContext}, or {@code null}
+ * if no {@code Subject} is associated
+ * with the provided {@code AccessControlContext}.
*
* @exception SecurityException if the caller does not have permission
- * to get the Subject.
+ * to get the {@code Subject}.
*
* @exception NullPointerException if the provided
- * AccessControlContext is null.
+ * {@code AccessControlContext} is {@code null}.
*/
public static Subject getSubject(final AccessControlContext acc) {
@@ -306,36 +306,36 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Perform work as a particular Subject.
+ * Perform work as a particular {@code Subject}.
*
*
This method first retrieves the current Thread's
- * AccessControlContext via
- * AccessController.getContext,
- * and then instantiates a new AccessControlContext
+ * {@code AccessControlContext} via
+ * {@code AccessController.getContext},
+ * and then instantiates a new {@code AccessControlContext}
* using the retrieved context along with a new
- * SubjectDomainCombiner (constructed using
- * the provided Subject).
- * Finally, this method invokes AccessController.doPrivileged,
- * passing it the provided PrivilegedAction,
- * as well as the newly constructed AccessControlContext.
+ * {@code SubjectDomainCombiner} (constructed using
+ * the provided {@code Subject}).
+ * Finally, this method invokes {@code AccessController.doPrivileged},
+ * passing it the provided {@code PrivilegedAction},
+ * as well as the newly constructed {@code AccessControlContext}.
*
*
*
- * @param subject the Subject that the specified
- * action will run as. This parameter
- * may be null.
+ * @param subject the {@code Subject} that the specified
+ * {@code action} will run as. This parameter
+ * may be {@code null}.
*
* @param the type of the value returned by the PrivilegedAction's
* {@code run} method.
*
* @param action the code to be run as the specified
- * Subject.
+ * {@code Subject}.
*
* @return the value returned by the PrivilegedAction's
- * run method.
+ * {@code run} method.
*
- * @exception NullPointerException if the PrivilegedAction
- * is null.
+ * @exception NullPointerException if the {@code PrivilegedAction}
+ * is {@code null}.
*
* @exception SecurityException if the caller does not have permission
* to invoke this method.
@@ -362,41 +362,41 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Perform work as a particular Subject.
+ * Perform work as a particular {@code Subject}.
*
*
This method first retrieves the current Thread's
- * AccessControlContext via
- * AccessController.getContext,
- * and then instantiates a new AccessControlContext
+ * {@code AccessControlContext} via
+ * {@code AccessController.getContext},
+ * and then instantiates a new {@code AccessControlContext}
* using the retrieved context along with a new
- * SubjectDomainCombiner (constructed using
- * the provided Subject).
- * Finally, this method invokes AccessController.doPrivileged,
- * passing it the provided PrivilegedExceptionAction,
- * as well as the newly constructed AccessControlContext.
+ * {@code SubjectDomainCombiner} (constructed using
+ * the provided {@code Subject}).
+ * Finally, this method invokes {@code AccessController.doPrivileged},
+ * passing it the provided {@code PrivilegedExceptionAction},
+ * as well as the newly constructed {@code AccessControlContext}.
*
*
*
- * @param subject the Subject that the specified
- * action will run as. This parameter
- * may be null.
+ * @param subject the {@code Subject} that the specified
+ * {@code action} will run as. This parameter
+ * may be {@code null}.
*
* @param the type of the value returned by the
* PrivilegedExceptionAction's {@code run} method.
*
* @param action the code to be run as the specified
- * Subject.
+ * {@code Subject}.
*
* @return the value returned by the
- * PrivilegedExceptionAction's run method.
+ * PrivilegedExceptionAction's {@code run} method.
*
* @exception PrivilegedActionException if the
- * PrivilegedExceptionAction.run
+ * {@code PrivilegedExceptionAction.run}
* method throws a checked exception.
*
* @exception NullPointerException if the specified
- * PrivilegedExceptionAction is
- * null.
+ * {@code PrivilegedExceptionAction} is
+ * {@code null}.
*
* @exception SecurityException if the caller does not have permission
* to invoke this method.
@@ -424,36 +424,36 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Perform privileged work as a particular Subject.
+ * Perform privileged work as a particular {@code Subject}.
*
- *
This method behaves exactly as Subject.doAs,
+ *
This method behaves exactly as {@code Subject.doAs},
* except that instead of retrieving the current Thread's
- * AccessControlContext, it uses the provided
- * AccessControlContext. If the provided
- * AccessControlContext is null,
- * this method instantiates a new AccessControlContext
+ * {@code AccessControlContext}, it uses the provided
+ * {@code AccessControlContext}. If the provided
+ * {@code AccessControlContext} is {@code null},
+ * this method instantiates a new {@code AccessControlContext}
* with an empty collection of ProtectionDomains.
*
*
*
- * @param subject the Subject that the specified
- * action will run as. This parameter
- * may be null.
+ * @param subject the {@code Subject} that the specified
+ * {@code action} will run as. This parameter
+ * may be {@code null}.
*
* @param the type of the value returned by the PrivilegedAction's
* {@code run} method.
*
* @param action the code to be run as the specified
- * Subject.
+ * {@code Subject}.
*
- * @param acc the AccessControlContext to be tied to the
+ * @param acc the {@code AccessControlContext} to be tied to the
* specified subject and action.
*
* @return the value returned by the PrivilegedAction's
- * run method.
+ * {@code run} method.
*
- * @exception NullPointerException if the PrivilegedAction
- * is null.
+ * @exception NullPointerException if the {@code PrivilegedAction}
+ * is {@code null}.
*
* @exception SecurityException if the caller does not have permission
* to invoke this method.
@@ -485,41 +485,41 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Perform privileged work as a particular Subject.
+ * Perform privileged work as a particular {@code Subject}.
*
- *
This method behaves exactly as Subject.doAs,
+ *
This method behaves exactly as {@code Subject.doAs},
* except that instead of retrieving the current Thread's
- * AccessControlContext, it uses the provided
- * AccessControlContext. If the provided
- * AccessControlContext is null,
- * this method instantiates a new AccessControlContext
+ * {@code AccessControlContext}, it uses the provided
+ * {@code AccessControlContext}. If the provided
+ * {@code AccessControlContext} is {@code null},
+ * this method instantiates a new {@code AccessControlContext}
* with an empty collection of ProtectionDomains.
*
*
*
- * @param subject the Subject that the specified
- * action will run as. This parameter
- * may be null.
+ * @param subject the {@code Subject} that the specified
+ * {@code action} will run as. This parameter
+ * may be {@code null}.
*
* @param the type of the value returned by the
* PrivilegedExceptionAction's {@code run} method.
*
* @param action the code to be run as the specified
- * Subject.
+ * {@code Subject}.
*
- * @param acc the AccessControlContext to be tied to the
+ * @param acc the {@code AccessControlContext} to be tied to the
* specified subject and action.
*
* @return the value returned by the
- * PrivilegedExceptionAction's run method.
+ * PrivilegedExceptionAction's {@code run} method.
*
* @exception PrivilegedActionException if the
- * PrivilegedExceptionAction.run
+ * {@code PrivilegedExceptionAction.run}
* method throws a checked exception.
*
* @exception NullPointerException if the specified
- * PrivilegedExceptionAction is
- * null.
+ * {@code PrivilegedExceptionAction} is
+ * {@code null}.
*
* @exception SecurityException if the caller does not have permission
* to invoke this method.
@@ -568,19 +568,19 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Return the Set of Principals associated with this
- * Subject. Each Principal represents
- * an identity for this Subject.
+ * Return the {@code Set} of Principals associated with this
+ * {@code Subject}. Each {@code Principal} represents
+ * an identity for this {@code Subject}.
*
- *
The returned Set is backed by this Subject's
- * internal PrincipalSet. Any modification
- * to the returned Set affects the internal
- * PrincipalSet as well.
+ *
The returned {@code Set} is backed by this Subject's
+ * internal {@code Principal} {@code Set}. Any modification
+ * to the returned {@code Set} affects the internal
+ * {@code Principal} {@code Set} as well.
*
*
*
- * @return The Set of Principals associated with this
- * Subject.
+ * @return The {@code Set} of Principals associated with this
+ * {@code Subject}.
*/
public Set getPrincipals() {
@@ -590,28 +590,28 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Return a Set of Principals associated with this
- * Subject that are instances or subclasses of the specified
- * Class.
+ * Return a {@code Set} of Principals associated with this
+ * {@code Subject} that are instances or subclasses of the specified
+ * {@code Class}.
*
- *
The returned Set is not backed by this Subject's
- * internal PrincipalSet. A new
- * Set is created and returned for each method invocation.
- * Modifications to the returned Set
- * will not affect the internal PrincipalSet.
+ *
The returned {@code Set} is not backed by this Subject's
+ * internal {@code Principal} {@code Set}. A new
+ * {@code Set} is created and returned for each method invocation.
+ * Modifications to the returned {@code Set}
+ * will not affect the internal {@code Principal} {@code Set}.
*
*
*
* @param the type of the class modeled by {@code c}
*
- * @param c the returned Set of Principals will all be
+ * @param c the returned {@code Set} of Principals will all be
* instances of this class.
*
- * @return a Set of Principals that are instances of the
- * specified Class.
+ * @return a {@code Set} of Principals that are instances of the
+ * specified {@code Class}.
*
- * @exception NullPointerException if the specified Class
- * is null.
+ * @exception NullPointerException if the specified {@code Class}
+ * is {@code null}.
*/
public Set getPrincipals(Class c) {
@@ -625,18 +625,18 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Return the Set of public credentials held by this
- * Subject.
+ * Return the {@code Set} of public credentials held by this
+ * {@code Subject}.
*
- *
The returned Set is backed by this Subject's
- * internal public Credential Set. Any modification
- * to the returned Set affects the internal public
- * Credential Set as well.
+ *
The returned {@code Set} is backed by this Subject's
+ * internal public Credential {@code Set}. Any modification
+ * to the returned {@code Set} affects the internal public
+ * Credential {@code Set} as well.
*
*
*
- * @return A Set of public credentials held by this
- * Subject.
+ * @return A {@code Set} of public credentials held by this
+ * {@code Subject}.
*/
public Set getPublicCredentials() {
@@ -646,29 +646,29 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Return the Set of private credentials held by this
- * Subject.
+ * Return the {@code Set} of private credentials held by this
+ * {@code Subject}.
*
- *
The returned Set is backed by this Subject's
- * internal private Credential Set. Any modification
- * to the returned Set affects the internal private
- * Credential Set as well.
+ *
The returned {@code Set} is backed by this Subject's
+ * internal private Credential {@code Set}. Any modification
+ * to the returned {@code Set} affects the internal private
+ * Credential {@code Set} as well.
*
*
A caller requires permissions to access the Credentials
- * in the returned Set, or to modify the
- * Set itself. A SecurityException
+ * in the returned {@code Set}, or to modify the
+ * {@code Set} itself. A {@code SecurityException}
* is thrown if the caller does not have the proper permissions.
*
- *
While iterating through the Set,
- * a SecurityException is thrown
+ *
While iterating through the {@code Set},
+ * a {@code SecurityException} is thrown
* if the caller does not have permission to access a
- * particular Credential. The Iterator
- * is nevertheless advanced to next element in the Set.
+ * particular Credential. The {@code Iterator}
+ * is nevertheless advanced to next element in the {@code Set}.
*
*
*
- * @return A Set of private credentials held by this
- * Subject.
+ * @return A {@code Set} of private credentials held by this
+ * {@code Subject}.
*/
public Set getPrivateCredentials() {
@@ -686,28 +686,28 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Return a Set of public credentials associated with this
- * Subject that are instances or subclasses of the specified
- * Class.
+ * Return a {@code Set} of public credentials associated with this
+ * {@code Subject} that are instances or subclasses of the specified
+ * {@code Class}.
*
- *
The returned Set is not backed by this Subject's
- * internal public Credential Set. A new
- * Set is created and returned for each method invocation.
- * Modifications to the returned Set
- * will not affect the internal public Credential Set.
+ *
The returned {@code Set} is not backed by this Subject's
+ * internal public Credential {@code Set}. A new
+ * {@code Set} is created and returned for each method invocation.
+ * Modifications to the returned {@code Set}
+ * will not affect the internal public Credential {@code Set}.
*
*
*
* @param the type of the class modeled by {@code c}
*
- * @param c the returned Set of public credentials will all be
+ * @param c the returned {@code Set} of public credentials will all be
* instances of this class.
*
- * @return a Set of public credentials that are instances
- * of the specified Class.
+ * @return a {@code Set} of public credentials that are instances
+ * of the specified {@code Class}.
*
- * @exception NullPointerException if the specified Class
- * is null.
+ * @exception NullPointerException if the specified {@code Class}
+ * is {@code null}.
*/
public Set getPublicCredentials(Class c) {
@@ -721,32 +721,32 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Return a Set of private credentials associated with this
- * Subject that are instances or subclasses of the specified
- * Class.
+ * Return a {@code Set} of private credentials associated with this
+ * {@code Subject} that are instances or subclasses of the specified
+ * {@code Class}.
*
*
The caller must have permission to access all of the
- * requested Credentials, or a SecurityException
+ * requested Credentials, or a {@code SecurityException}
* will be thrown.
*
- *
The returned Set is not backed by this Subject's
- * internal private Credential Set. A new
- * Set is created and returned for each method invocation.
- * Modifications to the returned Set
- * will not affect the internal private Credential Set.
+ *
The returned {@code Set} is not backed by this Subject's
+ * internal private Credential {@code Set}. A new
+ * {@code Set} is created and returned for each method invocation.
+ * Modifications to the returned {@code Set}
+ * will not affect the internal private Credential {@code Set}.
*
*
*
* @param the type of the class modeled by {@code c}
*
- * @param c the returned Set of private credentials will all be
+ * @param c the returned {@code Set} of private credentials will all be
* instances of this class.
*
- * @return a Set of private credentials that are instances
- * of the specified Class.
+ * @return a {@code Set} of private credentials that are instances
+ * of the specified {@code Class}.
*
- * @exception NullPointerException if the specified Class
- * is null.
+ * @exception NullPointerException if the specified {@code Class}
+ * is {@code null}.
*/
public Set getPrivateCredentials(Class c) {
@@ -768,25 +768,25 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Compares the specified Object with this Subject
+ * Compares the specified Object with this {@code Subject}
* for equality. Returns true if the given object is also a Subject
- * and the two Subject instances are equivalent.
- * More formally, two Subject instances are
- * equal if their Principal and Credential
+ * and the two {@code Subject} instances are equivalent.
+ * More formally, two {@code Subject} instances are
+ * equal if their {@code Principal} and {@code Credential}
* Sets are equal.
*
*
*
* @param o Object to be compared for equality with this
- * Subject.
+ * {@code Subject}.
*
* @return true if the specified Object is equal to this
- * Subject.
+ * {@code Subject}.
*
* @exception SecurityException if the caller does not have permission
- * to access the private credentials for this Subject,
+ * to access the private credentials for this {@code Subject},
* or if the caller does not have permission to access the
- * private credentials for the provided Subject.
+ * private credentials for the provided {@code Subject}.
*/
public boolean equals(Object o) {
@@ -833,11 +833,11 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Return the String representation of this Subject.
+ * Return the String representation of this {@code Subject}.
*
*
*
- * @return the String representation of this Subject.
+ * @return the String representation of this {@code Subject}.
*/
public String toString() {
return toString(true);
@@ -894,11 +894,11 @@ public final class Subject implements java.io.Serializable {
}
/**
- * Returns a hashcode for this Subject.
+ * Returns a hashcode for this {@code Subject}.
*
*
*
- * @return a hashcode for this Subject.
+ * @return a hashcode for this {@code Subject}.
*
* @exception SecurityException if the caller does not have permission
* to access this Subject's private credentials.
@@ -910,10 +910,10 @@ public final class Subject implements java.io.Serializable {
* hashcodes of this Subject's Principals and credentials.
*
* If a particular credential was destroyed
- * (credential.hashCode() throws an
- * IllegalStateException),
+ * ({@code credential.hashCode()} throws an
+ * {@code IllegalStateException}),
* the hashcode for that credential is derived via:
- * credential.getClass().toString().hashCode().
+ * {@code credential.getClass().toString().hashCode()}.
*/
int hashCode = 0;
@@ -964,7 +964,7 @@ public final class Subject implements java.io.Serializable {
s.defaultReadObject();
- // The Credential Set is not serialized, but we do not
+ // The Credential {@code Set} is not serialized, but we do not
// want the default deserialization routine to set it to null.
this.pubCredentials = Collections.synchronizedSet
(new SecureSet(this, PUB_CREDENTIAL_SET));
@@ -998,13 +998,13 @@ public final class Subject implements java.io.Serializable {
/**
* @serial An integer identifying the type of objects contained
- * in this set. If which == 1,
+ * in this set. If {@code which == 1},
* this is a Principal set and all the elements are
- * of type java.security.Principal.
- * If which == 2, this is a public credential
- * set and all the elements are of type Object.
- * If which == 3, this is a private credential
- * set and all the elements are of type Object.
+ * of type {@code java.security.Principal}.
+ * If {@code which == 2}, this is a public credential
+ * set and all the elements are of type {@code Object}.
+ * If {@code which == 3}, this is a private credential
+ * set and all the elements are of type {@code Object}.
*/
private int which;
@@ -1321,7 +1321,7 @@ public final class Subject implements java.io.Serializable {
}
/**
- * This class implements a Set which returns only
+ * This class implements a {@code Set} which returns only
* members that are an instance of a specified Class.
*/
private class ClassSet extends AbstractSet {
diff --git a/jdk/src/share/classes/javax/security/auth/SubjectDomainCombiner.java b/jdk/src/share/classes/javax/security/auth/SubjectDomainCombiner.java
index 9da411cc1bd..da75d683425 100644
--- a/jdk/src/share/classes/javax/security/auth/SubjectDomainCombiner.java
+++ b/jdk/src/share/classes/javax/security/auth/SubjectDomainCombiner.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -39,9 +39,9 @@ import java.util.WeakHashMap;
import java.lang.ref.WeakReference;
/**
- * A SubjectDomainCombiner updates ProtectionDomains
- * with Principals from the Subject associated with this
- * SubjectDomainCombiner.
+ * A {@code SubjectDomainCombiner} updates ProtectionDomains
+ * with Principals from the {@code Subject} associated with this
+ * {@code SubjectDomainCombiner}.
*
*/
public class SubjectDomainCombiner implements java.security.DomainCombiner {
@@ -66,13 +66,13 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
(useJavaxPolicy && cachePolicy());
/**
- * Associate the provided Subject with this
- * SubjectDomainCombiner.
+ * Associate the provided {@code Subject} with this
+ * {@code SubjectDomainCombiner}.
*
*
*
- * @param subject the Subject to be associated with
- * with this SubjectDomainCombiner.
+ * @param subject the {@code Subject} to be associated with
+ * with this {@code SubjectDomainCombiner}.
*/
public SubjectDomainCombiner(Subject subject) {
this.subject = subject;
@@ -85,19 +85,19 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
}
/**
- * Get the Subject associated with this
- * SubjectDomainCombiner.
+ * Get the {@code Subject} associated with this
+ * {@code SubjectDomainCombiner}.
*
*
*
- * @return the Subject associated with this
- * SubjectDomainCombiner, or null
- * if no Subject is associated with this
- * SubjectDomainCombiner.
+ * @return the {@code Subject} associated with this
+ * {@code SubjectDomainCombiner}, or {@code null}
+ * if no {@code Subject} is associated with this
+ * {@code SubjectDomainCombiner}.
*
* @exception SecurityException if the caller does not have permission
- * to get the Subject associated with this
- * SubjectDomainCombiner.
+ * to get the {@code Subject} associated with this
+ * {@code SubjectDomainCombiner}.
*/
public Subject getSubject() {
java.lang.SecurityManager sm = System.getSecurityManager();
@@ -110,18 +110,18 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
/**
* Update the relevant ProtectionDomains with the Principals
- * from the Subject associated with this
- * SubjectDomainCombiner.
+ * from the {@code Subject} associated with this
+ * {@code SubjectDomainCombiner}.
*
- *
A new ProtectionDomain instance is created
- * for each ProtectionDomain in the
- * currentDomains array. Each new ProtectionDomain
- * instance is created using the CodeSource,
- * Permissions and ClassLoader
- * from the corresponding ProtectionDomain in
+ *
A new {@code ProtectionDomain} instance is created
+ * for each {@code ProtectionDomain} in the
+ * currentDomains array. Each new {@code ProtectionDomain}
+ * instance is created using the {@code CodeSource},
+ * {@code Permission}s and {@code ClassLoader}
+ * from the corresponding {@code ProtectionDomain} in
* currentDomains, as well as with the Principals from
- * the Subject associated with this
- * SubjectDomainCombiner.
+ * the {@code Subject} associated with this
+ * {@code SubjectDomainCombiner}.
*
*
All of the newly instantiated ProtectionDomains are
* combined into a new array. The ProtectionDomains from the
@@ -136,23 +136,23 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
*
* @param currentDomains the ProtectionDomains associated with the
* current execution Thread, up to the most recent
- * privileged ProtectionDomain.
+ * privileged {@code ProtectionDomain}.
* The ProtectionDomains are are listed in order of execution,
- * with the most recently executing ProtectionDomain
+ * with the most recently executing {@code ProtectionDomain}
* residing at the beginning of the array. This parameter may
- * be null if the current execution Thread
+ * be {@code null} if the current execution Thread
* has no associated ProtectionDomains.
*
* @param assignedDomains the ProtectionDomains inherited from the
* parent Thread, or the ProtectionDomains from the
* privileged context, if a call to
* AccessController.doPrivileged(..., context)
- * had occurred This parameter may be null
+ * had occurred This parameter may be {@code null}
* if there were no ProtectionDomains inherited from the
* parent Thread, or from the privileged context.
*
* @return a new array consisting of the updated ProtectionDomains,
- * or null.
+ * or {@code null}.
*/
public ProtectionDomain[] combine(ProtectionDomain[] currentDomains,
ProtectionDomain[] assignedDomains) {
diff --git a/jdk/src/share/classes/javax/security/auth/callback/Callback.java b/jdk/src/share/classes/javax/security/auth/callback/Callback.java
index 43f884f049d..83855ca0484 100644
--- a/jdk/src/share/classes/javax/security/auth/callback/Callback.java
+++ b/jdk/src/share/classes/javax/security/auth/callback/Callback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -28,14 +28,14 @@ package javax.security.auth.callback;
/**
*
Implementations of this interface are passed to a
- * CallbackHandler, allowing underlying security services
+ * {@code CallbackHandler}, allowing underlying security services
* the ability to interact with a calling application to retrieve specific
* authentication data such as usernames and passwords, or to display
* certain information, such as error and warning messages.
*
- *
Callback implementations do not retrieve or
+ *
{@code Callback} implementations do not retrieve or
* display the information requested by underlying security services.
- * Callback implementations simply provide the means
+ * {@code Callback} implementations simply provide the means
* to pass such requests to applications, and for applications,
* if appropriate, to return requested information back to the
* underlying security services.
diff --git a/jdk/src/share/classes/javax/security/auth/callback/CallbackHandler.java b/jdk/src/share/classes/javax/security/auth/callback/CallbackHandler.java
index 843accac99b..af024962ec4 100644
--- a/jdk/src/share/classes/javax/security/auth/callback/CallbackHandler.java
+++ b/jdk/src/share/classes/javax/security/auth/callback/CallbackHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,7 +26,7 @@
package javax.security.auth.callback;
/**
- *
An application implements a CallbackHandler and passes
+ *
An application implements a {@code CallbackHandler} and passes
* it to underlying security services so that they may interact with
* the application to retrieve specific authentication data,
* such as usernames and passwords, or to display certain information,
@@ -40,12 +40,12 @@ package javax.security.auth.callback;
*
*
Underlying security services make requests for different types
* of information by passing individual Callbacks to the
- * CallbackHandler. The CallbackHandler
+ * {@code CallbackHandler}. The {@code CallbackHandler}
* implementation decides how to retrieve and display information
* depending on the Callbacks passed to it. For example,
* if the underlying service needs a username and password to
- * authenticate a user, it uses a NameCallback and
- * PasswordCallback. The CallbackHandler
+ * authenticate a user, it uses a {@code NameCallback} and
+ * {@code PasswordCallback}. The {@code CallbackHandler}
* can then choose to prompt for a username and password serially,
* or to prompt for both in a single window.
*
@@ -54,10 +54,10 @@ package javax.security.auth.callback;
* {@code auth.login.defaultCallbackHandler} security property.
*
*
If the security property is set to the fully qualified name of a
- * CallbackHandler implementation class,
- * then a LoginContext will load the specified
- * CallbackHandler and pass it to the underlying LoginModules.
- * The LoginContext only loads the default handler
+ * {@code CallbackHandler} implementation class,
+ * then a {@code LoginContext} will load the specified
+ * {@code CallbackHandler} and pass it to the underlying LoginModules.
+ * The {@code LoginContext} only loads the default handler
* if it was not provided one.
*
*
All default handler implementations must provide a public
@@ -71,11 +71,11 @@ public interface CallbackHandler {
*
Retrieve or display the information requested in the
* provided Callbacks.
*
- *
The handle method implementation checks the
- * instance(s) of the Callback object(s) passed in
+ *
The {@code handle} method implementation checks the
+ * instance(s) of the {@code Callback} object(s) passed in
* to retrieve or display the requested information.
* The following example is provided to help demonstrate what an
- * handle method implementation might look like.
+ * {@code handle} method implementation might look like.
* This example code is for guidance only. Many details,
* including proper error handling, are left out for simplicity.
*
@@ -135,7 +135,7 @@ public interface CallbackHandler {
* }
* }
*
- * @param callbacks an array of Callback objects provided
+ * @param callbacks an array of {@code Callback} objects provided
* by an underlying security service which contains
* the information requested to be retrieved or displayed.
*
@@ -143,7 +143,7 @@ public interface CallbackHandler {
*
* @exception UnsupportedCallbackException if the implementation of this
* method does not support one or more of the Callbacks
- * specified in the callbacks parameter.
+ * specified in the {@code callbacks} parameter.
*/
void handle(Callback[] callbacks)
throws java.io.IOException, UnsupportedCallbackException;
diff --git a/jdk/src/share/classes/javax/security/auth/callback/ChoiceCallback.java b/jdk/src/share/classes/javax/security/auth/callback/ChoiceCallback.java
index 422e50cb841..215a8dd790e 100644
--- a/jdk/src/share/classes/javax/security/auth/callback/ChoiceCallback.java
+++ b/jdk/src/share/classes/javax/security/auth/callback/ChoiceCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,8 +27,8 @@ package javax.security.auth.callback;
/**
*
Underlying security services instantiate and pass a
- * ChoiceCallback to the handle
- * method of a CallbackHandler to display a list of choices
+ * {@code ChoiceCallback} to the {@code handle}
+ * method of a {@code CallbackHandler} to display a list of choices
* and to retrieve the selected choice(s).
*
* @see javax.security.auth.callback.CallbackHandler
@@ -60,13 +60,13 @@ public class ChoiceCallback implements Callback, java.io.Serializable {
private boolean multipleSelectionsAllowed;
/**
* @serial the selected choices, represented as indexes into the
- * choices list.
+ * {@code choices} list.
* @since 1.4
*/
private int[] selections;
/**
- * Construct a ChoiceCallback with a prompt,
+ * Construct a {@code ChoiceCallback} with a prompt,
* a list of choices, a default choice, and a boolean specifying
* whether or not multiple selections from the list of choices are allowed.
*
@@ -79,21 +79,21 @@ public class ChoiceCallback implements Callback, java.io.Serializable {
* @param defaultChoice the choice to be used as the default choice
* when the list of choices are displayed. This value
* is represented as an index into the
- * choices array.
+ * {@code choices} array.
*
* @param multipleSelectionsAllowed boolean specifying whether or
* not multiple selections can be made from the
* list of choices.
*
- * @exception IllegalArgumentException if prompt is null,
- * if prompt has a length of 0,
- * if choices is null,
- * if choices has a length of 0,
- * if any element from choices is null,
- * if any element from choices
- * has a length of 0 or if defaultChoice
+ * @exception IllegalArgumentException if {@code prompt} is null,
+ * if {@code prompt} has a length of 0,
+ * if {@code choices} is null,
+ * if {@code choices} has a length of 0,
+ * if any element from {@code choices} is null,
+ * if any element from {@code choices}
+ * has a length of 0 or if {@code defaultChoice}
* does not fall within the array boundaries of
- * choices.
+ * {@code choices}.
*/
public ChoiceCallback(String prompt, String[] choices,
int defaultChoice, boolean multipleSelectionsAllowed) {
@@ -142,7 +142,7 @@ public class ChoiceCallback implements Callback, java.io.Serializable {
*
*
* @return the defaultChoice, represented as an index into
- * the choices list.
+ * the {@code choices} list.
*/
public int getDefaultChoice() {
return defaultChoice;
@@ -150,7 +150,7 @@ public class ChoiceCallback implements Callback, java.io.Serializable {
/**
* Get the boolean determining whether multiple selections from
- * the choices list are allowed.
+ * the {@code choices} list are allowed.
*
*
*
@@ -166,7 +166,7 @@ public class ChoiceCallback implements Callback, java.io.Serializable {
*
*
* @param selection the selection represented as an index into the
- * choices list.
+ * {@code choices} list.
*
* @see #getSelectedIndexes
*/
@@ -181,11 +181,11 @@ public class ChoiceCallback implements Callback, java.io.Serializable {
*
*
* @param selections the selections represented as indexes into the
- * choices list.
+ * {@code choices} list.
*
* @exception UnsupportedOperationException if multiple selections are
* not allowed, as determined by
- * allowMultipleSelections.
+ * {@code allowMultipleSelections}.
*
* @see #getSelectedIndexes
*/
@@ -201,7 +201,7 @@ public class ChoiceCallback implements Callback, java.io.Serializable {
*
*
* @return the selected choices, represented as indexes into the
- * choices list.
+ * {@code choices} list.
*
* @see #setSelectedIndexes
*/
diff --git a/jdk/src/share/classes/javax/security/auth/callback/ConfirmationCallback.java b/jdk/src/share/classes/javax/security/auth/callback/ConfirmationCallback.java
index a410c7b92cf..2d85c463ca9 100644
--- a/jdk/src/share/classes/javax/security/auth/callback/ConfirmationCallback.java
+++ b/jdk/src/share/classes/javax/security/auth/callback/ConfirmationCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,8 +27,8 @@ package javax.security.auth.callback;
/**
*
Underlying security services instantiate and pass a
- * ConfirmationCallback to the handle
- * method of a CallbackHandler to ask for YES/NO,
+ * {@code ConfirmationCallback} to the {@code handle}
+ * method of a {@code CallbackHandler} to ask for YES/NO,
* OK/CANCEL, YES/NO/CANCEL or other similar confirmations.
*
* @see javax.security.auth.callback.CallbackHandler
@@ -40,9 +40,9 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
/**
* Unspecified option type.
*
- *
The getOptionType method returns this
- * value if this ConfirmationCallback was instantiated
- * with options instead of an optionType.
+ *
The {@code getOptionType} method returns this
+ * value if this {@code ConfirmationCallback} was instantiated
+ * with {@code options} instead of an {@code optionType}.
*/
public static final int UNSPECIFIED_OPTION = -1;
@@ -50,9 +50,9 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
* YES/NO confirmation option.
*
*
An underlying security service specifies this as the
- * optionType to a ConfirmationCallback
+ * {@code optionType} to a {@code ConfirmationCallback}
* constructor if it requires a confirmation which can be answered
- * with either YES or NO.
+ * with either {@code YES} or {@code NO}.
*/
public static final int YES_NO_OPTION = 0;
@@ -60,9 +60,9 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
* YES/NO/CANCEL confirmation confirmation option.
*
*
An underlying security service specifies this as the
- * optionType to a ConfirmationCallback
+ * {@code optionType} to a {@code ConfirmationCallback}
* constructor if it requires a confirmation which can be answered
- * with either YES, NO or CANCEL.
+ * with either {@code YES}, {@code NO} or {@code CANCEL}.
*/
public static final int YES_NO_CANCEL_OPTION = 1;
@@ -70,45 +70,45 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
* OK/CANCEL confirmation confirmation option.
*
*
An underlying security service specifies this as the
- * optionType to a ConfirmationCallback
+ * {@code optionType} to a {@code ConfirmationCallback}
* constructor if it requires a confirmation which can be answered
- * with either OK or CANCEL.
+ * with either {@code OK} or {@code CANCEL}.
*/
public static final int OK_CANCEL_OPTION = 2;
/**
* YES option.
*
- *
If an optionType was specified to this
- * ConfirmationCallback, this option may be specified as a
- * defaultOption or returned as the selected index.
+ *
If an {@code optionType} was specified to this
+ * {@code ConfirmationCallback}, this option may be specified as a
+ * {@code defaultOption} or returned as the selected index.
*/
public static final int YES = 0;
/**
* NO option.
*
- *
If an optionType was specified to this
- * ConfirmationCallback, this option may be specified as a
- * defaultOption or returned as the selected index.
+ *
If an {@code optionType} was specified to this
+ * {@code ConfirmationCallback}, this option may be specified as a
+ * {@code defaultOption} or returned as the selected index.
*/
public static final int NO = 1;
/**
* CANCEL option.
*
- *
If an optionType was specified to this
- * ConfirmationCallback, this option may be specified as a
- * defaultOption or returned as the selected index.
+ *
If an {@code optionType} was specified to this
+ * {@code ConfirmationCallback}, this option may be specified as a
+ * {@code defaultOption} or returned as the selected index.
*/
public static final int CANCEL = 2;
/**
* OK option.
*
- *
If an optionType was specified to this
- * ConfirmationCallback, this option may be specified as a
- * defaultOption or returned as the selected index.
+ *
If an {@code optionType} was specified to this
+ * {@code ConfirmationCallback}, this option may be specified as a
+ * {@code defaultOption} or returned as the selected index.
*/
public static final int OK = 3;
@@ -152,7 +152,7 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
private int selection;
/**
- * Construct a ConfirmationCallback with a
+ * Construct a {@code ConfirmationCallback} with a
* message type, an option type and a default option.
*
*
Underlying security services use this constructor if
@@ -161,27 +161,27 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
*
*
*
- * @param messageType the message type (INFORMATION,
- * WARNING or ERROR).
+ * @param messageType the message type ({@code INFORMATION},
+ * {@code WARNING} or {@code ERROR}).
*
- * @param optionType the option type (YES_NO_OPTION,
- * YES_NO_CANCEL_OPTION or
- * OK_CANCEL_OPTION).
+ * @param optionType the option type ({@code YES_NO_OPTION},
+ * {@code YES_NO_CANCEL_OPTION} or
+ * {@code OK_CANCEL_OPTION}).
*
* @param defaultOption the default option
- * from the provided optionType (YES,
- * NO, CANCEL or
- * OK).
+ * from the provided optionType ({@code YES},
+ * {@code NO}, {@code CANCEL} or
+ * {@code OK}).
*
* @exception IllegalArgumentException if messageType is not either
- * INFORMATION, WARNING,
- * or ERROR, if optionType is not either
- * YES_NO_OPTION,
- * YES_NO_CANCEL_OPTION, or
- * OK_CANCEL_OPTION,
- * or if defaultOption
+ * {@code INFORMATION}, {@code WARNING},
+ * or {@code ERROR}, if optionType is not either
+ * {@code YES_NO_OPTION},
+ * {@code YES_NO_CANCEL_OPTION}, or
+ * {@code OK_CANCEL_OPTION},
+ * or if {@code defaultOption}
* does not correspond to one of the options in
- * optionType.
+ * {@code optionType}.
*/
public ConfirmationCallback(int messageType,
int optionType, int defaultOption) {
@@ -212,35 +212,35 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
}
/**
- * Construct a ConfirmationCallback with a
+ * Construct a {@code ConfirmationCallback} with a
* message type, a list of options and a default option.
*
*
Underlying security services use this constructor if
* they require a confirmation different from the available preset
* confirmations provided (for example, CONTINUE/ABORT or STOP/GO).
- * The confirmation options are listed in the options array,
- * and are displayed by the CallbackHandler implementation
+ * The confirmation options are listed in the {@code options} array,
+ * and are displayed by the {@code CallbackHandler} implementation
* in a manner consistent with the way preset options are displayed.
*
*
*
- * @param messageType the message type (INFORMATION,
- * WARNING or ERROR).
+ * @param messageType the message type ({@code INFORMATION},
+ * {@code WARNING} or {@code ERROR}).
*
* @param options the list of confirmation options.
*
* @param defaultOption the default option, represented as an index
- * into the options array.
+ * into the {@code options} array.
*
* @exception IllegalArgumentException if messageType is not either
- * INFORMATION, WARNING,
- * or ERROR, if options is null,
- * if options has a length of 0,
- * if any element from options is null,
- * if any element from options
- * has a length of 0, or if defaultOption
+ * {@code INFORMATION}, {@code WARNING},
+ * or {@code ERROR}, if {@code options} is null,
+ * if {@code options} has a length of 0,
+ * if any element from {@code options} is null,
+ * if any element from {@code options}
+ * has a length of 0, or if {@code defaultOption}
* does not lie within the array boundaries of
- * options.
+ * {@code options}.
*/
public ConfirmationCallback(int messageType,
String[] options, int defaultOption) {
@@ -261,7 +261,7 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
}
/**
- * Construct a ConfirmationCallback with a prompt,
+ * Construct a {@code ConfirmationCallback} with a prompt,
* message type, an option type and a default option.
*
*
Underlying security services use this constructor if
@@ -272,29 +272,29 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
*
* @param prompt the prompt used to describe the list of options.
*
- * @param messageType the message type (INFORMATION,
- * WARNING or ERROR).
+ * @param messageType the message type ({@code INFORMATION},
+ * {@code WARNING} or {@code ERROR}).
*
- * @param optionType the option type (YES_NO_OPTION,
- * YES_NO_CANCEL_OPTION or
- * OK_CANCEL_OPTION).
+ * @param optionType the option type ({@code YES_NO_OPTION},
+ * {@code YES_NO_CANCEL_OPTION} or
+ * {@code OK_CANCEL_OPTION}).
*
* @param defaultOption the default option
- * from the provided optionType (YES,
- * NO, CANCEL or
- * OK).
+ * from the provided optionType ({@code YES},
+ * {@code NO}, {@code CANCEL} or
+ * {@code OK}).
*
- * @exception IllegalArgumentException if prompt is null,
- * if prompt has a length of 0,
+ * @exception IllegalArgumentException if {@code prompt} is null,
+ * if {@code prompt} has a length of 0,
* if messageType is not either
- * INFORMATION, WARNING,
- * or ERROR, if optionType is not either
- * YES_NO_OPTION,
- * YES_NO_CANCEL_OPTION, or
- * OK_CANCEL_OPTION,
- * or if defaultOption
+ * {@code INFORMATION}, {@code WARNING},
+ * or {@code ERROR}, if optionType is not either
+ * {@code YES_NO_OPTION},
+ * {@code YES_NO_CANCEL_OPTION}, or
+ * {@code OK_CANCEL_OPTION},
+ * or if {@code defaultOption}
* does not correspond to one of the options in
- * optionType.
+ * {@code optionType}.
*/
public ConfirmationCallback(String prompt, int messageType,
int optionType, int defaultOption) {
@@ -327,39 +327,39 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
}
/**
- * Construct a ConfirmationCallback with a prompt,
+ * Construct a {@code ConfirmationCallback} with a prompt,
* message type, a list of options and a default option.
*
*
Underlying security services use this constructor if
* they require a confirmation different from the available preset
* confirmations provided (for example, CONTINUE/ABORT or STOP/GO).
- * The confirmation options are listed in the options array,
- * and are displayed by the CallbackHandler implementation
+ * The confirmation options are listed in the {@code options} array,
+ * and are displayed by the {@code CallbackHandler} implementation
* in a manner consistent with the way preset options are displayed.
*
*
*
* @param prompt the prompt used to describe the list of options.
*
- * @param messageType the message type (INFORMATION,
- * WARNING or ERROR).
+ * @param messageType the message type ({@code INFORMATION},
+ * {@code WARNING} or {@code ERROR}).
*
* @param options the list of confirmation options.
*
* @param defaultOption the default option, represented as an index
- * into the options array.
+ * into the {@code options} array.
*
- * @exception IllegalArgumentException if prompt is null,
- * if prompt has a length of 0,
+ * @exception IllegalArgumentException if {@code prompt} is null,
+ * if {@code prompt} has a length of 0,
* if messageType is not either
- * INFORMATION, WARNING,
- * or ERROR, if options is null,
- * if options has a length of 0,
- * if any element from options is null,
- * if any element from options
- * has a length of 0, or if defaultOption
+ * {@code INFORMATION}, {@code WARNING},
+ * or {@code ERROR}, if {@code options} is null,
+ * if {@code options} has a length of 0,
+ * if any element from {@code options} is null,
+ * if any element from {@code options}
+ * has a length of 0, or if {@code defaultOption}
* does not lie within the array boundaries of
- * options.
+ * {@code options}.
*/
public ConfirmationCallback(String prompt, int messageType,
String[] options, int defaultOption) {
@@ -386,8 +386,8 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
*
*
*
- * @return the prompt, or null if this ConfirmationCallback
- * was instantiated without a prompt.
+ * @return the prompt, or null if this {@code ConfirmationCallback}
+ * was instantiated without a {@code prompt}.
*/
public String getPrompt() {
return prompt;
@@ -398,8 +398,8 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
*
*
*
- * @return the message type (INFORMATION,
- * WARNING or ERROR).
+ * @return the message type ({@code INFORMATION},
+ * {@code WARNING} or {@code ERROR}).
*/
public int getMessageType() {
return messageType;
@@ -408,20 +408,20 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
/**
* Get the option type.
*
- *
If this method returns UNSPECIFIED_OPTION, then this
- * ConfirmationCallback was instantiated with
- * options instead of an optionType.
- * In this case, invoke the getOptions method
+ *
If this method returns {@code UNSPECIFIED_OPTION}, then this
+ * {@code ConfirmationCallback} was instantiated with
+ * {@code options} instead of an {@code optionType}.
+ * In this case, invoke the {@code getOptions} method
* to determine which confirmation options to display.
*
*
*
- * @return the option type (YES_NO_OPTION,
- * YES_NO_CANCEL_OPTION or
- * OK_CANCEL_OPTION), or
- * UNSPECIFIED_OPTION if this
- * ConfirmationCallback was instantiated with
- * options instead of an optionType.
+ * @return the option type ({@code YES_NO_OPTION},
+ * {@code YES_NO_CANCEL_OPTION} or
+ * {@code OK_CANCEL_OPTION}), or
+ * {@code UNSPECIFIED_OPTION} if this
+ * {@code ConfirmationCallback} was instantiated with
+ * {@code options} instead of an {@code optionType}.
*/
public int getOptionType() {
return optionType;
@@ -433,8 +433,8 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
*
*
* @return the list of confirmation options, or null if this
- * ConfirmationCallback was instantiated with
- * an optionType instead of options.
+ * {@code ConfirmationCallback} was instantiated with
+ * an {@code optionType} instead of {@code options}.
*/
public String[] getOptions() {
return options;
@@ -446,14 +446,14 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
*
*
* @return the default option, represented as
- * YES, NO, OK or
- * CANCEL if an optionType
+ * {@code YES}, {@code NO}, {@code OK} or
+ * {@code CANCEL} if an {@code optionType}
* was specified to the constructor of this
- * ConfirmationCallback.
+ * {@code ConfirmationCallback}.
* Otherwise, this method returns the default option as
* an index into the
- * options array specified to the constructor
- * of this ConfirmationCallback.
+ * {@code options} array specified to the constructor
+ * of this {@code ConfirmationCallback}.
*/
public int getDefaultOption() {
return defaultOption;
@@ -464,13 +464,13 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
*
*
*
- * @param selection the selection represented as YES,
- * NO, OK or CANCEL
- * if an optionType was specified to the constructor
- * of this ConfirmationCallback.
+ * @param selection the selection represented as {@code YES},
+ * {@code NO}, {@code OK} or {@code CANCEL}
+ * if an {@code optionType} was specified to the constructor
+ * of this {@code ConfirmationCallback}.
* Otherwise, the selection represents the index into the
- * options array specified to the constructor
- * of this ConfirmationCallback.
+ * {@code options} array specified to the constructor
+ * of this {@code ConfirmationCallback}.
*
* @see #getSelectedIndex
*/
@@ -484,14 +484,14 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
*
*
* @return the selected confirmation option represented as
- * YES, NO, OK or
- * CANCEL if an optionType
+ * {@code YES}, {@code NO}, {@code OK} or
+ * {@code CANCEL} if an {@code optionType}
* was specified to the constructor of this
- * ConfirmationCallback.
+ * {@code ConfirmationCallback}.
* Otherwise, this method returns the selected confirmation
* option as an index into the
- * options array specified to the constructor
- * of this ConfirmationCallback.
+ * {@code options} array specified to the constructor
+ * of this {@code ConfirmationCallback}.
*
* @see #setSelectedIndex
*/
diff --git a/jdk/src/share/classes/javax/security/auth/callback/LanguageCallback.java b/jdk/src/share/classes/javax/security/auth/callback/LanguageCallback.java
index 8bcdb0900a8..007b8993420 100644
--- a/jdk/src/share/classes/javax/security/auth/callback/LanguageCallback.java
+++ b/jdk/src/share/classes/javax/security/auth/callback/LanguageCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -29,8 +29,8 @@ import java.util.Locale;
/**
*
Underlying security services instantiate and pass a
- * LanguageCallback to the handle
- * method of a CallbackHandler to retrieve the Locale
+ * {@code LanguageCallback} to the {@code handle}
+ * method of a {@code CallbackHandler} to retrieve the {@code Locale}
* used for localizing text.
*
* @see javax.security.auth.callback.CallbackHandler
@@ -46,16 +46,16 @@ public class LanguageCallback implements Callback, java.io.Serializable {
private Locale locale;
/**
- * Construct a LanguageCallback.
+ * Construct a {@code LanguageCallback}.
*/
public LanguageCallback() { }
/**
- * Set the retrieved Locale.
+ * Set the retrieved {@code Locale}.
*
*
*
- * @param locale the retrieved Locale.
+ * @param locale the retrieved {@code Locale}.
*
* @see #getLocale
*/
@@ -64,12 +64,12 @@ public class LanguageCallback implements Callback, java.io.Serializable {
}
/**
- * Get the retrieved Locale.
+ * Get the retrieved {@code Locale}.
*
*
*
- * @return the retrieved Locale, or null
- * if no Locale could be retrieved.
+ * @return the retrieved {@code Locale}, or null
+ * if no {@code Locale} could be retrieved.
*
* @see #setLocale
*/
diff --git a/jdk/src/share/classes/javax/security/auth/callback/NameCallback.java b/jdk/src/share/classes/javax/security/auth/callback/NameCallback.java
index b8e92c6c40a..3dd380dc57b 100644
--- a/jdk/src/share/classes/javax/security/auth/callback/NameCallback.java
+++ b/jdk/src/share/classes/javax/security/auth/callback/NameCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,8 +27,8 @@ package javax.security.auth.callback;
/**
*
Underlying security services instantiate and pass a
- * NameCallback to the handle
- * method of a CallbackHandler to retrieve name information.
+ * {@code NameCallback} to the {@code handle}
+ * method of a {@code CallbackHandler} to retrieve name information.
*
* @see javax.security.auth.callback.CallbackHandler
*/
@@ -53,14 +53,14 @@ public class NameCallback implements Callback, java.io.Serializable {
private String inputName;
/**
- * Construct a NameCallback with a prompt.
+ * Construct a {@code NameCallback} with a prompt.
*
*
*
* @param prompt the prompt used to request the name.
*
- * @exception IllegalArgumentException if prompt is null
- * or if prompt has a length of 0.
+ * @exception IllegalArgumentException if {@code prompt} is null
+ * or if {@code prompt} has a length of 0.
*/
public NameCallback(String prompt) {
if (prompt == null || prompt.length() == 0)
@@ -69,7 +69,7 @@ public class NameCallback implements Callback, java.io.Serializable {
}
/**
- * Construct a NameCallback with a prompt
+ * Construct a {@code NameCallback} with a prompt
* and default name.
*
*
@@ -79,10 +79,10 @@ public class NameCallback implements Callback, java.io.Serializable {
* @param defaultName the name to be used as the default name displayed
* with the prompt.
*
- * @exception IllegalArgumentException if prompt is null,
- * if prompt has a length of 0,
- * if defaultName is null,
- * or if defaultName has a length of 0.
+ * @exception IllegalArgumentException if {@code prompt} is null,
+ * if {@code prompt} has a length of 0,
+ * if {@code defaultName} is null,
+ * or if {@code defaultName} has a length of 0.
*/
public NameCallback(String prompt, String defaultName) {
if (prompt == null || prompt.length() == 0 ||
@@ -109,8 +109,8 @@ public class NameCallback implements Callback, java.io.Serializable {
*
*
*
- * @return the default name, or null if this NameCallback
- * was not instantiated with a defaultName.
+ * @return the default name, or null if this {@code NameCallback}
+ * was not instantiated with a {@code defaultName}.
*/
public String getDefaultName() {
return defaultName;
diff --git a/jdk/src/share/classes/javax/security/auth/callback/PasswordCallback.java b/jdk/src/share/classes/javax/security/auth/callback/PasswordCallback.java
index d0407403365..0e8fb7bd794 100644
--- a/jdk/src/share/classes/javax/security/auth/callback/PasswordCallback.java
+++ b/jdk/src/share/classes/javax/security/auth/callback/PasswordCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,8 +27,8 @@ package javax.security.auth.callback;
/**
*
Underlying security services instantiate and pass a
- * PasswordCallback to the handle
- * method of a CallbackHandler to retrieve password information.
+ * {@code PasswordCallback} to the {@code handle}
+ * method of a {@code CallbackHandler} to retrieve password information.
*
* @see javax.security.auth.callback.CallbackHandler
*/
@@ -53,7 +53,7 @@ public class PasswordCallback implements Callback, java.io.Serializable {
private char[] inputPassword;
/**
- * Construct a PasswordCallback with a prompt
+ * Construct a {@code PasswordCallback} with a prompt
* and a boolean specifying whether the password should be displayed
* as it is being typed.
*
@@ -64,8 +64,8 @@ public class PasswordCallback implements Callback, java.io.Serializable {
* @param echoOn true if the password should be displayed
* as it is being typed.
*
- * @exception IllegalArgumentException if prompt is null or
- * if prompt has a length of 0.
+ * @exception IllegalArgumentException if {@code prompt} is null or
+ * if {@code prompt} has a length of 0.
*/
public PasswordCallback(String prompt, boolean echoOn) {
if (prompt == null || prompt.length() == 0)
diff --git a/jdk/src/share/classes/javax/security/auth/callback/TextInputCallback.java b/jdk/src/share/classes/javax/security/auth/callback/TextInputCallback.java
index a611beae8e4..eb4e81eac51 100644
--- a/jdk/src/share/classes/javax/security/auth/callback/TextInputCallback.java
+++ b/jdk/src/share/classes/javax/security/auth/callback/TextInputCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,8 +27,8 @@ package javax.security.auth.callback;
/**
*
Underlying security services instantiate and pass a
- * TextInputCallback to the handle
- * method of a CallbackHandler to retrieve generic text
+ * {@code TextInputCallback} to the {@code handle}
+ * method of a {@code CallbackHandler} to retrieve generic text
* information.
*
* @see javax.security.auth.callback.CallbackHandler
@@ -54,14 +54,14 @@ public class TextInputCallback implements Callback, java.io.Serializable {
private String inputText;
/**
- * Construct a TextInputCallback with a prompt.
+ * Construct a {@code TextInputCallback} with a prompt.
*
*
*
* @param prompt the prompt used to request the information.
*
- * @exception IllegalArgumentException if prompt is null
- * or if prompt has a length of 0.
+ * @exception IllegalArgumentException if {@code prompt} is null
+ * or if {@code prompt} has a length of 0.
*/
public TextInputCallback(String prompt) {
if (prompt == null || prompt.length() == 0)
@@ -70,7 +70,7 @@ public class TextInputCallback implements Callback, java.io.Serializable {
}
/**
- * Construct a TextInputCallback with a prompt
+ * Construct a {@code TextInputCallback} with a prompt
* and default input value.
*
*
@@ -80,10 +80,10 @@ public class TextInputCallback implements Callback, java.io.Serializable {
* @param defaultText the text to be used as the default text displayed
* with the prompt.
*
- * @exception IllegalArgumentException if prompt is null,
- * if prompt has a length of 0,
- * if defaultText is null
- * or if defaultText has a length of 0.
+ * @exception IllegalArgumentException if {@code prompt} is null,
+ * if {@code prompt} has a length of 0,
+ * if {@code defaultText} is null
+ * or if {@code defaultText} has a length of 0.
*/
public TextInputCallback(String prompt, String defaultText) {
if (prompt == null || prompt.length() == 0 ||
@@ -110,8 +110,8 @@ public class TextInputCallback implements Callback, java.io.Serializable {
*
*
*
- * @return the default text, or null if this TextInputCallback
- * was not instantiated with defaultText.
+ * @return the default text, or null if this {@code TextInputCallback}
+ * was not instantiated with {@code defaultText}.
*/
public String getDefaultText() {
return defaultText;
diff --git a/jdk/src/share/classes/javax/security/auth/callback/TextOutputCallback.java b/jdk/src/share/classes/javax/security/auth/callback/TextOutputCallback.java
index f8bc4605d71..f83295574c2 100644
--- a/jdk/src/share/classes/javax/security/auth/callback/TextOutputCallback.java
+++ b/jdk/src/share/classes/javax/security/auth/callback/TextOutputCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,8 +27,8 @@ package javax.security.auth.callback;
/**
*
Underlying security services instantiate and pass a
- * TextOutputCallback to the handle
- * method of a CallbackHandler to display information messages,
+ * {@code TextOutputCallback} to the {@code handle}
+ * method of a {@code CallbackHandler} to display information messages,
* warning messages and error messages.
*
* @see javax.security.auth.callback.CallbackHandler
@@ -61,16 +61,16 @@ public class TextOutputCallback implements Callback, java.io.Serializable {
*
*
*
- * @param messageType the message type (INFORMATION,
- * WARNING or ERROR).
+ * @param messageType the message type ({@code INFORMATION},
+ * {@code WARNING} or {@code ERROR}).
*
* @param message the message to be displayed.
*
- * @exception IllegalArgumentException if messageType
- * is not either INFORMATION,
- * WARNING or ERROR,
- * if message is null,
- * or if message has a length of 0.
+ * @exception IllegalArgumentException if {@code messageType}
+ * is not either {@code INFORMATION},
+ * {@code WARNING} or {@code ERROR},
+ * if {@code message} is null,
+ * or if {@code message} has a length of 0.
*/
public TextOutputCallback(int messageType, String message) {
if ((messageType != INFORMATION &&
@@ -87,8 +87,8 @@ public class TextOutputCallback implements Callback, java.io.Serializable {
*
*
*
- * @return the message type (INFORMATION,
- * WARNING or ERROR).
+ * @return the message type ({@code INFORMATION},
+ * {@code WARNING} or {@code ERROR}).
*/
public int getMessageType() {
return messageType;
diff --git a/jdk/src/share/classes/javax/security/auth/callback/UnsupportedCallbackException.java b/jdk/src/share/classes/javax/security/auth/callback/UnsupportedCallbackException.java
index cb9b66b0000..0a9fa5120b1 100644
--- a/jdk/src/share/classes/javax/security/auth/callback/UnsupportedCallbackException.java
+++ b/jdk/src/share/classes/javax/security/auth/callback/UnsupportedCallbackException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,8 +26,8 @@
package javax.security.auth.callback;
/**
- * Signals that a CallbackHandler does not
- * recognize a particular Callback.
+ * Signals that a {@code CallbackHandler} does not
+ * recognize a particular {@code Callback}.
*
*/
public class UnsupportedCallbackException extends Exception {
@@ -40,12 +40,12 @@ public class UnsupportedCallbackException extends Exception {
private Callback callback;
/**
- * Constructs a UnsupportedCallbackException
+ * Constructs a {@code UnsupportedCallbackException}
* with no detail message.
*
*
*
- * @param callback the unrecognized Callback.
+ * @param callback the unrecognized {@code Callback}.
*/
public UnsupportedCallbackException(Callback callback) {
super();
@@ -59,7 +59,7 @@ public class UnsupportedCallbackException extends Exception {
*
*
*
- * @param callback the unrecognized Callback.
+ * @param callback the unrecognized {@code Callback}.
*
* @param msg the detail message.
*/
@@ -69,11 +69,11 @@ public class UnsupportedCallbackException extends Exception {
}
/**
- * Get the unrecognized Callback.
+ * Get the unrecognized {@code Callback}.
*
*
*
- * @return the unrecognized Callback.
+ * @return the unrecognized {@code Callback}.
*/
public Callback getCallback() {
return callback;
diff --git a/jdk/src/share/classes/javax/security/auth/callback/package-info.java b/jdk/src/share/classes/javax/security/auth/callback/package-info.java
new file mode 100644
index 00000000000..4cd5daf621e
--- /dev/null
+++ b/jdk/src/share/classes/javax/security/auth/callback/package-info.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2000, 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.
+ */
+
+/**
+ * This package provides the classes necessary for services
+ * to interact with applications in order to retrieve
+ * information (authentication data including usernames
+ * or passwords, for example) or to display information
+ * (error and warning messages, for example).
+ *
+ * @since JDK1.4
+ */
+package javax.security.auth.callback;
diff --git a/jdk/src/share/classes/javax/security/auth/callback/package.html b/jdk/src/share/classes/javax/security/auth/callback/package.html
deleted file mode 100644
index 66d58e4f055..00000000000
--- a/jdk/src/share/classes/javax/security/auth/callback/package.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
-
-
- This package provides the classes necessary for services
- to interact with applications in order to retrieve
- information (authentication data including usernames
- or passwords, for example) or to display information
- (error and warning messages, for example).
-
-
-
-@since JDK1.4
-
-
diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java b/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java
index 689175acd48..77aabb8b9d6 100644
--- a/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/DelegationPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -38,7 +38,7 @@ import java.io.IOException;
* This class is used to restrict the usage of the Kerberos
* delegation model, ie: forwardable and proxiable tickets.
*
- * The target name of this Permission specifies a pair of
+ * The target name of this {@code Permission} specifies a pair of
* kerberos service principals. The first is the subordinate service principal
* being entrusted to use the TGT. The second service principal designates
* the target service the subordinate service principal is to
@@ -71,15 +71,15 @@ public final class DelegationPermission extends BasicPermission
private transient String subordinate, service;
/**
- * Create a new DelegationPermission
+ * Create a new {@code DelegationPermission}
* with the specified subordinate and target principals.
*
*
*
* @param principals the name of the subordinate and target principals
*
- * @throws NullPointerException if principals is null.
- * @throws IllegalArgumentException if principals is empty.
+ * @throws NullPointerException if {@code principals} is {@code null}.
+ * @throws IllegalArgumentException if {@code principals} is empty.
*/
public DelegationPermission(String principals) {
super(principals);
@@ -87,7 +87,7 @@ public final class DelegationPermission extends BasicPermission
}
/**
- * Create a new DelegationPermission
+ * Create a new {@code DelegationPermission}
* with the specified subordinate and target principals.
*
*
@@ -95,8 +95,8 @@ public final class DelegationPermission extends BasicPermission
*
* @param actions should be null.
*
- * @throws NullPointerException if principals is null.
- * @throws IllegalArgumentException if principals is empty.
+ * @throws NullPointerException if {@code principals} is {@code null}.
+ * @throws IllegalArgumentException if {@code principals} is empty.
*/
public DelegationPermission(String principals, String actions) {
super(principals, actions);
@@ -134,7 +134,7 @@ public final class DelegationPermission extends BasicPermission
* Checks if this Kerberos delegation permission object "implies" the
* specified permission.
*
- * If none of the above are true, implies returns false.
+ * If none of the above are true, {@code implies} returns false.
* @param p the permission to check against.
*
* @return true if the specified permission is implied by this object,
diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java
index ba530f9583c..5c8b65f2703 100644
--- a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -76,7 +76,7 @@ public class KerberosKey implements SecretKey, Destroyable {
private int versionNum;
/**
- * KeyImpl is serialized by writing out the ASN1 Encoded bytes
+ * {@code KeyImpl} is serialized by writing out the ASN1 Encoded bytes
* of the encryption key.
* The ASN1 encoding is defined in RFC4120 and as follows:
*
@@ -241,7 +241,7 @@ public class KerberosKey implements SecretKey, Destroyable {
/**
* Returns a hashcode for this KerberosKey.
*
- * @return a hashCode() for the KerberosKey
+ * @return a hashCode() for the {@code KerberosKey}
* @since 1.6
*/
public int hashCode() {
@@ -260,8 +260,8 @@ public class KerberosKey implements SecretKey, Destroyable {
/**
* Compares the specified Object with this KerberosKey for equality.
* Returns true if the given object is also a
- * KerberosKey and the two
- * KerberosKey instances are equivalent.
+ * {@code KerberosKey} and the two
+ * {@code KerberosKey} instances are equivalent.
*
* @param other the Object to compare to
* @return true if the specified object is equal to this KerberosKey,
diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java
index fac9097500d..6962f2a43d3 100644
--- a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -181,11 +181,11 @@ public final class KerberosPrincipal
/**
* Returns a hashcode for this principal. The hash code is defined to
* be the result of the following calculation:
- *
+ *
{@code
* hashCode = getName().hashCode();
- *
+ * }
*
- * @return a hashCode() for the KerberosPrincipal
+ * @return a hashCode() for the {@code KerberosPrincipal}
*/
public int hashCode() {
return getName().hashCode();
@@ -194,11 +194,11 @@ public final class KerberosPrincipal
/**
* Compares the specified Object with this Principal for equality.
* Returns true if the given object is also a
- * KerberosPrincipal and the two
- * KerberosPrincipal instances are equivalent.
- * More formally two KerberosPrincipal instances are equal
- * if the values returned by getName() are equal and the
- * values returned by getNameType() are equal.
+ * {@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 and the
+ * values returned by {@code getNameType()} are equal.
*
* @param other the Object to compare to
* @return true if the Object passed in represents the same principal
@@ -225,7 +225,7 @@ public final class KerberosPrincipal
/**
* Save the KerberosPrincipal object to a stream
*
- * @serialData this KerberosPrincipal is serialized
+ * @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
* RFC4120.
diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java
index e7e4821bd69..c9e2b283e98 100644
--- a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -103,7 +103,7 @@ public class KerberosTicket implements Destroyable, Refreshable,
private byte[] asn1Encoding;
/**
- *KeyImpl is serialized by writing out the ASN1 Encoded bytes
+ *{@code KeyImpl} is serialized by writing out the ASN1 Encoded bytes
* of the encryption key. The ASN1 encoding is defined in RFC4120 and as
* follows:
*
@@ -667,7 +667,7 @@ public class KerberosTicket implements Destroyable, Refreshable,
/**
* Returns a hashcode for this KerberosTicket.
*
- * @return a hashCode() for the KerberosTicket
+ * @return a hashCode() for the {@code KerberosTicket}
* @since 1.6
*/
public int hashCode() {
@@ -704,8 +704,8 @@ public class KerberosTicket implements Destroyable, Refreshable,
/**
* Compares the specified Object with this KerberosTicket for equality.
* Returns true if the given object is also a
- * KerberosTicket and the two
- * KerberosTicket instances are equivalent.
+ * {@code KerberosTicket} and the two
+ * {@code KerberosTicket} instances are equivalent.
*
* @param other the Object to compare to
* @return true if the specified object is equal to this KerberosTicket,
diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java b/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java
index 9755cb0a738..f4ee947212b 100644
--- a/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/KeyImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -166,7 +166,7 @@ class KeyImpl implements SecretKey, Destroyable, Serializable {
}
/**
- * @serialData this KeyImpl is serialized by
+ * @serialData this {@code KeyImpl} is serialized by
* writing out the ASN1 Encoded bytes of the encryption key.
* The ASN1 encoding is defined in RFC4120 and as follows:
* EncryptionKey ::= SEQUENCE {
diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java b/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java
index 32f644b5906..631b7d02275 100644
--- a/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -312,7 +312,7 @@ public final class KeyTab {
/**
* Returns a hashcode for this KeyTab.
*
- * @return a hashCode() for the KeyTab
+ * @return a hashCode() for the {@code KeyTab}
*/
public int hashCode() {
return Objects.hash(file, princ, bound);
@@ -321,8 +321,8 @@ public final class KeyTab {
/**
* Compares the specified Object with this KeyTab for equality.
* Returns true if the given object is also a
- * KeyTab and the two
- * KeyTab instances are equivalent.
+ * {@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
diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java b/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java
index 43296586f68..50a0517fa44 100644
--- a/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/ServicePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -50,7 +50,7 @@ import java.io.IOException;
* used within.
*
* The service principal name is the canonical name of the
- * KereberosPrincipal supplying the service, that is
+ * {@code KereberosPrincipal} supplying the service, that is
* the KerberosPrincipal represents a Kerberos service
* principal. This name is treated in a case sensitive manner.
* An asterisk may appear by itself, to signify any service principal.
@@ -135,9 +135,9 @@ public final class ServicePermission extends Permission
// created and re-used in the getAction function.
/**
- * Create a new ServicePermission
- * with the specified servicePrincipal
- * and action.
+ * Create a new {@code ServicePermission}
+ * with the specified {@code servicePrincipal}
+ * and {@code action}.
*
* @param servicePrincipal the name of the service principal.
* An asterisk may appear by itself, to signify any service principal.
@@ -169,7 +169,7 @@ public final class ServicePermission extends Permission
* Checks if this Kerberos service permission object "implies" the
* specified permission.
*
- * If none of the above are true, implies returns false.
+ * If none of the above are true, {@code implies} returns false.
* @param p the permission to check against.
*
* @return true if the specified permission is implied by this object,
diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/package-info.java b/jdk/src/share/classes/javax/security/auth/kerberos/package-info.java
new file mode 100644
index 00000000000..293745479d8
--- /dev/null
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/package-info.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2001, 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.
+ */
+
+/**
+ * This package contains utility classes related to the Kerberos network
+ * authentication protocol. They do not provide much Kerberos support
+ * themselves.
+ *
+ * The Kerberos network authentication protocol is defined in
+ * RFC 4120. The Java
+ * platform contains support for the client side of Kerberos via the
+ * {@link org.ietf.jgss} package. There might also be
+ * a login module that implements
+ * {@link javax.security.auth.spi.LoginModule LoginModule} to authenticate
+ * Kerberos principals.
+ *
+ * You can provide the name of your default realm and Key Distribution
+ * Center (KDC) host for that realm using the system properties
+ * {@code java.security.krb5.realm} and {@code java.security.krb5.kdc}.
+ * Both properties must be set.
+ * Alternatively, the {@code java.security.krb5.conf} system property can
+ * be set to the location of an MIT style {@code krb5.conf} configuration
+ * file. If none of these system properties are set, the {@code krb5.conf}
+ * file is searched for in an implementation-specific manner. Typically,
+ * an implementation will first look for a {@code krb5.conf} file in
+ * {@code /lib/security} and failing that, in an OS-specific
+ * location.
-
-
-
-
-
- This package contains utility classes related to the Kerberos network
- authentication protocol. They do not provide much Kerberos support
- themselves.
-
- The Kerberos network authentication protocol is defined in
- RFC 4120. The Java
- platform contains support for the client side of Kerberos via the
- {@link org.ietf.jgss} package. There might also be
- a login module that implements
- {@link javax.security.auth.spi.LoginModule LoginModule} to authenticate
- Kerberos principals.
-
- You can provide the name of your default realm and Key Distribution
- Center (KDC) host for that realm using the system properties
- {@code java.security.krb5.realm} and {@code java.security.krb5.kdc}.
- Both properties must be set.
- Alternatively, the {@code java.security.krb5.conf} system property can
- be set to the location of an MIT style {@code krb5.conf} configuration
- file. If none of these system properties are set, the {@code krb5.conf}
- file is searched for in an implementation-specific manner. Typically,
- an implementation will first look for a {@code krb5.conf} file in
- {@code /lib/security} and failing that, in an OS-specific
- location.
-
-
-@since JDK1.4
-
-
diff --git a/jdk/src/share/classes/javax/security/auth/login/AccountExpiredException.java b/jdk/src/share/classes/javax/security/auth/login/AccountExpiredException.java
index 40e8a138c85..e55536da025 100644
--- a/jdk/src/share/classes/javax/security/auth/login/AccountExpiredException.java
+++ b/jdk/src/share/classes/javax/security/auth/login/AccountExpiredException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -29,9 +29,9 @@ package javax.security.auth.login;
* Signals that a user account has expired.
*
*
This exception is thrown by LoginModules when they determine
- * that an account has expired. For example, a LoginModule,
+ * that an account has expired. For example, a {@code LoginModule},
* after successfully authenticating a user, may determine that the
- * user's account has expired. In this case the LoginModule
+ * user's account has expired. In this case the {@code LoginModule}
* throws this exception to notify the application. The application can
* then take the appropriate steps to notify the user.
*
diff --git a/jdk/src/share/classes/javax/security/auth/login/AppConfigurationEntry.java b/jdk/src/share/classes/javax/security/auth/login/AppConfigurationEntry.java
index 7c70d580cb9..05374db2e95 100644
--- a/jdk/src/share/classes/javax/security/auth/login/AppConfigurationEntry.java
+++ b/jdk/src/share/classes/javax/security/auth/login/AppConfigurationEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -29,14 +29,14 @@ import java.util.Map;
import java.util.Collections;
/**
- * This class represents a single LoginModule entry
+ * This class represents a single {@code LoginModule} entry
* configured for the application specified in the
- * getAppConfigurationEntry(String appName)
- * method in the Configuration class. Each respective
- * AppConfigurationEntry contains a LoginModule name,
- * a control flag (specifying whether this LoginModule is
+ * {@code getAppConfigurationEntry(String appName)}
+ * method in the {@code Configuration} class. Each respective
+ * {@code AppConfigurationEntry} contains a {@code LoginModule} name,
+ * a control flag (specifying whether this {@code LoginModule} is
* REQUIRED, REQUISITE, SUFFICIENT, or OPTIONAL), and LoginModule-specific
- * options. Please refer to the Configuration class for
+ * options. Please refer to the {@code Configuration} class for
* more information on the different control flags and their semantics.
*
* @see javax.security.auth.login.Configuration
@@ -50,25 +50,25 @@ public class AppConfigurationEntry {
/**
* Default constructor for this class.
*
- *
This entry represents a single LoginModule
+ *
This entry represents a single {@code LoginModule}
* entry configured for the application specified in the
- * getAppConfigurationEntry(String appName)
- * method from the Configuration class.
+ * {@code getAppConfigurationEntry(String appName)}
+ * method from the {@code Configuration} class.
*
* @param loginModuleName String representing the class name of the
- * LoginModule configured for the
+ * {@code LoginModule} configured for the
* specified application.
*
* @param controlFlag either REQUIRED, REQUISITE, SUFFICIENT,
* or OPTIONAL.
*
- * @param options the options configured for this LoginModule.
+ * @param options the options configured for this {@code LoginModule}.
*
- * @exception IllegalArgumentException if loginModuleName
- * is null, if LoginModuleName
- * has a length of 0, if controlFlag
+ * @exception IllegalArgumentException if {@code loginModuleName}
+ * is null, if {@code LoginModuleName}
+ * has a length of 0, if {@code controlFlag}
* is not either REQUIRED, REQUISITE, SUFFICIENT
- * or OPTIONAL, or if options is null.
+ * or OPTIONAL, or if {@code options} is null.
*/
public AppConfigurationEntry(String loginModuleName,
LoginModuleControlFlag controlFlag,
@@ -88,9 +88,9 @@ public class AppConfigurationEntry {
}
/**
- * Get the class name of the configured LoginModule.
+ * Get the class name of the configured {@code LoginModule}.
*
- * @return the class name of the configured LoginModule as
+ * @return the class name of the configured {@code LoginModule} as
* a String.
*/
public String getLoginModuleName() {
@@ -100,28 +100,28 @@ public class AppConfigurationEntry {
/**
* Return the controlFlag
* (either REQUIRED, REQUISITE, SUFFICIENT, or OPTIONAL)
- * for this LoginModule.
+ * for this {@code LoginModule}.
*
* @return the controlFlag
* (either REQUIRED, REQUISITE, SUFFICIENT, or OPTIONAL)
- * for this LoginModule.
+ * for this {@code LoginModule}.
*/
public LoginModuleControlFlag getControlFlag() {
return controlFlag;
}
/**
- * Get the options configured for this LoginModule.
+ * Get the options configured for this {@code LoginModule}.
*
- * @return the options configured for this LoginModule
- * as an unmodifiable Map.
+ * @return the options configured for this {@code LoginModule}
+ * as an unmodifiable {@code Map}.
*/
public Map getOptions() {
return options;
}
/**
- * This class represents whether or not a LoginModule
+ * This class represents whether or not a {@code LoginModule}
* is REQUIRED, REQUISITE, SUFFICIENT or OPTIONAL.
*/
public static class LoginModuleControlFlag {
@@ -129,25 +129,25 @@ public class AppConfigurationEntry {
private String controlFlag;
/**
- * Required LoginModule.
+ * Required {@code LoginModule}.
*/
public static final LoginModuleControlFlag REQUIRED =
new LoginModuleControlFlag("required");
/**
- * Requisite LoginModule.
+ * Requisite {@code LoginModule}.
*/
public static final LoginModuleControlFlag REQUISITE =
new LoginModuleControlFlag("requisite");
/**
- * Sufficient LoginModule.
+ * Sufficient {@code LoginModule}.
*/
public static final LoginModuleControlFlag SUFFICIENT =
new LoginModuleControlFlag("sufficient");
/**
- * Optional LoginModule.
+ * Optional {@code LoginModule}.
*/
public static final LoginModuleControlFlag OPTIONAL =
new LoginModuleControlFlag("optional");
diff --git a/jdk/src/share/classes/javax/security/auth/login/Configuration.java b/jdk/src/share/classes/javax/security/auth/login/Configuration.java
index ddfdd0a2a03..ff10a3bbf14 100644
--- a/jdk/src/share/classes/javax/security/auth/login/Configuration.java
+++ b/jdk/src/share/classes/javax/security/auth/login/Configuration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -49,9 +49,9 @@ import sun.security.jca.GetInstance;
*
*
A login configuration contains the following information.
* Note that this example only represents the default syntax for the
- * Configuration. Subclass implementations of this class
+ * {@code Configuration}. Subclass implementations of this class
* may implement alternative syntaxes and may retrieve the
- * Configuration from any source such as files, databases,
+ * {@code Configuration} from any source such as files, databases,
* or servers.
*
*
Each entry in the Configuration is indexed via an
+ *
Each entry in the {@code Configuration} is indexed via an
* application name, Name, and contains a list of
- * LoginModules configured for that application. Each LoginModule
+ * LoginModules configured for that application. Each {@code LoginModule}
* is specified via its fully qualified class name.
* Authentication proceeds down the module list in the exact order specified.
* If an application does not have specific entry,
@@ -83,55 +83,55 @@ import sun.security.jca.GetInstance;
* valid values for Flag and their respective semantics:
*
*
- * 1) Required - The LoginModule is required to succeed.
+ * 1) Required - The {@code LoginModule} is required to succeed.
* If it succeeds or fails, authentication still continues
- * to proceed down the LoginModule list.
+ * to proceed down the {@code LoginModule} list.
*
- * 2) Requisite - The LoginModule is required to succeed.
+ * 2) Requisite - The {@code LoginModule} is required to succeed.
* If it succeeds, authentication continues down the
- * LoginModule list. If it fails,
+ * {@code LoginModule} list. If it fails,
* control immediately returns to the application
* (authentication does not proceed down the
- * LoginModule list).
+ * {@code LoginModule} list).
*
- * 3) Sufficient - The LoginModule is not required to
+ * 3) Sufficient - The {@code LoginModule} is not required to
* succeed. If it does succeed, control immediately
* returns to the application (authentication does not
- * proceed down the LoginModule list).
+ * proceed down the {@code LoginModule} list).
* If it fails, authentication continues down the
- * LoginModule list.
+ * {@code LoginModule} list.
*
- * 4) Optional - The LoginModule is not required to
+ * 4) Optional - The {@code LoginModule} is not required to
* succeed. If it succeeds or fails,
* authentication still continues to proceed down the
- * LoginModule list.
+ * {@code LoginModule} list.
*
*
*
The overall authentication succeeds only if all Required and
* Requisite LoginModules succeed. If a Sufficient
- * LoginModule is configured and succeeds,
+ * {@code LoginModule} is configured and succeeds,
* then only the Required and Requisite LoginModules prior to
- * that SufficientLoginModule need to have succeeded for
+ * that Sufficient {@code LoginModule} need to have succeeded for
* the overall authentication to succeed. If no Required or
* Requisite LoginModules are configured for an application,
* then at least one Sufficient or Optional
- * LoginModule must succeed.
+ * {@code LoginModule} must succeed.
*
*
ModuleOptions is a space separated list of
- * LoginModule-specific values which are passed directly to
+ * {@code LoginModule}-specific values which are passed directly to
* the underlying LoginModules. Options are defined by the
- * LoginModule itself, and control the behavior within it.
- * For example, a LoginModule may define options to support
+ * {@code LoginModule} itself, and control the behavior within it.
+ * For example, a {@code LoginModule} may define options to support
* debugging/testing capabilities. The correct way to specify options in the
- * Configuration is by using the following key-value pairing:
+ * {@code Configuration} is by using the following key-value pairing:
* debug="true". The key and value should be separated by an
* 'equals' symbol, and the value should be surrounded by double quotes.
* If a String in the form, ${system.property}, occurs in the value,
* it will be expanded to the value of the system property.
* Note that there is no limit to the number of
- * options a LoginModule may define.
+ * options a {@code LoginModule} may define.
*
- *
The following represents an example Configuration entry
+ *
The following represents an example {@code Configuration} entry
* based on the syntax above:
*
*
This Configuration specifies that an application named,
+ *
This {@code Configuration} specifies that an application named,
* "Login", requires users to first authenticate to the
* com.sun.security.auth.module.UnixLoginModule, which is
* required to succeed. Even if the UnixLoginModule
@@ -165,11 +165,11 @@ import sun.security.jca.GetInstance;
*
*
There is only one Configuration object installed in the runtime at any
* given time. A Configuration object can be installed by calling the
- * setConfiguration method. The installed Configuration object
- * can be obtained by calling the getConfiguration method.
+ * {@code setConfiguration} method. The installed Configuration object
+ * can be obtained by calling the {@code getConfiguration} method.
*
*
If no Configuration object has been installed in the runtime, a call to
- * getConfiguration installs an instance of the default
+ * {@code getConfiguration} installs an instance of the default
* Configuration implementation (a default subclass implementation of this
* abstract class).
* The default Configuration implementation can be changed by setting the value
@@ -178,7 +178,7 @@ import sun.security.jca.GetInstance;
*
*
Application code can directly subclass Configuration to provide a custom
* implementation. In addition, an instance of a Configuration object can be
- * constructed by invoking one of the getInstance factory methods
+ * constructed by invoking one of the {@code getInstance} factory methods
* with a standard type. The default policy type is "JavaLoginConfig".
* See the Configuration section in the
@@ -222,7 +222,7 @@ public abstract class Configuration {
*
-
-
-
-@since 1.4
-
-
diff --git a/jdk/src/share/classes/javax/security/auth/package-info.java b/jdk/src/share/classes/javax/security/auth/package-info.java
new file mode 100644
index 00000000000..b4ac0827d22
--- /dev/null
+++ b/jdk/src/share/classes/javax/security/auth/package-info.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2000, 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.
+ */
+
+/**
+ * This package provides a framework for authentication and
+ * authorization. The framework allows
+ * authentication to be performed in pluggable fashion. Different
+ * authentication modules can be plugged under an application without
+ * requiring modifications to the application itself. The
+ * authorization component allows specification of access controls
+ * based on code location, code signers and code executors
+ * (Subjects).
+ *
+ * @since JDK1.4
+ */
+package javax.security.auth;
diff --git a/jdk/src/share/classes/javax/security/auth/package.html b/jdk/src/share/classes/javax/security/auth/package.html
deleted file mode 100644
index dc8801f35ef..00000000000
--- a/jdk/src/share/classes/javax/security/auth/package.html
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
- This package provides a framework for authentication and
- authorization. The framework allows
- authentication to be performed in pluggable fashion. Different
- authentication modules can be plugged under an application without
- requiring modifications to the application itself. The
- authorization component allows specification of access controls
- based on code location, code signers and code executors
- (Subjects).
-
-
-
-
-@since JDK1.4
-
-
diff --git a/jdk/src/share/classes/javax/security/auth/spi/LoginModule.java b/jdk/src/share/classes/javax/security/auth/spi/LoginModule.java
index e8074973382..37b99086120 100644
--- a/jdk/src/share/classes/javax/security/auth/spi/LoginModule.java
+++ b/jdk/src/share/classes/javax/security/auth/spi/LoginModule.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -32,95 +32,95 @@ import javax.security.auth.login.*;
import java.util.Map;
/**
- *
LoginModule describes the interface
+ *
{@code LoginModule} describes the interface
* implemented by authentication technology providers. LoginModules
* are plugged in under applications to provide a particular type of
* authentication.
*
- *
While applications write to the LoginContext API,
+ *
While applications write to the {@code LoginContext} API,
* authentication technology providers implement the
- * LoginModule interface.
- * A Configuration specifies the LoginModule(s)
+ * {@code LoginModule} interface.
+ * A {@code Configuration} specifies the LoginModule(s)
* to be used with a particular login application. Therefore different
* LoginModules can be plugged in under the application without
* requiring any modifications to the application itself.
*
- *
The LoginContext is responsible for reading the
- * Configuration and instantiating the appropriate
- * LoginModules. Each LoginModule is initialized with
- * a Subject, a CallbackHandler, shared
- * LoginModule state, and LoginModule-specific options.
+ *
The {@code LoginContext} is responsible for reading the
+ * {@code Configuration} and instantiating the appropriate
+ * LoginModules. Each {@code LoginModule} is initialized with
+ * a {@code Subject}, a {@code CallbackHandler}, shared
+ * {@code LoginModule} state, and LoginModule-specific options.
*
- * The Subject represents the
- * Subject currently being authenticated and is updated
+ * The {@code Subject} represents the
+ * {@code Subject} currently being authenticated and is updated
* with relevant Credentials if authentication succeeds.
- * LoginModules use the CallbackHandler to
- * communicate with users. The CallbackHandler may be
+ * LoginModules use the {@code CallbackHandler} to
+ * communicate with users. The {@code CallbackHandler} may be
* used to prompt for usernames and passwords, for example.
- * Note that the CallbackHandler may be null. LoginModules
- * which absolutely require a CallbackHandler to authenticate
- * the Subject may throw a LoginException.
+ * Note that the {@code CallbackHandler} may be null. LoginModules
+ * which absolutely require a {@code CallbackHandler} to authenticate
+ * the {@code Subject} may throw a {@code LoginException}.
* LoginModules optionally use the shared state to share information
* or data among themselves.
*
*
The LoginModule-specific options represent the options
- * configured for this LoginModule by an administrator or user
- * in the login Configuration.
- * The options are defined by the LoginModule itself
+ * configured for this {@code LoginModule} by an administrator or user
+ * in the login {@code Configuration}.
+ * The options are defined by the {@code LoginModule} itself
* and control the behavior within it. For example, a
- * LoginModule may define options to support debugging/testing
+ * {@code LoginModule} may define options to support debugging/testing
* capabilities. Options are defined using a key-value syntax,
- * such as debug=true. The LoginModule
- * stores the options as a Map so that the values may
+ * such as debug=true. The {@code LoginModule}
+ * stores the options as a {@code Map} so that the values may
* be retrieved using the key. Note that there is no limit to the number
- * of options a LoginModule chooses to define.
+ * of options a {@code LoginModule} chooses to define.
*
*
The calling application sees the authentication process as a single
* operation. However, the authentication process within the
- * LoginModule proceeds in two distinct phases.
+ * {@code LoginModule} proceeds in two distinct phases.
* In the first phase, the LoginModule's
- * login method gets invoked by the LoginContext's
- * login method. The login
- * method for the LoginModule then performs
+ * {@code login} method gets invoked by the LoginContext's
+ * {@code login} method. The {@code login}
+ * method for the {@code LoginModule} then performs
* the actual authentication (prompt for and verify a password for example)
* and saves its authentication status as private state
- * information. Once finished, the LoginModule's login
- * method either returns true (if it succeeded) or
- * false (if it should be ignored), or throws a
- * LoginException to specify a failure.
- * In the failure case, the LoginModule must not retry the
+ * information. Once finished, the LoginModule's {@code login}
+ * method either returns {@code true} (if it succeeded) or
+ * {@code false} (if it should be ignored), or throws a
+ * {@code LoginException} to specify a failure.
+ * In the failure case, the {@code LoginModule} must not retry the
* authentication or introduce delays. The responsibility of such tasks
* belongs to the application. If the application attempts to retry
- * the authentication, the LoginModule's login method will be
+ * the authentication, the LoginModule's {@code login} method will be
* called again.
*
*
In the second phase, if the LoginContext's overall authentication
* succeeded (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL
- * LoginModules succeeded), then the commit
- * method for the LoginModule gets invoked.
- * The commit method for a LoginModule checks its
+ * LoginModules succeeded), then the {@code commit}
+ * method for the {@code LoginModule} gets invoked.
+ * The {@code commit} method for a {@code LoginModule} checks its
* privately saved state to see if its own authentication succeeded.
- * If the overall LoginContext authentication succeeded
+ * If the overall {@code LoginContext} authentication succeeded
* and the LoginModule's own authentication succeeded, then the
- * commit method associates the relevant
+ * {@code commit} method associates the relevant
* Principals (authenticated identities) and Credentials (authentication data
- * such as cryptographic keys) with the Subject
- * located within the LoginModule.
+ * such as cryptographic keys) with the {@code Subject}
+ * located within the {@code LoginModule}.
*
*
If the LoginContext's overall authentication failed (the relevant
* REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules did not succeed),
- * then the abort method for each LoginModule
- * gets invoked. In this case, the LoginModule removes/destroys
+ * then the {@code abort} method for each {@code LoginModule}
+ * gets invoked. In this case, the {@code LoginModule} removes/destroys
* any authentication state originally saved.
*
- *
Logging out a Subject involves only one phase.
- * The LoginContext invokes the LoginModule's logout
- * method. The logout method for the LoginModule
+ *
Logging out a {@code Subject} involves only one phase.
+ * The {@code LoginContext} invokes the LoginModule's {@code logout}
+ * method. The {@code logout} method for the {@code LoginModule}
* then performs the logout procedures, such as removing Principals or
- * Credentials from the Subject or logging session information.
+ * Credentials from the {@code Subject} or logging session information.
*
- *
A LoginModule implementation must have a constructor with
- * no arguments. This allows classes which load the LoginModule
+ *
A {@code LoginModule} implementation must have a constructor with
+ * no arguments. This allows classes which load the {@code LoginModule}
* to instantiate it.
*
* @see javax.security.auth.login.LoginContext
@@ -131,38 +131,38 @@ public interface LoginModule {
/**
* Initialize this LoginModule.
*
- *
This method is called by the LoginContext
- * after this LoginModule has been instantiated.
+ *
This method is called by the {@code LoginContext}
+ * after this {@code LoginModule} has been instantiated.
* The purpose of this method is to initialize this
- * LoginModule with the relevant information.
- * If this LoginModule does not understand
- * any of the data stored in sharedState or
- * options parameters, they can be ignored.
+ * {@code LoginModule} with the relevant information.
+ * If this {@code LoginModule} does not understand
+ * any of the data stored in {@code sharedState} or
+ * {@code options} parameters, they can be ignored.
*
*
*
- * @param subject the Subject to be authenticated.
+ * @param subject the {@code Subject} to be authenticated.
*
- * @param callbackHandler a CallbackHandler for communicating
+ * @param callbackHandler a {@code CallbackHandler} for communicating
* with the end user (prompting for usernames and
* passwords, for example).
*
* @param sharedState state shared with other configured LoginModules.
*
* @param options options specified in the login
- * Configuration for this particular
- * LoginModule.
+ * {@code Configuration} for this particular
+ * {@code LoginModule}.
*/
void initialize(Subject subject, CallbackHandler callbackHandler,
Map sharedState,
Map options);
/**
- * Method to authenticate a Subject (phase 1).
+ * Method to authenticate a {@code Subject} (phase 1).
*
*
The implementation of this method authenticates
- * a Subject. For example, it may prompt for
- * Subject information such
+ * a {@code Subject}. For example, it may prompt for
+ * {@code Subject} information such
* as a username and password and then attempt to verify the password.
* This method saves the result of the authentication attempt
* as private state within the LoginModule.
@@ -172,7 +172,7 @@ public interface LoginModule {
* @exception LoginException if the authentication fails
*
* @return true if the authentication succeeded, or false if this
- * LoginModule should be ignored.
+ * {@code LoginModule} should be ignored.
*/
boolean login() throws LoginException;
@@ -186,9 +186,9 @@ public interface LoginModule {
*
*
If this LoginModule's own authentication attempt
* succeeded (checked by retrieving the private state saved by the
- * login method), then this method associates relevant
- * Principals and Credentials with the Subject located in the
- * LoginModule. If this LoginModule's own
+ * {@code login} method), then this method associates relevant
+ * Principals and Credentials with the {@code Subject} located in the
+ * {@code LoginModule}. If this LoginModule's own
* authentication attempted failed, then this method removes/destroys
* any state that was originally saved.
*
@@ -197,7 +197,7 @@ public interface LoginModule {
* @exception LoginException if the commit fails
*
* @return true if this method succeeded, or false if this
- * LoginModule should be ignored.
+ * {@code LoginModule} should be ignored.
*/
boolean commit() throws LoginException;
@@ -211,7 +211,7 @@ public interface LoginModule {
*
*
If this LoginModule's own authentication attempt
* succeeded (checked by retrieving the private state saved by the
- * login method), then this method cleans up any state
+ * {@code login} method), then this method cleans up any state
* that was originally saved.
*
*
@@ -219,12 +219,12 @@ public interface LoginModule {
* @exception LoginException if the abort fails
*
* @return true if this method succeeded, or false if this
- * LoginModule should be ignored.
+ * {@code LoginModule} should be ignored.
*/
boolean abort() throws LoginException;
/**
- * Method which logs out a Subject.
+ * Method which logs out a {@code Subject}.
*
*
An implementation of this method might remove/destroy a Subject's
* Principals and Credentials.
@@ -234,7 +234,7 @@ public interface LoginModule {
* @exception LoginException if the logout fails
*
* @return true if this method succeeded, or false if this
- * LoginModule should be ignored.
+ * {@code LoginModule} should be ignored.
*/
boolean logout() throws LoginException;
}
diff --git a/jdk/src/share/classes/javax/security/auth/spi/package-info.java b/jdk/src/share/classes/javax/security/auth/spi/package-info.java
new file mode 100644
index 00000000000..da7cbcb8b0c
--- /dev/null
+++ b/jdk/src/share/classes/javax/security/auth/spi/package-info.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2000, 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.
+ */
+
+/**
+ * This package provides the interface to be used for
+ * implementing pluggable authentication modules.
+ *
+ * @since JDK1.4
+ */
+package javax.security.auth.spi;
diff --git a/jdk/src/share/classes/javax/security/auth/spi/package.html b/jdk/src/share/classes/javax/security/auth/spi/package.html
deleted file mode 100644
index f4ca707c066..00000000000
--- a/jdk/src/share/classes/javax/security/auth/spi/package.html
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
- This package provides the interface to be used for
- implementing pluggable authentication modules.
-
-
-@since JDK1.4
-
-
diff --git a/jdk/src/share/classes/javax/security/auth/x500/X500Principal.java b/jdk/src/share/classes/javax/security/auth/x500/X500Principal.java
index 4a507197771..5c0a5621261 100644
--- a/jdk/src/share/classes/javax/security/auth/x500/X500Principal.java
+++ b/jdk/src/share/classes/javax/security/auth/x500/X500Principal.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -33,8 +33,8 @@ import sun.security.x509.X500Name;
import sun.security.util.*;
/**
- *
This class represents an X.500 Principal.
- * X500Principals are represented by distinguished names such as
+ *
This class represents an X.500 {@code Principal}.
+ * {@code X500Principal}s are represented by distinguished names such as
* "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US".
*
*
The string representation for this X500Principal
- * can be obtained by calling the getName methods.
+ *
The string representation for this {@code X500Principal}
+ * can be obtained by calling the {@code getName} methods.
*
- *
Note that the getSubjectX500Principal and
- * getIssuerX500Principal methods of
- * X509Certificate return X500Principals representing the
+ *
Note that the {@code getSubjectX500Principal} and
+ * {@code getIssuerX500Principal} methods of
+ * {@code X509Certificate} return X500Principals representing the
* issuer and subject fields of the certificate.
*
* @see java.security.cert.X509Certificate
@@ -97,7 +97,7 @@ public final class X500Principal implements Principal, java.io.Serializable {
}
/**
- * Creates an X500Principal from a string representation of
+ * Creates an {@code X500Principal} from a string representation of
* an X.500 distinguished name (ex:
* "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US").
* The distinguished name must be specified using the grammar defined in
@@ -119,9 +119,9 @@ public final class X500Principal implements Principal, java.io.Serializable {
*
{@code numericoid = number 1*( DOT number ) }
*
* @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format
- * @exception NullPointerException if the name
- * is null
- * @exception IllegalArgumentException if the name
+ * @exception NullPointerException if the {@code name}
+ * is {@code null}
+ * @exception IllegalArgumentException if the {@code name}
* is improperly specified
*/
public X500Principal(String name) {
@@ -129,7 +129,7 @@ public final class X500Principal implements Principal, java.io.Serializable {
}
/**
- * Creates an X500Principal from a string representation of
+ * Creates an {@code X500Principal} from a string representation of
* an X.500 distinguished name (ex:
* "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US").
* The distinguished name must be specified using the grammar defined in
@@ -137,13 +137,13 @@ public final class X500Principal implements Principal, java.io.Serializable {
*
*
This constructor recognizes the attribute type keywords specified
* in {@link #X500Principal(String)} and also recognizes additional
- * keywords that have entries in the keywordMap parameter.
+ * keywords that have entries in the {@code keywordMap} parameter.
* Keyword entries in the keywordMap take precedence over the default
- * keywords recognized by X500Principal(String). Keywords
+ * keywords recognized by {@code X500Principal(String)}. Keywords
* MUST be specified in all upper-case, otherwise they will be ignored.
* Improperly specified keywords are ignored; however if a keyword in the
* name maps to an improperly specified Object Identifier (OID), an
- * IllegalArgumentException is thrown. It is permissible to
+ * {@code IllegalArgumentException} is thrown. It is permissible to
* have 2 different keywords that map to the same OID.
*
*
This implementation enforces a more restrictive OID syntax than
@@ -157,11 +157,11 @@ public final class X500Principal implements Principal, java.io.Serializable {
* @param keywordMap an attribute type keyword map, where each key is a
* keyword String that maps to a corresponding object identifier in String
* form (a sequence of nonnegative integers separated by periods). The map
- * may be empty but never null.
- * @exception NullPointerException if name or
- * keywordMap is null
- * @exception IllegalArgumentException if the name is
- * improperly specified or a keyword in the name maps to an
+ * may be empty but never {@code null}.
+ * @exception NullPointerException if {@code name} or
+ * {@code keywordMap} is {@code null}
+ * @exception IllegalArgumentException if the {@code name} is
+ * improperly specified or a keyword in the {@code name} maps to an
* OID that is not in the correct form
* @since 1.6
*/
@@ -188,10 +188,10 @@ public final class X500Principal implements Principal, java.io.Serializable {
}
/**
- * Creates an X500Principal from a distinguished name in
+ * Creates an {@code X500Principal} from a distinguished name in
* ASN.1 DER encoded form. The ASN.1 notation for this structure is as
* follows.
- *
*
* @param name a byte array containing the distinguished name in ASN.1
* DER encoded form
@@ -233,7 +233,7 @@ public final class X500Principal implements Principal, java.io.Serializable {
}
/**
- * Creates an X500Principal from an InputStream
+ * Creates an {@code X500Principal} from an {@code InputStream}
* containing the distinguished name in ASN.1 DER encoded form.
* The ASN.1 notation for this structure is supplied in the
* documentation for
@@ -242,11 +242,11 @@ public final class X500Principal implements Principal, java.io.Serializable {
*
The read position of the input stream is positioned
* to the next available byte after the encoded distinguished name.
*
- * @param is an InputStream containing the distinguished
+ * @param is an {@code InputStream} containing the distinguished
* name in ASN.1 DER encoded form
*
- * @exception NullPointerException if the InputStream
- * is null
+ * @exception NullPointerException if the {@code InputStream}
+ * is {@code null}
* @exception IllegalArgumentException if an encoding error occurs
* (incorrect form for DN)
*/
@@ -284,9 +284,9 @@ public final class X500Principal implements Principal, java.io.Serializable {
* the format defined in RFC 2253.
*
*
This method is equivalent to calling
- * getName(X500Principal.RFC2253).
+ * {@code getName(X500Principal.RFC2253)}.
*
- * @return the distinguished name of this X500Principal
+ * @return the distinguished name of this {@code X500Principal}
*/
public String getName() {
return getName(X500Principal.RFC2253);
@@ -338,9 +338,9 @@ public final class X500Principal implements Principal, java.io.Serializable {
* those which section 2.4 of RFC 2253 states must be escaped
* (they are escaped using a preceding backslash character)
*
The entire name is converted to upper case
- * using String.toUpperCase(Locale.US)
+ * using {@code String.toUpperCase(Locale.US)}
*
The entire name is converted to lower case
- * using String.toLowerCase(Locale.US)
+ * using {@code String.toLowerCase(Locale.US)}
*
The name is finally normalized using normalization form KD,
* as described in the Unicode Standard and UAX #15
*
@@ -349,7 +349,7 @@ public final class X500Principal implements Principal, java.io.Serializable {
*
* @param format the format to use
*
- * @return a string representation of this X500Principal
+ * @return a string representation of this {@code X500Principal}
* using the specified format
* @throws IllegalArgumentException if the specified format is invalid
* or null
@@ -371,16 +371,16 @@ public final class X500Principal implements Principal, java.io.Serializable {
* Returns a string representation of the X.500 distinguished name
* using the specified format. Valid values for the format are
* "RFC1779" and "RFC2253" (case insensitive). "CANONICAL" is not
- * permitted and an IllegalArgumentException will be thrown.
+ * permitted and an {@code IllegalArgumentException} will be thrown.
*
*
This method returns Strings in the format as specified in
* {@link #getName(String)} and also emits additional attribute type
- * keywords for OIDs that have entries in the oidMap
+ * keywords for OIDs that have entries in the {@code oidMap}
* parameter. OID entries in the oidMap take precedence over the default
- * OIDs recognized by getName(String).
+ * OIDs recognized by {@code getName(String)}.
* Improperly specified OIDs are ignored; however if an OID
* in the name maps to an improperly specified keyword, an
- * IllegalArgumentException is thrown.
+ * {@code IllegalArgumentException} is thrown.
*
*
Additional standard formats may be introduced in the future.
*
@@ -393,12 +393,12 @@ public final class X500Principal implements Principal, java.io.Serializable {
* @param oidMap an OID map, where each key is an object identifier in
* String form (a sequence of nonnegative integers separated by periods)
* that maps to a corresponding attribute type keyword String.
- * The map may be empty but never null.
- * @return a string representation of this X500Principal
+ * The map may be empty but never {@code null}.
+ * @return a string representation of this {@code X500Principal}
* using the specified format
* @throws IllegalArgumentException if the specified format is invalid,
* null, or an OID in the name maps to an improperly specified keyword
- * @throws NullPointerException if oidMap is null
+ * @throws NullPointerException if {@code oidMap} is {@code null}
* @since 1.6
*/
public String getName(String format, Map oidMap) {
@@ -438,31 +438,31 @@ public final class X500Principal implements Principal, java.io.Serializable {
/**
* Return a user-friendly string representation of this
- * X500Principal.
+ * {@code X500Principal}.
*
- * @return a string representation of this X500Principal
+ * @return a string representation of this {@code X500Principal}
*/
public String toString() {
return thisX500Name.toString();
}
/**
- * Compares the specified Object with this
- * X500Principal for equality.
+ * Compares the specified {@code Object} with this
+ * {@code X500Principal} for equality.
*
- *
Specifically, this method returns true if
- * the Objecto is an X500Principal
+ *
Specifically, this method returns {@code true} if
+ * the {@code Object} o is an {@code X500Principal}
* and if the respective canonical string representations
- * (obtained via the getName(X500Principal.CANONICAL) method)
+ * (obtained via the {@code getName(X500Principal.CANONICAL)} method)
* of this object and o are equal.
*
*
This implementation is compliant with the requirements of RFC 3280.
*
* @param o Object to be compared for equality with this
- * X500Principal
+ * {@code X500Principal}
*
- * @return true if the specified Object is equal
- * to this X500Principal, false otherwise
+ * @return {@code true} if the specified {@code Object} is equal
+ * to this {@code X500Principal}, {@code false} otherwise
*/
public boolean equals(Object o) {
if (this == o) {
@@ -476,12 +476,12 @@ public final class X500Principal implements Principal, java.io.Serializable {
}
/**
- * Return a hash code for this X500Principal.
+ * Return a hash code for this {@code X500Principal}.
*
*
The hash code is calculated via:
- * getName(X500Principal.CANONICAL).hashCode()
+ * {@code getName(X500Principal.CANONICAL).hashCode()}
*
- * @return a hash code for this X500Principal
+ * @return a hash code for this {@code X500Principal}
*/
public int hashCode() {
return thisX500Name.hashCode();
@@ -490,9 +490,9 @@ public final class X500Principal implements Principal, java.io.Serializable {
/**
* Save the X500Principal object to a stream.
*
- * @serialData this X500Principal is serialized
+ * @serialData this {@code X500Principal} is serialized
* by writing out its DER-encoded form
- * (the value of getEncoded is serialized).
+ * (the value of {@code getEncoded} is serialized).
*/
private void writeObject(java.io.ObjectOutputStream s)
throws IOException {
diff --git a/jdk/src/share/classes/javax/security/auth/x500/X500PrivateCredential.java b/jdk/src/share/classes/javax/security/auth/x500/X500PrivateCredential.java
index 64bd14295da..56072eda5bc 100644
--- a/jdk/src/share/classes/javax/security/auth/x500/X500PrivateCredential.java
+++ b/jdk/src/share/classes/javax/security/auth/x500/X500PrivateCredential.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -30,7 +30,7 @@ import java.security.cert.X509Certificate;
import javax.security.auth.Destroyable;
/**
- *
This class represents an X500PrivateCredential.
+ *
This class represents an {@code X500PrivateCredential}.
* It associates an X.509 certificate, corresponding private key and the
* KeyStore alias used to reference that exact key pair in the KeyStore.
* This enables looking up the private credentials for an X.500 principal
@@ -48,8 +48,8 @@ public final class X500PrivateCredential implements Destroyable {
*
* @param cert X509Certificate
* @param key PrivateKey for the certificate
- * @exception IllegalArgumentException if either cert or
- * key is null
+ * @exception IllegalArgumentException if either {@code cert} or
+ * {@code key} is null
*
*/
@@ -68,8 +68,8 @@ public final class X500PrivateCredential implements Destroyable {
* @param cert X509Certificate
* @param key PrivateKey for the certificate
* @param alias KeyStore alias
- * @exception IllegalArgumentException if either cert,
- * key or alias is null
+ * @exception IllegalArgumentException if either {@code cert},
+ * {@code key} or {@code alias} is null
*
*/
public X500PrivateCredential(X509Certificate cert, PrivateKey key,
diff --git a/jdk/src/share/classes/javax/security/auth/x500/package-info.java b/jdk/src/share/classes/javax/security/auth/x500/package-info.java
new file mode 100644
index 00000000000..12f8a5322d1
--- /dev/null
+++ b/jdk/src/share/classes/javax/security/auth/x500/package-info.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2000, 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.
+ */
+
+/**
+ * This package contains the classes that should be used to store
+ * X500 Principal and X500 Private Credentials in a
+ * Subject.
+ *
+ *
+ *
+ * @since JDK1.4
+ */
+package javax.security.auth.x500;
diff --git a/jdk/src/share/classes/javax/security/auth/x500/package.html b/jdk/src/share/classes/javax/security/auth/x500/package.html
deleted file mode 100644
index 46a9203774f..00000000000
--- a/jdk/src/share/classes/javax/security/auth/x500/package.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
- This package contains the classes that should be used to store
- X500 Principal and X500 Private Credentials in a
- Subject.
-
-
-
-
-
-@since JDK1.4
-
-
diff --git a/jdk/src/share/classes/javax/security/cert/Certificate.java b/jdk/src/share/classes/javax/security/cert/Certificate.java
index 651c5bd1024..10fd767c157 100644
--- a/jdk/src/share/classes/javax/security/cert/Certificate.java
+++ b/jdk/src/share/classes/javax/security/cert/Certificate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -49,11 +49,11 @@ import java.security.SignatureException;
* sets of information, and they store and retrieve the information in
* different ways.
*
- *
Note: The classes in the package javax.security.cert
+ *
Note: The classes in the package {@code javax.security.cert}
* exist for compatibility with earlier versions of the
* Java Secure Sockets Extension (JSSE). New applications should instead
* use the standard Java SE certificate classes located in
- * java.security.cert.
+ * {@code java.security.cert}.
*
* @since 1.4
* @see X509Certificate
@@ -64,8 +64,8 @@ public abstract class Certificate {
/**
* Compares this certificate for equality with the specified
- * object. If the other object is an
- * instanceofCertificate, then
+ * object. If the {@code other} object is an
+ * {@code instanceof} {@code Certificate}, then
* its encoded form is retrieved and compared with the
* encoded form of this certificate.
*
diff --git a/jdk/src/share/classes/javax/security/cert/CertificateEncodingException.java b/jdk/src/share/classes/javax/security/cert/CertificateEncodingException.java
index 8832c3a2ee1..1496c754181 100644
--- a/jdk/src/share/classes/javax/security/cert/CertificateEncodingException.java
+++ b/jdk/src/share/classes/javax/security/cert/CertificateEncodingException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -30,11 +30,11 @@ package javax.security.cert;
* Certificate Encoding Exception. This is thrown whenever an error
* occurs whilst attempting to encode a certificate.
*
- *
Note: The classes in the package javax.security.cert
+ *
Note: The classes in the package {@code javax.security.cert}
* exist for compatibility with earlier versions of the
* Java Secure Sockets Extension (JSSE). New applications should instead
* use the standard Java SE certificate classes located in
- * java.security.cert.
+ * {@code java.security.cert}.
*
* @since 1.4
* @author Hemma Prafullchandra
diff --git a/jdk/src/share/classes/javax/security/cert/CertificateException.java b/jdk/src/share/classes/javax/security/cert/CertificateException.java
index 7e250558ed0..68ee6798b8c 100644
--- a/jdk/src/share/classes/javax/security/cert/CertificateException.java
+++ b/jdk/src/share/classes/javax/security/cert/CertificateException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -29,11 +29,11 @@ package javax.security.cert;
/**
* This exception indicates one of a variety of certificate problems.
*
- *
Note: The classes in the package javax.security.cert
+ *
Note: The classes in the package {@code javax.security.cert}
* exist for compatibility with earlier versions of the
* Java Secure Sockets Extension (JSSE). New applications should instead
* use the standard Java SE certificate classes located in
- * java.security.cert.
+ * {@code java.security.cert}.
*
* @author Hemma Prafullchandra
* @since 1.4
diff --git a/jdk/src/share/classes/javax/security/cert/CertificateExpiredException.java b/jdk/src/share/classes/javax/security/cert/CertificateExpiredException.java
index 601dc6bb1db..7e4579f2ebe 100644
--- a/jdk/src/share/classes/javax/security/cert/CertificateExpiredException.java
+++ b/jdk/src/share/classes/javax/security/cert/CertificateExpiredException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,15 +28,15 @@ package javax.security.cert;
/**
* Certificate Expired Exception. This is thrown whenever the current
- * Date or the specified Date is after the
- * notAfter date/time specified in the validity period
+ * {@code Date} or the specified {@code Date} is after the
+ * {@code notAfter} date/time specified in the validity period
* of the certificate.
*
- *
Note: The classes in the package javax.security.cert
+ *
Note: The classes in the package {@code javax.security.cert}
* exist for compatibility with earlier versions of the
* Java Secure Sockets Extension (JSSE). New applications should instead
* use the standard Java SE certificate classes located in
- * java.security.cert.
+ * {@code java.security.cert}.
*
* @since 1.4
* @author Hemma Prafullchandra
diff --git a/jdk/src/share/classes/javax/security/cert/CertificateNotYetValidException.java b/jdk/src/share/classes/javax/security/cert/CertificateNotYetValidException.java
index 2a0861580a3..9a53daa661d 100644
--- a/jdk/src/share/classes/javax/security/cert/CertificateNotYetValidException.java
+++ b/jdk/src/share/classes/javax/security/cert/CertificateNotYetValidException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,15 +28,15 @@ package javax.security.cert;
/**
* Certificate is not yet valid exception. This is thrown whenever
- * the current Date or the specified Date
- * is before the notBefore date/time in the Certificate
+ * the current {@code Date} or the specified {@code Date}
+ * is before the {@code notBefore} date/time in the Certificate
* validity period.
*
- *
Note: The classes in the package javax.security.cert
+ *
Note: The classes in the package {@code javax.security.cert}
* exist for compatibility with earlier versions of the
* Java Secure Sockets Extension (JSSE). New applications should instead
* use the standard Java SE certificate classes located in
- * java.security.cert.
+ * {@code java.security.cert}.
*
* @since 1.4
* @author Hemma Prafullchandra
diff --git a/jdk/src/share/classes/javax/security/cert/CertificateParsingException.java b/jdk/src/share/classes/javax/security/cert/CertificateParsingException.java
index c60ffe4f1f5..4378587bb70 100644
--- a/jdk/src/share/classes/javax/security/cert/CertificateParsingException.java
+++ b/jdk/src/share/classes/javax/security/cert/CertificateParsingException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -31,11 +31,11 @@ package javax.security.cert;
* invalid DER encoded certificate is parsed or unsupported DER features
* are found in the Certificate.
*
- *
Note: The classes in the package javax.security.cert
+ *
Note: The classes in the package {@code javax.security.cert}
* exist for compatibility with earlier versions of the
* Java Secure Sockets Extension (JSSE). New applications should instead
* use the standard Java SE certificate classes located in
- * java.security.cert.
+ * {@code java.security.cert}.
*
* @since 1.4
* @author Hemma Prafullchandra
diff --git a/jdk/src/share/classes/javax/security/cert/X509Certificate.java b/jdk/src/share/classes/javax/security/cert/X509Certificate.java
index 16fb0149801..1ef7ddcb56a 100644
--- a/jdk/src/share/classes/javax/security/cert/X509Certificate.java
+++ b/jdk/src/share/classes/javax/security/cert/X509Certificate.java
@@ -70,7 +70,7 @@ import java.util.Date;
* CA certificates are either signed by themselves, or by some other
* CA such as a "root" CA.
*
- * The ASN.1 definition of tbsCertificate is:
+ * The ASN.1 definition of {@code tbsCertificate} is:
*
* TBSCertificate ::= SEQUENCE {
* version [0] EXPLICIT Version DEFAULT v1,
@@ -113,11 +113,11 @@ import java.util.Date;
* initialization time and will fallback on a default implementation if
* the Security property is not accessible.
*
- *
Note: The classes in the package javax.security.cert
+ *
Note: The classes in the package {@code javax.security.cert}
* exist for compatibility with earlier versions of the
* Java Secure Sockets Extension (JSSE). New applications should instead
* use the standard Java SE certificate classes located in
- * java.security.cert.
+ * {@code java.security.cert}.
*
* @author Hemma Prafullchandra
* @since 1.4
@@ -150,7 +150,7 @@ public abstract class X509Certificate extends Certificate {
/**
* Instantiates an X509Certificate object, and initializes it with
- * the data read from the input stream inStream.
+ * the data read from the input stream {@code inStream}.
* The implementation (X509Certificate is an abstract class) is
* provided by the class specified as the value of the
* {@code cert.provider.x509v1} security property.
@@ -191,7 +191,7 @@ public abstract class X509Certificate extends Certificate {
* @param certData a byte array containing the DER-encoded
* certificate.
* @return an X509Certificate object initialized with the data
- * from certData.
+ * from {@code certData}.
* @exception CertificateException if a class initialization
* or certificate parsing error occurs.
*/
@@ -281,16 +281,16 @@ public abstract class X509Certificate extends Certificate {
* @param date the Date to check against to see if this certificate
* is valid at that date/time.
* @exception CertificateExpiredException if the certificate has expired
- * with respect to the date supplied.
+ * with respect to the {@code date} supplied.
* @exception CertificateNotYetValidException if the certificate is not
- * yet valid with respect to the date supplied.
+ * yet valid with respect to the {@code date} supplied.
* @see #checkValidity()
*/
public abstract void checkValidity(Date date)
throws CertificateExpiredException, CertificateNotYetValidException;
/**
- * Gets the version (version number) value from the
+ * Gets the {@code version} (version number) value from the
* certificate. The ASN.1 definition for this is:
*
* version [0] EXPLICIT Version DEFAULT v1
@@ -303,7 +303,7 @@ public abstract class X509Certificate extends Certificate {
public abstract int getVersion();
/**
- * Gets the serialNumber value from the certificate.
+ * Gets the {@code serialNumber} value from the certificate.
* The serial number is an integer assigned by the certification
* authority to each certificate. It must be unique for each
* certificate issued by a given CA (i.e., the issuer name and
@@ -320,7 +320,7 @@ public abstract class X509Certificate extends Certificate {
public abstract BigInteger getSerialNumber();
/**
- * Gets the issuer (issuer distinguished name) value from
+ * Gets the {@code issuer} (issuer distinguished name) value from
* the certificate. The issuer name identifies the entity that signed (and
* issued) the certificate.
*
@@ -341,27 +341,27 @@ public abstract class X509Certificate extends Certificate {
* AttributeType ::= OBJECT IDENTIFIER
* AttributeValue ::= ANY
*
- * The Name describes a hierarchical name composed of
+ * The {@code Name} describes a hierarchical name composed of
* attributes, such as country name, and corresponding values, such as US.
- * The type of the AttributeValue component is determined by
- * the AttributeType; in general it will be a
- * directoryString. A directoryString is usually
- * one of PrintableString,
- * TeletexString or UniversalString.
+ * The type of the {@code AttributeValue} component is determined by
+ * the {@code AttributeType}; in general it will be a
+ * {@code directoryString}. A {@code directoryString} is usually
+ * one of {@code PrintableString},
+ * {@code TeletexString} or {@code UniversalString}.
*
* @return a Principal whose name is the issuer distinguished name.
*/
public abstract Principal getIssuerDN();
/**
- * Gets the subject (subject distinguished name) value
+ * Gets the {@code subject} (subject distinguished name) value
* from the certificate.
* The ASN.1 definition for this is:
*
* subject Name
*
*
- *
See {@link #getIssuerDN() getIssuerDN} for Name
+ *
See {@link #getIssuerDN() getIssuerDN} for {@code Name}
* and other relevant definitions.
*
* @return a Principal whose name is the subject name.
@@ -370,7 +370,7 @@ public abstract class X509Certificate extends Certificate {
public abstract Principal getSubjectDN();
/**
- * Gets the notBefore date from the validity period of
+ * Gets the {@code notBefore} date from the validity period of
* the certificate.
* The relevant ASN.1 definitions are:
*
@@ -391,7 +391,7 @@ public abstract class X509Certificate extends Certificate {
public abstract Date getNotBefore();
/**
- * Gets the notAfter date from the validity period of
+ * Gets the {@code notAfter} date from the validity period of
* the certificate. See {@link #getNotBefore() getNotBefore}
* for relevant ASN.1 definitions.
*
@@ -415,7 +415,7 @@ public abstract class X509Certificate extends Certificate {
* -- algorithm object identifier value
*
*
- *
The algorithm name is determined from the algorithm
+ *
The algorithm name is determined from the {@code algorithm}
* OID string.
*
* @return the signature algorithm name.
diff --git a/jdk/src/share/classes/javax/security/cert/package-info.java b/jdk/src/share/classes/javax/security/cert/package-info.java
new file mode 100644
index 00000000000..c09a0eafabc
--- /dev/null
+++ b/jdk/src/share/classes/javax/security/cert/package-info.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 1999, 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.
+ */
+
+/**
+ * Provides classes for public key certificates.
+ *
+ * These classes include a simplified version of the
+ * java.security.cert package. These classes were developed
+ * as part of the Java Secure Socket
+ * Extension (JSSE). When JSSE was added to the J2SE version 1.4, this
+ * package was added for backward-compatibility reasons only.
+ *
+ * New applications should not use this package, but rather
+ * java.security.cert.
+ *
+ * @since 1.4
+ */
+package javax.security.cert;
diff --git a/jdk/src/share/classes/javax/security/cert/package.html b/jdk/src/share/classes/javax/security/cert/package.html
deleted file mode 100644
index 06c25e0d1aa..00000000000
--- a/jdk/src/share/classes/javax/security/cert/package.html
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-Provides classes for public key certificates.
-
-
-
-These classes include a simplified version of the
-java.security.cert package. These classes were developed
-as part of the Java Secure Socket
-Extension (JSSE). When JSSE was added to the J2SE version 1.4, this
-package was added for backward-compatibility reasons only.
-
-
-
-New applications should not use this package, but rather
-java.security.cert.
-
-
-@since 1.4
-
-
diff --git a/jdk/src/share/classes/javax/security/sasl/AuthenticationException.java b/jdk/src/share/classes/javax/security/sasl/AuthenticationException.java
index ea76d1a783c..b61981bc16f 100644
--- a/jdk/src/share/classes/javax/security/sasl/AuthenticationException.java
+++ b/jdk/src/share/classes/javax/security/sasl/AuthenticationException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -45,7 +45,7 @@ package javax.security.sasl;
*/
public class AuthenticationException extends SaslException {
/**
- * Constructs a new instance of AuthenticationException.
+ * Constructs a new instance of {@code AuthenticationException}.
* The root exception and the detailed message are null.
*/
public AuthenticationException () {
@@ -53,7 +53,7 @@ public class AuthenticationException extends SaslException {
}
/**
- * Constructs a new instance of AuthenticationException
+ * Constructs a new instance of {@code AuthenticationException}
* with a detailed message.
* The root exception is null.
* @param detail A possibly null string containing details of the exception.
@@ -65,7 +65,7 @@ public class AuthenticationException extends SaslException {
}
/**
- * Constructs a new instance of AuthenticationException with a detailed message
+ * Constructs a new instance of {@code AuthenticationException} with a detailed message
* and a root exception.
*
* @param detail A possibly null string containing details of the exception.
diff --git a/jdk/src/share/classes/javax/security/sasl/AuthorizeCallback.java b/jdk/src/share/classes/javax/security/sasl/AuthorizeCallback.java
index 0824cb2c087..e2342d64e6d 100644
--- a/jdk/src/share/classes/javax/security/sasl/AuthorizeCallback.java
+++ b/jdk/src/share/classes/javax/security/sasl/AuthorizeCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -28,7 +28,7 @@ package javax.security.sasl;
import javax.security.auth.callback.Callback;
/**
- * This callback is used by SaslServer to determine whether
+ * This callback is used by {@code SaslServer} to determine whether
* one entity (identified by an authenticated authentication id)
* can act on
* behalf of another entity (identified by an authorization id).
@@ -66,7 +66,7 @@ public class AuthorizeCallback implements Callback, java.io.Serializable {
private boolean authorized;
/**
- * Constructs an instance of AuthorizeCallback.
+ * Constructs an instance of {@code AuthorizeCallback}.
*
* @param authnID The (authenticated) authentication id.
* @param authzID The authorization id.
@@ -96,7 +96,7 @@ public class AuthorizeCallback implements Callback, java.io.Serializable {
* Determines whether the authentication id is allowed to
* act on behalf of the authorization id.
*
- * @return true if authorization is allowed; false otherwise
+ * @return {@code true} if authorization is allowed; {@code false} otherwise
* @see #setAuthorized(boolean)
* @see #getAuthorizedID()
*/
@@ -106,7 +106,7 @@ public class AuthorizeCallback implements Callback, java.io.Serializable {
/**
* Sets whether the authorization is allowed.
- * @param ok true if authorization is allowed; false otherwise
+ * @param ok {@code true} if authorization is allowed; {@code false} otherwise
* @see #isAuthorized
* @see #setAuthorizedID(java.lang.String)
*/
@@ -116,7 +116,7 @@ public class AuthorizeCallback implements Callback, java.io.Serializable {
/**
* Returns the id of the authorized user.
- * @return The id of the authorized user. null means the
+ * @return The id of the authorized user. {@code null} means the
* authorization failed.
* @see #setAuthorized(boolean)
* @see #setAuthorizedID(java.lang.String)
diff --git a/jdk/src/share/classes/javax/security/sasl/RealmCallback.java b/jdk/src/share/classes/javax/security/sasl/RealmCallback.java
index b9d30d1a3f4..b3af0998e5e 100644
--- a/jdk/src/share/classes/javax/security/sasl/RealmCallback.java
+++ b/jdk/src/share/classes/javax/security/sasl/RealmCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -28,7 +28,7 @@ package javax.security.sasl;
import javax.security.auth.callback.TextInputCallback;
/**
- * This callback is used by SaslClient and SaslServer
+ * This callback is used by {@code SaslClient} and {@code SaslServer}
* to retrieve realm information.
*
* @since 1.5
@@ -39,10 +39,10 @@ import javax.security.auth.callback.TextInputCallback;
public class RealmCallback extends TextInputCallback {
/**
- * Constructs a RealmCallback with a prompt.
+ * Constructs a {@code RealmCallback} with a prompt.
*
* @param prompt The non-null prompt to use to request the realm information.
- * @throws IllegalArgumentException If prompt is null or
+ * @throws IllegalArgumentException If {@code prompt} is null or
* the empty string.
*/
public RealmCallback(String prompt) {
@@ -50,14 +50,14 @@ public class RealmCallback extends TextInputCallback {
}
/**
- * Constructs a RealmCallback with a prompt and default
+ * Constructs a {@code RealmCallback} with a prompt and default
* realm information.
*
* @param prompt The non-null prompt to use to request the realm information.
* @param defaultRealmInfo The non-null default realm information to use.
- * @throws IllegalArgumentException If prompt is null or
+ * @throws IllegalArgumentException If {@code prompt} is null or
* the empty string,
- * or if defaultRealm is empty or null.
+ * or if {@code defaultRealm} is empty or null.
*/
public RealmCallback(String prompt, String defaultRealmInfo) {
super(prompt, defaultRealmInfo);
diff --git a/jdk/src/share/classes/javax/security/sasl/RealmChoiceCallback.java b/jdk/src/share/classes/javax/security/sasl/RealmChoiceCallback.java
index 3ee292a1582..7954109f541 100644
--- a/jdk/src/share/classes/javax/security/sasl/RealmChoiceCallback.java
+++ b/jdk/src/share/classes/javax/security/sasl/RealmChoiceCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -28,7 +28,7 @@ package javax.security.sasl;
import javax.security.auth.callback.ChoiceCallback;
/**
- * This callback is used by SaslClient and SaslServer
+ * This callback is used by {@code SaslClient} and {@code SaslServer}
* to obtain a realm given a list of realm choices.
*
* @since 1.5
@@ -39,19 +39,19 @@ import javax.security.auth.callback.ChoiceCallback;
public class RealmChoiceCallback extends ChoiceCallback {
/**
- * Constructs a RealmChoiceCallback with a prompt, a list of
+ * Constructs a {@code RealmChoiceCallback} with a prompt, a list of
* choices and a default choice.
*
* @param prompt the non-null prompt to use to request the realm.
* @param choices the non-null list of realms to choose from.
* @param defaultChoice the choice to be used as the default choice
* when the list of choices is displayed. It is an index into
- * the choices arary.
+ * the {@code choices} arary.
* @param multiple true if multiple choices allowed; false otherwise
- * @throws IllegalArgumentException If prompt is null or the empty string,
- * if choices has a length of 0, if any element from
- * choices is null or empty, or if defaultChoice
- * does not fall within the array boundary of choices
+ * @throws IllegalArgumentException If {@code prompt} is null or the empty string,
+ * if {@code choices} has a length of 0, if any element from
+ * {@code choices} is null or empty, or if {@code defaultChoice}
+ * does not fall within the array boundary of {@code choices}
*/
public RealmChoiceCallback(String prompt, String[]choices,
int defaultChoice, boolean multiple) {
diff --git a/jdk/src/share/classes/javax/security/sasl/Sasl.java b/jdk/src/share/classes/javax/security/sasl/Sasl.java
index bb9fb2eec04..77edc108792 100644
--- a/jdk/src/share/classes/javax/security/sasl/Sasl.java
+++ b/jdk/src/share/classes/javax/security/sasl/Sasl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -72,15 +72,15 @@ public class Sasl {
* of quality-of-protection values that the
* client or server is willing to support. A qop value is one of
*
- *
"auth" - authentication only
- *
"auth-int" - authentication plus integrity protection
- *
"auth-conf" - authentication plus integrity and confidentiality
+ *
{@code "auth"} - authentication only
+ *
{@code "auth-int"} - authentication plus integrity protection
+ *
{@code "auth-conf"} - authentication plus integrity and confidentiality
* protection
*
*
* The order of the list specifies the preference order of the client or
- * server. If this property is absent, the default qop is "auth".
- * The value of this constant is "javax.security.sasl.qop".
+ * server. If this property is absent, the default qop is {@code "auth"}.
+ * The value of this constant is {@code "javax.security.sasl.qop"}.
*/
public static final String QOP = "javax.security.sasl.qop";
@@ -90,9 +90,9 @@ public class Sasl {
* of cipher strength values that
* the client or server is willing to support. A strength value is one of
*
- *
"low"
- *
"medium"
- *
"high"
+ *
{@code "low"}
+ *
{@code "medium"}
+ *
{@code "high"}
*
* The order of the list specifies the preference order of the client or
* server. An implementation should allow configuration of the meaning
@@ -101,19 +101,19 @@ public class Sasl {
* cipher suites that match the strength values.
*
* If this property is absent, the default strength is
- * "high,medium,low".
- * The value of this constant is "javax.security.sasl.strength".
+ * {@code "high,medium,low"}.
+ * The value of this constant is {@code "javax.security.sasl.strength"}.
*/
public static final String STRENGTH = "javax.security.sasl.strength";
/**
* The name of a property that specifies whether the
* server must authenticate to the client. The property contains
- * "true" if the server must
- * authenticate the to client; "false" otherwise.
- * The default is "false".
+ * {@code "true"} if the server must
+ * authenticate the to client; {@code "false"} otherwise.
+ * The default is {@code "false"}.
* The value of this constant is
- * "javax.security.sasl.server.authentication".
+ * {@code "javax.security.sasl.server.authentication"}.
*/
public static final String SERVER_AUTH =
"javax.security.sasl.server.authentication";
@@ -125,28 +125,28 @@ public class Sasl {
* The property contains the bound host name after the authentication
* exchange has completed. It is only available on the server side.
* The value of this constant is
- * "javax.security.sasl.bound.server.name".
+ * {@code "javax.security.sasl.bound.server.name"}.
*/
public static final String BOUND_SERVER_NAME =
"javax.security.sasl.bound.server.name";
/**
* The name of a property that specifies the maximum size of the receive
- * buffer in bytes of SaslClient/SaslServer.
+ * buffer in bytes of {@code SaslClient}/{@code SaslServer}.
* The property contains the string representation of an integer.
* If this property is absent, the default size
* is defined by the mechanism.
- * The value of this constant is "javax.security.sasl.maxbuffer".
+ * The value of this constant is {@code "javax.security.sasl.maxbuffer"}.
*/
public static final String MAX_BUFFER = "javax.security.sasl.maxbuffer";
/**
* The name of a property that specifies the maximum size of the raw send
- * buffer in bytes of SaslClient/SaslServer.
+ * buffer in bytes of {@code SaslClient}/{@code SaslServer}.
* The property contains the string representation of an integer.
* The value of this property is negotiated between the client and server
* during the authentication exchange.
- * The value of this constant is "javax.security.sasl.rawsendsize".
+ * The value of this constant is {@code "javax.security.sasl.rawsendsize"}.
*/
public static final String RAW_SEND_SIZE = "javax.security.sasl.rawsendsize";
@@ -181,11 +181,11 @@ public class Sasl {
* The name of a property that specifies
* whether mechanisms susceptible to simple plain passive attacks (e.g.,
* "PLAIN") are not permitted. The property
- * contains "true" if such mechanisms are not permitted;
- * "false" if such mechanisms are permitted.
- * The default is "false".
+ * contains {@code "true"} if such mechanisms are not permitted;
+ * {@code "false"} if such mechanisms are permitted.
+ * The default is {@code "false"}.
* The value of this constant is
- * "javax.security.sasl.policy.noplaintext".
+ * {@code "javax.security.sasl.policy.noplaintext"}.
*/
public static final String POLICY_NOPLAINTEXT =
"javax.security.sasl.policy.noplaintext";
@@ -194,12 +194,12 @@ public class Sasl {
* The name of a property that specifies whether
* mechanisms susceptible to active (non-dictionary) attacks
* are not permitted.
- * The property contains "true"
+ * The property contains {@code "true"}
* if mechanisms susceptible to active attacks
- * are not permitted; "false" if such mechanisms are permitted.
- * The default is "false".
+ * are not permitted; {@code "false"} if such mechanisms are permitted.
+ * The default is {@code "false"}.
* The value of this constant is
- * "javax.security.sasl.policy.noactive".
+ * {@code "javax.security.sasl.policy.noactive"}.
*/
public static final String POLICY_NOACTIVE =
"javax.security.sasl.policy.noactive";
@@ -207,26 +207,26 @@ public class Sasl {
/**
* The name of a property that specifies whether
* mechanisms susceptible to passive dictionary attacks are not permitted.
- * The property contains "true"
+ * The property contains {@code "true"}
* if mechanisms susceptible to dictionary attacks are not permitted;
- * "false" if such mechanisms are permitted.
- * The default is "false".
+ * {@code "false"} if such mechanisms are permitted.
+ * The default is {@code "false"}.
*
* The value of this constant is
- * "javax.security.sasl.policy.nodictionary".
+ * {@code "javax.security.sasl.policy.nodictionary"}.
*/
public static final String POLICY_NODICTIONARY =
"javax.security.sasl.policy.nodictionary";
/**
* The name of a property that specifies whether mechanisms that accept
- * anonymous login are not permitted. The property contains "true"
+ * anonymous login are not permitted. The property contains {@code "true"}
* if mechanisms that accept anonymous login are not permitted;
- * "false"
- * if such mechanisms are permitted. The default is "false".
+ * {@code "false"}
+ * if such mechanisms are permitted. The default is {@code "false"}.
*
* The value of this constant is
- * "javax.security.sasl.policy.noanonymous".
+ * {@code "javax.security.sasl.policy.noanonymous"}.
*/
public static final String POLICY_NOANONYMOUS =
"javax.security.sasl.policy.noanonymous";
@@ -237,12 +237,12 @@ public class Sasl {
* means that breaking into one session will not automatically
* provide information for breaking into future sessions.
* The property
- * contains "true" if mechanisms that implement forward secrecy
- * between sessions are required; "false" if such mechanisms
- * are not required. The default is "false".
+ * contains {@code "true"} if mechanisms that implement forward secrecy
+ * between sessions are required; {@code "false"} if such mechanisms
+ * are not required. The default is {@code "false"}.
*
* The value of this constant is
- * "javax.security.sasl.policy.forward".
+ * {@code "javax.security.sasl.policy.forward"}.
*/
public static final String POLICY_FORWARD_SECRECY =
"javax.security.sasl.policy.forward";
@@ -250,12 +250,12 @@ public class Sasl {
/**
* The name of a property that specifies whether
* mechanisms that pass client credentials are required. The property
- * contains "true" if mechanisms that pass
- * client credentials are required; "false"
- * if such mechanisms are not required. The default is "false".
+ * contains {@code "true"} if mechanisms that pass
+ * client credentials are required; {@code "false"}
+ * if such mechanisms are not required. The default is {@code "false"}.
*
* The value of this constant is
- * "javax.security.sasl.policy.credentials".
+ * {@code "javax.security.sasl.policy.credentials"}.
*/
public static final String POLICY_PASS_CREDENTIALS =
"javax.security.sasl.policy.credentials";
@@ -269,38 +269,38 @@ public class Sasl {
* supports delegated authentication.
*
* The value of this constant is
- * "javax.security.sasl.credentials".
+ * {@code "javax.security.sasl.credentials"}.
*/
public static final String CREDENTIALS = "javax.security.sasl.credentials";
/**
- * Creates a SaslClient using the parameters supplied.
+ * Creates a {@code SaslClient} using the parameters supplied.
*
* This method uses the
JCA Security Provider Framework, described in the
* "Java Cryptography Architecture API Specification & Reference", for
- * locating and selecting a SaslClient implementation.
+ * locating and selecting a {@code SaslClient} implementation.
*
* First, it
- * obtains an ordered list of SaslClientFactory instances from
+ * obtains an ordered list of {@code SaslClientFactory} instances from
* the registered security providers for the "SaslClientFactory" service
* and the specified SASL mechanism(s). It then invokes
- * createSaslClient() on each factory instance on the list
- * until one produces a non-null SaslClient instance. It returns
- * the non-null SaslClient instance, or null if the search fails
- * to produce a non-null SaslClient instance.
+ * {@code createSaslClient()} on each factory instance on the list
+ * until one produces a non-null {@code SaslClient} instance. It returns
+ * the non-null {@code SaslClient} instance, or null if the search fails
+ * to produce a non-null {@code SaslClient} instance.
*
* A security provider for SaslClientFactory registers with the
* JCA Security Provider Framework keys of the form
- * SaslClientFactory.mechanism_name
+ * {@code SaslClientFactory.}{@code mechanism_name}
*
* and values that are class names of implementations of
- * javax.security.sasl.SaslClientFactory.
+ * {@code javax.security.sasl.SaslClientFactory}.
*
* For example, a provider that contains a factory class,
- * com.wiz.sasl.digest.ClientFactory, that supports the
+ * {@code com.wiz.sasl.digest.ClientFactory}, that supports the
* "DIGEST-MD5" mechanism would register the following entry with the JCA:
- * SaslClientFactory.DIGEST-MD5 com.wiz.sasl.digest.ClientFactory
+ * {@code SaslClientFactory.DIGEST-MD5 com.wiz.sasl.digest.ClientFactory}
*
* See the
* "Java Cryptography Architecture API Specification & Reference"
@@ -325,9 +325,9 @@ public class Sasl {
* @param props The possibly null set of properties used to
* select the SASL mechanism and to configure the authentication
* exchange of the selected mechanism.
- * For example, if props contains the
- * Sasl.POLICY_NOPLAINTEXT property with the value
- * "true", then the selected
+ * For example, if {@code props} contains the
+ * {@code Sasl.POLICY_NOPLAINTEXT} property with the value
+ * {@code "true"}, then the selected
* SASL mechanism must not be susceptible to simple plain passive attacks.
* In addition to the standard properties declared in this class,
* other, possibly mechanism-specific, properties can be included.
@@ -338,16 +338,16 @@ public class Sasl {
* mechanisms to get further information from the application/library
* to complete the authentication. For example, a SASL mechanism might
* require the authentication ID, password and realm from the caller.
- * The authentication ID is requested by using a NameCallback.
- * The password is requested by using a PasswordCallback.
- * The realm is requested by using a RealmChoiceCallback if there is a list
- * of realms to choose from, and by using a RealmCallback if
+ * The authentication ID is requested by using a {@code NameCallback}.
+ * The password is requested by using a {@code PasswordCallback}.
+ * The realm is requested by using a {@code RealmChoiceCallback} if there is a list
+ * of realms to choose from, and by using a {@code RealmCallback} if
* the realm must be entered.
*
- *@return A possibly null SaslClient created using the parameters
- * supplied. If null, cannot find a SaslClientFactory
+ *@return A possibly null {@code SaslClient} created using the parameters
+ * supplied. If null, cannot find a {@code SaslClientFactory}
* that will produce one.
- *@exception SaslException If cannot create a SaslClient because
+ *@exception SaslException If cannot create a {@code SaslClient} because
* of an error.
*/
public static SaslClient createSaslClient(
@@ -423,34 +423,34 @@ public class Sasl {
/**
- * Creates a SaslServer for the specified mechanism.
+ * Creates a {@code SaslServer} for the specified mechanism.
*
* This method uses the
JCA Security Provider Framework,
* described in the
* "Java Cryptography Architecture API Specification & Reference", for
- * locating and selecting a SaslServer implementation.
+ * locating and selecting a {@code SaslServer} implementation.
*
* First, it
- * obtains an ordered list of SaslServerFactory instances from
+ * obtains an ordered list of {@code SaslServerFactory} instances from
* the registered security providers for the "SaslServerFactory" service
* and the specified mechanism. It then invokes
- * createSaslServer() on each factory instance on the list
- * until one produces a non-null SaslServer instance. It returns
- * the non-null SaslServer instance, or null if the search fails
- * to produce a non-null SaslServer instance.
+ * {@code createSaslServer()} on each factory instance on the list
+ * until one produces a non-null {@code SaslServer} instance. It returns
+ * the non-null {@code SaslServer} instance, or null if the search fails
+ * to produce a non-null {@code SaslServer} instance.
*
* A security provider for SaslServerFactory registers with the
* JCA Security Provider Framework keys of the form
- * SaslServerFactory.mechanism_name
+ * {@code SaslServerFactory.}{@code mechanism_name}
*
* and values that are class names of implementations of
- * javax.security.sasl.SaslServerFactory.
+ * {@code javax.security.sasl.SaslServerFactory}.
*
* For example, a provider that contains a factory class,
- * com.wiz.sasl.digest.ServerFactory, that supports the
+ * {@code com.wiz.sasl.digest.ServerFactory}, that supports the
* "DIGEST-MD5" mechanism would register the following entry with the JCA:
- * SaslServerFactory.DIGEST-MD5 com.wiz.sasl.digest.ServerFactory
+ * {@code SaslServerFactory.DIGEST-MD5 com.wiz.sasl.digest.ServerFactory}
*
* See the
* "Java Cryptography Architecture API Specification & Reference"
@@ -463,14 +463,14 @@ public class Sasl {
* the authentication is being performed (e.g., "ldap").
* @param serverName The fully qualified host name of the server, or null
* if the server is not bound to any specific host name. If the mechanism
- * does not allow an unbound server, a SaslException will
+ * does not allow an unbound server, a {@code SaslException} will
* be thrown.
* @param props The possibly null set of properties used to
* select the SASL mechanism and to configure the authentication
* exchange of the selected mechanism.
- * For example, if props contains the
- * Sasl.POLICY_NOPLAINTEXT property with the value
- * "true", then the selected
+ * For example, if {@code props} contains the
+ * {@code Sasl.POLICY_NOPLAINTEXT} property with the value
+ * {@code "true"}, then the selected
* SASL mechanism must not be susceptible to simple plain passive attacks.
* In addition to the standard properties declared in this class,
* other, possibly mechanism-specific, properties can be included.
@@ -481,16 +481,16 @@ public class Sasl {
* mechanisms to get further information from the application/library
* to complete the authentication. For example, a SASL mechanism might
* require the authentication ID, password and realm from the caller.
- * The authentication ID is requested by using a NameCallback.
- * The password is requested by using a PasswordCallback.
- * The realm is requested by using a RealmChoiceCallback if there is a list
- * of realms to choose from, and by using a RealmCallback if
+ * The authentication ID is requested by using a {@code NameCallback}.
+ * The password is requested by using a {@code PasswordCallback}.
+ * The realm is requested by using a {@code RealmChoiceCallback} if there is a list
+ * of realms to choose from, and by using a {@code RealmCallback} if
* the realm must be entered.
*
- *@return A possibly null SaslServer created using the parameters
- * supplied. If null, cannot find a SaslServerFactory
+ *@return A possibly null {@code SaslServer} created using the parameters
+ * supplied. If null, cannot find a {@code SaslServerFactory}
* that will produce one.
- *@exception SaslException If cannot create a SaslServer because
+ *@exception SaslException If cannot create a {@code SaslServer} because
* of an error.
**/
public static SaslServer
@@ -533,11 +533,11 @@ public class Sasl {
}
/**
- * Gets an enumeration of known factories for producing SaslClient.
+ * Gets an enumeration of known factories for producing {@code SaslClient}.
* This method uses the same algorithm for locating factories as
- * createSaslClient().
+ * {@code createSaslClient()}.
* @return A non-null enumeration of known factories for producing
- * SaslClient.
+ * {@code SaslClient}.
* @see #createSaslClient
*/
public static Enumeration getSaslClientFactories() {
@@ -554,11 +554,11 @@ public class Sasl {
}
/**
- * Gets an enumeration of known factories for producing SaslServer.
+ * Gets an enumeration of known factories for producing {@code SaslServer}.
* This method uses the same algorithm for locating factories as
- * createSaslServer().
+ * {@code createSaslServer()}.
* @return A non-null enumeration of known factories for producing
- * SaslServer.
+ * {@code SaslServer}.
* @see #createSaslServer
*/
public static Enumeration getSaslServerFactories() {
diff --git a/jdk/src/share/classes/javax/security/sasl/SaslClient.java b/jdk/src/share/classes/javax/security/sasl/SaslClient.java
index 10f8d3dc3c2..e6786097228 100644
--- a/jdk/src/share/classes/javax/security/sasl/SaslClient.java
+++ b/jdk/src/share/classes/javax/security/sasl/SaslClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -30,14 +30,14 @@ package javax.security.sasl;
*
* A protocol library such as one for LDAP gets an instance of this
* class in order to perform authentication defined by a specific SASL
- * mechanism. Invoking methods on the SaslClient instance
+ * mechanism. Invoking methods on the {@code SaslClient} instance
* process challenges and create responses according to the SASL
- * mechanism implemented by the SaslClient.
+ * mechanism implemented by the {@code SaslClient}.
* As the authentication proceeds, the instance
* encapsulates the state of a SASL client's authentication exchange.
*
- * Here's an example of how an LDAP library might use a SaslClient.
- * It first gets an instance of a SaslClient:
+ * Here's an example of how an LDAP library might use a {@code SaslClient}.
+ * It first gets an instance of a {@code SaslClient}:
*
*
* If the mechanism has an initial response, the library invokes
- * evaluateChallenge() with an empty
+ * {@code evaluateChallenge()} with an empty
* challenge and to get initial response.
* Protocols such as IMAP4, which do not include an initial response with
* their first authentication command to the server, initiates the
- * authentication without first calling hasInitialResponse()
- * or evaluateChallenge().
+ * authentication without first calling {@code hasInitialResponse()}
+ * or {@code evaluateChallenge()}.
* When the server responds to the command, it sends an initial challenge.
* For a SASL mechanism in which the client sends data first, the server should
* have issued a challenge with no data. This will then result in a call
- * (on the client) to evaluateChallenge() with an empty challenge.
+ * (on the client) to {@code evaluateChallenge()} with an empty challenge.
*
* @since 1.5
*
@@ -107,7 +107,7 @@ public abstract interface SaslClient {
/**
* Determines whether this mechanism has an optional initial response.
- * If true, caller should call evaluateChallenge() with an
+ * If true, caller should call {@code evaluateChallenge()} with an
* empty array to get the initial response.
*
* @return true if this mechanism has an initial response.
@@ -148,22 +148,22 @@ public abstract interface SaslClient {
/**
* Unwraps a byte array received from the server.
* This method can be called only after the authentication exchange has
- * completed (i.e., when isComplete() returns true) and only if
+ * completed (i.e., when {@code isComplete()} returns true) and only if
* the authentication exchange has negotiated integrity and/or privacy
* as the quality of protection; otherwise, an
- * IllegalStateException is thrown.
+ * {@code IllegalStateException} is thrown.
*
- * incoming is the contents of the SASL buffer as defined in RFC 2222
+ * {@code incoming} is the contents of the SASL buffer as defined in RFC 2222
* without the leading four octet field that represents the length.
- * offset and len specify the portion of incoming
+ * {@code offset} and {@code len} specify the portion of {@code incoming}
* to use.
*
* @param incoming A non-null byte array containing the encoded bytes
* from the server.
- * @param offset The starting position at incoming of the bytes to use.
- * @param len The number of bytes from incoming to use.
+ * @param offset The starting position at {@code incoming} of the bytes to use.
+ * @param len The number of bytes from {@code incoming} to use.
* @return A non-null byte array containing the decoded bytes.
- * @exception SaslException if incoming cannot be successfully
+ * @exception SaslException if {@code incoming} cannot be successfully
* unwrapped.
* @exception IllegalStateException if the authentication exchange has
* not completed, or if the negotiated quality of protection
@@ -175,22 +175,22 @@ public abstract interface SaslClient {
/**
* Wraps a byte array to be sent to the server.
* This method can be called only after the authentication exchange has
- * completed (i.e., when isComplete() returns true) and only if
+ * completed (i.e., when {@code isComplete()} returns true) and only if
* the authentication exchange has negotiated integrity and/or privacy
* as the quality of protection; otherwise, an
- * IllegalStateException is thrown.
+ * {@code IllegalStateException} is thrown.
*
* The result of this method will make up the contents of the SASL buffer
* as defined in RFC 2222 without the leading four octet field that
* represents the length.
- * offset and len specify the portion of outgoing
+ * {@code offset} and {@code len} specify the portion of {@code outgoing}
* to use.
*
* @param outgoing A non-null byte array containing the bytes to encode.
- * @param offset The starting position at outgoing of the bytes to use.
- * @param len The number of bytes from outgoing to use.
+ * @param offset The starting position at {@code outgoing} of the bytes to use.
+ * @param len The number of bytes from {@code outgoing} to use.
* @return A non-null byte array containing the encoded bytes.
- * @exception SaslException if outgoing cannot be successfully
+ * @exception SaslException if {@code outgoing} cannot be successfully
* wrapped.
* @exception IllegalStateException if the authentication exchange has
* not completed, or if the negotiated quality of protection
@@ -202,8 +202,8 @@ public abstract interface SaslClient {
/**
* Retrieves the negotiated property.
* This method can be called only after the authentication exchange has
- * completed (i.e., when isComplete() returns true); otherwise, an
- * IllegalStateException is thrown.
+ * completed (i.e., when {@code isComplete()} returns true); otherwise, an
+ * {@code IllegalStateException} is thrown.
*
* @param propName The non-null property name.
* @return The value of the negotiated property. If null, the property was
diff --git a/jdk/src/share/classes/javax/security/sasl/SaslClientFactory.java b/jdk/src/share/classes/javax/security/sasl/SaslClientFactory.java
index e32b34cc0d6..731ed6f1121 100644
--- a/jdk/src/share/classes/javax/security/sasl/SaslClientFactory.java
+++ b/jdk/src/share/classes/javax/security/sasl/SaslClientFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -29,16 +29,16 @@ import java.util.Map;
import javax.security.auth.callback.CallbackHandler;
/**
- * An interface for creating instances of SaslClient.
+ * An interface for creating instances of {@code SaslClient}.
* A class that implements this interface
* must be thread-safe and handle multiple simultaneous
* requests. It must also have a public constructor that accepts no
* argument.
*
* This interface is not normally accessed directly by a client, which will use the
- * Sasl static methods
+ * {@code Sasl} static methods
* instead. However, a particular environment may provide and install a
- * new or different SaslClientFactory.
+ * new or different {@code SaslClientFactory}.
*
* @since 1.5
*
@@ -66,7 +66,7 @@ public abstract interface SaslClientFactory {
* of the server to authenticate to.
* @param props The possibly null set of properties used to select the SASL
* mechanism and to configure the authentication exchange of the selected
- * mechanism. See the Sasl class for a list of standard properties.
+ * mechanism. See the {@code Sasl} class for a list of standard properties.
* Other, possibly mechanism-specific, properties can be included.
* Properties not relevant to the selected mechanism are ignored,
* including any map entries with non-String keys.
@@ -75,16 +75,16 @@ public abstract interface SaslClientFactory {
* mechanisms to get further information from the application/library
* to complete the authentication. For example, a SASL mechanism might
* require the authentication ID, password and realm from the caller.
- * The authentication ID is requested by using a NameCallback.
- * The password is requested by using a PasswordCallback.
- * The realm is requested by using a RealmChoiceCallback if there is a list
- * of realms to choose from, and by using a RealmCallback if
+ * The authentication ID is requested by using a {@code NameCallback}.
+ * The password is requested by using a {@code PasswordCallback}.
+ * The realm is requested by using a {@code RealmChoiceCallback} if there is a list
+ * of realms to choose from, and by using a {@code RealmCallback} if
* the realm must be entered.
*
- *@return A possibly null SaslClient created using the parameters
- * supplied. If null, this factory cannot produce a SaslClient
+ *@return A possibly null {@code SaslClient} created using the parameters
+ * supplied. If null, this factory cannot produce a {@code SaslClient}
* using the parameters supplied.
- *@exception SaslException If cannot create a SaslClient because
+ *@exception SaslException If cannot create a {@code SaslClient} because
* of an error.
*/
public abstract SaslClient createSaslClient(
@@ -99,12 +99,12 @@ public abstract interface SaslClientFactory {
* Returns an array of names of mechanisms that match the specified
* mechanism selection policies.
* @param props The possibly null set of properties used to specify the
- * security policy of the SASL mechanisms. For example, if props
- * contains the Sasl.POLICY_NOPLAINTEXT property with the value
- * "true", then the factory must not return any SASL mechanisms
+ * security policy of the SASL mechanisms. For example, if {@code props}
+ * contains the {@code Sasl.POLICY_NOPLAINTEXT} property with the value
+ * {@code "true"}, then the factory must not return any SASL mechanisms
* that are susceptible to simple plain passive attacks.
- * See the Sasl class for a complete list of policy properties.
- * Non-policy related properties, if present in props, are ignored,
+ * See the {@code Sasl} class for a complete list of policy properties.
+ * Non-policy related properties, if present in {@code props}, are ignored,
* including any map entries with non-String keys.
* @return A non-null array containing a IANA-registered SASL mechanism names.
*/
diff --git a/jdk/src/share/classes/javax/security/sasl/SaslException.java b/jdk/src/share/classes/javax/security/sasl/SaslException.java
index ee82c6ea8c7..87fed3cec58 100644
--- a/jdk/src/share/classes/javax/security/sasl/SaslException.java
+++ b/jdk/src/share/classes/javax/security/sasl/SaslException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -45,7 +45,7 @@ public class SaslException extends IOException {
private Throwable _exception;
/**
- * Constructs a new instance of SaslException.
+ * Constructs a new instance of {@code SaslException}.
* The root exception and the detailed message are null.
*/
public SaslException () {
@@ -53,7 +53,7 @@ public class SaslException extends IOException {
}
/**
- * Constructs a new instance of SaslException with a detailed message.
+ * Constructs a new instance of {@code SaslException} with a detailed message.
* The root exception is null.
* @param detail A possibly null string containing details of the exception.
*
@@ -64,7 +64,7 @@ public class SaslException extends IOException {
}
/**
- * Constructs a new instance of SaslException with a detailed message
+ * Constructs a new instance of {@code SaslException} with a detailed message
* and a root exception.
* For example, a SaslException might result from a problem with
* the callback handler, which might throw a NoSuchCallbackException if
diff --git a/jdk/src/share/classes/javax/security/sasl/SaslServer.java b/jdk/src/share/classes/javax/security/sasl/SaslServer.java
index ec5d20a230d..818ae999654 100644
--- a/jdk/src/share/classes/javax/security/sasl/SaslServer.java
+++ b/jdk/src/share/classes/javax/security/sasl/SaslServer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -30,14 +30,14 @@ package javax.security.sasl;
*
* A server such an LDAP server gets an instance of this
* class in order to perform authentication defined by a specific SASL
- * mechanism. Invoking methods on the SaslServer instance
+ * mechanism. Invoking methods on the {@code SaslServer} instance
* generates challenges according to the SASL
- * mechanism implemented by the SaslServer.
+ * mechanism implemented by the {@code SaslServer}.
* As the authentication proceeds, the instance
* encapsulates the state of a SASL server's authentication exchange.
*
- * Here's an example of how an LDAP server might use a SaslServer.
- * It first gets an instance of a SaslServer for the SASL mechanism
+ * Here's an example of how an LDAP server might use a {@code SaslServer}.
+ * It first gets an instance of a {@code SaslServer} for the SASL mechanism
* requested by the client:
*
* SaslServer ss = Sasl.createSaslServer(mechanism,
@@ -104,8 +104,8 @@ public abstract interface SaslServer {
* to the client. It is non-null if the authentication must be continued
* by sending a challenge to the client, or if the authentication has
* succeeded but challenge data needs to be processed by the client.
- * isComplete() should be called
- * after each call to evaluateResponse(),to determine if any further
+ * {@code isComplete()} should be called
+ * after each call to {@code evaluateResponse()},to determine if any further
* response is needed from the client.
*
* @param response The non-null (but possibly empty) response sent
@@ -123,7 +123,7 @@ public abstract interface SaslServer {
/**
* Determines whether the authentication exchange has completed.
* This method is typically called after each invocation of
- * evaluateResponse() to determine whether the
+ * {@code evaluateResponse()} to determine whether the
* authentication has completed successfully or should be continued.
* @return true if the authentication exchange has completed; false otherwise.
*/
@@ -141,22 +141,22 @@ public abstract interface SaslServer {
/**
* Unwraps a byte array received from the client.
* This method can be called only after the authentication exchange has
- * completed (i.e., when isComplete() returns true) and only if
+ * completed (i.e., when {@code isComplete()} returns true) and only if
* the authentication exchange has negotiated integrity and/or privacy
* as the quality of protection; otherwise,
- * an IllegalStateException is thrown.
+ * an {@code IllegalStateException} is thrown.
*
- * incoming is the contents of the SASL buffer as defined in RFC 2222
+ * {@code incoming} is the contents of the SASL buffer as defined in RFC 2222
* without the leading four octet field that represents the length.
- * offset and len specify the portion of incoming
+ * {@code offset} and {@code len} specify the portion of {@code incoming}
* to use.
*
* @param incoming A non-null byte array containing the encoded bytes
* from the client.
- * @param offset The starting position at incoming of the bytes to use.
- * @param len The number of bytes from incoming to use.
+ * @param offset The starting position at {@code incoming} of the bytes to use.
+ * @param len The number of bytes from {@code incoming} to use.
* @return A non-null byte array containing the decoded bytes.
- * @exception SaslException if incoming cannot be successfully
+ * @exception SaslException if {@code incoming} cannot be successfully
* unwrapped.
* @exception IllegalStateException if the authentication exchange has
* not completed, or if the negotiated quality of protection
@@ -168,21 +168,21 @@ public abstract interface SaslServer {
/**
* Wraps a byte array to be sent to the client.
* This method can be called only after the authentication exchange has
- * completed (i.e., when isComplete() returns true) and only if
+ * completed (i.e., when {@code isComplete()} returns true) and only if
* the authentication exchange has negotiated integrity and/or privacy
- * as the quality of protection; otherwise, a SaslException is thrown.
+ * as the quality of protection; otherwise, a {@code SaslException} is thrown.
*
* The result of this method
* will make up the contents of the SASL buffer as defined in RFC 2222
* without the leading four octet field that represents the length.
- * offset and len specify the portion of outgoing
+ * {@code offset} and {@code len} specify the portion of {@code outgoing}
* to use.
*
* @param outgoing A non-null byte array containing the bytes to encode.
- * @param offset The starting position at outgoing of the bytes to use.
- * @param len The number of bytes from outgoing to use.
+ * @param offset The starting position at {@code outgoing} of the bytes to use.
+ * @param len The number of bytes from {@code outgoing} to use.
* @return A non-null byte array containing the encoded bytes.
- * @exception SaslException if outgoing cannot be successfully
+ * @exception SaslException if {@code outgoing} cannot be successfully
* wrapped.
* @exception IllegalStateException if the authentication exchange has
* not completed, or if the negotiated quality of protection has
@@ -194,8 +194,8 @@ public abstract interface SaslServer {
/**
* Retrieves the negotiated property.
* This method can be called only after the authentication exchange has
- * completed (i.e., when isComplete() returns true); otherwise, an
- * IllegalStateException is thrown.
+ * completed (i.e., when {@code isComplete()} returns true); otherwise, an
+ * {@code IllegalStateException} is thrown.
*
* @param propName the property
* @return The value of the negotiated property. If null, the property was
diff --git a/jdk/src/share/classes/javax/security/sasl/SaslServerFactory.java b/jdk/src/share/classes/javax/security/sasl/SaslServerFactory.java
index 33a01750165..baa8999634d 100644
--- a/jdk/src/share/classes/javax/security/sasl/SaslServerFactory.java
+++ b/jdk/src/share/classes/javax/security/sasl/SaslServerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -29,16 +29,16 @@ import java.util.Map;
import javax.security.auth.callback.CallbackHandler;
/**
- * An interface for creating instances of SaslServer.
+ * An interface for creating instances of {@code SaslServer}.
* A class that implements this interface
* must be thread-safe and handle multiple simultaneous
* requests. It must also have a public constructor that accepts no
* argument.
*
* This interface is not normally accessed directly by a server, which will use the
- * Sasl static methods
+ * {@code Sasl} static methods
* instead. However, a particular environment may provide and install a
- * new or different SaslServerFactory.
+ * new or different {@code SaslServerFactory}.
*
* @since 1.5
*
@@ -50,10 +50,10 @@ import javax.security.auth.callback.CallbackHandler;
*/
public abstract interface SaslServerFactory {
/**
- * Creates a SaslServer using the parameters supplied.
+ * Creates a {@code SaslServer} using the parameters supplied.
* It returns null
- * if no SaslServer can be created using the parameters supplied.
- * Throws SaslException if it cannot create a SaslServer
+ * if no {@code SaslServer} can be created using the parameters supplied.
+ * Throws {@code SaslException} if it cannot create a {@code SaslServer}
* because of an error.
*
* @param mechanism The non-null
@@ -63,10 +63,10 @@ public abstract interface SaslServerFactory {
* @param serverName The fully qualified host name of the server to
* authenticate to, or null if the server is not bound to any specific host
* name. If the mechanism does not allow an unbound server, a
- * SaslException will be thrown.
+ * {@code SaslException} will be thrown.
* @param props The possibly null set of properties used to select the SASL
* mechanism and to configure the authentication exchange of the selected
- * mechanism. See the Sasl class for a list of standard properties.
+ * mechanism. See the {@code Sasl} class for a list of standard properties.
* Other, possibly mechanism-specific, properties can be included.
* Properties not relevant to the selected mechanism are ignored,
* including any map entries with non-String keys.
@@ -75,16 +75,16 @@ public abstract interface SaslServerFactory {
* mechanisms to get further information from the application/library
* to complete the authentication. For example, a SASL mechanism might
* require the authentication ID, password and realm from the caller.
- * The authentication ID is requested by using a NameCallback.
- * The password is requested by using a PasswordCallback.
- * The realm is requested by using a RealmChoiceCallback if there is a list
- * of realms to choose from, and by using a RealmCallback if
+ * The authentication ID is requested by using a {@code NameCallback}.
+ * The password is requested by using a {@code PasswordCallback}.
+ * The realm is requested by using a {@code RealmChoiceCallback} if there is a list
+ * of realms to choose from, and by using a {@code RealmCallback} if
* the realm must be entered.
*
- *@return A possibly null SaslServer created using the parameters
- * supplied. If null, this factory cannot produce a SaslServer
+ *@return A possibly null {@code SaslServer} created using the parameters
+ * supplied. If null, this factory cannot produce a {@code SaslServer}
* using the parameters supplied.
- *@exception SaslException If cannot create a SaslServer because
+ *@exception SaslException If cannot create a {@code SaslServer} because
* of an error.
*/
public abstract SaslServer createSaslServer(
@@ -98,12 +98,12 @@ public abstract interface SaslServerFactory {
* Returns an array of names of mechanisms that match the specified
* mechanism selection policies.
* @param props The possibly null set of properties used to specify the
- * security policy of the SASL mechanisms. For example, if props
- * contains the Sasl.POLICY_NOPLAINTEXT property with the value
- * "true", then the factory must not return any SASL mechanisms
+ * security policy of the SASL mechanisms. For example, if {@code props}
+ * contains the {@code Sasl.POLICY_NOPLAINTEXT} property with the value
+ * {@code "true"}, then the factory must not return any SASL mechanisms
* that are susceptible to simple plain passive attacks.
- * See the Sasl class for a complete list of policy properties.
- * Non-policy related properties, if present in props, are ignored,
+ * See the {@code Sasl} class for a complete list of policy properties.
+ * Non-policy related properties, if present in {@code props}, are ignored,
* including any map entries with non-String keys.
* @return A non-null array containing a IANA-registered SASL mechanism names.
*/
diff --git a/jdk/src/share/classes/javax/security/sasl/package-info.java b/jdk/src/share/classes/javax/security/sasl/package-info.java
new file mode 100644
index 00000000000..f8e42b7120c
--- /dev/null
+++ b/jdk/src/share/classes/javax/security/sasl/package-info.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 1999, 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.
+ */
+
+/**
+ * Contains class and interfaces for supporting SASL.
+ *
+ * This package defines classes and interfaces for SASL mechanisms.
+ * It is used by developers to add authentication support for
+ * connection-based protocols that use SASL.
+ *
+ *
SASL Overview
+ *
+ * Simple Authentication and Security Layer (SASL) specifies a
+ * challenge-response protocol in which data is exchanged between the
+ * client and the server for the purposes of
+ * authentication and (optional) establishment of a security layer on
+ * which to carry on subsequent communications. It is used with
+ * connection-based protocols such as LDAPv3 or IMAPv4. SASL is
+ * described in
+ * RFC 2222.
+ *
+ *
+ * There are various mechanisms defined for SASL.
+ * Each mechanism defines the data that must be exchanged between the
+ * client and server in order for the authentication to succeed.
+ * This data exchange required for a particular mechanism is referred to
+ * to as its protocol profile.
+ * The following are some examples of mechanisms that have been defined by
+ * the Internet standards community.
+ *
+ *
DIGEST-MD5 (RFC 2831).
+ * This mechanism defines how HTTP Digest Authentication can be used as a SASL
+ * mechanism.
+ *
Anonymous (RFC 2245).
+ * This mechanism is anonymous authentication in which no credentials are
+ * necessary.
+ *
External (RFC 2222).
+ * This mechanism obtains authentication information
+ * from an external source (such as TLS or IPsec).
+ *
S/Key (RFC 2222).
+ * This mechanism uses the MD4 digest algorithm to exchange data based on
+ * a shared secret.
+ *
GSSAPI (RFC 2222).
+ * This mechanism uses the
+ * GSSAPI
+ * for obtaining authentication information.
+ *
+ *
+ * Some of these mechanisms provide both authentication and establishment
+ * of a security layer, others only authentication. Anonymous and
+ * S/Key do not provide for any security layers. GSSAPI and DIGEST-MD5
+ * allow negotiation of the security layer. For External, the
+ * security layer is determined by the external protocol.
+ *
+ *
Usage
+ *
+ * Users of this API are typically developers who produce
+ * client library implementations for connection-based protocols,
+ * such as LDAPv3 and IMAPv4,
+ * and developers who write servers (such as LDAP servers and IMAP servers).
+ * Developers who write client libraries use the
+ * {@code SaslClient} and {@code SaslClientFactory} interfaces.
+ * Developers who write servers use the
+ * {@code SaslServer} and {@code SaslServerFactory} interfaces.
+ *
+ * Among these two groups of users, each can be further divided into two groups:
+ * those who produce the SASL mechanisms and those
+ * who use the SASL mechanisms.
+ * The producers of SASL mechanisms need to provide implementations
+ * for these interfaces, while users of the SASL mechanisms use
+ * the APIs in this package to access those implementations.
+ *
+ *
Related Documentation
+ *
+ * Please refer to the
+ * Java
+ * SASL Programming Guide for information on how to use this API.
+ *
+ * @since 1.5
+ */
+package javax.security.sasl;
diff --git a/jdk/src/share/classes/javax/security/sasl/package.html b/jdk/src/share/classes/javax/security/sasl/package.html
deleted file mode 100644
index cf497ebe380..00000000000
--- a/jdk/src/share/classes/javax/security/sasl/package.html
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
-
-
-
-
-
-Contains class and interfaces for supporting SASL.
-
-This package defines classes and interfaces for SASL mechanisms.
-It is used by developers to add authentication support for
-connection-based protocols that use SASL.
-
-
SASL Overview
-
-
-Simple Authentication and Security Layer (SASL) specifies a
-challenge-response protocol in which data is exchanged between the
-client and the server for the purposes of
-authentication and (optional) establishment of a security layer on
-which to carry on subsequent communications. It is used with
-connection-based protocols such as LDAPv3 or IMAPv4. SASL is
-described in
-RFC 2222.
-
-
-There are various mechanisms defined for SASL.
-Each mechanism defines the data that must be exchanged between the
-client and server in order for the authentication to succeed.
-This data exchange required for a particular mechanism is referred to
-to as its protocol profile.
-The following are some examples of mechanims that have been defined by
-the Internet standards community.
-
-
DIGEST-MD5 (RFC 2831).
-This mechanism defines how HTTP Digest Authentication can be used as a SASL
-mechanism.
-
Anonymous (RFC 2245).
-This mechamism is anonymous authentication in which no credentials are
-necessary.
-
External (RFC 2222).
-This mechanism obtains authentication information
-from an external source (such as TLS or IPsec).
-
S/Key (RFC 2222).
-This mechanism uses the MD4 digest algorithm to exchange data based on
-a shared secret.
-
-Some of these mechanisms provide both authentication and establishment
-of a security layer, others only authentication. Anonymous and
-S/Key do not provide for any security layers. GSSAPI and DIGEST-MD5
-allow negotiation of the security layer. For External, the
-security layer is determined by the external protocol.
-
-
Usage
-
-
-Users of this API are typically developers who produce
-client library implementations for connection-based protocols,
-such as LDAPv3 and IMAPv4,
-and developers who write servers (such as LDAP servers and IMAP servers).
-Developers who write client libraries use the
-SaslClient and SaslClientFactory interfaces.
-Developers who write servers use the
-SaslServer and SaslServerFactory interfaces.
-
-Among these two groups of users, each can be further divided into two groups:
-those who produce the SASL mechanisms and those
-who use the SASL mechanisms.
-The producers of SASL mechanisms need to provide implementations
-for these interfaces, while users of the SASL mechanisms use
-the APIs in this package to access those implementations.
-
-
Related Documentation
-
-Please refer to the
-Java
-SASL Programming Guide for information on how to use this API.
-
-
-@since 1.5
-
-
-
-
-
From 3c5d7e26d15fce1d15407b9a7673f72ee2499bec Mon Sep 17 00:00:00 2001
From: Jason Uh
Date: Thu, 18 Jul 2013 10:49:08 -0700
Subject: [PATCH 090/101] 8020426: Fix doclint accessibility issues in java.io
Reviewed-by: mduigou, darcy, chegar
---
jdk/src/share/classes/java/io/DataInput.java | 131 ++++++------------
jdk/src/share/classes/java/io/File.java | 2 +-
.../classes/java/io/ObjectStreamField.java | 4 +-
.../classes/java/io/RandomAccessFile.java | 2 +-
4 files changed, 48 insertions(+), 91 deletions(-)
diff --git a/jdk/src/share/classes/java/io/DataInput.java b/jdk/src/share/classes/java/io/DataInput.java
index 4dad59d55f3..58a3a2bfd3f 100644
--- a/jdk/src/share/classes/java/io/DataInput.java
+++ b/jdk/src/share/classes/java/io/DataInput.java
@@ -48,132 +48,87 @@ package java.io;
* may be thrown if the input stream has been
* closed.
*
- *
* Implementations of the DataInput and DataOutput interfaces represent
* Unicode strings in a format that is a slight modification of UTF-8.
* (For information regarding the standard UTF-8 format, see section
* 3.9 Unicode Encoding Forms of The Unicode Standard, Version
* 4.0).
- * Note that in the following tables, the most significant bit appears in the
+ * Note that in the following table, the most significant bit appears in the
* far left-hand column.
- *
- * All characters in the range {@code '\u005Cu0001'} to
- * {@code '\u005Cu007F'} are represented by a single byte:
*
*
- *
*
+ *
+ * All characters in the range {@code '\u005Cu0001'} to
+ * {@code '\u005Cu007F'} are represented by a single byte:
+ *
+ *
*
- *
Bit Values
+ *
Bit Values
*
*
*
Byte 1
- *
- *
- *
- *
0
- *
bits 6-0
- *
- *
- *
+ *
0
+ *
bits 6-0
+ *
+ *
+ *
+ * The null character {@code '\u005Cu0000'} and characters
+ * in the range {@code '\u005Cu0080'} to {@code '\u005Cu07FF'} are
+ * represented by a pair of bytes:
*
- *
- *
- *
- *
- * The null character {@code '\u005Cu0000'} and characters in the
- * range {@code '\u005Cu0080'} to {@code '\u005Cu07FF'} are
- * represented by a pair of bytes:
- *
- *
- *
*
*
- *
Bit Values
+ *
Bit Values
*
*
*
Byte 1
- *
- *
- *
- *
1
- *
1
- *
0
- *
bits 10-6
- *
- *
- *
+ *
1
+ *
1
+ *
0
+ *
bits 10-6
*
*
*
Byte 2
- *
- *
- *
- *
1
- *
0
- *
bits 5-0
- *
- *
- *
+ *
1
+ *
0
+ *
bits 5-0
+ *
+ *
+ *
+ * {@code char} values in the range {@code '\u005Cu0800'}
+ * to {@code '\u005CuFFFF'} are represented by three bytes:
*
- *
- *
- *
- *
- * {@code char} values in the range {@code '\u005Cu0800'} to
- * {@code '\u005CuFFFF'} are represented by three bytes:
- *
- *
- *
*
*
- *
Bit Values
+ *
Bit Values
*
*
*
Byte 1
- *
- *
- *
- *
1
- *
1
- *
1
- *
0
- *
bits 15-12
- *
- *
- *
+ *
1
+ *
1
+ *
1
+ *
0
+ *
bits 15-12
*
*
*
Byte 2
- *
- *
- *
- *
1
- *
0
- *
bits 11-6
- *
- *
- *
+ *
1
+ *
0
+ *
bits 11-6
*
*
*
Byte 3
- *
- *
- *
- *
1
- *
0
- *
bits 5-0
- *
- *
- *
+ *
1
+ *
0
+ *
bits 5-0
*
*
- *
- *
+ *
*
* The differences between this format and the
* standard UTF-8 format are the following:
diff --git a/jdk/src/share/classes/java/io/File.java b/jdk/src/share/classes/java/io/File.java
index 6bab9bb21fe..f11530d2f67 100644
--- a/jdk/src/share/classes/java/io/File.java
+++ b/jdk/src/share/classes/java/io/File.java
@@ -129,7 +129,7 @@ import sun.security.action.GetPropertyAction;
* created, the abstract pathname represented by a File object
* will never change.
*
- *
Interoperability with {@code java.nio.file} package
+ *
Interoperability with {@code java.nio.file} package
*
*
The {@code java.nio.file}
* package defines interfaces and classes for the Java virtual machine to access
diff --git a/jdk/src/share/classes/java/io/ObjectStreamField.java b/jdk/src/share/classes/java/io/ObjectStreamField.java
index ceae3fd188e..981e4ba8ca2 100644
--- a/jdk/src/share/classes/java/io/ObjectStreamField.java
+++ b/jdk/src/share/classes/java/io/ObjectStreamField.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -240,6 +240,8 @@ public class ObjectStreamField
* Returns boolean value indicating whether or not the serializable field
* represented by this ObjectStreamField instance is unshared.
*
+ * @return {@code true} if this field is unshared
+ *
* @since 1.4
*/
public boolean isUnshared() {
diff --git a/jdk/src/share/classes/java/io/RandomAccessFile.java b/jdk/src/share/classes/java/io/RandomAccessFile.java
index 5e32ad5dba1..440cd225c80 100644
--- a/jdk/src/share/classes/java/io/RandomAccessFile.java
+++ b/jdk/src/share/classes/java/io/RandomAccessFile.java
@@ -128,7 +128,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* meanings are:
*
*
* This checks if this instant can be queried for the specified field.
- * If false, then calling the {@link #range(TemporalField) range} and
- * {@link #get(TemporalField) get} methods will throw an exception.
+ * If false, then calling the {@link #range(TemporalField) range},
+ * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+ * methods will throw an exception.
*
* If the field is a {@link ChronoField} then the query is implemented here.
* The supported fields are:
@@ -447,6 +449,44 @@ public final class Instant
return field != null && field.isSupportedBy(this);
}
+ /**
+ * Checks if the specified unit is supported.
+ *
+ * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * If false, then calling the {@link #plus(long, TemporalUnit)} and
+ * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+ *
+ * If the unit is a {@link ChronoUnit} then the query is implemented here.
+ * The supported units are:
+ *
+ *
{@code NANOS}
+ *
{@code MICROS}
+ *
{@code MILLIS}
+ *
{@code SECONDS}
+ *
{@code MINUTES}
+ *
{@code HOURS}
+ *
{@code HALF_DAYS}
+ *
{@code DAYS}
+ *
+ * All other {@code ChronoUnit} instances will return false.
+ *
+ * If the unit is not a {@code ChronoUnit}, then the result of this method
+ * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+ * passing {@code this} as the argument.
+ * Whether the unit is supported is determined by the unit.
+ *
+ * @param unit the unit to check, null returns false
+ * @return true if the unit can be added/subtracted, false if not
+ */
+ @Override
+ public boolean isSupported(TemporalUnit unit) {
+ if (unit instanceof ChronoUnit) {
+ return unit.isTimeBased() || unit == DAYS;
+ }
+ return unit != null && unit.isSupportedBy(this);
+ }
+
+ //-----------------------------------------------------------------------
/**
* Gets the range of valid values for the specified field.
*
@@ -511,7 +551,7 @@ public final class Instant
case MILLI_OF_SECOND: return nanos / 1000_000;
case INSTANT_SECONDS: INSTANT_SECONDS.checkValidIntValue(seconds);
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return range(field).checkValidIntValue(field.getFrom(this), field);
}
@@ -548,7 +588,7 @@ public final class Instant
case MILLI_OF_SECOND: return nanos / 1000_000;
case INSTANT_SECONDS: return seconds;
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.getFrom(this);
}
@@ -665,7 +705,7 @@ public final class Instant
case NANO_OF_SECOND: return (newValue != nanos ? create(seconds, (int) newValue) : this);
case INSTANT_SECONDS: return (newValue != seconds ? create(newValue, nanos) : this);
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.adjustInto(this, newValue);
}
@@ -807,7 +847,7 @@ public final class Instant
case HALF_DAYS: return plusSeconds(Math.multiplyExact(amountToAdd, SECONDS_PER_DAY / 2));
case DAYS: return plusSeconds(Math.multiplyExact(amountToAdd, SECONDS_PER_DAY));
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.addTo(this, amountToAdd);
}
@@ -1053,14 +1093,14 @@ public final class Instant
* complete units between the two instants.
* The {@code Temporal} passed to this method must be an {@code Instant}.
* For example, the amount in days between two dates can be calculated
- * using {@code startInstant.periodUntil(endInstant, SECONDS)}.
+ * using {@code startInstant.until(endInstant, SECONDS)}.
*
* There are two equivalent ways of using this method.
* The first is to invoke this method.
* The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
*
* // these two lines are equivalent
- * amount = start.periodUntil(end, SECONDS);
+ * amount = start.until(end, SECONDS);
* amount = SECONDS.between(start, end);
*
* The choice should be made based on which makes the code more readable.
@@ -1085,7 +1125,7 @@ public final class Instant
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
- public long periodUntil(Temporal endInstant, TemporalUnit unit) {
+ public long until(Temporal endInstant, TemporalUnit unit) {
if (endInstant instanceof Instant == false) {
Objects.requireNonNull(endInstant, "endInstant");
throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -1103,7 +1143,7 @@ public final class Instant
case HALF_DAYS: return secondsUntil(end) / (12 * SECONDS_PER_HOUR);
case DAYS: return secondsUntil(end) / (SECONDS_PER_DAY);
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.between(this, endInstant);
}
diff --git a/jdk/src/share/classes/java/time/LocalDate.java b/jdk/src/share/classes/java/time/LocalDate.java
index ede6d8326b9..d96f5b1fd1e 100644
--- a/jdk/src/share/classes/java/time/LocalDate.java
+++ b/jdk/src/share/classes/java/time/LocalDate.java
@@ -127,7 +127,7 @@ import java.util.Objects;
* @since 1.8
*/
public final class LocalDate
- implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable {
+ implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable {
/**
* The minimum supported {@code LocalDate}, '-999999999-01-01'.
@@ -466,8 +466,9 @@ public final class LocalDate
* Checks if the specified field is supported.
*
* This checks if this date can be queried for the specified field.
- * If false, then calling the {@link #range(TemporalField) range} and
- * {@link #get(TemporalField) get} methods will throw an exception.
+ * If false, then calling the {@link #range(TemporalField) range},
+ * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+ * methods will throw an exception.
*
* If the field is a {@link ChronoField} then the query is implemented here.
* The supported fields are:
@@ -501,6 +502,41 @@ public final class LocalDate
return ChronoLocalDate.super.isSupported(field);
}
+ /**
+ * Checks if the specified unit is supported.
+ *
+ * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * If false, then calling the {@link #plus(long, TemporalUnit)} and
+ * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+ *
+ * If the unit is a {@link ChronoUnit} then the query is implemented here.
+ * The supported units are:
+ *
+ *
{@code DAYS}
+ *
{@code WEEKS}
+ *
{@code MONTHS}
+ *
{@code YEARS}
+ *
{@code DECADES}
+ *
{@code CENTURIES}
+ *
{@code MILLENNIA}
+ *
{@code ERAS}
+ *
+ * All other {@code ChronoUnit} instances will return false.
+ *
+ * If the unit is not a {@code ChronoUnit}, then the result of this method
+ * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+ * passing {@code this} as the argument.
+ * Whether the unit is supported is determined by the unit.
+ *
+ * @param unit the unit to check, null returns false
+ * @return true if the unit can be added/subtracted, false if not
+ */
+ @Override // override for Javadoc
+ public boolean isSupported(TemporalUnit unit) {
+ return ChronoLocalDate.super.isSupported(unit);
+ }
+
+ //-----------------------------------------------------------------------
/**
* Gets the range of valid values for the specified field.
*
@@ -538,7 +574,7 @@ public final class LocalDate
}
return field.range();
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.rangeRefinedBy(this);
}
@@ -631,7 +667,7 @@ public final class LocalDate
case YEAR: return year;
case ERA: return (year >= 1 ? 1 : 0);
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
private long getProlepticMonth() {
@@ -988,7 +1024,7 @@ public final class LocalDate
case YEAR: return withYear((int) newValue);
case ERA: return (getLong(ERA) == newValue ? this : withYear(1 - year));
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.adjustInto(this, newValue);
}
@@ -1187,7 +1223,7 @@ public final class LocalDate
case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd));
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.addTo(this, amountToAdd);
}
@@ -1497,7 +1533,7 @@ public final class LocalDate
* The result will be negative if the end is before the start.
* The {@code Temporal} passed to this method must be a {@code LocalDate}.
* For example, the amount in days between two dates can be calculated
- * using {@code startDate.periodUntil(endDate, DAYS)}.
+ * using {@code startDate.until(endDate, DAYS)}.
*
* The calculation returns a whole number, representing the number of
* complete units between the two dates.
@@ -1509,7 +1545,7 @@ public final class LocalDate
* The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
*
* // these two lines are equivalent
- * amount = start.periodUntil(end, MONTHS);
+ * amount = start.until(end, MONTHS);
* amount = MONTHS.between(start, end);
*
* The choice should be made based on which makes the code more readable.
@@ -1534,7 +1570,7 @@ public final class LocalDate
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
- public long periodUntil(Temporal endDate, TemporalUnit unit) {
+ public long until(Temporal endDate, TemporalUnit unit) {
Objects.requireNonNull(unit, "unit");
if (endDate instanceof LocalDate == false) {
Objects.requireNonNull(endDate, "endDate");
@@ -1552,7 +1588,7 @@ public final class LocalDate
case MILLENNIA: return monthsUntil(end) / 12000;
case ERAS: return end.getLong(ERA) - getLong(ERA);
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.between(this, endDate);
}
@@ -1591,7 +1627,7 @@ public final class LocalDate
* The second is to use {@link Period#between(LocalDate, LocalDate)}:
*
* // these two lines are equivalent
- * period = start.periodUntil(end);
+ * period = start.until(end);
* period = Period.between(start, end);
*
* The choice should be made based on which makes the code more readable.
@@ -1600,7 +1636,7 @@ public final class LocalDate
* @return the period between this date and the end date, not null
*/
@Override
- public Period periodUntil(ChronoLocalDate> endDate) {
+ public Period until(ChronoLocalDate endDate) {
LocalDate end = LocalDate.from(endDate);
long totalMonths = end.getProlepticMonth() - this.getProlepticMonth(); // safe
int days = end.day - this.day;
@@ -1803,7 +1839,7 @@ public final class LocalDate
* @return the comparator value, negative if less, positive if greater
*/
@Override // override for Javadoc and performance
- public int compareTo(ChronoLocalDate> other) {
+ public int compareTo(ChronoLocalDate other) {
if (other instanceof LocalDate) {
return compareTo0((LocalDate) other);
}
@@ -1843,7 +1879,7 @@ public final class LocalDate
* @return true if this date is after the specified date
*/
@Override // override for Javadoc and performance
- public boolean isAfter(ChronoLocalDate> other) {
+ public boolean isAfter(ChronoLocalDate other) {
if (other instanceof LocalDate) {
return compareTo0((LocalDate) other) > 0;
}
@@ -1872,7 +1908,7 @@ public final class LocalDate
* @return true if this date is before the specified date
*/
@Override // override for Javadoc and performance
- public boolean isBefore(ChronoLocalDate> other) {
+ public boolean isBefore(ChronoLocalDate other) {
if (other instanceof LocalDate) {
return compareTo0((LocalDate) other) < 0;
}
@@ -1901,7 +1937,7 @@ public final class LocalDate
* @return true if this date is equal to the specified date
*/
@Override // override for Javadoc and performance
- public boolean isEqual(ChronoLocalDate> other) {
+ public boolean isEqual(ChronoLocalDate other) {
if (other instanceof LocalDate) {
return compareTo0((LocalDate) other) == 0;
}
diff --git a/jdk/src/share/classes/java/time/LocalDateTime.java b/jdk/src/share/classes/java/time/LocalDateTime.java
index 6e6c87bc2ff..d68d6f52537 100644
--- a/jdk/src/share/classes/java/time/LocalDateTime.java
+++ b/jdk/src/share/classes/java/time/LocalDateTime.java
@@ -515,8 +515,9 @@ public final class LocalDateTime
* Checks if the specified field is supported.
*
* This checks if this date-time can be queried for the specified field.
- * If false, then calling the {@link #range(TemporalField) range} and
- * {@link #get(TemporalField) get} methods will throw an exception.
+ * If false, then calling the {@link #range(TemporalField) range},
+ * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+ * methods will throw an exception.
*
* If the field is a {@link ChronoField} then the query is implemented here.
* The supported fields are:
@@ -569,6 +570,48 @@ public final class LocalDateTime
return field != null && field.isSupportedBy(this);
}
+ /**
+ * Checks if the specified unit is supported.
+ *
+ * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * If false, then calling the {@link #plus(long, TemporalUnit)} and
+ * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+ *
+ * If the unit is a {@link ChronoUnit} then the query is implemented here.
+ * The supported units are:
+ *
+ *
{@code NANOS}
+ *
{@code MICROS}
+ *
{@code MILLIS}
+ *
{@code SECONDS}
+ *
{@code MINUTES}
+ *
{@code HOURS}
+ *
{@code HALF_DAYS}
+ *
{@code DAYS}
+ *
{@code WEEKS}
+ *
{@code MONTHS}
+ *
{@code YEARS}
+ *
{@code DECADES}
+ *
{@code CENTURIES}
+ *
{@code MILLENNIA}
+ *
{@code ERAS}
+ *
+ * All other {@code ChronoUnit} instances will return false.
+ *
+ * If the unit is not a {@code ChronoUnit}, then the result of this method
+ * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+ * passing {@code this} as the argument.
+ * Whether the unit is supported is determined by the unit.
+ *
+ * @param unit the unit to check, null returns false
+ * @return true if the unit can be added/subtracted, false if not
+ */
+ @Override // override for Javadoc
+ public boolean isSupported(TemporalUnit unit) {
+ return ChronoLocalDateTime.super.isSupported(unit);
+ }
+
+ //-----------------------------------------------------------------------
/**
* Gets the range of valid values for the specified field.
*
@@ -1570,7 +1613,7 @@ public final class LocalDateTime
* The result will be negative if the end is before the start.
* The {@code Temporal} passed to this method must be a {@code LocalDateTime}.
* For example, the amount in days between two date-times can be calculated
- * using {@code startDateTime.periodUntil(endDateTime, DAYS)}.
+ * using {@code startDateTime.until(endDateTime, DAYS)}.
*
* The calculation returns a whole number, representing the number of
* complete units between the two date-times.
@@ -1582,7 +1625,7 @@ public final class LocalDateTime
* The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
*
* // these two lines are equivalent
- * amount = start.periodUntil(end, MONTHS);
+ * amount = start.until(end, MONTHS);
* amount = MONTHS.between(start, end);
*
* The choice should be made based on which makes the code more readable.
@@ -1609,18 +1652,17 @@ public final class LocalDateTime
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
- public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+ public long until(Temporal endDateTime, TemporalUnit unit) {
if (endDateTime instanceof LocalDateTime == false) {
Objects.requireNonNull(endDateTime, "endDateTime");
throw new DateTimeException("Unable to calculate amount as objects are of two different types");
}
LocalDateTime end = (LocalDateTime) endDateTime;
if (unit instanceof ChronoUnit) {
- ChronoUnit f = (ChronoUnit) unit;
- if (f.isTimeUnit()) {
+ if (unit.isTimeBased()) {
long amount = date.daysUntil(end.date);
if (amount == 0) {
- return time.periodUntil(end.time, unit);
+ return time.until(end.time, unit);
}
long timePart = end.time.toNanoOfDay() - time.toNanoOfDay();
if (amount > 0) {
@@ -1630,7 +1672,7 @@ public final class LocalDateTime
amount++; // safe
timePart -= NANOS_PER_DAY; // safe
}
- switch (f) {
+ switch ((ChronoUnit) unit) {
case NANOS:
amount = Math.multiplyExact(amount, NANOS_PER_DAY);
break;
@@ -1667,7 +1709,7 @@ public final class LocalDateTime
} else if (endDate.isBefore(date) && end.time.isAfter(time)) {
endDate = endDate.plusDays(1);
}
- return date.periodUntil(endDate, unit);
+ return date.until(endDate, unit);
}
return unit.between(this, endDateTime);
}
diff --git a/jdk/src/share/classes/java/time/LocalTime.java b/jdk/src/share/classes/java/time/LocalTime.java
index 41b1a927560..2bace6e7bc9 100644
--- a/jdk/src/share/classes/java/time/LocalTime.java
+++ b/jdk/src/share/classes/java/time/LocalTime.java
@@ -470,8 +470,9 @@ public final class LocalTime
* Checks if the specified field is supported.
*
* This checks if this time can be queried for the specified field.
- * If false, then calling the {@link #range(TemporalField) range} and
- * {@link #get(TemporalField) get} methods will throw an exception.
+ * If false, then calling the {@link #range(TemporalField) range},
+ * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+ * methods will throw an exception.
*
* If the field is a {@link ChronoField} then the query is implemented here.
* The supported fields are:
@@ -510,6 +511,43 @@ public final class LocalTime
return field != null && field.isSupportedBy(this);
}
+ /**
+ * Checks if the specified unit is supported.
+ *
+ * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * If false, then calling the {@link #plus(long, TemporalUnit)} and
+ * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+ *
+ * If the unit is a {@link ChronoUnit} then the query is implemented here.
+ * The supported units are:
+ *
+ *
{@code NANOS}
+ *
{@code MICROS}
+ *
{@code MILLIS}
+ *
{@code SECONDS}
+ *
{@code MINUTES}
+ *
{@code HOURS}
+ *
{@code HALF_DAYS}
+ *
+ * All other {@code ChronoUnit} instances will return false.
+ *
+ * If the unit is not a {@code ChronoUnit}, then the result of this method
+ * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+ * passing {@code this} as the argument.
+ * Whether the unit is supported is determined by the unit.
+ *
+ * @param unit the unit to check, null returns false
+ * @return true if the unit can be added/subtracted, false if not
+ */
+ @Override // override for Javadoc
+ public boolean isSupported(TemporalUnit unit) {
+ if (unit instanceof ChronoUnit) {
+ return unit.isTimeBased();
+ }
+ return unit != null && unit.isSupportedBy(this);
+ }
+
+ //-----------------------------------------------------------------------
/**
* Gets the range of valid values for the specified field.
*
@@ -628,7 +666,7 @@ public final class LocalTime
case CLOCK_HOUR_OF_DAY: return (hour == 0 ? 24 : hour);
case AMPM_OF_DAY: return hour / 12;
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
//-----------------------------------------------------------------------
@@ -803,7 +841,7 @@ public final class LocalTime
case CLOCK_HOUR_OF_DAY: return withHour((int) (newValue == 24 ? 0 : newValue));
case AMPM_OF_DAY: return plusHours((newValue - (hour / 12)) * 12);
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.adjustInto(this, newValue);
}
@@ -995,8 +1033,7 @@ public final class LocalTime
@Override
public LocalTime plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
- ChronoUnit f = (ChronoUnit) unit;
- switch (f) {
+ switch ((ChronoUnit) unit) {
case NANOS: return plusNanos(amountToAdd);
case MICROS: return plusNanos((amountToAdd % MICROS_PER_DAY) * 1000);
case MILLIS: return plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000_000);
@@ -1005,7 +1042,7 @@ public final class LocalTime
case HOURS: return plusHours(amountToAdd);
case HALF_DAYS: return plusHours((amountToAdd % 2) * 12);
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.addTo(this, amountToAdd);
}
@@ -1295,7 +1332,7 @@ public final class LocalTime
* The result will be negative if the end is before the start.
* The {@code Temporal} passed to this method must be a {@code LocalTime}.
* For example, the amount in hours between two times can be calculated
- * using {@code startTime.periodUntil(endTime, HOURS)}.
+ * using {@code startTime.until(endTime, HOURS)}.
*
* The calculation returns a whole number, representing the number of
* complete units between the two times.
@@ -1307,7 +1344,7 @@ public final class LocalTime
* The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
*
* // these two lines are equivalent
- * amount = start.periodUntil(end, MINUTES);
+ * amount = start.until(end, MINUTES);
* amount = MINUTES.between(start, end);
*
* The choice should be made based on which makes the code more readable.
@@ -1332,7 +1369,7 @@ public final class LocalTime
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
- public long periodUntil(Temporal endTime, TemporalUnit unit) {
+ public long until(Temporal endTime, TemporalUnit unit) {
if (endTime instanceof LocalTime == false) {
Objects.requireNonNull(endTime, "endTime");
throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -1349,7 +1386,7 @@ public final class LocalTime
case HOURS: return nanosUntil / NANOS_PER_HOUR;
case HALF_DAYS: return nanosUntil / (12 * NANOS_PER_HOUR);
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.between(this, endTime);
}
diff --git a/jdk/src/share/classes/java/time/Month.java b/jdk/src/share/classes/java/time/Month.java
index 272e8f96b36..85d12d8f136 100644
--- a/jdk/src/share/classes/java/time/Month.java
+++ b/jdk/src/share/classes/java/time/Month.java
@@ -61,7 +61,6 @@
*/
package java.time;
-import java.time.temporal.UnsupportedTemporalTypeException;
import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
import static java.time.temporal.ChronoUnit.MONTHS;
@@ -75,6 +74,7 @@ import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalAdjuster;
import java.time.temporal.TemporalField;
import java.time.temporal.TemporalQuery;
+import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
import java.util.Locale;
@@ -370,7 +370,7 @@ public enum Month implements TemporalAccessor, TemporalAdjuster {
if (field == MONTH_OF_YEAR) {
return getValue();
} else if (field instanceof ChronoField) {
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.getFrom(this);
}
diff --git a/jdk/src/share/classes/java/time/MonthDay.java b/jdk/src/share/classes/java/time/MonthDay.java
index 4204ef74a7d..06aa0437af8 100644
--- a/jdk/src/share/classes/java/time/MonthDay.java
+++ b/jdk/src/share/classes/java/time/MonthDay.java
@@ -438,7 +438,7 @@ public final class MonthDay
case DAY_OF_MONTH: return day;
case MONTH_OF_YEAR: return month;
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.getFrom(this);
}
diff --git a/jdk/src/share/classes/java/time/OffsetDateTime.java b/jdk/src/share/classes/java/time/OffsetDateTime.java
index b053085a9f5..5641154cf3e 100644
--- a/jdk/src/share/classes/java/time/OffsetDateTime.java
+++ b/jdk/src/share/classes/java/time/OffsetDateTime.java
@@ -65,6 +65,7 @@ import static java.time.temporal.ChronoField.EPOCH_DAY;
import static java.time.temporal.ChronoField.INSTANT_SECONDS;
import static java.time.temporal.ChronoField.NANO_OF_DAY;
import static java.time.temporal.ChronoField.OFFSET_SECONDS;
+import static java.time.temporal.ChronoUnit.FOREVER;
import static java.time.temporal.ChronoUnit.NANOS;
import java.io.IOException;
@@ -137,25 +138,40 @@ public final class OffsetDateTime
public static final OffsetDateTime MAX = LocalDateTime.MAX.atOffset(ZoneOffset.MIN);
/**
- * Comparator for two {@code OffsetDateTime} instances based solely on the instant.
+ * Gets a comparator that compares two {@code OffsetDateTime} instances
+ * based solely on the instant.
*
* This method differs from the comparison in {@link #compareTo} in that it
* only compares the underlying instant.
*
+ * @return a comparator that compares in time-line order
+ *
* @see #isAfter
* @see #isBefore
* @see #isEqual
*/
- public static final Comparator INSTANT_COMPARATOR = new Comparator() {
- @Override
- public int compare(OffsetDateTime datetime1, OffsetDateTime datetime2) {
- int cmp = Long.compare(datetime1.toEpochSecond(), datetime2.toEpochSecond());
- if (cmp == 0) {
- cmp = Long.compare(datetime1.toLocalTime().toNanoOfDay(), datetime2.toLocalTime().toNanoOfDay());
- }
- return cmp;
+ public static Comparator timeLineOrder() {
+ return OffsetDateTime::compareInstant;
+ }
+
+ /**
+ * Compares this {@code OffsetDateTime} to another date-time.
+ * The comparison is based on the instant.
+ *
+ * @param datetime1 the first date-time to compare, not null
+ * @param datetime2 the other date-time to compare to, not null
+ * @return the comparator value, negative if less, positive if greater
+ */
+ private static int compareInstant(OffsetDateTime datetime1, OffsetDateTime datetime2) {
+ if (datetime1.getOffset().equals(datetime2.getOffset())) {
+ return datetime1.toLocalDateTime().compareTo(datetime2.toLocalDateTime());
}
- };
+ int cmp = Long.compare(datetime1.toEpochSecond(), datetime2.toEpochSecond());
+ if (cmp == 0) {
+ cmp = datetime1.toLocalTime().getNano() - datetime2.toLocalTime().getNano();
+ }
+ return cmp;
+ }
/**
* Serialization version.
@@ -406,8 +422,9 @@ public final class OffsetDateTime
* Checks if the specified field is supported.
*
* This checks if this date-time can be queried for the specified field.
- * If false, then calling the {@link #range(TemporalField) range} and
- * {@link #get(TemporalField) get} methods will throw an exception.
+ * If false, then calling the {@link #range(TemporalField) range},
+ * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+ * methods will throw an exception.
*
* If the field is a {@link ChronoField} then the query is implemented here.
* The supported fields are:
@@ -458,6 +475,51 @@ public final class OffsetDateTime
return field instanceof ChronoField || (field != null && field.isSupportedBy(this));
}
+ /**
+ * Checks if the specified unit is supported.
+ *
+ * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * If false, then calling the {@link #plus(long, TemporalUnit)} and
+ * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+ *
+ * If the unit is a {@link ChronoUnit} then the query is implemented here.
+ * The supported units are:
+ *
+ *
{@code NANOS}
+ *
{@code MICROS}
+ *
{@code MILLIS}
+ *
{@code SECONDS}
+ *
{@code MINUTES}
+ *
{@code HOURS}
+ *
{@code HALF_DAYS}
+ *
{@code DAYS}
+ *
{@code WEEKS}
+ *
{@code MONTHS}
+ *
{@code YEARS}
+ *
{@code DECADES}
+ *
{@code CENTURIES}
+ *
{@code MILLENNIA}
+ *
{@code ERAS}
+ *
+ * All other {@code ChronoUnit} instances will return false.
+ *
+ * If the unit is not a {@code ChronoUnit}, then the result of this method
+ * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+ * passing {@code this} as the argument.
+ * Whether the unit is supported is determined by the unit.
+ *
+ * @param unit the unit to check, null returns false
+ * @return true if the unit can be added/subtracted, false if not
+ */
+ @Override // override for Javadoc
+ public boolean isSupported(TemporalUnit unit) {
+ if (unit instanceof ChronoUnit) {
+ return unit != FOREVER;
+ }
+ return unit != null && unit.isSupportedBy(this);
+ }
+
+ //-----------------------------------------------------------------------
/**
* Gets the range of valid values for the specified field.
*
@@ -1528,7 +1590,7 @@ public final class OffsetDateTime
* The start and end points are {@code this} and the specified date-time.
* The result will be negative if the end is before the start.
* For example, the period in days between two date-times can be calculated
- * using {@code startDateTime.periodUntil(endDateTime, DAYS)}.
+ * using {@code startDateTime.until(endDateTime, DAYS)}.
*
* The {@code Temporal} passed to this method must be an {@code OffsetDateTime}.
* If the offset differs between the two date-times, the specified
@@ -1544,7 +1606,7 @@ public final class OffsetDateTime
* The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
*
* // these two lines are equivalent
- * amount = start.periodUntil(end, MONTHS);
+ * amount = start.until(end, MONTHS);
* amount = MONTHS.between(start, end);
*
* The choice should be made based on which makes the code more readable.
@@ -1571,7 +1633,7 @@ public final class OffsetDateTime
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
- public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+ public long until(Temporal endDateTime, TemporalUnit unit) {
if (endDateTime instanceof OffsetDateTime == false) {
Objects.requireNonNull(endDateTime, "endDateTime");
throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -1579,7 +1641,7 @@ public final class OffsetDateTime
if (unit instanceof ChronoUnit) {
OffsetDateTime end = (OffsetDateTime) endDateTime;
end = end.withOffsetSameInstant(offset);
- return dateTime.periodUntil(end.dateTime, unit);
+ return dateTime.until(end.dateTime, unit);
}
return unit.between(this, endDateTime);
}
@@ -1724,15 +1786,9 @@ public final class OffsetDateTime
*/
@Override
public int compareTo(OffsetDateTime other) {
- if (getOffset().equals(other.getOffset())) {
- return toLocalDateTime().compareTo(other.toLocalDateTime());
- }
- int cmp = Long.compare(toEpochSecond(), other.toEpochSecond());
+ int cmp = compareInstant(this, other);
if (cmp == 0) {
- cmp = toLocalTime().getNano() - other.toLocalTime().getNano();
- if (cmp == 0) {
- cmp = toLocalDateTime().compareTo(other.toLocalDateTime());
- }
+ cmp = toLocalDateTime().compareTo(other.toLocalDateTime());
}
return cmp;
}
diff --git a/jdk/src/share/classes/java/time/OffsetTime.java b/jdk/src/share/classes/java/time/OffsetTime.java
index ff990696942..2872cff4b26 100644
--- a/jdk/src/share/classes/java/time/OffsetTime.java
+++ b/jdk/src/share/classes/java/time/OffsetTime.java
@@ -348,8 +348,9 @@ public final class OffsetTime
* Checks if the specified field is supported.
*
* This checks if this time can be queried for the specified field.
- * If false, then calling the {@link #range(TemporalField) range} and
- * {@link #get(TemporalField) get} methods will throw an exception.
+ * If false, then calling the {@link #range(TemporalField) range},
+ * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+ * methods will throw an exception.
*
* If the field is a {@link ChronoField} then the query is implemented here.
* The supported fields are:
@@ -389,6 +390,43 @@ public final class OffsetTime
return field != null && field.isSupportedBy(this);
}
+ /**
+ * Checks if the specified unit is supported.
+ *
+ * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * If false, then calling the {@link #plus(long, TemporalUnit)} and
+ * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+ *
+ * If the unit is a {@link ChronoUnit} then the query is implemented here.
+ * The supported units are:
+ *
+ *
{@code NANOS}
+ *
{@code MICROS}
+ *
{@code MILLIS}
+ *
{@code SECONDS}
+ *
{@code MINUTES}
+ *
{@code HOURS}
+ *
{@code HALF_DAYS}
+ *
+ * All other {@code ChronoUnit} instances will return false.
+ *
+ * If the unit is not a {@code ChronoUnit}, then the result of this method
+ * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+ * passing {@code this} as the argument.
+ * Whether the unit is supported is determined by the unit.
+ *
+ * @param unit the unit to check, null returns false
+ * @return true if the unit can be added/subtracted, false if not
+ */
+ @Override // override for Javadoc
+ public boolean isSupported(TemporalUnit unit) {
+ if (unit instanceof ChronoUnit) {
+ return unit.isTimeBased();
+ }
+ return unit != null && unit.isSupportedBy(this);
+ }
+
+ //-----------------------------------------------------------------------
/**
* Gets the range of valid values for the specified field.
*
@@ -1084,7 +1122,7 @@ public final class OffsetTime
* The start and end points are {@code this} and the specified time.
* The result will be negative if the end is before the start.
* For example, the period in hours between two times can be calculated
- * using {@code startTime.periodUntil(endTime, HOURS)}.
+ * using {@code startTime.until(endTime, HOURS)}.
*
* The {@code Temporal} passed to this method must be an {@code OffsetTime}.
* If the offset differs between the two times, then the specified
@@ -1100,7 +1138,7 @@ public final class OffsetTime
* The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
*
* // these two lines are equivalent
- * amount = start.periodUntil(end, MINUTES);
+ * amount = start.until(end, MINUTES);
* amount = MINUTES.between(start, end);
*
* The choice should be made based on which makes the code more readable.
@@ -1125,7 +1163,7 @@ public final class OffsetTime
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
- public long periodUntil(Temporal endTime, TemporalUnit unit) {
+ public long until(Temporal endTime, TemporalUnit unit) {
if (endTime instanceof OffsetTime == false) {
Objects.requireNonNull(endTime, "endTime");
throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -1142,7 +1180,7 @@ public final class OffsetTime
case HOURS: return nanosUntil / NANOS_PER_HOUR;
case HALF_DAYS: return nanosUntil / (12 * NANOS_PER_HOUR);
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.between(this, endTime);
}
diff --git a/jdk/src/share/classes/java/time/Period.java b/jdk/src/share/classes/java/time/Period.java
index b2748f089ce..45980d08740 100644
--- a/jdk/src/share/classes/java/time/Period.java
+++ b/jdk/src/share/classes/java/time/Period.java
@@ -139,7 +139,7 @@ public final class Period
* The pattern for parsing.
*/
private final static Pattern PATTERN =
- Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)Y)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)D)?", Pattern.CASE_INSENSITIVE);
+ Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)Y)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)W)?(?:([-+]?[0-9]+)D)?", Pattern.CASE_INSENSITIVE);
/**
* The set of supported units.
*/
@@ -186,6 +186,20 @@ public final class Period
return create(0, months, 0);
}
+ /**
+ * Obtains a {@code Period} representing a number of weeks.
+ *
+ * The resulting period will be day-based, with the amount of days
+ * equal to the number of weeks multiplied by 7.
+ * The years and months units will be zero.
+ *
+ * @param weeks the number of weeks, positive or negative
+ * @return the period, with the input weeks converted to days, not null
+ */
+ public static Period ofWeeks(int weeks) {
+ return create(0, 0, Math.multiplyExact(weeks, 7));
+ }
+
/**
* Obtains a {@code Period} representing a number of days.
*
@@ -257,22 +271,36 @@ public final class Period
* Obtains a {@code Period} from a text string such as {@code PnYnMnD}.
*
* This will parse the string produced by {@code toString()} which is
- * based on the ISO-8601 period format {@code PnYnMnD}.
+ * based on the ISO-8601 period formats {@code PnYnMnD} and {@code PnW}.
*
* The string starts with an optional sign, denoted by the ASCII negative
* or positive symbol. If negative, the whole period is negated.
* The ASCII letter "P" is next in upper or lower case.
- * There are then three sections, each consisting of a number and a suffix.
- * At least one of the three sections must be present.
- * The sections have suffixes in ASCII of "Y", "M" and "D" for
- * years, months and days, accepted in upper or lower case.
+ * There are then four sections, each consisting of a number and a suffix.
+ * At least one of the four sections must be present.
+ * The sections have suffixes in ASCII of "Y", "M", "W" and "D" for
+ * years, months, weeks and days, accepted in upper or lower case.
* The suffixes must occur in order.
* The number part of each section must consist of ASCII digits.
* The number may be prefixed by the ASCII negative or positive symbol.
* The number must parse to an {@code int}.
*
* The leading plus/minus sign, and negative values for other units are
- * not part of the ISO-8601 standard.
+ * not part of the ISO-8601 standard. In addition, ISO-8601 does not
+ * permit mixing between the {@code PnYnMnD} and {@code PnW} formats.
+ * Any week-based input is multiplied by 7 and treated as a number of days.
+ *
+ * For example, the following are valid inputs:
+ *
*
* @param text the text to parse, not null
* @return the parsed period, not null
@@ -285,14 +313,18 @@ public final class Period
int negate = ("-".equals(matcher.group(1)) ? -1 : 1);
String yearMatch = matcher.group(2);
String monthMatch = matcher.group(3);
- String dayMatch = matcher.group(4);
- if (yearMatch != null || monthMatch != null || dayMatch != null) {
+ String weekMatch = matcher.group(4);
+ String dayMatch = matcher.group(5);
+ if (yearMatch != null || monthMatch != null || dayMatch != null || weekMatch != null) {
try {
- return create(parseNumber(text, yearMatch, negate),
- parseNumber(text, monthMatch, negate),
- parseNumber(text, dayMatch, negate));
+ int years = parseNumber(text, yearMatch, negate);
+ int months = parseNumber(text, monthMatch, negate);
+ int weeks = parseNumber(text, weekMatch, negate);
+ int days = parseNumber(text, dayMatch, negate);
+ days = Math.addExact(days, Math.multiplyExact(weeks, 7));
+ return create(years, months, days);
} catch (NumberFormatException ex) {
- throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Period", text, 0).initCause(ex);
+ throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0, ex);
}
}
}
@@ -307,7 +339,7 @@ public final class Period
try {
return Math.multiplyExact(val, negate);
} catch (ArithmeticException ex) {
- throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Period", text, 0).initCause(ex);
+ throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0, ex);
}
}
@@ -329,10 +361,10 @@ public final class Period
* @param startDate the start date, inclusive, not null
* @param endDate the end date, exclusive, not null
* @return the period between this date and the end date, not null
- * @see ChronoLocalDate#periodUntil(ChronoLocalDate)
+ * @see ChronoLocalDate#until(ChronoLocalDate)
*/
public static Period between(LocalDate startDate, LocalDate endDate) {
- return startDate.periodUntil(endDate);
+ return startDate.until(endDate);
}
//-----------------------------------------------------------------------
@@ -386,7 +418,7 @@ public final class Period
} else if (unit == ChronoUnit.DAYS) {
return getDays();
} else {
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
}
diff --git a/jdk/src/share/classes/java/time/Year.java b/jdk/src/share/classes/java/time/Year.java
index c2d9974d79a..fb180d859cb 100644
--- a/jdk/src/share/classes/java/time/Year.java
+++ b/jdk/src/share/classes/java/time/Year.java
@@ -64,6 +64,10 @@ package java.time;
import static java.time.temporal.ChronoField.ERA;
import static java.time.temporal.ChronoField.YEAR;
import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import static java.time.temporal.ChronoUnit.CENTURIES;
+import static java.time.temporal.ChronoUnit.DECADES;
+import static java.time.temporal.ChronoUnit.ERAS;
+import static java.time.temporal.ChronoUnit.MILLENNIA;
import static java.time.temporal.ChronoUnit.YEARS;
import java.io.DataInput;
@@ -329,8 +333,9 @@ public final class Year
* Checks if the specified field is supported.
*
* This checks if this year can be queried for the specified field.
- * If false, then calling the {@link #range(TemporalField) range} and
- * {@link #get(TemporalField) get} methods will throw an exception.
+ * If false, then calling the {@link #range(TemporalField) range},
+ * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+ * methods will throw an exception.
*
* If the field is a {@link ChronoField} then the query is implemented here.
* The supported fields are:
@@ -357,6 +362,41 @@ public final class Year
return field != null && field.isSupportedBy(this);
}
+ /**
+ * Checks if the specified unit is supported.
+ *
+ * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * If false, then calling the {@link #plus(long, TemporalUnit)} and
+ * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+ *
+ * If the unit is a {@link ChronoUnit} then the query is implemented here.
+ * The supported units are:
+ *
+ *
{@code YEARS}
+ *
{@code DECADES}
+ *
{@code CENTURIES}
+ *
{@code MILLENNIA}
+ *
{@code ERAS}
+ *
+ * All other {@code ChronoUnit} instances will return false.
+ *
+ * If the unit is not a {@code ChronoUnit}, then the result of this method
+ * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+ * passing {@code this} as the argument.
+ * Whether the unit is supported is determined by the unit.
+ *
+ * @param unit the unit to check, null returns false
+ * @return true if the unit can be added/subtracted, false if not
+ */
+ @Override
+ public boolean isSupported(TemporalUnit unit) {
+ if (unit instanceof ChronoUnit) {
+ return unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS;
+ }
+ return unit != null && unit.isSupportedBy(this);
+ }
+
+ //-----------------------------------------------------------------------
/**
* Gets the range of valid values for the specified field.
*
@@ -450,7 +490,7 @@ public final class Year
case YEAR: return year;
case ERA: return (year < 1 ? 0 : 1);
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.getFrom(this);
}
@@ -575,7 +615,7 @@ public final class Year
case YEAR: return Year.of((int) newValue);
case ERA: return (getLong(ERA) == newValue ? this : Year.of(1 - year));
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.adjustInto(this, newValue);
}
@@ -664,7 +704,7 @@ public final class Year
case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd));
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.addTo(this, amountToAdd);
}
@@ -821,7 +861,7 @@ public final class Year
* The result will be negative if the end is before the start.
* The {@code Temporal} passed to this method must be a {@code Year}.
* For example, the period in decades between two year can be calculated
- * using {@code startYear.periodUntil(endYear, DECADES)}.
+ * using {@code startYear.until(endYear, DECADES)}.
*
* The calculation returns a whole number, representing the number of
* complete units between the two years.
@@ -833,7 +873,7 @@ public final class Year
* The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
*
* // these two lines are equivalent
- * amount = start.periodUntil(end, YEARS);
+ * amount = start.until(end, YEARS);
* amount = YEARS.between(start, end);
*
* The choice should be made based on which makes the code more readable.
@@ -858,7 +898,7 @@ public final class Year
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
- public long periodUntil(Temporal endYear, TemporalUnit unit) {
+ public long until(Temporal endYear, TemporalUnit unit) {
if (endYear instanceof Year == false) {
Objects.requireNonNull(endYear, "endYear");
throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -873,7 +913,7 @@ public final class Year
case MILLENNIA: return yearsUntil / 1000;
case ERAS: return end.getLong(ERA) - getLong(ERA);
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.between(this, endYear);
}
diff --git a/jdk/src/share/classes/java/time/YearMonth.java b/jdk/src/share/classes/java/time/YearMonth.java
index 855774eed1a..1d974095336 100644
--- a/jdk/src/share/classes/java/time/YearMonth.java
+++ b/jdk/src/share/classes/java/time/YearMonth.java
@@ -66,7 +66,12 @@ import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
import static java.time.temporal.ChronoField.YEAR;
import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import static java.time.temporal.ChronoUnit.CENTURIES;
+import static java.time.temporal.ChronoUnit.DECADES;
+import static java.time.temporal.ChronoUnit.ERAS;
+import static java.time.temporal.ChronoUnit.MILLENNIA;
import static java.time.temporal.ChronoUnit.MONTHS;
+import static java.time.temporal.ChronoUnit.YEARS;
import java.io.DataInput;
import java.io.DataOutput;
@@ -313,8 +318,9 @@ public final class YearMonth
* Checks if the specified field is supported.
*
* This checks if this year-month can be queried for the specified field.
- * If false, then calling the {@link #range(TemporalField) range} and
- * {@link #get(TemporalField) get} methods will throw an exception.
+ * If false, then calling the {@link #range(TemporalField) range},
+ * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+ * methods will throw an exception.
*
* If the field is a {@link ChronoField} then the query is implemented here.
* The supported fields are:
@@ -344,6 +350,42 @@ public final class YearMonth
return field != null && field.isSupportedBy(this);
}
+ /**
+ * Checks if the specified unit is supported.
+ *
+ * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * If false, then calling the {@link #plus(long, TemporalUnit)} and
+ * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+ *
+ * If the unit is a {@link ChronoUnit} then the query is implemented here.
+ * The supported units are:
+ *
+ *
{@code MONTHS}
+ *
{@code YEARS}
+ *
{@code DECADES}
+ *
{@code CENTURIES}
+ *
{@code MILLENNIA}
+ *
{@code ERAS}
+ *
+ * All other {@code ChronoUnit} instances will return false.
+ *
+ * If the unit is not a {@code ChronoUnit}, then the result of this method
+ * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+ * passing {@code this} as the argument.
+ * Whether the unit is supported is determined by the unit.
+ *
+ * @param unit the unit to check, null returns false
+ * @return true if the unit can be added/subtracted, false if not
+ */
+ @Override
+ public boolean isSupported(TemporalUnit unit) {
+ if (unit instanceof ChronoUnit) {
+ return unit == MONTHS || unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS;
+ }
+ return unit != null && unit.isSupportedBy(this);
+ }
+
+ //-----------------------------------------------------------------------
/**
* Gets the range of valid values for the specified field.
*
@@ -440,7 +482,7 @@ public final class YearMonth
case YEAR: return year;
case ERA: return (year < 1 ? 0 : 1);
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.getFrom(this);
}
@@ -639,7 +681,7 @@ public final class YearMonth
case YEAR: return withYear((int) newValue);
case ERA: return (getLong(ERA) == newValue ? this : withYear(1 - year));
}
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.adjustInto(this, newValue);
}
@@ -761,7 +803,7 @@ public final class YearMonth
case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd));
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.addTo(this, amountToAdd);
}
@@ -952,7 +994,7 @@ public final class YearMonth
* The result will be negative if the end is before the start.
* The {@code Temporal} passed to this method must be a {@code YearMonth}.
* For example, the period in years between two year-months can be calculated
- * using {@code startYearMonth.periodUntil(endYearMonth, YEARS)}.
+ * using {@code startYearMonth.until(endYearMonth, YEARS)}.
*
* The calculation returns a whole number, representing the number of
* complete units between the two year-months.
@@ -964,7 +1006,7 @@ public final class YearMonth
* The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
*
* // these two lines are equivalent
- * amount = start.periodUntil(end, MONTHS);
+ * amount = start.until(end, MONTHS);
* amount = MONTHS.between(start, end);
*
* The choice should be made based on which makes the code more readable.
@@ -989,7 +1031,7 @@ public final class YearMonth
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
- public long periodUntil(Temporal endYearMonth, TemporalUnit unit) {
+ public long until(Temporal endYearMonth, TemporalUnit unit) {
if (endYearMonth instanceof YearMonth == false) {
Objects.requireNonNull(endYearMonth, "endYearMonth");
throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -1005,7 +1047,7 @@ public final class YearMonth
case MILLENNIA: return monthsUntil / 12000;
case ERAS: return end.getLong(ERA) - getLong(ERA);
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.between(this, endYearMonth);
}
diff --git a/jdk/src/share/classes/java/time/ZoneId.java b/jdk/src/share/classes/java/time/ZoneId.java
index 026f73ef512..dcde85ae884 100644
--- a/jdk/src/share/classes/java/time/ZoneId.java
+++ b/jdk/src/share/classes/java/time/ZoneId.java
@@ -400,6 +400,36 @@ public abstract class ZoneId implements Serializable {
return of(zoneId, true);
}
+ /**
+ * Obtains an instance of {@code ZoneId} wrapping an offset.
+ *
+ * If the prefix is "GMT", "UTC", or "UT" a {@code ZoneId}
+ * with the prefix and the non-zero offset is returned.
+ * If the prefix is empty {@code ""} the {@code ZoneOffset} is returned.
+ *
+ * @param prefix the time-zone ID, not null
+ * @param offset the offset, not null
+ * @return the zone ID, not null
+ * @throws IllegalArgumentException if the prefix is not one of
+ * "GMT", "UTC", or "UT", or ""
+ */
+ public static ZoneId ofOffset(String prefix, ZoneOffset offset) {
+ Objects.requireNonNull(prefix, "prefix");
+ Objects.requireNonNull(offset, "offset");
+ if (prefix.length() == 0) {
+ return offset;
+ }
+
+ if (!prefix.equals("GMT") && !prefix.equals("UTC") && !prefix.equals("UT")) {
+ throw new IllegalArgumentException("prefix should be GMT, UTC or UT, is: " + prefix);
+ }
+
+ if (offset.getTotalSeconds() != 0) {
+ prefix = prefix.concat(offset.getId());
+ }
+ return new ZoneRegion(prefix, offset.getRules());
+ }
+
/**
* Parses the ID, taking a flag to indicate whether {@code ZoneRulesException}
* should be thrown or not, used in deserialization.
@@ -433,7 +463,7 @@ public abstract class ZoneId implements Serializable {
private static ZoneId ofWithPrefix(String zoneId, int prefixLength, boolean checkAvailable) {
String prefix = zoneId.substring(0, prefixLength);
if (zoneId.length() == prefixLength) {
- return ZoneRegion.ofPrefixedOffset(prefix, ZoneOffset.UTC);
+ return ofOffset(prefix, ZoneOffset.UTC);
}
if (zoneId.charAt(prefixLength) != '+' && zoneId.charAt(prefixLength) != '-') {
return ZoneRegion.ofId(zoneId, checkAvailable); // drop through to ZoneRulesProvider
@@ -441,9 +471,9 @@ public abstract class ZoneId implements Serializable {
try {
ZoneOffset offset = ZoneOffset.of(zoneId.substring(prefixLength));
if (offset == ZoneOffset.UTC) {
- return ZoneRegion.ofPrefixedOffset(prefix, offset);
+ return ofOffset(prefix, offset);
}
- return ZoneRegion.ofPrefixedOffset(prefix + offset.toString(), offset);
+ return ofOffset(prefix, offset);
} catch (DateTimeException ex) {
throw new DateTimeException("Invalid ID for offset-based ZoneId: " + zoneId, ex);
}
diff --git a/jdk/src/share/classes/java/time/ZoneOffset.java b/jdk/src/share/classes/java/time/ZoneOffset.java
index 4bbc4e4fa84..c5e4d056ee8 100644
--- a/jdk/src/share/classes/java/time/ZoneOffset.java
+++ b/jdk/src/share/classes/java/time/ZoneOffset.java
@@ -61,7 +61,6 @@
*/
package java.time;
-import java.time.temporal.UnsupportedTemporalTypeException;
import static java.time.LocalTime.MINUTES_PER_HOUR;
import static java.time.LocalTime.SECONDS_PER_HOUR;
import static java.time.LocalTime.SECONDS_PER_MINUTE;
@@ -79,6 +78,7 @@ import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalAdjuster;
import java.time.temporal.TemporalField;
import java.time.temporal.TemporalQuery;
+import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
import java.time.zone.ZoneRules;
import java.util.Objects;
@@ -581,7 +581,7 @@ public final class ZoneOffset
if (field == OFFSET_SECONDS) {
return totalSeconds;
} else if (field instanceof ChronoField) {
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return range(field).checkValidIntValue(getLong(field), field);
}
@@ -613,7 +613,7 @@ public final class ZoneOffset
if (field == OFFSET_SECONDS) {
return totalSeconds;
} else if (field instanceof ChronoField) {
- throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.getFrom(this);
}
diff --git a/jdk/src/share/classes/java/time/ZoneRegion.java b/jdk/src/share/classes/java/time/ZoneRegion.java
index af6a5405a69..66d30709d98 100644
--- a/jdk/src/share/classes/java/time/ZoneRegion.java
+++ b/jdk/src/share/classes/java/time/ZoneRegion.java
@@ -66,7 +66,6 @@ import java.time.zone.ZoneRules;
import java.time.zone.ZoneRulesException;
import java.time.zone.ZoneRulesProvider;
import java.util.Objects;
-import java.util.regex.Pattern;
/**
* A geographical region where the same time-zone rules apply.
@@ -153,19 +152,6 @@ final class ZoneRegion extends ZoneId implements Serializable {
}
}
- /**
- * Obtains an instance of {@code ZoneId} wrapping an offset.
- *
- * For example, zone IDs like 'UTC', 'GMT', 'UT' and 'UTC+01:30' will be setup here.
- *
- * @param zoneId the time-zone ID, not null
- * @param offset the offset, not null
- * @return the zone ID, not null
- */
- static ZoneRegion ofPrefixedOffset(String zoneId, ZoneOffset offset) {
- return new ZoneRegion(zoneId, offset.getRules());
- }
-
//-------------------------------------------------------------------------
/**
* Constructor.
diff --git a/jdk/src/share/classes/java/time/ZonedDateTime.java b/jdk/src/share/classes/java/time/ZonedDateTime.java
index e7ed5551d33..151470ecf93 100644
--- a/jdk/src/share/classes/java/time/ZonedDateTime.java
+++ b/jdk/src/share/classes/java/time/ZonedDateTime.java
@@ -642,8 +642,9 @@ public final class ZonedDateTime
* Checks if the specified field is supported.
*
* This checks if this date-time can be queried for the specified field.
- * If false, then calling the {@link #range(TemporalField) range} and
- * {@link #get(TemporalField) get} methods will throw an exception.
+ * If false, then calling the {@link #range(TemporalField) range},
+ * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+ * methods will throw an exception.
*
* If the field is a {@link ChronoField} then the query is implemented here.
* The supported fields are:
@@ -694,6 +695,48 @@ public final class ZonedDateTime
return field instanceof ChronoField || (field != null && field.isSupportedBy(this));
}
+ /**
+ * Checks if the specified unit is supported.
+ *
+ * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * If false, then calling the {@link #plus(long, TemporalUnit)} and
+ * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+ *
+ * If the unit is a {@link ChronoUnit} then the query is implemented here.
+ * The supported units are:
+ *
+ *
{@code NANOS}
+ *
{@code MICROS}
+ *
{@code MILLIS}
+ *
{@code SECONDS}
+ *
{@code MINUTES}
+ *
{@code HOURS}
+ *
{@code HALF_DAYS}
+ *
{@code DAYS}
+ *
{@code WEEKS}
+ *
{@code MONTHS}
+ *
{@code YEARS}
+ *
{@code DECADES}
+ *
{@code CENTURIES}
+ *
{@code MILLENNIA}
+ *
{@code ERAS}
+ *
+ * All other {@code ChronoUnit} instances will return false.
+ *
+ * If the unit is not a {@code ChronoUnit}, then the result of this method
+ * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+ * passing {@code this} as the argument.
+ * Whether the unit is supported is determined by the unit.
+ *
+ * @param unit the unit to check, null returns false
+ * @return true if the unit can be added/subtracted, false if not
+ */
+ @Override // override for Javadoc
+ public boolean isSupported(TemporalUnit unit) {
+ return ChronoZonedDateTime.super.isSupported(unit);
+ }
+
+ //-----------------------------------------------------------------------
/**
* Gets the range of valid values for the specified field.
*
@@ -1540,8 +1583,7 @@ public final class ZonedDateTime
@Override
public ZonedDateTime plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
- ChronoUnit u = (ChronoUnit) unit;
- if (u.isDateUnit()) {
+ if (unit.isDateBased()) {
return resolveLocal(dateTime.plus(amountToAdd, unit));
} else {
return resolveInstant(dateTime.plus(amountToAdd, unit));
@@ -1990,7 +2032,7 @@ public final class ZonedDateTime
* The start and end points are {@code this} and the specified date-time.
* The result will be negative if the end is before the start.
* For example, the period in days between two date-times can be calculated
- * using {@code startDateTime.periodUntil(endDateTime, DAYS)}.
+ * using {@code startDateTime.until(endDateTime, DAYS)}.
*
* The {@code Temporal} passed to this method must be a {@code ZonedDateTime}.
* If the time-zone differs between the two zoned date-times, the specified
@@ -2006,7 +2048,7 @@ public final class ZonedDateTime
* The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
*
* // these two lines are equivalent
- * amount = start.periodUntil(end, MONTHS);
+ * amount = start.until(end, MONTHS);
* amount = MONTHS.between(start, end);
*
* The choice should be made based on which makes the code more readable.
@@ -2047,7 +2089,7 @@ public final class ZonedDateTime
* @throws ArithmeticException if numeric overflow occurs
*/
@Override
- public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+ public long until(Temporal endDateTime, TemporalUnit unit) {
if (endDateTime instanceof ZonedDateTime == false) {
Objects.requireNonNull(endDateTime, "endDateTime");
throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -2055,11 +2097,10 @@ public final class ZonedDateTime
if (unit instanceof ChronoUnit) {
ZonedDateTime end = (ZonedDateTime) endDateTime;
end = end.withZoneSameInstant(zone);
- ChronoUnit u = (ChronoUnit) unit;
- if (u.isDateUnit()) {
- return dateTime.periodUntil(end.dateTime, unit);
+ if (unit.isDateBased()) {
+ return dateTime.until(end.dateTime, unit);
} else {
- return toOffsetDateTime().periodUntil(end.toOffsetDateTime(), unit);
+ return toOffsetDateTime().until(end.toOffsetDateTime(), unit);
}
}
return unit.between(this, endDateTime);
diff --git a/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java
index 14e2bf58f2a..99ba58f05b9 100644
--- a/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java
+++ b/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java
@@ -67,6 +67,8 @@ import java.time.DateTimeException;
import java.time.temporal.ChronoUnit;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAdjuster;
+import java.time.temporal.TemporalAmount;
+import java.time.temporal.TemporalField;
import java.time.temporal.TemporalUnit;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
@@ -96,12 +98,12 @@ import java.util.Objects;
* // Enumerate the list of available calendars and print today for each
* Set<Chronology> chronos = Chronology.getAvailableChronologies();
* for (Chronology chrono : chronos) {
- * ChronoLocalDate<?> date = chrono.dateNow();
+ * ChronoLocalDate date = chrono.dateNow();
* System.out.printf(" %20s: %s%n", chrono.getID(), date.toString());
* }
*
* // Print the Hijrah date and calendar
- * ChronoLocalDate<?> date = Chronology.of("Hijrah").dateNow();
+ * ChronoLocalDate date = Chronology.of("Hijrah").dateNow();
* int day = date.get(ChronoField.DAY_OF_MONTH);
* int dow = date.get(ChronoField.DAY_OF_WEEK);
* int month = date.get(ChronoField.MONTH_OF_YEAR);
@@ -110,10 +112,10 @@ import java.util.Objects;
* dow, day, month, year);
* // Print today's date and the last day of the year
- * ChronoLocalDate<?> now1 = Chronology.of("Hijrah").dateNow();
- * ChronoLocalDate<?> first = now1.with(ChronoField.DAY_OF_MONTH, 1)
+ * ChronoLocalDate now1 = Chronology.of("Hijrah").dateNow();
+ * ChronoLocalDate first = now1.with(ChronoField.DAY_OF_MONTH, 1)
* .with(ChronoField.MONTH_OF_YEAR, 1);
- * ChronoLocalDate<?> last = first.plus(1, ChronoUnit.YEARS)
+ * ChronoLocalDate last = first.plus(1, ChronoUnit.YEARS)
* .minus(1, ChronoUnit.DAYS);
* System.out.printf(" Today is %s: start: %s; end: %s%n", last.getChronology().getID(),
* first, last);
@@ -138,22 +140,61 @@ import java.util.Objects;
* @param the ChronoLocalDate of this date-time
* @since 1.8
*/
-abstract class ChronoDateImpl>
- implements ChronoLocalDate, Temporal, TemporalAdjuster, Serializable {
+abstract class ChronoDateImpl
+ implements ChronoLocalDate, Temporal, TemporalAdjuster, Serializable {
/**
* Serialization version.
*/
private static final long serialVersionUID = 6282433883239719096L;
+ /**
+ * Casts the {@code Temporal} to {@code ChronoLocalDate} ensuring it bas the specified chronology.
+ *
+ * @param chrono the chronology to check for, not null
+ * @param temporal a date-time to cast, not null
+ * @return the date-time checked and cast to {@code ChronoLocalDate}, not null
+ * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDate
+ * or the chronology is not equal this Chronology
+ */
+ static D ensureValid(Chronology chrono, Temporal temporal) {
+ @SuppressWarnings("unchecked")
+ D other = (D) temporal;
+ if (chrono.equals(other.getChronology()) == false) {
+ throw new ClassCastException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + other.getChronology().getId());
+ }
+ return other;
+ }
+
+ //-----------------------------------------------------------------------
/**
* Creates an instance.
*/
ChronoDateImpl() {
}
+ @Override
+ @SuppressWarnings("unchecked")
+ public D with(TemporalAdjuster adjuster) {
+ return (D) ChronoLocalDate.super.with(adjuster);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public D with(TemporalField field, long value) {
+ return (D) ChronoLocalDate.super.with(field, value);
+ }
+
//-----------------------------------------------------------------------
@Override
+ @SuppressWarnings("unchecked")
+ public D plus(TemporalAmount amount) {
+ return (D) ChronoLocalDate.super.plus(amount);
+ }
+
+ //-----------------------------------------------------------------------
+ @Override
+ @SuppressWarnings("unchecked")
public D plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
@@ -167,9 +208,21 @@ abstract class ChronoDateImpl>
case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd));
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
- return ChronoLocalDate.super.plus(amountToAdd, unit);
+ return (D) ChronoLocalDate.super.plus(amountToAdd, unit);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public D minus(TemporalAmount amount) {
+ return (D) ChronoLocalDate.super.minus(amount);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public D minus(long amountToSubtract, TemporalUnit unit) {
+ return (D) ChronoLocalDate.super.minus(amountToSubtract, unit);
}
//-----------------------------------------------------------------------
@@ -254,6 +307,7 @@ abstract class ChronoDateImpl>
* @return a date based on this one with the years subtracted, not null
* @throws DateTimeException if the result exceeds the supported date range
*/
+ @SuppressWarnings("unchecked")
D minusYears(long yearsToSubtract) {
return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract));
}
@@ -274,6 +328,7 @@ abstract class ChronoDateImpl>
* @return a date based on this one with the months subtracted, not null
* @throws DateTimeException if the result exceeds the supported date range
*/
+ @SuppressWarnings("unchecked")
D minusMonths(long monthsToSubtract) {
return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract));
}
@@ -293,6 +348,7 @@ abstract class ChronoDateImpl>
* @return a date based on this one with the weeks subtracted, not null
* @throws DateTimeException if the result exceeds the supported date range
*/
+ @SuppressWarnings("unchecked")
D minusWeeks(long weeksToSubtract) {
return (weeksToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusWeeks(Long.MAX_VALUE)).plusWeeks(1) : plusWeeks(-weeksToSubtract));
}
@@ -310,6 +366,7 @@ abstract class ChronoDateImpl>
* @return a date based on this one with the days subtracted, not null
* @throws DateTimeException if the result exceeds the supported date range
*/
+ @SuppressWarnings("unchecked")
D minusDays(long daysToSubtract) {
return (daysToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusDays(Long.MAX_VALUE)).plusDays(1) : plusDays(-daysToSubtract));
}
@@ -321,13 +378,13 @@ abstract class ChronoDateImpl>
* @throws ArithmeticException {@inheritDoc}
*/
@Override
- public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+ public long until(Temporal endDateTime, TemporalUnit unit) {
Objects.requireNonNull(endDateTime, "endDateTime");
Objects.requireNonNull(unit, "unit");
if (endDateTime instanceof ChronoLocalDate == false) {
throw new DateTimeException("Unable to calculate amount as objects are of two different types");
}
- ChronoLocalDate> end = (ChronoLocalDate>) endDateTime;
+ ChronoLocalDate end = (ChronoLocalDate) endDateTime;
if (getChronology().equals(end.getChronology()) == false) {
throw new DateTimeException("Unable to calculate amount as objects have different chronologies");
}
@@ -342,16 +399,16 @@ abstract class ChronoDateImpl>
case MILLENNIA: return monthsUntil(end) / 12000;
case ERAS: return end.getLong(ERA) - getLong(ERA);
}
- throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+ throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
return unit.between(this, endDateTime);
}
- private long daysUntil(ChronoLocalDate> end) {
+ private long daysUntil(ChronoLocalDate end) {
return end.toEpochDay() - toEpochDay(); // no overflow
}
- private long monthsUntil(ChronoLocalDate> end) {
+ private long monthsUntil(ChronoLocalDate end) {
ValueRange range = getChronology().range(MONTH_OF_YEAR);
if (range.getMaximum() != 12) {
throw new IllegalStateException("ChronoDateImpl only supports Chronologies with 12 months per year");
@@ -367,7 +424,7 @@ abstract class ChronoDateImpl>
return true;
}
if (obj instanceof ChronoLocalDate) {
- return compareTo((ChronoLocalDate>) obj) == 0;
+ return compareTo((ChronoLocalDate) obj) == 0;
}
return false;
}
diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java
index 31c08260d6e..923e8960b0f 100644
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java
@@ -242,11 +242,10 @@ import java.util.Objects;
* Additional calendar systems may be added to the system.
* See {@link Chronology} for more details.
*
- * @param the concrete type for the date
* @since 1.8
*/
-public interface ChronoLocalDate>
- extends Temporal, TemporalAdjuster, Comparable> {
+public interface ChronoLocalDate
+ extends Temporal, TemporalAdjuster, Comparable {
/**
* Gets a comparator that compares {@code ChronoLocalDate} in
@@ -263,7 +262,7 @@ public interface ChronoLocalDate>
* @see #isBefore
* @see #isEqual
*/
- static Comparator> timeLineOrder() {
+ static Comparator timeLineOrder() {
return Chronology.DATE_ORDER;
}
@@ -289,9 +288,9 @@ public interface ChronoLocalDate>
* @throws DateTimeException if unable to convert to a {@code ChronoLocalDate}
* @see Chronology#date(TemporalAccessor)
*/
- static ChronoLocalDate> from(TemporalAccessor temporal) {
+ static ChronoLocalDate from(TemporalAccessor temporal) {
if (temporal instanceof ChronoLocalDate) {
- return (ChronoLocalDate>) temporal;
+ return (ChronoLocalDate) temporal;
}
Chronology chrono = temporal.query(TemporalQuery.chronology());
if (chrono == null) {
@@ -367,6 +366,25 @@ public interface ChronoLocalDate>
return (isLeapYear() ? 366 : 365);
}
+ /**
+ * Checks if the specified field is supported.
+ *
+ * This checks if the specified field can be queried on this date.
+ * If false, then calling the {@link #range(TemporalField) range},
+ * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+ * methods will throw an exception.
+ *
+ * The set of supported fields is defined by the chronology and normally includes
+ * all {@code ChronoField} date fields.
+ *
+ * If the field is not a {@code ChronoField}, then the result of this method
+ * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)}
+ * passing {@code this} as the argument.
+ * Whether the field is supported is determined by the field.
+ *
+ * @param field the field to check, null returns false
+ * @return true if the field can be queried, false if not
+ */
@Override
default boolean isSupported(TemporalField field) {
if (field instanceof ChronoField) {
@@ -375,6 +393,32 @@ public interface ChronoLocalDate>
return field != null && field.isSupportedBy(this);
}
+ /**
+ * Checks if the specified unit is supported.
+ *