From c6274c7aa28e470cdce74fb14b2c737e534bab76 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 24 Apr 2017 15:15:55 +0300 Subject: [PATCH 01/55] 8178971: Uncommon formatting and typos in java.desktop module Reviewed-by: prr, ssadetsky --- .../image/AbstractMultiResolutionImage.java | 3 +- .../share/classes/java/awt/package-info.java | 8 ++--- .../classes/javax/sound/midi/MetaMessage.java | 2 +- .../classes/javax/sound/midi/Sequence.java | 10 +++--- .../classes/javax/sound/midi/Sequencer.java | 8 ++--- .../javax/sound/midi/ShortMessage.java | 36 +++++++++---------- .../javax/sound/midi/SysexMessage.java | 4 +-- .../javax/sound/sampled/BooleanControl.java | 4 +-- .../javax/sound/sampled/FloatControl.java | 18 +++++----- .../javax/sound/sampled/LineEvent.java | 8 ++--- .../share/classes/javax/swing/JComponent.java | 2 +- .../share/classes/module-info.java | 31 ++++++++++------ 12 files changed, 72 insertions(+), 62 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java index 89c43879ac3..aa105ccea75 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java @@ -29,7 +29,8 @@ import java.awt.Image; /** * This class provides default implementations of several {@code Image} methods - * for classes that want to implement the {@MultiResolutionImage} interface. + * for classes that want to implement the {@code MultiResolutionImage} + * interface. * * For example, *
 {@code
diff --git a/jdk/src/java.desktop/share/classes/java/awt/package-info.java b/jdk/src/java.desktop/share/classes/java/awt/package-info.java
index b2335c33ead..76ecdae7ec0 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/package-info.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/package-info.java
@@ -35,10 +35,10 @@
  * components can fire. See AWTEvent for a description of the AWT event model.
  * 

* A container is a component that can contain components and other containers. - * A con tainer can also have a layout manager that controls the visual - * placement of components in the container. The AWT package contains several - * layout manager classes and an interface for building your own layout manager. - * See Container and LayoutManager for more information. + * A container can also have a layout manager that controls the visual placement + * of components in the container. The AWT package contains several layout + * manager classes and an interface for building your own layout manager. See + * Container and LayoutManager for more information. *

* Each {@code Component} object is limited in its maximum size and its location * because the values are stored as an integer. Also, a platform may further diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java index 8c6a5904378..0fe40e84342 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java @@ -59,7 +59,7 @@ public class MetaMessage extends MidiMessage { * * @see MidiMessage#getStatus */ - public static final int META = 0xFF; // 255 + public static final int META = 0xFF; // 255 /** * The length of the actual message in the data array. This is used to diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java index b8cfba0adcb..f8b8aaac27d 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequence.java @@ -58,7 +58,7 @@ public class Sequence { * * @see #Sequence(float, int) */ - public static final float PPQ = 0.0f; + public static final float PPQ = 0.0f; /** * The SMPTE-based timing type with 24 frames per second (resolution is @@ -66,7 +66,7 @@ public class Sequence { * * @see #Sequence(float, int) */ - public static final float SMPTE_24 = 24.0f; + public static final float SMPTE_24 = 24.0f; /** * The SMPTE-based timing type with 25 frames per second (resolution is @@ -74,7 +74,7 @@ public class Sequence { * * @see #Sequence(float, int) */ - public static final float SMPTE_25 = 25.0f; + public static final float SMPTE_25 = 25.0f; /** * The SMPTE-based timing type with 29.97 frames per second (resolution is @@ -82,7 +82,7 @@ public class Sequence { * * @see #Sequence(float, int) */ - public static final float SMPTE_30DROP = 29.97f; + public static final float SMPTE_30DROP = 29.97f; /** * The SMPTE-based timing type with 30 frames per second (resolution is @@ -90,7 +90,7 @@ public class Sequence { * * @see #Sequence(float, int) */ - public static final float SMPTE_30 = 30.0f; + public static final float SMPTE_30 = 30.0f; // Variables diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java index 4050f385cc8..c1e94908602 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java @@ -733,7 +733,7 @@ public interface Sequencer extends MidiDevice { * information from its internal clock. This is not a legal slave sync * mode. */ - public static final SyncMode INTERNAL_CLOCK = new SyncMode("Internal Clock"); + public static final SyncMode INTERNAL_CLOCK = new SyncMode("Internal Clock"); /** * A master or slave synchronization mode that specifies the use of MIDI @@ -745,7 +745,7 @@ public interface Sequencer extends MidiDevice { * receiver. MIDI clock messages are sent at a rate of 24 per quarter * note. */ - public static final SyncMode MIDI_SYNC = new SyncMode("MIDI Sync"); + public static final SyncMode MIDI_SYNC = new SyncMode("MIDI Sync"); /** * A master or slave synchronization mode that specifies the use of MIDI @@ -756,13 +756,13 @@ public interface Sequencer extends MidiDevice { * sequencer sends MIDI Time Code messages to its receiver. (See the * MIDI 1.0 Detailed Specification for a description of MIDI Time Code.) */ - public static final SyncMode MIDI_TIME_CODE = new SyncMode("MIDI Time Code"); + public static final SyncMode MIDI_TIME_CODE = new SyncMode("MIDI Time Code"); /** * A slave synchronization mode indicating that no timing information * should be sent to the receiver. This is not a legal master sync mode. */ - public static final SyncMode NO_SYNC = new SyncMode("No Timing"); + public static final SyncMode NO_SYNC = new SyncMode("No Timing"); } } diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java index 8d0a9a22253..c02deda21bf 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java @@ -61,35 +61,35 @@ public class ShortMessage extends MidiMessage { * * @see MidiMessage#getStatus */ - public static final int MIDI_TIME_CODE = 0xF1; // 241 + public static final int MIDI_TIME_CODE = 0xF1; // 241 /** * Status byte for Song Position Pointer message (0xF2, or 242). * * @see MidiMessage#getStatus */ - public static final int SONG_POSITION_POINTER = 0xF2; // 242 + public static final int SONG_POSITION_POINTER = 0xF2; // 242 /** * Status byte for MIDI Song Select message (0xF3, or 243). * * @see MidiMessage#getStatus */ - public static final int SONG_SELECT = 0xF3; // 243 + public static final int SONG_SELECT = 0xF3; // 243 /** * Status byte for Tune Request message (0xF6, or 246). * * @see MidiMessage#getStatus */ - public static final int TUNE_REQUEST = 0xF6; // 246 + public static final int TUNE_REQUEST = 0xF6; // 246 /** * Status byte for End of System Exclusive message (0xF7, or 247). * * @see MidiMessage#getStatus */ - public static final int END_OF_EXCLUSIVE = 0xF7; // 247 + public static final int END_OF_EXCLUSIVE = 0xF7; // 247 // System real-time messages @@ -98,80 +98,80 @@ public class ShortMessage extends MidiMessage { * * @see MidiMessage#getStatus */ - public static final int TIMING_CLOCK = 0xF8; // 248 + public static final int TIMING_CLOCK = 0xF8; // 248 /** * Status byte for Start message (0xFA, or 250). * * @see MidiMessage#getStatus */ - public static final int START = 0xFA; // 250 + public static final int START = 0xFA; // 250 /** * Status byte for Continue message (0xFB, or 251). * * @see MidiMessage#getStatus */ - public static final int CONTINUE = 0xFB; // 251 + public static final int CONTINUE = 0xFB; // 251 /** * Status byte for Stop message (0xFC, or 252). * * @see MidiMessage#getStatus */ - public static final int STOP = 0xFC; //252 + public static final int STOP = 0xFC; //252 /** * Status byte for Active Sensing message (0xFE, or 254). * * @see MidiMessage#getStatus */ - public static final int ACTIVE_SENSING = 0xFE; // 254 + public static final int ACTIVE_SENSING = 0xFE; // 254 /** * Status byte for System Reset message (0xFF, or 255). * * @see MidiMessage#getStatus */ - public static final int SYSTEM_RESET = 0xFF; // 255 + public static final int SYSTEM_RESET = 0xFF; // 255 // Channel voice message upper nibble defines /** * Command value for Note Off message (0x80, or 128). */ - public static final int NOTE_OFF = 0x80; // 128 + public static final int NOTE_OFF = 0x80; // 128 /** * Command value for Note On message (0x90, or 144). */ - public static final int NOTE_ON = 0x90; // 144 + public static final int NOTE_ON = 0x90; // 144 /** * Command value for Polyphonic Key Pressure (Aftertouch) message (0xA0, or * 160). */ - public static final int POLY_PRESSURE = 0xA0; // 160 + public static final int POLY_PRESSURE = 0xA0; // 160 /** * Command value for Control Change message (0xB0, or 176). */ - public static final int CONTROL_CHANGE = 0xB0; // 176 + public static final int CONTROL_CHANGE = 0xB0; // 176 /** * Command value for Program Change message (0xC0, or 192). */ - public static final int PROGRAM_CHANGE = 0xC0; // 192 + public static final int PROGRAM_CHANGE = 0xC0; // 192 /** * Command value for Channel Pressure (Aftertouch) message (0xD0, or 208). */ - public static final int CHANNEL_PRESSURE = 0xD0; // 208 + public static final int CHANNEL_PRESSURE = 0xD0; // 208 /** * Command value for Pitch Bend message (0xE0, or 224). */ - public static final int PITCH_BEND = 0xE0; // 224 + public static final int PITCH_BEND = 0xE0; // 224 /** * Constructs a new {@code ShortMessage}. The contents of the new message diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java index de478c3be31..b561faad898 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java @@ -81,7 +81,7 @@ public class SysexMessage extends MidiMessage { * * @see MidiMessage#getStatus */ - public static final int SYSTEM_EXCLUSIVE = 0xF0; // 240 + public static final int SYSTEM_EXCLUSIVE = 0xF0; // 240 /** * Status byte for Special System Exclusive message (0xF7, or 247), which is @@ -90,7 +90,7 @@ public class SysexMessage extends MidiMessage { * * @see MidiMessage#getStatus */ - public static final int SPECIAL_SYSTEM_EXCLUSIVE = 0xF7; // 247 + public static final int SPECIAL_SYSTEM_EXCLUSIVE = 0xF7; // 247 /** * The data bytes for this system exclusive message. These are initialized diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java index 4f81d7c6514..a1abf92cef6 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java @@ -141,14 +141,14 @@ public abstract class BooleanControl extends Control { * Represents a control for the mute status of a line. Note that mute * status does not affect gain. */ - public static final Type MUTE = new Type("Mute"); + public static final Type MUTE = new Type("Mute"); /** * Represents a control for whether reverberation is applied to a line. * Note that the status of this control not affect the reverberation * settings for a line, but does affect whether these settings are used. */ - public static final Type APPLY_REVERB = new Type("Apply Reverb"); + public static final Type APPLY_REVERB = new Type("Apply Reverb"); /** * Constructs a new boolean control type. diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java index 485225b85f0..40cc82e4db5 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java @@ -386,7 +386,7 @@ public abstract class FloatControl extends Control { * @see #REVERB_RETURN * @see #VOLUME */ - public static final Type MASTER_GAIN = new Type("Master Gain"); + public static final Type MASTER_GAIN = new Type("Master Gain"); /** * Represents a control for the auxiliary send gain on a line. @@ -394,7 +394,7 @@ public abstract class FloatControl extends Control { * @see #MASTER_GAIN * @see #AUX_RETURN */ - public static final Type AUX_SEND = new Type("AUX Send"); + public static final Type AUX_SEND = new Type("AUX Send"); /** * Represents a control for the auxiliary return gain on a line. @@ -402,7 +402,7 @@ public abstract class FloatControl extends Control { * @see #MASTER_GAIN * @see #AUX_SEND */ - public static final Type AUX_RETURN = new Type("AUX Return"); + public static final Type AUX_RETURN = new Type("AUX Return"); /** * Represents a control for the pre-reverb gain on a line. This control @@ -413,7 +413,7 @@ public abstract class FloatControl extends Control { * @see #REVERB_RETURN * @see EnumControl.Type#REVERB */ - public static final Type REVERB_SEND = new Type("Reverb Send"); + public static final Type REVERB_SEND = new Type("Reverb Send"); /** * Represents a control for the post-reverb gain on a line. This control @@ -423,7 +423,7 @@ public abstract class FloatControl extends Control { * @see #MASTER_GAIN * @see #REVERB_SEND */ - public static final Type REVERB_RETURN = new Type("Reverb Return"); + public static final Type REVERB_RETURN = new Type("Reverb Return"); /** * Represents a control for the volume on a line. @@ -431,7 +431,7 @@ public abstract class FloatControl extends Control { /* * $$kk: 08.30.99: ISSUE: what units? linear or dB? */ - public static final Type VOLUME = new Type("Volume"); + public static final Type VOLUME = new Type("Volume"); /** * Represents a control for the relative pan (left-right positioning) of @@ -442,7 +442,7 @@ public abstract class FloatControl extends Control { * * @see #BALANCE */ - public static final Type PAN = new Type("Pan"); + public static final Type PAN = new Type("Pan"); /** * Represents a control for the relative balance of a stereo signal @@ -452,7 +452,7 @@ public abstract class FloatControl extends Control { * * @see #PAN */ - public static final Type BALANCE = new Type("Balance"); + public static final Type BALANCE = new Type("Balance"); /** * Represents a control that changes the sample rate of audio playback. @@ -470,7 +470,7 @@ public abstract class FloatControl extends Control { * doubling the sample rate has the effect of doubling the frequencies * in the sound's spectrum, which raises the pitch by an octave. */ - public static final Type SAMPLE_RATE = new Type("Sample Rate"); + public static final Type SAMPLE_RATE = new Type("Sample Rate"); /** * Constructs a new float control type. diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java index 19fb585eae5..ca57d1de22a 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java @@ -220,7 +220,7 @@ public class LineEvent extends EventObject { * @see #CLOSE * @see Line#open */ - public static final Type OPEN = new Type("Open"); + public static final Type OPEN = new Type("Open"); /** * A type of event that is sent when a line closes, freeing the system @@ -229,7 +229,7 @@ public class LineEvent extends EventObject { * @see #OPEN * @see Line#close */ - public static final Type CLOSE = new Type("Close"); + public static final Type CLOSE = new Type("Close"); /** * A type of event that is sent when a line begins to engage in active @@ -239,7 +239,7 @@ public class LineEvent extends EventObject { * @see #STOP * @see DataLine#start */ - public static final Type START = new Type("Start"); + public static final Type START = new Type("Start"); /** * A type of event that is sent when a line ceases active input or @@ -249,7 +249,7 @@ public class LineEvent extends EventObject { * @see #START * @see DataLine#stop */ - public static final Type STOP = new Type("Stop"); + public static final Type STOP = new Type("Stop"); /** * A type of event that is sent when a line ceases to engage in active diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java index 4e9884d9828..e832abb1d75 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java @@ -3735,7 +3735,7 @@ public abstract class JComponent extends Container implements Serializable, * @since 1.3 * @deprecated This class is no longer used or needed. * {@code java.awt.Component.AccessibleAWTComponent} provides - * the same functionality and it is handled in {@Component}. + * the same functionality and it is handled in {@code Component}. */ @Deprecated protected class AccessibleFocusHandler implements FocusListener { diff --git a/jdk/src/java.desktop/share/classes/module-info.java b/jdk/src/java.desktop/share/classes/module-info.java index 29d24e68df3..658becc98c3 100644 --- a/jdk/src/java.desktop/share/classes/module-info.java +++ b/jdk/src/java.desktop/share/classes/module-info.java @@ -114,10 +114,17 @@ module java.desktop { uses javax.sound.sampled.spi.FormatConversionProvider; uses javax.sound.sampled.spi.MixerProvider; - provides sun.datatransfer.DesktopDatatransferService with sun.awt.datatransfer.DesktopDatatransferServiceImpl; - provides java.net.ContentHandlerFactory with sun.awt.www.content.MultimediaContentHandlers; - provides javax.print.PrintServiceLookup with sun.print.PrintServiceLookupProvider; - provides javax.print.StreamPrintServiceFactory with sun.print.PSStreamPrinterFactory; + provides sun.datatransfer.DesktopDatatransferService with + sun.awt.datatransfer.DesktopDatatransferServiceImpl; + + provides java.net.ContentHandlerFactory with + sun.awt.www.content.MultimediaContentHandlers; + + provides javax.print.PrintServiceLookup with + sun.print.PrintServiceLookupProvider; + + provides javax.print.StreamPrintServiceFactory with + sun.print.PSStreamPrinterFactory; provides javax.sound.midi.spi.MidiDeviceProvider with com.sun.media.sound.MidiInDeviceProvider, @@ -125,14 +132,17 @@ module java.desktop { com.sun.media.sound.RealTimeSequencerProvider, com.sun.media.sound.SoftProvider; - provides javax.sound.midi.spi.MidiFileReader with com.sun.media.sound.StandardMidiFileReader; - provides javax.sound.midi.spi.MidiFileWriter with com.sun.media.sound.StandardMidiFileWriter; + provides javax.sound.midi.spi.MidiFileReader with + com.sun.media.sound.StandardMidiFileReader; + + provides javax.sound.midi.spi.MidiFileWriter with + com.sun.media.sound.StandardMidiFileWriter; provides javax.sound.midi.spi.SoundbankReader with - com.sun.media.sound.AudioFileSoundbankReader, - com.sun.media.sound.DLSSoundbankReader, - com.sun.media.sound.JARSoundbankReader, - com.sun.media.sound.SF2SoundbankReader; + com.sun.media.sound.AudioFileSoundbankReader, + com.sun.media.sound.DLSSoundbankReader, + com.sun.media.sound.JARSoundbankReader, + com.sun.media.sound.SF2SoundbankReader; provides javax.sound.sampled.spi.AudioFileReader with com.sun.media.sound.AiffFileReader, @@ -158,4 +168,3 @@ module java.desktop { com.sun.media.sound.DirectAudioDeviceProvider, com.sun.media.sound.PortMixerProvider; } - From 7e67ffbd41f001c1a64fc11e77d6258ef8be4411 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Mon, 24 Apr 2017 07:10:37 -0700 Subject: [PATCH 02/55] 8178905: Undecorated frame is not painted on OEL7(Gnome3) Reviewed-by: prr, serb --- .../unix/classes/sun/awt/X11/XContentWindow.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java index 74444b8d2d6..c430ac45aaa 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -139,6 +139,12 @@ public final class XContentWindow extends XWindow { @Override public void handleExposeEvent(XEvent xev) { + if(parentFrame.isTargetUndecorated() && + XWM.getWMID() != XWM.UNITY_COMPIZ_WM && + width <= 0 && height <= 0) { + // WM didn't send initial ConfigureNotify, so set the bounds here + setContentBounds(parentFrame.getDimensions()); + } if (width <= 0 || height <= 0) { return; } From aefdcda532c131e8eea8874fe7ae2f9d1569dbe3 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Thu, 4 May 2017 07:26:28 +0000 Subject: [PATCH 03/55] 8178380: Module system implementation refresh (5/2017) Co-authored-by: Serguei Spitsyn Reviewed-by: lfoltan, hseigel, mchung, sspitsyn --- .../src/share/vm/classfile/moduleEntry.cpp | 23 ++++--- hotspot/src/share/vm/classfile/modules.cpp | 63 ++++++++++--------- .../src/share/vm/classfile/packageEntry.cpp | 18 +++--- hotspot/src/share/vm/classfile/vmSymbols.hpp | 2 + hotspot/src/share/vm/logging/logTag.hpp | 4 +- hotspot/src/share/vm/oops/instanceKlass.cpp | 20 +++--- hotspot/src/share/vm/prims/jvmti.xml | 4 +- hotspot/src/share/vm/prims/jvmtiExport.cpp | 10 --- hotspot/src/share/vm/prims/jvmtiExport.hpp | 2 - hotspot/src/share/vm/runtime/arguments.cpp | 5 +- hotspot/src/share/vm/runtime/globals.hpp | 3 + hotspot/src/share/vm/runtime/thread.cpp | 2 +- .../src/share/vm/services/attachListener.cpp | 36 ++++++++++- .../share/vm/services/diagnosticCommand.cpp | 19 ++++++ ...fineMethodUsedByMultipleMethodHandles.java | 2 +- .../vm/ci/runtime/test/RedefineClassTest.java | 3 +- .../spectrapredefineclass/Launcher.java | 2 +- .../Launcher.java | 2 +- .../TestOptionsWithRangesDynamic.java | 2 +- .../test/runtime/Metaspace/DefineClass.java | 4 +- hotspot/test/runtime/logging/ModulesTest.java | 34 ++++++++-- .../test/runtime/logging/StartupTimeTest.java | 8 +-- .../runtime/modules/JVMAddModuleExports.java | 20 +++--- .../runtime/modules/JVMAddModulePackage.java | 12 ++-- .../test/runtime/modules/JVMDefineModule.java | 10 +-- .../modules/ModuleStress/ModuleStress.java | 8 +-- .../modules/ModuleStress/ModuleStressGC.java | 4 +- 27 files changed, 202 insertions(+), 120 deletions(-) diff --git a/hotspot/src/share/vm/classfile/moduleEntry.cpp b/hotspot/src/share/vm/classfile/moduleEntry.cpp index 2f07b10da3e..f9941c014e2 100644 --- a/hotspot/src/share/vm/classfile/moduleEntry.cpp +++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp @@ -158,10 +158,10 @@ void ModuleEntry::set_read_walk_required(ClassLoaderData* m_loader_data) { loader_data() != m_loader_data && !m_loader_data->is_builtin_class_loader_data()) { _must_walk_reads = true; - if (log_is_enabled(Trace, modules)) { + if (log_is_enabled(Trace, module)) { ResourceMark rm; - log_trace(modules)("ModuleEntry::set_read_walk_required(): module %s reads list must be walked", - (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE); + log_trace(module)("ModuleEntry::set_read_walk_required(): module %s reads list must be walked", + (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE); } } } @@ -180,10 +180,10 @@ void ModuleEntry::purge_reads() { // on the remaining live modules on the reads list. _must_walk_reads = false; - if (log_is_enabled(Trace, modules)) { + if (log_is_enabled(Trace, module)) { ResourceMark rm; - log_trace(modules)("ModuleEntry::purge_reads(): module %s reads list being walked", - (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE); + log_trace(module)("ModuleEntry::purge_reads(): module %s reads list being walked", + (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE); } // Go backwards because this removes entries that are dead. @@ -236,8 +236,11 @@ ModuleEntryTable::~ModuleEntryTable() { m = m->next(); ResourceMark rm; - log_debug(modules)("ModuleEntryTable: deleting module: %s", to_remove->name() != NULL ? - to_remove->name()->as_C_string() : UNNAMED_MODULE); + if (to_remove->name() != NULL) { + log_info(module, unload)("unloading module %s", to_remove->name()->as_C_string()); + } + log_debug(module)("ModuleEntryTable: deleting module: %s", to_remove->name() != NULL ? + to_remove->name()->as_C_string() : UNNAMED_MODULE); // Clean out the C heap allocated reads list first before freeing the entry to_remove->delete_reads(); @@ -315,9 +318,9 @@ ModuleEntry* ModuleEntryTable::new_entry(unsigned int hash, Handle module_handle if (ClassLoader::is_in_patch_mod_entries(name)) { entry->set_is_patched(); - if (log_is_enabled(Trace, modules, patch)) { + if (log_is_enabled(Trace, module, patch)) { ResourceMark rm; - log_trace(modules, patch)("Marked module %s as patched from --patch-module", name->as_C_string()); + log_trace(module, patch)("Marked module %s as patched from --patch-module", name->as_C_string()); } } diff --git a/hotspot/src/share/vm/classfile/modules.cpp b/hotspot/src/share/vm/classfile/modules.cpp index 39928498910..7328aec06fb 100644 --- a/hotspot/src/share/vm/classfile/modules.cpp +++ b/hotspot/src/share/vm/classfile/modules.cpp @@ -237,16 +237,18 @@ static void define_javabase_module(jobject module, jstring version, // Patch any previously loaded class's module field with java.base's java.lang.Module. ModuleEntryTable::patch_javabase_entries(module_handle); - log_debug(modules)("define_javabase_module(): Definition of module: " - JAVA_BASE_NAME ", version: %s, location: %s, package #: %d", - module_version != NULL ? module_version : "NULL", - module_location != NULL ? module_location : "NULL", - pkg_list->length()); + log_info(module, load)(JAVA_BASE_NAME " location: %s", + module_location != NULL ? module_location : "NULL"); + log_debug(module)("define_javabase_module(): Definition of module: " + JAVA_BASE_NAME ", version: %s, location: %s, package #: %d", + module_version != NULL ? module_version : "NULL", + module_location != NULL ? module_location : "NULL", + pkg_list->length()); // packages defined to java.base for (int x = 0; x < pkg_list->length(); x++) { - log_trace(modules)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME, - (pkg_list->at(x))->as_C_string()); + log_trace(module)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME, + (pkg_list->at(x))->as_C_string()); } } @@ -438,23 +440,24 @@ void Modules::define_module(jobject module, jstring version, throw_dup_pkg_exception(module_name, existing_pkg, CHECK); } - if (log_is_enabled(Debug, modules)) { - outputStream* logst = Log(modules)::debug_stream(); + log_info(module, load)("%s location: %s", module_name, + module_location != NULL ? module_location : "NULL"); + if (log_is_enabled(Debug, module)) { + outputStream* logst = Log(module)::debug_stream(); logst->print("define_module(): creation of module: %s, version: %s, location: %s, ", module_name, module_version != NULL ? module_version : "NULL", module_location != NULL ? module_location : "NULL"); loader_data->print_value_on(logst); logst->print_cr(", package #: %d", pkg_list->length()); for (int y = 0; y < pkg_list->length(); y++) { - log_trace(modules)("define_module(): creation of package %s for module %s", - (pkg_list->at(y))->as_C_string(), module_name); + log_trace(module)("define_module(): creation of package %s for module %s", + (pkg_list->at(y))->as_C_string(), module_name); } } // If the module is defined to the boot loader and an exploded build is being // used, prepend /modules/modules_name, if it exists, to the system boot class path. if (loader == NULL && - !Universe::is_module_initialized() && !ClassLoader::has_jrt_entry()) { ClassLoader::add_to_exploded_build_list(module_symbol, CHECK); } @@ -487,7 +490,7 @@ void Modules::set_bootloader_unnamed_module(jobject module, TRAPS) { } Handle h_loader = Handle(THREAD, loader); - log_debug(modules)("set_bootloader_unnamed_module(): recording unnamed module for boot loader"); + log_debug(module)("set_bootloader_unnamed_module(): recording unnamed module for boot loader"); // Ensure the boot loader's PackageEntryTable has been created ModuleEntryTable* module_table = get_module_entry_table(h_loader, CHECK); @@ -545,10 +548,10 @@ void Modules::add_module_exports(jobject from_module, const char* package_name, from_module_entry->name()->as_C_string())); } - log_debug(modules)("add_module_exports(): package %s in module %s is exported to module %s", - package_entry->name()->as_C_string(), - from_module_entry->name()->as_C_string(), - to_module_entry == NULL ? "NULL" : + log_debug(module)("add_module_exports(): package %s in module %s is exported to module %s", + package_entry->name()->as_C_string(), + from_module_entry->name()->as_C_string(), + to_module_entry == NULL ? "NULL" : to_module_entry->is_named() ? to_module_entry->name()->as_C_string() : UNNAMED_MODULE); @@ -592,12 +595,12 @@ void Modules::add_reads_module(jobject from_module, jobject to_module, TRAPS) { } ResourceMark rm(THREAD); - log_debug(modules)("add_reads_module(): Adding read from module %s to module %s", - from_module_entry->is_named() ? - from_module_entry->name()->as_C_string() : UNNAMED_MODULE, - to_module_entry == NULL ? "all unnamed" : - (to_module_entry->is_named() ? - to_module_entry->name()->as_C_string() : UNNAMED_MODULE)); + log_debug(module)("add_reads_module(): Adding read from module %s to module %s", + from_module_entry->is_named() ? + from_module_entry->name()->as_C_string() : UNNAMED_MODULE, + to_module_entry == NULL ? "all unnamed" : + (to_module_entry->is_named() ? + to_module_entry->name()->as_C_string() : UNNAMED_MODULE)); // if modules are the same or if from_module is unnamed then no need to add the read. if (from_module_entry != to_module_entry && from_module_entry->is_named()) { @@ -616,7 +619,7 @@ jobject Modules::get_module(jclass clazz, TRAPS) { } oop mirror = JNIHandles::resolve_non_null(clazz); if (mirror == NULL) { - log_debug(modules)("get_module(): no mirror, returning NULL"); + log_debug(module)("get_module(): no mirror, returning NULL"); return NULL; } if (!java_lang_Class::is_instance(mirror)) { @@ -629,9 +632,9 @@ jobject Modules::get_module(jclass clazz, TRAPS) { assert(module != NULL, "java.lang.Class module field not set"); assert(java_lang_Module::is_instance(module), "module is not an instance of type java.lang.Module"); - if (log_is_enabled(Debug, modules)) { + if (log_is_enabled(Debug, module)) { ResourceMark rm(THREAD); - outputStream* logst = Log(modules)::debug_stream(); + outputStream* logst = Log(module)::debug_stream(); Klass* klass = java_lang_Class::as_Klass(mirror); oop module_name = java_lang_Module::name(module); if (module_name != NULL) { @@ -764,8 +767,8 @@ void Modules::add_module_package(jobject module, const char* package_name, TRAPS THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), message); } - log_debug(modules)("add_module_package(): Adding package %s to module %s", - package_name, module_entry->name()->as_C_string()); + log_debug(module)("add_module_package(): Adding package %s to module %s", + package_name, module_entry->name()->as_C_string()); TempNewSymbol pkg_symbol = SymbolTable::new_symbol(package_name, CHECK); PackageEntryTable* package_table = loader_data->packages(); @@ -820,8 +823,8 @@ void Modules::add_module_exports_to_all_unnamed(jobject module, const char* pack module_entry->name()->as_C_string())); } - log_debug(modules)("add_module_exports_to_all_unnamed(): package %s in module" - " %s is exported to all unnamed modules", + log_debug(module)("add_module_exports_to_all_unnamed(): package %s in module" + " %s is exported to all unnamed modules", package_entry->name()->as_C_string(), module_entry->name()->as_C_string()); diff --git a/hotspot/src/share/vm/classfile/packageEntry.cpp b/hotspot/src/share/vm/classfile/packageEntry.cpp index ab80fcb732b..aec61c0c75a 100644 --- a/hotspot/src/share/vm/classfile/packageEntry.cpp +++ b/hotspot/src/share/vm/classfile/packageEntry.cpp @@ -77,13 +77,13 @@ void PackageEntry::set_export_walk_required(ClassLoaderData* m_loader_data) { (this_pkg_mod == NULL || this_pkg_mod->loader_data() != m_loader_data) && !m_loader_data->is_builtin_class_loader_data()) { _must_walk_exports = true; - if (log_is_enabled(Trace, modules)) { + if (log_is_enabled(Trace, module)) { ResourceMark rm; assert(name() != NULL, "PackageEntry without a valid name"); - log_trace(modules)("PackageEntry::set_export_walk_required(): package %s defined in module %s, exports list must be walked", - name()->as_C_string(), - (this_pkg_mod == NULL || this_pkg_mod->name() == NULL) ? - UNNAMED_MODULE : this_pkg_mod->name()->as_C_string()); + log_trace(module)("PackageEntry::set_export_walk_required(): package %s defined in module %s, exports list must be walked", + name()->as_C_string(), + (this_pkg_mod == NULL || this_pkg_mod->name() == NULL) ? + UNNAMED_MODULE : this_pkg_mod->name()->as_C_string()); } } } @@ -132,13 +132,13 @@ void PackageEntry::purge_qualified_exports() { // on the remaining live modules on the exports list. _must_walk_exports = false; - if (log_is_enabled(Trace, modules)) { + if (log_is_enabled(Trace, module)) { ResourceMark rm; assert(name() != NULL, "PackageEntry without a valid name"); ModuleEntry* pkg_mod = module(); - log_trace(modules)("PackageEntry::purge_qualified_exports(): package %s defined in module %s, exports list being walked", - name()->as_C_string(), - (pkg_mod == NULL || pkg_mod->name() == NULL) ? UNNAMED_MODULE : pkg_mod->name()->as_C_string()); + log_trace(module)("PackageEntry::purge_qualified_exports(): package %s defined in module %s, exports list being walked", + name()->as_C_string(), + (pkg_mod == NULL || pkg_mod->name() == NULL) ? UNNAMED_MODULE : pkg_mod->name()->as_C_string()); } // Go backwards because this removes entries that are dead. diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp index 633bb8fd98a..13405609579 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp @@ -650,6 +650,8 @@ template(addUses_signature, "(Ljava/lang/Module;Ljava/lang/Class;)V") \ template(addProvides_name, "addProvides") \ template(addProvides_signature, "(Ljava/lang/Module;Ljava/lang/Class;Ljava/lang/Class;)V") \ + template(loadModule_name, "loadModule") \ + template(loadModule_signature, "(Ljava/lang/String;)Ljava/lang/Module;") \ template(transformedByAgent_name, "transformedByAgent") \ template(transformedByAgent_signature, "(Ljava/lang/Module;)V") \ template(appendToClassPathForInstrumentation_name, "appendToClassPathForInstrumentation") \ diff --git a/hotspot/src/share/vm/logging/logTag.hpp b/hotspot/src/share/vm/logging/logTag.hpp index e262d074cfa..322e9030112 100644 --- a/hotspot/src/share/vm/logging/logTag.hpp +++ b/hotspot/src/share/vm/logging/logTag.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, 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 @@ -82,7 +82,7 @@ LOG_TAG(metadata) \ LOG_TAG(metaspace) \ LOG_TAG(mmu) \ - LOG_TAG(modules) \ + LOG_TAG(module) \ LOG_TAG(monitorinflation) \ LOG_TAG(monitormismatch) \ LOG_TAG(nmethod) \ diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 70984514348..044d26e5219 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -2331,21 +2331,21 @@ void InstanceKlass::set_package(ClassLoaderData* loader_data, TRAPS) { name()->as_C_string(), loader_data->loader_name()); } - if (log_is_enabled(Debug, modules)) { + if (log_is_enabled(Debug, module)) { ResourceMark rm; ModuleEntry* m = _package_entry->module(); - log_trace(modules)("Setting package: class: %s, package: %s, loader: %s, module: %s", - external_name(), - pkg_name->as_C_string(), - loader_data->loader_name(), - (m->is_named() ? m->name()->as_C_string() : UNNAMED_MODULE)); + log_trace(module)("Setting package: class: %s, package: %s, loader: %s, module: %s", + external_name(), + pkg_name->as_C_string(), + loader_data->loader_name(), + (m->is_named() ? m->name()->as_C_string() : UNNAMED_MODULE)); } } else { ResourceMark rm; - log_trace(modules)("Setting package: class: %s, package: unnamed, loader: %s, module: %s", - external_name(), - (loader_data != NULL) ? loader_data->loader_name() : "NULL", - UNNAMED_MODULE); + log_trace(module)("Setting package: class: %s, package: unnamed, loader: %s, module: %s", + external_name(), + (loader_data != NULL) ? loader_data->loader_name() : "NULL", + UNNAMED_MODULE); } } diff --git a/hotspot/src/share/vm/prims/jvmti.xml b/hotspot/src/share/vm/prims/jvmti.xml index e7d02cc6dd0..df7f349d1ff 100644 --- a/hotspot/src/share/vm/prims/jvmti.xml +++ b/hotspot/src/share/vm/prims/jvmti.xml @@ -6814,7 +6814,9 @@ class C2 extends C1 implements I2 { , , , , and . If a module is not modifiable - then the module can not be updated with these functions. + then the module can not be updated with these functions. The result of + this function is always JNI_TRUE when called to determine + if an unnamed module is modifiable. new diff --git a/hotspot/src/share/vm/prims/jvmtiExport.cpp b/hotspot/src/share/vm/prims/jvmtiExport.cpp index ad7984c4a8f..8ac9e1bc822 100644 --- a/hotspot/src/share/vm/prims/jvmtiExport.cpp +++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp @@ -54,7 +54,6 @@ #include "runtime/os.inline.hpp" #include "runtime/thread.inline.hpp" #include "runtime/vframe.hpp" -#include "services/attachListener.hpp" #include "services/serviceUtil.hpp" #include "utilities/macros.hpp" #if INCLUDE_ALL_GCS @@ -2479,15 +2478,6 @@ extern "C" { typedef jint (JNICALL *OnAttachEntry_t)(JavaVM*, char *, void *); } -jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) { - // get agent name and options - const char* agent = op->arg(0); - const char* absParam = op->arg(1); - const char* options = op->arg(2); - - return load_agent_library(agent, absParam, options, st); -} - jint JvmtiExport::load_agent_library(const char *agent, const char *absParam, const char *options, outputStream* st) { char ebuf[1024]; diff --git a/hotspot/src/share/vm/prims/jvmtiExport.hpp b/hotspot/src/share/vm/prims/jvmtiExport.hpp index 8599656ab7d..666ab62709b 100644 --- a/hotspot/src/share/vm/prims/jvmtiExport.hpp +++ b/hotspot/src/share/vm/prims/jvmtiExport.hpp @@ -45,7 +45,6 @@ class JvmtiEventControllerPrivate; class JvmtiManageCapabilities; class JvmtiEnv; class JvmtiThreadState; -class AttachOperation; #define JVMTI_SUPPORT_FLAG(key) \ private: \ @@ -396,7 +395,6 @@ class JvmtiExport : public AllStatic { #if INCLUDE_SERVICES // attach support static jint load_agent_library(const char *agent, const char *absParam, const char *options, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR); - static jint load_agent_library(AttachOperation* op, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR); #endif // SetNativeMethodPrefix support diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index cecf8556b7c..36cce48466f 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -2837,11 +2837,14 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m build_jvm_args(option->optionString); } - // -verbose:[class/gc/jni] + // -verbose:[class/module/gc/jni] if (match_option(option, "-verbose", &tail)) { if (!strcmp(tail, ":class") || !strcmp(tail, "")) { LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, load)); LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, unload)); + } else if (!strcmp(tail, ":module")) { + LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, load)); + LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, unload)); } else if (!strcmp(tail, ":gc")) { LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc)); } else if (!strcmp(tail, ":jni")) { diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 77acae0abc4..16ce96b8a65 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -3874,6 +3874,9 @@ public: product(bool, StartAttachListener, false, \ "Always start Attach Listener at VM startup") \ \ + product(bool, EnableDynamicAgentLoading, true, \ + "Allow tools to load agents with the attach mechanism") \ + \ manageable(bool, PrintConcurrentLocks, false, \ "Print java.util.concurrent locks in thread dump") \ \ diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index c5bf44f76ec..758020a7c77 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -3404,7 +3404,7 @@ static void call_initPhase1(TRAPS) { // // After phase 2, The VM will begin search classes from -Xbootclasspath/a. static void call_initPhase2(TRAPS) { - TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, modules, startuptime)); + TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, module, startuptime)); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK); instanceKlassHandle klass (THREAD, k); diff --git a/hotspot/src/share/vm/services/attachListener.cpp b/hotspot/src/share/vm/services/attachListener.cpp index 0de704d6913..99ba58b5200 100644 --- a/hotspot/src/share/vm/services/attachListener.cpp +++ b/hotspot/src/share/vm/services/attachListener.cpp @@ -100,6 +100,36 @@ static jint get_properties(AttachOperation* op, outputStream* out, Symbol* seria return JNI_OK; } +// Implementation of "load" command. +static jint load_agent(AttachOperation* op, outputStream* out) { + // get agent name and options + const char* agent = op->arg(0); + const char* absParam = op->arg(1); + const char* options = op->arg(2); + + // If loading a java agent then need to ensure that the java.instrument module is loaded + if (strcmp(agent, "instrument") == 0) { + Thread* THREAD = Thread::current(); + ResourceMark rm(THREAD); + HandleMark hm(THREAD); + JavaValue result(T_OBJECT); + Handle h_module_name = java_lang_String::create_from_str("java.instrument", THREAD); + JavaCalls::call_static(&result, + SystemDictionary::module_Modules_klass(), + vmSymbols::loadModule_name(), + vmSymbols::loadModule_signature(), + h_module_name, + THREAD); + if (HAS_PENDING_EXCEPTION) { + java_lang_Throwable::print(PENDING_EXCEPTION, out); + CLEAR_PENDING_EXCEPTION; + return JNI_ERR; + } + } + + return JvmtiExport::load_agent_library(agent, absParam, options, out); +} + // Implementation of "properties" command. // See also: PrintSystemPropertiesDCmd class static jint get_system_properties(AttachOperation* op, outputStream* out) { @@ -282,7 +312,7 @@ static AttachOperationFunctionInfo funcs[] = { { "agentProperties", get_agent_properties }, { "datadump", data_dump }, { "dumpheap", dump_heap }, - { "load", JvmtiExport::load_agent_library }, + { "load", load_agent }, { "properties", get_system_properties }, { "threaddump", thread_dump }, { "inspectheap", heap_inspection }, @@ -321,6 +351,10 @@ static void attach_listener_thread_entry(JavaThread* thread, TRAPS) { // handle special detachall operation if (strcmp(op->name(), AttachOperation::detachall_operation_name()) == 0) { AttachListener::detachall(); + } else if (!EnableDynamicAgentLoading && strcmp(op->name(), "load") == 0) { + st.print("Dynamic agent loading is not enabled. " + "Use -XX:+EnableDynamicAgentLoading to launch target VM."); + res = JNI_ERR; } else { // find the function to dispatch too AttachOperationFunctionInfo* info = NULL; diff --git a/hotspot/src/share/vm/services/diagnosticCommand.cpp b/hotspot/src/share/vm/services/diagnosticCommand.cpp index 29aa08daf94..fab6990214a 100644 --- a/hotspot/src/share/vm/services/diagnosticCommand.cpp +++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp @@ -42,6 +42,21 @@ #include "utilities/macros.hpp" #include "oops/objArrayOop.inline.hpp" + +static void loadAgentModule(TRAPS) { + ResourceMark rm(THREAD); + HandleMark hm(THREAD); + + JavaValue result(T_OBJECT); + Handle h_module_name = java_lang_String::create_from_str("jdk.management.agent", CHECK); + JavaCalls::call_static(&result, + SystemDictionary::module_Modules_klass(), + vmSymbols::loadModule_name(), + vmSymbols::loadModule_signature(), + h_module_name, + THREAD); +} + void DCmdRegistrant::register_dcmds(){ // Registration of the diagnostic commands // First argument specifies which interfaces will export the command @@ -753,6 +768,7 @@ void JMXStartRemoteDCmd::execute(DCmdSource source, TRAPS) { // the remote management server. // throw java.lang.NoSuchMethodError if the method doesn't exist + loadAgentModule(CHECK); Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK); instanceKlassHandle ik (THREAD, k); @@ -826,6 +842,7 @@ void JMXStartLocalDCmd::execute(DCmdSource source, TRAPS) { // the local management server // throw java.lang.NoSuchMethodError if method doesn't exist + loadAgentModule(CHECK); Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK); instanceKlassHandle ik (THREAD, k); @@ -843,6 +860,7 @@ void JMXStopRemoteDCmd::execute(DCmdSource source, TRAPS) { // management server // throw java.lang.NoSuchMethodError if method doesn't exist + loadAgentModule(CHECK); Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK); instanceKlassHandle ik (THREAD, k); @@ -864,6 +882,7 @@ void JMXStatusDCmd::execute(DCmdSource source, TRAPS) { // invoke getManagementAgentStatus() method to generate the status info // throw java.lang.NoSuchMethodError if method doesn't exist + loadAgentModule(CHECK); Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK); instanceKlassHandle ik (THREAD, k); diff --git a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java index e923258e480..e792ad170c9 100644 --- a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java +++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java @@ -32,7 +32,7 @@ * java.management * jdk.attach * - * @run main/othervm compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles + * @run main/othervm -Djdk.attach.allowAttachSelf compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles */ package compiler.jsr292; diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java index 78546acb1ef..c073a85a838 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java @@ -29,7 +29,8 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.attach * java.base/jdk.internal.misc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.RedefineClassTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djdk.attach.allowAttachSelf + * jdk.vm.ci.runtime.test.RedefineClassTest */ package jdk.vm.ci.runtime.test; diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java index 9ca9ba0283b..d2e1b136980 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java @@ -33,7 +33,7 @@ * @run driver compiler.profiling.spectrapredefineclass.Launcher * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation * -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 - * -XX:ReservedCodeCacheSize=3M + * -XX:ReservedCodeCacheSize=3M -Djdk.attach.allowAttachSelf * compiler.profiling.spectrapredefineclass.Agent */ diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java index 857fbbbbd84..cea5a477d1d 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java @@ -36,7 +36,7 @@ * @run driver compiler.profiling.spectrapredefineclass_classloaders.Launcher * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation * -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 - * -XX:ReservedCodeCacheSize=3M + * -XX:ReservedCodeCacheSize=3M -Djdk.attach.allowAttachSelf * compiler.profiling.spectrapredefineclass_classloaders.Agent */ diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java index d5f20b5d4d2..4fb53dfe1ea 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java @@ -28,7 +28,7 @@ * @modules java.base/jdk.internal.misc * jdk.attach/sun.tools.attach * java.management - * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestOptionsWithRangesDynamic + * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Djdk.attach.allowAttachSelf TestOptionsWithRangesDynamic */ import java.util.List; diff --git a/hotspot/test/runtime/Metaspace/DefineClass.java b/hotspot/test/runtime/Metaspace/DefineClass.java index 4563e56366f..6225e1555fc 100644 --- a/hotspot/test/runtime/Metaspace/DefineClass.java +++ b/hotspot/test/runtime/Metaspace/DefineClass.java @@ -41,8 +41,8 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UnsyncloadClass -XX:-AllowParallelDefineClass test.DefineClass defineClassParallel - * @run main/othervm test.DefineClass redefineClass - * @run main/othervm test.DefineClass redefineClassWithError + * @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClass + * @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClassWithError * @author volker.simonis@gmail.com */ diff --git a/hotspot/test/runtime/logging/ModulesTest.java b/hotspot/test/runtime/logging/ModulesTest.java index 58b94cc3579..0a469d30fec 100644 --- a/hotspot/test/runtime/logging/ModulesTest.java +++ b/hotspot/test/runtime/logging/ModulesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, 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 @@ -23,7 +23,7 @@ /* * @test - * @summary modules=debug should have logging from statements in the code + * @summary -Xlog:module should emit logging output * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -35,9 +35,16 @@ import jdk.test.lib.process.ProcessTools; public class ModulesTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-Xlog:modules=trace", "-version"); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); + testModuleTrace("-Xlog:module=trace", "-version"); + testModuleLoad("-Xlog:module+load", "-version"); + testModuleUnload("-Xlog:module+unload", "-version"); + + // same as -Xlog:module+load -Xlog:module+unload + testModuleLoad("-verbose:module", "-version"); + } + + static void testModuleTrace(String... args) throws Exception { + OutputAnalyzer output = run(args); output.shouldContain("define_javabase_module(): Definition of module:"); output.shouldContain("define_javabase_module(): creation of package"); output.shouldContain("define_module(): creation of module"); @@ -48,5 +55,22 @@ public class ModulesTest { output.shouldContain("Setting package: class:"); output.shouldHaveExitValue(0); } + + static void testModuleLoad(String... args) throws Exception { + OutputAnalyzer output = run(args); + output.shouldContain("java.base location:"); + output.shouldContain("java.management location:"); + output.shouldHaveExitValue(0); + } + + static void testModuleUnload(String... args) throws Exception { + OutputAnalyzer output = run(args); + output.shouldHaveExitValue(0); + } + + static OutputAnalyzer run(String... args) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + return new OutputAnalyzer(pb.start()); + } } diff --git a/hotspot/test/runtime/logging/StartupTimeTest.java b/hotspot/test/runtime/logging/StartupTimeTest.java index 4448caeac07..4069b02401e 100644 --- a/hotspot/test/runtime/logging/StartupTimeTest.java +++ b/hotspot/test/runtime/logging/StartupTimeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,7 +57,7 @@ public class StartupTimeTest { static void analyzeModulesOutputOff(ProcessBuilder pb) throws Exception { OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldNotContain("[modules,startuptime]"); + output.shouldNotContain("[module,startuptime]"); output.shouldHaveExitValue(0); } @@ -70,11 +70,11 @@ public class StartupTimeTest { InnerClass.class.getName()); analyzeOutputOff(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules", + pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+module", InnerClass.class.getName()); analyzeModulesOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules=off", + pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+module=off", InnerClass.class.getName()); analyzeModulesOutputOff(pb); } diff --git a/hotspot/test/runtime/modules/JVMAddModuleExports.java b/hotspot/test/runtime/modules/JVMAddModuleExports.java index 01d441c7879..da839829610 100644 --- a/hotspot/test/runtime/modules/JVMAddModuleExports.java +++ b/hotspot/test/runtime/modules/JVMAddModuleExports.java @@ -41,12 +41,12 @@ public class JVMAddModuleExports { MyClassLoader to_cl = new MyClassLoader(); Module from_module, to_module; - from_module = ModuleHelper.ModuleObject("from_module", from_cl, new String[] { "mypackage", "this/package" }); + from_module = ModuleHelper.ModuleObject("from_module", from_cl, new String[] { "mypackage", "x/apackage" }); assertNotNull(from_module, "Module should not be null"); - ModuleHelper.DefineModule(from_module, "9.0", "from_module/here", new String[] { "mypackage", "this/package" }); - to_module = ModuleHelper.ModuleObject("to_module", to_cl, new String[] { "yourpackage", "that/package" }); + ModuleHelper.DefineModule(from_module, "9.0", "from_module/here", new String[] { "mypackage", "x/apackage" }); + to_module = ModuleHelper.ModuleObject("to_module", to_cl, new String[] { "yourpackage", "that/apackage" }); assertNotNull(to_module, "Module should not be null"); - ModuleHelper.DefineModule(to_module, "9.0", "to_module/here", new String[] { "yourpackage", "that/package" }); + ModuleHelper.DefineModule(to_module, "9.0", "to_module/here", new String[] { "yourpackage", "that/apackage" }); // Null from_module argument, expect an NPE try { @@ -117,19 +117,19 @@ public class JVMAddModuleExports { // Export a package, that is not in from_module, to from_module try { - ModuleHelper.AddModuleExports(from_module, "that/package", from_module); + ModuleHelper.AddModuleExports(from_module, "that/apackage", from_module); throw new RuntimeException("Failed to get the expected IAE"); } catch(IllegalArgumentException e) { // Expected } // Export the same package twice to the same module - ModuleHelper.AddModuleExports(from_module, "this/package", to_module); - ModuleHelper.AddModuleExports(from_module, "this/package", to_module); + ModuleHelper.AddModuleExports(from_module, "x/apackage", to_module); + ModuleHelper.AddModuleExports(from_module, "x/apackage", to_module); // Export a package, using '.' instead of '/' try { - ModuleHelper.AddModuleExports(from_module, "this.package", to_module); + ModuleHelper.AddModuleExports(from_module, "x.apackage", to_module); throw new RuntimeException("Failed to get the expected IAE"); } catch(IllegalArgumentException e) { // Expected @@ -137,8 +137,8 @@ public class JVMAddModuleExports { // Export a package to the unnamed module and then to a specific module. // The qualified export should be ignored. - ModuleHelper.AddModuleExportsToAll(to_module, "that/package"); - ModuleHelper.AddModuleExports(to_module, "that/package", from_module); + ModuleHelper.AddModuleExportsToAll(to_module, "that/apackage"); + ModuleHelper.AddModuleExports(to_module, "that/apackage", from_module); } static class MyClassLoader extends ClassLoader { } diff --git a/hotspot/test/runtime/modules/JVMAddModulePackage.java b/hotspot/test/runtime/modules/JVMAddModulePackage.java index eb2e32581c6..dc2237f39e3 100644 --- a/hotspot/test/runtime/modules/JVMAddModulePackage.java +++ b/hotspot/test/runtime/modules/JVMAddModulePackage.java @@ -49,16 +49,16 @@ public class JVMAddModulePackage { module_two = ModuleHelper.ModuleObject("module_two", cl1, new String[] { "yourpackage" }); assertNotNull(module_two, "Module should not be null"); ModuleHelper.DefineModule(module_two, "9.0", "module_two/here", new String[] { "yourpackage" }); - module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "package/num3" }); + module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "apackage/num3" }); assertNotNull(module_three, "Module should not be null"); - ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "package/num3" }); + ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "apackage/num3" }); // Simple call ModuleHelper.AddModulePackage(module_one, "new_package"); // Add a package and export it - ModuleHelper.AddModulePackage(module_one, "package/num3"); - ModuleHelper.AddModuleExportsToAll(module_one, "package/num3"); + ModuleHelper.AddModulePackage(module_one, "apackage/num3"); + ModuleHelper.AddModuleExportsToAll(module_one, "apackage/num3"); // Null module argument, expect an NPE try { @@ -94,7 +94,7 @@ public class JVMAddModulePackage { // Invalid package name, expect an IAE try { - ModuleHelper.AddModulePackage(module_one, "your.package"); + ModuleHelper.AddModulePackage(module_one, "your.apackage"); throw new RuntimeException("Failed to get the expected IAE"); } catch(IllegalArgumentException e) { // Expected @@ -102,7 +102,7 @@ public class JVMAddModulePackage { // Invalid package name, expect an IAE try { - ModuleHelper.AddModulePackage(module_one, ";your/package"); + ModuleHelper.AddModulePackage(module_one, ";your/apackage"); throw new RuntimeException("Failed to get the expected IAE"); } catch(IllegalArgumentException e) { // Expected diff --git a/hotspot/test/runtime/modules/JVMDefineModule.java b/hotspot/test/runtime/modules/JVMDefineModule.java index e3e263be291..3c40f026100 100644 --- a/hotspot/test/runtime/modules/JVMDefineModule.java +++ b/hotspot/test/runtime/modules/JVMDefineModule.java @@ -207,10 +207,10 @@ public class JVMDefineModule { ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { }); // Invalid package name, expect an IAE - m = ModuleHelper.ModuleObject("moduleFive", cl, new String[] { "your.package" }); + m = ModuleHelper.ModuleObject("moduleFive", cl, new String[] { "your.apackage" }); try { - ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "your.package" }); - throw new RuntimeException("Failed to get expected IAE for your.package"); + ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "your.apackage" }); + throw new RuntimeException("Failed to get expected IAE for your.apackage"); } catch(IllegalArgumentException e) { if (!e.getMessage().contains("Invalid package name")) { throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage()); @@ -220,8 +220,8 @@ public class JVMDefineModule { // Invalid package name, expect an IAE m = ModuleHelper.ModuleObject("moduleSix", cl, new String[] { "foo" }); // Name irrelevant try { - ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { ";your/package" }); - throw new RuntimeException("Failed to get expected IAE for ;your.package"); + ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { ";your/apackage" }); + throw new RuntimeException("Failed to get expected IAE for ;your.apackage"); } catch(IllegalArgumentException e) { if (!e.getMessage().contains("Invalid package name")) { throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage()); diff --git a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java index 83f706d7092..c3906bcfb15 100644 --- a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java +++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java @@ -53,7 +53,7 @@ public class ModuleStress { // those loaders never die. ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-Xbootclasspath/a:.", - "-Xlog:modules=trace", + "-Xlog:module=trace", "-version"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); @@ -88,7 +88,7 @@ public class ModuleStress { // the same loader and thus have the exact same life cycle. pb = ProcessTools.createJavaProcessBuilder( "-Xbootclasspath/a:.", - "-Xlog:modules=trace", + "-Xlog:module=trace", "ModuleSameCLMain"); oa = new OutputAnalyzer(pb.start()); @@ -102,7 +102,7 @@ public class ModuleStress { // class loaders which could die and thus be unloaded. pb = ProcessTools.createJavaProcessBuilder( "-Xbootclasspath/a:.", - "-Xlog:modules=trace", + "-Xlog:module=trace", "ModuleNonBuiltinCLMain"); oa = new OutputAnalyzer(pb.start()); @@ -120,7 +120,7 @@ public class ModuleStress { pb = ProcessTools.createJavaProcessBuilder( "-Djava.system.class.loader=CustomSystemClassLoader", "-Xbootclasspath/a:.", - "-Xlog:modules=trace", + "-Xlog:module=trace", "ModuleNonBuiltinCLMain"); oa = new OutputAnalyzer(pb.start()); diff --git a/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java b/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java index 9db70d4b137..dacc0189280 100644 --- a/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java +++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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,7 +73,7 @@ public class ModuleStressGC { // test's, defined to module jdk.translet, export list at // GC safepoints. ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-Xlog:modules=trace", + "-Xlog:module=trace", "-p", MODS_DIR.toString(), "-m", "jdk.test/test.MainGC"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); From aa386ac45b316c2adcec835d8a5a49d1aa5d38d3 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Tue, 25 Apr 2017 09:37:24 +0200 Subject: [PATCH 04/55] 8179070: nashorn+octane's box2d causes c2 to crash with "Bad graph detected in compute_lca_of_uses" CiTypeFlow speculates field is null but parsing uses non null constant because of concurrent class initialization Reviewed-by: thartmann --- hotspot/src/share/vm/opto/parse3.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/opto/parse3.cpp b/hotspot/src/share/vm/opto/parse3.cpp index ca571af0dd2..ee0997e6913 100644 --- a/hotspot/src/share/vm/opto/parse3.cpp +++ b/hotspot/src/share/vm/opto/parse3.cpp @@ -146,8 +146,16 @@ void Parse::do_field_access(bool is_get, bool is_field) { void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) { + BasicType bt = field->layout_type(); + // Does this field have a constant value? If so, just push the value. - if (field->is_constant()) { + if (field->is_constant() && + // Keep consistent with types found by ciTypeFlow: for an + // unloaded field type, ciTypeFlow::StateVector::do_getstatic() + // speculates the field is null. The code in the rest of this + // method does the same. We must not bypass it and use a non + // null constant here. + (bt != T_OBJECT || field->type()->is_loaded())) { // final or stable field Node* con = make_constant_from_field(field, obj); if (con != NULL) { @@ -163,7 +171,6 @@ void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) { int offset = field->offset_in_bytes(); const TypePtr* adr_type = C->alias_type(field)->adr_type(); Node *adr = basic_plus_adr(obj, obj, offset); - BasicType bt = field->layout_type(); // Build the resultant type of the load const Type *type; From 15d2a8831a67292fdbc684e248778c3c4f0c21d5 Mon Sep 17 00:00:00 2001 From: Shafi Ahmad Date: Thu, 27 Apr 2017 00:08:24 -0700 Subject: [PATCH 05/55] 8177721: Improve diagnostics in sun.management.Agent#startAgent() Reviewed-by: dfuchs, dholmes, poonam --- .../classes/jdk/internal/agent/Agent.java | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java index 124c737a2ed..29c7e87f6c8 100644 --- a/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java +++ b/jdk/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java @@ -393,7 +393,7 @@ public class Agent { } catch (JdpException e) { error(e); } catch (AgentConfigurationError err) { - error(err.getError(), err.getParams()); + error(err); } } @@ -454,7 +454,7 @@ public class Agent { } } catch (AgentConfigurationError e) { - error(e.getError(), e.getParams()); + error(e); } catch (Exception e) { error(e); } @@ -665,18 +665,6 @@ public class Agent { throw new RuntimeException(keyText); } - public static void error(String key, String[] params) { - if (params == null || params.length == 0) { - error(key); - } else { - StringBuilder message = new StringBuilder(params[0]); - for (int i = 1; i < params.length; i++) { - message.append(' ').append(params[i]); - } - error(key, message.toString()); - } - } - public static void error(String key, String message) { String keyText = getText(key); System.err.print(getText("agent.err.error") + ": " + keyText); @@ -690,6 +678,23 @@ public class Agent { throw new RuntimeException(e); } + public static void error(AgentConfigurationError e) { + String keyText = getText(e.getError()); + String[] params = e.getParams(); + + System.err.print(getText("agent.err.error") + ": " + keyText); + + if (params != null && params.length != 0) { + StringBuffer message = new StringBuffer(params[0]); + for (int i = 1; i < params.length; i++) { + message.append(" " + params[i]); + } + System.err.println(": " + message); + } + e.printStackTrace(); + throw new RuntimeException(e); + } + public static void warning(String key, String message) { System.err.print(getText("agent.err.warning") + ": " + getText(key)); System.err.println(": " + message); From 36d2ae5ce8e874e351eb9c9f2c362494aa2368fa Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Thu, 27 Apr 2017 08:27:25 -0700 Subject: [PATCH 06/55] 8179027: JComboBox too small under Windows LAF Reviewed-by: prr, alexsch --- .../swing/plaf/windows/WindowsComboBoxUI.java | 9 +- .../WindowsComboBoxSizeTest.java | 90 +++++++++++++++++++ 2 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 jdk/test/javax/swing/JComboBox/WindowsComboBoxSize/WindowsComboBoxSizeTest.java diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java index 677ee8b0e13..c14f328c0fa 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java @@ -339,11 +339,16 @@ public class WindowsComboBoxUI extends BasicComboBoxUI { public Dimension getMinimumSize( JComponent c ) { Dimension d = super.getMinimumSize(c); if (XPStyle.getXP() != null) { - d.width += 5; + d.width += 7; + boolean isEditable = false; + if (c instanceof JComboBox) { + isEditable = ((JComboBox) c).isEditable(); + } + d.height += isEditable ? 4 : 6; } else { d.width += 4; + d.height += 2; } - d.height += 2; return d; } diff --git a/jdk/test/javax/swing/JComboBox/WindowsComboBoxSize/WindowsComboBoxSizeTest.java b/jdk/test/javax/swing/JComboBox/WindowsComboBoxSize/WindowsComboBoxSizeTest.java new file mode 100644 index 00000000000..64c4e51685f --- /dev/null +++ b/jdk/test/javax/swing/JComboBox/WindowsComboBoxSize/WindowsComboBoxSizeTest.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2017, 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 8179027 + * @requires (os.family == "windows") + * @summary JComboBox too small under Windows LAF + * @run main WindowsComboBoxSizeTest + */ + +import javax.swing.*; +import java.awt.FlowLayout; +import java.awt.Robot; + +public class WindowsComboBoxSizeTest { + private static JTextField textField; + private static JComboBox comboBox; + private static JComboBox comboBoxEd; + private static JFrame frame; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame(); + frame.getContentPane().setLayout( new FlowLayout() ); + + textField = new JTextField("item 1"); + frame.getContentPane().add(textField); + + comboBox = new JComboBox<>(new String[] + {"item 1", "item 2", "item 3"}); + frame.getContentPane().add(comboBox); + + comboBoxEd = new JComboBox<>(new String[] + {"item 1", "item 2", "item 3"}); + comboBoxEd.setEditable( true ); + frame.getContentPane().add(comboBoxEd); + + frame.pack(); + frame.setVisible( true ); + }); + Robot robot = new Robot(); + robot.waitForIdle(); + + try { + test(); + } finally { + SwingUtilities.invokeLater(frame::dispose); + } + } + + private static void test() throws Exception { + SwingUtilities.invokeAndWait(() -> { + int expected = textField.getSize().height; + if (comboBox.getSize().height != expected ) { + throw new RuntimeException( + "Wrong non-editable JComboBox height " + + comboBox.getSize().height); + } + if (comboBoxEd.getSize().height != expected ) { + throw new RuntimeException( + "Wrong editable JComboBox height " + + comboBoxEd.getSize().height); + } + }); + } +} + From 6b9419790917fc409aee8b55a368037e77e55afb Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Thu, 27 Apr 2017 08:49:23 -0700 Subject: [PATCH 07/55] 8140237: [TEST_BUG]Test javax/swing/plaf/nimbus/8041642/bug8041642.java fails for OEL 7 Reviewed-by: alexsch --- .../swing/plaf/nimbus/8041642/bug8041642.java | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java b/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java index 73f4202178c..9eeaa0e1b9e 100644 --- a/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java +++ b/jdk/test/javax/swing/plaf/nimbus/8041642/bug8041642.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, 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 @@ -24,7 +24,7 @@ /* * @test * @key headful - * @bug 8041642 8079450 + * @bug 8041642 8079450 8140237 * @summary Incorrect paint of JProgressBar in Nimbus LF * @author Semyon Sadetsky */ @@ -39,16 +39,7 @@ public class bug8041642 { private static JProgressBar bar; public static void main(String[] args) throws Exception { - for (UIManager.LookAndFeelInfo info : UIManager - .getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - try { - UIManager.setLookAndFeel(info.getClassName()); - } catch (Exception ex) { - } - break; - } - } + UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -58,14 +49,14 @@ public class bug8041642 { setup(frame); } }); + final Robot robot = new Robot(); + robot.delay(300); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { point = bar.getLocationOnScreen(); } }); - final Robot robot = new Robot(); - robot.delay(100); Color color = robot.getPixelColor(point.x + 1, point.y + 7); System.out.println(color); if (color.getGreen() < 150 || color.getBlue() > 30 || @@ -77,7 +68,7 @@ public class bug8041642 { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { - //frame.dispose(); + frame.dispose(); } }); } From 821e71f0ccf176ca398f2fee1df840a3da33393b Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 27 Apr 2017 14:07:38 -0700 Subject: [PATCH 08/55] 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9 Reviewed-by: serb, ssadetsky --- .../macosx/native/include/jawt_md.h | 2 +- .../share/classes/java/awt/package-info.java | 2 + .../java.desktop/share/native/include/jawt.h | 42 +- .../share/specs/AWT_Native_Interface.html | 776 ++++++++++++++++++ 4 files changed, 806 insertions(+), 16 deletions(-) create mode 100644 jdk/src/java.desktop/share/specs/AWT_Native_Interface.html diff --git a/jdk/src/java.desktop/macosx/native/include/jawt_md.h b/jdk/src/java.desktop/macosx/native/include/jawt_md.h index c6859fdbf90..94a13c9ab40 100644 --- a/jdk/src/java.desktop/macosx/native/include/jawt_md.h +++ b/jdk/src/java.desktop/macosx/native/include/jawt_md.h @@ -37,7 +37,7 @@ extern "C" { #endif /* - * Mac OS X specific declarations for AWT native interface. + * MacOS specific declarations for AWT native interface. * See notes in jawt.h for an example of use. */ diff --git a/jdk/src/java.desktop/share/classes/java/awt/package-info.java b/jdk/src/java.desktop/share/classes/java/awt/package-info.java index 76ecdae7ec0..682a371dd83 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/package-info.java +++ b/jdk/src/java.desktop/share/classes/java/awt/package-info.java @@ -54,6 +54,8 @@ *

* * @since 1.0 diff --git a/jdk/src/java.desktop/share/native/include/jawt.h b/jdk/src/java.desktop/share/native/include/jawt.h index 8cb2cb8564d..2079b0bc1b3 100644 --- a/jdk/src/java.desktop/share/native/include/jawt.h +++ b/jdk/src/java.desktop/share/native/include/jawt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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,18 +38,22 @@ extern "C" { * The AWT native interface allows a native C or C++ application a means * by which to access native structures in AWT. This is to facilitate moving * legacy C and C++ applications to Java and to target the needs of the - * community who, at present, wish to do their own native rendering to canvases - * for performance reasons. Standard extensions such as Java3D also require a - * means to access the underlying native data structures of AWT. + * developers who need to do their own native rendering to canvases + * for performance or other reasons. * - * There may be future extensions to this API depending on demand. + * Conversely it also provides mechanisms for an application which already + * has a native window to provide that to AWT for AWT rendering. * - * A VM does not have to implement this API in order to pass the JCK. - * It is recommended, however, that this API is implemented on VMs that support - * standard extensions, such as Java3D. + * Since every platform may be different in its native data structures + * and APIs for windowing systems the application must necessarily + * provided per-platform source and compile and deliver per-platform + * native code to use this API. + * + * These interfaces are not part of the Java SE specification and + * a VM is not required to implement this API. However it is strongly + * recommended that all implementations which support headful AWT + * also support these interfaces. * - * Since this is a native API, any program which uses it cannot be considered - * 100% pure java. */ /* @@ -58,7 +62,7 @@ extern "C" { * For each platform, there is a native drawing surface structure. This * platform-specific structure can be found in jawt_md.h. It is recommended * that additional platforms follow the same model. It is also recommended - * that VMs on Win32 and Solaris support the existing structures in jawt_md.h. + * that VMs on all platforms support the existing structures in jawt_md.h. * ******************* * EXAMPLE OF USAGE: @@ -98,8 +102,8 @@ extern "C" { * jboolean result; * jint lock; * - * // Get the AWT - * awt.version = JAWT_VERSION_1_3; + * // Get the AWT. Request version 9 to access features in that release. + * awt.version = JAWT_VERSION_9; * result = JAWT_GetAWT(env, &awt); * assert(result != JNI_FALSE); * @@ -154,7 +158,7 @@ typedef struct jawt_DrawingSurfaceInfo { /* * Pointer to the platform-specific information. This can be safely * cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a - * JAWT_X11DrawingSurfaceInfo on Solaris. On Mac OS X this is a + * JAWT_X11DrawingSurfaceInfo on Linux and Solaris. On Mac OS X this is a * pointer to a NSObject that conforms to the JAWT_SurfaceLayers * protocol. See jawt_md.h for details. */ @@ -237,7 +241,8 @@ typedef struct jawt_DrawingSurface { typedef struct jawt { /* * Version of this structure. This must always be set before - * calling JAWT_GetAWT() + * calling JAWT_GetAWT(). It affects the functions returned. + * Must be one of the known pre-defined versions. */ jint version; /* @@ -332,6 +337,13 @@ typedef struct jawt { _JNI_IMPORT_OR_EXPORT_ jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt); +/* + * Specify one of these constants as the JAWT.version + * Specifying an earlier version will limit the available functions to + * those provided in that earlier version of JAWT. + * See the "Since" note on each API. Methods with no "Since" + * may be presumed to be present in JAWT_VERSION_1_3. + */ #define JAWT_VERSION_1_3 0x00010003 #define JAWT_VERSION_1_4 0x00010004 #define JAWT_VERSION_1_7 0x00010007 diff --git a/jdk/src/java.desktop/share/specs/AWT_Native_Interface.html b/jdk/src/java.desktop/share/specs/AWT_Native_Interface.html new file mode 100644 index 00000000000..782376099a8 --- /dev/null +++ b/jdk/src/java.desktop/share/specs/AWT_Native_Interface.html @@ -0,0 +1,776 @@ + + + + + +Java AWT Native Interface Specification and Guide + + +

The Java AWT Native Interface Specification and Guide

+

Introduction

+

The Java AWT Native Interface (JAWT) comprises a small set of native +(eg C language-based) APIs that provide a standard supported way +for interaction between Java API windows and surfaces, and +platform native API windows and surfaces. +Non-Java libraries may then render to a Java owned window. +

+Note: in this document the terms "Java AWT Native Interface", +"AWT Native Interface" and "JAWT" are interchangeable and +refer to this same specification. +

+The fundamental obstacle to native rendering without JAWT is that +is that the rendering code cannot identify where to draw. +The native code needs access to information about a Java +drawing surface (such as a handle to the underlying native ID of a +Canvas), but cannot get it.

+Without that information (ie without JAWT) an application could +use native rendering only by creating its own top-level window +not shared at all with Java. This is unacceptable for most uses. +Except for usage via JAWT, this is considered to be entirely +internal to the Java platform implementation: private, unsupported +and undocumented. +

+JAWT should be supported in all headful implementations +where technically possible although this is not enforced by the JCK. +There is a platform-specific and a platform +independent portion to the API, to account for the differing +data structures and requirements of each platform. +This document specifies the platform independent portions and +also documents the platform dependent portions for the Oracle JDK +supported desktop operating environments. +For AWT the term platform is less tied to the underlying operating +system than it is to the desktop windowing environment. +

+Reasons for using the AWT Native Interface include +

+

+Drawbacks include +

+The header file "jawt.h" +in the Appendix fully specifies the APIs provided by JAWT. +

+An example illustrating how easy it is to use the AWT Native Interface +is presented and discussed later in this document.

+ +

JAWT usage depends on JNI

+

The definition of Java Standard Edition includes JNI, the Java +Native Interface. Many Java developers will never need to use it, +but the interface is the only standard supported way for a Java +language program to interact directly with +application code that has been compiled to the native machine +instructions for the host processor architecture. +JNI is used where ever there is a need for mixed languages. +These are by no means limited to cases like AWT. For example, you +could use JNI to integrate with native code that communicates with +a peripheral device, such as a scanner, connected to a system via a +USB port.

+

So JNI is general enough to be used to access almost any +sort of native library. +The rest of this document assumes a familiarity with how +to use JNI. + +

How to use JAWT

+

In this section we describe the most common usage of the AWT +Native Interface — overriding the paint method to +direct drawing operations to a native rendering library which then +queries the Java VM to determine the information it needs in order +to render. Note, however, that any native code may use the AWT +Native Interface to learn about a target drawing surface, not just +code in a paint method.

+

The first step in hooking up a native rendering library to a +Java Canvas is to define a new class that extends +Canvas and overrides the paint method. The Java +system routes all drawing operations for a Canvas object +through the paint method, as it does for all other GUI +objects. Canvas is a good candidate for the rendering surface as +it does not have any content as a Button would.

+

The new paint method, to be implemented in the native +rendering library, must be declared as public native void +, and the native library itself is loaded at runtime by including a +call to System.loadLibrary( "myRenderingLib")in +the static block of the class. The myRenderingLib +name is used for the native shared library; for Linux or the Solaris +operating environment, the actual name for the library file on disk +is libmyRenderingLib.so .

+

Here is a simple example of such a class:

+
+import java.awt.*;
+import java.awt.event.*;
+
+public class MyCanvas extends Canvas {
+    static {
+        System.loadLibrary("myRenderingLib");
+    }
+    public native void paint(Graphics g);
+
+    public static void main(String[] args) {
+        Frame f = new Frame();
+        f.setBounds(0, 0, 500, 110);
+        f.add(new MyCanvas());
+        f.addWindowListener( new WindowAdapter() {
+            public void windowClosing(WindowEvent ev) {
+                System.exit(0);
+            }
+        } );
+        f.show();
+    }
+}
+
+
+

Note that this class has a main method that can be used +to run this code as an application for testing purposes.

+

The next step is to run the javah tool on the +MyCanvas class file above to generate a C/C++ header file +that describes the interface to the native paint method +that Java expects to be used. javah is a standard tool +included with the JDK. NB: javac -h outputdir may also be used.

+ +

The final step ­ and the most interesting one ­ is to +write the native rendering method, with an interface that conforms +to the header file that javah generated, and build it as a +standard shared library (called myRenderingLib in the +above example) by linking it, against the appropriate JDK provided +$JDK_HOME/lib/$JAWT_LIB library for the target platform. +Where JAWT_LIB has the base name "jawt" and follows platform +shared object naming rules. i.e.: +

+ +This code will call back to the Java virtual machine to +get the drawing surface information it needs to access the +MyCanvas peer. Once this information is available, the +code can draw directly to MyCanvas using standard drawing +routines supplied by the underlying operating system.

+

Here is sample source code for a native paint method +designed for use in a X11-based drawing environment (Linux +or Solaris) and a Java VM where the AWT Native Interface is present:

+
+#include "MyCanvas.h"
+#include "jawt_md.h"
+
+/*
+ * Class:     MyCanvas
+ * Method:    paint
+ * Signature: (Ljava/awt/Graphics;)V
+ */
+JNIEXPORT void JNICALL Java_MyCanvas_paint
+(JNIEnv* env, jobject canvas, jobject graphics)
+{
+    JAWT awt;
+    JAWT_DrawingSurface* ds;
+    JAWT_DrawingSurfaceInfo* dsi;
+    JAWT_X11DrawingSurfaceInfo* dsi_x11;
+    jboolean result;
+    jint lock;
+    GC gc;
+
+    short       i;
+    char        *testString = "^^^ rendered from native code ^^^";
+
+    /* Get the AWT */
+    awt.version = JAWT_VERSION_9;
+    if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
+        printf("AWT Not found\n");
+        return;
+    }
+
+    /* Get the drawing surface */
+    ds = awt.GetDrawingSurface(env, canvas);
+    if (ds == NULL) {
+        printf("NULL drawing surface\n");
+        return;
+    }
+
+    /* Lock the drawing surface */
+    lock = ds->Lock(ds);
+    if((lock & JAWT_LOCK_ERROR) != 0) {
+        printf("Error locking surface\n");
+        awt.FreeDrawingSurface(ds);
+        return;
+    }
+
+    /* Get the drawing surface info */
+    dsi = ds->GetDrawingSurfaceInfo(ds);
+    if (dsi == NULL) {
+        printf("Error getting surface info\n");
+        ds->Unlock(ds);
+        awt.FreeDrawingSurface(ds);
+        return;
+    }
+
+    /* Get the platform-specific drawing info */
+    dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
+
+
+    /* Now paint */
+    gc = XCreateGC(dsi_x11->display, dsi_x11->drawable, 0, 0);
+    XSetBackground(dsi_x11->display, gc, 0);
+    for (i=0; i<36;i++)
+    {
+        XSetForeground(dsi_x11->display, gc, 10*i);
+        XFillRectangle(dsi_x11->display, dsi_x11->drawable, gc,
+                        10*i, 5, 90, 90);
+    }
+    XSetForeground(dsi_x11->display, gc, 155);
+    XDrawImageString(dsi_x11->display, dsi_x11->drawable, gc,
+                        100, 110, testString, strlen(testString));
+    XFreeGC(dsi_x11->display, gc);
+
+
+    /* Free the drawing surface info */
+    ds->FreeDrawingSurfaceInfo(dsi);
+
+    /* Unlock the drawing surface */
+    ds->Unlock(ds);
+
+    /* Free the drawing surface */
+    awt.FreeDrawingSurface(ds);
+}
+
+

The key data structure here is JAWT , which is defined +in jawt.h (included by jawt_md.h) ; it provides +access to all the information the native code needs to get the job +done. The first part of the native method is boilerplate: it +populates the JAWT structure, gets a +JAWT_DrawingSurface structure, locks the surface (only one +drawing engine at a time, please!), then gets a +JAWT_DrawingSurfaceInfo structure that contains a pointer +(in the platformInfo field) to the necessary +platform-specific drawing information. It also includes the +bounding rectangle of the drawing surface and the current clipping +region.

+

The structure of the information pointed to by +platformInfo is defined in a machine-dependent header file +called jawt_md.h. For X11 drawing, it includes +information about the X11 display and X11 drawable associated with +MyCanvas. After the drawing operations are completed, +there is more boilerplate code as JAWT_DrawingSurfaceInfo +is freed and JAWT_DrawingSurface is unlocked and +freed.

+

The corresponding code for the GDI API on the Microsoft Windows platform would +be structured similarly, but would include the version of +jawt_md.h for Microsoft Windows and the structure located +in the platformInfo field of drawing surface info would be +cast as a JAWT_Win32DrawingSurfaceInfo* . And, of course, +the actual drawing operations would need to be changed to those +appropriate for the Microsoft Windows platform. +The same also for MacOS. +

+

Summary

+

The ability to draw directly into a Java Canvas from a +native code library is extremely useful for developers planning to +migrate a legacy software system to Java, especially one that +includes a high-performance rendering engine. It makes it much +easier to migrate in stages, leaving performance-sensitive +rendering code alone, while other less-sensitive portions of code +are converted to Java. The result can be a modern Java-centric +application, providing the benefit of portability and development +efficiency, but one that does not sacrifice an investment in +performance of a key piece of native code.

+

References

+

The definitive reference to the Java Native Interface is The +Java Native Interface: Programmer's Guide and Specification by +Sheng Liang. This book was published in June +1999 by Addison-Wesley. The ISBN is 0-201-32577-2.

+

Appendix

+

Header Files for jawt.h and jawt_md.h

+ +

jawt.h

+
+#ifndef _JAVASOFT_JAWT_H_
+#define _JAVASOFT_JAWT_H_
+
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * AWT native interface.
+ *
+ * The AWT native interface allows a native C or C++ application a means
+ * by which to access native structures in AWT.  This is to facilitate moving
+ * legacy C and C++ applications to Java and to target the needs of the
+ * developers who need to do their own native rendering to canvases
+ * for performance or other reasons.
+ *
+ * Conversely it also provides mechanisms for an application which already
+ * has a native window to provide that to AWT for AWT rendering.
+ *
+ * Since every platform may be different in its native data structures
+ * and APIs for windowing systems the application must necessarily
+ * provided per-platform source and compile and deliver per-platform
+ * native code  to use this API.
+ *
+ * These interfaces are not part of the Java SE specification and
+ * a VM is not required to implement this API. However it is strongly
+ * recommended that all implementations which support headful AWT
+ * also support these interfaces.
+ *
+ */
+
+/*
+ * AWT Native Drawing Surface (JAWT_DrawingSurface).
+ *
+ * For each platform, there is a native drawing surface structure.  This
+ * platform-specific structure can be found in jawt_md.h.  It is recommended
+ * that additional platforms follow the same model.  It is also recommended
+ * that VMs on all platforms support the existing structures in jawt_md.h.
+ *
+ *******************
+ * EXAMPLE OF USAGE:
+ *******************
+ *
+ * On Microsoft Windows, a programmer wishes to access the HWND of a canvas
+ * to perform native rendering into it.  The programmer has declared the
+ * paint() method for their canvas subclass to be native:
+ *
+ *
+ * MyCanvas.java:
+ *
+ * import java.awt.*;
+ *
+ * public class MyCanvas extends Canvas {
+ *
+ *     static {
+ *         System.loadLibrary("mylib");
+ *     }
+ *
+ *     public native void paint(Graphics g);
+ * }
+ *
+ *
+ * myfile.c:
+ *
+ * #include "jawt_md.h"
+ * #include <assert.h>
+ *
+ * JNIEXPORT void JNICALL
+ * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
+ * {
+ *     JAWT awt;
+ *     JAWT_DrawingSurface* ds;
+ *     JAWT_DrawingSurfaceInfo* dsi;
+ *     JAWT_Win32DrawingSurfaceInfo* dsi_win;
+ *     jboolean result;
+ *     jint lock;
+ *
+ *     // Get the AWT. Request version 9 to access features in that release.
+ *     awt.version = JAWT_VERSION_9;
+ *     result = JAWT_GetAWT(env, &awt);
+ *     assert(result != JNI_FALSE);
+ *
+ *     // Get the drawing surface
+ *     ds = awt.GetDrawingSurface(env, canvas);
+ *     assert(ds != NULL);
+ *
+ *     // Lock the drawing surface
+ *     lock = ds->Lock(ds);
+ *     assert((lock & JAWT_LOCK_ERROR) == 0);
+ *
+ *     // Get the drawing surface info
+ *     dsi = ds->GetDrawingSurfaceInfo(ds);
+ *
+ *     // Get the platform-specific drawing info
+ *     dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
+ *
+ *     //////////////////////////////
+ *     // !!! DO PAINTING HERE !!! //
+ *     //////////////////////////////
+ *
+ *     // Free the drawing surface info
+ *     ds->FreeDrawingSurfaceInfo(dsi);
+ *
+ *     // Unlock the drawing surface
+ *     ds->Unlock(ds);
+ *
+ *     // Free the drawing surface
+ *     awt.FreeDrawingSurface(ds);
+ * }
+ *
+ */
+
+/*
+ * JAWT_Rectangle
+ * Structure for a native rectangle.
+ */
+typedef struct jawt_Rectangle {
+    jint x;
+    jint y;
+    jint width;
+    jint height;
+} JAWT_Rectangle;
+
+struct jawt_DrawingSurface;
+
+/*
+ * JAWT_DrawingSurfaceInfo
+ * Structure for containing the underlying drawing information of a component.
+ */
+typedef struct jawt_DrawingSurfaceInfo {
+    /*
+     * Pointer to the platform-specific information.  This can be safely
+     * cast to a JAWT_Win32DrawingSurfaceInfo on Microsoft Windows or a
+     * JAWT_X11DrawingSurfaceInfo on Linux and Solaris. On MacOS this is a
+     * pointer to a NSObject that conforms to the JAWT_SurfaceLayers protocol.
+     * See jawt_md.h for details.
+     */
+    void* platformInfo;
+    /* Cached pointer to the underlying drawing surface */
+    struct jawt_DrawingSurface* ds;
+    /* Bounding rectangle of the drawing surface */
+    JAWT_Rectangle bounds;
+    /* Number of rectangles in the clip */
+    jint clipSize;
+    /* Clip rectangle array */
+    JAWT_Rectangle* clip;
+} JAWT_DrawingSurfaceInfo;
+
+#define JAWT_LOCK_ERROR                 0x00000001
+#define JAWT_LOCK_CLIP_CHANGED          0x00000002
+#define JAWT_LOCK_BOUNDS_CHANGED        0x00000004
+#define JAWT_LOCK_SURFACE_CHANGED       0x00000008
+
+/*
+ * JAWT_DrawingSurface
+ * Structure for containing the underlying drawing information of a component.
+ * All operations on a JAWT_DrawingSurface MUST be performed from the same
+ * thread as the call to GetDrawingSurface.
+ */
+typedef struct jawt_DrawingSurface {
+    /* Cached reference to the Java environment of the calling thread.
+     * If Lock(), Unlock(), GetDrawingSurfaceInfo() or
+     * FreeDrawingSurfaceInfo() are called from a different thread,
+     * this data member should be set before calling those functions.
+     */
+    JNIEnv* env;
+    /* Cached reference to the target object */
+    jobject target;
+    /*
+     * Lock the surface of the target component for native rendering.
+     * When finished drawing, the surface must be unlocked with
+     * Unlock().  This function returns a bitmask with one or more of the
+     * following values:
+     *
+     * JAWT_LOCK_ERROR - When an error has occurred and the surface could not
+     * be locked.
+     *
+     * JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
+     *
+     * JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
+     *
+     * JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
+     */
+    jint (JNICALL *Lock)
+        (struct jawt_DrawingSurface* ds);
+    /*
+     * Get the drawing surface info.
+     * The value returned may be cached, but the values may change if
+     * additional calls to Lock() or Unlock() are made.
+     * Lock() must be called before this can return a valid value.
+     * Returns NULL if an error has occurred.
+     * When finished with the returned value, FreeDrawingSurfaceInfo must be
+     * called.
+     */
+    JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
+        (struct jawt_DrawingSurface* ds);
+    /*
+     * Free the drawing surface info.
+     */
+    void (JNICALL *FreeDrawingSurfaceInfo)
+        (JAWT_DrawingSurfaceInfo* dsi);
+    /*
+     * Unlock the drawing surface of the target component for native rendering.
+     */
+    void (JNICALL *Unlock)
+        (struct jawt_DrawingSurface* ds);
+} JAWT_DrawingSurface;
+
+/*
+ * JAWT
+ * Structure for containing native AWT functions.
+ */
+typedef struct jawt {
+    /*
+     * Version of this structure.  This must always be set before
+     * calling JAWT_GetAWT(). It affects the functions returned.
+     * Must be one of the known pre-defined versions.
+     */
+    jint version;
+    /*
+     * Return a drawing surface from a target jobject.  This value
+     * may be cached.
+     * Returns NULL if an error has occurred.
+     * Target must be a java.awt.Component (should be a Canvas
+     * or Window for native rendering).
+     * FreeDrawingSurface() must be called when finished with the
+     * returned JAWT_DrawingSurface.
+     */
+    JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
+        (JNIEnv* env, jobject target);
+    /*
+     * Free the drawing surface allocated in GetDrawingSurface.
+     */
+    void (JNICALL *FreeDrawingSurface)
+        (JAWT_DrawingSurface* ds);
+    /*
+     * Since 1.4
+     * Locks the entire AWT for synchronization purposes
+     */
+    void (JNICALL *Lock)(JNIEnv* env);
+    /*
+     * Since 1.4
+     * Unlocks the entire AWT for synchronization purposes
+     */
+    void (JNICALL *Unlock)(JNIEnv* env);
+    /*
+     * Since 1.4
+     * Returns a reference to a java.awt.Component from a native
+     * platform handle.  On Windows, this corresponds to an HWND;
+     * on Solaris and Linux, this is a Drawable.  For other platforms,
+     * see the appropriate machine-dependent header file for a description.
+     * The reference returned by this function is a local
+     * reference that is only valid in this environment.
+     * This function returns a NULL reference if no component could be
+     * found with matching platform information.
+     */
+    jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
+
+    /**
+     * Since 9
+     * Creates a java.awt.Frame placed in a native container. Container is
+     * referenced by the native platform handle. For example on Windows this
+     * corresponds to an HWND. For other platforms, see the appropriate
+     * machine-dependent header file for a description. The reference returned
+     * by this function is a local reference that is only valid in this
+     * environment. This function returns a NULL reference if no frame could be
+     * created with matching platform information.
+     */
+    jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo);
+
+    /**
+     * Since 9
+     * Moves and resizes the embedded frame. The new location of the top-left
+     * corner is specified by x and y parameters relative to the native parent
+     * component. The new size is specified by width and height.
+     *
+     * The embedded frame should be created by CreateEmbeddedFrame() method, or
+     * this function will not have any effect.
+     *
+     * java.awt.Component.setLocation() and java.awt.Component.setBounds() for
+     * EmbeddedFrame really don't move it within the native parent. These
+     * methods always locate the embedded frame at (0, 0) for backward
+     * compatibility. To allow moving embedded frames this method was
+     * introduced, and it works just the same way as setLocation() and
+     * setBounds() for usual, non-embedded components.
+     *
+     * Using usual get/setLocation() and get/setBounds() together with this new
+     * method is not recommended.
+     */
+    void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame,
+            jint x, jint y, jint w, jint h);
+    /**
+     * Since 9
+     * Synthesize a native message to activate or deactivate an EmbeddedFrame
+     * window depending on the value of parameter doActivate, if "true"
+     * activates the window; otherwise, deactivates the window.
+     *
+     * The embedded frame should be created by CreateEmbeddedFrame() method, or
+     * this function will not have any effect.
+     */
+    void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env,
+            jobject embeddedFrame, jboolean doActivate);
+} JAWT;
+
+/*
+ * Get the AWT native structure.  This function returns JNI_FALSE if
+ * an error occurs.
+ */
+_JNI_IMPORT_OR_EXPORT_
+jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
+
+/*
+ * Specify one of these constants as the JAWT.version
+ * Specifying an earlier version will limit the available functions to
+ * those provided in that earlier version of JAWT.
+ * See the "Since" note on each API. Methods with no "Since"
+ * may be presumed to be present in JAWT_VERSION_1_3.
+ */
+#define JAWT_VERSION_1_3 0x00010003
+#define JAWT_VERSION_1_4 0x00010004
+#define JAWT_VERSION_1_7 0x00010007
+#define JAWT_VERSION_9 0x00090000
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !_JAVASOFT_JAWT_H_ */
+
+
+

jawt_md.h (Linux/Solaris/X11 operating environment version)

+
+#ifndef _JAVASOFT_JAWT_MD_H_
+#define _JAVASOFT_JAWT_MD_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Intrinsic.h>
+#include "jawt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * X11-specific declarations for AWT native interface.
+ * See notes in jawt.h for an example of use.
+ */
+typedef struct jawt_X11DrawingSurfaceInfo {
+    Drawable drawable;
+    Display* display;
+    VisualID visualID;
+    Colormap colormapID;
+    int depth;
+} JAWT_X11DrawingSurfaceInfo;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_JAVASOFT_JAWT_MD_H_ */
+
+

jawt_md.h (Microsoft Windows version)

+
+#ifndef _JAVASOFT_JAWT_MD_H_
+#define _JAVASOFT_JAWT_MD_H_
+
+#include <windows.h>
+#include "jawt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Microsoft Windows specific declarations for AWT native interface.
+ * See notes in jawt.h for an example of use.
+ */
+typedef struct jawt_Win32DrawingSurfaceInfo {
+    /* Native window, DDB, or DIB handle */
+    union {
+        HWND hwnd;
+        HBITMAP hbitmap;
+        void* pbits;
+    };
+    /*
+     * This HDC should always be used instead of the HDC returned from
+     * BeginPaint() or any calls to GetDC().
+     */
+    HDC hdc;
+    HPALETTE hpalette;
+} JAWT_Win32DrawingSurfaceInfo;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_JAVASOFT_JAWT_MD_H_ */
+
+

jawt_md.h (MacOS version)

+
+#ifndef _JAVASOFT_JAWT_MD_H_
+#define _JAVASOFT_JAWT_MD_H_
+
+#include "jawt.h"
+
+#ifdef __OBJC__
+#import 
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * MacOS specific declarations for AWT native interface.
+ * See notes in jawt.h for an example of use.
+ */
+
+/*
+ * When calling JAWT_GetAWT with a JAWT version less than 1.7, you must pass this
+ * flag or you will not be able to get a valid drawing surface and JAWT_GetAWT will
+ * return false. This is to maintain compatibility with applications that used the
+ * interface with Java 6 which had multiple rendering models. This flag is not necessary
+ * when JAWT version 1.7 or greater is used as this is the only supported rendering mode.
+ *
+ * Example:
+ *   JAWT awt;
+ *   awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
+ *   jboolean success = JAWT_GetAWT(env, &awt);
+ */
+#define JAWT_MACOSX_USE_CALAYER 0x80000000
+
+/*
+ * When the native Cocoa toolkit is in use, the pointer stored in
+ * JAWT_DrawingSurfaceInfo->platformInfo points to a NSObject that conforms to the
+ * JAWT_SurfaceLayers protocol. Setting the layer property of this object will cause the
+ * specified layer to be overlaid on the Components rectangle. If the window the
+ * Component belongs to has a CALayer attached to it, this layer will be accessible via
+ * the windowLayer property.
+ */
+#ifdef __OBJC__
+@protocol JAWT_SurfaceLayers
+@property (readwrite, retain) CALayer *layer;
+@property (readonly) CALayer *windowLayer;
+@end
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_JAVASOFT_JAWT_MD_H_ */
+
+ + + From 9fe1a3b3e05036a8d018c5116324b7390c9a8450 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Mon, 1 May 2017 10:24:07 -0700 Subject: [PATCH 09/55] 8160530: [TEST-BUG] Consistent failure of java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java Reviewed-by: yan, prr, serb --- .../MissingEventsOnModalDialogTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jdk/test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java b/jdk/test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java index 997cac38011..a9ea6ecedf1 100644 --- a/jdk/test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java +++ b/jdk/test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, 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 MissingEventsOnModalDialogTest { mouseDragAndDrop(robot, point, getCenterPoint(targetFrame)); - long time = System.currentTimeMillis() + 200; + long time = System.currentTimeMillis() + 1000; while (!passed) { if (time < System.currentTimeMillis()) { @@ -222,10 +222,12 @@ public class MissingEventsOnModalDialogTest { } Thread.sleep(10); } - - Point point = getCenterPoint(dialog); Robot robot = new Robot(); robot.setAutoDelay(50); + robot.waitForIdle(); + robot.delay(200); + + Point point = getCenterPoint(dialog); robot.mouseMove(point.x, point.y); robot.mousePress(InputEvent.BUTTON1_MASK); From 0eb6c339c348b9ab90d18719b2c6bab219800a85 Mon Sep 17 00:00:00 2001 From: Bradford Wetmore Date: Tue, 2 May 2017 10:34:22 -0700 Subject: [PATCH 10/55] 8178014: CryptoPolicyParser's API comment contains < and > characters Reviewed-by: ksrini, mullan --- .../classes/javax/crypto/CipherInputStream.java | 4 ++-- .../classes/javax/crypto/CryptoPermission.java | 14 +++++++------- .../classes/javax/crypto/CryptoPolicyParser.java | 10 +++++----- .../javax/xml/crypto/dsig/XMLSignContext.java | 4 ++-- .../javax/xml/crypto/dsig/XMLValidateContext.java | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java index 9c8bc81393a..54ad9611e2d 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java +++ b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -93,7 +93,7 @@ public class CipherInputStream extends FilterInputStream { // stream status private boolean closed = false; - /** + /* * private convenience function. * * Entry condition: ostart = ofinish diff --git a/jdk/src/java.base/share/classes/javax/crypto/CryptoPermission.java b/jdk/src/java.base/share/classes/javax/crypto/CryptoPermission.java index 749e31926fe..ddc2648b693 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/CryptoPermission.java +++ b/jdk/src/java.base/share/classes/javax/crypto/CryptoPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -196,19 +196,19 @@ class CryptoPermission extends java.security.Permission { * Checks if the specified permission is "implied" by * this object. *

- * More specifically, this method returns true if:

+ * More specifically, this method returns true if: *

    - *
  • p is an instance of CryptoPermission, and

    + *

  • p is an instance of CryptoPermission, and
  • *
  • p's algorithm name equals or (in the case of wildcards) - * is implied by this permission's algorithm name, and

    + * is implied by this permission's algorithm name, and

  • *
  • p's maximum allowable key size is less or - * equal to this permission's maximum allowable key size, and

    + * equal to this permission's maximum allowable key size, and

  • *
  • p's algorithm parameter spec equals or is - * implied by this permission's algorithm parameter spec, and

    + * implied by this permission's algorithm parameter spec, and

  • *
  • p's exemptionMechanism equals or * is implied by this permission's * exemptionMechanism (a null exemption mechanism - * implies any other exemption mechanism). + * implies any other exemption mechanism).
  • *
* * @param p the permission to check against. diff --git a/jdk/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java b/jdk/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java index 7f27ea2506a..0093ce65b6d 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java +++ b/jdk/src/java.base/share/classes/javax/crypto/CryptoPolicyParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -46,10 +46,12 @@ import java.lang.reflect.*; * * The format of a permission entry in the jurisdiction policy file is: * + *
{@code
  *   permission [, 
  *              [[, ][, 
  *              [, , ]]]];
+ * }
* * @author Sharon Liu * @@ -526,8 +528,7 @@ final class CryptoPolicyParser { /** * Each grant entry in the policy configuration file is represented by a - * GrantEntry object.

- * + * GrantEntry object. *

* For example, the entry *

@@ -587,8 +588,7 @@ final class CryptoPolicyParser {
 
     /**
      * Each crypto permission entry in the policy configuration file is
-     * represented by a CryptoPermissionEntry object.  

- * + * represented by a CryptoPermissionEntry object. *

* For example, the entry *

diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignContext.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignContext.java
index d495de69b98..91c2f9e744c 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignContext.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, 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,7 +41,7 @@ import javax.xml.crypto.XMLCryptoContext;
  * (for example, you should not use the same XMLSignContext
  * instance to sign two different {@link XMLSignature} objects).
  * 

- * Supported Properties + * Supported Properties *

The following properties can be set using the * {@link #setProperty setProperty} method. *

    diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java index 4c3da6615c8..d8fbfd072ce 100644 --- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java +++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLValidateContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -40,7 +40,7 @@ import javax.xml.crypto.XMLCryptoContext; * (for example, you should not use the same XMLValidateContext * instance to validate two different {@link XMLSignature} objects). *

    - * Supported Properties + * Supported Properties *

    The following properties can be set by an application using the * {@link #setProperty setProperty} method. *

      From cc6031a373e4143877516e0172762d3822a82c74 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Tue, 2 May 2017 12:10:55 -0700 Subject: [PATCH 11/55] 8159902: OGL surfaces are not HiDPI compatible on Linux/Solaris Reviewed-by: prr, serb --- .../sun/java2d/opengl/GLXSurfaceData.java | 36 ++++++++++++++++--- .../JInternalFrame/8069348/bug8069348.java | 4 +-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java b/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java index fc7f3d90351..bfe9a26426e 100644 --- a/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java +++ b/jdk/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -112,11 +112,13 @@ public abstract class GLXSurfaceData extends OGLSurfaceData { } public static class GLXWindowSurfaceData extends GLXSurfaceData { + protected final int scale; public GLXWindowSurfaceData(X11ComponentPeer peer, GLXGraphicsConfig gc) { super(peer, gc, peer.getColorModel(), WINDOW); + scale = gc.getScale(); } public SurfaceData getReplacement() { @@ -126,6 +128,8 @@ public abstract class GLXSurfaceData extends OGLSurfaceData { public Rectangle getBounds() { Rectangle r = peer.getBounds(); r.x = r.y = 0; + r.width = (int) Math.ceil(r.width * scale); + r.height = (int) Math.ceil(r.height * scale); return r; } @@ -135,6 +139,16 @@ public abstract class GLXSurfaceData extends OGLSurfaceData { public Object getDestination() { return peer.getTarget(); } + + @Override + public double getDefaultScaleX() { + return scale; + } + + @Override + public double getDefaultScaleY() { + return scale; + } } /** @@ -177,6 +191,7 @@ public abstract class GLXSurfaceData extends OGLSurfaceData { private Image offscreenImage; private int width, height; + private final int scale; public GLXOffScreenSurfaceData(X11ComponentPeer peer, GLXGraphicsConfig gc, @@ -186,11 +201,12 @@ public abstract class GLXSurfaceData extends OGLSurfaceData { { super(peer, gc, cm, type); - this.width = width; - this.height = height; + scale = gc.getDevice().getScaleFactor(); + this.width = width * scale; + this.height = height * scale; offscreenImage = image; - initSurface(width, height); + initSurface(this.width, this.height); } public SurfaceData getReplacement() { @@ -201,6 +217,8 @@ public abstract class GLXSurfaceData extends OGLSurfaceData { if (type == FLIP_BACKBUFFER) { Rectangle r = peer.getBounds(); r.x = r.y = 0; + r.width = (int) Math.ceil(r.width * scale); + r.height = (int) Math.ceil(r.height * scale); return r; } else { return new Rectangle(width, height); @@ -213,5 +231,15 @@ public abstract class GLXSurfaceData extends OGLSurfaceData { public Object getDestination() { return offscreenImage; } + + @Override + public double getDefaultScaleX() { + return scale; + } + + @Override + public double getDefaultScaleY() { + return scale; + } } } diff --git a/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java b/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java index 62d49234722..1fd61fbfd16 100644 --- a/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java +++ b/jdk/test/javax/swing/JInternalFrame/8069348/bug8069348.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, 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,7 +37,7 @@ import static sun.awt.OSInfo.*; /** * @test * @key headful - * @bug 8069348 + * @bug 8069348 8159902 * @summary SunGraphics2D.copyArea() does not properly work for scaled graphics * @author Alexandr Scherbatiy * @modules java.desktop/sun.awt From 1f241ad95793c18c4dd37f58d14a9848a3733e55 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Tue, 2 May 2017 13:26:29 -0700 Subject: [PATCH 12/55] 8178984: Unnecessary angle brackets in the Line2D::intersectsLine() javadoc Reviewed-by: prr, jdv --- jdk/src/java.desktop/share/classes/java/awt/geom/Line2D.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/java/awt/geom/Line2D.java b/jdk/src/java.desktop/share/classes/java/awt/geom/Line2D.java index b877519f92e..98f70b7eb8a 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/geom/Line2D.java +++ b/jdk/src/java.desktop/share/classes/java/awt/geom/Line2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -618,7 +618,7 @@ public abstract class Line2D implements Shape, Cloneable { * specified line segment * @param y2 the Y coordinate of the end point of the * specified line segment - * @return {@code } if this line segment and the specified line segment + * @return {@code true} if this line segment and the specified line segment * intersect each other; {@code false} otherwise. * @since 1.2 */ From 2013e8365955aaad94fd023b76bf22b5b92a8e10 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 3 May 2017 08:46:37 +0200 Subject: [PATCH 13/55] 8179453: Add a proper SetupProcessMarkdown Reviewed-by: erikj --- common/doc/testing.md | 5 +- make/Javadoc.gmk | 44 +++++++------- make/UpdateBuildDocs.gmk | 59 ++++-------------- make/common/ProcessMarkdown.gmk | 103 ++++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+), 72 deletions(-) create mode 100644 make/common/ProcessMarkdown.gmk diff --git a/common/doc/testing.md b/common/doc/testing.md index 46f32f911e3..f84bd27dda2 100644 --- a/common/doc/testing.md +++ b/common/doc/testing.md @@ -199,9 +199,8 @@ Additional options to the Gtest test framework. Use `GTEST="OPTIONS=--help"` to see all available Gtest options. --- -# Override some definitions in http://openjdk.java.net/page.css that are -# unsuitable for this document. +# Override some definitions in the global css file that are not optimal for +# this document. header-includes: - '' - - '' --- diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index 6c47d064b06..0c36b7c4208 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -27,6 +27,7 @@ default: all include $(SPEC) include MakeBase.gmk include Modules.gmk +include ProcessMarkdown.gmk include ZipArchive.gmk include $(JDK_TOPDIR)/make/Tools.gmk include $(JDK_TOPDIR)/make/ModuleTools.gmk @@ -356,7 +357,7 @@ $(eval $(call SetupApiDocsGeneration, JAVASE_API, \ # unmodified ALL_MODULES := $(call FindAllModules) -COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib +COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib %.css $(foreach m, $(ALL_MODULES), \ $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ @@ -370,36 +371,35 @@ $(foreach m, $(ALL_MODULES), \ ) \ ) +# Copy the global resources +GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/specs +$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \ + SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \ + FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \ + DEST := $(JAVADOC_OUTPUTDIR)/specs/, \ +)) +JDK_SPECS_TARGETS += $(COPY_GLOBAL_RESOURCES) + ifeq ($(ENABLE_FULL_DOCS), true) # For all markdown files in $module/share/specs directories, convert them to # html. - MARKDOWN_SPEC_FILTER := %.md - # Macro for SetupCopyFiles that converts from markdown to html using pandoc. - define markdown-to-html - $(call MakeDir, $(@D)) - $(RM) $@ - $(PANDOC) -t html -s -o $@ $< - endef - - rename-md-to-html = \ - $(patsubst %.md,%.html,$1) + GLOBAL_SPECS_DEFAULT_CSS_FILE := $(JAVADOC_OUTPUTDIR)/specs/resources/jdk-default.css $(foreach m, $(ALL_MODULES), \ $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ - $(if $(SPECS_$m), \ - $(eval $(call SetupCopyFiles, CONVERT_MARKDOWN_$m, \ - SRC := $(SPECS_$m), \ - FILES := $(filter $(MARKDOWN_SPEC_FILTER), $(call CacheFind, $(SPECS_$m))), \ - DEST := $(JAVADOC_OUTPUTDIR)/specs/, \ - MACRO := markdown-to-html, \ - NAME_MACRO := rename-md-to-html, \ - LOG_ACTION := Converting from markdown, \ - )) \ - $(eval JDK_SPECS_TARGETS += $(CONVERT_MARKDOWN_$m)) \ + $(foreach d, $(SPECS_$m), \ + $(if $(filter %.md, $(call CacheFind, $d)), \ + $(eval $(call SetupProcessMarkdown, CONVERT_MARKDOWN_$m_$d, \ + SRC := $d, \ + FILES := $(filter %.md, $(call CacheFind, $d)), \ + DEST := $(JAVADOC_OUTPUTDIR)/specs/, \ + CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ + )) \ + ) \ + $(eval JDK_SPECS_TARGETS += $(CONVERT_MARKDOWN_$m_$d)) \ ) \ ) - endif # Special treatment for generated documentation diff --git a/make/UpdateBuildDocs.gmk b/make/UpdateBuildDocs.gmk index 42f5ee03594..e1008c42e93 100644 --- a/make/UpdateBuildDocs.gmk +++ b/make/UpdateBuildDocs.gmk @@ -27,6 +27,7 @@ default: all include $(SPEC) include MakeBase.gmk +include ProcessMarkdown.gmk ################################################################################ # This makefile updates the generated build html documentation. @@ -38,62 +39,26 @@ ifeq ($(PANDOC), ) $(error Cannot continue) endif -################################################################################ -# Setup make rules for converting a markdown file to html. -# -# Parameter 1 is the name of the rule. This name is used as variable prefix, -# and the targets generated are listed in a variable by that name. -# -# Remaining parameters are named arguments. These include: -# SOURCE_FILE The markdown source file -# TARGET_DIR The directory where to store the generated html file -# OPTIONS Additional options to pandoc -# -SetupMarkdownToHtml = $(NamedParamsMacroTemplate) -define SetupMarkdownToHtmlBody - ifeq ($$($1_SOURCE_FILE), ) - $$(error SOURCE_FILE is missing in SetupMarkdownToHtml $1) - endif - - ifeq ($$($1_TARGET_DIR), ) - $$(error TARGET_DIR is missing in SetupMarkdownToHtml $1) - endif - - $1_BASENAME := $$(notdir $$(basename $$($1_SOURCE_FILE))) - $1_OUTPUT_FILE := $$($1_TARGET_DIR)/$$($1_BASENAME).html - -$$($1_OUTPUT_FILE): $$($1_SOURCE_FILE) - $$(call LogInfo, Converting $$(notdir $1) to html) - $$(call MakeDir, $$($1_TARGET_DIR) $$(MAKESUPPORT_OUTPUTDIR)/markdown) - $$(call ExecuteWithLog, $$(MAKESUPPORT_OUTPUTDIR)/markdown/$1, \ - $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \ - --css 'http://openjdk.java.net/page.css' '$$<' -o '$$@') - TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \ - if [ "x$$$$TOO_LONG_LINES" != x ]; then \ - $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \ - $$(ECHO) "The following lines are longer than 80 characters:" ; \ - $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \ - fi - - $1 := $$($1_OUTPUT_FILE) - - TARGETS += $$($1) -endef +GLOBAL_SPECS_DEFAULT_CSS_FILE := $(JDK_TOPDIR)/make/data/docs-resources/specs/resources/jdk-default.css ################################################################################ DOCS_DIR := $(TOPDIR)/common/doc -$(eval $(call SetupMarkdownToHtml, building, \ - SOURCE_FILE := $(DOCS_DIR)/building.md, \ - TARGET_DIR := $(DOCS_DIR), \ +$(eval $(call SetupProcessMarkdown, building, \ + FILES := $(DOCS_DIR)/building.md, \ + DEST := $(DOCS_DIR), \ + CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ )) +TARGETS += $(building) -$(eval $(call SetupMarkdownToHtml, testing, \ - SOURCE_FILE := $(DOCS_DIR)/testing.md, \ - TARGET_DIR := $(DOCS_DIR), \ +$(eval $(call SetupProcessMarkdown, testing, \ + FILES := $(DOCS_DIR)/testing.md, \ + DEST := $(DOCS_DIR), \ + CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ OPTIONS := --toc, \ )) +TARGETS += $(testing) ################################################################################ diff --git a/make/common/ProcessMarkdown.gmk b/make/common/ProcessMarkdown.gmk new file mode 100644 index 00000000000..eec4d0cf060 --- /dev/null +++ b/make/common/ProcessMarkdown.gmk @@ -0,0 +1,103 @@ +# Copyright (c) 2017, 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. +# + +ifeq (,$(_MAKEBASE_GMK)) + $(error You must include MakeBase.gmk prior to including ProcessMarkdown.gmk) +endif + +# Helper function for SetupProcessMarkdown +# $1: The $1 from SetupProcessMarkdown +# $2: The name of the current source file, relative to $1_SRC +define ProcessMarkdown + $1_$2_OUTPUT_FILE := $$($1_DEST)/$$(basename $2).html + $1_$2_TARGET_DIR := $$(dir $$($1_$2_OUTPUT_FILE)) + ifneq ($$($1_CSS), ) + ifneq ($$(findstring http:/, $$($1_CSS)), ) + $1_$2_CSS_OPTION := --css '$$($1_CSS)' + else + $1_$2_CSS := $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR)) + $1_$2_CSS_OPTION := --css '$$($1_$2_CSS)' + endif + endif + $1_$2_OPTIONS = $$(shell $$(GREP) _pandoc-options_: $$($1_SRC)/$2 | $$(CUT) -d : -f 2-) + $1_$2_MARKER := $$(subst /,_,$1_$2) + + $1_$2_VARDEPS := $$($1_OPTIONS) $$($1_CSS) + $1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, \ + $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER).vardeps) + +$$($1_$2_OUTPUT_FILE): $$($1_SRC)/$2 $$($1_$2_VARDEPS_FILE) + $$(call LogInfo, Converting $2 to html) + $$(call MakeDir, $$($1_$2_TARGET_DIR) $$(SUPPORT_OUTPUTDIR)/markdown) + $$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \ + $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \ + $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$<' -o '$$@') + ifneq ($$(findstring $$(LOG_LEVEL), debug trace),) + TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \ + if [ "x$$$$TOO_LONG_LINES" != x ]; then \ + $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \ + $$(ECHO) "The following lines are longer than 80 characters:" ; \ + $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \ + fi + endif + + $1 += $$($1_$2_OUTPUT_FILE) +endef + +################################################################################ +# Setup make rules for converting a markdown file to html. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# SRC : Source root dir (defaults to dir of first file) +# DEST : Dest root dir +# FILES : List of files to copy with absolute paths, or path relative to SRC. +# Must be in SRC. +# OPTIONS : Additional options to pandoc +# +SetupProcessMarkdown = $(NamedParamsMacroTemplate) +define SetupProcessMarkdownBody + ifeq ($$($1_FILES), ) + $$(error FILES is missing in SetupProcessMarkdown $1) + endif + + ifeq ($$($1_DEST), ) + $$(error DEST is missing in SetupProcessMarkdown $1) + endif + + # Default SRC to the dir of the first file. + ifeq ($$($1_SRC), ) + $1_SRC := $$(dir $$(firstword $$($1_FILES))) + endif + + # Remove any trailing slash from SRC and DEST + $1_SRC := $$(patsubst %/,%,$$($1_SRC)) + $1_DEST := $$(patsubst %/,%,$$($1_DEST)) + + $$(foreach f, $$(patsubst $$($1_SRC)/%,%,$$($1_FILES)), \ + $$(eval $$(call ProcessMarkdown,$1,$$f)) \ + ) +endef From 48c6f05cf3e9eb70aabb4cb651d5a043e253ce85 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 3 May 2017 08:46:45 +0200 Subject: [PATCH 14/55] 8179453: Add a proper SetupProcessMarkdown Reviewed-by: erikj --- .../specs/resources/jdk-default.css | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 jdk/make/data/docs-resources/specs/resources/jdk-default.css diff --git a/jdk/make/data/docs-resources/specs/resources/jdk-default.css b/jdk/make/data/docs-resources/specs/resources/jdk-default.css new file mode 100644 index 00000000000..eea78ea539d --- /dev/null +++ b/jdk/make/data/docs-resources/specs/resources/jdk-default.css @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2017, 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. + */ + +body { + margin: 2em 2em; + font-family: DejaVu Sans, Bitstream Vera Sans, Luxi Sans, Verdana, Arial, Helvetica; + font-size: 10pt; + line-height: 1.4; +} + +pre, code, tt { + font-family: DejaVu Sans Mono, Bitstream Vera Sans Mono, Luxi Mono, + Courier New, monospace; +} + +blockquote { + margin: 1.5ex 0em 1.5ex 2em; +} + +p { + padding: 0pt; + margin: 1ex 0em; +} + +p:first-child, pre:first-child { margin-top: 0pt; } + +h1 { + font-weight: bold; + padding: 0pt; + margin: 2ex .5ex 1ex 0pt; +} + +h1:first-child, h2:first-child { + margin-top: 0ex; +} + +h2 { + font-weight: bold; + padding: 0pt; + margin: 2ex 0pt 1ex 0pt; +} + +h3 { + font-weight: bold; + padding: 0pt; + margin: 1.5ex 0pt 1ex 0pt; +} + +h4 { + font-weight: bold; + padding: 0pt; + margin: 1.5ex 0pt 1ex 0pt; +} + +a:link { + color: #437291; +} + +a:visited { + color: #666666; +} + +a[href]:hover { + color: #e76f00; +} + +a img { + border-width: 0px; +} + +img { + background: white; +} + +table { + border-collapse: collapse; + margin-left: 15px; + margin-right: 15px; +} + +th, td { + padding: 3px; + vertical-align: top; +} + +table, th, td { + border: 1px solid black; +} + +caption { + text-align: left; + font-style: italic; + text-indent: 15px; + margin-bottom:10px; +} + +tr:nth-child(even) { + background: #DDD; +} + +tr:nth-child(odd) { + background: #FFF; +} + +th { + background: #DDF; +} From bf1507936deb724806ea7f76964e847b0d36cf96 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Wed, 3 May 2017 07:39:45 -0700 Subject: [PATCH 15/55] 8179538: Update jdk.jdi to be HTML-5 friendly Reviewed-by: mchung, sspitsyn --- .../share/classes/com/sun/jdi/ClassType.java | 8 +--- .../classes/com/sun/jdi/InterfaceType.java | 5 +-- .../classes/com/sun/jdi/JDIPermission.java | 7 +-- .../share/classes/com/sun/jdi/Location.java | 4 +- .../classes/com/sun/jdi/ObjectReference.java | 5 +-- .../share/classes/com/sun/jdi/Type.java | 25 ++++++----- .../share/classes/com/sun/jdi/Value.java | 45 ++++++++++--------- .../com/sun/jdi/VirtualMachineManager.java | 6 +-- .../com/sun/jdi/doc-files/signature.html | 2 +- .../jdk.jdi/share/classes/module-info.java | 4 +- 10 files changed, 51 insertions(+), 60 deletions(-) diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java index 3286c73796f..65ef602c959 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -217,9 +217,6 @@ public interface ClassType extends ReferenceType { * a member of this class or a superclass, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is an initializer, constructor or static intializer. - * @throws {@link InvalidTypeException} if any argument in the - * argument list is not assignable to the corresponding method argument - * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not @@ -322,9 +319,6 @@ public interface ClassType extends ReferenceType { * a member of this class, if the size of the argument list * does not match the number of declared arguments for the constructor, * or if the method is not a constructor. - * @throws {@link InvalidTypeException} if any argument in the - * argument list is not assignable to the corresponding method argument - * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java index 64a9fa48ee0..8ff159f7ba1 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -168,9 +168,6 @@ public interface InterfaceType extends ReferenceType { * a member of this interface, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. - * @throws {@link InvalidTypeException} if any argument in the - * argument list is not assignable to the corresponding method argument - * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java index 109500afc97..175c12a2586 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, 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 @@ -40,8 +40,9 @@ package com.sun.jdi; * permission allows, and discusses the risks of granting code the * permission. * - * + *
      + * * * * diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java index b17f2418b9d..42ea4ca5e23 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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,7 +41,7 @@ import java.util.List; * Several mirror interfaces have locations. Each such mirror * extends a {@link Locatable} interface. *

      - * Strata + * Strata *

      * The source information for a Location is dependent on the * stratum which is used. A stratum is a source code diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java index fa93b015cfa..fdef1eae4d7 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -249,9 +249,6 @@ public interface ObjectReference extends Value { * if the method is a constructor or static initializer, or * if {@link #INVOKE_NONVIRTUAL} is specified and the method is * abstract. - * @throws {@link InvalidTypeException} if any argument in the - * argument list is not assignable to the corresponding method argument - * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Type.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Type.java index 41b61fcba80..50ad02747e8 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Type.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Type.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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,13 +45,14 @@ package com.sun.jdi; *

      * The following table illustrates which subinterfaces of Type * are used to mirror types in the target VM -- - *

      Table shows permission target name, what the + * permission allows, and associated risks
      Permission Target NameWhat the Permission Allows
      - * + *
      + * + * * - * - * - * + * + * + * * * * @@ -79,12 +80,12 @@ package com.sun.jdi; * * * - * + * * - * - * - * - * + * + * + * + * * * * diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Value.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Value.java index 75e5e410fa7..b54c7b796c9 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Value.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Value.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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,7 +31,7 @@ package com.sun.jdi; * value hierarchy encompassing primitive values and object values. *

      * Some examples of where values may be accessed: - *

      Maps each type declared in target to a mirrored + * instance of a subinterface of PrimitiveType or ReferenceType"
      Subinterfaces of {@link PrimitiveType}
      Type declared in target asIs mirrored as an instance of
      Type declared in target asIs mirrored as an instance of
      boolean {@link BooleanType}
      void{@link VoidType}
      Subinterfaces of {@link ReferenceType}
      Type declared in target asFor exampleIs mirrored as an instance of
      Type declared in target asFor exampleIs mirrored as an instance of
      a classDate
      + *
      * *
      layout
      {@link ObjectReference#getValue(com.sun.jdi.Field) * ObjectReference.getValue(Field)} @@ -52,15 +52,16 @@ package com.sun.jdi; *

      * The following table illustrates which subinterfaces of Value * are used to mirror values in the target VM -- - * - * + *
      + * + * * - * - * - * - * - * + * + * + * + * + * * * * @@ -106,13 +107,13 @@ package com.sun.jdi; * * * - * + * * - * - * - * - * - * + * + * + * + * + * * * * @@ -148,13 +149,13 @@ package com.sun.jdi; * * * - * + * * - * - * - * - * - * + * + * + * + * + * * * * diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java index 58c435accf3..d8f6e0bf011 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -51,8 +51,8 @@ import java.io.IOException; * Some {@link com.sun.jdi.connect.Connector} implementations may require slightly * different handling than presented below. * - *
      Maps each kind of value to a mirrored + * instance of a subinterface of Value
      Subinterfaces of {@link PrimitiveValue}
      Kind of valueFor example -
      expression in target
      Is mirrored as an
      instance of
      {@link Type} of value
      {@link #type() Value.type()}
      Kind of valueFor example -
      expression in target
      Is mirrored as an
      instance of
      {@link Type} of value
      {@link #type() Value.type()}
      a boolean {@code true} {@link VoidValue} {@link VoidType}
      Subinterfaces of {@link ObjectReference}
      Kind of valueFor example -
      expression in target
      Is mirrored as an
      instance of
      {@link Type} of value
      {@link #type() Value.type()}
      Kind of valueFor example -
      expression in target
      Is mirrored as an
      instance of
      {@link Type} of value
      {@link #type() Value.type()}
      a class instance {@code this} {@code this.getClass()}
        {@code .getClassLoader()}
      {@link ClassLoaderReference} {@link ClassType}
      Other
      Kind of valueFor example -
      expression in target
      Is mirrored as{@link Type} of value
      Kind of valueFor example -
      expression in target
      Is mirrored as{@link Type} of value
      null {@code null}
      + *
      + * * * * diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/doc-files/signature.html b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/doc-files/signature.html index b6b8d5ce666..3f3ac690437 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/doc-files/signature.html +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/doc-files/signature.html @@ -4,7 +4,7 @@ JDI Type Signatures - +
      Four scenarios for connecting a debugger to a virtual machine"
      ScenarioDescription
      diff --git a/jdk/src/jdk.jdi/share/classes/module-info.java b/jdk/src/jdk.jdi/share/classes/module-info.java index 6be55916fc4..e778655cf37 100644 --- a/jdk/src/jdk.jdi/share/classes/module-info.java +++ b/jdk/src/jdk.jdi/share/classes/module-info.java @@ -45,8 +45,8 @@ * Platform Debugger Architecture documentation for this release and the Java Platform Debugger Architecture * website. - *

      - * Global Exceptions: + *

      + * Global Exceptions: *

      * This section documents exceptions which apply to the entire API and are thus * not documented on individual methods. From 24f4f83ebcc81c22465e45885ab38b30a6ed7ae3 Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Wed, 3 May 2017 12:58:17 -0400 Subject: [PATCH 16/55] 8078267: Add test to verify that a module based JDBC driver via the service-provider loading mechanism Reviewed-by: joehw --- .../DriverManagerModuleTests.java | 146 ++++++++ .../luckydogtennis/LuckyDogDriver.java | 91 +++++ .../luckydogtennis/StubConnection.java | 315 ++++++++++++++++++ .../modules/luckydogdriver/module-info.java | 27 ++ .../com/luckydogtennis/StubConnection.java | 315 ++++++++++++++++++ .../com/luckydogtennis/StubDriver.java | 97 ++++++ .../sql/modules/mystubdriver/module-info.java | 29 ++ 7 files changed, 1020 insertions(+) create mode 100644 jdk/test/java/sql/driverModuleTests/DriverManagerModuleTests.java create mode 100644 jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/LuckyDogDriver.java create mode 100644 jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/StubConnection.java create mode 100644 jdk/test/java/sql/modules/luckydogdriver/module-info.java create mode 100644 jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubConnection.java create mode 100644 jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubDriver.java create mode 100644 jdk/test/java/sql/modules/mystubdriver/module-info.java diff --git a/jdk/test/java/sql/driverModuleTests/DriverManagerModuleTests.java b/jdk/test/java/sql/driverModuleTests/DriverManagerModuleTests.java new file mode 100644 index 00000000000..aad39cdb1dd --- /dev/null +++ b/jdk/test/java/sql/driverModuleTests/DriverManagerModuleTests.java @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2017, 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.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; +import static org.testng.Assert.*; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +/* + * @test + * @library /java/sql/modules + * @build luckydogdriver/* mystubdriver/* + * @run testng/othervm DriverManagerModuleTests + * @summary Tests that a JDBC Driver that is a module can be loaded + * via the service-provider loading mechanism. + */ +public class DriverManagerModuleTests { + + private final String LUCKYDOGDRIVER_URL = "jdbc:tennis:myDB"; + private static final String STUBDRIVERURL = "jdbc:stub:myDB"; + private static final String CONNECTION_CLASS_NAME = "com.luckydogtennis.StubConnection"; + + @BeforeClass + public static void setUpClass() throws Exception { + } + + @AfterClass + public static void tearDownClass() throws Exception { + } + + @BeforeMethod + public void setUpMethod() throws Exception { + } + + @AfterMethod + public void tearDownMethod() throws Exception { + } + + /** + * Validate JDBC drivers as modules will be accessible. One driver will be + * loaded and registered via the service-provider loading mechanism. The + * other driver will need to be explictly loaded + * + * @throws java.lang.Exception + */ + @Test + public void test() throws Exception { + System.out.println("\n$$$ runing Test()\n"); + dumpRegisteredDrivers(); + Driver d = DriverManager.getDriver(STUBDRIVERURL); + assertNotNull(d, "StubDriver should not be null"); + assertTrue(isDriverRegistered(d)); + Driver d2 = null; + + // This driver should not be found until it is explictly loaded + try { + d2 = DriverManager.getDriver(LUCKYDOGDRIVER_URL); + } catch (SQLException e) { + // ignore expected Exception + } + assertNull(d2, "LuckyDogDriver should be null"); + loadDriver(); + d2 = DriverManager.getDriver(LUCKYDOGDRIVER_URL); + assertNotNull(d2, "LuckyDogDriver should not be null"); + assertTrue(isDriverRegistered(d2), "Driver was NOT registered"); + + dumpRegisteredDrivers(); + DriverManager.deregisterDriver(d2); + assertFalse(isDriverRegistered(d2), "Driver IS STILL registered"); + dumpRegisteredDrivers(); + + } + + /** + * Validate that a Connection can be obtained from a JDBC driver which is a + * module and loaded via the service-provider loading mechanism. + * + * @throws java.lang.Exception + */ + @Test + public void test00() throws Exception { + System.out.println("\n$$$ runing Test00()\n"); + Connection con = DriverManager.getConnection(STUBDRIVERURL); + assertNotNull(con, "Returned Connection should not be NULL"); + System.out.println("con=" + con.getClass().getName()); + assertTrue(con.getClass().getName().equals(CONNECTION_CLASS_NAME)); + + } + + /** + * Utility method to see if a driver is registered + */ + private static void dumpRegisteredDrivers() { + System.out.println("\n+++ Loaded Drivers +++"); + + DriverManager.drivers().forEach(d -> System.out.println("\t\t### Driver:" + d)); + + System.out.println("++++++++++++++++++++++++"); + } + + /** + * Utility method to load the LuckyDogDriver + */ + private static void loadDriver() { + try { + Class.forName("luckydogtennis.LuckyDogDriver"); + } catch (ClassNotFoundException ex) { + System.out.println("**** Error: luckydogtennis.LuckyDogDriver not found"); + } + System.out.println("Driver Loaded"); + } + + /** + * Utility method to see if a driver is registered + */ + private static boolean isDriverRegistered(Driver d) { + return DriverManager.drivers().filter(driver-> driver == d).findFirst().isPresent(); + + } +} diff --git a/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/LuckyDogDriver.java b/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/LuckyDogDriver.java new file mode 100644 index 00000000000..39f69133035 --- /dev/null +++ b/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/LuckyDogDriver.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package luckydogtennis; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.DriverPropertyInfo; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class LuckyDogDriver implements Driver { + + static { + registerDriver(); + System.out.println("*****in static block LuckyDogDriver"); + } + + private static void registerDriver() { + try { + DriverManager.registerDriver(new LuckyDogDriver()); + } catch (SQLException ex) { + Logger.getLogger(LuckyDogDriver.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public LuckyDogDriver() { + System.out.println("*****in LuckyDogDriver Constructor"); + } + + @Override + public Connection connect(String url, Properties info) throws SQLException { + if (acceptsURL(url)) { + return new StubConnection(); + } + return null; + } + + @Override + public boolean acceptsURL(String url) throws SQLException { + return url.matches("^jdbc:tennis:.*"); + } + + @Override + public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMajorVersion() { + return 1; + } + + @Override + public int getMinorVersion() { + return 0; + } + + @Override + public boolean jdbcCompliant() { + return true; + } + + @Override + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/StubConnection.java b/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/StubConnection.java new file mode 100644 index 00000000000..3faece2ca33 --- /dev/null +++ b/jdk/test/java/sql/modules/luckydogdriver/luckydogtennis/StubConnection.java @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package luckydogtennis; + +import java.sql.Array; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.NClob; +import java.sql.PreparedStatement; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Struct; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Executor; + +public class StubConnection implements Connection{ + + @Override + public Statement createStatement() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String nativeSQL(String sql) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAutoCommit(boolean autoCommit) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getAutoCommit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void commit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public DatabaseMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setReadOnly(boolean readOnly) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isReadOnly() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCatalog(String catalog) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCatalog() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getTransactionIsolation() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Map> getTypeMap() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setHoldability(int holdability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Savepoint setSavepoint() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Savepoint setSavepoint(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback(Savepoint savepoint) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void releaseSavepoint(Savepoint savepoint) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob createClob() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob createBlob() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob createNClob() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML createSQLXML() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isValid(int timeout) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClientInfo(String name, String value) throws SQLClientInfoException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClientInfo(Properties properties) throws SQLClientInfoException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getClientInfo(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Properties getClientInfo() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array createArrayOf(String typeName, Object[] elements) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Struct createStruct(String typeName, Object[] attributes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSchema(String schema) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getSchema() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void abort(Executor executor) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getNetworkTimeout() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/jdk/test/java/sql/modules/luckydogdriver/module-info.java b/jdk/test/java/sql/modules/luckydogdriver/module-info.java new file mode 100644 index 00000000000..5f98bc3ecd1 --- /dev/null +++ b/jdk/test/java/sql/modules/luckydogdriver/module-info.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2017, 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. + */ +module luckydogdriver { + requires transitive java.logging; + requires transitive java.sql; + exports luckydogtennis; +} diff --git a/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubConnection.java b/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubConnection.java new file mode 100644 index 00000000000..16971149b4d --- /dev/null +++ b/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubConnection.java @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.luckydogtennis; + +import java.sql.Array; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.NClob; +import java.sql.PreparedStatement; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Struct; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Executor; + +public class StubConnection implements Connection{ + + @Override + public Statement createStatement() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String nativeSQL(String sql) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAutoCommit(boolean autoCommit) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getAutoCommit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void commit() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public DatabaseMetaData getMetaData() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setReadOnly(boolean readOnly) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isReadOnly() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setCatalog(String catalog) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getCatalog() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getTransactionIsolation() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Map> getTypeMap() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setHoldability(int holdability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Savepoint setSavepoint() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Savepoint setSavepoint(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void rollback(Savepoint savepoint) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void releaseSavepoint(Savepoint savepoint) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Clob createClob() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Blob createBlob() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public NClob createNClob() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public SQLXML createSQLXML() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isValid(int timeout) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClientInfo(String name, String value) throws SQLClientInfoException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setClientInfo(Properties properties) throws SQLClientInfoException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getClientInfo(String name) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Properties getClientInfo() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Array createArrayOf(String typeName, Object[] elements) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Struct createStruct(String typeName, Object[] attributes) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSchema(String schema) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getSchema() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void abort(Executor executor) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getNetworkTimeout() throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubDriver.java b/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubDriver.java new file mode 100644 index 00000000000..d080deefbf2 --- /dev/null +++ b/jdk/test/java/sql/modules/mystubdriver/com/luckydogtennis/StubDriver.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.luckydogtennis; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.DriverPropertyInfo; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class StubDriver implements Driver { + + static { + System.out.println("*****in static block StubDriver"); + registerDriver(); + } + + private static void registerDriver() { + try { + DriverManager.registerDriver(new StubDriver()); + } catch (SQLException ex) { + Logger.getLogger(StubDriver.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public StubDriver() { + System.out.println("*****in StubDriver Constructor*************"); + /* + for (StackTraceElement ste : Thread.currentThread().getStackTrace()) { + System.out.println(ste); + } + System.out.println("******************"); + */ + } + + @Override + public Connection connect(String url, Properties info) throws SQLException { + if (acceptsURL(url)) { + return new StubConnection(); + } + return null; + } + + @Override + public boolean acceptsURL(String url) throws SQLException { + return url.matches("^jdbc:stub:.*"); + } + + @Override + public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMajorVersion() { + return 1; + } + + @Override + public int getMinorVersion() { + return 0; + } + + @Override + public boolean jdbcCompliant() { + return true; + } + + @Override + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/jdk/test/java/sql/modules/mystubdriver/module-info.java b/jdk/test/java/sql/modules/mystubdriver/module-info.java new file mode 100644 index 00000000000..ce15e831130 --- /dev/null +++ b/jdk/test/java/sql/modules/mystubdriver/module-info.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2017, 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. + */ +module mystubdriver { + requires transitive java.logging; + requires transitive java.sql; + exports com.luckydogtennis; + provides java.sql.Driver with + com.luckydogtennis.StubDriver; +} From 32e2e37f5c600bdbd3f5491ba8dfd29307178406 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Wed, 3 May 2017 20:49:56 +0200 Subject: [PATCH 17/55] 8179438: Incremental builds broken on Windows Reviewed-by: tbell, ihse --- make/common/NativeCompilation.gmk | 1 + 1 file changed, 1 insertion(+) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index ae0cc2068de..28911884d04 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -165,6 +165,7 @@ endif WINDOWS_SHOWINCLUDE_SED_PATTERN := \ -e '/^Note: including file:/!d' \ -e 's|Note: including file: *||' \ + -e 's|\r||g' \ -e 's|\\|/|g' \ -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \ -e '\|$(TOPDIR)|I !d' \ From 6aff2d0db6f574cd321d56fdfb3a82cc1a023c5b Mon Sep 17 00:00:00 2001 From: John Jiang Date: Wed, 3 May 2017 21:15:07 -0700 Subject: [PATCH 18/55] 8179451: Confidential copyright header in openjdk Using Oracle OpenJDK copyright notices Reviewed-by: weijun --- .../ssl/CertPathRestrictions/JSSEClient.java | 20 ++++++++++++++++++- .../ssl/CertPathRestrictions/JSSEServer.java | 20 ++++++++++++++++++- .../CertPathRestrictions/TLSRestrictions.java | 4 +--- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java index 636809ba9d2..e2e1b47d506 100644 --- a/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java @@ -1,6 +1,24 @@ /* * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * 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.io.InputStream; diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java index 80d76e9b58d..338329163ea 100644 --- a/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java @@ -1,6 +1,24 @@ /* * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * 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.io.InputStream; diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java b/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java index 35293d1b8a6..2a6ffb2d135 100644 --- a/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java @@ -4,9 +4,7 @@ * * 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. + * 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 From f057a4afd816e36ac1b1825895a3e66fce060126 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Thu, 4 May 2017 07:26:16 +0000 Subject: [PATCH 19/55] 8178380: Module system implementation refresh (5/2017) Reviewed-by: alanb --- common/autoconf/generated-configure.sh | 30 +++++++++++++++++++++++--- common/autoconf/platform.m4 | 28 ++++++++++++++++++++++-- common/autoconf/spec.gmk.in | 9 +++++--- make/CreateJmods.gmk | 3 +-- make/ReleaseFile.gmk | 2 ++ 5 files changed, 62 insertions(+), 10 deletions(-) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 15a76ea619b..557304f2a4f 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -995,8 +995,9 @@ OPENJDK_TARGET_CPU_OSARCH OPENJDK_TARGET_CPU_ISADIR OPENJDK_TARGET_CPU_LEGACY_LIB OPENJDK_TARGET_CPU_LEGACY -OPENJDK_MODULE_TARGET_OS_ARCH -OPENJDK_MODULE_TARGET_OS_NAME +RELEASE_FILE_OS_ARCH +RELEASE_FILE_OS_NAME +OPENJDK_MODULE_TARGET_PLATFORM COMPILE_TYPE OPENJDK_TARGET_CPU_ENDIAN OPENJDK_TARGET_CPU_BITS @@ -4897,6 +4898,8 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom" + + #%%% Build and target systems %%% @@ -5180,7 +5183,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1492975963 +DATE_WHEN_GENERATED=1493697637 ############################################################################### # @@ -16040,6 +16043,27 @@ $as_echo "$COMPILE_TYPE" >&6; } OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU" fi + OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}" + + + + if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then + RELEASE_FILE_OS_NAME=SunOS + fi + if test "x$OPENJDK_TARGET_OS" = "xlinux"; then + RELEASE_FILE_OS_NAME=Linux + fi + if test "x$OPENJDK_TARGET_OS" = "xwindows"; then + RELEASE_FILE_OS_NAME=Windows + fi + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + RELEASE_FILE_OS_NAME="Darwin" + fi + if test "x$OPENJDK_TARGET_OS" = "xaix"; then + RELEASE_FILE_OS_NAME="AIX" + fi + RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU} + diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4 index c9c339decb3..0dbf74cbe12 100644 --- a/common/autoconf/platform.m4 +++ b/common/autoconf/platform.m4 @@ -433,6 +433,29 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER], ]) +AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], +[ + if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then + RELEASE_FILE_OS_NAME=SunOS + fi + if test "x$OPENJDK_TARGET_OS" = "xlinux"; then + RELEASE_FILE_OS_NAME=Linux + fi + if test "x$OPENJDK_TARGET_OS" = "xwindows"; then + RELEASE_FILE_OS_NAME=Windows + fi + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + RELEASE_FILE_OS_NAME="Darwin" + fi + if test "x$OPENJDK_TARGET_OS" = "xaix"; then + RELEASE_FILE_OS_NAME="AIX" + fi + RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU} + + AC_SUBST(RELEASE_FILE_OS_NAME) + AC_SUBST(RELEASE_FILE_OS_ARCH) +]) + AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES], [ if test "x$OPENJDK_TARGET_OS" = xmacosx; then @@ -447,8 +470,8 @@ AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES], OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU" fi - AC_SUBST(OPENJDK_MODULE_TARGET_OS_NAME) - AC_SUBST(OPENJDK_MODULE_TARGET_OS_ARCH) + OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}" + AC_SUBST(OPENJDK_MODULE_TARGET_PLATFORM) ]) #%%% Build and target systems %%% @@ -466,6 +489,7 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET], PLATFORM_EXTRACT_TARGET_AND_BUILD PLATFORM_SETUP_TARGET_CPU_BITS PLATFORM_SET_MODULE_TARGET_OS_VALUES + PLATFORM_SET_RELEASE_FILE_OS_VALUES PLATFORM_SETUP_LEGACY_VARS ]) diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 08a38c6bc15..ad113a258cb 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -101,9 +101,12 @@ OPENJDK_BUILD_CPU_ARCH:=@OPENJDK_BUILD_CPU_ARCH@ OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@ OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@ -# OS values for use in ModuleTarget class file attribute. -OPENJDK_MODULE_TARGET_OS_NAME:=@OPENJDK_MODULE_TARGET_OS_NAME@ -OPENJDK_MODULE_TARGET_OS_ARCH:=@OPENJDK_MODULE_TARGET_OS_ARCH@ +# Target platform value in ModuleTarget class file attribute. +OPENJDK_MODULE_TARGET_PLATFORM:=@OPENJDK_MODULE_TARGET_PLATFORM@ + +# OS_* properties in release file +RELEASE_FILE_OS_NAME:=@RELEASE_FILE_OS_NAME@ +RELEASE_FILE_OS_ARCH:=@RELEASE_FILE_OS_ARCH@ LIBM:=@LIBM@ LIBDL:=@LIBDL@ diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk index 65b9bf52343..7d4287e02d8 100644 --- a/make/CreateJmods.gmk +++ b/make/CreateJmods.gmk @@ -135,8 +135,7 @@ $(JMODS_DIR)/$(MODULE).jmod: $(DEPS) $(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@) $(JMOD) create \ --module-version $(VERSION_SHORT) \ - --os-name '$(OPENJDK_MODULE_TARGET_OS_NAME)' \ - --os-arch '$(OPENJDK_MODULE_TARGET_OS_ARCH)' \ + --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \ --module-path $(JMODS_DIR) \ --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \ $(JMOD_FLAGS) $(JMODS_TEMPDIR)/$(notdir $@) diff --git a/make/ReleaseFile.gmk b/make/ReleaseFile.gmk index b57cb7be780..0f4d080a07e 100644 --- a/make/ReleaseFile.gmk +++ b/make/ReleaseFile.gmk @@ -48,6 +48,8 @@ define create-info-file $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)")) $(call info-file-item, "SOURCE", "$(strip $(SOURCE_REVISION))") $(call info-file-item, "IMPLEMENTOR", "$(COMPANY_NAME)") + $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)") + $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)") endef # Param 1 - The file containing the MODULES list From 4c0e26e374b2ab6320b70cb39c6ad865c8bd9644 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Thu, 4 May 2017 07:26:55 +0000 Subject: [PATCH 20/55] 8178380: Module system implementation refresh (5/2017) Co-authored-by: Mandy Chung Co-authored-by: Chris Hegarty Reviewed-by: mchung, alanb, sspitsyn --- jdk/make/mapfiles/libinstrument/mapfile-vers | 1 + .../share/classes/java/lang/ClassLoader.java | 45 +- .../share/classes/java/lang/Module.java | 27 +- .../classes/java/lang/SecurityManager.java | 61 ++- .../share/classes/java/lang/System.java | 7 +- .../java/lang/invoke/MethodHandles.java | 7 +- .../java/lang/module/Configuration.java | 14 +- .../java/lang/module/ModuleDescriptor.java | 1 + .../java/lang/module/ModuleFinder.java | 8 +- .../classes/java/lang/module/Resolver.java | 150 ++---- .../classes/java/nio/file/FileSystems.java | 10 +- .../internal/loader/BuiltinClassLoader.java | 27 +- .../jdk/internal/misc/JavaLangAccess.java | 13 +- .../classes/jdk/internal/module/Checks.java | 152 +++--- .../internal/module/ClassFileAttributes.java | 53 +-- .../jdk/internal/module/ModuleBootstrap.java | 51 +- .../internal/module/ModuleHashesBuilder.java | 2 +- .../jdk/internal/module/ModuleInfo.java | 17 +- .../internal/module/ModuleInfoExtender.java | 16 +- .../jdk/internal/module/ModuleInfoWriter.java | 5 +- .../jdk/internal/module/ModuleLoaderMap.java | 74 ++- .../jdk/internal/module/ModulePatcher.java | 6 +- .../jdk/internal/module/ModulePath.java | 55 ++- .../jdk/internal/module/ModuleReferences.java | 5 +- .../jdk/internal/module/ModuleResolution.java | 31 +- .../jdk/internal/module/ModuleTarget.java | 21 +- .../classes/jdk/internal/module/Modules.java | 100 +++- .../jdk/internal/module/Resources.java | 10 +- .../java.base/share/classes/module-info.java | 1 + .../classes/sun/launcher/LauncherHelper.java | 439 ++++++++++++++---- .../launcher/resources/launcher.properties | 38 +- .../java.base/share/native/libjli/emessages.h | 3 +- jdk/src/java.base/share/native/libjli/java.c | 131 ++++-- .../java/lang/instrument/Instrumentation.java | 3 +- .../classes/java/lang/instrument/package.html | 163 ++++--- .../share/classes/module-info.java | 3 + .../sun/instrument/InstrumentationImpl.java | 13 +- .../InstrumentationImplNativeMethods.c | 17 + .../native/libinstrument/InvocationAdapter.c | 111 ++++- .../java/lang/management/ThreadInfo.java | 3 + .../sun/tools/attach/VirtualMachineImpl.java | 13 +- .../sun/tools/attach/VirtualMachineImpl.java | 13 +- .../sun/tools/attach/VirtualMachineImpl.java | 13 +- .../tools/attach/HotSpotVirtualMachine.java | 63 ++- .../sun/tools/attach/VirtualMachineImpl.java | 13 +- .../sun/tools/attach/VirtualMachineImpl.java | 23 +- .../share/classes/sun/tools/jar/Main.java | 308 ++++++++---- .../classes/sun/tools/jar/Validator.java | 2 +- .../sun/tools/jar/resources/jar.properties | 6 +- .../jlink/builder/DefaultImageBuilder.java | 12 +- .../jlink/internal/ImagePluginStack.java | 10 +- .../jdk/tools/jlink/internal/Platform.java | 19 +- .../jlink/internal/ResourcePoolManager.java | 12 +- .../internal/plugins/ReleaseInfoPlugin.java | 29 +- .../internal/plugins/SystemModulesPlugin.java | 15 +- .../jlink/plugin/ResourcePoolModule.java | 13 +- .../classes/jdk/tools/jmod/JmodTask.java | 148 +++--- .../jdk/tools/jmod/resources/jmod.properties | 6 +- .../HotSpotDiagnosticMXBean/CheckOrigin.java | 1 + jdk/test/com/sun/tools/attach/AttachSelf.java | 61 +++ jdk/test/com/sun/tools/attach/RunnerUtil.java | 5 +- .../com/sun/tools/attach/java.policy.allow | 3 +- .../com/sun/tools/attach/modules/Agent.java | 30 ++ .../com/sun/tools/attach/modules/Driver.java | 35 ++ .../tools/attach/modules/m/module-info.java} | 9 +- .../sun/tools/attach/modules/m/p/Main.java | 164 +++++++ .../lang/instrument/executableJAR/Agent.java | 33 ++ .../instrument/executableJAR/AgentHelper.java | 25 + .../executableJAR/ExecJarWithAgent.java | 138 ++++++ .../lang/instrument/executableJAR/Main.java | 41 ++ .../java/lang/invoke/DefineClassTest.java | 29 +- .../lang/module/AutomaticModulesTest.java | 21 +- .../java/lang/module/ConfigurationTest.java | 40 +- .../lang/module/ModuleDescriptorTest.java | 48 +- .../customfs/ModulesInCustomFileSystem.java | 142 ++++++ .../lang/module/customfs/m1/module-info.java | 27 ++ .../java/lang/module/customfs/m1/p/Main.java | 30 ++ .../lang/module/customfs/m2/module-info.java | 26 ++ .../java/lang/module/customfs/m2/q/Hello.java | 30 ++ .../java/nio/file/spi/SetDefaultProvider.java | 144 +++++- jdk/test/java/nio/file/spi/TestProvider.java | 29 +- jdk/test/java/nio/file/spi/m/module-info.java | 24 + jdk/test/java/nio/file/spi/m/p/Main.java | 62 +++ .../util/logging/TestLoggerWeakRefLeak.java | 4 +- .../lib/testlibrary/ModuleTargetHelper.java | 17 +- .../bootstrap/JvmstatCountersTest.java | 2 +- jdk/test/tools/jar/mmrjar/Basic.java | 65 ++- jdk/test/tools/jar/modularJar/Basic.java | 19 +- .../jar/multiRelease/whitebox/Driver.java | 28 ++ .../tools/jar/ValidatorComparatorTest.java | 101 ++++ jdk/test/tools/jlink/IntegrationTest.java | 5 - jdk/test/tools/jlink/JLinkNegativeTest.java | 2 +- .../SystemModulesTest.java | 7 +- .../UserModuleTest.java | 8 +- .../src/m1/p1/Main.java | 3 +- .../src/m4/p4/Main.java | 3 +- jdk/test/tools/jmod/JmodTest.java | 13 +- .../modules/describe/DescribeModuleTest.java | 103 ++++ .../modules/listmods/ListModsTest.java | 138 ++---- .../src/java.transaction/module-info.java | 1 - .../systemmodules/PatchSystemModules.java | 73 ++- .../ShowModuleResolutionTest.java | 84 ++++ .../modules/validate/ValidateModulesTest.java | 135 ++++++ .../src/xmlkit/ClassReader.java | 3 +- 104 files changed, 3461 insertions(+), 1162 deletions(-) create mode 100644 jdk/test/com/sun/tools/attach/AttachSelf.java create mode 100644 jdk/test/com/sun/tools/attach/modules/Agent.java create mode 100644 jdk/test/com/sun/tools/attach/modules/Driver.java rename jdk/test/{tools/launcher/modules/listmods/src/java.transaction/javax/transaction/atomic/Atomic.java => com/sun/tools/attach/modules/m/module-info.java} (88%) create mode 100644 jdk/test/com/sun/tools/attach/modules/m/p/Main.java create mode 100644 jdk/test/java/lang/instrument/executableJAR/Agent.java create mode 100644 jdk/test/java/lang/instrument/executableJAR/AgentHelper.java create mode 100644 jdk/test/java/lang/instrument/executableJAR/ExecJarWithAgent.java create mode 100644 jdk/test/java/lang/instrument/executableJAR/Main.java create mode 100644 jdk/test/java/lang/module/customfs/ModulesInCustomFileSystem.java create mode 100644 jdk/test/java/lang/module/customfs/m1/module-info.java create mode 100644 jdk/test/java/lang/module/customfs/m1/p/Main.java create mode 100644 jdk/test/java/lang/module/customfs/m2/module-info.java create mode 100644 jdk/test/java/lang/module/customfs/m2/q/Hello.java create mode 100644 jdk/test/java/nio/file/spi/m/module-info.java create mode 100644 jdk/test/java/nio/file/spi/m/p/Main.java create mode 100644 jdk/test/tools/jar/multiRelease/whitebox/Driver.java create mode 100644 jdk/test/tools/jar/multiRelease/whitebox/jdk.jartool/sun/tools/jar/ValidatorComparatorTest.java create mode 100644 jdk/test/tools/launcher/modules/describe/DescribeModuleTest.java create mode 100644 jdk/test/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java create mode 100644 jdk/test/tools/launcher/modules/validate/ValidateModulesTest.java diff --git a/jdk/make/mapfiles/libinstrument/mapfile-vers b/jdk/make/mapfiles/libinstrument/mapfile-vers index 748670139bd..c51a8af2dc7 100644 --- a/jdk/make/mapfiles/libinstrument/mapfile-vers +++ b/jdk/make/mapfiles/libinstrument/mapfile-vers @@ -39,6 +39,7 @@ SUNWprivate_1.1 { Java_sun_instrument_InstrumentationImpl_getObjectSize0; Java_sun_instrument_InstrumentationImpl_appendToClassLoaderSearch0; Java_sun_instrument_InstrumentationImpl_setNativeMethodPrefixes; + Java_sun_instrument_InstrumentationImpl_loadAgent0; local: *; }; diff --git a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java index ddce2879e2e..fc5a780e7ed 100644 --- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java +++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java @@ -119,18 +119,24 @@ import sun.security.util.SecurityConstants; * The Java run-time has the following built-in class loaders: * *

        - *
      • Bootstrap class loader. + *
      • Bootstrap class loader. * It is the virtual machine's built-in class loader, typically represented * as {@code null}, and does not have a parent.

      • - *
      • {@linkplain #getPlatformClassLoader() Platform class loader}. + *
      • {@linkplain #getPlatformClassLoader() Platform class loader}. * All platform classes are visible to the platform class loader * that can be used as the parent of a {@code ClassLoader} instance. * Platform classes include Java SE platform APIs, their implementation * classes and JDK-specific run-time classes that are defined by the - * platform class loader or its ancestors.

      • - *
      • {@linkplain #getSystemClassLoader() System class loader}. - * It is also known as application class - * loader and is distinct from the platform class loader. + * platform class loader or its ancestors. + *

        To allow for upgrading/overriding of modules defined to the platform + * class loader, and where classes in the upgraded version link to + * classes in modules defined to the application class loader, the + * platform class loader may delegate to the application class loader. + * In other words, classes in named modules defined to the application + * class loader may be visible to the platform class loader.

      • + *
      • {@linkplain #getSystemClassLoader() System class loader}. + * It is also known as application class loader and is distinct + * from the platform class loader. * The system class loader is typically used to define classes on the * application class path, module path, and JDK-specific tools. * The platform class loader is a parent or an ancestor of the system class @@ -368,6 +374,10 @@ public abstract class ClassLoader { * Creates a new class loader of the specified name and using the * specified parent class loader for delegation. * + * @apiNote If the parent is specified as {@code null} (for the + * bootstrap class loader) then there is no guarantee that all platform + * classes are visible. + * * @param name class loader name; or {@code null} if not named * @param parent the parent class loader * @@ -390,9 +400,12 @@ public abstract class ClassLoader { * delegation. * *

        If there is a security manager, its {@link - * SecurityManager#checkCreateClassLoader() - * checkCreateClassLoader} method is invoked. This may result in - * a security exception.

        + * SecurityManager#checkCreateClassLoader() checkCreateClassLoader} method + * is invoked. This may result in a security exception.

        + * + * @apiNote If the parent is specified as {@code null} (for the + * bootstrap class loader) then there is no guarantee that all platform + * classes are visible. * * @param parent * The parent class loader @@ -2206,6 +2219,12 @@ public abstract class ClassLoader { * this class loader are searched recursively (parent by parent) * for a {@code Package} of the given name. * + * @apiNote The {@link #getPlatformClassLoader() platform class loader} + * may delegate to the application class loader but the application class + * loader is not its ancestor. When invoked on the platform class loader, + * this method will not find packages defined to the application + * class loader. + * * @param name * The package name * @@ -2251,6 +2270,14 @@ public abstract class ClassLoader { * {@code Package} object of the same package name, each defined by * a different class loader in the class loader hierarchy. * + * @apiNote The {@link #getPlatformClassLoader() platform class loader} + * may delegate to the application class loader. In other words, + * packages in modules defined to the application class loader may be + * visible to the platform class loader. On the other hand, + * the application class loader is not its ancestor and hence + * when invoked on the platform class loader, this method will not + * return any packages defined to the application class loader. + * * @return The array of {@code Package} objects defined by this * class loader and its ancestors * diff --git a/jdk/src/java.base/share/classes/java/lang/Module.java b/jdk/src/java.base/share/classes/java/lang/Module.java index 26337d86beb..f6ab49b4519 100644 --- a/jdk/src/java.base/share/classes/java/lang/Module.java +++ b/jdk/src/java.base/share/classes/java/lang/Module.java @@ -57,6 +57,7 @@ import jdk.internal.loader.BuiltinClassLoader; import jdk.internal.loader.BootLoader; import jdk.internal.misc.JavaLangAccess; import jdk.internal.misc.SharedSecrets; +import jdk.internal.module.ModuleLoaderMap; import jdk.internal.module.ServicesCatalog; import jdk.internal.module.Resources; import jdk.internal.org.objectweb.asm.AnnotationVisitor; @@ -215,8 +216,8 @@ public final class Module implements AnnotatedElement { } /** - * Returns the layer that contains this module or {@code null} if this - * module is not in a layer. + * Returns the module layer that contains this module or {@code null} if + * this module is not in a module layer. * * A module layer contains named modules and therefore this method always * returns {@code null} when invoked on an unnamed module. @@ -691,6 +692,13 @@ public final class Module implements AnnotatedElement { *

        This method has no effect if the package is already open * to the given module.

        * + * @apiNote This method can be used for cases where a consumer + * module uses a qualified opens to open a package to an API + * module but where the reflective access to the members of classes in + * the consumer module is delegated to code in another module. Code in the + * API module can use this method to open the package in the consumer module + * to the other module. + * * @param pn * The package name * @param other @@ -1077,7 +1085,7 @@ public final class Module implements AnnotatedElement { if (loader != null) { moduleToLoader.put(name, loader); loaders.add(loader); - } else if (!isBootLayer) { + } else if (!(clf instanceof ModuleLoaderMap.Mapper)) { throw new IllegalArgumentException("loader can't be 'null'"); } } @@ -1458,11 +1466,11 @@ public final class Module implements AnnotatedElement { * encapsulated.
      • * *
      • A package name is derived from the resource name. If - * the package name is a {@link #getPackages() package} in the module - * then the resource can only be located by the caller of this method - * when the package is {@link #isOpen(String,Module) open} to at least - * the caller's module. If the resource is not in a package in the module - * then the resource is not encapsulated.
      • + * the package name is a {@linkplain #getPackages() package} in the + * module then the resource can only be located by the caller of this + * method when the package is {@linkplain #isOpen(String,Module) open} + * to at least the caller's module. If the resource is not in a + * package in the module then the resource is not encapsulated. *
      * *

      In the above, the package name for a resource is derived @@ -1521,8 +1529,7 @@ public final class Module implements AnnotatedElement { } // locate resource in module - JavaLangAccess jla = SharedSecrets.getJavaLangAccess(); - URL url = jla.findResource(loader, mn, name); + URL url = loader.findResource(mn, name); if (url != null) { try { return url.openStream(); diff --git a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java index 098e8626525..b60d63e5f02 100644 --- a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java +++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java @@ -25,10 +25,10 @@ package java.lang; -import java.lang.RuntimePermission; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleDescriptor.Exports; import java.lang.module.ModuleDescriptor.Opens; +import java.lang.module.ModuleReference; import java.lang.reflect.Member; import java.io.FileDescriptor; import java.io.File; @@ -42,12 +42,15 @@ import java.security.PrivilegedAction; import java.security.Security; import java.security.SecurityPermission; import java.util.HashSet; +import java.util.Map; import java.util.Objects; import java.util.PropertyPermission; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; -import java.util.stream.Stream; +import jdk.internal.module.ModuleBootstrap; +import jdk.internal.module.ModuleLoaderMap; import jdk.internal.reflect.CallerSensitive; import sun.security.util.SecurityConstants; @@ -1431,30 +1434,30 @@ class SecurityManager { return packages; } - // The non-exported packages of the modules in the boot layer that are - // loaded by the platform class loader or its ancestors. A non-exported - // package is a package that either is not exported at all by its containing - // module or is exported in a qualified fashion by its containing module. - private static final Set nonExportedPkgs; - + // The non-exported packages in modules defined to the boot or platform + // class loaders. A non-exported package is a package that is not exported + // or is only exported to specific modules. + private static final Map nonExportedPkgs = new ConcurrentHashMap<>(); static { - // Get the modules in the boot layer - Stream bootLayerModules = ModuleLayer.boot().modules().stream(); - - // Filter out the modules loaded by the boot or platform loader - PrivilegedAction> pa = () -> - bootLayerModules.filter(SecurityManager::isBootOrPlatformModule) - .collect(Collectors.toSet()); - Set modules = AccessController.doPrivileged(pa); - - // Filter out the non-exported packages - nonExportedPkgs = modules.stream() - .map(Module::getDescriptor) - .map(SecurityManager::nonExportedPkgs) - .flatMap(Set::stream) - .collect(Collectors.toSet()); + addNonExportedPackages(ModuleLayer.boot()); } + /** + * Record the non-exported packages of the modules in the given layer + */ + static void addNonExportedPackages(ModuleLayer layer) { + Set bootModules = ModuleLoaderMap.bootModules(); + Set platformModules = ModuleLoaderMap.platformModules(); + layer.modules().stream() + .map(Module::getDescriptor) + .filter(md -> bootModules.contains(md.name()) + || platformModules.contains(md.name())) + .map(SecurityManager::nonExportedPkgs) + .flatMap(Set::stream) + .forEach(pn -> nonExportedPkgs.put(pn, Boolean.TRUE)); + } + + /** * Called by java.security.Security */ @@ -1467,14 +1470,6 @@ class SecurityManager { } } - /** - * Returns true if the module's loader is the boot or platform loader. - */ - private static boolean isBootOrPlatformModule(Module m) { - return m.getClassLoader() == null || - m.getClassLoader() == ClassLoader.getPlatformClassLoader(); - } - /** * Returns the non-exported packages of the specified module. */ @@ -1535,7 +1530,7 @@ class SecurityManager { Objects.requireNonNull(pkg, "package name can't be null"); // check if pkg is not exported to all modules - if (nonExportedPkgs.contains(pkg)) { + if (nonExportedPkgs.containsKey(pkg)) { checkPermission( new RuntimePermission("accessClassInPackage." + pkg)); return; @@ -1634,7 +1629,7 @@ class SecurityManager { Objects.requireNonNull(pkg, "package name can't be null"); // check if pkg is not exported to all modules - if (nonExportedPkgs.contains(pkg)) { + if (nonExportedPkgs.containsKey(pkg)) { checkPermission( new RuntimePermission("defineClassInPackage." + pkg)); return; diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java index a57c9a74c34..a966fdc715f 100644 --- a/jdk/src/java.base/share/classes/java/lang/System.java +++ b/jdk/src/java.base/share/classes/java/lang/System.java @@ -41,7 +41,6 @@ import java.lang.reflect.Executable; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.net.URI; -import java.net.URL; import java.security.AccessControlContext; import java.security.ProtectionDomain; import java.security.AccessController; @@ -2111,9 +2110,6 @@ public final class System { public Class findBootstrapClassOrNull(ClassLoader cl, String name) { return cl.findBootstrapClassOrNull(name); } - public URL findResource(ClassLoader cl, String mn, String name) throws IOException { - return cl.findResource(mn, name); - } public Stream packages(ClassLoader cl) { return cl.packages(); } @@ -2123,6 +2119,9 @@ public final class System { public String fastUUID(long lsb, long msb) { return Long.fastUUID(lsb, msb); } + public void addNonExportedPackages(ModuleLayer layer) { + SecurityManager.addNonExportedPackages(layer); + } public void invalidatePackageAccessCache() { SecurityManager.invalidatePackageAccessCache(); } diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index afd8d9b2819..6536afb0e99 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -876,9 +876,7 @@ public class MethodHandles { * accessible to the class. The {@code PACKAGE} lookup mode serves to authenticate * that the lookup object was created by a caller in the runtime package (or derived * from a lookup originally created by suitably privileged code to a target class in - * the runtime package). The lookup modes cannot include {@link #PRIVATE PRIVATE} - * access. A lookup with {@code PRIVATE} access can be downgraded to drop this lookup - * mode with the {@linkplain #dropLookupMode(int) dropLookupMode} method.

      + * the runtime package).

      * *

      The {@code bytes} parameter is the class bytes of a valid class file (as defined * by the The Java Virtual Machine Specification) with a class name in the @@ -896,7 +894,6 @@ public class MethodHandles { * @throws IllegalArgumentException the bytes are for a class in a different package * to the lookup class * @throws IllegalAccessException if this lookup does not have {@code PACKAGE} access - * @throws UnsupportedOperationException if the lookup class has {@code PRIVATE} access * @throws LinkageError if the class is malformed ({@code ClassFormatError}), cannot be * verified ({@code VerifyError}), is already defined, or another linkage error occurs * @throws SecurityException if denied by the security manager @@ -911,8 +908,6 @@ public class MethodHandles { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new RuntimePermission("defineClass")); - if (hasPrivateAccess()) - throw new UnsupportedOperationException("PRIVATE access not supported"); if ((lookupModes() & PACKAGE) == 0) throw new IllegalAccessException("Lookup does not have PACKAGE access"); assert (lookupModes() & (MODULE|PUBLIC)) != 0; diff --git a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java index d5fc16c1ef6..ef7e44a114d 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java +++ b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java @@ -109,20 +109,17 @@ public final class Configuration { private final Set modules; private final Map nameToModule; - // module constraints on target - private final String osName; - private final String osArch; + // constraint on target platform + private final String targetPlatform; - String osName() { return osName; } - String osArch() { return osArch; } + String targetPlatform() { return targetPlatform; } private Configuration() { this.parents = Collections.emptyList(); this.graph = Collections.emptyMap(); this.modules = Collections.emptySet(); this.nameToModule = Collections.emptyMap(); - this.osName = null; - this.osArch = null; + this.targetPlatform = null; } private Configuration(List parents, @@ -147,8 +144,7 @@ public final class Configuration { this.modules = Set.of(moduleArray); this.nameToModule = Map.ofEntries(nameEntries); - this.osName = resolver.osName(); - this.osArch = resolver.osArch(); + this.targetPlatform = resolver.targetPlatform(); } /** diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java index 01b4316fa20..20d198b46ee 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java +++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java @@ -99,6 +99,7 @@ public class ModuleDescriptor * * @see ModuleDescriptor#modifiers() * @since 9 + * @spec JPMS */ public static enum Modifier { /** diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java index 0be9d8d9eff..e0e6d883550 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java +++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java @@ -286,8 +286,9 @@ public interface ModuleFinder { * class names of provider classes.

      * *
    • If the JAR file has a {@code Main-Class} attribute in its - * main manifest then its value is the module {@link - * ModuleDescriptor#mainClass() main class}.

    • + * main manifest, its value is a legal class name, and its package is + * in the set of packages derived for the module, then the value is the + * module {@linkplain ModuleDescriptor#mainClass() main class}.

      * * * @@ -298,8 +299,7 @@ public interface ModuleFinder { * file, where the JAR file contains a {@code .class} in the top-level * directory of the JAR file, where an entry in a service configuration * file is not a legal class name or its package name is not in the set of - * packages derived for the module, or where the module main class is not - * a legal class name or its package is not in the module.

      + * packages derived for the module.

      * *

      In addition to JAR files, an implementation may also support modules * that are packaged in other implementation specific module formats. If diff --git a/jdk/src/java.base/share/classes/java/lang/module/Resolver.java b/jdk/src/java.base/share/classes/java/lang/module/Resolver.java index 6adf93f8317..a723e638abe 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/Resolver.java +++ b/jdk/src/java.base/share/classes/java/lang/module/Resolver.java @@ -28,6 +28,7 @@ package java.lang.module; import java.io.PrintStream; import java.lang.module.ModuleDescriptor.Provides; import java.lang.module.ModuleDescriptor.Requires.Modifier; +import java.net.URI; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; @@ -38,10 +39,8 @@ import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.StringJoiner; import java.util.stream.Collectors; import jdk.internal.module.ModuleHashes; @@ -69,12 +68,10 @@ final class Resolver { // true if all automatic modules have been found private boolean haveAllAutomaticModules; - // module constraints on target platform - private String osName; - private String osArch; + // constraint on target platform + private String targetPlatform; - String osName() { return osName; } - String osArch() { return osArch; } + String targetPlatform() { return targetPlatform; } /** * @throws IllegalArgumentException if there are more than one parent and @@ -89,37 +86,23 @@ final class Resolver { this.afterFinder = afterFinder; this.traceOutput = traceOutput; - // record constraints on target platform, checking that they don't conflict + // record constraint on target platform, checking for conflicts for (Configuration parent : parents) { - String value = parent.osName(); + String value = parent.targetPlatform(); if (value != null) { - if (osName == null) { - osName = value; + if (targetPlatform == null) { + targetPlatform = value; } else { - if (!value.equals(osName)) { - failParentConflict("Operating System", osName, value); - } - } - } - value = parent.osArch(); - if (value != null) { - if (osArch == null) { - osArch = value; - } else { - if (!value.equals(osArch)) { - failParentConflict("OS architecture", osArch, value); + if (!value.equals(targetPlatform)) { + String msg = "Parents have conflicting constraints on target" + + " platform: " + targetPlatform + ", " + value; + throw new IllegalArgumentException(msg); } } } } } - private void failParentConflict(String constraint, String s1, String s2) { - String msg = "Parents have conflicting constraints on target " - + constraint + ": " + s1 + ", " + s2; - throw new IllegalArgumentException(msg); - } - /** * Resolves the given named modules. * @@ -147,8 +130,7 @@ final class Resolver { } if (isTracing()) { - trace("Root module %s located", root); - mref.location().ifPresent(uri -> trace(" (%s)", uri)); + trace("root %s", nameAndInfo(mref)); } addFoundModule(mref); @@ -180,9 +162,7 @@ final class Resolver { ModuleDescriptor other = mref.descriptor(); q.offer(other); if (isTracing()) { - trace("Automatic module %s located, required by %s", - other.name(), descriptor.name()); - mref.location().ifPresent(uri -> trace(" (%s)", uri)); + trace("%s requires %s", descriptor.name(), nameAndInfo(mref)); } }); haveAllAutomaticModules = true; @@ -213,21 +193,13 @@ final class Resolver { } } + if (isTracing() && !dn.equals("java.base")) { + trace("%s requires %s", descriptor.name(), nameAndInfo(mref)); + } + if (!nameToReference.containsKey(dn)) { addFoundModule(mref); q.offer(mref.descriptor()); - - if (isTracing()) { - String prefix; - if (mref.descriptor().isAutomatic()) { - prefix = "Automatic module"; - } else { - prefix = "Module"; - } - trace(prefix + " %s located, required by %s", - dn, descriptor.name()); - mref.location().ifPresent(uri -> trace(" (%s)", uri)); - } } } @@ -291,6 +263,13 @@ final class Resolver { do { for (ModuleDescriptor descriptor : candidateConsumers) { if (!descriptor.uses().isEmpty()) { + + // the modules that provide at least one service + Set modulesToBind = null; + if (isTracing()) { + modulesToBind = new HashSet<>(); + } + for (String service : descriptor.uses()) { Set mrefs = availableProviders.get(service); if (mrefs != null) { @@ -298,15 +277,13 @@ final class Resolver { ModuleDescriptor provider = mref.descriptor(); if (!provider.equals(descriptor)) { - trace("Module %s provides %s, used by %s", - provider.name(), service, descriptor.name()); + if (isTracing() && modulesToBind.add(provider)) { + trace("%s binds %s", descriptor.name(), + nameAndInfo(mref)); + } String pn = provider.name(); if (!nameToReference.containsKey(pn)) { - if (isTracing()) { - mref.location() - .ifPresent(uri -> trace(" (%s)", uri)); - } addFoundModule(mref); q.push(provider); } @@ -349,59 +326,31 @@ final class Resolver { if (mref instanceof ModuleReferenceImpl) { ModuleTarget target = ((ModuleReferenceImpl)mref).moduleTarget(); if (target != null) - checkTargetConstraints(mn, target); + checkTargetPlatform(mn, target); } nameToReference.put(mn, mref); } /** - * Check that the module's constraints on the target platform do not - * conflict with the constraints of other modules resolved so far or - * modules in parent configurations. + * Check that the module's constraints on the target platform does + * conflict with the constraint of other modules resolved so far. */ - private void checkTargetConstraints(String mn, ModuleTarget target) { - String value = target.osName(); + private void checkTargetPlatform(String mn, ModuleTarget target) { + String value = target.targetPlatform(); if (value != null) { - if (osName == null) { - osName = value; + if (targetPlatform == null) { + targetPlatform = value; } else { - if (!value.equals(osName)) { - failTargetConstraint(mn, target); - } - } - } - value = target.osArch(); - if (value != null) { - if (osArch == null) { - osArch = value; - } else { - if (!value.equals(osArch)) { - failTargetConstraint(mn, target); + if (!value.equals(targetPlatform)) { + findFail("Module %s has constraints on target platform (%s)" + + " that conflict with other modules: %s", mn, + value, targetPlatform); } } } } - private void failTargetConstraint(String mn, ModuleTarget target) { - String s1 = targetAsString(osName, osArch); - String s2 = targetAsString(target.osName(), target.osArch()); - findFail("Module %s has constraints on target platform (%s) that" - + " conflict with other modules: %s", mn, s1, s2); - } - - private String targetAsString(ModuleTarget target) { - return targetAsString(target.osName(), target.osArch()); - } - - private String targetAsString(String osName, String osArch) { - return new StringJoiner("-") - .add(Objects.toString(osName, "*")) - .add(Objects.toString(osArch, "*")) - .toString(); - } - - /** * Execute post-resolution checks and returns the module graph of resolved * modules as {@code Map}. The resolved modules will be in the given @@ -412,12 +361,6 @@ final class Resolver { Map> finish(Configuration cf, boolean check) { - if (isTracing()) { - trace("Result:"); - Set names = nameToReference.keySet(); - names.stream().sorted().forEach(name -> trace(" %s", name)); - } - if (check) { detectCycles(); checkHashes(); @@ -520,9 +463,8 @@ final class Resolver { findFail("Unable to compute the hash of module %s", dn); } - // skip checking the hash if the module has been patched ModuleReferenceImpl other = (ModuleReferenceImpl)mref2; - if (other != null && !other.isPatched()) { + if (other != null) { byte[] recordedHash = hashes.hashFor(dn); byte[] actualHash = other.computeHash(algorithm); if (actualHash == null) @@ -965,9 +907,17 @@ final class Resolver { private void trace(String fmt, Object ... args) { if (traceOutput != null) { - traceOutput.format("[Resolver] " + fmt, args); + traceOutput.format(fmt, args); traceOutput.println(); } } + private String nameAndInfo(ModuleReference mref) { + ModuleDescriptor descriptor = mref.descriptor(); + StringBuilder sb = new StringBuilder(descriptor.name()); + mref.location().ifPresent(uri -> sb.append(" " + uri)); + if (descriptor.isAutomatic()) + sb.append(" automatic"); + return sb.toString(); + } } diff --git a/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java b/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java index 08ff1f0d740..2754fa39c0a 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java +++ b/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, 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 @@ -36,6 +36,8 @@ import java.util.Map; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; +import jdk.internal.misc.VM; + /** * Factory methods for file systems. This class defines the {@link #getDefault * getDefault} method to get the default file system and factory methods to @@ -120,8 +122,8 @@ public final class FileSystems { // if the property java.nio.file.spi.DefaultFileSystemProvider is // set then its value is the name of the default provider (or a list) - String propValue = System - .getProperty("java.nio.file.spi.DefaultFileSystemProvider"); + String prop = "java.nio.file.spi.DefaultFileSystemProvider"; + String propValue = System.getProperty(prop); if (propValue != null) { for (String cn: propValue.split(",")) { try { @@ -184,7 +186,7 @@ public final class FileSystems { * @return the default file system */ public static FileSystem getDefault() { - if (jdk.internal.misc.VM.isBooted()) { + if (VM.isModuleSystemInited()) { return DefaultFileSystemHolder.defaultFileSystem; } else { return BuiltinFileSystemHolder.builtinFileSystem; diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java b/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java index ce3bb67e8dd..5d1c97c6d25 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java +++ b/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java @@ -172,12 +172,10 @@ public class BuiltinClassLoader } /** - * Register a module this this class loader. This has the effect of making - * the types in the module visible. + * Register a module this class loader. This has the effect of making the + * types in the module visible. */ public void loadModule(ModuleReference mref) { - assert !VM.isModuleSystemInited(); - String mn = mref.descriptor().name(); if (nameToModule.putIfAbsent(mn, mref) != null) { throw new InternalError(mn + " already defined to this loader"); @@ -191,6 +189,11 @@ public class BuiltinClassLoader + other.mref().descriptor().name()); } } + + // clear resources cache if VM is already initialized + if (VM.isModuleSystemInited() && resourceCache != null) { + resourceCache = null; + } } /** @@ -355,7 +358,10 @@ public class BuiltinClassLoader private List findMiscResource(String name) throws IOException { SoftReference>> ref = this.resourceCache; Map> map = (ref != null) ? ref.get() : null; - if (map != null) { + if (map == null) { + map = new ConcurrentHashMap<>(); + this.resourceCache = new SoftReference<>(map); + } else { List urls = map.get(name); if (urls != null) return urls; @@ -381,23 +387,18 @@ public class BuiltinClassLoader } } } - return result; + return (result != null) ? result : Collections.emptyList(); } }); } catch (PrivilegedActionException pae) { throw (IOException) pae.getCause(); } - // only cache resources after all modules have been defined + // only cache resources after VM is fully initialized if (VM.isModuleSystemInited()) { - if (map == null) { - map = new ConcurrentHashMap<>(); - this.resourceCache = new SoftReference<>(map); - } - if (urls == null) - urls = Collections.emptyList(); map.putIfAbsent(name, urls); } + return urls; } diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java index ece20d827a4..92b60d70777 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java @@ -25,13 +25,11 @@ package jdk.internal.misc; -import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.module.ModuleDescriptor; import java.lang.reflect.Executable; import java.lang.reflect.Method; import java.net.URI; -import java.net.URL; import java.security.AccessControlContext; import java.security.ProtectionDomain; import java.util.Map; @@ -156,12 +154,6 @@ public interface JavaLangAccess { */ Class findBootstrapClassOrNull(ClassLoader cl, String name); - /** - * Returns a URL to a resource with the given name in a module that is - * defined to the given class loader. - */ - URL findResource(ClassLoader cl, String moduleName, String name) throws IOException; - /** * Returns the Packages for the given class loader. */ @@ -177,6 +169,11 @@ public interface JavaLangAccess { */ String fastUUID(long lsb, long msb); + /** + * Record the non-exported packages of the modules in the given layer + */ + void addNonExportedPackages(ModuleLayer layer); + /** * Invalidate package access cache */ diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/Checks.java b/jdk/src/java.base/share/classes/jdk/internal/module/Checks.java index 32712834c0a..4d772df129a 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/Checks.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/Checks.java @@ -25,6 +25,8 @@ package jdk.internal.module; +import java.util.Set; + /** * Utility class for checking module, package, and class names. */ @@ -45,18 +47,17 @@ public final class Checks { int next; int off = 0; while ((next = name.indexOf('.', off)) != -1) { - if (isJavaIdentifier(name, off, (next - off)) == -1) { - String id = name.substring(off, next); + String id = name.substring(off, next); + if (!isJavaIdentifier(id)) { throw new IllegalArgumentException(name + ": Invalid module name" + ": '" + id + "' is not a Java identifier"); } off = next+1; } - int last = isJavaIdentifier(name, off, name.length() - off); - if (last == -1) { - String id = name.substring(off); + String last = name.substring(off); + if (!isJavaIdentifier(last)) { throw new IllegalArgumentException(name + ": Invalid module name" - + ": '" + id + "' is not a Java identifier"); + + ": '" + last + "' is not a Java identifier"); } return name; } @@ -68,14 +69,13 @@ public final class Checks { int next; int off = 0; while ((next = name.indexOf('.', off)) != -1) { - if (isJavaIdentifier(name, off, (next - off)) == -1) + String id = name.substring(off, next); + if (!isJavaIdentifier(id)) return false; off = next+1; } - int last = isJavaIdentifier(name, off, name.length() - off); - if (last == -1) - return false; - return true; + String last = name.substring(off); + return isJavaIdentifier(last); } /** @@ -144,12 +144,13 @@ public final class Checks { int next; int off = 0; while ((next = name.indexOf('.', off)) != -1) { - if (isJavaIdentifier(name, off, (next - off)) == -1) + String id = name.substring(off, next); + if (!isJavaIdentifier(id)) return false; off = next+1; } - int count = name.length() - off; - return (isJavaIdentifier(name, off, count) != -1); + String last = name.substring(off); + return isJavaIdentifier(last); } /** @@ -164,76 +165,99 @@ public final class Checks { int next; int off = 0; while ((next = name.indexOf('.', off)) != -1) { - if (isJavaIdentifier(name, off, (next - off)) == -1) { - String id = name.substring(off, next); + String id = name.substring(off, next); + if (!isJavaIdentifier(id)) { throw new IllegalArgumentException(name + ": Invalid " + what + ": '" + id + "' is not a Java identifier"); } off = next + 1; } - if (isJavaIdentifier(name, off, name.length() - off) == -1) { - String id = name.substring(off, name.length()); + String last = name.substring(off); + if (!isJavaIdentifier(last)) { throw new IllegalArgumentException(name + ": Invalid " + what - + ": '" + id + "' is not a Java identifier"); + + ": '" + last + "' is not a Java identifier"); } return name; } /** - * Returns {@code true} if a given legal module name contains an identifier - * that doesn't end with a Java letter. + * Returns true if the given char sequence is a legal Java identifier, + * otherwise false. */ - public static boolean hasJavaIdentifierWithTrailingDigit(String name) { - // quick scan to allow names that are just ASCII without digits - boolean needToParse = false; - int i = 0; - while (i < name.length()) { - int c = name.charAt(i); - if (c > 0x7F || (c >= '0' && c <= '9')) { - needToParse = true; - break; - } - i++; - } - if (!needToParse) + private static boolean isJavaIdentifier(CharSequence cs) { + if (cs.length() == 0 || RESERVED.contains(cs)) return false; - // slow path - int next; - int off = 0; - while ((next = name.indexOf('.', off)) != -1) { - int last = isJavaIdentifier(name, off, (next - off)); - if (!Character.isJavaIdentifierStart(last)) - return true; - off = next+1; - } - int last = isJavaIdentifier(name, off, name.length() - off); - if (!Character.isJavaIdentifierStart(last)) - return true; - return false; - - } - - /** - * Checks if a char sequence is a legal Java identifier, returning the code - * point of the last character if legal or {@code -1} if not legal. - */ - private static int isJavaIdentifier(CharSequence cs, int offset, int count) { - if (count == 0) - return -1; - int first = Character.codePointAt(cs, offset); + int first = Character.codePointAt(cs, 0); if (!Character.isJavaIdentifierStart(first)) - return -1; + return false; - int cp = first; int i = Character.charCount(first); - while (i < count) { - cp = Character.codePointAt(cs, offset+i); + while (i < cs.length()) { + int cp = Character.codePointAt(cs, i); if (!Character.isJavaIdentifierPart(cp)) - return -1; + return false; i += Character.charCount(cp); } - return cp; + return true; } + + // keywords, boolean and null literals, not allowed in identifiers + private static final Set RESERVED = Set.of( + "abstract", + "assert", + "boolean", + "break", + "byte", + "case", + "catch", + "char", + "class", + "const", + "continue", + "default", + "do", + "double", + "else", + "enum", + "extends", + "final", + "finally", + "float", + "for", + "goto", + "if", + "implements", + "import", + "instanceof", + "int", + "interface", + "long", + "native", + "new", + "package", + "private", + "protected", + "public", + "return", + "short", + "static", + "strictfp", + "super", + "switch", + "synchronized", + "this", + "throw", + "throws", + "transient", + "try", + "void", + "volatile", + "while", + "true", + "false", + "null", + "_" + ); } diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ClassFileAttributes.java b/jdk/src/java.base/share/classes/jdk/internal/module/ClassFileAttributes.java index 6d8816237dd..dd3520f044c 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ClassFileAttributes.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ClassFileAttributes.java @@ -549,34 +549,26 @@ public final class ClassFileAttributes { * u2 attribute_name_index; * u4 attribute_length; * - * // index to CONSTANT_utf8_info structure with the OS name - * u2 os_name_index; - * // index to CONSTANT_utf8_info structure with the OS arch - * u2 os_arch_index + * // index to CONSTANT_utf8_info structure with the target platform + * u2 target_platform_index; * } * * } */ public static class ModuleTargetAttribute extends Attribute { - private final String osName; - private final String osArch; + private final String targetPlatform; - public ModuleTargetAttribute(String osName, String osArch) { + public ModuleTargetAttribute(String targetPlatform) { super(MODULE_TARGET); - this.osName = osName; - this.osArch = osArch; + this.targetPlatform = targetPlatform; } public ModuleTargetAttribute() { - this(null, null); + this(null); } - public String osName() { - return osName; - } - - public String osArch() { - return osArch; + public String targetPlatform() { + return targetPlatform; } @Override @@ -588,20 +580,14 @@ public final class ClassFileAttributes { Label[] labels) { - String osName = null; - String osArch = null; + String targetPlatform = null; - int name_index = cr.readUnsignedShort(off); - if (name_index != 0) - osName = cr.readUTF8(off, buf); + int target_platform_index = cr.readUnsignedShort(off); + if (target_platform_index != 0) + targetPlatform = cr.readUTF8(off, buf); off += 2; - int arch_index = cr.readUnsignedShort(off); - if (arch_index != 0) - osArch = cr.readUTF8(off, buf); - off += 2; - - return new ModuleTargetAttribute(osName, osArch); + return new ModuleTargetAttribute(targetPlatform); } @Override @@ -613,15 +599,10 @@ public final class ClassFileAttributes { { ByteVector attr = new ByteVector(); - int name_index = 0; - if (osName != null && osName.length() > 0) - name_index = cw.newUTF8(osName); - attr.putShort(name_index); - - int arch_index = 0; - if (osArch != null && osArch.length() > 0) - arch_index = cw.newUTF8(osArch); - attr.putShort(arch_index); + int target_platform_index = 0; + if (targetPlatform != null && targetPlatform.length() > 0) + target_platform_index = cw.newUTF8(targetPlatform); + attr.putShort(target_platform_index); return attr; } diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java index 061b2294158..d083ead7801 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java @@ -84,8 +84,9 @@ public final class ModuleBootstrap { // The ModulePatcher for the initial configuration private static final ModulePatcher patcher = initModulePatcher(); - // ModuleFinder for the initial configuration - private static ModuleFinder initialFinder; + // ModuleFinders for the initial configuration + private static ModuleFinder unlimitedFinder; + private static ModuleFinder limitedFinder; /** * Returns the ModulePatcher for the initial configuration. @@ -95,11 +96,20 @@ public final class ModuleBootstrap { } /** - * Returns the ModuleFinder for the initial configuration + * Returns the ModuleFinder for the initial configuration before observability + * is limited by the --limit-modules command line option. */ - public static ModuleFinder finder() { - assert initialFinder != null; - return initialFinder; + public static ModuleFinder unlimitedFinder() { + assert unlimitedFinder != null; + return unlimitedFinder; + } + + /** + * Returns the ModuleFinder for the initial configuration. + */ + public static ModuleFinder limitedFinder() { + assert limitedFinder != null; + return limitedFinder; } /** @@ -134,6 +144,11 @@ public final class ModuleBootstrap { PerfCounters.defineBaseTime.addElapsedTimeFrom(t1); + // special mode to boot with only java.base, ignores other options + String propValue = getAndRemoveProperty("jdk.module.minimumBoot"); + if (propValue != null) { + return createMinimalBootLayer(); + } long t2 = System.nanoTime(); @@ -180,7 +195,8 @@ public final class ModuleBootstrap { } // --limit-modules - String propValue = getAndRemoveProperty("jdk.module.limitmods"); + unlimitedFinder = finder; + propValue = getAndRemoveProperty("jdk.module.limitmods"); if (propValue != null) { Set mods = new HashSet<>(); for (String mod: propValue.split(",")) { @@ -188,6 +204,7 @@ public final class ModuleBootstrap { } finder = limitFinder(finder, mods, roots); } + limitedFinder = finder; // If there is no initial module specified then assume that the initial // module is the unnamed module of the application class loader. This @@ -267,7 +284,8 @@ public final class ModuleBootstrap { } PrintStream traceOutput = null; - if (Boolean.getBoolean("jdk.launcher.traceResolver")) + propValue = getAndRemoveProperty("jdk.module.showModuleResolution"); + if (propValue != null && Boolean.parseBoolean(propValue)) traceOutput = System.out; // run the resolver to create the configuration @@ -362,12 +380,23 @@ public final class ModuleBootstrap { // total time to initialize PerfCounters.bootstrapTime.addElapsedTimeFrom(t0); - // remember the ModuleFinder - initialFinder = finder; - return bootLayer; } + /** + * Create a "minimal" boot module layer that only contains java.base. + */ + private static ModuleLayer createMinimalBootLayer() { + Configuration cf = SharedSecrets.getJavaLangModuleAccess() + .resolveAndBind(ModuleFinder.ofSystem(), + Set.of(JAVA_BASE), + false, + null); + + Function clf = ModuleLoaderMap.mappingFunction(cf); + return ModuleLayer.empty().defineModules(cf, clf); + } + /** * Returns a ModuleFinder that limits observability to the given root * modules, their transitive dependences, plus a set of other modules. diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java index d808fe1db48..804f5eb4527 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java @@ -138,7 +138,7 @@ public class ModuleHashesBuilder { } /* - * Utilty class + * Utility class */ static class Graph { private final Set nodes; diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java index b589e2923f0..f6f1bb07e16 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java @@ -546,21 +546,15 @@ public final class ModuleInfo { private ModuleTarget readModuleTargetAttribute(DataInput in, ConstantPool cpool) throws IOException { - String osName = null; - String osArch = null; + String targetPlatform = null; - int name_index = in.readUnsignedShort(); - if (name_index != 0) - osName = cpool.getUtf8(name_index); + int index = in.readUnsignedShort(); + if (index != 0) + targetPlatform = cpool.getUtf8(index); - int arch_index = in.readUnsignedShort(); - if (arch_index != 0) - osArch = cpool.getUtf8(arch_index); - - return new ModuleTarget(osName, osArch); + return new ModuleTarget(targetPlatform); } - /** * Reads the ModuleHashes attribute */ @@ -612,7 +606,6 @@ public final class ModuleInfo { return new ModuleResolution(flags); } - /** * Returns true if the given attribute can be present at most once * in the class file. Returns false otherwise. diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java index 35f28d35696..270d0a2605f 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoExtender.java @@ -62,9 +62,8 @@ public final class ModuleInfoExtender { // the value of the ModuleMainClass attribute private String mainClass; - // the values for the ModuleTarget attribute - private String osName; - private String osArch; + // the value for the ModuleTarget attribute + private String targetPlatform; // the hashes for the ModuleHashes attribute private ModuleHashes hashes; @@ -108,11 +107,10 @@ public final class ModuleInfoExtender { } /** - * Sets the values for the ModuleTarget attribute. + * Sets the value for the ModuleTarget attribute. */ - public ModuleInfoExtender targetPlatform(String osName, String osArch) { - this.osName = osName; - this.osArch = osArch; + public ModuleInfoExtender targetPlatform(String targetPlatform) { + this.targetPlatform = targetPlatform; return this; } @@ -199,8 +197,8 @@ public final class ModuleInfoExtender { cv.addAttribute(new ModulePackagesAttribute(packages)); if (mainClass != null) cv.addAttribute(new ModuleMainClassAttribute(mainClass)); - if (osName != null || osArch != null) - cv.addAttribute(new ModuleTargetAttribute(osName, osArch)); + if (targetPlatform != null) + cv.addAttribute(new ModuleTargetAttribute(targetPlatform)); if (hashes != null) cv.addAttribute(new ModuleHashesAttribute(hashes)); if (moduleResolution != null) diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java index 01bee5041f4..dded95fe93d 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java @@ -66,10 +66,9 @@ public final class ModuleInfoWriter { // write ModuleMainClass if the module has a main class md.mainClass().ifPresent(mc -> cw.visitAttribute(new ModuleMainClassAttribute(mc))); - // write ModuleTarget if there is a platform OS/arch + // write ModuleTarget if there is a target platform if (target != null) { - cw.visitAttribute(new ModuleTargetAttribute(target.osName(), - target.osArch())); + cw.visitAttribute(new ModuleTargetAttribute(target.targetPlatform())); } cw.visitEnd(); diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java index 15e60d0d611..b0f465d4776 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java @@ -37,36 +37,66 @@ import jdk.internal.loader.ClassLoaders; /** - * The module to class loader map. The list of boot modules and platform modules - * are generated at build time. + * Supports the mapping of modules to class loaders. The set of modules mapped + * to the boot and platform class loaders is generated at build time from + * this source file. */ -final class ModuleLoaderMap { +public final class ModuleLoaderMap { + + /** + * Maps the system modules to the built-in class loaders. + */ + public static final class Mapper implements Function { + private final Map map; + + Mapper(Map map) { + this.map = map; // defensive copy not needed + } + + @Override + public ClassLoader apply(String name) { + return map.get(name); + } + } + + /** + * Returns the names of the modules defined to the boot loader. + */ + public static Set bootModules() { + // The list of boot modules generated at build time. + String[] BOOT_MODULES = new String[] { "@@BOOT_MODULE_NAMES@@" }; + Set bootModules = new HashSet<>(BOOT_MODULES.length); + for (String mn : BOOT_MODULES) { + bootModules.add(mn); + } + return bootModules; + } + + /** + * Returns the names of the modules defined to the platform loader. + */ + public static Set platformModules() { + // The list of platform modules generated at build time. + String[] PLATFORM_MODULES = new String[] { "@@PLATFORM_MODULE_NAMES@@" }; + Set platformModules = new HashSet<>(PLATFORM_MODULES.length); + for (String mn : PLATFORM_MODULES) { + platformModules.add(mn); + } + return platformModules; + } /** * Returns the function to map modules in the given configuration to the * built-in class loaders. */ static Function mappingFunction(Configuration cf) { - - // The list of boot modules and platform modules are generated at build time. - final String[] BOOT_MODULES = new String[] { "@@BOOT_MODULE_NAMES@@" }; - final String[] PLATFORM_MODULES = new String[] { "@@PLATFORM_MODULE_NAMES@@" }; - - Set bootModules = new HashSet<>(BOOT_MODULES.length); - for (String mn : BOOT_MODULES) { - bootModules.add(mn); - } - - Set platformModules = new HashSet<>(PLATFORM_MODULES.length); - for (String mn : PLATFORM_MODULES) { - platformModules.add(mn); - } + Set bootModules = bootModules(); + Set platformModules = platformModules(); ClassLoader platformClassLoader = ClassLoaders.platformClassLoader(); ClassLoader appClassLoader = ClassLoaders.appClassLoader(); Map map = new HashMap<>(); - for (ResolvedModule resolvedModule : cf.modules()) { String mn = resolvedModule.name(); if (!bootModules.contains(mn)) { @@ -77,12 +107,6 @@ final class ModuleLoaderMap { } } } - - return new Function () { - @Override - public ClassLoader apply(String mn) { - return map.get(mn); - } - }; + return new Mapper(map); } } diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java index 3f5827bfc54..c0458e0f34e 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java @@ -120,7 +120,7 @@ public final class ModulePatcher { // JAR file - do not open as a multi-release JAR as this // is not supported by the boot class loader - try (JarFile jf = new JarFile(file.toFile())) { + try (JarFile jf = new JarFile(file.toString())) { jf.stream() .filter(e -> !e.isDirectory() && (!isAutomatic || e.getName().endsWith(".class"))) @@ -431,7 +431,7 @@ public final class ModulePatcher { private final URL csURL; JarResourceFinder(Path path) throws IOException { - this.jf = new JarFile(path.toFile()); + this.jf = new JarFile(path.toString()); this.csURL = path.toUri().toURL(); } @@ -505,7 +505,7 @@ public final class ModulePatcher { public Resource find(String name) throws IOException { Path file = Resources.toFilePath(dir, name); if (file != null) { - return newResource(name, dir, file); + return newResource(name, dir, file); } else { return null; } diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java index 75a76b0858f..750ac801fe3 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java @@ -59,6 +59,7 @@ import java.util.jar.Manifest; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.zip.ZipException; import java.util.zip.ZipFile; import jdk.internal.jmod.JmodFile; @@ -315,26 +316,42 @@ public class ModulePath implements ModuleFinder { { try { + // exploded module if (attrs.isDirectory()) { return readExplodedModule(entry); // may return null - } else { + } + + // JAR or JMOD file + if (attrs.isRegularFile()) { String fn = entry.getFileName().toString(); - if (attrs.isRegularFile()) { - if (fn.endsWith(".jar")) { + boolean isDefaultFileSystem = isDefaultFileSystem(entry); + + // JAR file + if (fn.endsWith(".jar")) { + if (isDefaultFileSystem) { return readJar(entry); - } else if (isLinkPhase && fn.endsWith(".jmod")) { - return readJMod(entry); + } else { + // the JAR file is in a custom file system so + // need to copy it to the local file system + Path tmpdir = Files.createTempDirectory("mlib"); + Path target = Files.copy(entry, tmpdir.resolve(fn)); + return readJar(target); } } - return null; + + // JMOD file + if (isDefaultFileSystem && isLinkPhase && fn.endsWith(".jmod")) { + return readJMod(entry); + } } + return null; + } catch (InvalidModuleDescriptorException e) { throw new FindException("Error reading module: " + entry, e); } } - /** * Returns a string with the file name of the module if possible. * If the module location is not a file URI then return the URI @@ -434,7 +451,7 @@ public class ModulePath implements ModuleFinder { * 3. The contents of any META-INF/services configuration files are mapped * to "provides" declarations * 4. The Main-Class attribute in the main attributes of the JAR manifest - * is mapped to the module descriptor mainClass + * is mapped to the module descriptor mainClass if possible */ private ModuleDescriptor deriveModuleDescriptor(JarFile jf) throws IOException @@ -530,12 +547,12 @@ public class ModulePath implements ModuleFinder { String mainClass = attrs.getValue(Attributes.Name.MAIN_CLASS); if (mainClass != null) { mainClass = mainClass.replace("/", "."); - String pn = packageName(mainClass); - if (!packages.contains(pn)) { - String msg = "Main-Class " + mainClass + " not in module"; - throw new InvalidModuleDescriptorException(msg); + if (Checks.isClassName(mainClass)) { + String pn = packageName(mainClass); + if (packages.contains(pn)) { + builder.mainClass(mainClass); + } } - builder.mainClass(mainClass); } } @@ -617,6 +634,8 @@ public class ModulePath implements ModuleFinder { } return ModuleReferences.newJarModule(attrs, patcher, file); + } catch (ZipException e) { + throw new FindException("Error reading " + file, e); } } @@ -733,6 +752,16 @@ public class ModulePath implements ModuleFinder { } } + + /** + * Return true if a path locates a path in the default file system + */ + private boolean isDefaultFileSystem(Path path) { + return path.getFileSystem().provider() + .getScheme().equalsIgnoreCase("file"); + } + + private static final PerfCounter scanTime = PerfCounter.newPerfCounter("jdk.module.finder.modulepath.scanTime"); private static final PerfCounter moduleCount diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferences.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferences.java index 450cc5ce6d2..938c446b6c7 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferences.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferences.java @@ -25,6 +25,7 @@ package jdk.internal.module; +import java.io.File; import java.io.IOError; import java.io.IOException; import java.io.InputStream; @@ -226,8 +227,8 @@ class ModuleReferences { static JarFile newJarFile(Path path) { try { - return new JarFile(path.toFile(), - true, // verify + return new JarFile(new File(path.toString()), + true, // verify ZipFile.OPEN_READ, JarFile.runtimeVersion()); } catch (IOException ioe) { diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleResolution.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleResolution.java index 76c42368c63..d8b9d9609a1 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleResolution.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleResolution.java @@ -39,6 +39,10 @@ public final class ModuleResolution { this.value = value; } + public int value() { + return value; + } + public static ModuleResolution empty() { return new ModuleResolution(0); } @@ -74,35 +78,30 @@ public final class ModuleResolution { throw new InternalError("cannot add deprecated for removal to " + value); return new ModuleResolution(value | WARN_DEPRECATED_FOR_REMOVAL); } + public ModuleResolution withIncubating() { if ((value & (WARN_DEPRECATED | WARN_DEPRECATED_FOR_REMOVAL)) != 0) throw new InternalError("cannot add incubating to " + value); return new ModuleResolution(value | WARN_INCUBATING); } - public int value() { - return value; - } - public static boolean doNotResolveByDefault(ModuleReference mref) { // get the DO_NOT_RESOLVE_BY_DEFAULT flag, if any - if (!(mref instanceof ModuleReferenceImpl)) - return false; - - ModuleResolution mres = ((ModuleReferenceImpl)mref).moduleResolution(); - if (mres != null) - return mres.doNotResolveByDefault(); + if (mref instanceof ModuleReferenceImpl) { + ModuleResolution mres = ((ModuleReferenceImpl) mref).moduleResolution(); + if (mres != null) + return mres.doNotResolveByDefault(); + } return false; } public static boolean hasIncubatingWarning(ModuleReference mref) { - if (!(mref instanceof ModuleReferenceImpl)) - return false; - - ModuleResolution mres = ((ModuleReferenceImpl)mref).moduleResolution(); - if (mres != null) - return mres.hasIncubatingWarning(); + if (mref instanceof ModuleReferenceImpl) { + ModuleResolution mres = ((ModuleReferenceImpl) mref).moduleResolution(); + if (mres != null) + return mres.hasIncubatingWarning(); + } return false; } diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleTarget.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleTarget.java index dcfe8ac8b58..ffd50704f33 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleTarget.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleTarget.java @@ -25,22 +25,21 @@ package jdk.internal.module; +/** + * Represents the module target. + * + * For now, this is a single value for the target platform, e.g. "linux-x64". + */ public final class ModuleTarget { - private final String osName; - private final String osArch; + private final String targetPlatform; - public ModuleTarget(String osName, String osArch) { - this.osName = osName; - this.osArch = osArch; + public ModuleTarget(String targetPlatform) { + this.targetPlatform = targetPlatform; } - public String osName() { - return osName; - } - - public String osArch() { - return osArch; + public String targetPlatform() { + return targetPlatform; } } diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java b/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java index 62288625b76..af784dd944e 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java @@ -25,12 +25,22 @@ package jdk.internal.module; +import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; +import java.lang.module.ModuleFinder; +import java.lang.module.ModuleReference; +import java.lang.module.ResolvedModule; import java.net.URI; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; import jdk.internal.loader.BootLoader; +import jdk.internal.loader.BuiltinClassLoader; import jdk.internal.loader.ClassLoaders; import jdk.internal.misc.JavaLangAccess; import jdk.internal.misc.SharedSecrets; @@ -38,8 +48,8 @@ import jdk.internal.misc.SharedSecrets; /** * A helper class for creating and updating modules. This class is intended to * support command-line options, tests, and the instrumentation API. It is also - * used by the VM to add read edges when agents are instrumenting code that - * need to link to supporting classes. + * used by the VM to load modules or add read edges when agents are instrumenting + * code that need to link to supporting classes. * * The parameters that are package names in this API are the fully-qualified * names of the packages as defined in section 6.5.3 of The Java™ @@ -154,4 +164,90 @@ public class Modules { addReads(m, BootLoader.getUnnamedModule()); addReads(m, ClassLoaders.appClassLoader().getUnnamedModule()); } + + /** + * Called by the VM to load a system module, typically "java.instrument" or + * "jdk.management.agent". If the module is not loaded then it is resolved + * and loaded (along with any dependences that weren't previously loaded) + * into a child layer. + */ + public static synchronized Module loadModule(String name) { + ModuleLayer top = topLayer; + if (top == null) + top = ModuleLayer.boot(); + + Module module = top.findModule(name).orElse(null); + if (module != null) { + // module already loaded + return module; + } + + // resolve the module with the top-most layer as the parent + ModuleFinder empty = ModuleFinder.of(); + ModuleFinder finder = ModuleBootstrap.unlimitedFinder(); + Set roots = Set.of(name); + Configuration cf = top.configuration().resolveAndBind(empty, finder, roots); + + // create the child layer + Function clf = ModuleLoaderMap.mappingFunction(cf); + ModuleLayer newLayer = top.defineModules(cf, clf); + + // add qualified exports/opens to give access to modules in child layer + Map map = newLayer.modules().stream() + .collect(Collectors.toMap(Module::getName, + Function.identity())); + ModuleLayer layer = top; + while (layer != null) { + for (Module m : layer.modules()) { + // qualified exports + m.getDescriptor().exports().stream() + .filter(ModuleDescriptor.Exports::isQualified) + .forEach(e -> e.targets().forEach(target -> { + Module other = map.get(target); + if (other != null) { + addExports(m, e.source(), other); + }})); + + // qualified opens + m.getDescriptor().opens().stream() + .filter(ModuleDescriptor.Opens::isQualified) + .forEach(o -> o.targets().forEach(target -> { + Module other = map.get(target); + if (other != null) { + addOpens(m, o.source(), other); + }})); + } + + List parents = layer.parents(); + assert parents.size() <= 1; + layer = parents.isEmpty() ? null : parents.get(0); + } + + // update security manager before making types visible + JLA.addNonExportedPackages(newLayer); + + // update the built-in class loaders to make the types visible + for (ResolvedModule resolvedModule : cf.modules()) { + ModuleReference mref = resolvedModule.reference(); + String mn = mref.descriptor().name(); + ClassLoader cl = clf.apply(mn); + if (cl == null) { + BootLoader.loadModule(mref); + } else { + ((BuiltinClassLoader) cl).loadModule(mref); + } + } + + // new top layer + topLayer = newLayer; + + // return module + return newLayer.findModule(name) + .orElseThrow(() -> new InternalError("module not loaded")); + + } + + // the top-most system layer + private static ModuleLayer topLayer; + } diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/Resources.java b/jdk/src/java.base/share/classes/jdk/internal/module/Resources.java index 4498682f0b9..53865742dbe 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/Resources.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/Resources.java @@ -26,10 +26,10 @@ package jdk.internal.module; import java.io.File; import java.io.IOException; +import java.nio.file.FileSystem; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; /** @@ -94,7 +94,7 @@ public final class Resources { if (expectDirectory) { name = name.substring(0, name.length() - 1); // drop trailing "/" } - Path path = toSafeFilePath(name); + Path path = toSafeFilePath(dir.getFileSystem(), name); if (path != null) { Path file = dir.resolve(path); try { @@ -116,7 +116,7 @@ public final class Resources { * are rejected, as are resource names that translates to a file path * with a root component. */ - private static Path toSafeFilePath(String name) { + private static Path toSafeFilePath(FileSystem fs, String name) { // scan elements of resource name int next; int off = 0; @@ -135,12 +135,12 @@ public final class Resources { // convert to file path Path path; if (File.separatorChar == '/') { - path = Paths.get(name); + path = fs.getPath(name); } else { // not allowed to embed file separators if (name.contains(File.separator)) return null; - path = Paths.get(name.replace('/', File.separatorChar)); + path = fs.getPath(name.replace('/', File.separatorChar)); } // file path not allowed to have root component diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java index 1c3f76927aa..838f215d888 100644 --- a/jdk/src/java.base/share/classes/module-info.java +++ b/jdk/src/java.base/share/classes/module-info.java @@ -161,6 +161,7 @@ module java.base { java.security.jgss, java.sql, java.xml, + jdk.attach, jdk.charsets, jdk.compiler, // reflective dependency jdk.incubator.httpclient, diff --git a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java index d6cc3661d00..5ac605a2092 100644 --- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java +++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java @@ -43,13 +43,17 @@ import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.io.UnsupportedEncodingException; -import java.lang.module.ModuleFinder; -import java.lang.module.ModuleReference; +import java.lang.module.Configuration; +import java.lang.module.FindException; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleDescriptor.Requires; import java.lang.module.ModuleDescriptor.Exports; import java.lang.module.ModuleDescriptor.Opens; import java.lang.module.ModuleDescriptor.Provides; +import java.lang.module.ModuleFinder; +import java.lang.module.ModuleReference; +import java.lang.module.ResolvedModule; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.math.BigDecimal; @@ -58,14 +62,16 @@ import java.net.URI; import java.nio.charset.Charset; import java.nio.file.DirectoryStream; import java.nio.file.Files; +import java.nio.file.NoSuchFileException; import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.attribute.BasicFileAttributes; import java.text.Normalizer; import java.text.MessageFormat; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.HashSet; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -83,6 +89,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.internal.misc.VM; +import jdk.internal.module.ModuleBootstrap; import jdk.internal.module.Modules; @@ -98,6 +105,7 @@ public final class LauncherHelper { "javafx.application.Application"; private static final String JAVAFX_FXHELPER_CLASS_NAME_SUFFIX = "sun.launcher.LauncherHelper$FXHelper"; + private static final String LAUNCHER_AGENT_CLASS = "Launcher-Agent-Class"; private static final String MAIN_CLASS = "Main-Class"; private static final String ADD_EXPORTS = "Add-Exports"; private static final String ADD_OPENS = "Add-Opens"; @@ -408,8 +416,12 @@ public final class LauncherHelper { ostream = (printToStderr) ? System.err : System.out; } + static void initOutput(PrintStream ps) { + ostream = ps; + } + static String getMainClassFromJar(String jarname) { - String mainValue = null; + String mainValue; try (JarFile jarFile = new JarFile(jarname)) { Manifest manifest = jarFile.getManifest(); if (manifest == null) { @@ -426,6 +438,22 @@ public final class LauncherHelper { abort(null, "java.launcher.jar.error3", jarname); } + // Launcher-Agent-Class (only check for this when Main-Class present) + String agentClass = mainAttrs.getValue(LAUNCHER_AGENT_CLASS); + if (agentClass != null) { + ModuleLayer.boot().findModule("java.instrument").ifPresent(m -> { + try { + String cn = "sun.instrument.InstrumentationImpl"; + Class clazz = Class.forName(cn, false, null); + Method loadAgent = clazz.getMethod("loadAgent", String.class); + loadAgent.invoke(null, jarname); + } catch (Throwable e) { + if (e instanceof InvocationTargetException) e = e.getCause(); + abort(e, "java.launcher.jar.error4", jarname); + } + }); + } + // Add-Exports and Add-Opens String exports = mainAttrs.getValue(ADD_EXPORTS); if (exports != null) { @@ -913,141 +941,350 @@ public final class LauncherHelper { } } - private static void formatCommaList(PrintStream out, - String prefix, - Collection list) - { - if (list.isEmpty()) - return; - out.format("%s", prefix); - boolean first = true; - for (Object ob : list) { - if (first) { - out.format(" %s", ob); - first = false; - } else { - out.format(", %s", ob); - } - } - out.format("%n"); - } - /** * Called by the launcher to list the observable modules. - * If called without any sub-options then the output is a simple list of - * the modules. If called with sub-options then the sub-options are the - * names of the modules to list (e.g. --list-modules java.base,java.desktop) */ - static void listModules(boolean printToStderr, String optionFlag) - throws IOException, ClassNotFoundException - { - initOutput(printToStderr); + static void listModules() { + initOutput(System.out); - ModuleFinder finder = jdk.internal.module.ModuleBootstrap.finder(); - int colon = optionFlag.indexOf('='); - if (colon == -1) { - finder.findAll().stream() - .sorted(Comparator.comparing(ModuleReference::descriptor)) - .forEach(mref -> describeModule(finder, mref, false)); - } else { - String[] names = optionFlag.substring(colon+1).split(","); - for (String name: names) { - ModuleReference mref = finder.find(name).orElse(null); - if (mref == null) { - System.err.format("%s not found%n", name); - continue; - } - describeModule(finder, mref, true); - } - } + ModuleBootstrap.limitedFinder().findAll().stream() + .sorted(new JrtFirstComparator()) + .forEach(LauncherHelper::showModule); } /** - * Describes the given module. + * Called by the launcher to show the resolved modules */ - static void describeModule(ModuleFinder finder, - ModuleReference mref, - boolean verbose) - { - ModuleDescriptor md = mref.descriptor(); - ostream.print("module " + midAndLocation(md, mref.location())); - if (md.isAutomatic()) - ostream.print(" automatic"); - ostream.println(); + static void showResolvedModules() { + initOutput(System.out); - if (!verbose) - return; + ModuleLayer bootLayer = ModuleLayer.boot(); + Configuration cf = bootLayer.configuration(); + + cf.modules().stream() + .map(ResolvedModule::reference) + .sorted(new JrtFirstComparator()) + .forEach(LauncherHelper::showModule); + } + + /** + * Called by the launcher to describe a module + */ + static void describeModule(String moduleName) { + initOutput(System.out); + + ModuleFinder finder = ModuleBootstrap.limitedFinder(); + ModuleReference mref = finder.find(moduleName).orElse(null); + if (mref == null) { + abort(null, "java.launcher.module.error4", moduleName); + } + ModuleDescriptor md = mref.descriptor(); + + // one-line summary + showModule(mref); // unqualified exports (sorted by package) - Set exports = new TreeSet<>(Comparator.comparing(Exports::source)); - md.exports().stream().filter(e -> !e.isQualified()).forEach(exports::add); - for (Exports e : exports) { - String modsAndSource = Stream.concat(toStringStream(e.modifiers()), - Stream.of(e.source())) + md.exports().stream() + .filter(e -> !e.isQualified()) + .sorted(Comparator.comparing(Exports::source)) + .map(e -> Stream.concat(Stream.of(e.source()), + toStringStream(e.modifiers())) + .collect(Collectors.joining(" "))) + .forEach(sourceAndMods -> ostream.format("exports %s%n", sourceAndMods)); + + // dependences + for (Requires r : md.requires()) { + String nameAndMods = Stream.concat(Stream.of(r.name()), + toStringStream(r.modifiers())) .collect(Collectors.joining(" ")); - ostream.format(" exports %s%n", modsAndSource); + ostream.format("requires %s", nameAndMods); + finder.find(r.name()) + .map(ModuleReference::descriptor) + .filter(ModuleDescriptor::isAutomatic) + .ifPresent(any -> ostream.print(" automatic")); + ostream.println(); } - for (Requires d : md.requires()) { - ostream.format(" requires %s", d); - String suffix = finder.find(d.name()) - .map(ModuleReference::descriptor) - .map(any -> any.isAutomatic() ? " automatic" : "") - .orElse(" not found"); - ostream.println(suffix); - } + // service use and provides for (String s : md.uses()) { - ostream.format(" uses %s%n", s); + ostream.format("uses %s%n", s); } - for (Provides ps : md.provides()) { - ostream.format(" provides %s with %s%n", ps.service(), - ps.providers().stream().collect(Collectors.joining(", "))); + String names = ps.providers().stream().collect(Collectors.joining(" ")); + ostream.format("provides %s with %s%n", ps.service(), names); + } // qualified exports for (Exports e : md.exports()) { if (e.isQualified()) { - String modsAndSource = Stream.concat(toStringStream(e.modifiers()), - Stream.of(e.source())) - .collect(Collectors.joining(" ")); - ostream.format(" exports %s", modsAndSource); - formatCommaList(ostream, " to", e.targets()); + String who = e.targets().stream().collect(Collectors.joining(" ")); + ostream.format("qualified exports %s to %s%n", e.source(), who); } } // open packages - for (Opens obj: md.opens()) { - String modsAndSource = Stream.concat(toStringStream(obj.modifiers()), - Stream.of(obj.source())) + for (Opens opens: md.opens()) { + if (opens.isQualified()) + ostream.print("qualified "); + String sourceAndMods = Stream.concat(Stream.of(opens.source()), + toStringStream(opens.modifiers())) .collect(Collectors.joining(" ")); - ostream.format(" opens %s", modsAndSource); - if (obj.isQualified()) - formatCommaList(ostream, " to", obj.targets()); - else - ostream.println(); + ostream.format("opens %s", sourceAndMods); + if (opens.isQualified()) { + String who = opens.targets().stream().collect(Collectors.joining(" ")); + ostream.format(" to %s", who); + } + ostream.println(); } // non-exported/non-open packages Set concealed = new TreeSet<>(md.packages()); md.exports().stream().map(Exports::source).forEach(concealed::remove); md.opens().stream().map(Opens::source).forEach(concealed::remove); - concealed.forEach(p -> ostream.format(" contains %s%n", p)); + concealed.forEach(p -> ostream.format("contains %s%n", p)); } - static String toString(Set s) { - return toStringStream(s).collect(Collectors.joining(" ")); + /** + * Prints a single line with the module name, version and modifiers + */ + private static void showModule(ModuleReference mref) { + ModuleDescriptor md = mref.descriptor(); + ostream.print(md.toNameAndVersion()); + mref.location() + .filter(uri -> !isJrt(uri)) + .ifPresent(uri -> ostream.format(" %s", uri)); + if (md.isOpen()) + ostream.print(" open"); + if (md.isAutomatic()) + ostream.print(" automatic"); + ostream.println(); } - static Stream toStringStream(Set s) { + /** + * A ModuleReference comparator that considers modules in the run-time + * image to be less than modules than not in the run-time image. + */ + private static class JrtFirstComparator implements Comparator { + private final Comparator real; + + JrtFirstComparator() { + this.real = Comparator.comparing(ModuleReference::descriptor); + } + + @Override + public int compare(ModuleReference a, ModuleReference b) { + if (isJrt(a)) { + return isJrt(b) ? real.compare(a, b) : -1; + } else { + return isJrt(b) ? 1 : real.compare(a, b); + } + } + } + + private static Stream toStringStream(Set s) { return s.stream().map(e -> e.toString().toLowerCase()); } - static String midAndLocation(ModuleDescriptor md, Optional location ) { - URI loc = location.orElse(null); - if (loc == null || loc.getScheme().equalsIgnoreCase("jrt")) - return md.toNameAndVersion(); - else - return md.toNameAndVersion() + " (" + loc + ")"; + private static boolean isJrt(ModuleReference mref) { + return isJrt(mref.location().orElse(null)); + } + + private static boolean isJrt(URI uri) { + return (uri != null && uri.getScheme().equalsIgnoreCase("jrt")); + } + + /** + * Called by the launcher to validate the modules on the upgrade and + * application module paths. + * + * @return {@code true} if no errors are found + */ + private static boolean validateModules() { + initOutput(System.out); + + ModuleValidator validator = new ModuleValidator(); + + // upgrade module path + String value = System.getProperty("jdk.module.upgrade.path"); + if (value != null) { + Stream.of(value.split(File.pathSeparator)) + .map(Paths::get) + .forEach(validator::scan); + } + + // system modules + ModuleFinder.ofSystem().findAll().stream() + .sorted(Comparator.comparing(ModuleReference::descriptor)) + .forEach(validator::process); + + // application module path + value = System.getProperty("jdk.module.path"); + if (value != null) { + Stream.of(value.split(File.pathSeparator)) + .map(Paths::get) + .forEach(validator::scan); + } + + return !validator.foundErrors(); + } + + /** + * A simple validator to check for errors and conflicts between modules. + */ + static class ModuleValidator { + private static final String MODULE_INFO = "module-info.class"; + + private Map nameToModule = new HashMap<>(); + private Map packageToModule = new HashMap<>(); + private boolean errorFound; + + /** + * Returns true if at least one error was found + */ + boolean foundErrors() { + return errorFound; + } + + /** + * Prints the module location and name. + */ + private void printModule(ModuleReference mref) { + mref.location() + .filter(uri -> !isJrt(uri)) + .ifPresent(uri -> ostream.print(uri + " ")); + ModuleDescriptor descriptor = mref.descriptor(); + ostream.print(descriptor.name()); + if (descriptor.isAutomatic()) + ostream.print(" automatic"); + ostream.println(); + } + + /** + * Prints the module location and name, checks if the module is + * shadowed by a previously seen module, and finally checks for + * package conflicts with previously seen modules. + */ + void process(ModuleReference mref) { + printModule(mref); + + String name = mref.descriptor().name(); + ModuleReference previous = nameToModule.putIfAbsent(name, mref); + if (previous != null) { + ostream.print(INDENT + "shadowed by "); + printModule(previous); + } else { + // check for package conflicts when not shadowed + for (String pkg : mref.descriptor().packages()) { + previous = packageToModule.putIfAbsent(pkg, mref); + if (previous != null) { + String mn = previous.descriptor().name(); + ostream.println(INDENT + "contains " + pkg + + " conflicts with module " + mn); + errorFound = true; + } + } + } + } + + /** + * Scan an element on a module path. The element is a directory + * of modules, an exploded module, or a JAR file. + */ + void scan(Path entry) { + BasicFileAttributes attrs; + try { + attrs = Files.readAttributes(entry, BasicFileAttributes.class); + } catch (NoSuchFileException ignore) { + return; + } catch (IOException ioe) { + ostream.println(entry + " " + ioe); + errorFound = true; + return; + } + + String fn = entry.getFileName().toString(); + if (attrs.isRegularFile() && fn.endsWith(".jar")) { + // JAR file, explicit or automatic module + scanModule(entry).ifPresent(this::process); + } else if (attrs.isDirectory()) { + Path mi = entry.resolve(MODULE_INFO); + if (Files.exists(mi)) { + // exploded module + scanModule(entry).ifPresent(this::process); + } else { + // directory of modules + scanDirectory(entry); + } + } + } + + /** + * Scan the JAR files and exploded modules in a directory. + */ + private void scanDirectory(Path dir) { + try (DirectoryStream stream = Files.newDirectoryStream(dir)) { + Map moduleToEntry = new HashMap<>(); + + for (Path entry : stream) { + BasicFileAttributes attrs; + try { + attrs = Files.readAttributes(entry, BasicFileAttributes.class); + } catch (IOException ioe) { + ostream.println(entry + " " + ioe); + errorFound = true; + continue; + } + + ModuleReference mref = null; + + String fn = entry.getFileName().toString(); + if (attrs.isRegularFile() && fn.endsWith(".jar")) { + mref = scanModule(entry).orElse(null); + } else if (attrs.isDirectory()) { + Path mi = entry.resolve(MODULE_INFO); + if (Files.exists(mi)) { + mref = scanModule(entry).orElse(null); + } + } + + if (mref != null) { + String name = mref.descriptor().name(); + Path previous = moduleToEntry.putIfAbsent(name, entry); + if (previous != null) { + // same name as other module in the directory + printModule(mref); + ostream.println(INDENT + "contains same module as " + + previous.getFileName()); + errorFound = true; + } else { + process(mref); + } + } + } + } catch (IOException ioe) { + ostream.println(dir + " " + ioe); + errorFound = true; + } + } + + /** + * Scan a JAR file or exploded module. + */ + private Optional scanModule(Path entry) { + ModuleFinder finder = ModuleFinder.of(entry); + try { + return finder.findAll().stream().findFirst(); + } catch (FindException e) { + ostream.println(entry); + ostream.println(INDENT + e.getMessage()); + Throwable cause = e.getCause(); + if (cause != null) { + ostream.println(INDENT + cause); + } + errorFound = true; + return Optional.empty(); + } + } } } diff --git a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties index 7816cc058cc..7cf14706afb 100644 --- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties +++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties @@ -53,26 +53,33 @@ java.launcher.opt.footer = \ \ A {0} separated list of directories, each directory\n\ \ is a directory of modules that replace upgradeable\n\ \ modules in the runtime image\n\ -\ --add-modules [,...]\n\ +\ --add-modules [,...]\n\ \ root modules to resolve in addition to the initial module.\n\ -\ can also be ALL-DEFAULT, ALL-SYSTEM,\n\ +\ can also be ALL-DEFAULT, ALL-SYSTEM,\n\ \ ALL-MODULE-PATH.\n\ -\ --limit-modules [,...]\n\ -\ limit the universe of observable modules\n\ -\ --list-modules [[,...]]\n\ -\ list the observable modules and exit\n\ -\ --dry-run create VM but do not execute main method.\n\ -\ This --dry-run option may be useful for validating the\n\ +\ --list-modules\n\ +\ list observable modules and exit\n\ +\ --d \n\ +\ --describe-module \n\ +\ describe a module and exit\n\ +\ --dry-run create VM and load main class but do not execute main method.\n\ +\ The --dry-run option may be useful for validating the\n\ \ command-line options such as the module system configuration.\n\ +\ --validate-modules\n\ +\ validate all modules and exit\n\ +\ The --validate-modules option may be useful for finding\n\ +\ conflicts and other errors with modules on the module path.\n\ \ -D=\n\ \ set a system property\n\ -\ -verbose:[class|gc|jni]\n\ +\ -verbose:[class|module|gc|jni]\n\ \ enable verbose output\n\ \ -version print product version to the error stream and exit\n\ \ --version print product version to the output stream and exit\n\ \ -showversion print product version to the error stream and continue\n\ \ --show-version\n\ \ print product version to the output stream and continue\n\ +\ --show-module-resolution\n\ +\ show module resolution output during startup\n\ \ -? -h -help\n\ \ print this help message to the error stream\n\ \ --help print this help message to the output stream\n\ @@ -119,7 +126,6 @@ java.launcher.X.usage=\n\ \ -Xcomp forces compilation of methods on first invocation\n\ \ -Xdebug provided for backward compatibility\n\ \ -Xdiag show additional diagnostic messages\n\ -\ -Xdiag:resolver show resolver diagnostic messages\n\ \ -Xfuture enable strictest checks, anticipating future default\n\ \ -Xint interpreted mode execution only\n\ \ -Xinternalversion\n\ @@ -164,10 +170,12 @@ java.launcher.X.usage=\n\ \ permit illegal access to members of types in named modules\n\ \ by code in unnamed modules. This compatibility option will\n\ \ be removed in the next release.\n\ -\ --disable-@files disable further argument file expansion\n\ +\ --limit-modules [,...]\n\ +\ limit the universe of observable modules\n\ \ --patch-module =({0})*\n\ -\ Override or augment a module with classes and resources\n\ -\ in JAR files or directories.\n\n\ +\ override or augment a module with classes and resources\n\ +\ in JAR files or directories.\n\ +\ --disable-@files disable further argument file expansion\n\n\ These extra options are subject to change without notice.\n # Translators please note do not translate the options themselves @@ -204,6 +212,7 @@ java.launcher.jar.error1=\ Error: An unexpected error occurred while trying to open file {0} java.launcher.jar.error2=manifest not found in {0} java.launcher.jar.error3=no main manifest attribute, in {0} +java.launcher.jar.error4=error loading java agent in {0} java.launcher.init.error=initialization error java.launcher.javafx.error1=\ Error: The JavaFX launchApplication method has the wrong signature, it\n\ @@ -215,4 +224,5 @@ java.launcher.module.error2=\ java.launcher.module.error3=\ Error: Unable to load main class {0} from module {1}\n\ \t{2} - +java.launcher.module.error4=\ + {0} not found diff --git a/jdk/src/java.base/share/native/libjli/emessages.h b/jdk/src/java.base/share/native/libjli/emessages.h index 8c3c34199ea..c5ae8d74b5e 100644 --- a/jdk/src/java.base/share/native/libjli/emessages.h +++ b/jdk/src/java.base/share/native/libjli/emessages.h @@ -43,13 +43,14 @@ #define ARG_ERROR2 "Error: %s requires jar file specification" #define ARG_ERROR3 "Error: The -J option should not be followed by a space." #define ARG_ERROR4 "Error: %s requires module path specification" -#define ARG_ERROR5 "Error: %s requires module id" +#define ARG_ERROR5 "Error: %s requires module name" #define ARG_ERROR6 "Error: %s requires modules to be specified" #define ARG_ERROR7 "Error: %s can only be specified once" #define ARG_ERROR8 "Error: Unmatched quote in environment variable %s" #define ARG_ERROR9 "Error: Option %s is not allowed in environment variable %s" #define ARG_ERROR10 "Error: Option %s in %s is not allowed in environment variable %s" #define ARG_ERROR11 "Error: Cannot specify main class in environment variable %s" +#define ARG_ERROR12 "Error: %s requires module name" #define JVM_ERROR1 "Error: Could not create the Java Virtual Machine.\n" GEN_ERROR #define JVM_ERROR2 "Error: Could not detach main thread.\n" JNI_ERROR diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c index f8265eeb110..927c09f5d14 100644 --- a/jdk/src/java.base/share/native/libjli/java.c +++ b/jdk/src/java.base/share/native/libjli/java.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, 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 @@ -71,7 +71,10 @@ static jboolean printTo = USE_STDERR; /* where to print version/usage */ static jboolean printXUsage = JNI_FALSE; /* print and exit*/ static jboolean dryRun = JNI_FALSE; /* initialize VM and exit */ static char *showSettings = NULL; /* print but continue */ -static char *listModules = NULL; +static jboolean showResolvedModules = JNI_FALSE; +static jboolean listModules = JNI_FALSE; +static char *describeModule = NULL; +static jboolean validateModules = JNI_FALSE; static const char *_program_name; static const char *_launcher_name; @@ -118,7 +121,10 @@ static void SetApplicationClassPath(const char**); static void PrintJavaVersion(JNIEnv *env, jboolean extraLF); static void PrintUsage(JNIEnv* env, jboolean doXUsage); static void ShowSettings(JNIEnv* env, char *optString); -static void ListModules(JNIEnv* env, char *optString); +static void ShowResolvedModules(JNIEnv* env); +static void ListModules(JNIEnv* env); +static void DescribeModule(JNIEnv* env, char* optString); +static jboolean ValidateModules(JNIEnv* env); static void SetPaths(int argc, char **argv); @@ -409,9 +415,31 @@ JavaMain(void * _args) CHECK_EXCEPTION_LEAVE(1); } - if (listModules != NULL) { - ListModules(env, listModules); + // show resolved modules and continue + if (showResolvedModules) { + ShowResolvedModules(env); CHECK_EXCEPTION_LEAVE(1); + } + + // list observable modules, then exit + if (listModules) { + ListModules(env); + CHECK_EXCEPTION_LEAVE(1); + LEAVE(); + } + + // describe a module, then exit + if (describeModule != NULL) { + DescribeModule(env, describeModule); + CHECK_EXCEPTION_LEAVE(1); + LEAVE(); + } + + // validate modules on the module path, then exit + if (validateModules) { + jboolean okay = ValidateModules(env); + CHECK_EXCEPTION_LEAVE(1); + if (!okay) ret = 1; LEAVE(); } @@ -552,7 +580,8 @@ static jboolean IsLauncherOption(const char* name) { return IsClassPathOption(name) || IsLauncherMainOption(name) || - JLI_StrCmp(name, "--list-modules") == 0; + JLI_StrCmp(name, "--describe-module") == 0 || + JLI_StrCmp(name, "-d") == 0; } /* @@ -1199,7 +1228,7 @@ GetOpt(int *pargc, char ***pargv, char **poption, char **pvalue) { } else if (JLI_StrCCmp(arg, "--") == 0 && (equals = JLI_StrChr(arg, '=')) != NULL) { value = equals+1; - if (JLI_StrCCmp(arg, "--list-modules=") == 0 || + if (JLI_StrCCmp(arg, "--describe-module=") == 0 || JLI_StrCCmp(arg, "--module=") == 0 || JLI_StrCCmp(arg, "--class-path=") == 0) { kind = LAUNCHER_OPTION_WITH_ARGUMENT; @@ -1263,18 +1292,18 @@ ParseArguments(int *pargc, char ***pargv, REPORT_ERROR (has_arg_any_len, ARG_ERROR1, arg); SetClassPath(value); mode = LM_CLASS; - } else if (JLI_StrCmp(arg, "--list-modules") == 0 || - JLI_StrCCmp(arg, "--list-modules=") == 0) { - listModules = arg; - - // set listModules to --list-modules= if argument is specified - if (JLI_StrCmp(arg, "--list-modules") == 0 && has_arg) { - static const char format[] = "%s=%s"; - size_t buflen = JLI_StrLen(option) + 2 + JLI_StrLen(value); - listModules = JLI_MemAlloc(buflen); - JLI_Snprintf(listModules, buflen, format, option, value); - } - return JNI_TRUE; + } else if (JLI_StrCmp(arg, "--list-modules") == 0) { + listModules = JNI_TRUE; + } else if (JLI_StrCmp(arg, "--show-resolved-modules") == 0) { + showResolvedModules = JNI_TRUE; + } else if (JLI_StrCmp(arg, "--validate-modules") == 0) { + AddOption("-Djdk.module.minimumBoot=true", NULL); + validateModules = JNI_TRUE; + } else if (JLI_StrCmp(arg, "--describe-module") == 0 || + JLI_StrCCmp(arg, "--describe-module=") == 0 || + JLI_StrCmp(arg, "-d") == 0) { + REPORT_ERROR (has_arg_any_len, ARG_ERROR12, arg); + describeModule = value; /* * Parse white-space options */ @@ -1336,9 +1365,8 @@ ParseArguments(int *pargc, char ***pargv, showSettings = arg; } else if (JLI_StrCmp(arg, "-Xdiag") == 0) { AddOption("-Dsun.java.launcher.diag=true", NULL); - AddOption("-Djdk.launcher.traceResolver=true", NULL); - } else if (JLI_StrCmp(arg, "-Xdiag:resolver") == 0) { - AddOption("-Djdk.launcher.traceResolver=true", NULL); + } else if (JLI_StrCmp(arg, "--show-module-resolution") == 0) { + AddOption("-Djdk.module.showModuleResolution=true", NULL); /* * The following case provide backward compatibility with old-style * command line options. @@ -1399,7 +1427,10 @@ ParseArguments(int *pargc, char ***pargv, } if (*pwhat == NULL) { - *pret = 1; + /* LM_UNKNOWN okay for options that exit */ + if (!listModules && !describeModule && !validateModules) { + *pret = 1; + } } else if (mode == LM_UNKNOWN) { /* default to LM_CLASS if -m, -jar and -cp options are * not specified */ @@ -1828,21 +1859,61 @@ ShowSettings(JNIEnv *env, char *optString) } /** - * List modules supported by the runtime + * Show resolved modules */ static void -ListModules(JNIEnv *env, char *optString) +ShowResolvedModules(JNIEnv *env) +{ + jmethodID showResolvedModulesID; + jclass cls = GetLauncherHelperClass(env); + NULL_CHECK(cls); + NULL_CHECK(showResolvedModulesID = (*env)->GetStaticMethodID(env, cls, + "showResolvedModules", "()V")); + (*env)->CallStaticVoidMethod(env, cls, showResolvedModulesID); +} + +/** + * List observable modules + */ +static void +ListModules(JNIEnv *env) { jmethodID listModulesID; - jstring joptString = NULL; jclass cls = GetLauncherHelperClass(env); NULL_CHECK(cls); NULL_CHECK(listModulesID = (*env)->GetStaticMethodID(env, cls, - "listModules", "(ZLjava/lang/String;)V")); + "listModules", "()V")); + (*env)->CallStaticVoidMethod(env, cls, listModulesID); +} + +/** + * Describe a module + */ +static void +DescribeModule(JNIEnv *env, char *optString) +{ + jmethodID describeModuleID; + jstring joptString = NULL; + jclass cls = GetLauncherHelperClass(env); + NULL_CHECK(cls); + NULL_CHECK(describeModuleID = (*env)->GetStaticMethodID(env, cls, + "describeModule", "(Ljava/lang/String;)V")); NULL_CHECK(joptString = (*env)->NewStringUTF(env, optString)); - (*env)->CallStaticVoidMethod(env, cls, listModulesID, - USE_STDOUT, - joptString); + (*env)->CallStaticVoidMethod(env, cls, describeModuleID, joptString); +} + +/** + * Validate modules + */ +static jboolean +ValidateModules(JNIEnv *env) +{ + jmethodID validateModulesID; + jclass cls = GetLauncherHelperClass(env); + NULL_CHECK_RETURN_VALUE(cls, JNI_FALSE); + validateModulesID = (*env)->GetStaticMethodID(env, cls, "validateModules", "()Z"); + NULL_CHECK_RETURN_VALUE(cls, JNI_FALSE); + return (*env)->CallStaticBooleanMethod(env, cls, validateModulesID); } /* diff --git a/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java b/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java index 65d1569d0a0..fb94e384116 100644 --- a/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java +++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java @@ -729,7 +729,8 @@ public interface Instrumentation { * Tests whether a module can be modified with {@link #redefineModule * redefineModule}. If a module is modifiable then this method returns * {@code true}. If a module is not modifiable then this method returns - * {@code false}. + * {@code false}. This method always returns {@code true} when the module + * is an unnamed module (as redefining an unnamed module is a no-op). * * @param module the module to test if it can be modified * @return {@code true} if the module is modifiable, otherwise {@code false} diff --git a/jdk/src/java.instrument/share/classes/java/lang/instrument/package.html b/jdk/src/java.instrument/share/classes/java/lang/instrument/package.html index e7f8d8f6996..5c40a234c91 100644 --- a/jdk/src/java.instrument/share/classes/java/lang/instrument/package.html +++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/package.html @@ -1,5 +1,5 @@ + * * This is what a menu bar might look like: *

      * + *

      * image showing the
  * distance AB=BC, and AD=DE - * + *

      * If the gradient and graphics rendering transforms are uniformly scaled and * the user sets the focus so that it coincides with the center of the circle, * the gradient color proportions are equal for any line drawn from the center. * The following figure shows the distances AB, BC, AD, and DE. They are all equal. - *

      + *

      * image showing the
  * distance of AB, BC, AD, and DE are all equal - *

      + *

      * Note that some minor variations in distances may occur due to sampling at * the granularity of a pixel. * If no cycle method is specified, {@code NO_CYCLE} will be chosen by @@ -116,11 +116,9 @@ import java.beans.ConstructorProperties; *

      * This image demonstrates the example code above, with default * (centered) focus for each of the three cycle methods: - *

      + *

      * image showing the
  * output of the sameple code - *

      - * *

      * It is also possible to specify a non-centered focus point, as * in the following code: @@ -139,10 +137,9 @@ import java.beans.ConstructorProperties; *

      * This image demonstrates the previous example code, with non-centered * focus for each of the three cycle methods: - *

      + *

      * image showing the
  * output of the sample code - *

      * * @see java.awt.Paint * @see java.awt.Graphics2D#setPaint diff --git a/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java b/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java index fcc5cf3c729..ecc531c1473 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, 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,7 +39,7 @@ import java.beans.Transient; * that create a {@code Rectangle}, and the methods that can modify * one, do not prevent setting a negative value for width or height. *

      - * + * * A {@code Rectangle} whose width or height is exactly zero has location * along those axes with zero dimension, but is otherwise considered empty. * The {@link #isEmpty} method will return true for such a {@code Rectangle}. @@ -49,7 +49,7 @@ import java.beans.Transient; * will include the location of the {@code Rectangle} on that axis in the * result as if the {@link #add(Point)} method were being called. *

      - * + * * A {@code Rectangle} whose width or height is negative has neither * location nor dimension along those axes with negative dimensions. * Such a {@code Rectangle} is treated as non-existent along those axes. diff --git a/jdk/src/java.desktop/share/classes/java/awt/Shape.java b/jdk/src/java.desktop/share/classes/java/awt/Shape.java index 209063c46a2..d8c385f200c 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Shape.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Shape.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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 @@ -43,7 +43,7 @@ import java.awt.geom.Rectangle2D; * object that describes the trajectory path of the {@code Shape} * outline. *

      - * Definition of insideness: + * Definition of insideness: * A point is considered to lie inside a * {@code Shape} if and only if: *

        diff --git a/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java b/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java index 63ceb3f1706..1de393a51cb 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java +++ b/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSourceContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -65,7 +65,7 @@ import sun.awt.ComponentFactory; * itself between the platform and the * listeners provided by the initiator of the drag operation. *

        - * + * * By default, {@code DragSourceContext} sets the cursor as appropriate * for the current state of the drag and drop operation. For example, if * the user has chosen {@linkplain DnDConstants#ACTION_MOVE the move action}, diff --git a/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java b/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java index c9ae83659f6..d9170d18ab5 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java +++ b/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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,14 +96,14 @@ import jdk.internal.misc.SharedSecrets; *

      * *

      Summary of attributes

      - *
      JDI Type Signatures
      * - * - * - * - * + * + * + * + * * * * diff --git a/jdk/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java b/jdk/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java index 019abbeb5c1..4bdb3d189f2 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java +++ b/jdk/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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 @@ -46,7 +46,7 @@ import java.beans.ConstructorProperties; * [ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ] * [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ] * - *

      Handling 90-Degree Rotations

      + *

      Handling 90-Degree Rotations

      *

      * In some variations of the {@code rotate} methods in the * {@code AffineTransform} class, a double-precision argument diff --git a/jdk/src/java.desktop/share/classes/java/awt/geom/Arc2D.java b/jdk/src/java.desktop/share/classes/java/awt/geom/Arc2D.java index c5bb52aca24..00e553bbbbb 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/geom/Arc2D.java +++ b/jdk/src/java.desktop/share/classes/java/awt/geom/Arc2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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,11 +33,11 @@ import java.io.Serializable; * start angle, angular extent (length of the arc), and a closure type * ({@code OPEN}, {@code CHORD}, or {@code PIE}). *

      - * + * * The arc is a partial section of a full ellipse which * inscribes the framing rectangle of its parent {@link RectangularShape}. * - * + * * The angles are specified relative to the non-square * framing rectangle such that 45 degrees always falls on the line from * the center of the ellipse to the upper right corner of the framing diff --git a/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java b/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java index 9ef2bb1bfd8..08df1a7451d 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java +++ b/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -846,7 +846,7 @@ public abstract class Path2D implements Shape, Cloneable { * path. * * @serialData - * + * *

        *
      1. The default serializable fields. * There are no default serializable fields as of 1.6. @@ -1605,7 +1605,7 @@ public abstract class Path2D implements Shape, Cloneable { * path. * * @serialData - * + * *
          *
        1. The default serializable fields. * There are no default serializable fields as of 1.6. diff --git a/jdk/src/java.desktop/share/classes/java/awt/im/spi/package-info.java b/jdk/src/java.desktop/share/classes/java/awt/im/spi/package-info.java index 59e34968325..ca2e5337413 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/im/spi/package-info.java +++ b/jdk/src/java.desktop/share/classes/java/awt/im/spi/package-info.java @@ -33,7 +33,7 @@ * languages and the use of entirely different input mechanisms, such as * handwriting recognition. * - *

          Packaging Input Methods

          + *

          Packaging Input Methods

          * Input methods can be made available by adding them to the application's class * path. The main JAR file of an input method must contain the file: *
          @@ -61,14 +61,14 @@
            * that loading of the class implementing {@code InputMethod} can be deferred
            * until actually needed.
            *
          - * 

          Loading Input Methods

          + *

          Loading Input Methods

          * The input method framework will usually defer loading of input method * classes until they are absolutely needed. It loads only the * {@code InputMethodDescriptor} implementations during AWT initialization. It * loads an {@code InputMethod} implementation when the input method has been * selected. * - *

          Java Input Methods and Peered Text + *

          Java Input Methods and Peered Text * Components

          * The Java input method framework intends to support all combinations of input * methods (host input methods and Java input methods) and components (peered diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferByte.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferByte.java index e1c32674858..d6fadd97c31 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferByte.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferByte.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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,7 @@ import static sun.java2d.StateTrackable.State.*; * Values stored in the byte array(s) of this {@code DataBuffer} are treated as * unsigned values. *

          - * + * * Note that some implementations may function more efficiently * if they can maintain control over how the data for an image is * stored. diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferDouble.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferDouble.java index 4ca5471cd18..cfd78cd8f0e 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferDouble.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferDouble.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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,7 +31,7 @@ import static sun.java2d.StateTrackable.State.*; * This class extends {@code DataBuffer} and stores data internally * in {@code double} form. *

          - * + * * Note that some implementations may function more efficiently * if they can maintain control over how the data for an image is * stored. diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferFloat.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferFloat.java index 48e0cf437ff..259f0699780 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferFloat.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferFloat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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,7 +31,7 @@ import static sun.java2d.StateTrackable.State.*; * This class extends {@code DataBuffer} and stores data internally * in {@code float} form. *

          - * + * * Note that some implementations may function more efficiently * if they can maintain control over how the data for an image is * stored. diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferInt.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferInt.java index cdf43cedb2a..58d8e658f17 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferInt.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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,7 +41,7 @@ import static sun.java2d.StateTrackable.State.*; * This class extends {@code DataBuffer} and stores data internally * as integers. *

          - * + * * Note that some implementations may function more efficiently * if they can maintain control over how the data for an image is * stored. diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferShort.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferShort.java index 1c90a5fd171..90d8148fbb8 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferShort.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferShort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -40,7 +40,7 @@ import static sun.java2d.StateTrackable.State.*; /** * This class extends {@code DataBuffer} and stores data internally as shorts. *

          - * + * * Note that some implementations may function more efficiently * if they can maintain control over how the data for an image is * stored. diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferUShort.java b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferUShort.java index d2009f90a0e..f8ec77a0711 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferUShort.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/DataBufferUShort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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,7 @@ import static sun.java2d.StateTrackable.State.*; * shorts. Values stored in the short array(s) of this {@code DataBuffer} * are treated as unsigned values. *

          - * + * * Note that some implementations may function more efficiently * if they can maintain control over how the data for an image is * stored. diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java b/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java index 81aab994178..2ef638ee0f5 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java @@ -55,7 +55,7 @@ import java.util.Arrays; * {@code IndexColorModel} objects are never pre-multiplied with * the alpha components. *

          - * + * * The transparency of an {@code IndexColorModel} object is * determined by examining the alpha components of the colors in the * colormap and choosing the most specific value after considering @@ -86,7 +86,7 @@ import java.util.Arrays; * and {@code getNumComponents} returns 4. * *

          - * + * * The values used to index into the colormap are taken from the least * significant n bits of pixel representations where * n is based on the pixel size specified in the constructor. diff --git a/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java b/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java index eb311c27cda..74b81fe272b 100644 --- a/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java +++ b/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java @@ -37,7 +37,7 @@ * interfaces, and 6 Java programming language classes. These are described * below. * - *

          Interface + *

          Interface * Accessible

          * Interface Accessible is the main interface of * the Java Accessibility API. All components that support the Java @@ -48,7 +48,7 @@ * object that is part of the user interface of a Java application, if that * program is to be compatible with assistive technologies. * - *

          Class + *

          Class * AccessibleContext

          * AccessibleContext represents the minimum * information all accessible objects return and is obtained by calling the @@ -108,7 +108,7 @@ * called on an AccessibleContext.

        2. * * - *

          Class + *

          Class * AccessibleRole

          * This class encapsulates the Accessible object's role in the user interface * and is obtained by calling the {@code getAccessibleRole} method on an @@ -123,7 +123,7 @@ * programmer-defined roles can be added in the future without needing to modify * the base class. * - *

          Class + *

          Class * AccessibleState

          * This class encapsulates a particular state of the Accessible object. * Accessible states include things like "Armed", "Busy", "Checked", "Focused", @@ -142,7 +142,7 @@ * additional, programmer-defined roles can be added in the future without * needing to modify the base class. * - *

          Class + *

          Class * AccessibleStateSet

          * This class encapsulates a collection of states of the Accessible object and * is obtained by calling the {@code getAccessibleStateSet} method on an @@ -152,7 +152,7 @@ * class provide for retrieving the individual * AccessibleStates on the state set. * - *

          Class + *

          Class * AccessibleBundle

          * This class is used to maintain a strongly typed enumeration. It is the super * class of both the AccessibleRole and @@ -161,7 +161,7 @@ * AccessibleRole and * AccessibleState classes. * - *

          Interface + *

          Interface * AccessibleAction

          * The AccessibleAction interface should be * supported by any object that can perform one or more actions. This interface @@ -177,7 +177,7 @@ * AccessibleContext. If the return value is * not null, the object supports this interface. * - *

          + *

          * Interface AccessibleComponent

          * The AccessibleComponent interface * should be supported by any object that is rendered on the screen. This @@ -190,7 +190,7 @@ * AccessibleContext. If the return value is * not null, the object supports this interface. * - *

          + *

          * Interface AccessibleSelection

          * The AccessibleSelection interface * provides the standard mechanism for an assistive technology to determine what @@ -206,7 +206,7 @@ * AccessibleContext. If the return value is * not null, the object supports this interface. * - *

          Interface + *

          Interface * AccessibleText

          * Interface AccessibleText is the contract * for making rich, editable text Accessible. Not all text displayed on the @@ -230,7 +230,7 @@ * AccessibleContext. If the return value is * not null, the object supports this interface. * - *

          + *

          * Interface AccessibleHypertext

          * The AccessibleHypertext interface * should be supported by any object that presents hypertext information on the @@ -246,7 +246,7 @@ * class which extends AccessibleHypertext, then that object supports * AccessibleHypertext. * - *

          + *

          * Interface AccessibleHyperlink

          * An object that is a hyperlink should support the * AccessibleHyperlink interface.  @@ -254,7 +254,7 @@ * getLink method on an AccessibleHypertext * object. * - *

          Interface + *

          Interface * AccessibleValue

          * The AccessibleValue interface should be * supported by any object that supports a numerical value (e.g., a scroll bar). diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java index 7678762203f..8b522da3ed6 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -63,8 +63,8 @@ import com.sun.imageio.plugins.tiff.TIFFImageMetadata; *

          A {@code TIFFDirectory} is aware of the tag numbers in the * group of {@link TIFFTagSet}s associated with it. When * a {@code TIFFDirectory} is created from a native image metadata - * object, these tag sets are derived from the tagSets attribute - * of the TIFFIFD node.

          + * object, these tag sets are derived from the {@code tagSets} attribute + * of the {@code TIFFIFD} node.

          * *

          A {@code TIFFDirectory} might also have a parent {@link TIFFTag}. * This will occur if the directory represents an IFD other than the root @@ -73,8 +73,8 @@ import com.sun.imageio.plugins.tiff.TIFFImageMetadata; * {@link TIFFTag#isIFDPointer} method of this parent {@code TIFFTag} * must return {@code true}. When a {@code TIFFDirectory} is * created from a native image metadata object, the parent tag set is set - * from the parentTagName attribute of the corresponding - * TIFFIFD node. Note that a {@code TIFFDirectory} instance + * from the {@code parentTagName} attribute of the corresponding + * {@code TIFFIFD} node. Note that a {@code TIFFDirectory} instance * which has a non-{@code null} parent tag will be contained in the * data field of a {@code TIFFField} instance which has a tag field * equal to the contained directory's parent tag.

          @@ -133,8 +133,8 @@ public class TIFFDirectory implements Cloneable { * an image metadata object. The supplied object must support an image * metadata format supported by the TIFF {@link javax.imageio.ImageWriter} * plug-in. This will usually be either the TIFF native image metadata - * format javax_imageio_tiff_image_1.0 or the Java - * Image I/O standard metadata format javax_imageio_1.0. + * format {@code javax_imageio_tiff_image_1.0} or the Java + * Image I/O standard metadata format {@code javax_imageio_1.0}. * * @param tiffImageMetadata A metadata object which supports a compatible * image metadata format. diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java index 7d4152c3db4..abc041abca0 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java @@ -62,7 +62,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *

      * * * * * * * * * * * * * * * * * * * * * * * * * *
      KeyValue TypePrincipal ConstantsDefault ValueKeyValue TypePrincipal ConstantsDefault Value
      {@link #FAMILY}
      - * BYTE + * {@code BYTE} * * {@link TIFFTag#TIFF_BYTE} @@ -77,7 +77,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * ASCII + * {@code ASCII} * * {@link TIFFTag#TIFF_ASCII} @@ -92,7 +92,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * SHORT + * {@code SHORT} * * {@link TIFFTag#TIFF_SHORT} @@ -107,7 +107,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * LONG + * {@code LONG} * * {@link TIFFTag#TIFF_LONG} @@ -122,7 +122,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * RATIONAL + * {@code RATIONAL} * * {@link TIFFTag#TIFF_RATIONAL} @@ -137,7 +137,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * SBYTE + * {@code SBYTE} * * {@link TIFFTag#TIFF_SBYTE} @@ -152,7 +152,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * UNDEFINED + * {@code UNDEFINED} * * {@link TIFFTag#TIFF_UNDEFINED} @@ -167,7 +167,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * SSHORT + * {@code SSHORT} * * {@link TIFFTag#TIFF_SSHORT} @@ -182,7 +182,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * SLONG + * {@code SLONG} * * {@link TIFFTag#TIFF_SLONG} @@ -197,7 +197,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * SRATIONAL + * {@code SRATIONAL} * * {@link TIFFTag#TIFF_SRATIONAL} @@ -212,7 +212,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * FLOAT + * {@code FLOAT} * * {@link TIFFTag#TIFF_FLOAT} @@ -227,7 +227,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * DOUBLE + * {@code DOUBLE} * * {@link TIFFTag#TIFF_DOUBLE} @@ -242,7 +242,7 @@ import com.sun.imageio.plugins.tiff.TIFFIFD; * *
      - * IFD + * {@code IFD} * * {@link TIFFTag#TIFF_IFD_POINTER} @@ -941,14 +941,14 @@ public final class TIFFField implements Cloneable { /** * Returns the {@code TIFFField} as a node named either - * "TIFFField" or "TIFFIFD" as described in the + * {@code "TIFFField"} or {@code "TIFFIFD"} as described in the * TIFF native image metadata specification. The node will be named - * "TIFFIFD" if and only if {@link #hasDirectory()} returns + * {@code "TIFFIFD"} if and only if {@link #hasDirectory()} returns * {@code true} and the field's type is either {@link TIFFTag#TIFF_LONG} * or {@link TIFFTag#TIFF_IFD_POINTER}. * - * @return a {@code Node} named "TIFFField" or - * "TIFFIFD". + * @return a {@code Node} named {@code "TIFFField"} or + * {@code "TIFFIFD"}. */ public Node getAsNativeNode() { return new TIFFFieldNode(this); diff --git a/jdk/src/java.desktop/share/classes/javax/print/MimeType.java b/jdk/src/java.desktop/share/classes/javax/print/MimeType.java index c9d1f614af0..e96859e9c4c 100644 --- a/jdk/src/java.desktop/share/classes/javax/print/MimeType.java +++ b/jdk/src/java.desktop/share/classes/javax/print/MimeType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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,6 @@ import java.util.Vector; *
    • * Since not all Java profiles include the AWT, the Jini Print Service should * not depend on an AWT class. - *

      *

    • * The implementation of class java.awt.datatransfer.MimeType does not * guarantee @@ -76,7 +75,6 @@ import java.util.Vector; *
    • Quoting backslash characters inside parameter values are removed. *
    • The parameters are arranged in ascending order of parameter name. * - *

      * * @author Alan Kaminsky */ diff --git a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java index 8369f7f4da8..7df44452a4f 100644 --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -40,7 +40,7 @@ import javax.print.attribute.PrintJobAttribute; * for purposes of finishing. *

      * Standard Finishings values are: - * + *
      * *
      *   @@ -76,7 +76,7 @@ import javax.print.attribute.PrintJobAttribute; *

      * The following Finishings values are more specific; they indicate a * corner or an edge as if the document were a portrait document: - * + *
      * *
      *   diff --git a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java index 7f06e953572..86a84de83d0 100644 --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -70,7 +70,7 @@ import javax.print.attribute.PrintJobAttribute; * The standard MultipleDocumentHandling values are: *
        *
      • - * {@link #SINGLE_DOCUMENT + * {@link #SINGLE_DOCUMENT * SINGLE_DOCUMENT}. If a print job has multiple * documents -- say, the document data is called {@code a} and * {@code b} -- then the result of processing all the document data @@ -85,7 +85,7 @@ import javax.print.attribute.PrintJobAttribute; * each copy ({@code a(*),b(*)}) to start on a new media sheet. * *
      • - * {@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES + * {@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES}. If a print job * has multiple documents -- say, the document data is called {@code a} and * {@code b} -- then the result of processing the data in each document @@ -98,7 +98,7 @@ import javax.print.attribute.PrintJobAttribute; * {@code a(*),a(*),...,b(*),b(*)...}. * *
      • - * {@link #SEPARATE_DOCUMENTS_COLLATED_COPIES + * {@link #SEPARATE_DOCUMENTS_COLLATED_COPIES * SEPARATE_DOCUMENTS_COLLATED_COPIES}. If a print job * has multiple documents -- say, the document data is called {@code a} and * {@code b} -- then the result of processing the data in each document @@ -111,7 +111,7 @@ import javax.print.attribute.PrintJobAttribute; * {@code a(*),b(*),a(*),b(*),...}. * *
      • - * {@link #SINGLE_DOCUMENT_NEW_SHEET + * {@link #SINGLE_DOCUMENT_NEW_SHEET * SINGLE_DOCUMENT_NEW_SHEET}. Same as SINGLE_DOCUMENT, * except that the printer must ensure that the first impression of each * document instance in the job is placed on a new media sheet. This value diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java index f7b8b9b5b3a..6ca01acb05b 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -47,15 +47,15 @@ package javax.sound.midi; * {@code MidiMessage} includes methods to get, but not set, these values. * Setting them is a subclass responsibility. *

        - * The MIDI standard expresses MIDI data in + * The MIDI standard expresses MIDI data in * bytes. However, because JavaTM uses signed bytes, the Java Sound * API uses integers instead of bytes when expressing MIDI data. For example, * the {@link #getStatus()} method of {@code MidiMessage} returns MIDI status * bytes as integers. If you are processing MIDI data that originated outside * Java Sound and now is encoded as signed bytes, the bytes can be * converted to integers using this conversion: - * - *

        {@code int i = (int)(byte & 0xFF)}
        + *

        + * {@code int i = (int)(byte & 0xFF)} *

        * If you simply need to pass a known MIDI byte value as a method parameter, it * can be expressed directly as an integer, using (for example) decimal or diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java index 2d679613e01..0019a74f1b8 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -51,7 +51,7 @@ package javax.sound.midi; * given type of {@code Synthesizer} always has a fixed number of voices, equal * to the maximum number of simultaneous notes it is capable of sounding. *

        - * If the voice is not currently processing + * If the voice is not currently processing * a MIDI note, it is considered inactive. A voice is inactive when it has been * given no note-on commands, or when every note-on command received has been * terminated by a corresponding note-off (or by an "all notes off" message). diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java index 40cc82e4db5..af310211d5f 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/FloatControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -361,8 +361,8 @@ public abstract class FloatControl extends Control { * loudness is unaffected. Note that gain measures dB, not amplitude. * The relationship between a gain in decibels and the corresponding * linear amplitude multiplier is: - * - *

        {@code linearScalar = pow(10.0, gainDB/20.0)}
        + *

        + * {@code linearScalar = pow(10.0, gainDB/20.0)} *

        * The {@code FloatControl} class has methods to impose a maximum and * minimum allowable value for gain. However, because an audio signal diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java index 7749b3a86fc..b5e20f0702a 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -159,9 +159,9 @@ public interface SourceDataLine extends DataLine { *

        * The number of bytes to write must represent an integral number of sample * frames, such that: - *
        - *

        {@code [ bytes written ] % [frame size in bytes ] == 0}
        - *
        + *

        + * {@code [ bytes written ] % [frame size in bytes ] == 0} + *

        * The return value will always meet this requirement. A request to write a * number of bytes representing a non-integral number of sample frames * cannot be fulfilled and may result in an diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/TargetDataLine.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/TargetDataLine.java index acacdbcccae..944c8e03d92 100644 --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/TargetDataLine.java +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/TargetDataLine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -149,9 +149,9 @@ public interface TargetDataLine extends DataLine { *

        * The number of bytes to be read must represent an integral number of * sample frames, such that: - *
        - *

        {@code [ bytes read ] % [frame size in bytes ] == 0}
        - *
        + *

        + * {@code [ bytes read ] % [frame size in bytes ] == 0} + *

        * The return value will always meet this requirement. A request to read a * number of bytes representing a non-integral number of sample frames * cannot be fulfilled and may result in an IllegalArgumentException. diff --git a/jdk/src/java.desktop/share/classes/javax/swing/Action.java b/jdk/src/java.desktop/share/classes/javax/swing/Action.java index f34fe517f11..52c6cd8c01b 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/Action.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/Action.java @@ -69,7 +69,7 @@ import java.beans.*; * are desired, and use simple ActionListeners elsewhere. *
        * - *

        Swing Components Supporting Action

        + *

        Swing Components Supporting Action

        *

        * Many of Swing's components have an Action property. When * an Action is set on a component, the following things @@ -96,34 +96,34 @@ import java.beans.*; * * - * - * + * + * * + * * + * * + * * + * * + * * + * * + * * + * *
        Component Property - * Components - * Action Key - * Notes - *
        Component Property + * Components + * Action Key + * Notes + *
        enabled * All * The isEnabled method *   - *
        toolTipText * All * SHORT_DESCRIPTION *   - *
        actionCommand * All * ACTION_COMMAND_KEY *   - *
        mnemonic * All buttons * MNEMONIC_KEY * A null value or Action results in the * button's mnemonic property being set to * '\0'. - *
        text * All buttons * NAME @@ -139,7 +139,7 @@ import java.beans.*; * true if the Action has a * non-null value for LARGE_ICON_KEY or * SMALL_ICON. - *
        displayedMnemonicIndex * All buttons * DISPLAYED_MNEMONIC_INDEX_KEY @@ -150,7 +150,7 @@ import java.beans.*; * mnemonic index is not updated. In any subsequent changes to * DISPLAYED_MNEMONIC_INDEX_KEY, null * is treated as -1. - *
        icon * All buttons except of JCheckBox, * JToggleButton and JRadioButton. @@ -160,13 +160,13 @@ import java.beans.*; * SMALL_ICON. All other buttons will use * LARGE_ICON_KEY; if the value is null they * use SMALL_ICON. - *
        accelerator * All JMenuItem subclasses, with the exception of * JMenu. * ACCELERATOR_KEY *   - *
        selected * JToggleButton, JCheckBox, * JRadioButton, JCheckBoxMenuItem and diff --git a/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java b/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java index ceaa943b97c..c56f020fe0e 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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.PrintStream; * arranged when the frame is resized. * * - *
        + * *

        The following text describes this graphic. diff --git a/jdk/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java b/jdk/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java index 31bb7dd6596..3ac3755b82f 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -40,7 +40,7 @@ import sun.swing.DefaultLookup; /** * Renders an item in a list. *

        - * Implementation Note: + * Implementation Note: * This class overrides * invalidate, * validate, diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java index 6de8a0bd750..1c1f56a56db 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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,7 +49,7 @@ import javax.accessibility.*; * * * - *
        + * *

        The following text describes this image. diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JList.java b/jdk/src/java.desktop/share/classes/javax/swing/JList.java index ca8202071f5..0e7648c3630 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JList.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -145,7 +145,7 @@ import static sun.swing.SwingUtilities2.Section.*; * Responsibility for listening to selection changes in order to keep the list's * visual representation up to date lies with the list's {@code ListUI}. *

        - * + * * Painting of cells in a {@code JList} is handled by a delegate called a * cell renderer, installed on the list as the {@code cellRenderer} property. * The renderer provides a {@code java.awt.Component} that is used @@ -201,7 +201,7 @@ import static sun.swing.SwingUtilities2.Section.*; * To avoid these calculations, you can set a {@code fixedCellWidth} and * {@code fixedCellHeight} on the list, or have these values calculated * automatically based on a single prototype value: - * + * *

          * {@code
          * JList bigDataList = new JList(bigData);
        diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java
        index a61f1507253..1fec8d24b18 100644
        --- a/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java
        +++ b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 1997, 2017, 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
        @@ -143,7 +143,7 @@ import sun.awt.AWTAccessor;
          * in which case a default Frame is used as the parent,
          * and the dialog will be
          * centered on the screen (depending on the {@literal L&F}).
        - * 
        message
        + *
        message
        * A descriptive message to be placed in the dialog box. * In the most common usage, message is just a String or * String constant. diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java index 3f72a8bc5ef..2a16d69daa1 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java @@ -72,7 +72,7 @@ import sun.security.action.GetBooleanAction; * * * - * diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java index a51509baec3..04e99bc521a 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,7 +57,7 @@ import java.beans.Transient; * *
        + * * The following text describes this graphic. *
        * - *
        + * *

        The following text describes this image. diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JTree.java b/jdk/src/java.desktop/share/classes/javax/swing/JTree.java index 34f779ab029..0dfcaebf0db 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JTree.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -44,7 +44,7 @@ import sun.swing.SwingUtilities2.Section; import static sun.swing.SwingUtilities2.Section.*; /** - * + * * A control that displays a set of hierarchical data as an outline. * You can find task-oriented documentation and examples of using trees in * How to Use Trees, diff --git a/jdk/src/java.desktop/share/classes/javax/swing/LookAndFeel.java b/jdk/src/java.desktop/share/classes/javax/swing/LookAndFeel.java index bd8ea835b6c..0356defe226 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/LookAndFeel.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/LookAndFeel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -91,7 +91,7 @@ import java.util.StringTokenizer; * to provide a specific set of defaults. These are documented in the * classes that require the specific default. * - *

        ComponentUIs and defaults

        + *

        ComponentUIs and defaults

        * * All {@code ComponentUIs} typically need to set various properties * on the {@code JComponent} the {@code ComponentUI} is providing the @@ -121,7 +121,7 @@ import java.util.StringTokenizer; * provided by this class as they handle the necessary checking and install * the property using the recommended guidelines. * - *

        Exceptions

        + *

        Exceptions

        * * All of the install methods provided by {@code LookAndFeel} need to * access the defaults if the value of the property being changed is diff --git a/jdk/src/java.desktop/share/classes/javax/swing/SizeSequence.java b/jdk/src/java.desktop/share/classes/javax/swing/SizeSequence.java index 131032d8491..24b4c845994 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/SizeSequence.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/SizeSequence.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -53,11 +53,10 @@ package javax.swing; * The following figure shows the relationship between size and position data * for a multi-column component. * - *
        + *

        * The first item begins at position 0, the second at the position equal
  to the size of the previous item, and so on. - *

        *

        * In the figure, the first index (0) corresponds to the first column, * the second index (1) to the second column, and so on. diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java index 05efd8f8321..42fc80b49a7 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java @@ -1283,14 +1283,13 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { * text component (i.e. the root of the hierarchy) that * can be traversed to determine how the model is being * represented spatially. - *

        - * NOTE:The View hierarchy can + *

        + * NOTE:The View hierarchy can * be traversed from the root view, and other things * can be done as well. Things done in this way cannot * be protected like simple method calls through the TextUI. * Therefore, proper operation in the presence of concurrency * must be arranged by any logic that calls this method! - * * * @param tc the text component for which this UI is installed * @return the view diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java index dae37d5e7be..0ded39cc52b 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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,7 @@ import sun.swing.SwingUtilities2; * All colors returned by {@code DefaultMetalTheme} are completely * opaque. * - *

        Font Style

        + *

        Font Style

        * * {@code DefaultMetalTheme} uses bold fonts for many controls. To make all * controls (with the exception of the internal frame title bars and diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java index 9320bd1d095..fed8e2b0145 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java @@ -292,85 +292,85 @@ public class MetalLookAndFeel extends BasicLookAndFeel * added to {@code table}: * - * - * + * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * *
        Key - * Value - *
        Key + * Value + *
        "desktop" * {@code theme.getDesktopColor()} - *
        "activeCaption" * {@code theme.getWindowTitleBackground()} - *
        "activeCaptionText" * {@code theme.getWindowTitleForeground()} - *
        "activeCaptionBorder" * {@code theme.getPrimaryControlShadow()} - *
        "inactiveCaption" * {@code theme.getWindowTitleInactiveBackground()} - *
        "inactiveCaptionText" * {@code theme.getWindowTitleInactiveForeground()} - *
        "inactiveCaptionBorder" * {@code theme.getControlShadow()} - *
        "window" * {@code theme.getWindowBackground()} - *
        "windowBorder" * {@code theme.getControl()} - *
        "windowText" * {@code theme.getUserTextColor()} - *
        "menu" * {@code theme.getMenuBackground()} - *
        "menuText" * {@code theme.getMenuForeground()} - *
        "text" * {@code theme.getWindowBackground()} - *
        "textText" * {@code theme.getUserTextColor()} - *
        "textHighlight" * {@code theme.getTextHighlightColor()} - *
        "textHighlightText" * {@code theme.getHighlightedTextColor()} - *
        "textInactiveText" * {@code theme.getInactiveSystemTextColor()} - *
        "control" * {@code theme.getControl()} - *
        "controlText" * {@code theme.getControlTextColor()} - *
        "controlHighlight" * {@code theme.getControlHighlight()} - *
        "controlLtHighlight" * {@code theme.getControlHighlight()} - *
        "controlShadow" * {@code theme.getControlShadow()} - *
        "controlDkShadow" * {@code theme.getControlDarkShadow()} - *
        "scrollbar" * {@code theme.getControl()} - *
        "info" * {@code theme.getPrimaryControl()} - *
        "infoText" * {@code theme.getPrimaryControlInfo()} *
        diff --git a/jdk/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java b/jdk/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java index 0a7504da6ea..541a4e7343f 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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,7 +41,7 @@ import sun.swing.DefaultLookup; * in a JTable. *

        * - * Implementation Note: + * Implementation Note: * This class inherits from JLabel, a standard component class. * However JTable employs a unique mechanism for rendering * its cells and therefore requires some slightly modified behavior diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java index d61d1f8de5b..640ca1c07c0 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -999,17 +999,17 @@ public class HTMLDocument extends DefaultStyledDocument { * * *

        Invoking setInnerHTML(elem, "<ul><li>") - * results in the following structure (new elements are in red).

        + * results in the following structure (new elements are in red).

        * *
              *     <body>
              *       |
              *     <div>
              *         \
        -     *         <ul>
        +     *         <ul>
              *           \
        -     *           <li>
        +     *           <li>
              * 
        * *

        Parameter elem must not be a leaf element, @@ -1083,15 +1083,15 @@ public class HTMLDocument extends DefaultStyledDocument { * * *

        Invoking setOuterHTML(elem, "<ul><li>") - * results in the following structure (new elements are in red).

        + * results in the following structure (new elements are in red).

        * *
              *    <body>
              *      |
        -     *     <ul>
        +     *     <ul>
              *       \
        -     *       <li>
        +     *       <li>
              * 
        * *

        If either elem or htmlText @@ -1157,16 +1157,16 @@ public class HTMLDocument extends DefaultStyledDocument { * *

        Invoking insertAfterStart(elem, * "<ul><li>") results in the following structure - * (new elements are in red).

        + * (new elements are in red).

        * *
              *        <body>
              *          |
              *        <div>
              *       /  |  \
        -     *    <ul> <p> <p>
        +     *    <ul> <p> <p>
              *     /
        -     *  <li>
        +     *  <li>
              * 
        * *

        Unlike the insertBeforeStart method, new @@ -1229,17 +1229,17 @@ public class HTMLDocument extends DefaultStyledDocument { * * *

        Invoking insertBeforeEnd(elem, "<ul><li>") - * results in the following structure (new elements are in red).

        + * results in the following structure (new elements are in red).

        * *
              *        <body>
              *          |
              *        <div>
              *       /  |  \
        -     *     <p> <p> <ul>
        +     *     <p> <p> <ul>
              *               \
        -     *               <li>
        +     *               <li>
              * 
        * *

        Unlike the insertAfterEnd method, new elements @@ -1300,14 +1300,14 @@ public class HTMLDocument extends DefaultStyledDocument { * *

        Invoking insertBeforeStart(elem, * "<ul><li>") results in the following structure - * (new elements are in red).

        + * (new elements are in red).

        * *
              *        <body>
              *         /  \
        -     *      <ul> <div>
        +     *      <ul> <div>
              *       /    /  \
        -     *     <li> <p>  <p>
        +     *     <li> <p>  <p>
              * 
        * *

        Unlike the insertAfterStart method, new @@ -1360,15 +1360,15 @@ public class HTMLDocument extends DefaultStyledDocument { * * *

        Invoking insertAfterEnd(elem, "<ul><li>") - * results in the following structure (new elements are in red).

        + * results in the following structure (new elements are in red).

        * *
              *        <body>
              *         /  \
        -     *      <div> <ul>
        +     *      <div> <ul>
              *       / \    \
        -     *     <p> <p>  <li>
        +     *     <p> <p>  <li>
              * 
        * *

        Unlike the insertBeforeEnd method, new elements diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java index d5d995e9fba..7117fdd3823 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -1120,7 +1120,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * * * - * * diff --git a/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java b/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java index c7cdfc366ea..1b600343613 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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,9 +61,9 @@ import sun.swing.DefaultLookup; * defaults table. The following table lists the mapping between * {@code DefaultTreeCellRenderer} property and defaults table key: *
        TagView created + * TagView created *
        HTML.Tag.CONTENTInlineView *
        - * - * + *
        Property: - * Key: + *
        Property: + * Key: *
        "leafIcon""Tree.leafIcon" *
        "closedIcon""Tree.closedIcon" *
        "openIcon""Tree.openIcon" @@ -74,7 +74,7 @@ import sun.swing.DefaultLookup; *
        "borderSelectionColor""Tree.selectionBorderColor" *
        *

        - * Implementation Note: + * Implementation Note: * This class overrides * invalidate, * validate, diff --git a/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java b/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java index cb85826e611..55fa6228b76 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,11 +57,11 @@ import sun.swing.text.UndoableEditLockSupport; * upper-case letter in bold are significant, those in lower-case * and italicized are insignificant. *

        - * + * * *
        * - *
        Figure 1 + *
        Figure 1 *
        *

        * As shown in figure 1, if D was just added, the @@ -70,11 +70,11 @@ import sun.swing.text.UndoableEditLockSupport; * index of the next edit to 3 (edit c), as shown in the following * figure. *

        - * + * * *
        * - *
        Figure 2 + *
        Figure 2 *
        *

        * The last significant edit is A, so that invoking @@ -82,11 +82,11 @@ import sun.swing.text.UndoableEditLockSupport; * b, and A, in that order, setting the index of the * next edit to 0, as shown in the following figure. *

        - * + * * *
        * - *
        Figure 3 + *
        Figure 3 *
        *

        * Invoking redo results in invoking redo on @@ -108,11 +108,11 @@ import sun.swing.text.UndoableEditLockSupport; * the new edit is added after c, as shown in the following * figure. *

        - * + * * *
        * - *
        Figure 4 + *
        Figure 4 *
        *

        * Once end has been invoked on an UndoManager From 5024b5321b8eea71dda84d8ed7cf0b7a70452824 Mon Sep 17 00:00:00 2001 From: Felix Yang Date: Sun, 7 May 2017 19:01:13 -0700 Subject: [PATCH 28/55] 8178912: Remove sample/chatserver/ChatTest.java and sample/mergesort/MergeSortTest.java Reviewed-by: psandoz --- jdk/test/ProblemList.txt | 3 - jdk/test/TEST.groups | 4 +- jdk/test/sample/TEST.properties | 1 - jdk/test/sample/chatserver/ChatTest.java | 402 ------------------- jdk/test/sample/mergesort/MergeSortTest.java | 105 ----- 5 files changed, 1 insertion(+), 514 deletions(-) delete mode 100644 jdk/test/sample/TEST.properties delete mode 100644 jdk/test/sample/chatserver/ChatTest.java delete mode 100644 jdk/test/sample/mergesort/MergeSortTest.java diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 997cec649cb..16987c27a57 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -301,7 +301,4 @@ javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java 8169737 linux org/omg/CORBA/OrbPropertiesTest.java 8175177 generic-all -sample/mergesort/MergeSortTest.java 8178912 generic-all -sample/chatserver/ChatTest.java 8178912 generic-all - ############################################################################ diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups index 2acbc72a821..07f876ce3db 100644 --- a/jdk/test/TEST.groups +++ b/jdk/test/TEST.groups @@ -272,8 +272,7 @@ jdk_other = \ com/sun/jndi \ com/sun/corba \ org/omg/CORBA \ - lib/testlibrary \ - sample + lib/testlibrary # # SCTP is its own group as it is highly sensitive to kernel/network config @@ -774,7 +773,6 @@ compact1_minimal = \ javax \ jdk \ lib \ - sample \ sun \ vm \ -:needs_full_vm_compact1 \ diff --git a/jdk/test/sample/TEST.properties b/jdk/test/sample/TEST.properties deleted file mode 100644 index 8e5f78afde3..00000000000 --- a/jdk/test/sample/TEST.properties +++ /dev/null @@ -1 +0,0 @@ -external.lib.roots = ../../ diff --git a/jdk/test/sample/chatserver/ChatTest.java b/jdk/test/sample/chatserver/ChatTest.java deleted file mode 100644 index dcfe4d3dd6c..00000000000 --- a/jdk/test/sample/chatserver/ChatTest.java +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Copyright (c) 2011 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 - * @summary Test chat server chatserver test - * - * @library /src/sample/share/nio/chatserver - * @build ChatTest ChatServer Client ClientReader DataReader MessageReader NameReader - * @run testng ChatTest - */ - -import java.io.*; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CyclicBarrier; - -import org.testng.annotations.Test; - -public class ChatTest { - public static int listeningPort = 0; - - @Test - public static void doTest() throws Throwable { - testStartStop(); - testPortOpen(); - testAsksForName(); - testUseName(); - testConnectDisconnectConnect(); - testUsernameAndMessage(); - testDontReceiveMessageInNameState(); - } - - private static ChatServer startServer() throws IOException { - ChatServer server = new ChatServer(0); - InetSocketAddress address = (InetSocketAddress) server.getSocketAddress(); - listeningPort = address.getPort(); - server.run(); - return server; - } - - public static void testStartStop() throws Exception { - ChatServer server = startServer(); - server.shutdown(); - } - - public static void testPortOpen() throws Exception { - ChatServer server = startServer(); - try { - Socket socket = new Socket("localhost", listeningPort); - if (!socket.isConnected()) { - throw new RuntimeException("Failed to connect to server: port not open"); - } - } finally { - server.shutdown(); - } - } - - public static void testAsksForName() throws Exception { - ChatServer server = startServer(); - try { - Socket socket = new Socket("localhost", listeningPort); - - Reader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); - String string = readAvailableString(reader); - if (!string.equals("Name: ")) { - throw new RuntimeException("Server doesn't send Name: "); - } - } finally { - server.shutdown(); - } - } - - public static void testUseName() throws Throwable { - ChatServer server = startServer(); - try { - performTestUseName(); - } finally { - server.shutdown(); - } - } - - public static void testConnectDisconnectConnect() throws Exception { - ChatServer server = startServer(); - try { - performTestConnectDisconnectConnect(); - } finally { - server.shutdown(); - } - } - - public static void testUsernameAndMessage() throws Exception { - ChatServer server = startServer(); - try { - performTestUsernameAndMessage(); - } finally { - server.shutdown(); - } - } - - public static void testDontReceiveMessageInNameState() throws Exception { - ChatServer server = startServer(); - try { - performDontReceiveMessageInNameState(); - } finally { - server.shutdown(); - } - } - - private static void assertEqual(List exception, Object value, Object expected) { - if (expected == value) { - return; - } - if (expected == null) { - exception.add(new RuntimeException("Expected null, but was: " + value)); - return; - } - if (!expected.equals(value)) { - exception.add(new RuntimeException("Expected: " + expected + " but was: " + value)); - return; - } - } - - private static void performDontReceiveMessageInNameState() throws Exception { - final CyclicBarrier barrier1 = new CyclicBarrier(2); - final CyclicBarrier barrier2 = new CyclicBarrier(2); - final CyclicBarrier barrier3 = new CyclicBarrier(2); - final List exceptions = Collections.synchronizedList(new ArrayList()); - - ChatConnection chatConnection = new ChatConnection() { - @Override - public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { - String string = readAvailableString(reader); - assertEqual(exceptions, string, "Name: "); - writer.write("testClient1\n"); - waitForJoin(reader, "testClient1"); - barrier1.await(); - writer.write("Ignore this!\n"); - barrier2.await(); - barrier3.await(); - } - }; - - Thread client2 = new Thread(new ChatConnection() { - @Override - public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { - barrier1.await(); - barrier2.await(); - String string = readAvailableString(reader); - assertEqual(exceptions, string, "Name: "); - string = readAvailableString(reader, true); - assertEqual(exceptions, string, null); - writer.write("testClient2\n"); - barrier3.await(); - } - }); - - client2.start(); - chatConnection.run(); - if (!exceptions.isEmpty()) { - throw exceptions.get(0); - } - - } - - private static void waitForJoin(BufferedReader reader, String s) throws IOException { - String joined; - do { - joined = readAvailableString(reader); - } while (!(joined != null && joined.contains("Welcome " + s))); - } - - private static void performTestUsernameAndMessage() throws Exception { - final CyclicBarrier barrier1 = new CyclicBarrier(2); - final CyclicBarrier barrier2 = new CyclicBarrier(2); - final CyclicBarrier barrier3 = new CyclicBarrier(2); - final List exceptions = Collections.synchronizedList(new ArrayList()); - - ChatConnection chatConnection = new ChatConnection() { - @Override - public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { - String string = readAvailableString(reader); - assertEqual(exceptions, string, "Name: "); - writer.write("testClient1\n"); - waitForJoin(reader, "testClient1"); - barrier1.await(); - barrier2.await(); - string = readAvailableString(reader); - assertEqual(exceptions, string, "testClient2: Hello world!\n"); - barrier3.await(); - } - }; - - Thread client2 = new Thread(new ChatConnection() { - @Override - public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { - String string = readAvailableString(reader); - assertEqual(exceptions, string, "Name: "); - barrier1.await(); - writer.write("testClient2\nHello world!\n"); - barrier2.await(); - barrier3.await(); - } - }); - - client2.start(); - chatConnection.run(); - if (!exceptions.isEmpty()) { - throw exceptions.get(0); - } - } - - private static void performTestConnectDisconnectConnect() throws Exception { - final CyclicBarrier barrier1 = new CyclicBarrier(2); - final CyclicBarrier barrier2 = new CyclicBarrier(2); - final CyclicBarrier barrier3 = new CyclicBarrier(2); - final List exceptions = new ArrayList(); - - ChatConnection chatConnection = new ChatConnection() { - @Override - public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { - String string = readAvailableString(reader); - assertEqual(exceptions, string, "Name: "); - writer.write("testClient1\n"); - } - }; - - ChatConnection chatConnection2 = new ChatConnection() { - @Override - public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { - readAvailableString(reader); - writer.write("testClient1\n"); - waitForJoin(reader, "testClient1"); - barrier1.await(); - writer.write("Good morning!\n"); - barrier2.await(); - String string = readAvailableString(reader); - assertEqual(exceptions, string, "testClient2: Hello world!\n"); - barrier3.await(); - } - }; - - Thread client2 = new Thread(new ChatConnection() { - @Override - public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { - readAvailableString(reader); - writer.write("testClient2\n"); - waitForJoin(reader, "testClient2"); - barrier1.await(); - writer.write("Hello world!\n"); - barrier2.await(); - String string = readAvailableString(reader); - assertEqual(exceptions, string, "testClient1: Good morning!\n"); - barrier3.await(); - } - }); - - client2.start(); - chatConnection.run(); - chatConnection2.run(); - if (!exceptions.isEmpty()) { - throw exceptions.get(0); - } - } - - private static void performTestUseName() throws Exception { - final CyclicBarrier barrier1 = new CyclicBarrier(2); - final CyclicBarrier barrier2 = new CyclicBarrier(2); - final CyclicBarrier barrier3 = new CyclicBarrier(2); - final List exceptions = new ArrayList(); - - ChatConnection chatConnection = new ChatConnection() { - @Override - public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { - String string = readAvailableString(reader); - if (!"Name: ".equals(string)) { - exceptions.add(new RuntimeException("Expected Name: ")); - } - writer.write("testClient1\n"); - waitForJoin(reader, "testClient1"); - barrier1.await(); - barrier2.await(); - string = readAvailableString(reader); - if (!"testClient2: Hello world!\n".equals(string)) { - exceptions.add(new RuntimeException("testClient2: Hello world!\n")); - } - barrier3.await(); - } - }; - - Thread client2 = new Thread(new ChatConnection() { - @Override - public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception { - String string = readAvailableString(reader); - if (!"Name: ".equals(string)) { - exceptions.add(new RuntimeException("Expected Name: ")); - } - writer.write("testClient2\n"); - waitForJoin(reader, "testClient2"); - barrier1.await(); - writer.write("Hello world!\n"); - barrier2.await(); - barrier3.await(); - } - }); - - client2.start(); - chatConnection.run(); - if (!exceptions.isEmpty()) { - throw exceptions.get(0); - } - } - - private static String readAvailableString(Reader reader) throws IOException { - return readAvailableString(reader, false); - } - - private static String readAvailableString(Reader reader, boolean now) throws IOException { - StringBuilder builder = new StringBuilder(); - int bytes; - if (now && !reader.ready()) { - return null; - } - do { - char[] buf = new char[256]; - bytes = reader.read(buf); - builder.append(buf, 0, bytes); - } while (bytes == 256); - return builder.toString(); - } - - private abstract static class ChatConnection implements Runnable { - public Exception exception; - - @Override - public void run() { - try (Socket socket = new Socket("localhost", listeningPort); - BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); - Writer writer = new FlushingWriter(new OutputStreamWriter(socket.getOutputStream()))) { - socket.setTcpNoDelay(true); - - run(socket, reader, writer); - } catch (Exception e) { - exception = e; - } - } - - public abstract void run(Socket socket, BufferedReader reader, Writer writer) throws Exception; - } - - private static class FlushingWriter extends Writer { - public final Writer delegate; - - private FlushingWriter(Writer delegate) { - this.delegate = delegate; - } - - @Override - public void write(char[] cbuf, int off, int len) throws IOException { - delegate.write(cbuf, off, len); - } - - @Override - public void flush() throws IOException { - delegate.flush(); - } - - @Override - public void close() throws IOException { - delegate.close(); - } - - @Override - public void write(String str) throws IOException { - super.write(str); - flush(); - } - } -} diff --git a/jdk/test/sample/mergesort/MergeSortTest.java b/jdk/test/sample/mergesort/MergeSortTest.java deleted file mode 100644 index fb082c21a56..00000000000 --- a/jdk/test/sample/mergesort/MergeSortTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2011 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 - * @summary Test MergeSort - * - * @library /src/sample/share/forkjoin/mergesort - * @build MergeSortTest MergeDemo MergeSort - * @run testng MergeSortTest - */ - -import java.util.Arrays; -import java.util.Random; - -import org.testng.annotations.Test; - -public class MergeSortTest { - private Random random; - private MergeSort target; - - public MergeSortTest(Random random, MergeSort target) { - this.random = random; - this.target = target; - } - - @Test - public static void doTest() { - MergeSortTest test = new MergeSortTest(new Random(), new MergeSort(Runtime.getRuntime().availableProcessors() * 4)); - test.run(); - } - - private int[] generateArray(int elements) { - int[] array = new int[elements]; - for (int i = 0; i < array.length; ++i) { - array[i] = random.nextInt(10); - } - return array; - } - - private void run() { - testSort(); - testSortSingle(); - testSortEmpty(); - testLong(); - } - - public void testLong() { - for (int i = 0; i < 1000; ++i) { - int elements = 1 + i * 100; - - int[] array = generateArray(elements); - int[] copy = Arrays.copyOf(array, array.length); - Arrays.sort(copy); - target.sort(array); - assertEqual(copy, array); - } - } - - private void testSortEmpty() { - int[] array = { }; - target.sort(array); - assertEqual(new int[] { }, array); - } - - private void testSortSingle() { - int[] array = { 1 }; - target.sort(array); - assertEqual(new int[] { 1 }, array); - } - - private void testSort() { - int[] array = { 7, 3, 9, 0, -6, 12, 54, 3, -6, 88, 1412}; - target.sort(array); - assertEqual(new int[] { -6, -6, 0, 3, 3, 7, 9, 12, 54, 88, 1412 }, array); - } - - private void assertEqual(int[] expected, int[] array) { - if (!Arrays.equals(expected, array)) { - throw new RuntimeException("Invalid sorted array!"); - } - } - - -} From 105585bf9b213f0fceec10ec26e92a61d5a627d6 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 8 May 2017 08:46:00 +0200 Subject: [PATCH 29/55] 8179658: SetupProcessMarkdown creates long file names Reviewed-by: tbell, erikj --- make/Javadoc.gmk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index f98cdabca89..61ebaf7efd3 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -390,14 +390,14 @@ ifeq ($(ENABLE_FULL_DOCS), true) $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ $(foreach d, $(SPECS_$m), \ $(if $(filter %.md, $(call CacheFind, $d)), \ - $(eval $(call SetupProcessMarkdown, CONVERT_MARKDOWN_$m_$d, \ + $(eval $(call SetupProcessMarkdown, CONVERT_MARKDOWN_$m_$(patsubst $(TOPDIR)/%,%,$d), \ SRC := $d, \ FILES := $(filter %.md, $(call CacheFind, $d)), \ DEST := $(JAVADOC_OUTPUTDIR)/specs/, \ CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \ )) \ ) \ - $(eval JDK_SPECS_TARGETS += $(CONVERT_MARKDOWN_$m_$d)) \ + $(eval JDK_SPECS_TARGETS += $(CONVERT_MARKDOWN_$m_$(patsubst $(TOPDIR)/%,%,$d))) \ ) \ ) endif From e9766a8480c38a696725d6362257c8e9e070c715 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 8 May 2017 14:02:22 +0200 Subject: [PATCH 30/55] 8140268: Generate link to specification license for JavaDoc API documentation Reviewed-by: erikj --- make/Javadoc.gmk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index 61ebaf7efd3..4d088b86a65 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -55,6 +55,9 @@ DOCROOTPARENT_FLAG ?= TRUE JAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=homepage BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/ COPYRIGHT_URL := {@docroot}/../legal/cpyr.html +LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html +REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html + # In order to get a specific ordering it's necessary to specify the total # ordering of tags as the tags are otherwise ordered in order of definition. @@ -135,7 +138,10 @@ JAVADOC_BOTTOM := \ the US and other countries.
        \ Copyright \ © 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME). \ - $(COMPANY_ADDRESS). All rights reserved.$(DRAFT_MARKER_STR) + $(COMPANY_ADDRESS). All rights reserved. \ + Use is subject to license terms. Also see the \ + documentation redistribution policy. \ + $(DRAFT_MARKER_STR) JAVADOC_TOP := \

        lookupClass) { this(lookupClass, FULL_POWER_MODES); // make sure we haven't accidentally picked up a privileged class: - checkUnprivilegedlookupClass(lookupClass, FULL_POWER_MODES); + checkUnprivilegedlookupClass(lookupClass); } private Lookup(Class lookupClass, int allowedModes) { @@ -827,7 +840,7 @@ public class MethodHandles { newModes = 0; } - checkUnprivilegedlookupClass(requestedLookupClass, newModes); + checkUnprivilegedlookupClass(requestedLookupClass); return new Lookup(requestedLookupClass, newModes); } @@ -979,25 +992,10 @@ public class MethodHandles { */ static final Lookup PUBLIC_LOOKUP = new Lookup(Object.class, (PUBLIC|UNCONDITIONAL)); - private static void checkUnprivilegedlookupClass(Class lookupClass, int allowedModes) { + private static void checkUnprivilegedlookupClass(Class lookupClass) { String name = lookupClass.getName(); if (name.startsWith("java.lang.invoke.")) throw newIllegalArgumentException("illegal lookupClass: "+lookupClass); - - // For caller-sensitive MethodHandles.lookup() disallow lookup from - // restricted packages. This a fragile and blunt approach. - // TODO replace with a more formal and less fragile mechanism - // that does not bluntly restrict classes under packages within - // java.base from looking up MethodHandles or VarHandles. - if (allowedModes == FULL_POWER_MODES && lookupClass.getClassLoader() == null) { - if ((name.startsWith("java.") && - !name.equals("java.lang.Thread") && - !name.startsWith("java.util.concurrent.")) || - (name.startsWith("sun.") && - !name.startsWith("sun.invoke."))) { - throw newIllegalArgumentException("illegal lookupClass: " + lookupClass); - } - } } /** diff --git a/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java index 50200fdeada..f919026b31d 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java @@ -135,6 +135,24 @@ public class ReflectionFactory { return soleInstance; } + /** + * Returns an alternate reflective Method instance for the given method + * intended for reflection to invoke, if present. + * + * A trusted method can define an alternate implementation for a method `foo` + * by defining a method named "reflected$foo" that will be invoked + * reflectively. + */ + private static Method findMethodForReflection(Method method) { + String altName = "reflected$" + method.getName(); + try { + return method.getDeclaringClass() + .getDeclaredMethod(altName, method.getParameterTypes()); + } catch (NoSuchMethodException ex) { + return null; + } + } + //-------------------------------------------------------------------------- // // Routines used by java.lang.reflect @@ -161,6 +179,13 @@ public class ReflectionFactory { public MethodAccessor newMethodAccessor(Method method) { checkInitted(); + if (Reflection.isCallerSensitive(method)) { + Method altMethod = findMethodForReflection(method); + if (altMethod != null) { + method = altMethod; + } + } + if (noInflation && !ReflectUtil.isVMAnonymousClass(method.getDeclaringClass())) { return new MethodAccessorGenerator(). generateMethod(method.getDeclaringClass(), diff --git a/jdk/test/java/lang/invoke/lookup/ReflectiveLookupTest.java b/jdk/test/java/lang/invoke/lookup/ReflectiveLookupTest.java new file mode 100644 index 00000000000..9d8eec4abd0 --- /dev/null +++ b/jdk/test/java/lang/invoke/lookup/ReflectiveLookupTest.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2017, 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. + */ + +/* + * @test + * @bug 8020801 + * @summary Restriction on reflective call to MethodHandles.lookup method + * @run main java.base/java.lang.LookupTest + * @run main ReflectiveLookupTest + * @run main/othervm -Dsun.reflect.noInflation=true ReflectiveLookupTest + */ + +import java.lang.invoke.*; +import java.lang.invoke.MethodHandles.Lookup; +import java.lang.reflect.Method; + +import static java.lang.invoke.MethodType.*; + +/* + * Lookup object can be obtained statically or reflectively. + */ +public class ReflectiveLookupTest { + public static void main(String... args) throws Throwable { + // Get a full power lookup + Lookup lookup1 = MethodHandles.lookup(); + MethodHandle mh1 = lookup1.findStatic(lookup1.lookupClass(), + "foo", + methodType(String.class)); + assertEquals((String) mh1.invokeExact(), foo()); + + Method lookupMethod = MethodHandles.class.getMethod("lookup"); + System.out.println("reflection method: " + lookupMethod); + if (!lookupMethod.getName().equals("lookup")) { + throw new RuntimeException("Unexpected name: " + lookupMethod.getName()); + } + + // Get a full power Lookup reflectively. + Lookup lookup2 = (Lookup) lookupMethod.invoke(null); + assertEquals(lookup1.lookupClass(), lookup2.lookupClass()); + assertEquals(lookup1.lookupModes(), lookup2.lookupModes()); + MethodHandle mh2 = lookup2.findStatic(lookup2.lookupClass(), + "foo", + methodType(String.class)); + assertEquals((String) mh2.invokeExact(), foo()); + } + + static String foo() { + return "foo!"; + } + + static void assertEquals(Object o1, Object o2) { + if (!o1.equals(o2)) { + throw new RuntimeException(o1 + " != " + o2); + } + } +} + diff --git a/jdk/test/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java b/jdk/test/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java new file mode 100644 index 00000000000..3e5341baff3 --- /dev/null +++ b/jdk/test/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang; + +import java.lang.invoke.*; +import java.lang.invoke.MethodHandles.Lookup; +import java.lang.reflect.InvocationTargetException; + +import static java.lang.invoke.MethodType.*; + +/* + * Verify that a Lookup object can be obtained statically from java.base + * but fails when it's obtained via reflection from java.base. + */ +public class LookupTest { + public static void main(String... args) throws Throwable { + // Get a full power lookup + Lookup lookup1 = MethodHandles.lookup(); + MethodHandle mh1 = lookup1.findStatic(lookup1.lookupClass(), + "foo", + methodType(String.class)); + assertEquals((String) mh1.invokeExact(), foo()); + + // access protected member + MethodHandle mh2 = lookup1.findVirtual(java.lang.ClassLoader.class, + "getPackage", + methodType(Package.class, String.class)); + ClassLoader loader = ClassLoader.getPlatformClassLoader(); + Package pkg = (Package)mh2.invokeExact(loader, "java.lang"); + assertEquals(pkg.getName(), "java.lang"); + + // MethodHandles.lookup will fail if it's called reflectively + try { + MethodHandles.class.getMethod("lookup").invoke(null); + } catch (InvocationTargetException e) { + if (!(e.getCause() instanceof IllegalArgumentException)) { + throw e.getCause(); + } + } + } + + static String foo() { return "foo!"; } + + static void assertEquals(Object o1, Object o2) { + if (!o1.equals(o2)) { + throw new RuntimeException(o1 + " != " + o2); + } + } +} From 7c75811e593ab595555c87fec1624782c05f5696 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 9 May 2017 12:53:37 +0200 Subject: [PATCH 32/55] 8179889: Fix typographic errors in copyright headers Reviewed-by: erikj, dholmes --- hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp | 6 ++---- .../sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java | 2 +- .../test/gc/class_unloading/TestClassUnloadingDisabled.java | 2 +- hotspot/test/native/logging/test_logTagSetDescriptions.cpp | 2 +- hotspot/test/native/memory/test_metachunk.cpp | 2 +- hotspot/test/runtime/CommandLine/PermGenFlagsTest.java | 2 +- hotspot/test/runtime/logging/ThreadLoggingTest.java | 2 +- hotspot/test/runtime/logging/p2/B.jcod | 2 +- hotspot/test/testlibrary/ctw/Makefile | 2 +- 9 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp index ceaec5d53ec..57bc7b2d340 100644 --- a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp @@ -1,8 +1,7 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. - * reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE - * HEADER. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as @@ -21,7 +20,6 @@ * 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 diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java index ca06fc413e2..abe5e0c6730 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64RegisterMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 20014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/test/gc/class_unloading/TestClassUnloadingDisabled.java b/hotspot/test/gc/class_unloading/TestClassUnloadingDisabled.java index 96f10bbcd60..6d1c2d602cb 100644 --- a/hotspot/test/gc/class_unloading/TestClassUnloadingDisabled.java +++ b/hotspot/test/gc/class_unloading/TestClassUnloadingDisabled.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reqserved. + * Copyright (c) 2016, 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 diff --git a/hotspot/test/native/logging/test_logTagSetDescriptions.cpp b/hotspot/test/native/logging/test_logTagSetDescriptions.cpp index 77c0a3191dc..b0e9364c525 100644 --- a/hotspot/test/native/logging/test_logTagSetDescriptions.cpp +++ b/hotspot/test/native/logging/test_logTagSetDescriptions.cpp @@ -10,7 +10,7 @@ * 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 - * ac_heapanied this code). + * 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, diff --git a/hotspot/test/native/memory/test_metachunk.cpp b/hotspot/test/native/memory/test_metachunk.cpp index e99bf42a121..9a4c6dae3a1 100644 --- a/hotspot/test/native/memory/test_metachunk.cpp +++ b/hotspot/test/native/memory/test_metachunk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 diff --git a/hotspot/test/runtime/CommandLine/PermGenFlagsTest.java b/hotspot/test/runtime/CommandLine/PermGenFlagsTest.java index 9a821e0059e..3ce993f57d4 100644 --- a/hotspot/test/runtime/CommandLine/PermGenFlagsTest.java +++ b/hotspot/test/runtime/CommandLine/PermGenFlagsTest.java @@ -8,7 +8,7 @@ * * 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 + * 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). * diff --git a/hotspot/test/runtime/logging/ThreadLoggingTest.java b/hotspot/test/runtime/logging/ThreadLoggingTest.java index 1f06e0594d9..80b8cc6e3d8 100644 --- a/hotspot/test/runtime/logging/ThreadLoggingTest.java +++ b/hotspot/test/runtime/logging/ThreadLoggingTest.java @@ -9,7 +9,7 @@ * * 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 + * 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). * diff --git a/hotspot/test/runtime/logging/p2/B.jcod b/hotspot/test/runtime/logging/p2/B.jcod index 724c180aa16..b30d1e32876 100644 --- a/hotspot/test/runtime/logging/p2/B.jcod +++ b/hotspot/test/runtime/logging/p2/B.jcod @@ -8,7 +8,7 @@ * * 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 + * 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). * diff --git a/hotspot/test/testlibrary/ctw/Makefile b/hotspot/test/testlibrary/ctw/Makefile index db7204b1f12..3b521188daf 100644 --- a/hotspot/test/testlibrary/ctw/Makefile +++ b/hotspot/test/testlibrary/ctw/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2016. Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2016, 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 97df63049cf4266cd508cd4ff186e60b3ce66c4f Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 9 May 2017 12:57:30 +0200 Subject: [PATCH 33/55] 8179889: Fix typographic errors in copyright headers Reviewed-by: erikj, dholmes --- .../native/libnet/DefaultProxySelector.c | 2 +- .../classes/com/sun/crypto/provider/GCTR.java | 2 +- .../security/util/ConstraintsParameters.java | 2 +- .../share/native/libjimage/endian.hpp | 2 +- .../native/libjimage/imageDecompressor.cpp | 2 +- .../native/libjimage/imageDecompressor.hpp | 2 +- .../share/native/libjimage/imageFile.hpp | 2 +- .../share/native/libjimage/inttypes.hpp | 3 +- .../share/native/libjimage/jimage.hpp | 3 +- .../share/native/libjimage/osSupport.hpp | 2 +- .../classes/sun/swing/LightweightContent.java | 2 +- .../incubator/http/WindowUpdateSender.java | 1 + .../ScreenMenu/ScreenMenuMemoryLeakTest.java | 4 +- .../Cipher/AES/TestCICOWithGCMAndAAD.java | 2 +- jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh | 4 +- jdk/test/com/sun/jdi/BreakpointWithFullGC.sh | 2 +- jdk/test/com/sun/jdi/CatchAllTest.sh | 4 +- jdk/test/com/sun/jdi/CatchCaughtTest.sh | 4 +- jdk/test/com/sun/jdi/CatchPatternTest.sh | 4 +- .../com/sun/jdi/CommandCommentDelimiter.sh | 4 +- jdk/test/com/sun/jdi/DeferredStepTest.sh | 12 ++--- jdk/test/com/sun/jdi/DeoptimizeWalk.sh | 4 +- jdk/test/com/sun/jdi/EvalArgs.sh | 48 +++++++++---------- .../com/sun/jdi/GetLocalVariables3Test.sh | 4 +- .../com/sun/jdi/GetLocalVariables4Test.sh | 4 +- jdk/test/com/sun/jdi/JdbExprTest.sh | 12 ++--- jdk/test/com/sun/jdi/JdbLockTest.sh | 4 +- jdk/test/com/sun/jdi/MixedSuspendTest.sh | 2 +- jdk/test/com/sun/jdi/NullLocalVariable.sh | 8 ++-- .../com/sun/jdi/NullThreadGroupNameTest.java | 2 +- .../com/sun/jdi/RedefineChangeClassOrder.sh | 4 +- jdk/test/com/sun/jdi/RedefineException.sh | 6 +-- jdk/test/com/sun/jdi/RedefineImplementor.sh | 4 +- .../com/sun/jdi/RedefineIntConstantToLong.sh | 8 ++-- .../GarbageCollectorMXBean/LastGCInfo.java | 2 +- .../net/httpserver/SimpleHttpServerTest.java | 2 +- .../sun/net/httpserver/StopNoStartTest.java | 2 +- .../com/sun/net/httpserver/bugs/B6433018.java | 3 +- .../com/sun/tools/attach/PermissionTest.java | 2 +- .../com/sun/tools/attach/ProviderTest.java | 2 +- .../tools/attach/StartManagementAgent.java | 2 +- .../com/sun/tools/attach/TempDirTest.java | 2 +- .../UnfocusableToplevel.java | 2 +- .../HTMLTransferTest/HTMLTransferTest.html | 2 +- .../HTMLTransferTest/HTMLTransferTest.java | 2 +- .../Modal/NestedModalDialogTest.java | 2 +- .../Modeless/NestedModelessDialogTest.java | 2 +- .../MainAppContext/MainAppContext.java | 2 +- .../RegexpFilterTest/RegexpFilterTest.html | 4 +- .../WindowIsFocusableAccessByThreadsTest.java | 2 +- .../ShowChildWhileResizingTest.java | 3 +- .../AltTabCrashTest/AltTabCrashTest.java | 2 +- .../LightweightEventTest.java | 2 +- .../GlassPaneOverlappingTestBase.java | 2 +- .../AWT_Mixing/SimpleOverlappingTestBase.java | 3 +- .../MaximizedFrameTest.java | 2 +- .../JContainerMousePositionTest.java | 2 +- .../EventQueuePushAutoshutdown.sh | 27 +++++------ .../ToolkitPropertyTest/bug7129133.java | 2 +- .../awt/Window/FindOwner/FindOwnerTest.java | 4 +- .../DisposeFrameOnDragTest.java | 2 +- .../DisabledComponentsTest.java | 2 +- .../font/TextLayout/ArabicDiacriticTest.java | 1 + .../MissingCodePointLayoutTest.java | 1 + .../io/RandomAccessFile/FileLengthTest.java | 2 +- .../java/lang/instrument/RedefineBigClass.sh | 4 +- .../X-VarHandleTestMethodType.java.template | 3 +- .../java/net/httpclient/ProxyAuthTest.java | 1 + .../file/WatchService/DeleteInterference.java | 4 ++ .../UnixSocketFile.java | 2 +- .../LimitedDoPrivilegedWithNullPerms.java | 2 +- .../LimitedDoPrivilegedWithThread.java | 2 +- .../java/time/temporal/TestIsoWeekFields.java | 2 +- .../resources/PropertyBundle.properties | 3 +- .../SpliteratorLateBindingFailFastHelper.java | 2 +- .../logrb/resources/PropertyBundle.properties | 3 +- .../resources/PropertyBundle.properties | 3 +- .../LibraryLoader/LibraryLoaderTest.java | 2 +- .../management/monitor/ThreadPoolAccTest.java | 2 +- .../javax/net/ssl/TLS/CipherTestUtils.java | 25 +++++----- jdk/test/javax/net/ssl/TLS/JSSEClient.java | 25 +++++----- jdk/test/javax/net/ssl/TLS/JSSEServer.java | 25 +++++----- jdk/test/javax/net/ssl/TLS/TestJSSE.java | 25 +++++----- .../TLS/TestJSSEClientDefaultProtocol.java | 25 +++++----- .../net/ssl/TLS/TestJSSEClientProtocol.java | 25 +++++----- .../ssl/TLS/TestJSSENoCommonProtocols.java | 25 +++++----- .../net/ssl/TLS/TestJSSEServerProtocol.java | 25 +++++----- .../attribute/TestUnsupportedResolution.java | 3 +- .../javax/security/auth/Subject/Generic.java | 2 +- .../JAASConfigSyntaxTest.java | 28 +++++------ .../SampleLoginModule.java | 27 ++++++----- .../swing/JComboBox/6632953/bug6632953.java | 2 +- .../JFileChooser/4150029/bug4150029.html | 4 +- .../swing/JInternalFrame/Test6325652.java | 2 +- .../8072900/WrongSelectionOnMouseOver.java | 2 +- .../swing/JPopupMenu/6694823/bug6694823.java | 2 +- .../SynthButtonUI/6276188/bug6276188.java | 2 +- .../parser/Parser/8028616/bug8028616.java | 2 +- jdk/test/sun/awt/dnd/8024061/bug8024061.java | 2 +- jdk/test/sun/net/idn/NFS4StringPrep.java | 2 +- jdk/test/sun/security/krb5/auto/BogusKDC.java | 2 +- .../sun/security/krb5/auto/NoAddresses.java | 2 +- jdk/test/sun/security/krb5/auto/Renew.java | 2 +- jdk/test/sun/security/krb5/auto/Renewal.java | 2 +- .../sun/security/krb5/auto/SSLwithPerms.java | 2 +- .../sun/security/krb5/canonicalize/Test.java | 2 +- jdk/test/sun/security/mscapi/CastError.java | 2 +- jdk/test/sun/security/mscapi/PrngSlow.java | 2 +- .../sun/security/mscapi/PublicKeyInterop.sh | 2 +- .../security/pkcs12/StoreSecretKeyTest.java | 2 +- .../SeedGenerator/SeedGeneratorChoice.java | 3 +- .../sun/security/tools/jarsigner/nameclash.sh | 3 +- .../x509/URICertStore/SocksProxy.java | 2 +- jdk/test/tools/pack200/MultiRelease.java | 2 +- 114 files changed, 308 insertions(+), 304 deletions(-) diff --git a/jdk/src/java.base/macosx/native/libnet/DefaultProxySelector.c b/jdk/src/java.base/macosx/native/libnet/DefaultProxySelector.c index ab6f465da40..aa91f3012b2 100644 --- a/jdk/src/java.base/macosx/native/libnet/DefaultProxySelector.c +++ b/jdk/src/java.base/macosx/native/libnet/DefaultProxySelector.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java index 6a394e448d1..ffa681c6a2b 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, 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 diff --git a/jdk/src/java.base/share/classes/sun/security/util/ConstraintsParameters.java b/jdk/src/java.base/share/classes/sun/security/util/ConstraintsParameters.java index 84318654557..83e6d32ff8a 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/ConstraintsParameters.java +++ b/jdk/src/java.base/share/classes/sun/security/util/ConstraintsParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 diff --git a/jdk/src/java.base/share/native/libjimage/endian.hpp b/jdk/src/java.base/share/native/libjimage/endian.hpp index 81eca199191..b14c39ec0f3 100644 --- a/jdk/src/java.base/share/native/libjimage/endian.hpp +++ b/jdk/src/java.base/share/native/libjimage/endian.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp b/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp index e2dbb79ce6f..96a175c57e7 100644 --- a/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp +++ b/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp b/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp index c5a758abbcb..ed98b32e8cb 100644 --- a/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp +++ b/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/jdk/src/java.base/share/native/libjimage/imageFile.hpp b/jdk/src/java.base/share/native/libjimage/imageFile.hpp index 9e02d87460c..c32d2fed8c8 100644 --- a/jdk/src/java.base/share/native/libjimage/imageFile.hpp +++ b/jdk/src/java.base/share/native/libjimage/imageFile.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/jdk/src/java.base/share/native/libjimage/inttypes.hpp b/jdk/src/java.base/share/native/libjimage/inttypes.hpp index d66b05418f1..c5947265245 100644 --- a/jdk/src/java.base/share/native/libjimage/inttypes.hpp +++ b/jdk/src/java.base/share/native/libjimage/inttypes.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -47,4 +47,3 @@ typedef long long s8; #endif #endif // LIBJIMAGE_INTTYPES_HPP - diff --git a/jdk/src/java.base/share/native/libjimage/jimage.hpp b/jdk/src/java.base/share/native/libjimage/jimage.hpp index 8521307bbf8..305c6e2b387 100644 --- a/jdk/src/java.base/share/native/libjimage/jimage.hpp +++ b/jdk/src/java.base/share/native/libjimage/jimage.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -202,4 +202,3 @@ extern "C" bool JIMAGE_ResourcePath(JImageFile* image, JImageLocationRef locatio typedef bool (*JImage_ResourcePath_t)(JImageFile* jimage, JImageLocationRef location, char* buffer, jlong size); - diff --git a/jdk/src/java.base/share/native/libjimage/osSupport.hpp b/jdk/src/java.base/share/native/libjimage/osSupport.hpp index 8fa15e3c0a7..aeb6c6a79d7 100644 --- a/jdk/src/java.base/share/native/libjimage/osSupport.hpp +++ b/jdk/src/java.base/share/native/libjimage/osSupport.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/jdk/src/java.desktop/share/classes/sun/swing/LightweightContent.java b/jdk/src/java.desktop/share/classes/sun/swing/LightweightContent.java index a18d056aa2f..169332a44d1 100644 --- a/jdk/src/java.desktop/share/classes/sun/swing/LightweightContent.java +++ b/jdk/src/java.desktop/share/classes/sun/swing/LightweightContent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WindowUpdateSender.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WindowUpdateSender.java index 1e279c3f701..ecc83de8ca0 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WindowUpdateSender.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WindowUpdateSender.java @@ -20,6 +20,7 @@ * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any + * questions. */ package jdk.incubator.http; diff --git a/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java b/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java index 8aabcae42c7..26071d4bb7b 100644 --- a/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java +++ b/jdk/test/com/apple/laf/ScreenMenu/ScreenMenuMemoryLeakTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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,4 +102,4 @@ public class ScreenMenuMemoryLeakTest { Objects.requireNonNull(menuItem, "The menu item should still be available at this point"); sMenu.remove(menuItem); } -} \ No newline at end of file +} diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java index edc43d61ae3..80732762297 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java @@ -17,7 +17,7 @@ * 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 + * or visit www.oracle.com if you need additional information or have any * questions. */ diff --git a/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh b/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh index 8d8df5cfc0e..2b98636a4f2 100644 --- a/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh +++ b/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -98,7 +98,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh index 81baff826e4..b6e2210500d 100644 --- a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh +++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 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 diff --git a/jdk/test/com/sun/jdi/CatchAllTest.sh b/jdk/test/com/sun/jdi/CatchAllTest.sh index 52d1864384b..fb0ab6aa3e6 100644 --- a/jdk/test/com/sun/jdi/CatchAllTest.sh +++ b/jdk/test/com/sun/jdi/CatchAllTest.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -76,7 +76,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/CatchCaughtTest.sh b/jdk/test/com/sun/jdi/CatchCaughtTest.sh index 47a0d356e36..0322b5ebf87 100644 --- a/jdk/test/com/sun/jdi/CatchCaughtTest.sh +++ b/jdk/test/com/sun/jdi/CatchCaughtTest.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -67,7 +67,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/CatchPatternTest.sh b/jdk/test/com/sun/jdi/CatchPatternTest.sh index 0a45b388a4d..b4a45d626f9 100644 --- a/jdk/test/com/sun/jdi/CatchPatternTest.sh +++ b/jdk/test/com/sun/jdi/CatchPatternTest.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -108,7 +108,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh b/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh index c5beb904d30..a3da8253c11 100644 --- a/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh +++ b/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2004, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -70,7 +70,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/DeferredStepTest.sh b/jdk/test/com/sun/jdi/DeferredStepTest.sh index 528404fefc7..82e97ff19b9 100644 --- a/jdk/test/com/sun/jdi/DeferredStepTest.sh +++ b/jdk/test/com/sun/jdi/DeferredStepTest.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ public class $classname { static class jj1 implements Runnable { public void run() { int count = 0; - + for ( int ii = 0; ii < 10; ii++) { // line 6 int intInPotato04 = 666; // line 7 ++count; // line 8; @1 breakpoint @@ -65,7 +65,7 @@ public class $classname { static class jj2 implements Runnable { public void run() { int count2 = 0; - + for (int ii = 0; ii < 10; ii++) { // line 18 String StringInPotato05 = "I am"; // line 19 ++count2; // line 20; @1 breakpoint @@ -139,7 +139,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done @@ -157,7 +157,7 @@ This test should be run and checked manually. If this works right, you should see StepEvents/Breakpoint events for lines 8, 9, 6, 7, 8, 9, 6, .... for thread jj11 and - 20, 21, 18, 19, 20, 21, 18, ... for thread jj2 + 20, 21, 18, 19, 20, 21, 18, ... for thread jj2 Since both threads are running at the same time, these events can be intermixed. @@ -179,5 +179,5 @@ Kill the test and rerun it if this happens. EOF runit -#jdbFailIfPresent "Nothing suspended" +#jdbFailIfPresent "Nothing suspended" #pass diff --git a/jdk/test/com/sun/jdi/DeoptimizeWalk.sh b/jdk/test/com/sun/jdi/DeoptimizeWalk.sh index e8fc44c4281..06eadb4e833 100644 --- a/jdk/test/com/sun/jdi/DeoptimizeWalk.sh +++ b/jdk/test/com/sun/jdi/DeoptimizeWalk.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -96,7 +96,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/EvalArgs.sh b/jdk/test/com/sun/jdi/EvalArgs.sh index aa3e75fdb74..b1c2f65df1b 100644 --- a/jdk/test/com/sun/jdi/EvalArgs.sh +++ b/jdk/test/com/sun/jdi/EvalArgs.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ # @test # @bug 4663146 -# @summary Arguments match no method error +# @summary Arguments match no method error # @author Jim Holmlund/Suvasis # # @run shell/timeout=300 EvalArgs.sh @@ -72,13 +72,13 @@ public class $classname { System.out.println( ffjj1(myjj1)); System.out.println( ffjj1(myjj2)); - System.out.println("$classname.ffoverload($classname.jjboolean) = " + + System.out.println("$classname.ffoverload($classname.jjboolean) = " + $classname.ffoverload($classname.jjboolean)); - System.out.println("$classname.ffoverload($classname.jjbyte) = " + + System.out.println("$classname.ffoverload($classname.jjbyte) = " + $classname.ffoverload($classname.jjbyte)); - System.out.println("$classname.ffoverload($classname.jjchar) = " + + System.out.println("$classname.ffoverload($classname.jjchar) = " + $classname.ffoverload($classname.jjchar)); - System.out.println("$classname.ffoverload($classname.jjdouble) = " + + System.out.println("$classname.ffoverload($classname.jjdouble) = " + $classname.ffoverload($classname.jjdouble)); @@ -94,11 +94,11 @@ public class $classname { public static String ffjj1(jj1 arg) { return arg.me; } - + public static String ffjj2(jj2 arg) { return arg.me; } - + static String ffboolean(boolean p1) { return "ffbool: p1 = " + p1; } @@ -106,31 +106,31 @@ public class $classname { static String ffbyte(byte p1) { return "ffbyte: p1 = " + p1; } - + static String ffchar(char p1) { return "ffchar: p1 = " + p1; } - + static String ffdouble(double p1) { return "ffdouble: p1 = " + p1; } - + static String fffloat(float p1) { return "fffloat: p1 = " + p1; } - + static String ffint(int p1) { return "ffint: p1 = " + p1; } - + static String fflong(long p1) { return "fflong: p1 = " + p1; } - + static String ffshort(short p1) { return "ffshort: p1 = " + p1; } - + static String ffintArray(int[] p1) { return "ffintArray: p1 = " + p1; } @@ -139,15 +139,15 @@ public class $classname { public static String ffoverload(jj1 arg) { return arg.me; } - + static String ffoverload(boolean p1) { return "ffoverload: boolean p1 = " + p1; } -/*** +/*** static String ffoverload(byte p1) { return "ffoverload: byte p1 = " + p1; } -***/ +***/ static String ffoverload(char p1) { return "ffoverload: char p1 = " + p1; } @@ -159,11 +159,11 @@ public class $classname { static String ffoverload(float p1) { return "ffoverload: float p1 = " + p1; } -/*** +/*** static String ffoverload(int p1) { return "ffoverload: int p1 = " + p1; } -***/ +***/ static String ffoverload(long p1) { return "ffoverload: long p1 = " + p1; } @@ -171,7 +171,7 @@ public class $classname { static String ffoverload(short p1) { return "ffoverload: short p1 = " + p1; } - + static String ffoverload(int[] p1) { return "ffoverload: int array p1 = " + p1; } @@ -184,7 +184,7 @@ public class $classname { public String toString() { return me; } - + } static class jj2 extends jj1 { @@ -227,7 +227,7 @@ dojdbCmds() # Provide a visual break in the output cmd print 1 - # Verify mixing primitive types works ok + # Verify mixing primitive types works ok # These should work even though the arg types are # not the same because there is only one # method with each name. @@ -302,7 +302,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/GetLocalVariables3Test.sh b/jdk/test/com/sun/jdi/GetLocalVariables3Test.sh index 2910897d989..15ee917b23a 100644 --- a/jdk/test/com/sun/jdi/GetLocalVariables3Test.sh +++ b/jdk/test/com/sun/jdi/GetLocalVariables3Test.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -67,7 +67,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/GetLocalVariables4Test.sh b/jdk/test/com/sun/jdi/GetLocalVariables4Test.sh index bba2d90a86a..b4cff66a37d 100644 --- a/jdk/test/com/sun/jdi/GetLocalVariables4Test.sh +++ b/jdk/test/com/sun/jdi/GetLocalVariables4Test.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -69,7 +69,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/JdbExprTest.sh b/jdk/test/com/sun/jdi/JdbExprTest.sh index a3c4ce168f4..a8c11e0a82e 100644 --- a/jdk/test/com/sun/jdi/JdbExprTest.sh +++ b/jdk/test/com/sun/jdi/JdbExprTest.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ class $classname { public static void bkpt() { int i = 0; //@1 breakpoint } - + public static void main(String[] args) { bkpt(); } @@ -73,7 +73,7 @@ dojdbCmds() cmd print java.lang.Long.MIN_VALUE jdbFailIfNotPresent " \= \-9223372036854775808" 3 - + cmd print 9223372036854775807L jdbFailIfNotPresent "9223372036854775807L = 9223372036854775807" 3 cmd print 9223372036854775807 @@ -83,7 +83,7 @@ dojdbCmds() jdbFailIfNotPresent "\-9223372036854775807L = \-9223372036854775807" 3 cmd print -9223372036854775807 jdbFailIfNotPresent "\-9223372036854775807 = \-9223372036854775807" 3 - + cmd print -1 jdbFailIfNotPresent "\-1 = \-1" 3 cmd print 1L @@ -92,7 +92,7 @@ dojdbCmds() jdbFailIfNotPresent "\-1L = \-1" 3 cmd print 0x1 jdbFailIfNotPresent "0x1 = 1" 3 - + cmd set $classname.aLong = 9223372036854775807L cmd print $classname.aLong jdbFailIfNotPresent "$classname.aLong = 9223372036854775807" 3 @@ -142,7 +142,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/JdbLockTest.sh b/jdk/test/com/sun/jdi/JdbLockTest.sh index 6558b98a679..ac5b33e594c 100644 --- a/jdk/test/com/sun/jdi/JdbLockTest.sh +++ b/jdk/test/com/sun/jdi/JdbLockTest.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2003, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -94,7 +94,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/MixedSuspendTest.sh b/jdk/test/com/sun/jdi/MixedSuspendTest.sh index 00f5f5dec56..a676d8e14bd 100644 --- a/jdk/test/com/sun/jdi/MixedSuspendTest.sh +++ b/jdk/test/com/sun/jdi/MixedSuspendTest.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2005, 2015 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2015, 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 diff --git a/jdk/test/com/sun/jdi/NullLocalVariable.sh b/jdk/test/com/sun/jdi/NullLocalVariable.sh index ce38929471f..14447d1cb2d 100644 --- a/jdk/test/com/sun/jdi/NullLocalVariable.sh +++ b/jdk/test/com/sun/jdi/NullLocalVariable.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -40,10 +40,10 @@ public class badscope { public static final void main(String args[]) { try { System.out.println("hi!"); // @1 breakpoint - } catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } finally { - System.out.println("done"); + System.out.println("done"); } } } @@ -71,7 +71,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java b/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java index 66f576fed2c..dbc18ec5e77 100644 --- a/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java +++ b/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 diff --git a/jdk/test/com/sun/jdi/RedefineChangeClassOrder.sh b/jdk/test/com/sun/jdi/RedefineChangeClassOrder.sh index b14a42201b3..0113c3304b9 100644 --- a/jdk/test/com/sun/jdi/RedefineChangeClassOrder.sh +++ b/jdk/test/com/sun/jdi/RedefineChangeClassOrder.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2006, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -135,7 +135,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/RedefineException.sh b/jdk/test/com/sun/jdi/RedefineException.sh index c2f0555f79e..19ea8cc70a1 100644 --- a/jdk/test/com/sun/jdi/RedefineException.sh +++ b/jdk/test/com/sun/jdi/RedefineException.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -75,7 +75,7 @@ public class $1 { } System.out.println("a2: done"); } - + public void a3() throws Exception { int a3local = 3; String a3string = "a3"; @@ -105,7 +105,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/RedefineImplementor.sh b/jdk/test/com/sun/jdi/RedefineImplementor.sh index dd7f83e8a0c..071ceec26e9 100644 --- a/jdk/test/com/sun/jdi/RedefineImplementor.sh +++ b/jdk/test/com/sun/jdi/RedefineImplementor.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2006, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -81,7 +81,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh b/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh index bd3bb514d52..049d6b6451c 100644 --- a/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh +++ b/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2006, 2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -50,13 +50,13 @@ public final class $1 { } public long m2(int j) { - System.out.println(System.getProperty("line.separator") + + System.out.println(System.getProperty("line.separator") + "**** public long m2(int j) with value: " + j); return j; } public long m2(long j) { - System.out.println(System.getProperty("line.separator") + + System.out.println(System.getProperty("line.separator") + "**** public long m2(long j) with value: " + j); return j; } @@ -102,7 +102,7 @@ mysetup() for ii in . $TESTSRC $TESTSRC/.. ; do if [ -r "$ii/ShellScaffold.sh" ] ; then - . $ii/ShellScaffold.sh + . $ii/ShellScaffold.sh break fi done diff --git a/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java b/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java index bdb3a0cfd0a..db33387b4b7 100644 --- a/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java +++ b/jdk/test/com/sun/management/GarbageCollectorMXBean/LastGCInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, 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 diff --git a/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java b/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java index c33ded954b4..e9d420ac8d3 100644 --- a/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java +++ b/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/com/sun/net/httpserver/StopNoStartTest.java b/jdk/test/com/sun/net/httpserver/StopNoStartTest.java index c10d767e7d7..4eef659ae41 100644 --- a/jdk/test/com/sun/net/httpserver/StopNoStartTest.java +++ b/jdk/test/com/sun/net/httpserver/StopNoStartTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/com/sun/net/httpserver/bugs/B6433018.java b/jdk/test/com/sun/net/httpserver/bugs/B6433018.java index 3193530aebc..f9ff8465598 100644 --- a/jdk/test/com/sun/net/httpserver/bugs/B6433018.java +++ b/jdk/test/com/sun/net/httpserver/bugs/B6433018.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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,4 +103,3 @@ public class B6433018 { } } } - diff --git a/jdk/test/com/sun/tools/attach/PermissionTest.java b/jdk/test/com/sun/tools/attach/PermissionTest.java index 1d74abb4155..9b034a21fcb 100644 --- a/jdk/test/com/sun/tools/attach/PermissionTest.java +++ b/jdk/test/com/sun/tools/attach/PermissionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 diff --git a/jdk/test/com/sun/tools/attach/ProviderTest.java b/jdk/test/com/sun/tools/attach/ProviderTest.java index 6c0125bb270..ed762907af2 100644 --- a/jdk/test/com/sun/tools/attach/ProviderTest.java +++ b/jdk/test/com/sun/tools/attach/ProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 diff --git a/jdk/test/com/sun/tools/attach/StartManagementAgent.java b/jdk/test/com/sun/tools/attach/StartManagementAgent.java index 5abeba24606..1a5234b3408 100644 --- a/jdk/test/com/sun/tools/attach/StartManagementAgent.java +++ b/jdk/test/com/sun/tools/attach/StartManagementAgent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 diff --git a/jdk/test/com/sun/tools/attach/TempDirTest.java b/jdk/test/com/sun/tools/attach/TempDirTest.java index 0ae0a4648f8..5be1bc3aa56 100644 --- a/jdk/test/com/sun/tools/attach/TempDirTest.java +++ b/jdk/test/com/sun/tools/attach/TempDirTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 diff --git a/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java b/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java index 17587f9526c..35819bdc2a7 100644 --- a/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java +++ b/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 diff --git a/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.html b/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.html index 2367cfc6b4a..356ad0f8126 100644 --- a/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.html +++ b/jdk/test/java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.html @@ -1,5 +1,5 @@ - Have Desired Model ? NO --> Re-exec --> Main - * NO YES --> Continue + * Path is desired JRE ? YES --> Continue + * NO * | * | * \|/ * Paths have well known - * jvm paths ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main - * YES YES --> Continue + * jvm paths ? --> NO --> Continue + * YES * | * | * \|/ * Does libjvm.so exist - * in any of them ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main - * YES YES --> Continue + * in any of them ? --> NO --> Continue + * YES * | * | * \|/ @@ -217,7 +216,7 @@ static InvocationFunctions *GetExportedJNIFunctions() { } char jvmPath[PATH_MAX]; - jboolean gotJVMPath = GetJVMPath(jrePath, preferredJVM, jvmPath, sizeof(jvmPath), CURRENT_DATA_MODEL); + jboolean gotJVMPath = GetJVMPath(jrePath, preferredJVM, jvmPath, sizeof(jvmPath)); if (!gotJVMPath) { JLI_ReportErrorMessage("Failed to GetJVMPath()"); return NULL; @@ -362,203 +361,51 @@ CreateExecutionEnvironment(int *pargc, char ***pargv, char jrepath[], jint so_jrepath, char jvmpath[], jint so_jvmpath, char jvmcfg[], jint so_jvmcfg) { - /* - * First, determine if we are running the desired data model. If we - * are running the desired data model, all the error messages - * associated with calling GetJREPath, ReadKnownVMs, etc. should be - * output. However, if we are not running the desired data model, - * some of the errors should be suppressed since it is more - * informative to issue an error message based on whether or not the - * os/processor combination has dual mode capabilities. - */ jboolean jvmpathExists; /* Compute/set the name of the executable */ SetExecname(*pargv); - /* Check data model flags, and exec process, if needed */ - { - char * jvmtype = NULL; - int argc = *pargc; - char **argv = *pargv; - int running = CURRENT_DATA_MODEL; + char * jvmtype = NULL; + int argc = *pargc; + char **argv = *pargv; - int wanted = running; /* What data mode is being - asked for? Current model is - fine unless another model - is asked for */ - - char** newargv = NULL; - int newargc = 0; - - /* - * Starting in 1.5, all unix platforms accept the -d32 and -d64 - * options. On platforms where only one data-model is supported - * (e.g. ia-64 Linux), using the flag for the other data model is - * an error and will terminate the program. - */ - - { /* open new scope to declare local variables */ - int i; - - newargv = (char **)JLI_MemAlloc((argc+1) * sizeof(char*)); - newargv[newargc++] = argv[0]; - - /* scan for data model arguments and remove from argument list; - last occurrence determines desired data model */ - for (i=1; i < argc; i++) { - - if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) { - wanted = 64; - continue; - } - if (JLI_StrCmp(argv[i], "-J-d32") == 0 || JLI_StrCmp(argv[i], "-d32") == 0) { - wanted = 32; - continue; - } - newargv[newargc++] = argv[i]; - - if (IsJavaArgs()) { - if (argv[i][0] != '-') continue; - } else { - if (JLI_StrCmp(argv[i], "-classpath") == 0 || JLI_StrCmp(argv[i], "-cp") == 0) { - i++; - if (i >= argc) break; - newargv[newargc++] = argv[i]; - continue; - } - if (argv[i][0] != '-') { i++; break; } - } - } - - /* copy rest of args [i .. argc) */ - while (i < argc) { - newargv[newargc++] = argv[i++]; - } - newargv[newargc] = NULL; - - /* - * newargv has all proper arguments here - */ - - argc = newargc; - argv = newargv; - } - - /* If the data model is not changing, it is an error if the - jvmpath does not exist */ - if (wanted == running) { - /* Find out where the JRE is that we will be using. */ - if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE) ) { - JLI_ReportErrorMessage(JRE_ERROR1); - exit(2); - } - JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%s%sjvm.cfg", - jrepath, FILESEP, FILESEP, "", ""); - /* Find the specified JVM type */ - if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) { - JLI_ReportErrorMessage(CFG_ERROR7); - exit(1); - } - - jvmpath[0] = '\0'; - jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE); - if (JLI_StrCmp(jvmtype, "ERROR") == 0) { - JLI_ReportErrorMessage(CFG_ERROR9); - exit(4); - } - - if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, wanted)) { - JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath); - exit(4); - } - - /* - * Mac OS X requires the Cocoa event loop to be run on the "main" - * thread. Spawn off a new thread to run main() and pass - * this thread off to the Cocoa event loop. - */ - MacOSXStartup(argc, argv); - - /* - * we seem to have everything we need, so without further ado - * we return back, otherwise proceed to set the environment. - */ - return; - } else { /* do the same speculatively or exit */ -#if defined(DUAL_MODE) - if (running != wanted) { - /* Find out where the JRE is that we will be using. */ - if (!GetJREPath(jrepath, so_jrepath, JNI_TRUE)) { - /* give up and let other code report error message */ - JLI_ReportErrorMessage(JRE_ERROR2, wanted); - exit(1); - } - JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%s%sjvm.cfg", - jrepath, FILESEP, FILESEP, "", ""); - /* - * Read in jvm.cfg for target data model and process vm - * selection options. - */ - if (ReadKnownVMs(jvmcfg, JNI_TRUE) < 1) { - /* give up and let other code report error message */ - JLI_ReportErrorMessage(JRE_ERROR2, wanted); - exit(1); - } - jvmpath[0] = '\0'; - jvmtype = CheckJvmType(pargc, pargv, JNI_TRUE); - if (JLI_StrCmp(jvmtype, "ERROR") == 0) { - JLI_ReportErrorMessage(CFG_ERROR9); - exit(4); - } - - /* exec child can do error checking on the existence of the path */ - jvmpathExists = GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, wanted); - } -#else /* ! DUAL_MODE */ - JLI_ReportErrorMessage(JRE_ERROR2, wanted); - exit(1); -#endif /* DUAL_MODE */ - } - { - char *newexec = execname; - JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n"); - (void) fflush(stdout); - (void) fflush(stderr); - /* - * Use posix_spawn() instead of execv() on Mac OS X. - * This allows us to choose which architecture the child process - * should run as. - */ - { - posix_spawnattr_t attr; - size_t unused_size; - pid_t unused_pid; - -#if defined(__i386__) || defined(__x86_64__) - cpu_type_t cpu_type[] = { (wanted == 64) ? CPU_TYPE_X86_64 : CPU_TYPE_X86, - (running== 64) ? CPU_TYPE_X86_64 : CPU_TYPE_X86 }; -#else - cpu_type_t cpu_type[] = { CPU_TYPE_ANY }; -#endif /* __i386 .. */ - - posix_spawnattr_init(&attr); - posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETEXEC); - posix_spawnattr_setbinpref_np(&attr, sizeof(cpu_type) / sizeof(cpu_type_t), - cpu_type, &unused_size); - - posix_spawn(&unused_pid, newexec, NULL, &attr, argv, environ); - } - JLI_ReportErrorMessageSys(JRE_ERROR4, newexec); - -#if defined(DUAL_MODE) - if (running != wanted) { - JLI_ReportErrorMessage(JRE_ERROR5, wanted, running); - } -#endif /* DUAL_MODE */ - } + /* Find out where the JRE is that we will be using. */ + if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE) ) { + JLI_ReportErrorMessage(JRE_ERROR1); + exit(2); + } + JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%sjvm.cfg", + jrepath, FILESEP, FILESEP); + /* Find the specified JVM type */ + if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) { + JLI_ReportErrorMessage(CFG_ERROR7); exit(1); } + + jvmpath[0] = '\0'; + jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE); + if (JLI_StrCmp(jvmtype, "ERROR") == 0) { + JLI_ReportErrorMessage(CFG_ERROR9); + exit(4); + } + + if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath)) { + JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath); + exit(4); + } + + /* + * Mac OS X requires the Cocoa event loop to be run on the "main" + * thread. Spawn off a new thread to run main() and pass + * this thread off to the Cocoa event loop. + */ + MacOSXStartup(argc, argv); + + /* + * we seem to have everything we need + */ + return; } /* @@ -566,7 +413,7 @@ CreateExecutionEnvironment(int *pargc, char ***pargv, */ static jboolean GetJVMPath(const char *jrepath, const char *jvmtype, - char *jvmpath, jint jvmpathsize, int bitsWanted) + char *jvmpath, jint jvmpathsize) { struct stat s; @@ -577,8 +424,7 @@ GetJVMPath(const char *jrepath, const char *jvmtype, * macosx client library is built thin, i386 only. * 64 bit client requests must load server library */ - const char *jvmtypeUsed = ((bitsWanted == 64) && (strcmp(jvmtype, "client") == 0)) ? "server" : jvmtype; - JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/%s/" JVM_DLL, jrepath, jvmtypeUsed); + JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/server/" JVM_DLL, jrepath); } JLI_TraceLauncher("Does `%s' exist ... ", jvmpath); diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c index f8265eeb110..4b005e24924 100644 --- a/jdk/src/java.base/share/native/libjli/java.c +++ b/jdk/src/java.base/share/native/libjli/java.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, 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 @@ -123,7 +123,6 @@ static void ListModules(JNIEnv* env, char *optString); static void SetPaths(int argc, char **argv); static void DumpState(); -static jboolean RemovableOption(char *option); enum OptionKind { LAUNCHER_OPTION = 0, @@ -742,17 +741,16 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) { } /* - * static void SetJvmEnvironment(int argc, char **argv); - * Is called just before the JVM is loaded. We can set env variables - * that are consumed by the JVM. This function is non-destructive, - * leaving the arg list intact. The first use is for the JVM flag - * -XX:NativeMemoryTracking=value. + * This method must be called before the VM is loaded, primarily + * used to parse and set any VM related options or env variables. + * This function is non-destructive leaving the argument list intact. */ static void SetJvmEnvironment(int argc, char **argv) { static const char* NMT_Env_Name = "NMT_LEVEL_"; int i; + /* process only the launcher arguments */ for (i = 0; i < argc; i++) { char *arg = argv[i]; /* @@ -811,11 +809,8 @@ SetJvmEnvironment(int argc, char **argv) { printf("TRACER_MARKER: NativeMemoryTracking: got value %s\n",envBuf); free(envName); } - } - } - } } @@ -1383,8 +1378,6 @@ ParseArguments(int *pargc, char ***pargv, ; /* Ignore machine independent options already handled */ } else if (ProcessPlatformOption(arg)) { ; /* Processing of platform dependent options */ - } else if (RemovableOption(arg)) { - ; /* Do not pass option to vm. */ } else { /* java.class.path set on the command line */ if (JLI_StrCCmp(arg, "-Djava.class.path=") == 0) { @@ -2262,34 +2255,6 @@ DumpState() printf("\tfullversion:%s\n", GetFullVersion()); } -/* - * Return JNI_TRUE for an option string that has no effect but should - * _not_ be passed on to the vm; return JNI_FALSE otherwise. On - * Solaris SPARC, this screening needs to be done if: - * -d32 or -d64 is passed to a binary with an unmatched data model - * (the exec in CreateExecutionEnvironment removes -d options and points the - * exec to the proper binary). In the case of when the data model and the - * requested version is matched, an exec would not occur, and these options - * were erroneously passed to the vm. - */ -jboolean -RemovableOption(char * option) -{ - /* - * Unconditionally remove both -d32 and -d64 options since only - * the last such options has an effect; e.g. - * java -d32 -d64 -d32 -version - * is equivalent to - * java -d32 -version - */ - - if( (JLI_StrCCmp(option, "-d32") == 0 ) || - (JLI_StrCCmp(option, "-d64") == 0 ) ) - return JNI_TRUE; - else - return JNI_FALSE; -} - /* * A utility procedure to always print to stderr */ diff --git a/jdk/src/java.base/unix/native/libjli/java_md.h b/jdk/src/java.base/unix/native/libjli/java_md.h index f0eaa302bd3..cc3bb1194e1 100644 --- a/jdk/src/java.base/unix/native/libjli/java_md.h +++ b/jdk/src/java.base/unix/native/libjli/java_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -54,7 +54,7 @@ char *FindExecName(char *program); const char *SetExecname(char **argv); const char *GetExecName(); static jboolean GetJVMPath(const char *jrepath, const char *jvmtype, - char *jvmpath, jint jvmpathsize, int bitsWanted); + char *jvmpath, jint jvmpathsize); static jboolean GetJREPath(char *path, jint pathsize, jboolean speculative); #if defined(_AIX) diff --git a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c index cb9afc09822..408b5378bfe 100644 --- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c +++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -62,9 +62,7 @@ * * The selection of the proper vm shared library to open depends on * several classes of command line options, including vm "flavor" - * options (-client, -server) and the data model options, -d32 and - * -d64, as well as a version specification which may have come from - * the command line or from the manifest of an executable jar file. + * options (-client, -server). * The vm selection options are not passed to the running * virtual machine; they must be screened out by the launcher. * @@ -120,34 +118,30 @@ * | * \|/ * ParseArguments - * (removes -d32 and -d64 if any, - * processes version options, - * creates argument list for vm, - * etc.) * | * | * \|/ * RequiresSetenv * Is LD_LIBRARY_PATH - * and friends set ? --> NO --> Have Desired Model ? NO --> Error/Exit - * YES YES --> Continue + * and friends set ? --> NO --> Continue + * YES * | * | * \|/ - * Path is desired JRE ? YES --> Have Desired Model ? NO --> Error/Exit - * NO YES --> Continue + * Path is desired JRE ? YES --> Continue + * NO * | * | * \|/ * Paths have well known - * jvm paths ? --> NO --> Have Desired Model ? NO --> Error/Exit - * YES YES --> Continue + * jvm paths ? --> NO --> Error/Exit + * YES * | * | * \|/ - * Does libjvm.so exit - * in any of them ? --> NO --> Have Desired Model ? NO --> Error/Exit - * YES YES --> Continue + * Does libjvm.so exist + * in any of them ? --> NO --> Continue + * YES * | * | * \|/ @@ -302,229 +296,97 @@ CreateExecutionEnvironment(int *pargc, char ***pargv, char jrepath[], jint so_jrepath, char jvmpath[], jint so_jvmpath, char jvmcfg[], jint so_jvmcfg) { - /* - * First, determine if we are running the desired data model. If we - * are running the desired data model, all the error messages - * associated with calling GetJREPath, ReadKnownVMs, etc. should be - * output, otherwise we simply exit with an error, as we no longer - * support dual data models. - */ - jboolean jvmpathExists; + + char * jvmtype = NULL; + int argc = *pargc; + char **argv = *pargv; + +#ifdef SETENV_REQUIRED + jboolean mustsetenv = JNI_FALSE; + char *runpath = NULL; /* existing effective LD_LIBRARY_PATH setting */ + char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */ + char* newpath = NULL; /* path on new LD_LIBRARY_PATH */ + char* lastslash = NULL; + char** newenvp = NULL; /* current environment */ + size_t new_runpath_size; +#endif /* SETENV_REQUIRED */ /* Compute/set the name of the executable */ SetExecname(*pargv); - /* Check data model flags, and exec process, if needed */ - { - char * jvmtype = NULL; - int argc = *pargc; - char **argv = *pargv; - int running = CURRENT_DATA_MODEL; - /* - * As of jdk9, there is no support for dual mode operations, however - * for legacy error reporting purposes and until -d options are supported - * we need this. - */ - int wanted = running; -#ifdef SETENV_REQUIRED - jboolean mustsetenv = JNI_FALSE; - char *runpath = NULL; /* existing effective LD_LIBRARY_PATH setting */ - char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */ - char* newpath = NULL; /* path on new LD_LIBRARY_PATH */ - char* lastslash = NULL; - char** newenvp = NULL; /* current environment */ - size_t new_runpath_size; -#ifdef __solaris__ - char* dmpath = NULL; /* data model specific LD_LIBRARY_PATH, - Solaris only */ -#endif /* __solaris__ */ -#endif /* SETENV_REQUIRED */ - - char** newargv = NULL; - int newargc = 0; - - /* - * Starting in 1.5, all unix platforms accept the -d32 and -d64 - * options. On platforms where only one data-model is supported - * (e.g. ia-64 Linux), using the flag for the other data model is - * an error and will terminate the program. - */ - - { /* open new scope to declare local variables */ - int i; - - newargv = (char **)JLI_MemAlloc((argc+1) * sizeof(char*)); - newargv[newargc++] = argv[0]; - - /* scan for data model arguments and remove from argument list; - last occurrence determines desired data model */ - for (i=1; i < argc; i++) { - - if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) { - wanted = 64; - continue; - } - if (JLI_StrCmp(argv[i], "-J-d32") == 0 || JLI_StrCmp(argv[i], "-d32") == 0) { - wanted = 32; - continue; - } - newargv[newargc++] = argv[i]; - - if (IsJavaArgs()) { - if (argv[i][0] != '-') continue; - } else { - if (JLI_StrCmp(argv[i], "-classpath") == 0 || JLI_StrCmp(argv[i], "-cp") == 0) { - i++; - if (i >= argc) break; - newargv[newargc++] = argv[i]; - continue; - } - if (argv[i][0] != '-') { i++; break; } - } - } - - /* copy rest of args [i .. argc) */ - while (i < argc) { - newargv[newargc++] = argv[i++]; - } - newargv[newargc] = NULL; - - /* - * newargv has all proper arguments here - */ - - argc = newargc; - argv = newargv; - } - - /* If the data model is not changing, it is an error if the - jvmpath does not exist */ - if (wanted == running) { - /* Find out where the JRE is that we will be using. */ - if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE) ) { - JLI_ReportErrorMessage(JRE_ERROR1); - exit(2); - } - JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%sjvm.cfg", - jrepath, FILESEP, FILESEP, FILESEP); - /* Find the specified JVM type */ - if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) { - JLI_ReportErrorMessage(CFG_ERROR7); - exit(1); - } - - jvmpath[0] = '\0'; - jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE); - if (JLI_StrCmp(jvmtype, "ERROR") == 0) { - JLI_ReportErrorMessage(CFG_ERROR9); - exit(4); - } - - if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, 0 )) { - JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath); - exit(4); - } - /* - * we seem to have everything we need, so without further ado - * we return back, otherwise proceed to set the environment. - */ -#ifdef SETENV_REQUIRED - mustsetenv = RequiresSetenv(jvmpath); - JLI_TraceLauncher("mustsetenv: %s\n", mustsetenv ? "TRUE" : "FALSE"); - - if (mustsetenv == JNI_FALSE) { - JLI_MemFree(newargv); - return; - } -#else - JLI_MemFree(newargv); - return; -#endif /* SETENV_REQUIRED */ - } else { /* do the same speculatively or exit */ - JLI_ReportErrorMessage(JRE_ERROR2, wanted); + /* Check to see if the jvmpath exists */ + /* Find out where the JRE is that we will be using. */ + if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE)) { + JLI_ReportErrorMessage(JRE_ERROR1); + exit(2); + } + JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%sjvm.cfg", + jrepath, FILESEP, FILESEP); + /* Find the specified JVM type */ + if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) { + JLI_ReportErrorMessage(CFG_ERROR7); exit(1); - } + } + + jvmpath[0] = '\0'; + jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE); + if (JLI_StrCmp(jvmtype, "ERROR") == 0) { + JLI_ReportErrorMessage(CFG_ERROR9); + exit(4); + } + + if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath)) { + JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath); + exit(4); + } + /* + * we seem to have everything we need, so without further ado + * we return back, otherwise proceed to set the environment. + */ #ifdef SETENV_REQUIRED - if (mustsetenv) { - /* - * We will set the LD_LIBRARY_PATH as follows: - * - * o $JVMPATH (directory portion only) - * o $JRE/lib - * o $JRE/../lib - * - * followed by the user's previous effective LD_LIBRARY_PATH, if - * any. - */ + mustsetenv = RequiresSetenv(jvmpath); + JLI_TraceLauncher("mustsetenv: %s\n", mustsetenv ? "TRUE" : "FALSE"); -#ifdef __solaris__ - /* - * Starting in Solaris 7, ld.so.1 supports three LD_LIBRARY_PATH - * variables: - * - * 1. LD_LIBRARY_PATH -- used for 32 and 64 bit searches if - * data-model specific variables are not set. - * - * 2. LD_LIBRARY_PATH_64 -- overrides and replaces LD_LIBRARY_PATH - * for 64-bit binaries. - * The vm uses LD_LIBRARY_PATH to set the java.library.path system - * property. To shield the vm from the complication of multiple - * LD_LIBRARY_PATH variables, if the appropriate data model - * specific variable is set, we will act as if LD_LIBRARY_PATH had - * the value of the data model specific variant and the data model - * specific variant will be unset. Note that the variable for the - * *wanted* data model must be used (if it is set), not simply the - * current running data model. - */ + if (mustsetenv == JNI_FALSE) { + return; + } +#else + return; +#endif /* SETENV_REQUIRED */ - switch (wanted) { - case 0: - case 64: - dmpath = getenv("LD_LIBRARY_PATH_64"); - wanted = 64; - break; +#ifdef SETENV_REQUIRED + if (mustsetenv) { + /* + * We will set the LD_LIBRARY_PATH as follows: + * + * o $JVMPATH (directory portion only) + * o $JRE/lib + * o $JRE/../lib + * + * followed by the user's previous effective LD_LIBRARY_PATH, if + * any. + */ - default: - JLI_ReportErrorMessage(JRE_ERROR3, __LINE__); - exit(1); /* unknown value in wanted */ - break; - } + runpath = getenv(LD_LIBRARY_PATH); - /* - * If dmpath is NULL, the relevant data model specific variable is - * not set and normal LD_LIBRARY_PATH should be used. - */ - if (dmpath == NULL) { - runpath = getenv("LD_LIBRARY_PATH"); - } else { - runpath = dmpath; - } -#else /* ! __solaris__ */ - /* - * If not on Solaris, assume only a single LD_LIBRARY_PATH - * variable. - */ - runpath = getenv(LD_LIBRARY_PATH); -#endif /* __solaris__ */ - - /* runpath contains current effective LD_LIBRARY_PATH setting */ - { /* New scope to declare local variable */ - char *new_jvmpath = JLI_StringDup(jvmpath); - new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) + - 2 * JLI_StrLen(jrepath) + + /* runpath contains current effective LD_LIBRARY_PATH setting */ + { /* New scope to declare local variable */ + char *new_jvmpath = JLI_StringDup(jvmpath); + new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) + + 2 * JLI_StrLen(jrepath) + #ifdef AIX - /* On AIX we additionally need 'jli' in the path because ld doesn't support $ORIGIN. */ - JLI_StrLen(jrepath) + JLI_StrLen("/lib//jli:") + + /* On AIX we additionally need 'jli' in the path because ld doesn't support $ORIGIN. */ + JLI_StrLen(jrepath) + JLI_StrLen("/lib//jli:") + #endif - JLI_StrLen(new_jvmpath) + 52; - new_runpath = JLI_MemAlloc(new_runpath_size); - newpath = new_runpath + JLI_StrLen(LD_LIBRARY_PATH "="); + JLI_StrLen(new_jvmpath) + 52; + new_runpath = JLI_MemAlloc(new_runpath_size); + newpath = new_runpath + JLI_StrLen(LD_LIBRARY_PATH "="); - /* - * Create desired LD_LIBRARY_PATH value for target data model. - */ - { + /* + * Create desired LD_LIBRARY_PATH value for target data model. + */ + { /* remove the name of the .so from the JVM path */ lastslash = JLI_StrRChr(new_jvmpath, '/'); if (lastslash) @@ -555,85 +417,66 @@ CreateExecutionEnvironment(int *pargc, char ***pargv, */ if (runpath != NULL && JLI_StrNCmp(newpath, runpath, JLI_StrLen(newpath)) == 0 && - (runpath[JLI_StrLen(newpath)] == 0 || runpath[JLI_StrLen(newpath)] == ':') && - (running == wanted) /* data model does not have to be changed */ -#ifdef __solaris__ - && (dmpath == NULL) /* data model specific variables not set */ -#endif /* __solaris__ */ - ) { - JLI_MemFree(newargv); + (runpath[JLI_StrLen(newpath)] == 0 || + runpath[JLI_StrLen(newpath)] == ':')) { JLI_MemFree(new_runpath); return; } - } } - - /* - * Place the desired environment setting onto the prefix of - * LD_LIBRARY_PATH. Note that this prevents any possible infinite - * loop of execv() because we test for the prefix, above. - */ - if (runpath != 0) { - /* ensure storage for runpath + colon + NULL */ - if ((JLI_StrLen(runpath) + 1 + 1) > new_runpath_size) { - JLI_ReportErrorMessageSys(JRE_ERROR11); - exit(1); - } - JLI_StrCat(new_runpath, ":"); - JLI_StrCat(new_runpath, runpath); - } - - if (putenv(new_runpath) != 0) { - exit(1); /* problem allocating memory; LD_LIBRARY_PATH not set - properly */ - } - - /* - * Unix systems document that they look at LD_LIBRARY_PATH only - * once at startup, so we have to re-exec the current executable - * to get the changed environment variable to have an effect. - */ - -#ifdef __solaris__ - /* - * If dmpath is not NULL, remove the data model specific string - * in the environment for the exec'ed child. - */ - if (dmpath != NULL) - (void)UnsetEnv("LD_LIBRARY_PATH_64"); -#endif /* __solaris */ - - newenvp = environ; } -#endif /* SETENV_REQUIRED */ - { - char *newexec = execname; - JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n"); - (void) fflush(stdout); - (void) fflush(stderr); -#ifdef SETENV_REQUIRED - if (mustsetenv) { - execve(newexec, argv, newenvp); - } else { - execv(newexec, argv); + + /* + * Place the desired environment setting onto the prefix of + * LD_LIBRARY_PATH. Note that this prevents any possible infinite + * loop of execv() because we test for the prefix, above. + */ + if (runpath != 0) { + /* ensure storage for runpath + colon + NULL */ + if ((JLI_StrLen(runpath) + 1 + 1) > new_runpath_size) { + JLI_ReportErrorMessageSys(JRE_ERROR11); + exit(1); } -#else /* !SETENV_REQUIRED */ - execv(newexec, argv); -#endif /* SETENV_REQUIRED */ - JLI_ReportErrorMessageSys(JRE_ERROR4, newexec); + JLI_StrCat(new_runpath, ":"); + JLI_StrCat(new_runpath, runpath); } - exit(1); + + if (putenv(new_runpath) != 0) { + /* problem allocating memory; LD_LIBRARY_PATH not set properly */ + exit(1); + } + + /* + * Unix systems document that they look at LD_LIBRARY_PATH only + * once at startup, so we have to re-exec the current executable + * to get the changed environment variable to have an effect. + */ + + newenvp = environ; } +#endif /* SETENV_REQUIRED */ + { + char *newexec = execname; + JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n"); + (void) fflush(stdout); + (void) fflush(stderr); +#ifdef SETENV_REQUIRED + if (mustsetenv) { + execve(newexec, argv, newenvp); + } else { + execv(newexec, argv); + } +#else /* !SETENV_REQUIRED */ + execv(newexec, argv); +#endif /* SETENV_REQUIRED */ + JLI_ReportErrorMessageSys(JRE_ERROR4, newexec); + } + exit(1); } -/* - * On Solaris VM choosing is done by the launcher (java.c), - * bitsWanted is used by MacOSX, on Solaris and Linux this. - * parameter is unused. - */ + static jboolean GetJVMPath(const char *jrepath, const char *jvmtype, - char *jvmpath, jint jvmpathsize, int bitsWanted) + char *jvmpath, jint jvmpathsize) { struct stat s; diff --git a/jdk/src/java.base/windows/native/libjli/java_md.c b/jdk/src/java.base/windows/native/libjli/java_md.c index 385fc8ca36d..18739457298 100644 --- a/jdk/src/java.base/windows/native/libjli/java_md.c +++ b/jdk/src/java.base/windows/native/libjli/java_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -158,32 +158,10 @@ CreateExecutionEnvironment(int *pargc, char ***pargv, char *jrepath, jint so_jrepath, char *jvmpath, jint so_jvmpath, char *jvmcfg, jint so_jvmcfg) { - char * jvmtype; + + char *jvmtype; int i = 0; - int running = CURRENT_DATA_MODEL; - - int wanted = running; - char** argv = *pargv; - for (i = 1; i < *pargc ; i++) { - if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) { - wanted = 64; - continue; - } - if (JLI_StrCmp(argv[i], "-J-d32") == 0 || JLI_StrCmp(argv[i], "-d32") == 0) { - wanted = 32; - continue; - } - - if (IsJavaArgs() && argv[i][0] != '-') - continue; - if (argv[i][0] != '-') - break; - } - if (running != wanted) { - JLI_ReportErrorMessage(JRE_ERROR2, wanted); - exit(1); - } /* Find out where the JRE is that we will be using. */ if (!GetJREPath(jrepath, so_jrepath)) { diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 8542940bb1a..190fb6ae57a 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -99,9 +99,8 @@ # 1. Make sure test passes on all platforms with samevm, or mark it othervm # 2. Make sure test passes on all platforms when run with it's entire group # 3. Make sure both VMs are tested, -server and -client, if possible -# 4. Make sure you try the -d64 option on Solaris -# 5. Use a tool like JPRT or something to verify these results -# 6. Delete lines in this file, include the changes with your test changes +# 4. Use a tool like JPRT or something to verify these results +# 5. Delete lines in this file, include the changes with your test changes # # You may need to repeat your testing 2 or even 3 times to verify good # results, some of these samevm failures are not very predictable. diff --git a/jdk/test/java/awt/JAWT/JAWT.sh b/jdk/test/java/awt/JAWT/JAWT.sh index d01ff022a42..8432a7188dd 100644 --- a/jdk/test/java/awt/JAWT/JAWT.sh +++ b/jdk/test/java/awt/JAWT/JAWT.sh @@ -85,7 +85,7 @@ case "$OS" in MAKEFILE="Makefile.win" CC="cl" MAKE="nmake" - ${TESTJAVA}${FS}bin${FS}java -d64 -version 2>&1 | grep '64-Bit' > $NULL + ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL if [ "$?" -eq '0' ] then ARCH="amd64" @@ -100,7 +100,7 @@ case "$OS" in FS="/" MAKEFILE="Makefile.cygwin" CC="gcc" - ${TESTJAVA}${FS}bin${FS}java -d64 -version 2>&1 | grep '64-Bit' > $NULL + ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL if [ "$?" -eq '0' ] then ARCH="amd64" diff --git a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh index 9b01503fe5d..cc227b02910 100644 --- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh +++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh @@ -47,12 +47,7 @@ if [ -z "$TESTJAVA" ]; then TESTCLASSES=`pwd` JAVA=java which $JAVA - ${JAVA} -d64 -version > /dev/null 2<&1 - if [ $? = 1 ]; then ${JAVA} -version - else - ${JAVA} -d64 -version - fi else JAVA="${TESTJAVA}/bin/java" fi diff --git a/jdk/test/java/util/Arrays/Big.java b/jdk/test/java/util/Arrays/Big.java index cd8f097ac09..1d40b39b846 100644 --- a/jdk/test/java/util/Arrays/Big.java +++ b/jdk/test/java/util/Arrays/Big.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ // A proper regression test for 5045582 requires too much memory. // If you have a really big machine, run like this: -// java -d64 -Xms25g -Xmx25g Big 30 +// java -Xms25g -Xmx25g Big 30 import java.util.*; @@ -68,7 +68,7 @@ public class Big { } // To test Object arrays larger than 1<<30, you need 13GB. Run like: - // java -d64 -Xms13g -Xmx13g Big 30 2 + // java -Xms13g -Xmx13g Big 30 2 if ((tasks & 0x2) != 0) { System.out.println("Integer[]"); System.gc(); diff --git a/jdk/test/tools/launcher/ChangeDataModel.java b/jdk/test/tools/launcher/ChangeDataModel.java index 31ee6f8cfe4..e6bc281ad62 100644 --- a/jdk/test/tools/launcher/ChangeDataModel.java +++ b/jdk/test/tools/launcher/ChangeDataModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, 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 @@ -23,104 +23,57 @@ /** * @test - * @bug 4894330 4810347 6277269 8029388 + * @bug 4894330 4810347 6277269 8029388 8169646 * @compile -XDignore.symbol.file ChangeDataModel.java * @run main ChangeDataModel - * @summary Verify -d32 and -d64 options are accepted(rejected) on all platforms + * @summary Verify -d32, -d64 and -J prefixed data-model options are rejected on all platforms * @author Joseph D. Darcy, ksrini */ -import java.io.File; -import java.util.ArrayList; -import java.util.List; + +import java.util.Arrays; public class ChangeDataModel extends TestHelper { - private static final File TestJar = new File("test" + JAR_FILE_EXT); - private static final String OptionName = "Args"; - private static final File TestOptionJar = new File(OptionName + JAR_FILE_EXT); - private static final String OPT_PREFIX = "ARCH_OPT:"; - static void createTestJar() throws Exception { - String[] code = { - " public static void main(String argv[]) {", - " System.out.println(\"" + OPT_PREFIX + "-d\" + System.getProperty(\"sun.arch.data.model\", \"none\"));", - " }",}; - createJar(TestJar, code); - } public static void main(String... args) throws Exception { - createTestJar(); - createOptionsJar(); - - // verify if data model flag for default data model is accepted, also - // verify if the complimentary data model is rejected. - if (is32Bit) { - checkAcceptance(javaCmd, "-d32"); - checkRejection(javaCmd, "-d64"); - checkOption(javaCmd, "-d64"); - } else if (is64Bit) { - checkAcceptance(javaCmd, "-d64"); - checkRejection(javaCmd, "-d32"); - checkOption(javaCmd, "-d32"); - } else { - throw new Error("unsupported data model"); - } + new ChangeDataModel().run(args); } - static void checkAcceptance(String cmd, String dmodel) { - TestResult tr = doExec(cmd, dmodel, "-jar", TestJar.getAbsolutePath()); - if (!tr.contains(OPT_PREFIX + dmodel)) { + @Test + public void check32bitRejection() throws Exception { + checkRejection("-d32"); + } + + @Test + public void check64bitRejection() throws Exception { + checkRejection("-d64"); + } + + void checkRejection(String dmodel) throws Exception { + String expect = "Unrecognized option: " + dmodel; + String[] cmds1 = { + javaCmd, + dmodel, + "-version" + }; + checkRejection(expect, cmds1); + + String[] cmds2 = { + javacCmd, + "-J" + dmodel, + "-version" + }; + checkRejection(expect, cmds2); + } + + + void checkRejection(String expect, String... cmds) throws Exception { + TestResult tr = doExec(cmds); + tr.checkNegative(); + if (!tr.contains(expect)) { System.out.println(tr); - String message = "Data model flag " + dmodel + - " not accepted or had improper effect."; - throw new RuntimeException(message); + String error = "did not get " + "\'" + expect + "\'" + + "with options " + Arrays.asList(cmds); + throw new Exception(error); } } - - static void checkRejection(String cmd, String dmodel) { - TestResult tr = doExec(cmd, dmodel, "-jar", TestJar.getAbsolutePath()); - if (tr.contains(OPT_PREFIX + dmodel)) { - System.out.println(tr); - String message = "Data model flag " + dmodel + " was accepted."; - throw new RuntimeException(message); - } - } - - static void checkOption(String cmd, String dmodel) throws Exception { - TestResult tr = doExec(cmd, "-jar", TestOptionJar.getAbsolutePath(), dmodel); - verifyOption(tr, dmodel); - - tr = doExec(cmd, "-cp", ".", OptionName, dmodel); - verifyOption(tr, dmodel); - } - - static void verifyOption(TestResult tr, String dmodel) { - if (!tr.contains(OPT_PREFIX + dmodel)) { - System.out.println(tr); - String message = "app argument: " + dmodel + " not found."; - throw new RuntimeException(message); - } - if (!tr.isOK()) { - System.out.println(tr); - String message = "app argument: " + dmodel + " interpreted ?"; - throw new RuntimeException(message); - } - } - - static void createOptionsJar() throws Exception { - List code = new ArrayList<>(); - code.add("public class Args {"); - code.add(" public static void main(String argv[]) {"); - code.add(" for (String x : argv)"); - code.add(" System.out.println(\"" + OPT_PREFIX + "\" + x);"); - code.add(" }"); - code.add("}"); - File optionsJava = new File(OptionName + JAVA_FILE_EXT); - createFile(optionsJava, code); - File optionsClass = new File(OptionName + CLASS_FILE_EXT); - - compile(optionsJava.getName()); - createJar("cvfe", - TestOptionJar.getName(), - OptionName, - optionsClass.getName()); - } } diff --git a/jdk/test/tools/launcher/Test7029048.java b/jdk/test/tools/launcher/Test7029048.java index 1a32322c832..b9d70aee9f2 100644 --- a/jdk/test/tools/launcher/Test7029048.java +++ b/jdk/test/tools/launcher/Test7029048.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, 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 @@ -193,7 +193,7 @@ public class Test7029048 extends TestHelper { if (isSolaris) { /* * Case 3: set the appropriate LLP_XX flag, - * java64 -d64, LLP_64 is relevant, LLP_32 is ignored + * java64 LLP_64 is relevant, LLP_32 is ignored */ env.clear(); env.put(LD_LIBRARY_PATH_64, dstServerDir.getAbsolutePath()); From 7a4f23e55d88ac4e27b9352682150bcefcc41d0e Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Thu, 11 May 2017 07:33:23 +0800 Subject: [PATCH 42/55] 8179389: X509Certificate generateCRLs is extremely slow using a PEM crl list Reviewed-by: mullan --- .../sun/security/provider/X509Factory.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/security/provider/X509Factory.java b/jdk/src/java.base/share/classes/sun/security/provider/X509Factory.java index 1789dd62cf5..34a3c8e1ac4 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/X509Factory.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/X509Factory.java @@ -553,8 +553,7 @@ public class X509Factory extends CertificateFactorySpi { return bout.toByteArray(); } else { // Read BASE64 encoded data, might skip info at the beginning - char[] data = new char[2048]; - int pos = 0; + ByteArrayOutputStream data = new ByteArrayOutputStream(); // Step 1: Read until header is found int hyphen = (c=='-') ? 1: 0; // count of consequent hyphens @@ -598,7 +597,10 @@ public class X509Factory extends CertificateFactorySpi { end = '\n'; } else { end = '\r'; - data[pos++] = (char)next; + // Skip all white space chars + if (next != 9 && next != 10 && next != 13 && next != 32) { + data.write(next); + } } break; } @@ -612,9 +614,9 @@ public class X509Factory extends CertificateFactorySpi { throw new IOException("Incomplete data"); } if (next != '-') { - data[pos++] = (char)next; - if (pos >= data.length) { - data = Arrays.copyOf(data, data.length+1024); + // Skip all white space chars + if (next != 9 && next != 10 && next != 13 && next != 32) { + data.write(next); } } else { break; @@ -635,7 +637,11 @@ public class X509Factory extends CertificateFactorySpi { checkHeaderFooter(header.toString(), footer.toString()); - return Pem.decode(new String(data, 0, pos)); + try { + return Base64.getDecoder().decode(data.toByteArray()); + } catch (IllegalArgumentException e) { + throw new IOException(e); + } } } From d9de25905c64870d1ccef736b4a3d1c8b82f72a3 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Wed, 10 May 2017 23:40:46 +0000 Subject: [PATCH 43/55] 8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS Reviewed-by: valeriep, jnimeh, apetcher --- .../classes/sun/security/ssl/CipherSuite.java | 43 +- .../sun/security/ssl/CipherSuiteList.java | 46 +- .../sun/security/ssl/ClientHandshaker.java | 38 +- .../classes/sun/security/ssl/DHCrypt.java | 281 +--------- .../classes/sun/security/ssl/ECDHCrypt.java | 10 +- .../security/ssl/EllipticCurvesExtension.java | 400 -------------- .../sun/security/ssl/ExtensionType.java | 8 +- .../sun/security/ssl/HandshakeMessage.java | 48 +- .../classes/sun/security/ssl/Handshaker.java | 124 ++--- .../sun/security/ssl/HelloExtensions.java | 8 +- .../classes/sun/security/ssl/NamedGroup.java | 169 ++++++ .../sun/security/ssl/NamedGroupType.java | 32 ++ .../ssl/PredefinedDHParameterSpecs.java | 314 +++++++++++ .../sun/security/ssl/ServerHandshaker.java | 155 ++++-- .../ssl/SupportedGroupsExtension.java | 491 ++++++++++++++++++ .../ssl/DHKeyExchange/DHEKeySizing.java | 37 +- .../ssl/DHKeyExchange/UseStrongDHSizes.java | 93 ++++ 17 files changed, 1430 insertions(+), 867 deletions(-) delete mode 100644 jdk/src/java.base/share/classes/sun/security/ssl/EllipticCurvesExtension.java create mode 100644 jdk/src/java.base/share/classes/sun/security/ssl/NamedGroup.java create mode 100644 jdk/src/java.base/share/classes/sun/security/ssl/NamedGroupType.java create mode 100644 jdk/src/java.base/share/classes/sun/security/ssl/PredefinedDHParameterSpecs.java create mode 100644 jdk/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java create mode 100644 jdk/test/sun/security/ssl/DHKeyExchange/UseStrongDHSizes.java diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java b/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java index 2ffb5f32b4b..c8080ca9a67 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, 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 @@ -44,6 +44,7 @@ import static sun.security.ssl.CipherSuite.CipherType.*; import static sun.security.ssl.CipherSuite.MacAlg.*; import static sun.security.ssl.CipherSuite.BulkCipher.*; import static sun.security.ssl.JsseJce.*; +import static sun.security.ssl.NamedGroupType.*; /** * An SSL/TLS CipherSuite. Constants for the standard key exchange, cipher, @@ -376,38 +377,38 @@ final class CipherSuite implements Comparable { static enum KeyExchange { // key exchange algorithms - K_NULL ("NULL", false, false), - K_RSA ("RSA", true, false), - K_RSA_EXPORT ("RSA_EXPORT", true, false), - K_DH_RSA ("DH_RSA", false, false), - K_DH_DSS ("DH_DSS", false, false), - K_DHE_DSS ("DHE_DSS", true, false), - K_DHE_RSA ("DHE_RSA", true, false), - K_DH_ANON ("DH_anon", true, false), + K_NULL ("NULL", false, NAMED_GROUP_NONE), + K_RSA ("RSA", true, NAMED_GROUP_NONE), + K_RSA_EXPORT ("RSA_EXPORT", true, NAMED_GROUP_NONE), + K_DH_RSA ("DH_RSA", false, NAMED_GROUP_NONE), + K_DH_DSS ("DH_DSS", false, NAMED_GROUP_NONE), + K_DHE_DSS ("DHE_DSS", true, NAMED_GROUP_FFDHE), + K_DHE_RSA ("DHE_RSA", true, NAMED_GROUP_FFDHE), + K_DH_ANON ("DH_anon", true, NAMED_GROUP_FFDHE), - K_ECDH_ECDSA ("ECDH_ECDSA", ALLOW_ECC, true), - K_ECDH_RSA ("ECDH_RSA", ALLOW_ECC, true), - K_ECDHE_ECDSA("ECDHE_ECDSA", ALLOW_ECC, true), - K_ECDHE_RSA ("ECDHE_RSA", ALLOW_ECC, true), - K_ECDH_ANON ("ECDH_anon", ALLOW_ECC, true), + K_ECDH_ECDSA ("ECDH_ECDSA", ALLOW_ECC, NAMED_GROUP_ECDHE), + K_ECDH_RSA ("ECDH_RSA", ALLOW_ECC, NAMED_GROUP_ECDHE), + K_ECDHE_ECDSA("ECDHE_ECDSA", ALLOW_ECC, NAMED_GROUP_ECDHE), + K_ECDHE_RSA ("ECDHE_RSA", ALLOW_ECC, NAMED_GROUP_ECDHE), + K_ECDH_ANON ("ECDH_anon", ALLOW_ECC, NAMED_GROUP_ECDHE), // Kerberos cipher suites - K_KRB5 ("KRB5", true, false), - K_KRB5_EXPORT("KRB5_EXPORT", true, false), + K_KRB5 ("KRB5", true, NAMED_GROUP_NONE), + K_KRB5_EXPORT("KRB5_EXPORT", true, NAMED_GROUP_NONE), // renegotiation protection request signaling cipher suite - K_SCSV ("SCSV", true, false); + K_SCSV ("SCSV", true, NAMED_GROUP_NONE); // name of the key exchange algorithm, e.g. DHE_DSS final String name; final boolean allowed; - final boolean isEC; + final NamedGroupType groupType; private final boolean alwaysAvailable; - KeyExchange(String name, boolean allowed, boolean isEC) { + KeyExchange(String name, boolean allowed, NamedGroupType groupType) { this.name = name; this.allowed = allowed; - this.isEC = isEC; + this.groupType = groupType; this.alwaysAvailable = allowed && (!name.startsWith("EC")) && (!name.startsWith("KRB")); } @@ -417,7 +418,7 @@ final class CipherSuite implements Comparable { return true; } - if (isEC) { + if (groupType == NAMED_GROUP_ECDHE) { return (allowed && JsseJce.isEcAvailable()); } else if (name.startsWith("KRB")) { return (allowed && JsseJce.isKerberosAvailable()); diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuiteList.java b/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuiteList.java index a114f4acb83..025f40bda61 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuiteList.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuiteList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, 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,6 +30,7 @@ import java.io.*; import java.util.*; import javax.net.ssl.SSLException; +import static sun.security.ssl.NamedGroupType.*; /** * A list of CipherSuites. Also maintains the lists of supported and @@ -42,15 +43,16 @@ final class CipherSuiteList { private final Collection cipherSuites; private String[] suiteNames; - - // flag indicating whether this list contains any ECC ciphersuites. - // null if not yet checked. - private volatile Boolean containsEC; + private final EnumSet groupsTypes = + EnumSet.noneOf(NamedGroupType.class); // for use by buildAvailableCache() and // Handshaker.getKickstartMessage() only CipherSuiteList(Collection cipherSuites) { this.cipherSuites = cipherSuites; + for (CipherSuite suite : cipherSuites) { + updateGroupTypes(suite); + } } /** @@ -59,6 +61,7 @@ final class CipherSuiteList { CipherSuiteList(CipherSuite suite) { cipherSuites = new ArrayList(1); cipherSuites.add(suite); + updateGroupTypes(suite); } /** @@ -82,6 +85,7 @@ final class CipherSuiteList { + suiteName + " with currently installed providers"); } cipherSuites.add(suite); + updateGroupTypes(suite); } } @@ -97,7 +101,20 @@ final class CipherSuiteList { } cipherSuites = new ArrayList(bytes.length >> 1); for (int i = 0; i < bytes.length; i += 2) { - cipherSuites.add(CipherSuite.valueOf(bytes[i], bytes[i+1])); + CipherSuite suite = CipherSuite.valueOf(bytes[i], bytes[i+1]); + cipherSuites.add(suite); + updateGroupTypes(suite); + } + } + + // Please don't use this method except constructors. + private void updateGroupTypes(CipherSuite cipherSuite) { + if (cipherSuite.keyExchange != null && (!cipherSuite.exportable)) { + NamedGroupType groupType = cipherSuite.keyExchange.groupType; + if ((groupType != NAMED_GROUP_NONE) && + (!groupsTypes.contains(groupType))) { + groupsTypes.add(groupType); + } } } @@ -108,20 +125,9 @@ final class CipherSuiteList { return cipherSuites.contains(suite); } - // Return whether this list contains any ECC ciphersuites - boolean containsEC() { - if (containsEC == null) { - for (CipherSuite c : cipherSuites) { - if (c.keyExchange.isEC) { - containsEC = true; - return true; - } - } - - containsEC = false; - } - - return containsEC; + // Return whether this list contains cipher suites of a named group type. + boolean contains(NamedGroupType groupType) { + return groupsTypes.contains(groupType); } /** diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java index b95de5ecde2..1d6c74eab3a 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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 @@ -148,6 +148,10 @@ final class ClientHandshaker extends Handshaker { private static final boolean enableMFLExtension = Debug.getBooleanProperty("jsse.enableMFLExtension", false); + // To switch off the supported_groups extension for DHE cipher suite. + private static final boolean enableFFDHE = + Debug.getBooleanProperty("jsse.enableFFDHE", true); + // Whether an ALPN extension was sent in the ClientHello private boolean alpnActive = false; @@ -767,13 +771,15 @@ final class ClientHandshaker extends Handshaker { fatalSE(Alerts.alert_unexpected_message, "Server set " + type + " extension when not requested by client"); } - } else if ((type != ExtensionType.EXT_ELLIPTIC_CURVES) + } else if ((type != ExtensionType.EXT_SUPPORTED_GROUPS) && (type != ExtensionType.EXT_EC_POINT_FORMATS) && (type != ExtensionType.EXT_SERVER_NAME) && (type != ExtensionType.EXT_ALPN) && (type != ExtensionType.EXT_RENEGOTIATION_INFO) && (type != ExtensionType.EXT_STATUS_REQUEST) && (type != ExtensionType.EXT_STATUS_REQUEST_V2)) { + // Note: Better to check client requested extensions rather + // than all supported extensions. fatalSE(Alerts.alert_unsupported_extension, "Server sent an unsupported extension: " + type); } @@ -823,6 +829,17 @@ final class ClientHandshaker extends Handshaker { * our own D-H algorithm object so we can defer key calculations * until after we've sent the client key exchange message (which * gives client and server some useful parallelism). + * + * Note per section 3 of RFC 7919, if the server is not compatible with + * FFDHE specification, the client MAY decide to continue the connection + * if the selected DHE group is acceptable under local policy, or it MAY + * decide to terminate the connection with a fatal insufficient_security + * (71) alert. The algorithm constraints mechanism is JDK local policy + * used for additional DHE parameters checking. So this implementation + * does not check the server compatibility and just pass to the local + * algorithm constraints checking. The client will continue the + * connection if the server selected DHE group is acceptable by the + * specified algorithm constraints. */ private void serverKeyExchange(DH_ServerKeyExchange mesg) throws IOException { @@ -1495,14 +1512,17 @@ final class ClientHandshaker extends Handshaker { sslContext.getSecureRandom(), maxProtocolVersion, sessionId, cipherSuites, isDTLS); - // add elliptic curves and point format extensions - if (cipherSuites.containsEC()) { - EllipticCurvesExtension ece = - EllipticCurvesExtension.createExtension(algorithmConstraints); - if (ece != null) { - clientHelloMessage.extensions.add(ece); + // Add named groups extension for ECDHE and FFDHE if necessary. + SupportedGroupsExtension sge = + SupportedGroupsExtension.createExtension( + algorithmConstraints, + cipherSuites, enableFFDHE); + if (sge != null) { + clientHelloMessage.extensions.add(sge); + // Add elliptic point format extensions + if (cipherSuites.contains(NamedGroupType.NAMED_GROUP_ECDHE)) { clientHelloMessage.extensions.add( - EllipticPointFormatsExtension.DEFAULT); + EllipticPointFormatsExtension.DEFAULT); } } diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/DHCrypt.java b/jdk/src/java.base/share/classes/sun/security/ssl/DHCrypt.java index f7dadcaf66d..a9d4c2a37e4 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/DHCrypt.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/DHCrypt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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,14 +26,8 @@ package sun.security.ssl; -import java.util.Map; -import java.util.HashMap; -import java.util.Collections; -import java.util.regex.Pattern; -import java.util.regex.Matcher; import java.math.BigInteger; import java.security.*; -import java.io.IOException; import javax.net.ssl.SSLHandshakeException; import javax.crypto.SecretKey; import javax.crypto.KeyAgreement; @@ -101,7 +95,7 @@ final class DHCrypt { */ DHCrypt(int keyLength, SecureRandom random) { this(keyLength, - ParametersHolder.definedParams.get(keyLength), random); + PredefinedDHParameterSpecs.definedParams.get(keyLength), random); } /** @@ -115,6 +109,14 @@ final class DHCrypt { new DHParameterSpec(modulus, base), random); } + /** + * Generate a Diffie-Hellman keypair using the named group. + */ + DHCrypt(NamedGroup namedGroup, SecureRandom random) { + this(-1, // The length (-1) is not used in the implementation. + SupportedGroupsExtension.getDHParameterSpec(namedGroup), random); + } + /** * Generate a Diffie-Hellman keypair using the specified size and * parameters. @@ -272,266 +274,5 @@ final class DHCrypt { return null; } - - // lazy initialization holder class idiom for static default parameters - // - // See Effective Java Second Edition: Item 71. - private static class ParametersHolder { - private final static boolean debugIsOn = - (Debug.getInstance("ssl") != null) && Debug.isOn("sslctx"); - - // - // Default DH ephemeral parameters - // - private static final BigInteger p512 = new BigInteger( // generated - "D87780E15FF50B4ABBE89870188B049406B5BEA98AB23A02" + - "41D88EA75B7755E669C08093D3F0CA7FC3A5A25CF067DCB9" + - "A43DD89D1D90921C6328884461E0B6D3", 16); - private static final BigInteger p768 = new BigInteger( // RFC 2409 - "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" + - "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + - "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" + - "E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF", 16); - - private static final BigInteger p1024 = new BigInteger( // RFC 2409 - "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" + - "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + - "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" + - "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" + - "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381" + - "FFFFFFFFFFFFFFFF", 16); - private static final BigInteger p1536 = new BigInteger( // RFC 3526 - "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" + - "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + - "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" + - "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" + - "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" + - "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" + - "83655D23DCA3AD961C62F356208552BB9ED529077096966D" + - "670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF", 16); - private static final BigInteger p2048 = new BigInteger( // TLS FFDHE - "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" + - "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + - "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" + - "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + - "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" + - "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + - "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" + - "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + - "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" + - "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + - "886B423861285C97FFFFFFFFFFFFFFFF", 16); - private static final BigInteger p3072 = new BigInteger( // TLS FFDHE - "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" + - "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + - "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" + - "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + - "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" + - "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + - "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" + - "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + - "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" + - "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + - "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238" + - "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + - "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3" + - "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + - "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF" + - "3C1B20EE3FD59D7C25E41D2B66C62E37FFFFFFFFFFFFFFFF", 16); - private static final BigInteger p4096 = new BigInteger( // TLS FFDHE - "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" + - "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + - "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" + - "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + - "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" + - "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + - "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" + - "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + - "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" + - "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + - "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238" + - "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + - "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3" + - "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + - "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF" + - "3C1B20EE3FD59D7C25E41D2B669E1EF16E6F52C3164DF4FB" + - "7930E9E4E58857B6AC7D5F42D69F6D187763CF1D55034004" + - "87F55BA57E31CC7A7135C886EFB4318AED6A1E012D9E6832" + - "A907600A918130C46DC778F971AD0038092999A333CB8B7A" + - "1A1DB93D7140003C2A4ECEA9F98D0ACC0A8291CDCEC97DCF" + - "8EC9B55A7F88A46B4DB5A851F44182E1C68A007E5E655F6A" + - "FFFFFFFFFFFFFFFF", 16); - private static final BigInteger p6144 = new BigInteger( // TLS FFDHE - "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" + - "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + - "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" + - "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + - "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" + - "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + - "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" + - "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + - "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" + - "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + - "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238" + - "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + - "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3" + - "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + - "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF" + - "3C1B20EE3FD59D7C25E41D2B669E1EF16E6F52C3164DF4FB" + - "7930E9E4E58857B6AC7D5F42D69F6D187763CF1D55034004" + - "87F55BA57E31CC7A7135C886EFB4318AED6A1E012D9E6832" + - "A907600A918130C46DC778F971AD0038092999A333CB8B7A" + - "1A1DB93D7140003C2A4ECEA9F98D0ACC0A8291CDCEC97DCF" + - "8EC9B55A7F88A46B4DB5A851F44182E1C68A007E5E0DD902" + - "0BFD64B645036C7A4E677D2C38532A3A23BA4442CAF53EA6" + - "3BB454329B7624C8917BDD64B1C0FD4CB38E8C334C701C3A" + - "CDAD0657FCCFEC719B1F5C3E4E46041F388147FB4CFDB477" + - "A52471F7A9A96910B855322EDB6340D8A00EF092350511E3" + - "0ABEC1FFF9E3A26E7FB29F8C183023C3587E38DA0077D9B4" + - "763E4E4B94B2BBC194C6651E77CAF992EEAAC0232A281BF6" + - "B3A739C1226116820AE8DB5847A67CBEF9C9091B462D538C" + - "D72B03746AE77F5E62292C311562A846505DC82DB854338A" + - "E49F5235C95B91178CCF2DD5CACEF403EC9D1810C6272B04" + - "5B3B71F9DC6B80D63FDD4A8E9ADB1E6962A69526D43161C1" + - "A41D570D7938DAD4A40E329CD0E40E65FFFFFFFFFFFFFFFF", 16); - private static final BigInteger p8192 = new BigInteger( // TLS FFDHE - "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" + - "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + - "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" + - "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + - "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" + - "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + - "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" + - "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + - "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" + - "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + - "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238" + - "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + - "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3" + - "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + - "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF" + - "3C1B20EE3FD59D7C25E41D2B669E1EF16E6F52C3164DF4FB" + - "7930E9E4E58857B6AC7D5F42D69F6D187763CF1D55034004" + - "87F55BA57E31CC7A7135C886EFB4318AED6A1E012D9E6832" + - "A907600A918130C46DC778F971AD0038092999A333CB8B7A" + - "1A1DB93D7140003C2A4ECEA9F98D0ACC0A8291CDCEC97DCF" + - "8EC9B55A7F88A46B4DB5A851F44182E1C68A007E5E0DD902" + - "0BFD64B645036C7A4E677D2C38532A3A23BA4442CAF53EA6" + - "3BB454329B7624C8917BDD64B1C0FD4CB38E8C334C701C3A" + - "CDAD0657FCCFEC719B1F5C3E4E46041F388147FB4CFDB477" + - "A52471F7A9A96910B855322EDB6340D8A00EF092350511E3" + - "0ABEC1FFF9E3A26E7FB29F8C183023C3587E38DA0077D9B4" + - "763E4E4B94B2BBC194C6651E77CAF992EEAAC0232A281BF6" + - "B3A739C1226116820AE8DB5847A67CBEF9C9091B462D538C" + - "D72B03746AE77F5E62292C311562A846505DC82DB854338A" + - "E49F5235C95B91178CCF2DD5CACEF403EC9D1810C6272B04" + - "5B3B71F9DC6B80D63FDD4A8E9ADB1E6962A69526D43161C1" + - "A41D570D7938DAD4A40E329CCFF46AAA36AD004CF600C838" + - "1E425A31D951AE64FDB23FCEC9509D43687FEB69EDD1CC5E" + - "0B8CC3BDF64B10EF86B63142A3AB8829555B2F747C932665" + - "CB2C0F1CC01BD70229388839D2AF05E454504AC78B758282" + - "2846C0BA35C35F5C59160CC046FD8251541FC68C9C86B022" + - "BB7099876A460E7451A8A93109703FEE1C217E6C3826E52C" + - "51AA691E0E423CFC99E9E31650C1217B624816CDAD9A95F9" + - "D5B8019488D9C0A0A1FE3075A577E23183F81D4A3F2FA457" + - "1EFC8CE0BA8A4FE8B6855DFE72B0A66EDED2FBABFBE58A30" + - "FAFABE1C5D71A87E2F741EF8C1FE86FEA6BBFDE530677F0D" + - "97D11D49F7A8443D0822E506A9F4614E011E2A94838FF88C" + - "D68C8BB7C5C6424CFFFFFFFFFFFFFFFF", 16); - - private static final BigInteger[] supportedPrimes = { - p512, p768, p1024, p1536, p2048, p3072, p4096, p6144, p8192}; - - // a measure of the uncertainty that prime modulus p is not a prime - // - // see BigInteger.isProbablePrime(int certainty) - private final static int PRIME_CERTAINTY = 120; - - // the known security property, jdk.tls.server.defaultDHEParameters - private final static String PROPERTY_NAME = - "jdk.tls.server.defaultDHEParameters"; - - private static final Pattern spacesPattern = Pattern.compile("\\s+"); - - private final static Pattern syntaxPattern = Pattern.compile( - "(\\{[0-9A-Fa-f]+,[0-9A-Fa-f]+\\})" + - "(,\\{[0-9A-Fa-f]+,[0-9A-Fa-f]+\\})*"); - - private static final Pattern paramsPattern = Pattern.compile( - "\\{([0-9A-Fa-f]+),([0-9A-Fa-f]+)\\}"); - - // cache of predefined default DH ephemeral parameters - private final static Map definedParams; - - static { - String property = AccessController.doPrivileged( - new PrivilegedAction() { - public String run() { - return Security.getProperty(PROPERTY_NAME); - } - }); - - if (property != null && !property.isEmpty()) { - // remove double quote marks from beginning/end of the property - if (property.length() >= 2 && property.charAt(0) == '"' && - property.charAt(property.length() - 1) == '"') { - property = property.substring(1, property.length() - 1); - } - - property = property.trim(); - } - - if (property != null && !property.isEmpty()) { - Matcher spacesMatcher = spacesPattern.matcher(property); - property = spacesMatcher.replaceAll(""); - - if (debugIsOn) { - System.out.println("The Security Property " + - PROPERTY_NAME + ": " + property); - } - } - - Map defaultParams = new HashMap<>(); - if (property != null && !property.isEmpty()) { - Matcher syntaxMatcher = syntaxPattern.matcher(property); - if (syntaxMatcher.matches()) { - Matcher paramsFinder = paramsPattern.matcher(property); - while(paramsFinder.find()) { - String primeModulus = paramsFinder.group(1); - BigInteger p = new BigInteger(primeModulus, 16); - if (!p.isProbablePrime(PRIME_CERTAINTY)) { - if (debugIsOn) { - System.out.println( - "Prime modulus p in Security Property, " + - PROPERTY_NAME + ", is not a prime: " + - primeModulus); - } - - continue; - } - - String baseGenerator = paramsFinder.group(2); - BigInteger g = new BigInteger(baseGenerator, 16); - - DHParameterSpec spec = new DHParameterSpec(p, g); - int primeLen = p.bitLength(); - defaultParams.put(primeLen, spec); - } - } else if (debugIsOn) { - System.out.println("Invalid Security Property, " + - PROPERTY_NAME + ", definition"); - } - } - - for (BigInteger p : supportedPrimes) { - int primeLen = p.bitLength(); - defaultParams.putIfAbsent(primeLen, - new DHParameterSpec(p, BigInteger.TWO)); - } - - definedParams = - Collections.unmodifiableMap( - defaultParams); - } - } } + diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/ECDHCrypt.java b/jdk/src/java.base/share/classes/sun/security/ssl/ECDHCrypt.java index 929c592d698..7e4f5932a58 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/ECDHCrypt.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/ECDHCrypt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -56,17 +56,17 @@ final class ECDHCrypt { } // Called by ServerHandshaker for ephemeral ECDH - ECDHCrypt(int curveId, SecureRandom random) { + ECDHCrypt(NamedGroup namedGroup, SecureRandom random) { try { KeyPairGenerator kpg = JsseJce.getKeyPairGenerator("EC"); ECGenParameterSpec params = - EllipticCurvesExtension.getECGenParamSpec(curveId); + SupportedGroupsExtension.getECGenParamSpec(namedGroup); kpg.initialize(params, random); KeyPair kp = kpg.generateKeyPair(); privateKey = kp.getPrivate(); publicKey = (ECPublicKey)kp.getPublic(); } catch (GeneralSecurityException e) { - throw new RuntimeException("Could not generate DH keypair", e); + throw new RuntimeException("Could not generate ECDH keypair", e); } } @@ -79,7 +79,7 @@ final class ECDHCrypt { privateKey = kp.getPrivate(); publicKey = (ECPublicKey)kp.getPublic(); } catch (GeneralSecurityException e) { - throw new RuntimeException("Could not generate DH keypair", e); + throw new RuntimeException("Could not generate ECDH keypair", e); } } diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/EllipticCurvesExtension.java b/jdk/src/java.base/share/classes/sun/security/ssl/EllipticCurvesExtension.java deleted file mode 100644 index c91b25e72ef..00000000000 --- a/jdk/src/java.base/share/classes/sun/security/ssl/EllipticCurvesExtension.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.security.ssl; - -import java.io.IOException; -import java.security.spec.ECParameterSpec; -import java.security.spec.ECGenParameterSpec; -import java.security.spec.InvalidParameterSpecException; -import java.security.AlgorithmParameters; -import java.security.AlgorithmConstraints; -import java.security.CryptoPrimitive; -import java.security.AccessController; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Map; -import java.util.ArrayList; -import javax.net.ssl.SSLProtocolException; - -import sun.security.action.GetPropertyAction; - -final class EllipticCurvesExtension extends HelloExtension { - - /* Class and subclass dynamic debugging support */ - private static final Debug debug = Debug.getInstance("ssl"); - - private static final int ARBITRARY_PRIME = 0xff01; - private static final int ARBITRARY_CHAR2 = 0xff02; - - // speed up the searching - private static final Map oidToIdMap = new HashMap<>(); - private static final Map idToOidMap = new HashMap<>(); - - // speed up the parameters construction - private static final Map idToParams = new HashMap<>(); - - // the supported elliptic curves - private static final int[] supportedCurveIds; - - // the curves of the extension - private final int[] curveIds; - - // See sun.security.util.CurveDB for the OIDs - private static enum NamedEllipticCurve { - T163_K1(1, "sect163k1", "1.3.132.0.1", true), // NIST K-163 - T163_R1(2, "sect163r1", "1.3.132.0.2", false), - T163_R2(3, "sect163r2", "1.3.132.0.15", true), // NIST B-163 - T193_R1(4, "sect193r1", "1.3.132.0.24", false), - T193_R2(5, "sect193r2", "1.3.132.0.25", false), - T233_K1(6, "sect233k1", "1.3.132.0.26", true), // NIST K-233 - T233_R1(7, "sect233r1", "1.3.132.0.27", true), // NIST B-233 - T239_K1(8, "sect239k1", "1.3.132.0.3", false), - T283_K1(9, "sect283k1", "1.3.132.0.16", true), // NIST K-283 - T283_R1(10, "sect283r1", "1.3.132.0.17", true), // NIST B-283 - T409_K1(11, "sect409k1", "1.3.132.0.36", true), // NIST K-409 - T409_R1(12, "sect409r1", "1.3.132.0.37", true), // NIST B-409 - T571_K1(13, "sect571k1", "1.3.132.0.38", true), // NIST K-571 - T571_R1(14, "sect571r1", "1.3.132.0.39", true), // NIST B-571 - - P160_K1(15, "secp160k1", "1.3.132.0.9", false), - P160_R1(16, "secp160r1", "1.3.132.0.8", false), - P160_R2(17, "secp160r2", "1.3.132.0.30", false), - P192_K1(18, "secp192k1", "1.3.132.0.31", false), - P192_R1(19, "secp192r1", "1.2.840.10045.3.1.1", true), // NIST P-192 - P224_K1(20, "secp224k1", "1.3.132.0.32", false), - P224_R1(21, "secp224r1", "1.3.132.0.33", true), // NIST P-224 - P256_K1(22, "secp256k1", "1.3.132.0.10", false), - P256_R1(23, "secp256r1", "1.2.840.10045.3.1.7", true), // NIST P-256 - P384_R1(24, "secp384r1", "1.3.132.0.34", true), // NIST P-384 - P521_R1(25, "secp521r1", "1.3.132.0.35", true); // NIST P-521 - - int id; - String name; - String oid; - boolean isFips; - - NamedEllipticCurve(int id, String name, String oid, boolean isFips) { - this.id = id; - this.name = name; - this.oid = oid; - this.isFips = isFips; - - if (oidToIdMap.put(oid, id) != null || - idToOidMap.put(id, oid) != null) { - - throw new RuntimeException( - "Duplicate named elliptic curve definition: " + name); - } - } - - static NamedEllipticCurve getCurve(String name, boolean requireFips) { - for (NamedEllipticCurve curve : NamedEllipticCurve.values()) { - if (curve.name.equals(name) && (!requireFips || curve.isFips)) { - return curve; - } - } - - return null; - } - } - - static { - boolean requireFips = SunJSSE.isFIPS(); - - // hack code to initialize NamedEllipticCurve - NamedEllipticCurve nec = - NamedEllipticCurve.getCurve("secp256r1", false); - - // The value of the System Property defines a list of enabled named - // curves in preference order, separated with comma. For example: - // - // jdk.tls.namedGroups="secp521r1, secp256r1, secp384r1" - // - // If the System Property is not defined or the value is empty, the - // default curves and preferences will be used. - String property = AccessController.doPrivileged( - new GetPropertyAction("jdk.tls.namedGroups")); - if (property != null && property.length() != 0) { - // remove double quote marks from beginning/end of the property - if (property.length() > 1 && property.charAt(0) == '"' && - property.charAt(property.length() - 1) == '"') { - property = property.substring(1, property.length() - 1); - } - } - - ArrayList idList; - if (property != null && property.length() != 0) { // customized curves - String[] curves = property.split(","); - idList = new ArrayList<>(curves.length); - for (String curve : curves) { - curve = curve.trim(); - if (!curve.isEmpty()) { - NamedEllipticCurve namedCurve = - NamedEllipticCurve.getCurve(curve, requireFips); - if (namedCurve != null) { - if (isAvailableCurve(namedCurve.id)) { - idList.add(namedCurve.id); - } - } // ignore unknown curves - } - } - if (idList.isEmpty() && JsseJce.isEcAvailable()) { - throw new IllegalArgumentException( - "System property jdk.tls.namedGroups(" + property + ") " + - "contains no supported elliptic curves"); - } - } else { // default curves - int[] ids; - if (requireFips) { - ids = new int[] { - // only NIST curves in FIPS mode - 23, 24, 25, 9, 10, 11, 12, 13, 14, - }; - } else { - ids = new int[] { - // NIST curves first - 23, 24, 25, 9, 10, 11, 12, 13, 14, - // non-NIST curves - 22, - }; - } - - idList = new ArrayList<>(ids.length); - for (int curveId : ids) { - if (isAvailableCurve(curveId)) { - idList.add(curveId); - } - } - } - - if (debug != null && idList.isEmpty()) { - Debug.log( - "Initialized [jdk.tls.namedGroups|default] list contains " + - "no available elliptic curves. " + - (property != null ? "(" + property + ")" : "[Default]")); - } - - supportedCurveIds = new int[idList.size()]; - int i = 0; - for (Integer id : idList) { - supportedCurveIds[i++] = id; - } - } - - // check whether the curve is supported by the underlying providers - private static boolean isAvailableCurve(int curveId) { - String oid = idToOidMap.get(curveId); - if (oid != null) { - AlgorithmParameters params = null; - try { - params = JsseJce.getAlgorithmParameters("EC"); - params.init(new ECGenParameterSpec(oid)); - } catch (Exception e) { - return false; - } - - // cache the parameters - idToParams.put(curveId, params); - - return true; - } - - return false; - } - - private EllipticCurvesExtension(int[] curveIds) { - super(ExtensionType.EXT_ELLIPTIC_CURVES); - - this.curveIds = curveIds; - } - - EllipticCurvesExtension(HandshakeInStream s, int len) - throws IOException { - super(ExtensionType.EXT_ELLIPTIC_CURVES); - - int k = s.getInt16(); - if (((len & 1) != 0) || (k + 2 != len)) { - throw new SSLProtocolException("Invalid " + type + " extension"); - } - - // Note: unknown curves will be ignored later. - curveIds = new int[k >> 1]; - for (int i = 0; i < curveIds.length; i++) { - curveIds[i] = s.getInt16(); - } - } - - // get the preferred active curve - static int getActiveCurves(AlgorithmConstraints constraints) { - return getPreferredCurve(supportedCurveIds, constraints); - } - - static boolean hasActiveCurves(AlgorithmConstraints constraints) { - return getActiveCurves(constraints) >= 0; - } - - static EllipticCurvesExtension createExtension( - AlgorithmConstraints constraints) { - - ArrayList idList = new ArrayList<>(supportedCurveIds.length); - for (int curveId : supportedCurveIds) { - if (constraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - "EC", idToParams.get(curveId))) { - idList.add(curveId); - } - } - - if (!idList.isEmpty()) { - int[] ids = new int[idList.size()]; - int i = 0; - for (Integer id : idList) { - ids[i++] = id; - } - - return new EllipticCurvesExtension(ids); - } - - return null; - } - - // get the preferred activated curve - int getPreferredCurve(AlgorithmConstraints constraints) { - return getPreferredCurve(curveIds, constraints); - } - - // get a preferred activated curve - private static int getPreferredCurve(int[] curves, - AlgorithmConstraints constraints) { - for (int curveId : curves) { - if (isSupported(curveId) && constraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - "EC", idToParams.get(curveId))) { - return curveId; - } - } - - return -1; - } - - boolean contains(int index) { - for (int curveId : curveIds) { - if (index == curveId) { - return true; - } - } - return false; - } - - @Override - int length() { - return 6 + (curveIds.length << 1); - } - - @Override - void send(HandshakeOutStream s) throws IOException { - s.putInt16(type.id); - int k = curveIds.length << 1; - s.putInt16(k + 2); - s.putInt16(k); - for (int curveId : curveIds) { - s.putInt16(curveId); - } - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("Extension " + type + ", curve names: {"); - boolean first = true; - for (int curveId : curveIds) { - if (first) { - first = false; - } else { - sb.append(", "); - } - // first check if it is a known named curve, then try other cases. - String curveName = getCurveName(curveId); - if (curveName != null) { - sb.append(curveName); - } else if (curveId == ARBITRARY_PRIME) { - sb.append("arbitrary_explicit_prime_curves"); - } else if (curveId == ARBITRARY_CHAR2) { - sb.append("arbitrary_explicit_char2_curves"); - } else { - sb.append("unknown curve " + curveId); - } - } - sb.append("}"); - return sb.toString(); - } - - // Test whether the given curve is supported. - static boolean isSupported(int index) { - for (int curveId : supportedCurveIds) { - if (index == curveId) { - return true; - } - } - - return false; - } - - static int getCurveIndex(ECParameterSpec params) { - String oid = JsseJce.getNamedCurveOid(params); - if (oid == null) { - return -1; - } - Integer n = oidToIdMap.get(oid); - return (n == null) ? -1 : n; - } - - static String getCurveOid(int index) { - return idToOidMap.get(index); - } - - static ECGenParameterSpec getECGenParamSpec(int index) { - AlgorithmParameters params = idToParams.get(index); - try { - return params.getParameterSpec(ECGenParameterSpec.class); - } catch (InvalidParameterSpecException ipse) { - // should be unlikely - String curveOid = getCurveOid(index); - return new ECGenParameterSpec(curveOid); - } - } - - private static String getCurveName(int index) { - for (NamedEllipticCurve namedCurve : NamedEllipticCurve.values()) { - if (namedCurve.id == index) { - return namedCurve.name; - } - } - - return null; - } -} diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/ExtensionType.java b/jdk/src/java.base/share/classes/sun/security/ssl/ExtensionType.java index be64dfde624..5338807bbdc 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/ExtensionType.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/ExtensionType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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 @@ -82,9 +82,9 @@ final class ExtensionType { static final ExtensionType EXT_CERT_TYPE = e(0x0009, "cert_type"); // IANA registry value: 9 - // extensions defined in RFC 4492 (ECC) - static final ExtensionType EXT_ELLIPTIC_CURVES = - e(0x000A, "elliptic_curves"); // IANA registry value: 10 + // extensions defined in RFC 4492 (ECC) and RFC 7919 (FFDHE) + static final ExtensionType EXT_SUPPORTED_GROUPS = + e(0x000A, "supported_groups"); // IANA registry value: 10 static final ExtensionType EXT_EC_POINT_FORMATS = e(0x000B, "ec_point_formats"); // IANA registry value: 11 diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java index 4717fbba178..8477456c4d5 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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 @@ -1369,8 +1369,9 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange { private static final int CURVE_EXPLICIT_CHAR2 = 2; private static final int CURVE_NAMED_CURVE = 3; - // id of the curve we are using - private int curveId; + // id of the named group we are using + private int groupId; + // encoded public point private byte[] pointBytes; @@ -1389,7 +1390,8 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange { ECDH_ServerKeyExchange(ECDHCrypt obj, PrivateKey privateKey, byte[] clntNonce, byte[] svrNonce, SecureRandom sr, SignatureAndHashAlgorithm signAlgorithm, - ProtocolVersion protocolVersion) throws GeneralSecurityException { + ProtocolVersion protocolVersion) + throws SSLHandshakeException, GeneralSecurityException { this.protocolVersion = protocolVersion; @@ -1397,7 +1399,14 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange { ECParameterSpec params = publicKey.getParams(); ECPoint point = publicKey.getW(); pointBytes = JsseJce.encodePoint(point, params.getCurve()); - curveId = EllipticCurvesExtension.getCurveIndex(params); + + NamedGroup namedGroup = NamedGroup.valueOf(params); + if ((namedGroup == null) || (namedGroup.oid == null) ){ + // unlikely + throw new SSLHandshakeException( + "Unnamed EC parameter spec: " + params); + } + groupId = namedGroup.id; if (privateKey == null) { // ECDH_anon @@ -1434,20 +1443,27 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange { // These parsing errors should never occur as we negotiated // the supported curves during the exchange of the Hello messages. if (curveType == CURVE_NAMED_CURVE) { - curveId = input.getInt16(); - if (!EllipticCurvesExtension.isSupported(curveId)) { + groupId = input.getInt16(); + NamedGroup namedGroup = NamedGroup.valueOf(groupId); + if (namedGroup == null) { throw new SSLHandshakeException( - "Unsupported curveId: " + curveId); + "Unknown named group ID: " + groupId); } - String curveOid = EllipticCurvesExtension.getCurveOid(curveId); - if (curveOid == null) { + + if (!SupportedGroupsExtension.supports(namedGroup)) { throw new SSLHandshakeException( - "Unknown named curve: " + curveId); + "Unsupported named group: " + namedGroup); } - parameters = JsseJce.getECParameterSpec(curveOid); + + if (namedGroup.oid == null) { + throw new SSLHandshakeException( + "Unknown named EC curve: " + namedGroup); + } + + parameters = JsseJce.getECParameterSpec(namedGroup.oid); if (parameters == null) { throw new SSLHandshakeException( - "Unsupported curve: " + curveOid); + "No supported EC parameter for named group: " + namedGroup); } } else { throw new SSLHandshakeException( @@ -1530,8 +1546,8 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange { sig.update(svrNonce); sig.update((byte)CURVE_NAMED_CURVE); - sig.update((byte)(curveId >> 8)); - sig.update((byte)curveId); + sig.update((byte)(groupId >> 8)); + sig.update((byte)groupId); sig.update((byte)pointBytes.length); sig.update(pointBytes); } @@ -1552,7 +1568,7 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange { @Override void send(HandshakeOutStream s) throws IOException { s.putInt8(CURVE_NAMED_CURVE); - s.putInt16(curveId); + s.putInt16(groupId); s.putBytes8(pointBytes); if (signatureBytes != null) { diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java b/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java index f830bc70ce1..e26495b3c5f 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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 @@ -52,6 +52,7 @@ import sun.security.ssl.CipherSuite.*; import static sun.security.ssl.CipherSuite.PRF.*; import static sun.security.ssl.CipherSuite.CipherType.*; +import static sun.security.ssl.NamedGroupType.*; /** * Handshaker ... processes handshake records from an SSL V3.0 @@ -685,42 +686,14 @@ abstract class Handshaker { ArrayList suites = new ArrayList<>(); if (!(activeProtocols.collection().isEmpty()) && activeProtocols.min.v != ProtocolVersion.NONE.v) { - boolean checkedCurves = false; - boolean hasCurves = false; + Map cachedStatus = + new EnumMap<>(NamedGroupType.class); for (CipherSuite suite : enabledCipherSuites.collection()) { - if (!activeProtocols.min.obsoletes(suite) && + if (suite.isAvailable() && + (!activeProtocols.min.obsoletes(suite)) && activeProtocols.max.supports(suite)) { - if (algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - suite.name, null)) { - - boolean available = true; - if (suite.keyExchange.isEC) { - if (!checkedCurves) { - hasCurves = EllipticCurvesExtension - .hasActiveCurves(algorithmConstraints); - checkedCurves = true; - - if (!hasCurves && debug != null && - Debug.isOn("verbose")) { - System.out.println( - "No available elliptic curves"); - } - } - - available = hasCurves; - - if (!available && debug != null && - Debug.isOn("verbose")) { - System.out.println( - "No active elliptic curves, ignore " + - suite); - } - } - - if (available) { - suites.add(suite); - } + if (isActivatable(suite, cachedStatus)) { + suites.add(suite); } } else if (debug != null && Debug.isOn("verbose")) { if (activeProtocols.min.obsoletes(suite)) { @@ -779,46 +752,15 @@ abstract class Handshaker { } boolean found = false; + Map cachedStatus = + new EnumMap<>(NamedGroupType.class); for (CipherSuite suite : enabledCipherSuites.collection()) { if (suite.isAvailable() && (!protocol.obsoletes(suite)) && protocol.supports(suite)) { - if (algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - suite.name, null)) { - - boolean available = true; - if (suite.keyExchange.isEC) { - if (!checkedCurves) { - hasCurves = EllipticCurvesExtension - .hasActiveCurves(algorithmConstraints); - checkedCurves = true; - - if (!hasCurves && debug != null && - Debug.isOn("verbose")) { - System.out.println( - "No activated elliptic curves"); - } - } - - available = hasCurves; - - if (!available && debug != null && - Debug.isOn("verbose")) { - System.out.println( - "No active elliptic curves, ignore " + - suite + " for " + protocol); - } - } - - if (available) { - protocols.add(protocol); - found = true; - break; - } - } else if (debug != null && Debug.isOn("verbose")) { - System.out.println( - "Ignoring disabled cipher suite: " + suite + - " for " + protocol); + if (isActivatable(suite, cachedStatus)) { + protocols.add(protocol); + found = true; + break; } } else if (debug != null && Debug.isOn("verbose")) { System.out.println( @@ -826,6 +768,7 @@ abstract class Handshaker { " for " + protocol); } } + if (!found && (debug != null) && Debug.isOn("handshake")) { System.out.println( "No available cipher suite for " + protocol); @@ -842,6 +785,43 @@ abstract class Handshaker { return activeProtocols; } + private boolean isActivatable(CipherSuite suite, + Map cachedStatus) { + + if (algorithmConstraints.permits( + EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), suite.name, null)) { + boolean available = true; + NamedGroupType groupType = suite.keyExchange.groupType; + if (groupType != NAMED_GROUP_NONE) { + Boolean checkedStatus = cachedStatus.get(groupType); + if (checkedStatus == null) { + available = SupportedGroupsExtension.isActivatable( + algorithmConstraints, groupType); + cachedStatus.put(groupType, available); + + if (!available && debug != null && Debug.isOn("verbose")) { + System.out.println("No activated named group"); + } + } else { + available = checkedStatus.booleanValue(); + } + + if (!available && debug != null && Debug.isOn("verbose")) { + System.out.println( + "No active named group, ignore " + suite); + } + + return available; + } else { + return true; + } + } else if (debug != null && Debug.isOn("verbose")) { + System.out.println("Ignoring disabled cipher suite: " + suite); + } + + return false; + } + /** * As long as handshaking has not activated, we can * change whether session creations are allowed. diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/HelloExtensions.java b/jdk/src/java.base/share/classes/sun/security/ssl/HelloExtensions.java index f831db12391..82975c962f5 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/HelloExtensions.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/HelloExtensions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, 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,7 +49,7 @@ import javax.net.ssl.*; * explicitly support. * . ServerNameExtension: the server_name extension. * . SignatureAlgorithmsExtension: the signature_algorithms extension. - * . EllipticCurvesExtension: the ECC supported curves extension. + * . SupportedGroupsExtension: the supported groups extension. * . EllipticPointFormatsExtension: the ECC supported point formats * (compressed/uncompressed) extension. * . ALPNExtension: the application_layer_protocol_negotiation extension. @@ -79,8 +79,8 @@ final class HelloExtensions { extension = new ServerNameExtension(s, extlen); } else if (extType == ExtensionType.EXT_SIGNATURE_ALGORITHMS) { extension = new SignatureAlgorithmsExtension(s, extlen); - } else if (extType == ExtensionType.EXT_ELLIPTIC_CURVES) { - extension = new EllipticCurvesExtension(s, extlen); + } else if (extType == ExtensionType.EXT_SUPPORTED_GROUPS) { + extension = new SupportedGroupsExtension(s, extlen); } else if (extType == ExtensionType.EXT_EC_POINT_FORMATS) { extension = new EllipticPointFormatsExtension(s, extlen); } else if (extType == ExtensionType.EXT_RENEGOTIATION_INFO) { diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/NamedGroup.java b/jdk/src/java.base/share/classes/sun/security/ssl/NamedGroup.java new file mode 100644 index 00000000000..452e839a205 --- /dev/null +++ b/jdk/src/java.base/share/classes/sun/security/ssl/NamedGroup.java @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ssl; + +import java.security.spec.ECParameterSpec; +import java.security.spec.ECGenParameterSpec; +import static sun.security.ssl.NamedGroupType.*; + +enum NamedGroup { + // Elliptic Curves (RFC 4492) + // + // See sun.security.util.CurveDB for the OIDs + + // NIST K-163 + SECT163_K1(1, NAMED_GROUP_ECDHE, "sect163k1", "1.3.132.0.1", true), + + SECT163_R1(2, NAMED_GROUP_ECDHE, "sect163r1", "1.3.132.0.2", false), + + // NIST B-163 + SECT163_R2(3, NAMED_GROUP_ECDHE, "sect163r2", "1.3.132.0.15", true), + + SECT193_R1(4, NAMED_GROUP_ECDHE, "sect193r1", "1.3.132.0.24", false), + SECT193_R2(5, NAMED_GROUP_ECDHE, "sect193r2", "1.3.132.0.25", false), + + // NIST K-233 + SECT233_K1(6, NAMED_GROUP_ECDHE, "sect233k1", "1.3.132.0.26", true), + + // NIST B-233 + SECT233_R1(7, NAMED_GROUP_ECDHE, "sect233r1", "1.3.132.0.27", true), + + SECT239_K1(8, NAMED_GROUP_ECDHE, "sect239k1", "1.3.132.0.3", false), + + // NIST K-283 + SECT283_K1(9, NAMED_GROUP_ECDHE, "sect283k1", "1.3.132.0.16", true), + + // NIST B-283 + SECT283_R1(10, NAMED_GROUP_ECDHE, "sect283r1", "1.3.132.0.17", true), + + // NIST K-409 + SECT409_K1(11, NAMED_GROUP_ECDHE, "sect409k1", "1.3.132.0.36", true), + + // NIST B-409 + SECT409_R1(12, NAMED_GROUP_ECDHE, "sect409r1", "1.3.132.0.37", true), + + // NIST K-571 + SECT571_K1(13, NAMED_GROUP_ECDHE, "sect571k1", "1.3.132.0.38", true), + + // NIST B-571 + SECT571_R1(14, NAMED_GROUP_ECDHE, "sect571r1", "1.3.132.0.39", true), + + SECP160_K1(15, NAMED_GROUP_ECDHE, "secp160k1", "1.3.132.0.9", false), + SECP160_R1(16, NAMED_GROUP_ECDHE, "secp160r1", "1.3.132.0.8", false), + SECP160_R2(17, NAMED_GROUP_ECDHE, "secp160r2", "1.3.132.0.30", false), + SECP192_K1(18, NAMED_GROUP_ECDHE, "secp192k1", "1.3.132.0.31", false), + + // NIST P-192 + SECP192_R1(19, NAMED_GROUP_ECDHE, "secp192r1", "1.2.840.10045.3.1.1", true), + + SECP224_K1(20, NAMED_GROUP_ECDHE, "secp224k1", "1.3.132.0.32", false), + // NIST P-224 + SECP224_R1(21, NAMED_GROUP_ECDHE, "secp224r1", "1.3.132.0.33", true), + + SECP256_K1(22, NAMED_GROUP_ECDHE, "secp256k1", "1.3.132.0.10", false), + + // NIST P-256 + SECP256_R1(23, NAMED_GROUP_ECDHE, "secp256r1", "1.2.840.10045.3.1.7", true), + + // NIST P-384 + SECP384_R1(24, NAMED_GROUP_ECDHE, "secp384r1", "1.3.132.0.34", true), + + // NIST P-521 + SECP521_R1(25, NAMED_GROUP_ECDHE, "secp521r1", "1.3.132.0.35", true), + + // Finite Field Diffie-Hellman Ephemeral Parameters (RFC 7919) + FFDHE_2048(256, NAMED_GROUP_FFDHE, "ffdhe2048", true), + FFDHE_3072(257, NAMED_GROUP_FFDHE, "ffdhe3072", true), + FFDHE_4096(258, NAMED_GROUP_FFDHE, "ffdhe4096", true), + FFDHE_6144(259, NAMED_GROUP_FFDHE, "ffdhe6144", true), + FFDHE_8192(260, NAMED_GROUP_FFDHE, "ffdhe8192", true); + + int id; + NamedGroupType type; + String name; + String oid; + String algorithm; + boolean isFips; + + // Constructor used for Elliptic Curve Groups (ECDHE) + NamedGroup(int id, NamedGroupType type, + String name, String oid, boolean isFips) { + this.id = id; + this.type = type; + this.name = name; + this.oid = oid; + this.algorithm = "EC"; + this.isFips = isFips; + } + + // Constructor used for Finite Field Diffie-Hellman Groups (FFDHE) + NamedGroup(int id, NamedGroupType type, String name, boolean isFips) { + this.id = id; + this.type = type; + this.name = name; + this.oid = null; + this.algorithm = "DiffieHellman"; + this.isFips = isFips; + } + + static NamedGroup valueOf(int id) { + for (NamedGroup group : NamedGroup.values()) { + if (group.id == id) { + return group; + } + } + + return null; + } + + static NamedGroup nameOf(String name) { + for (NamedGroup group : NamedGroup.values()) { + if (group.name.equals(name)) { + return group; + } + } + + return null; + } + + static NamedGroup valueOf(ECParameterSpec params) { + String oid = JsseJce.getNamedCurveOid(params); + if ((oid != null) && (!oid.isEmpty())) { + for (NamedGroup group : NamedGroup.values()) { + if (oid.equals(group.oid)) { + return group; + } + } + } + + return null; + } + + @Override + public String toString() { + return this.name; + } +} diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/NamedGroupType.java b/jdk/src/java.base/share/classes/sun/security/ssl/NamedGroupType.java new file mode 100644 index 00000000000..0e0c982e4a2 --- /dev/null +++ b/jdk/src/java.base/share/classes/sun/security/ssl/NamedGroupType.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ssl; + +enum NamedGroupType { + NAMED_GROUP_ECDHE, // Elliptic Curve Groups (ECDHE) + NAMED_GROUP_FFDHE, // Finite Field Groups (DHE) + NAMED_GROUP_NONE // No predefined named group +} diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/PredefinedDHParameterSpecs.java b/jdk/src/java.base/share/classes/sun/security/ssl/PredefinedDHParameterSpecs.java new file mode 100644 index 00000000000..54d8c7d3109 --- /dev/null +++ b/jdk/src/java.base/share/classes/sun/security/ssl/PredefinedDHParameterSpecs.java @@ -0,0 +1,314 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ssl; + +import java.security.*; +import java.math.BigInteger; +import java.util.regex.Pattern; +import java.util.regex.Matcher; +import java.util.Map; +import java.util.HashMap; +import java.util.Collections; +import javax.crypto.spec.DHParameterSpec; + +/** + * Predefined default DH ephemeral parameters. + */ +final class PredefinedDHParameterSpecs { + private final static boolean debugIsOn = + (Debug.getInstance("ssl") != null) && Debug.isOn("sslctx"); + + // + // Default DH ephemeral parameters + // + private static final BigInteger p512 = new BigInteger( // generated + "D87780E15FF50B4ABBE89870188B049406B5BEA98AB23A02" + + "41D88EA75B7755E669C08093D3F0CA7FC3A5A25CF067DCB9" + + "A43DD89D1D90921C6328884461E0B6D3", 16); + private static final BigInteger p768 = new BigInteger( // RFC 2409 + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" + + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" + + "E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF", 16); + + private static final BigInteger p1024 = new BigInteger( // RFC 2409 + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" + + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" + + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" + + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381" + + "FFFFFFFFFFFFFFFF", 16); + private static final BigInteger p1536 = new BigInteger( // RFC 3526 + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" + + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" + + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" + + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" + + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" + + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" + + "670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF", 16); + private static final BigInteger p2048 = new BigInteger( // TLS FFDHE + "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" + + "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + + "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" + + "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + + "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" + + "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + + "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" + + "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + + "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" + + "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + + "886B423861285C97FFFFFFFFFFFFFFFF", 16); + private static final BigInteger p3072 = new BigInteger( // TLS FFDHE + "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" + + "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + + "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" + + "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + + "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" + + "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + + "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" + + "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + + "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" + + "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + + "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238" + + "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + + "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3" + + "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + + "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF" + + "3C1B20EE3FD59D7C25E41D2B66C62E37FFFFFFFFFFFFFFFF", 16); + private static final BigInteger p4096 = new BigInteger( // TLS FFDHE + "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" + + "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + + "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" + + "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + + "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" + + "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + + "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" + + "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + + "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" + + "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + + "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238" + + "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + + "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3" + + "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + + "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF" + + "3C1B20EE3FD59D7C25E41D2B669E1EF16E6F52C3164DF4FB" + + "7930E9E4E58857B6AC7D5F42D69F6D187763CF1D55034004" + + "87F55BA57E31CC7A7135C886EFB4318AED6A1E012D9E6832" + + "A907600A918130C46DC778F971AD0038092999A333CB8B7A" + + "1A1DB93D7140003C2A4ECEA9F98D0ACC0A8291CDCEC97DCF" + + "8EC9B55A7F88A46B4DB5A851F44182E1C68A007E5E655F6A" + + "FFFFFFFFFFFFFFFF", 16); + private static final BigInteger p6144 = new BigInteger( // TLS FFDHE + "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" + + "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + + "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" + + "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + + "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" + + "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + + "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" + + "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + + "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" + + "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + + "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238" + + "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + + "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3" + + "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + + "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF" + + "3C1B20EE3FD59D7C25E41D2B669E1EF16E6F52C3164DF4FB" + + "7930E9E4E58857B6AC7D5F42D69F6D187763CF1D55034004" + + "87F55BA57E31CC7A7135C886EFB4318AED6A1E012D9E6832" + + "A907600A918130C46DC778F971AD0038092999A333CB8B7A" + + "1A1DB93D7140003C2A4ECEA9F98D0ACC0A8291CDCEC97DCF" + + "8EC9B55A7F88A46B4DB5A851F44182E1C68A007E5E0DD902" + + "0BFD64B645036C7A4E677D2C38532A3A23BA4442CAF53EA6" + + "3BB454329B7624C8917BDD64B1C0FD4CB38E8C334C701C3A" + + "CDAD0657FCCFEC719B1F5C3E4E46041F388147FB4CFDB477" + + "A52471F7A9A96910B855322EDB6340D8A00EF092350511E3" + + "0ABEC1FFF9E3A26E7FB29F8C183023C3587E38DA0077D9B4" + + "763E4E4B94B2BBC194C6651E77CAF992EEAAC0232A281BF6" + + "B3A739C1226116820AE8DB5847A67CBEF9C9091B462D538C" + + "D72B03746AE77F5E62292C311562A846505DC82DB854338A" + + "E49F5235C95B91178CCF2DD5CACEF403EC9D1810C6272B04" + + "5B3B71F9DC6B80D63FDD4A8E9ADB1E6962A69526D43161C1" + + "A41D570D7938DAD4A40E329CD0E40E65FFFFFFFFFFFFFFFF", 16); + private static final BigInteger p8192 = new BigInteger( // TLS FFDHE + "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" + + "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + + "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" + + "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + + "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" + + "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + + "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" + + "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + + "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" + + "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + + "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238" + + "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + + "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3" + + "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + + "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF" + + "3C1B20EE3FD59D7C25E41D2B669E1EF16E6F52C3164DF4FB" + + "7930E9E4E58857B6AC7D5F42D69F6D187763CF1D55034004" + + "87F55BA57E31CC7A7135C886EFB4318AED6A1E012D9E6832" + + "A907600A918130C46DC778F971AD0038092999A333CB8B7A" + + "1A1DB93D7140003C2A4ECEA9F98D0ACC0A8291CDCEC97DCF" + + "8EC9B55A7F88A46B4DB5A851F44182E1C68A007E5E0DD902" + + "0BFD64B645036C7A4E677D2C38532A3A23BA4442CAF53EA6" + + "3BB454329B7624C8917BDD64B1C0FD4CB38E8C334C701C3A" + + "CDAD0657FCCFEC719B1F5C3E4E46041F388147FB4CFDB477" + + "A52471F7A9A96910B855322EDB6340D8A00EF092350511E3" + + "0ABEC1FFF9E3A26E7FB29F8C183023C3587E38DA0077D9B4" + + "763E4E4B94B2BBC194C6651E77CAF992EEAAC0232A281BF6" + + "B3A739C1226116820AE8DB5847A67CBEF9C9091B462D538C" + + "D72B03746AE77F5E62292C311562A846505DC82DB854338A" + + "E49F5235C95B91178CCF2DD5CACEF403EC9D1810C6272B04" + + "5B3B71F9DC6B80D63FDD4A8E9ADB1E6962A69526D43161C1" + + "A41D570D7938DAD4A40E329CCFF46AAA36AD004CF600C838" + + "1E425A31D951AE64FDB23FCEC9509D43687FEB69EDD1CC5E" + + "0B8CC3BDF64B10EF86B63142A3AB8829555B2F747C932665" + + "CB2C0F1CC01BD70229388839D2AF05E454504AC78B758282" + + "2846C0BA35C35F5C59160CC046FD8251541FC68C9C86B022" + + "BB7099876A460E7451A8A93109703FEE1C217E6C3826E52C" + + "51AA691E0E423CFC99E9E31650C1217B624816CDAD9A95F9" + + "D5B8019488D9C0A0A1FE3075A577E23183F81D4A3F2FA457" + + "1EFC8CE0BA8A4FE8B6855DFE72B0A66EDED2FBABFBE58A30" + + "FAFABE1C5D71A87E2F741EF8C1FE86FEA6BBFDE530677F0D" + + "97D11D49F7A8443D0822E506A9F4614E011E2A94838FF88C" + + "D68C8BB7C5C6424CFFFFFFFFFFFFFFFF", 16); + + private static final BigInteger[] supportedPrimes = { + p512, p768, p1024, p1536, p2048, p3072, p4096, p6144, p8192}; + + private static final BigInteger[] ffdhePrimes = { + p2048, p3072, p4096, p6144, p8192}; + + // a measure of the uncertainty that prime modulus p is not a prime + // + // see BigInteger.isProbablePrime(int certainty) + private final static int PRIME_CERTAINTY = 120; + + // the known security property, jdk.tls.server.defaultDHEParameters + private final static String PROPERTY_NAME = + "jdk.tls.server.defaultDHEParameters"; + + private static final Pattern spacesPattern = Pattern.compile("\\s+"); + + private final static Pattern syntaxPattern = Pattern.compile( + "(\\{[0-9A-Fa-f]+,[0-9A-Fa-f]+\\})" + + "(,\\{[0-9A-Fa-f]+,[0-9A-Fa-f]+\\})*"); + + private static final Pattern paramsPattern = Pattern.compile( + "\\{([0-9A-Fa-f]+),([0-9A-Fa-f]+)\\}"); + + // cache of predefined default DH ephemeral parameters + final static Map definedParams; + + // cache of Finite Field DH Ephemeral parameters (RFC 7919/FFDHE) + final static Map ffdheParams; + + static { + String property = AccessController.doPrivileged( + new PrivilegedAction() { + public String run() { + return Security.getProperty(PROPERTY_NAME); + } + }); + + if (property != null && !property.isEmpty()) { + // remove double quote marks from beginning/end of the property + if (property.length() >= 2 && property.charAt(0) == '"' && + property.charAt(property.length() - 1) == '"') { + property = property.substring(1, property.length() - 1); + } + + property = property.trim(); + } + + if (property != null && !property.isEmpty()) { + Matcher spacesMatcher = spacesPattern.matcher(property); + property = spacesMatcher.replaceAll(""); + + if (debugIsOn) { + System.out.println("The Security Property " + + PROPERTY_NAME + ": " + property); + } + } + + Map defaultParams = new HashMap<>(); + if (property != null && !property.isEmpty()) { + Matcher syntaxMatcher = syntaxPattern.matcher(property); + if (syntaxMatcher.matches()) { + Matcher paramsFinder = paramsPattern.matcher(property); + while(paramsFinder.find()) { + String primeModulus = paramsFinder.group(1); + BigInteger p = new BigInteger(primeModulus, 16); + if (!p.isProbablePrime(PRIME_CERTAINTY)) { + if (debugIsOn) { + System.out.println( + "Prime modulus p in Security Property, " + + PROPERTY_NAME + ", is not a prime: " + + primeModulus); + } + + continue; + } + + String baseGenerator = paramsFinder.group(2); + BigInteger g = new BigInteger(baseGenerator, 16); + + DHParameterSpec spec = new DHParameterSpec(p, g); + int primeLen = p.bitLength(); + defaultParams.put(primeLen, spec); + } + } else if (debugIsOn) { + System.out.println("Invalid Security Property, " + + PROPERTY_NAME + ", definition"); + } + } + + Map tempFFDHEs = new HashMap<>(); + for (BigInteger p : ffdhePrimes) { + int primeLen = p.bitLength(); + DHParameterSpec dhps = new DHParameterSpec(p, BigInteger.TWO); + tempFFDHEs.put(primeLen, dhps); + defaultParams.putIfAbsent(primeLen, dhps); + } + + for (BigInteger p : supportedPrimes) { + int primeLen = p.bitLength(); + if (defaultParams.get(primeLen) == null) { + defaultParams.put(primeLen, + new DHParameterSpec(p, BigInteger.TWO)); + } + } + + ffdheParams = + Collections.unmodifiableMap(tempFFDHEs); + definedParams = + Collections.unmodifiableMap(defaultParams); + } +} diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java index 4ad18b163e5..85b96cd3f8b 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, 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,7 +96,7 @@ final class ServerHandshaker extends Handshaker { private ProtocolVersion clientRequestedVersion; // client supported elliptic curves - private EllipticCurvesExtension requestedCurves; + private SupportedGroupsExtension requestedGroups; // the preferable signature algorithm used by ServerKeyExchange message SignatureAndHashAlgorithm preferableSignatureAlgorithm; @@ -751,8 +751,8 @@ final class ServerHandshaker extends Handshaker { throw new SSLException("Client did not resume a session"); } - requestedCurves = (EllipticCurvesExtension) - mesg.extensions.get(ExtensionType.EXT_ELLIPTIC_CURVES); + requestedGroups = (SupportedGroupsExtension) + mesg.extensions.get(ExtensionType.EXT_SUPPORTED_GROUPS); // We only need to handle the "signature_algorithm" extension // for full handshakes and TLS 1.2 or later. @@ -1341,6 +1341,8 @@ final class ServerHandshaker extends Handshaker { } } + // The named group used for ECDHE and FFDHE. + NamedGroup namedGroup = null; switch (keyExchange) { case K_RSA: // need RSA certs for authentication @@ -1366,6 +1368,37 @@ final class ServerHandshaker extends Handshaker { } break; case K_DHE_RSA: + // Is ephemeral DH cipher suite usable for the connection? + // + // [RFC 7919] If a compatible TLS server receives a Supported + // Groups extension from a client that includes any FFDHE group + // (i.e., any codepoint between 256 and 511, inclusive, even if + // unknown to the server), and if none of the client-proposed + // FFDHE groups are known and acceptable to the server, then + // the server MUST NOT select an FFDHE cipher suite. In this + // case, the server SHOULD select an acceptable non-FFDHE cipher + // suite from the client's offered list. If the extension is + // present with FFDHE groups, none of the client's offered + // groups are acceptable by the server, and none of the client's + // proposed non-FFDHE cipher suites are acceptable to the server, + // the server MUST end the connection with a fatal TLS alert + // of type insufficient_security(71). + // + // Note: For compatibility, if an application is customized to + // use legacy sizes (512 bits for exportable cipher suites and + // 768 bits for others), or the cipher suite is exportable, the + // FFDHE extension will not be used. + if ((!useLegacyEphemeralDHKeys) && (!suite.exportable) && + (requestedGroups != null) && requestedGroups.hasFFDHEGroup()) { + + namedGroup = requestedGroups.getPreferredGroup( + algorithmConstraints, NamedGroupType.NAMED_GROUP_FFDHE); + if (namedGroup == null) { + // no match found, cannot use this cipher suite. + return false; + } + } + // need RSA certs for authentication if (setupPrivateKeyAndChain("RSA") == false) { return false; @@ -1386,9 +1419,20 @@ final class ServerHandshaker extends Handshaker { } } - setupEphemeralDHKeys(suite.exportable, privateKey); + setupEphemeralDHKeys(namedGroup, suite.exportable, privateKey); break; case K_ECDHE_RSA: + // Is ECDHE cipher suite usable for the connection? + namedGroup = (requestedGroups != null) ? + requestedGroups.getPreferredGroup( + algorithmConstraints, NamedGroupType.NAMED_GROUP_ECDHE) : + SupportedGroupsExtension.getPreferredECGroup( + algorithmConstraints); + if (namedGroup == null) { + // no match found, cannot use this ciphersuite + return false; + } + // need RSA certs for authentication if (setupPrivateKeyAndChain("RSA") == false) { return false; @@ -1409,11 +1453,23 @@ final class ServerHandshaker extends Handshaker { } } - if (setupEphemeralECDHKeys() == false) { - return false; - } + setupEphemeralECDHKeys(namedGroup); break; case K_DHE_DSS: + // Is ephemeral DH cipher suite usable for the connection? + // + // See comment in K_DHE_RSA case. + if ((!useLegacyEphemeralDHKeys) && (!suite.exportable) && + (requestedGroups != null) && requestedGroups.hasFFDHEGroup()) { + + namedGroup = requestedGroups.getPreferredGroup( + algorithmConstraints, NamedGroupType.NAMED_GROUP_FFDHE); + if (namedGroup == null) { + // no match found, cannot use this cipher suite. + return false; + } + } + // get preferable peer signature algorithm for server key exchange if (protocolVersion.useTLS12PlusSpec()) { preferableSignatureAlgorithm = @@ -1434,9 +1490,20 @@ final class ServerHandshaker extends Handshaker { return false; } - setupEphemeralDHKeys(suite.exportable, privateKey); + setupEphemeralDHKeys(namedGroup, suite.exportable, privateKey); break; case K_ECDHE_ECDSA: + // Is ECDHE cipher suite usable for the connection? + namedGroup = (requestedGroups != null) ? + requestedGroups.getPreferredGroup( + algorithmConstraints, NamedGroupType.NAMED_GROUP_ECDHE) : + SupportedGroupsExtension.getPreferredECGroup( + algorithmConstraints); + if (namedGroup == null) { + // no match found, cannot use this ciphersuite + return false; + } + // get preferable peer signature algorithm for server key exchange if (protocolVersion.useTLS12PlusSpec()) { preferableSignatureAlgorithm = @@ -1456,9 +1523,8 @@ final class ServerHandshaker extends Handshaker { if (setupPrivateKeyAndChain("EC") == false) { return false; } - if (setupEphemeralECDHKeys() == false) { - return false; - } + + setupEphemeralECDHKeys(namedGroup); break; case K_ECDH_RSA: // need EC cert @@ -1475,14 +1541,36 @@ final class ServerHandshaker extends Handshaker { setupStaticECDHKeys(); break; case K_DH_ANON: + // Is ephemeral DH cipher suite usable for the connection? + // + // See comment in K_DHE_RSA case. + if ((!useLegacyEphemeralDHKeys) && (!suite.exportable) && + (requestedGroups != null) && requestedGroups.hasFFDHEGroup()) { + namedGroup = requestedGroups.getPreferredGroup( + algorithmConstraints, NamedGroupType.NAMED_GROUP_FFDHE); + if (namedGroup == null) { + // no match found, cannot use this cipher suite. + return false; + } + } + // no certs needed for anonymous - setupEphemeralDHKeys(suite.exportable, null); + setupEphemeralDHKeys(namedGroup, suite.exportable, null); break; case K_ECDH_ANON: - // no certs needed for anonymous - if (setupEphemeralECDHKeys() == false) { + // Is ECDHE cipher suite usable for the connection? + namedGroup = (requestedGroups != null) ? + requestedGroups.getPreferredGroup( + algorithmConstraints, NamedGroupType.NAMED_GROUP_ECDHE) : + SupportedGroupsExtension.getPreferredECGroup( + algorithmConstraints); + if (namedGroup == null) { + // no match found, cannot use this ciphersuite return false; } + + // no certs needed for anonymous + setupEphemeralECDHKeys(namedGroup); break; default: ClientKeyExchangeService p = @@ -1544,7 +1632,15 @@ final class ServerHandshaker extends Handshaker { * Acquire some "ephemeral" Diffie-Hellman keys for this handshake. * We don't reuse these, for improved forward secrecy. */ - private void setupEphemeralDHKeys(boolean export, Key key) { + private void setupEphemeralDHKeys( + NamedGroup namedGroup, boolean export, Key key) { + // Are the client and server willing to negotiate FFDHE groups? + if ((!useLegacyEphemeralDHKeys) && (!export) && (namedGroup != null)) { + dh = new DHCrypt(namedGroup, sslContext.getSecureRandom()); + + return; + } // Otherwise, the client is not compatible with FFDHE extension. + /* * 768 bits ephemeral DH private keys were used to be used in * ServerKeyExchange except that exportable ciphers max out at 512 @@ -1613,20 +1709,11 @@ final class ServerHandshaker extends Handshaker { dh = new DHCrypt(keySize, sslContext.getSecureRandom()); } - // Setup the ephemeral ECDH parameters. - // If we cannot continue because we do not support any of the curves that - // the client requested, return false. Otherwise (all is well), return true. - private boolean setupEphemeralECDHKeys() { - int index = (requestedCurves != null) ? - requestedCurves.getPreferredCurve(algorithmConstraints) : - EllipticCurvesExtension.getActiveCurves(algorithmConstraints); - if (index < 0) { - // no match found, cannot use this ciphersuite - return false; - } - - ecdh = new ECDHCrypt(index, sslContext.getSecureRandom()); - return true; + /** + * Setup the ephemeral ECDH parameters. + */ + private void setupEphemeralECDHKeys(NamedGroup namedGroup) { + ecdh = new ECDHCrypt(namedGroup, sslContext.getSecureRandom()); } private void setupStaticECDHKeys() { @@ -1674,9 +1761,11 @@ final class ServerHandshaker extends Handshaker { return false; } ECParameterSpec params = ((ECPublicKey)publicKey).getParams(); - int id = EllipticCurvesExtension.getCurveIndex(params); - if ((id <= 0) || !EllipticCurvesExtension.isSupported(id) || - ((requestedCurves != null) && !requestedCurves.contains(id))) { + NamedGroup namedGroup = NamedGroup.valueOf(params); + if ((namedGroup == null) || + (!SupportedGroupsExtension.supports(namedGroup)) || + ((requestedGroups != null) && + !requestedGroups.contains(namedGroup.id))) { return false; } } diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java b/jdk/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java new file mode 100644 index 00000000000..b33cc1e6e55 --- /dev/null +++ b/jdk/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java @@ -0,0 +1,491 @@ +/* + * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ssl; + +import java.io.IOException; +import java.security.spec.ECGenParameterSpec; +import java.security.spec.InvalidParameterSpecException; +import java.security.AlgorithmParameters; +import java.security.AlgorithmConstraints; +import java.security.CryptoPrimitive; +import java.security.AccessController; +import java.security.spec.AlgorithmParameterSpec; +import javax.crypto.spec.DHParameterSpec; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import java.util.ArrayList; +import javax.net.ssl.SSLProtocolException; + +import sun.security.action.GetPropertyAction; + +// +// Note: Since RFC 7919, the extension's semantics are expanded from +// "Supported Elliptic Curves" to "Supported Groups". The enum datatype +// used in the extension has been renamed from NamedCurve to NamedGroup. +// Its semantics are likewise expanded from "named curve" to "named group". +// +final class SupportedGroupsExtension extends HelloExtension { + + /* Class and subclass dynamic debugging support */ + private static final Debug debug = Debug.getInstance("ssl"); + + private static final int ARBITRARY_PRIME = 0xff01; + private static final int ARBITRARY_CHAR2 = 0xff02; + + // cache to speed up the parameters construction + private static final Map namedGroupParams = new HashMap<>(); + + // the supported named groups + private static final NamedGroup[] supportedNamedGroups; + + // the named group presented in the extension + private final int[] requestedNamedGroupIds; + + static { + boolean requireFips = SunJSSE.isFIPS(); + + // The value of the System Property defines a list of enabled named + // groups in preference order, separated with comma. For example: + // + // jdk.tls.namedGroups="secp521r1, secp256r1, ffdhe2048" + // + // If the System Property is not defined or the value is empty, the + // default groups and preferences will be used. + String property = AccessController.doPrivileged( + new GetPropertyAction("jdk.tls.namedGroups")); + if (property != null && property.length() != 0) { + // remove double quote marks from beginning/end of the property + if (property.length() > 1 && property.charAt(0) == '"' && + property.charAt(property.length() - 1) == '"') { + property = property.substring(1, property.length() - 1); + } + } + + ArrayList groupList; + if (property != null && property.length() != 0) { // customized groups + String[] groups = property.split(","); + groupList = new ArrayList<>(groups.length); + for (String group : groups) { + group = group.trim(); + if (!group.isEmpty()) { + NamedGroup namedGroup = NamedGroup.nameOf(group); + if (namedGroup != null && + (!requireFips || namedGroup.isFips)) { + if (isAvailableGroup(namedGroup)) { + groupList.add(namedGroup); + } + } // ignore unknown groups + } + } + + if (groupList.isEmpty() && JsseJce.isEcAvailable()) { + throw new IllegalArgumentException( + "System property jdk.tls.namedGroups(" + property + ") " + + "contains no supported elliptic curves"); + } + } else { // default groups + NamedGroup[] groups; + if (requireFips) { + groups = new NamedGroup[] { + // only NIST curves in FIPS mode + NamedGroup.SECP256_R1, + NamedGroup.SECP384_R1, + NamedGroup.SECP521_R1, + NamedGroup.SECT283_K1, + NamedGroup.SECT283_R1, + NamedGroup.SECT409_K1, + NamedGroup.SECT409_R1, + NamedGroup.SECT571_K1, + NamedGroup.SECT571_R1, + + // FFDHE 2048 + NamedGroup.FFDHE_2048, + NamedGroup.FFDHE_3072, + NamedGroup.FFDHE_4096, + NamedGroup.FFDHE_6144, + NamedGroup.FFDHE_8192, + }; + } else { + groups = new NamedGroup[] { + // NIST curves first + NamedGroup.SECP256_R1, + NamedGroup.SECP384_R1, + NamedGroup.SECP521_R1, + NamedGroup.SECT283_K1, + NamedGroup.SECT283_R1, + NamedGroup.SECT409_K1, + NamedGroup.SECT409_R1, + NamedGroup.SECT571_K1, + NamedGroup.SECT571_R1, + + // non-NIST curves + NamedGroup.SECP256_K1, + + // FFDHE 2048 + NamedGroup.FFDHE_2048, + NamedGroup.FFDHE_3072, + NamedGroup.FFDHE_4096, + NamedGroup.FFDHE_6144, + NamedGroup.FFDHE_8192, + }; + } + + groupList = new ArrayList<>(groups.length); + for (NamedGroup group : groups) { + if (isAvailableGroup(group)) { + groupList.add(group); + } + } + } + + if (debug != null && groupList.isEmpty()) { + Debug.log( + "Initialized [jdk.tls.namedGroups|default] list contains " + + "no available elliptic curves. " + + (property != null ? "(" + property + ")" : "[Default]")); + } + + supportedNamedGroups = new NamedGroup[groupList.size()]; + int i = 0; + for (NamedGroup namedGroup : groupList) { + supportedNamedGroups[i++] = namedGroup; + } + } + + // check whether the group is supported by the underlying providers + private static boolean isAvailableGroup(NamedGroup namedGroup) { + AlgorithmParameters params = null; + AlgorithmParameterSpec spec = null; + if ("EC".equals(namedGroup.algorithm)) { + if (namedGroup.oid != null) { + try { + params = JsseJce.getAlgorithmParameters("EC"); + spec = new ECGenParameterSpec(namedGroup.oid); + } catch (Exception e) { + return false; + } + } + } else if ("DiffieHellman".equals(namedGroup.algorithm)) { + try { + params = JsseJce.getAlgorithmParameters("DiffieHellman"); + spec = getFFDHEDHParameterSpec(namedGroup); + } catch (Exception e) { + return false; + } + } + + if ((params != null) && (spec != null)) { + try { + params.init(spec); + } catch (Exception e) { + return false; + } + + // cache the parameters + namedGroupParams.put(namedGroup, params); + + return true; + } + + return false; + } + + private static DHParameterSpec getFFDHEDHParameterSpec( + NamedGroup namedGroup) { + DHParameterSpec spec = null; + switch (namedGroup) { + case FFDHE_2048: + spec = PredefinedDHParameterSpecs.ffdheParams.get(2048); + break; + case FFDHE_3072: + spec = PredefinedDHParameterSpecs.ffdheParams.get(3072); + break; + case FFDHE_4096: + spec = PredefinedDHParameterSpecs.ffdheParams.get(4096); + break; + case FFDHE_6144: + spec = PredefinedDHParameterSpecs.ffdheParams.get(6144); + break; + case FFDHE_8192: + spec = PredefinedDHParameterSpecs.ffdheParams.get(8192); + } + + return spec; + } + + private static DHParameterSpec getPredefinedDHParameterSpec( + NamedGroup namedGroup) { + DHParameterSpec spec = null; + switch (namedGroup) { + case FFDHE_2048: + spec = PredefinedDHParameterSpecs.definedParams.get(2048); + break; + case FFDHE_3072: + spec = PredefinedDHParameterSpecs.definedParams.get(3072); + break; + case FFDHE_4096: + spec = PredefinedDHParameterSpecs.definedParams.get(4096); + break; + case FFDHE_6144: + spec = PredefinedDHParameterSpecs.definedParams.get(6144); + break; + case FFDHE_8192: + spec = PredefinedDHParameterSpecs.definedParams.get(8192); + } + + return spec; + } + + private SupportedGroupsExtension(int[] requestedNamedGroupIds) { + super(ExtensionType.EXT_SUPPORTED_GROUPS); + + this.requestedNamedGroupIds = requestedNamedGroupIds; + } + + SupportedGroupsExtension(HandshakeInStream s, int len) throws IOException { + super(ExtensionType.EXT_SUPPORTED_GROUPS); + + int k = s.getInt16(); + if (((len & 1) != 0) || (k == 0) || (k + 2 != len)) { + throw new SSLProtocolException("Invalid " + type + " extension"); + } + + // Note: unknown named group will be ignored later. + requestedNamedGroupIds = new int[k >> 1]; + for (int i = 0; i < requestedNamedGroupIds.length; i++) { + requestedNamedGroupIds[i] = s.getInt16(); + } + } + + // Get a local preferred supported ECDHE group permitted by the constraints. + static NamedGroup getPreferredECGroup(AlgorithmConstraints constraints) { + for (NamedGroup namedGroup : supportedNamedGroups) { + if ((namedGroup.type == NamedGroupType.NAMED_GROUP_ECDHE) && + constraints.permits(EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), + namedGroup.algorithm, namedGroupParams.get(namedGroup))) { + + return namedGroup; + } + } + + return null; + } + + // Is there any supported group permitted by the constraints? + static boolean isActivatable( + AlgorithmConstraints constraints, NamedGroupType type) { + + boolean hasFFDHEGroups = false; + for (NamedGroup namedGroup : supportedNamedGroups) { + if (namedGroup.type == type) { + if (constraints.permits( + EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), + namedGroup.algorithm, + namedGroupParams.get(namedGroup))) { + + return true; + } + + if (!hasFFDHEGroups && + (type == NamedGroupType.NAMED_GROUP_FFDHE)) { + + hasFFDHEGroups = true; + } + } + } + + // For compatibility, if no FFDHE groups are defined, the non-FFDHE + // compatible mode (using DHE cipher suite without FFDHE extension) + // is allowed. + // + // Note that the constraints checking on DHE parameters will be + // performed during key exchanging in a handshake. + if (!hasFFDHEGroups && (type == NamedGroupType.NAMED_GROUP_FFDHE)) { + return true; + } + + return false; + } + + // Create the default supported groups extension. + static SupportedGroupsExtension createExtension( + AlgorithmConstraints constraints, + CipherSuiteList cipherSuites, boolean enableFFDHE) { + + ArrayList groupList = + new ArrayList<>(supportedNamedGroups.length); + for (NamedGroup namedGroup : supportedNamedGroups) { + if ((!enableFFDHE) && + (namedGroup.type == NamedGroupType.NAMED_GROUP_FFDHE)) { + continue; + } + + if (cipherSuites.contains(namedGroup.type) && + constraints.permits(EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), + namedGroup.algorithm, namedGroupParams.get(namedGroup))) { + + groupList.add(namedGroup.id); + } + } + + if (!groupList.isEmpty()) { + int[] ids = new int[groupList.size()]; + int i = 0; + for (Integer id : groupList) { + ids[i++] = id; + } + + return new SupportedGroupsExtension(ids); + } + + return null; + } + + // get the preferred activated named group + NamedGroup getPreferredGroup( + AlgorithmConstraints constraints, NamedGroupType type) { + + for (int groupId : requestedNamedGroupIds) { + NamedGroup namedGroup = NamedGroup.valueOf(groupId); + if ((namedGroup != null) && (namedGroup.type == type) && + SupportedGroupsExtension.supports(namedGroup) && + constraints.permits(EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), + namedGroup.algorithm, namedGroupParams.get(namedGroup))) { + + return namedGroup; + } + } + + return null; + } + + boolean hasFFDHEGroup() { + for (int groupId : requestedNamedGroupIds) { + /* + * [RFC 7919] Codepoints in the "Supported Groups Registry" + * with a high byte of 0x01 (that is, between 256 and 511, + * inclusive) are set aside for FFDHE groups. + */ + if ((groupId >= 256) && (groupId <= 511)) { + return true; + } + } + + return false; + } + + boolean contains(int index) { + for (int groupId : requestedNamedGroupIds) { + if (index == groupId) { + return true; + } + } + return false; + } + + @Override + int length() { + return 6 + (requestedNamedGroupIds.length << 1); + } + + @Override + void send(HandshakeOutStream s) throws IOException { + s.putInt16(type.id); + int k = requestedNamedGroupIds.length << 1; + s.putInt16(k + 2); + s.putInt16(k); + for (int groupId : requestedNamedGroupIds) { + s.putInt16(groupId); + } + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Extension " + type + ", group names: {"); + boolean first = true; + for (int groupId : requestedNamedGroupIds) { + if (first) { + first = false; + } else { + sb.append(", "); + } + // first check if it is a known named group, then try other cases. + NamedGroup namedGroup = NamedGroup.valueOf(groupId); + if (namedGroup != null) { + sb.append(namedGroup.name); + } else if (groupId == ARBITRARY_PRIME) { + sb.append("arbitrary_explicit_prime_curves"); + } else if (groupId == ARBITRARY_CHAR2) { + sb.append("arbitrary_explicit_char2_curves"); + } else { + sb.append("unknown named group " + groupId); + } + } + sb.append("}"); + return sb.toString(); + } + + static boolean supports(NamedGroup namedGroup) { + for (NamedGroup group : supportedNamedGroups) { + if (namedGroup.id == group.id) { + return true; + } + } + + return false; + } + + static ECGenParameterSpec getECGenParamSpec(NamedGroup namedGroup) { + if (namedGroup.type != NamedGroupType.NAMED_GROUP_ECDHE) { + throw new RuntimeException("Not a named EC group: " + namedGroup); + } + + AlgorithmParameters params = namedGroupParams.get(namedGroup); + try { + return params.getParameterSpec(ECGenParameterSpec.class); + } catch (InvalidParameterSpecException ipse) { + // should be unlikely + return new ECGenParameterSpec(namedGroup.oid); + } + } + + static DHParameterSpec getDHParameterSpec(NamedGroup namedGroup) { + if (namedGroup.type != NamedGroupType.NAMED_GROUP_FFDHE) { + throw new RuntimeException("Not a named DH group: " + namedGroup); + } + + AlgorithmParameters params = namedGroupParams.get(namedGroup); + try { + return params.getParameterSpec(DHParameterSpec.class); + } catch (InvalidParameterSpecException ipse) { + // should be unlikely + return getPredefinedDHParameterSpec(namedGroup); + } + } +} diff --git a/jdk/test/sun/security/ssl/DHKeyExchange/DHEKeySizing.java b/jdk/test/sun/security/ssl/DHKeyExchange/DHEKeySizing.java index 3b449315e17..c00337789f0 100644 --- a/jdk/test/sun/security/ssl/DHKeyExchange/DHEKeySizing.java +++ b/jdk/test/sun/security/ssl/DHKeyExchange/DHEKeySizing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, 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,33 +31,44 @@ * @bug 6956398 * @summary make ephemeral DH key match the length of the certificate key * @run main/othervm + * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1639 267 + * @run main/othervm -Djsse.enableFFDHE=false * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1255 75 - * @run main/othervm -Djdk.tls.ephemeralDHKeySize=matched + * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.ephemeralDHKeySize=matched * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1255 75 - * @run main/othervm -Djdk.tls.ephemeralDHKeySize=legacy + * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.ephemeralDHKeySize=legacy * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1255 75 - * @run main/othervm -Djdk.tls.ephemeralDHKeySize=1024 + * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.ephemeralDHKeySize=1024 * DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1255 75 * - * @run main/othervm + * @run main/othervm -Djsse.enableFFDHE=false * DHEKeySizing SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA true 229 75 * - * @run main/othervm + * @run main/othervm -Djsse.enableFFDHE=false * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1383 139 - * @run main/othervm -Djdk.tls.ephemeralDHKeySize=legacy + * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.ephemeralDHKeySize=legacy * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1319 107 - * @run main/othervm -Djdk.tls.ephemeralDHKeySize=matched + * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.ephemeralDHKeySize=matched * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1639 267 - * @run main/othervm -Djdk.tls.ephemeralDHKeySize=1024 + * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.ephemeralDHKeySize=1024 * DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA false 1383 139 * - * @run main/othervm + * @run main/othervm -Djsse.enableFFDHE=false * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 357 139 - * @run main/othervm -Djdk.tls.ephemeralDHKeySize=legacy + * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.ephemeralDHKeySize=legacy * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 293 107 - * @run main/othervm -Djdk.tls.ephemeralDHKeySize=matched + * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.ephemeralDHKeySize=matched * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 357 139 - * @run main/othervm -Djdk.tls.ephemeralDHKeySize=1024 + * @run main/othervm -Djsse.enableFFDHE=false + * -Djdk.tls.ephemeralDHKeySize=1024 * DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5 false 357 139 */ diff --git a/jdk/test/sun/security/ssl/DHKeyExchange/UseStrongDHSizes.java b/jdk/test/sun/security/ssl/DHKeyExchange/UseStrongDHSizes.java new file mode 100644 index 00000000000..5706f5cc7ae --- /dev/null +++ b/jdk/test/sun/security/ssl/DHKeyExchange/UseStrongDHSizes.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2017, 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. + */ + +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + +/* + * @test + * @bug 8140436 + * @modules jdk.crypto.ec + * @library /javax/net/ssl/templates + * @summary Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS + * @run main/othervm UseStrongDHSizes 2048 + */ + +import java.io.InputStream; +import java.io.OutputStream; +import java.security.Security; +import javax.net.ssl.SSLSocket; + +public class UseStrongDHSizes extends SSLSocketTemplate { + /* + * Run the test case. + */ + public static void main(String[] args) throws Exception { + // reset the security property to make sure that the algorithms + // and keys used in this test are not disabled unexpectedly. + String constraint = "DH keySize < " + Integer.valueOf(args[0]); + Security.setProperty("jdk.tls.disabledAlgorithms", constraint); + Security.setProperty("jdk.certpath.disabledAlgorithms", ""); + + (new UseStrongDHSizes()).run(); + } + + @Override + protected void runServerApplication(SSLSocket socket) throws Exception { + String ciphers[] = { + "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", + "TLS_DHE_DSS_WITH_AES_128_CBC_SHA", + "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA"}; + + socket.setEnabledCipherSuites(ciphers); + socket.setWantClientAuth(true); + + InputStream sslIS = socket.getInputStream(); + OutputStream sslOS = socket.getOutputStream(); + + sslIS.read(); + sslOS.write(85); + sslOS.flush(); + } + + @Override + protected void runClientApplication(SSLSocket socket) throws Exception { + String ciphers[] = { + "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", + "TLS_DHE_DSS_WITH_AES_128_CBC_SHA", + "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", + "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA"}; + socket.setEnabledCipherSuites(ciphers); + socket.setUseClientMode(true); + + InputStream sslIS = socket.getInputStream(); + OutputStream sslOS = socket.getOutputStream(); + + sslOS.write(280); + sslOS.flush(); + sslIS.read(); + } +} From 381dc3404c1f1af2be5a62c8b2851e2617a9021e Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 11 May 2017 16:26:48 +0000 Subject: [PATCH 44/55] Added tag jdk-9+169 for changeset f87535f0217d --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 6f3a4bc52e0..88b31a1ce33 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -411,3 +411,4 @@ aff4f339acd40942d3dab499846b52acd87b3af1 jdk-9+165 ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166 35017c286513ddcbcc6b63b99679c604993fc639 jdk-9+167 143d4c87bc1ef1ed6dadd613cd9dd4488fdefc29 jdk-9+168 +b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169 From 1d05e4f19bb77c89b2036fdaf377cdb22228548c Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 11 May 2017 16:26:48 +0000 Subject: [PATCH 45/55] Added tag jdk-9+169 for changeset 3f875168ce21 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 4dc7b9e665b..1ce36c1698b 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -571,3 +571,4 @@ c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165 560d7aa083a24b6a56443feb8de0f40435d33aa9 jdk-9+166 1ca7ed1b17b5776930d641d1379834f3140a74e4 jdk-9+167 fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168 +16d692be099c5c38eb48cc9aca78b0c900910d5b jdk-9+169 From 145df524c9e5954e9e27b2a258bd16f59320baf0 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 11 May 2017 16:26:48 +0000 Subject: [PATCH 46/55] Added tag jdk-9+169 for changeset 67a9483804b2 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index aa447404dec..6dde9ab35df 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -411,3 +411,4 @@ a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165 934c18145915b06d3fcc0de1a30f91f5aab8a192 jdk-9+166 43de67f51801b9e16507865fcb7e8344f4ca4aa9 jdk-9+167 03a2cc9c8a1e8f87924c9863e917bc8b91770d5f jdk-9+168 +b2218d41edef02ee8f94bb438f885b2ba79bfa08 jdk-9+169 From 19a1a6c18987f1db190a2c93885d899dbde4f4d3 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 11 May 2017 16:26:50 +0000 Subject: [PATCH 47/55] Added tag jdk-9+169 for changeset cd369ee4d4bc --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 0789134cb17..f4217d62903 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -411,3 +411,4 @@ a7942c3b1e59495dbf51dc7c41aab355fcd253d7 jdk-9+165 5d2b48f1f0a322aca719b49ff02ab421705bffc7 jdk-9+166 7828aedcb525df40b7c8122bcc3f997c75ebaf7f jdk-9+167 e78da9db6299b3fcba49300d52e2359e82fdd218 jdk-9+168 +177436a54ca13730ffc725a6e5dbfcd9486f3da3 jdk-9+169 From 3f5bc07a700e84e7bf98f88c3f2c0f9ed6130945 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Thu, 11 May 2017 18:44:41 +0200 Subject: [PATCH 48/55] 8180081: Adjust Jib and JDL configuration for 10 to support promotable builds Reviewed-by: ctornqvi, tbell, ihse --- common/conf/jib-profiles.js | 150 +++++++++++++++++++++++------------- 1 file changed, 96 insertions(+), 54 deletions(-) diff --git a/common/conf/jib-profiles.js b/common/conf/jib-profiles.js index dce28a6586b..b6fd25a6fcf 100644 --- a/common/conf/jib-profiles.js +++ b/common/conf/jib-profiles.js @@ -239,11 +239,8 @@ var getJibProfilesCommon = function (input, data) { common.main_profile_base = { dependencies: ["boot_jdk", "gnumake", "jtreg"], default_make_targets: ["product-bundles", "test-bundles"], - configure_args: [ - "--with-version-opt=" + common.build_id, - "--enable-jtreg-failure-handler", - "--with-version-build=" + common.build_number - ] + configure_args: concat(["--enable-jtreg-failure-handler"], + versionArgs(input, common)) }; // Extra settings for debug profiles common.debug_suffix = "-debug"; @@ -269,10 +266,12 @@ var getJibProfilesCommon = function (input, data) { /** * Define common artifacts template for all main profiles - * @param pf - Name of platform in bundle names - * @param demo_ext - Type of extension for demo bundle + * @param o - Object containing data for artifacts */ - common.main_profile_artifacts = function (pf, demo_ext) { + common.main_profile_artifacts = function (o) { + var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version); + var jre_subdir = (o.jre_subdir != null ? o.jre_subdir : "jre-" + data.version); + var pf = o.platform return { artifacts: { jdk: { @@ -281,7 +280,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre: { @@ -290,7 +289,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" }, test: { @@ -307,7 +306,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre_symbols: { @@ -316,15 +315,8 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" - }, - demo: { - local: "bundles/\\(jdk.*demo." + demo_ext + "\\)", - remote: [ - "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_demo." + demo_ext, - "bundles/" + pf + "/\\1" - ], } } }; @@ -333,9 +325,12 @@ var getJibProfilesCommon = function (input, data) { /** * Define common artifacts template for all debug profiles - * @param pf - Name of platform in bundle names + * @param o - Object containing data for artifacts */ - common.debug_profile_artifacts = function (pf) { + common.debug_profile_artifacts = function (o) { + var jdk_subdir = "jdk-" + data.version + "/fastdebug"; + var jre_subdir = "jre-" + data.version + "/fastdebug"; + var pf = o.platform return { artifacts: { jdk: { @@ -344,7 +339,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre: { @@ -353,7 +348,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" }, test: { @@ -370,7 +365,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre_symbols: { @@ -379,7 +374,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" } } @@ -665,61 +660,53 @@ var getJibProfilesProfiles = function (input, common, data) { // // Define artifacts for profiles // - // Macosx bundles are named osx and Windows demo bundles use zip instead of + // Macosx bundles are named osx // tar.gz. var artifactData = { "linux-x64": { platform: "linux-x64", - demo_ext: "tar.gz" }, "linux-x86": { platform: "linux-x86", - demo_ext: "tar.gz" }, "macosx-x64": { platform: "osx-x64", - demo_ext: "tar.gz" + jdk_subdir: "jdk-" + data.version + ".jdk/Contents/Home", + jre_subdir: "jre-" + data.version + ".jre/Contents/Home" }, "solaris-x64": { platform: "solaris-x64", - demo_ext: "tar.gz" }, "solaris-sparcv9": { platform: "solaris-sparcv9", - demo_ext: "tar.gz" }, "windows-x64": { platform: "windows-x64", - demo_ext: "zip" }, "windows-x86": { platform: "windows-x86", - demo_ext: "zip" }, "linux-arm64": { platform: "linux-arm64-vfp-hflt", - demo_ext: "tar.gz" }, "linux-arm-vfp-hflt": { platform: "linux-arm32-vfp-hflt", - demo_ext: "tar.gz" }, "linux-arm-vfp-hflt-dyn": { platform: "linux-arm32-vfp-hflt-dyn", - demo_ext: "tar.gz" } } // Generate common artifacts for all main profiles Object.keys(artifactData).forEach(function (name) { profiles[name] = concatObjects(profiles[name], - common.main_profile_artifacts(artifactData[name].platform, artifactData[name].demo_ext)); + common.main_profile_artifacts(artifactData[name])); }); // Generate common artifacts for all debug profiles Object.keys(artifactData).forEach(function (name) { var debugName = name + common.debug_suffix; profiles[debugName] = concatObjects(profiles[debugName], - common.debug_profile_artifacts(artifactData[name].platform)); + common.debug_profile_artifacts(artifactData[name])); }); // Extra profile specific artifacts @@ -740,7 +727,12 @@ var getJibProfilesProfiles = function (input, common, data) { artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ], + subdir: "jdk-" + data.version }, jre: { local: "bundles/\\(jre.*bin.tar.gz\\)", @@ -748,20 +740,25 @@ var getJibProfilesProfiles = function (input, common, data) { }, test: { local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin-tests.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ] }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin-symbols.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ], + subdir: "jdk-" + data.version }, jre_symbols: { local: "bundles/\\(jre.*bin-symbols.tar.gz\\)", remote: "bundles/openjdk/GPL/linux-x64/\\1", }, - demo: { - local: "bundles/\\(jdk.*demo.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", - }, doc_api_spec: { local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)", remote: "bundles/openjdk/GPL/linux-x64/\\1", @@ -773,11 +770,29 @@ var getJibProfilesProfiles = function (input, common, data) { artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/profile/linux-x86/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ], + subdir: "jdk-" + data.version }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/profile/linux-x86/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin-symbols.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ], + subdir: "jdk-" + data.version + }, + test: { + local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin-tests.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ] }, jre: { // This regexp needs to not match the compact* files below @@ -803,7 +818,12 @@ var getJibProfilesProfiles = function (input, common, data) { artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ], + subdir: "jdk-" + data.version }, jre: { local: "bundles/\\(jre.*bin.tar.gz\\)", @@ -811,19 +831,24 @@ var getJibProfilesProfiles = function (input, common, data) { }, test: { local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin-tests.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ] }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1" + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin-symbols.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ], + subdir: "jdk-" + data.version }, jre_symbols: { local: "bundles/\\(jre.*bin-symbols.tar.gz\\)", remote: "bundles/openjdk/GPL/windows-x86/\\1", - }, - demo: { - local: "bundles/\\(jdk.*demo.zip\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", } } }, @@ -1154,6 +1179,23 @@ var getVersion = function (major, minor, security, patch) { return version; }; +/** + * Constructs the common version configure args based on build type and + * other version inputs + */ +var versionArgs = function(input, common) { + var args = ["--with-version-build=" + common.build_number]; + if (input.build_type == "promoted") { + args = concat(args, + // This needs to be changed when we start building release candidates + "--with-version-pre=ea", + "--without-version-opt"); + } else { + args = concat(args, "--with-version-opt=" + common.build_id); + } + return args; +} + // Properties representation of the common/autoconf/version-numbers file. Lazily // initiated by the function below. var version_numbers; From 1f2554ca5c3624ae5bfdbb361c5608ed7027d559 Mon Sep 17 00:00:00 2001 From: Ron Pressler Date: Thu, 11 May 2017 12:55:53 -0700 Subject: [PATCH 49/55] 8159995: Rename internal Unsafe.compare methods Reviewed-by: psandoz, dholmes --- .../share/classes/java/lang/Class.java | 6 +- .../share/classes/java/lang/ClassLoader.java | 2 +- .../java/lang/invoke/MethodHandles.java | 7 +- .../lang/invoke/X-VarHandle.java.template | 42 +- .../X-VarHandleByteArrayView.java.template | 46 +- .../util/concurrent/ConcurrentHashMap.java | 40 +- .../util/concurrent/atomic/AtomicInteger.java | 14 +- .../atomic/AtomicIntegerFieldUpdater.java | 4 +- .../util/concurrent/atomic/AtomicLong.java | 18 +- .../atomic/AtomicLongFieldUpdater.java | 4 +- .../atomic/AtomicReferenceFieldUpdater.java | 4 +- .../classes/jdk/internal/misc/Unsafe.java | 608 +++++++++--------- .../share/classes/sun/misc/Unsafe.java | 8 +- 13 files changed, 403 insertions(+), 400 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java index a7f1262c3b5..8b8fb6d0bb4 100644 --- a/jdk/src/java.base/share/classes/java/lang/Class.java +++ b/jdk/src/java.base/share/classes/java/lang/Class.java @@ -2875,19 +2875,19 @@ public final class Class implements java.io.Serializable, static boolean casReflectionData(Class clazz, SoftReference> oldData, SoftReference> newData) { - return unsafe.compareAndSwapObject(clazz, reflectionDataOffset, oldData, newData); + return unsafe.compareAndSetObject(clazz, reflectionDataOffset, oldData, newData); } static boolean casAnnotationType(Class clazz, AnnotationType oldType, AnnotationType newType) { - return unsafe.compareAndSwapObject(clazz, annotationTypeOffset, oldType, newType); + return unsafe.compareAndSetObject(clazz, annotationTypeOffset, oldType, newType); } static boolean casAnnotationData(Class clazz, AnnotationData oldData, AnnotationData newData) { - return unsafe.compareAndSwapObject(clazz, annotationDataOffset, oldData, newData); + return unsafe.compareAndSetObject(clazz, annotationDataOffset, oldData, newData); } } diff --git a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java index 2f6af4de922..8142bb0abab 100644 --- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java +++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java @@ -2857,7 +2857,7 @@ public abstract class ClassLoader { } catch (NoSuchFieldException e) { throw new InternalError(e); } - return unsafe.compareAndSwapObject(this, offset, null, obj); + return unsafe.compareAndSetObject(this, offset, null, obj); } } diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index eceba166e24..b8cabc5c924 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -1662,7 +1662,7 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method * (If the trailing array argument is the only argument, * the given receiver value will be bound to it.) *

        - * This is equivalent to the following code: + * This is almost equivalent to the following code, with some differences noted below: *

        {@code
         import static java.lang.invoke.MethodHandles.*;
         import static java.lang.invoke.MethodType.*;
        @@ -1675,7 +1675,10 @@ return mh1;
                  * where {@code defc} is either {@code receiver.getClass()} or a super
                  * type of that class, in which the requested method is accessible
                  * to the lookup class.
        -         * (Note that {@code bindTo} does not preserve variable arity.)
        +         * (Unlike {@code bind}, {@code bindTo} does not preserve variable arity.
        +         * Also, {@code bindTo} may throw a {@code ClassCastException} in instances where {@code bind} would
        +         * throw a {@code IllegalAccessException}, as in the case where the member is {@code protected} and
        +         * the receiver is restricted by {@code findVirtual} to the lookup class)
                  * @param receiver the object from which the method is accessed
                  * @param name the name of the method
                  * @param type the type of the method, with the receiver argument omitted
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template
        index 634d64d8327..71419c36548 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -125,7 +125,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static boolean compareAndSet(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
        -            return UNSAFE.compareAndSwap$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
        +            return UNSAFE.compareAndSet$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -133,7 +133,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static $type$ compareAndExchange(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
        -            return UNSAFE.compareAndExchange$Type$Volatile(Objects.requireNonNull(handle.receiverType.cast(holder)),
        +            return UNSAFE.compareAndExchange$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -157,7 +157,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static boolean weakCompareAndSetPlain(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
        -            return UNSAFE.weakCompareAndSwap$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
        +            return UNSAFE.weakCompareAndSet$Type$Plain(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -165,7 +165,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static boolean weakCompareAndSet(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
        -            return UNSAFE.weakCompareAndSwap$Type$Volatile(Objects.requireNonNull(handle.receiverType.cast(holder)),
        +            return UNSAFE.weakCompareAndSet$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -173,7 +173,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static boolean weakCompareAndSetAcquire(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
        -            return UNSAFE.weakCompareAndSwap$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
        +            return UNSAFE.weakCompareAndSet$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -181,7 +181,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static boolean weakCompareAndSetRelease(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
        -            return UNSAFE.weakCompareAndSwap$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)),
        +            return UNSAFE.weakCompareAndSet$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)),
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -275,7 +275,7 @@ final class VarHandle$Type$s {
                                                handle.fieldOffset,
                                                value);
                 }
        -        
        +
                 @ForceInline
                 static $type$ getAndBitwiseXor(FieldInstanceReadWrite handle, Object holder, $type$ value) {
                     return UNSAFE.getAndBitwiseXor$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
        @@ -392,7 +392,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static boolean compareAndSet(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
        -            return UNSAFE.compareAndSwap$Type$(handle.base,
        +            return UNSAFE.compareAndSet$Type$(handle.base,
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -401,7 +401,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static $type$ compareAndExchange(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
        -            return UNSAFE.compareAndExchange$Type$Volatile(handle.base,
        +            return UNSAFE.compareAndExchange$Type$(handle.base,
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -425,7 +425,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static boolean weakCompareAndSetPlain(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
        -            return UNSAFE.weakCompareAndSwap$Type$(handle.base,
        +            return UNSAFE.weakCompareAndSet$Type$Plain(handle.base,
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -433,7 +433,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static boolean weakCompareAndSet(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
        -            return UNSAFE.weakCompareAndSwap$Type$Volatile(handle.base,
        +            return UNSAFE.weakCompareAndSet$Type$(handle.base,
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -441,7 +441,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static boolean weakCompareAndSetAcquire(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
        -            return UNSAFE.weakCompareAndSwap$Type$Acquire(handle.base,
        +            return UNSAFE.weakCompareAndSet$Type$Acquire(handle.base,
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -449,7 +449,7 @@ final class VarHandle$Type$s {
         
                 @ForceInline
                 static boolean weakCompareAndSetRelease(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
        -            return UNSAFE.weakCompareAndSwap$Type$Release(handle.base,
        +            return UNSAFE.weakCompareAndSet$Type$Release(handle.base,
                                                        handle.fieldOffset,
                                                        {#if[Object]?handle.fieldType.cast(expected):expected},
                                                        {#if[Object]?handle.fieldType.cast(value):value});
        @@ -689,7 +689,7 @@ final class VarHandle$Type$s {
         #else[Object]
                     $type$[] array = ($type$[]) oarray;
         #end[Object]
        -            return UNSAFE.compareAndSwap$Type$(array,
        +            return UNSAFE.compareAndSet$Type$(array,
                             (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                             {#if[Object]?handle.componentType.cast(expected):expected},
                             {#if[Object]?handle.componentType.cast(value):value});
        @@ -702,7 +702,7 @@ final class VarHandle$Type$s {
         #else[Object]
                     $type$[] array = ($type$[]) oarray;
         #end[Object]
        -            return UNSAFE.compareAndExchange$Type$Volatile(array,
        +            return UNSAFE.compareAndExchange$Type$(array,
                             (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                             {#if[Object]?handle.componentType.cast(expected):expected},
                             {#if[Object]?handle.componentType.cast(value):value});
        @@ -741,7 +741,7 @@ final class VarHandle$Type$s {
         #else[Object]
                     $type$[] array = ($type$[]) oarray;
         #end[Object]
        -            return UNSAFE.weakCompareAndSwap$Type$(array,
        +            return UNSAFE.weakCompareAndSet$Type$Plain(array,
                             (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                             {#if[Object]?handle.componentType.cast(expected):expected},
                             {#if[Object]?handle.componentType.cast(value):value});
        @@ -754,7 +754,7 @@ final class VarHandle$Type$s {
         #else[Object]
                     $type$[] array = ($type$[]) oarray;
         #end[Object]
        -            return UNSAFE.weakCompareAndSwap$Type$Volatile(array,
        +            return UNSAFE.weakCompareAndSet$Type$(array,
                             (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                             {#if[Object]?handle.componentType.cast(expected):expected},
                             {#if[Object]?handle.componentType.cast(value):value});
        @@ -767,7 +767,7 @@ final class VarHandle$Type$s {
         #else[Object]
                     $type$[] array = ($type$[]) oarray;
         #end[Object]
        -            return UNSAFE.weakCompareAndSwap$Type$Acquire(array,
        +            return UNSAFE.weakCompareAndSet$Type$Acquire(array,
                             (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                             {#if[Object]?handle.componentType.cast(expected):expected},
                             {#if[Object]?handle.componentType.cast(value):value});
        @@ -780,7 +780,7 @@ final class VarHandle$Type$s {
         #else[Object]
                     $type$[] array = ($type$[]) oarray;
         #end[Object]
        -            return UNSAFE.weakCompareAndSwap$Type$Release(array,
        +            return UNSAFE.weakCompareAndSet$Type$Release(array,
                             (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                             {#if[Object]?handle.componentType.cast(expected):expected},
                             {#if[Object]?handle.componentType.cast(value):value});
        @@ -897,7 +897,7 @@ final class VarHandle$Type$s {
                                                (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
                                                value);
                 }
        -        
        +
                 @ForceInline
                 static $type$ getAndBitwiseXor(Array handle, Object oarray, int index, $type$ value) {
                     $type$[] array = ($type$[]) oarray;
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template
        index da57311e39d..e85fd913406 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -186,7 +186,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 @ForceInline
                 static boolean compareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
                     byte[] ba = (byte[]) oba;
        -            return UNSAFE.compareAndSwap$RawType$(
        +            return UNSAFE.compareAndSet$RawType$(
                             ba,
                             address(ba, index(ba, index)),
                             convEndian(handle.be, expected), convEndian(handle.be, value));
        @@ -196,7 +196,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 static $type$ compareAndExchange(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
                     byte[] ba = (byte[]) oba;
                     return convEndian(handle.be,
        -                              UNSAFE.compareAndExchange$RawType$Volatile(
        +                              UNSAFE.compareAndExchange$RawType$(
                                               ba,
                                               address(ba, index(ba, index)),
                                               convEndian(handle.be, expected), convEndian(handle.be, value)));
        @@ -225,7 +225,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 @ForceInline
                 static boolean weakCompareAndSetPlain(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
                     byte[] ba = (byte[]) oba;
        -            return UNSAFE.weakCompareAndSwap$RawType$(
        +            return UNSAFE.weakCompareAndSet$RawType$Plain(
                             ba,
                             address(ba, index(ba, index)),
                             convEndian(handle.be, expected), convEndian(handle.be, value));
        @@ -234,7 +234,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 @ForceInline
                 static boolean weakCompareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
                     byte[] ba = (byte[]) oba;
        -            return UNSAFE.weakCompareAndSwap$RawType$Volatile(
        +            return UNSAFE.weakCompareAndSet$RawType$(
                             ba,
                             address(ba, index(ba, index)),
                             convEndian(handle.be, expected), convEndian(handle.be, value));
        @@ -243,7 +243,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 @ForceInline
                 static boolean weakCompareAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
                     byte[] ba = (byte[]) oba;
        -            return UNSAFE.weakCompareAndSwap$RawType$Acquire(
        +            return UNSAFE.weakCompareAndSet$RawType$Acquire(
                             ba,
                             address(ba, index(ba, index)),
                             convEndian(handle.be, expected), convEndian(handle.be, value));
        @@ -252,7 +252,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 @ForceInline
                 static boolean weakCompareAndSetRelease(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
                     byte[] ba = (byte[]) oba;
        -            return UNSAFE.weakCompareAndSwap$RawType$Release(
        +            return UNSAFE.weakCompareAndSet$RawType$Release(
                             ba,
                             address(ba, index(ba, index)),
                             convEndian(handle.be, expected), convEndian(handle.be, value));
        @@ -336,7 +336,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                     do {
                         nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
                         expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
        -            } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset,
        +            } while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset,
                             nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta)));
                     return expectedValue;
                 }
        @@ -389,7 +389,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                     do {
                         nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
                         expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
        -            } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset,
        +            } while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset,
                             nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value)));
                     return expectedValue;
                 }
        @@ -440,7 +440,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                     do {
                         nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
                         expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
        -            } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset,
        +            } while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset,
                             nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value)));
                     return expectedValue;
                 }
        @@ -491,7 +491,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                     do {
                         nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
                         expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
        -            } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset,
        +            } while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset,
                             nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value)));
                     return expectedValue;
                 }
        @@ -625,7 +625,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 @ForceInline
                 static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
                     ByteBuffer bb = (ByteBuffer) obb;
        -            return UNSAFE.compareAndSwap$RawType$(
        +            return UNSAFE.compareAndSet$RawType$(
                             UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                             address(bb, indexRO(bb, index)),
                             convEndian(handle.be, expected), convEndian(handle.be, value));
        @@ -635,7 +635,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 static $type$ compareAndExchange(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
                     ByteBuffer bb = (ByteBuffer) obb;
                     return convEndian(handle.be,
        -                              UNSAFE.compareAndExchange$RawType$Volatile(
        +                              UNSAFE.compareAndExchange$RawType$(
                                               UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                                               address(bb, indexRO(bb, index)),
                                               convEndian(handle.be, expected), convEndian(handle.be, value)));
        @@ -664,7 +664,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 @ForceInline
                 static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
                     ByteBuffer bb = (ByteBuffer) obb;
        -            return UNSAFE.weakCompareAndSwap$RawType$(
        +            return UNSAFE.weakCompareAndSet$RawType$Plain(
                             UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                             address(bb, indexRO(bb, index)),
                             convEndian(handle.be, expected), convEndian(handle.be, value));
        @@ -673,7 +673,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 @ForceInline
                 static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
                     ByteBuffer bb = (ByteBuffer) obb;
        -            return UNSAFE.weakCompareAndSwap$RawType$Volatile(
        +            return UNSAFE.weakCompareAndSet$RawType$(
                             UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                             address(bb, indexRO(bb, index)),
                             convEndian(handle.be, expected), convEndian(handle.be, value));
        @@ -682,7 +682,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 @ForceInline
                 static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
                     ByteBuffer bb = (ByteBuffer) obb;
        -            return UNSAFE.weakCompareAndSwap$RawType$Acquire(
        +            return UNSAFE.weakCompareAndSet$RawType$Acquire(
                             UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                             address(bb, indexRO(bb, index)),
                             convEndian(handle.be, expected), convEndian(handle.be, value));
        @@ -691,7 +691,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                 @ForceInline
                 static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
                     ByteBuffer bb = (ByteBuffer) obb;
        -            return UNSAFE.weakCompareAndSwap$RawType$Release(
        +            return UNSAFE.weakCompareAndSet$RawType$Release(
                             UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                             address(bb, indexRO(bb, index)),
                             convEndian(handle.be, expected), convEndian(handle.be, value));
        @@ -776,7 +776,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                     do {
                         nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
                         expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
        -            } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset,
        +            } while (!UNSAFE.weakCompareAndSet$RawType$(base, offset,
                             nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta)));
                     return expectedValue;
                 }
        @@ -830,7 +830,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                     do {
                         nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
                         expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
        -            } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset,
        +            } while (!UNSAFE.weakCompareAndSet$RawType$(base, offset,
                             nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value)));
                     return expectedValue;
                 }
        @@ -882,12 +882,12 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                     do {
                         nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
                         expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
        -            } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset,
        +            } while (!UNSAFE.weakCompareAndSet$RawType$(base, offset,
                             nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value)));
                     return expectedValue;
                 }
        -        
        -        
        +
        +
                 @ForceInline
                 static $type$ getAndBitwiseXor(ByteBufferHandle handle, Object obb, int index, $type$ value) {
                     ByteBuffer bb = (ByteBuffer) obb;
        @@ -935,7 +935,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
                     do {
                         nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
                         expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
        -            } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset,
        +            } while (!UNSAFE.weakCompareAndSet$RawType$(base, offset,
                             nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value)));
                     return expectedValue;
                 }
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java
        index 882333b7cab..b2fe964eb03 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java
        @@ -768,7 +768,7 @@ public class ConcurrentHashMap extends AbstractMap
         
             static final  boolean casTabAt(Node[] tab, int i,
                                                 Node c, Node v) {
        -        return U.compareAndSwapObject(tab, ((long)i << ASHIFT) + ABASE, c, v);
        +        return U.compareAndSetObject(tab, ((long)i << ASHIFT) + ABASE, c, v);
             }
         
             static final  void setTabAt(Node[] tab, int i, Node v) {
        @@ -2300,7 +2300,7 @@ public class ConcurrentHashMap extends AbstractMap
                 while ((tab = table) == null || tab.length == 0) {
                     if ((sc = sizeCtl) < 0)
                         Thread.yield(); // lost initialization race; just spin
        -            else if (U.compareAndSwapInt(this, SIZECTL, sc, -1)) {
        +            else if (U.compareAndSetInt(this, SIZECTL, sc, -1)) {
                         try {
                             if ((tab = table) == null || tab.length == 0) {
                                 int n = (sc > 0) ? sc : DEFAULT_CAPACITY;
        @@ -2331,13 +2331,13 @@ public class ConcurrentHashMap extends AbstractMap
             private final void addCount(long x, int check) {
                 CounterCell[] as; long b, s;
                 if ((as = counterCells) != null ||
        -            !U.compareAndSwapLong(this, BASECOUNT, b = baseCount, s = b + x)) {
        +            !U.compareAndSetLong(this, BASECOUNT, b = baseCount, s = b + x)) {
                     CounterCell a; long v; int m;
                     boolean uncontended = true;
                     if (as == null || (m = as.length - 1) < 0 ||
                         (a = as[ThreadLocalRandom.getProbe() & m]) == null ||
                         !(uncontended =
        -                  U.compareAndSwapLong(a, CELLVALUE, v = a.value, v + x))) {
        +                  U.compareAndSetLong(a, CELLVALUE, v = a.value, v + x))) {
                         fullAddCount(x, uncontended);
                         return;
                     }
        @@ -2355,10 +2355,10 @@ public class ConcurrentHashMap extends AbstractMap
                                 sc == rs + MAX_RESIZERS || (nt = nextTable) == null ||
                                 transferIndex <= 0)
                                 break;
        -                    if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1))
        +                    if (U.compareAndSetInt(this, SIZECTL, sc, sc + 1))
                                 transfer(tab, nt);
                         }
        -                else if (U.compareAndSwapInt(this, SIZECTL, sc,
        +                else if (U.compareAndSetInt(this, SIZECTL, sc,
                                                      (rs << RESIZE_STAMP_SHIFT) + 2))
                             transfer(tab, null);
                         s = sumCount();
        @@ -2379,7 +2379,7 @@ public class ConcurrentHashMap extends AbstractMap
                         if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 ||
                             sc == rs + MAX_RESIZERS || transferIndex <= 0)
                             break;
        -                if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) {
        +                if (U.compareAndSetInt(this, SIZECTL, sc, sc + 1)) {
                             transfer(tab, nextTab);
                             break;
                         }
        @@ -2402,7 +2402,7 @@ public class ConcurrentHashMap extends AbstractMap
                     Node[] tab = table; int n;
                     if (tab == null || (n = tab.length) == 0) {
                         n = (sc > c) ? sc : c;
        -                if (U.compareAndSwapInt(this, SIZECTL, sc, -1)) {
        +                if (U.compareAndSetInt(this, SIZECTL, sc, -1)) {
                             try {
                                 if (table == tab) {
                                     @SuppressWarnings("unchecked")
        @@ -2419,7 +2419,7 @@ public class ConcurrentHashMap extends AbstractMap
                         break;
                     else if (tab == table) {
                         int rs = resizeStamp(n);
        -                if (U.compareAndSwapInt(this, SIZECTL, sc,
        +                if (U.compareAndSetInt(this, SIZECTL, sc,
                                                 (rs << RESIZE_STAMP_SHIFT) + 2))
                             transfer(tab, null);
                     }
        @@ -2460,7 +2460,7 @@ public class ConcurrentHashMap extends AbstractMap
                             i = -1;
                             advance = false;
                         }
        -                else if (U.compareAndSwapInt
        +                else if (U.compareAndSetInt
                                  (this, TRANSFERINDEX, nextIndex,
                                   nextBound = (nextIndex > stride ?
                                                nextIndex - stride : 0))) {
        @@ -2477,7 +2477,7 @@ public class ConcurrentHashMap extends AbstractMap
                             sizeCtl = (n << 1) - (n >>> 1);
                             return;
                         }
        -                if (U.compareAndSwapInt(this, SIZECTL, sc = sizeCtl, sc - 1)) {
        +                if (U.compareAndSetInt(this, SIZECTL, sc = sizeCtl, sc - 1)) {
                             if ((sc - 2) != resizeStamp(n) << RESIZE_STAMP_SHIFT)
                                 return;
                             finishing = advance = true;
        @@ -2602,7 +2602,7 @@ public class ConcurrentHashMap extends AbstractMap
                             if (cellsBusy == 0) {            // Try to attach new Cell
                                 CounterCell r = new CounterCell(x); // Optimistic create
                                 if (cellsBusy == 0 &&
        -                            U.compareAndSwapInt(this, CELLSBUSY, 0, 1)) {
        +                            U.compareAndSetInt(this, CELLSBUSY, 0, 1)) {
                                     boolean created = false;
                                     try {               // Recheck under lock
                                         CounterCell[] rs; int m, j;
        @@ -2624,14 +2624,14 @@ public class ConcurrentHashMap extends AbstractMap
                         }
                         else if (!wasUncontended)       // CAS already known to fail
                             wasUncontended = true;      // Continue after rehash
        -                else if (U.compareAndSwapLong(a, CELLVALUE, v = a.value, v + x))
        +                else if (U.compareAndSetLong(a, CELLVALUE, v = a.value, v + x))
                             break;
                         else if (counterCells != as || n >= NCPU)
                             collide = false;            // At max size or stale
                         else if (!collide)
                             collide = true;
                         else if (cellsBusy == 0 &&
        -                         U.compareAndSwapInt(this, CELLSBUSY, 0, 1)) {
        +                         U.compareAndSetInt(this, CELLSBUSY, 0, 1)) {
                             try {
                                 if (counterCells == as) {// Expand table unless stale
                                     CounterCell[] rs = new CounterCell[n << 1];
        @@ -2648,7 +2648,7 @@ public class ConcurrentHashMap extends AbstractMap
                         h = ThreadLocalRandom.advanceProbe(h);
                     }
                     else if (cellsBusy == 0 && counterCells == as &&
        -                     U.compareAndSwapInt(this, CELLSBUSY, 0, 1)) {
        +                     U.compareAndSetInt(this, CELLSBUSY, 0, 1)) {
                         boolean init = false;
                         try {                           // Initialize table
                             if (counterCells == as) {
        @@ -2663,7 +2663,7 @@ public class ConcurrentHashMap extends AbstractMap
                         if (init)
                             break;
                     }
        -            else if (U.compareAndSwapLong(this, BASECOUNT, v = baseCount, v + x))
        +            else if (U.compareAndSetLong(this, BASECOUNT, v = baseCount, v + x))
                         break;                          // Fall back on using base
                 }
             }
        @@ -2859,7 +2859,7 @@ public class ConcurrentHashMap extends AbstractMap
                  * Acquires write lock for tree restructuring.
                  */
                 private final void lockRoot() {
        -            if (!U.compareAndSwapInt(this, LOCKSTATE, 0, WRITER))
        +            if (!U.compareAndSetInt(this, LOCKSTATE, 0, WRITER))
                         contendedLock(); // offload to separate method
                 }
         
        @@ -2877,14 +2877,14 @@ public class ConcurrentHashMap extends AbstractMap
                     boolean waiting = false;
                     for (int s;;) {
                         if (((s = lockState) & ~WAITER) == 0) {
        -                    if (U.compareAndSwapInt(this, LOCKSTATE, s, WRITER)) {
        +                    if (U.compareAndSetInt(this, LOCKSTATE, s, WRITER)) {
                                 if (waiting)
                                     waiter = null;
                                 return;
                             }
                         }
                         else if ((s & WAITER) == 0) {
        -                    if (U.compareAndSwapInt(this, LOCKSTATE, s, s | WAITER)) {
        +                    if (U.compareAndSetInt(this, LOCKSTATE, s, s | WAITER)) {
                                 waiting = true;
                                 waiter = Thread.currentThread();
                             }
        @@ -2909,7 +2909,7 @@ public class ConcurrentHashMap extends AbstractMap
                                     return e;
                                 e = e.next;
                             }
        -                    else if (U.compareAndSwapInt(this, LOCKSTATE, s,
        +                    else if (U.compareAndSetInt(this, LOCKSTATE, s,
                                                          s + READER)) {
                                 TreeNode r, p;
                                 try {
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java
        index f2184aaeebd..22850e6dab7 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java
        @@ -140,7 +140,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
              * the actual value was not equal to the expected value.
              */
             public final boolean compareAndSet(int expectedValue, int newValue) {
        -        return U.compareAndSwapInt(this, VALUE, expectedValue, newValue);
        +        return U.compareAndSetInt(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -161,7 +161,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
              */
             @Deprecated(since="9")
             public final boolean weakCompareAndSet(int expectedValue, int newValue) {
        -        return U.weakCompareAndSwapInt(this, VALUE, expectedValue, newValue);
        +        return U.weakCompareAndSetIntPlain(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -175,7 +175,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
              * @since 9
              */
             public final boolean weakCompareAndSetPlain(int expectedValue, int newValue) {
        -        return U.weakCompareAndSwapInt(this, VALUE, expectedValue, newValue);
        +        return U.weakCompareAndSetIntPlain(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -473,7 +473,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
              * @since 9
              */
             public final int compareAndExchange(int expectedValue, int newValue) {
        -        return U.compareAndExchangeIntVolatile(this, VALUE, expectedValue, newValue);
        +        return U.compareAndExchangeInt(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -520,7 +520,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
              * @since 9
              */
             public final boolean weakCompareAndSetVolatile(int expectedValue, int newValue) {
        -        return U.weakCompareAndSwapIntVolatile(this, VALUE, expectedValue, newValue);
        +        return U.weakCompareAndSetInt(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -535,7 +535,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
              * @since 9
              */
             public final boolean weakCompareAndSetAcquire(int expectedValue, int newValue) {
        -        return U.weakCompareAndSwapIntAcquire(this, VALUE, expectedValue, newValue);
        +        return U.weakCompareAndSetIntAcquire(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -550,7 +550,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
              * @since 9
              */
             public final boolean weakCompareAndSetRelease(int expectedValue, int newValue) {
        -        return U.weakCompareAndSwapIntRelease(this, VALUE, expectedValue, newValue);
        +        return U.weakCompareAndSetIntRelease(this, VALUE, expectedValue, newValue);
             }
         
         }
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
        index 1de994f06ec..826a0557b5f 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
        @@ -481,12 +481,12 @@ public abstract class AtomicIntegerFieldUpdater {
         
                 public final boolean compareAndSet(T obj, int expect, int update) {
                     accessCheck(obj);
        -            return U.compareAndSwapInt(obj, offset, expect, update);
        +            return U.compareAndSetInt(obj, offset, expect, update);
                 }
         
                 public final boolean weakCompareAndSet(T obj, int expect, int update) {
                     accessCheck(obj);
        -            return U.compareAndSwapInt(obj, offset, expect, update);
        +            return U.compareAndSetInt(obj, offset, expect, update);
                 }
         
                 public final void set(T obj, int newValue) {
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java
        index a0670eeac8f..940f67c1bf3 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java
        @@ -56,7 +56,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
         
             /**
              * Records whether the underlying JVM supports lockless
        -     * compareAndSwap for longs. While the intrinsic compareAndSwapLong
        +     * compareAndSet for longs. While the intrinsic compareAndSetLong
              * method works in either case, some constructions should be
              * handled at Java level to avoid locking user-visible locks.
              */
        @@ -119,7 +119,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
              */
             public final void set(long newValue) {
                 // Use putLongVolatile instead of ordinary volatile store when
        -        // using compareAndSwapLong, for sake of some 32bit systems.
        +        // using compareAndSetLong, for sake of some 32bit systems.
                 U.putLongVolatile(this, VALUE, newValue);
             }
         
        @@ -156,7 +156,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
              * the actual value was not equal to the expected value.
              */
             public final boolean compareAndSet(long expectedValue, long newValue) {
        -        return U.compareAndSwapLong(this, VALUE, expectedValue, newValue);
        +        return U.compareAndSetLong(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -177,7 +177,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
              */
             @Deprecated(since="9")
             public final boolean weakCompareAndSet(long expectedValue, long newValue) {
        -        return U.weakCompareAndSwapLong(this, VALUE, expectedValue, newValue);
        +        return U.weakCompareAndSetLongPlain(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -191,7 +191,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
              * @since 9
              */
             public final boolean weakCompareAndSetPlain(long expectedValue, long newValue) {
        -        return U.weakCompareAndSwapLong(this, VALUE, expectedValue, newValue);
        +        return U.weakCompareAndSetLongPlain(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -487,7 +487,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
              * @since 9
              */
             public final long compareAndExchange(long expectedValue, long newValue) {
        -        return U.compareAndExchangeLongVolatile(this, VALUE, expectedValue, newValue);
        +        return U.compareAndExchangeLong(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -534,7 +534,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
              * @since 9
              */
             public final boolean weakCompareAndSetVolatile(long expectedValue, long newValue) {
        -        return U.weakCompareAndSwapLongVolatile(this, VALUE, expectedValue, newValue);
        +        return U.weakCompareAndSetLong(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -549,7 +549,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
              * @since 9
              */
             public final boolean weakCompareAndSetAcquire(long expectedValue, long newValue) {
        -        return U.weakCompareAndSwapLongAcquire(this, VALUE, expectedValue, newValue);
        +        return U.weakCompareAndSetLongAcquire(this, VALUE, expectedValue, newValue);
             }
         
             /**
        @@ -564,7 +564,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
              * @since 9
              */
             public final boolean weakCompareAndSetRelease(long expectedValue, long newValue) {
        -        return U.weakCompareAndSwapLongRelease(this, VALUE, expectedValue, newValue);
        +        return U.weakCompareAndSetLongRelease(this, VALUE, expectedValue, newValue);
             }
         
         }
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
        index bd60f0bdcbb..ee0447a8b88 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
        @@ -454,12 +454,12 @@ public abstract class AtomicLongFieldUpdater {
         
                 public final boolean compareAndSet(T obj, long expect, long update) {
                     accessCheck(obj);
        -            return U.compareAndSwapLong(obj, offset, expect, update);
        +            return U.compareAndSetLong(obj, offset, expect, update);
                 }
         
                 public final boolean weakCompareAndSet(T obj, long expect, long update) {
                     accessCheck(obj);
        -            return U.compareAndSwapLong(obj, offset, expect, update);
        +            return U.compareAndSetLong(obj, offset, expect, update);
                 }
         
                 public final void set(T obj, long newValue) {
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
        index 56f6751b9f0..a469abb98cc 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
        @@ -432,14 +432,14 @@ public abstract class AtomicReferenceFieldUpdater {
                 public final boolean compareAndSet(T obj, V expect, V update) {
                     accessCheck(obj);
                     valueCheck(update);
        -            return U.compareAndSwapObject(obj, offset, expect, update);
        +            return U.compareAndSetObject(obj, offset, expect, update);
                 }
         
                 public final boolean weakCompareAndSet(T obj, V expect, V update) {
                     // same implementation as strong form for now
                     accessCheck(obj);
                     valueCheck(update);
        -            return U.compareAndSwapObject(obj, offset, expect, update);
        +            return U.compareAndSetObject(obj, offset, expect, update);
                 }
         
                 public final void set(T obj, V newValue) {
        diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
        index f4de0ea0c47..f9d7e3e22b0 100644
        --- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
        +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2000, 2017, 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
        @@ -1278,55 +1278,55 @@ public final class Unsafe {
              * @return {@code true} if successful
              */
             @HotSpotIntrinsicCandidate
        -    public final native boolean compareAndSwapObject(Object o, long offset,
        -                                                     Object expected,
        -                                                     Object x);
        +    public final native boolean compareAndSetObject(Object o, long offset,
        +                                                    Object expected,
        +                                                    Object x);
         
             @HotSpotIntrinsicCandidate
        -    public final native Object compareAndExchangeObjectVolatile(Object o, long offset,
        -                                                                Object expected,
        -                                                                Object x);
        +    public final native Object compareAndExchangeObject(Object o, long offset,
        +                                                        Object expected,
        +                                                        Object x);
         
             @HotSpotIntrinsicCandidate
             public final Object compareAndExchangeObjectAcquire(Object o, long offset,
                                                                        Object expected,
                                                                        Object x) {
        -        return compareAndExchangeObjectVolatile(o, offset, expected, x);
        +        return compareAndExchangeObject(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
             public final Object compareAndExchangeObjectRelease(Object o, long offset,
                                                                        Object expected,
                                                                        Object x) {
        -        return compareAndExchangeObjectVolatile(o, offset, expected, x);
        +        return compareAndExchangeObject(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapObject(Object o, long offset,
        -                                                         Object expected,
        -                                                         Object x) {
        -        return compareAndSwapObject(o, offset, expected, x);
        +    public final boolean weakCompareAndSetObjectPlain(Object o, long offset,
        +                                                      Object expected,
        +                                                      Object x) {
        +        return compareAndSetObject(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapObjectAcquire(Object o, long offset,
        -                                                                Object expected,
        -                                                                Object x) {
        -        return compareAndSwapObject(o, offset, expected, x);
        +    public final boolean weakCompareAndSetObjectAcquire(Object o, long offset,
        +                                                        Object expected,
        +                                                        Object x) {
        +        return compareAndSetObject(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapObjectRelease(Object o, long offset,
        -                                                                Object expected,
        -                                                                Object x) {
        -        return compareAndSwapObject(o, offset, expected, x);
        +    public final boolean weakCompareAndSetObjectRelease(Object o, long offset,
        +                                                        Object expected,
        +                                                        Object x) {
        +        return compareAndSetObject(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapObjectVolatile(Object o, long offset,
        -                                                                Object expected,
        -                                                                Object x) {
        -        return compareAndSwapObject(o, offset, expected, x);
        +    public final boolean weakCompareAndSetObject(Object o, long offset,
        +                                                 Object expected,
        +                                                 Object x) {
        +        return compareAndSetObject(o, offset, expected, x);
             }
         
             /**
        @@ -1339,61 +1339,61 @@ public final class Unsafe {
              * @return {@code true} if successful
              */
             @HotSpotIntrinsicCandidate
        -    public final native boolean compareAndSwapInt(Object o, long offset,
        -                                                  int expected,
        -                                                  int x);
        +    public final native boolean compareAndSetInt(Object o, long offset,
        +                                                 int expected,
        +                                                 int x);
         
             @HotSpotIntrinsicCandidate
        -    public final native int compareAndExchangeIntVolatile(Object o, long offset,
        -                                                          int expected,
        -                                                          int x);
        +    public final native int compareAndExchangeInt(Object o, long offset,
        +                                                  int expected,
        +                                                  int x);
         
             @HotSpotIntrinsicCandidate
             public final int compareAndExchangeIntAcquire(Object o, long offset,
                                                                  int expected,
                                                                  int x) {
        -        return compareAndExchangeIntVolatile(o, offset, expected, x);
        +        return compareAndExchangeInt(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
             public final int compareAndExchangeIntRelease(Object o, long offset,
                                                                  int expected,
                                                                  int x) {
        -        return compareAndExchangeIntVolatile(o, offset, expected, x);
        +        return compareAndExchangeInt(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapInt(Object o, long offset,
        -                                                      int expected,
        -                                                      int x) {
        -        return compareAndSwapInt(o, offset, expected, x);
        +    public final boolean weakCompareAndSetIntPlain(Object o, long offset,
        +                                                   int expected,
        +                                                   int x) {
        +        return compareAndSetInt(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapIntAcquire(Object o, long offset,
        -                                                             int expected,
        -                                                             int x) {
        -        return compareAndSwapInt(o, offset, expected, x);
        +    public final boolean weakCompareAndSetIntAcquire(Object o, long offset,
        +                                                     int expected,
        +                                                     int x) {
        +        return compareAndSetInt(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapIntRelease(Object o, long offset,
        -                                                             int expected,
        -                                                             int x) {
        -        return compareAndSwapInt(o, offset, expected, x);
        +    public final boolean weakCompareAndSetIntRelease(Object o, long offset,
        +                                                     int expected,
        +                                                     int x) {
        +        return compareAndSetInt(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapIntVolatile(Object o, long offset,
        -                                                             int expected,
        -                                                             int x) {
        -        return compareAndSwapInt(o, offset, expected, x);
        +    public final boolean weakCompareAndSetInt(Object o, long offset,
        +                                              int expected,
        +                                              int x) {
        +        return compareAndSetInt(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final byte compareAndExchangeByteVolatile(Object o, long offset,
        -                                                     byte expected,
        -                                                     byte x) {
        +    public final byte compareAndExchangeByte(Object o, long offset,
        +                                             byte expected,
        +                                             byte x) {
                 long wordOffset = offset & ~3;
                 int shift = (int) (offset & 3) << 3;
                 if (BE) {
        @@ -1407,64 +1407,64 @@ public final class Unsafe {
                     fullWord = getIntVolatile(o, wordOffset);
                     if ((fullWord & mask) != maskedExpected)
                         return (byte) ((fullWord & mask) >> shift);
        -        } while (!weakCompareAndSwapIntVolatile(o, wordOffset,
        +        } while (!weakCompareAndSetInt(o, wordOffset,
                                                         fullWord, (fullWord & ~mask) | maskedX));
                 return expected;
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean compareAndSwapByte(Object o, long offset,
        -                                            byte expected,
        -                                            byte x) {
        -        return compareAndExchangeByteVolatile(o, offset, expected, x) == expected;
        +    public final boolean compareAndSetByte(Object o, long offset,
        +                                           byte expected,
        +                                           byte x) {
        +        return compareAndExchangeByte(o, offset, expected, x) == expected;
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapByteVolatile(Object o, long offset,
        -                                                        byte expected,
        -                                                        byte x) {
        -        return compareAndSwapByte(o, offset, expected, x);
        +    public final boolean weakCompareAndSetByte(Object o, long offset,
        +                                               byte expected,
        +                                               byte x) {
        +        return compareAndSetByte(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapByteAcquire(Object o, long offset,
        -                                                       byte expected,
        -                                                       byte x) {
        -        return weakCompareAndSwapByteVolatile(o, offset, expected, x);
        +    public final boolean weakCompareAndSetByteAcquire(Object o, long offset,
        +                                                      byte expected,
        +                                                      byte x) {
        +        return weakCompareAndSetByte(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapByteRelease(Object o, long offset,
        -                                                       byte expected,
        -                                                       byte x) {
        -        return weakCompareAndSwapByteVolatile(o, offset, expected, x);
        +    public final boolean weakCompareAndSetByteRelease(Object o, long offset,
        +                                                      byte expected,
        +                                                      byte x) {
        +        return weakCompareAndSetByte(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapByte(Object o, long offset,
        -                                                        byte expected,
        -                                                        byte x) {
        -        return weakCompareAndSwapByteVolatile(o, offset, expected, x);
        +    public final boolean weakCompareAndSetBytePlain(Object o, long offset,
        +                                                    byte expected,
        +                                                    byte x) {
        +        return weakCompareAndSetByte(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
             public final byte compareAndExchangeByteAcquire(Object o, long offset,
                                                             byte expected,
                                                             byte x) {
        -        return compareAndExchangeByteVolatile(o, offset, expected, x);
        +        return compareAndExchangeByte(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
             public final byte compareAndExchangeByteRelease(Object o, long offset,
                                                             byte expected,
                                                             byte x) {
        -        return compareAndExchangeByteVolatile(o, offset, expected, x);
        +        return compareAndExchangeByte(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final short compareAndExchangeShortVolatile(Object o, long offset,
        -                                             short expected,
        -                                             short x) {
        +    public final short compareAndExchangeShort(Object o, long offset,
        +                                               short expected,
        +                                               short x) {
                 if ((offset & 3) == 3) {
                     throw new IllegalArgumentException("Update spans the word, not supported");
                 }
        @@ -1482,44 +1482,44 @@ public final class Unsafe {
                     if ((fullWord & mask) != maskedExpected) {
                         return (short) ((fullWord & mask) >> shift);
                     }
        -        } while (!weakCompareAndSwapIntVolatile(o, wordOffset,
        +        } while (!weakCompareAndSetInt(o, wordOffset,
                                                         fullWord, (fullWord & ~mask) | maskedX));
                 return expected;
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean compareAndSwapShort(Object o, long offset,
        -                                             short expected,
        -                                             short x) {
        -        return compareAndExchangeShortVolatile(o, offset, expected, x) == expected;
        +    public final boolean compareAndSetShort(Object o, long offset,
        +                                            short expected,
        +                                            short x) {
        +        return compareAndExchangeShort(o, offset, expected, x) == expected;
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapShortVolatile(Object o, long offset,
        -                                                         short expected,
        -                                                         short x) {
        -        return compareAndSwapShort(o, offset, expected, x);
        +    public final boolean weakCompareAndSetShort(Object o, long offset,
        +                                                short expected,
        +                                                short x) {
        +        return compareAndSetShort(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapShortAcquire(Object o, long offset,
        -                                                        short expected,
        -                                                        short x) {
        -        return weakCompareAndSwapShortVolatile(o, offset, expected, x);
        +    public final boolean weakCompareAndSetShortAcquire(Object o, long offset,
        +                                                       short expected,
        +                                                       short x) {
        +        return weakCompareAndSetShort(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapShortRelease(Object o, long offset,
        -                                                        short expected,
        -                                                        short x) {
        -        return weakCompareAndSwapShortVolatile(o, offset, expected, x);
        +    public final boolean weakCompareAndSetShortRelease(Object o, long offset,
        +                                                       short expected,
        +                                                       short x) {
        +        return weakCompareAndSetShort(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapShort(Object o, long offset,
        -                                                 short expected,
        -                                                 short x) {
        -        return weakCompareAndSwapShortVolatile(o, offset, expected, x);
        +    public final boolean weakCompareAndSetShortPlain(Object o, long offset,
        +                                                     short expected,
        +                                                     short x) {
        +        return weakCompareAndSetShort(o, offset, expected, x);
             }
         
         
        @@ -1527,14 +1527,14 @@ public final class Unsafe {
             public final short compareAndExchangeShortAcquire(Object o, long offset,
                                                              short expected,
                                                              short x) {
        -        return compareAndExchangeShortVolatile(o, offset, expected, x);
        +        return compareAndExchangeShort(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
             public final short compareAndExchangeShortRelease(Object o, long offset,
                                                             short expected,
                                                             short x) {
        -        return compareAndExchangeShortVolatile(o, offset, expected, x);
        +        return compareAndExchangeShort(o, offset, expected, x);
             }
         
             @ForceInline
        @@ -1548,17 +1548,17 @@ public final class Unsafe {
             }
         
             @ForceInline
        -    public final boolean compareAndSwapChar(Object o, long offset,
        -                                            char expected,
        -                                            char x) {
        -        return compareAndSwapShort(o, offset, c2s(expected), c2s(x));
        +    public final boolean compareAndSetChar(Object o, long offset,
        +                                           char expected,
        +                                           char x) {
        +        return compareAndSetShort(o, offset, c2s(expected), c2s(x));
             }
         
             @ForceInline
        -    public final char compareAndExchangeCharVolatile(Object o, long offset,
        -                                            char expected,
        -                                            char x) {
        -        return s2c(compareAndExchangeShortVolatile(o, offset, c2s(expected), c2s(x)));
        +    public final char compareAndExchangeChar(Object o, long offset,
        +                                             char expected,
        +                                             char x) {
        +        return s2c(compareAndExchangeShort(o, offset, c2s(expected), c2s(x)));
             }
         
             @ForceInline
        @@ -1576,31 +1576,31 @@ public final class Unsafe {
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapCharVolatile(Object o, long offset,
        -                                            char expected,
        -                                            char x) {
        -        return weakCompareAndSwapShortVolatile(o, offset, c2s(expected), c2s(x));
        +    public final boolean weakCompareAndSetChar(Object o, long offset,
        +                                               char expected,
        +                                               char x) {
        +        return weakCompareAndSetShort(o, offset, c2s(expected), c2s(x));
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapCharAcquire(Object o, long offset,
        -                                            char expected,
        -                                            char x) {
        -        return weakCompareAndSwapShortAcquire(o, offset, c2s(expected), c2s(x));
        +    public final boolean weakCompareAndSetCharAcquire(Object o, long offset,
        +                                                      char expected,
        +                                                      char x) {
        +        return weakCompareAndSetShortAcquire(o, offset, c2s(expected), c2s(x));
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapCharRelease(Object o, long offset,
        -                                            char expected,
        -                                            char x) {
        -        return weakCompareAndSwapShortRelease(o, offset, c2s(expected), c2s(x));
        +    public final boolean weakCompareAndSetCharRelease(Object o, long offset,
        +                                                      char expected,
        +                                                      char x) {
        +        return weakCompareAndSetShortRelease(o, offset, c2s(expected), c2s(x));
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapChar(Object o, long offset,
        -                                            char expected,
        -                                            char x) {
        -        return weakCompareAndSwapShort(o, offset, c2s(expected), c2s(x));
        +    public final boolean weakCompareAndSetCharPlain(Object o, long offset,
        +                                                    char expected,
        +                                                    char x) {
        +        return weakCompareAndSetShortPlain(o, offset, c2s(expected), c2s(x));
             }
         
             /**
        @@ -1653,17 +1653,17 @@ public final class Unsafe {
             }
         
             @ForceInline
        -    public final boolean compareAndSwapBoolean(Object o, long offset,
        -                                               boolean expected,
        -                                               boolean x) {
        -        return compareAndSwapByte(o, offset, bool2byte(expected), bool2byte(x));
        +    public final boolean compareAndSetBoolean(Object o, long offset,
        +                                              boolean expected,
        +                                              boolean x) {
        +        return compareAndSetByte(o, offset, bool2byte(expected), bool2byte(x));
             }
         
             @ForceInline
        -    public final boolean compareAndExchangeBooleanVolatile(Object o, long offset,
        -                                                        boolean expected,
        -                                                        boolean x) {
        -        return byte2bool(compareAndExchangeByteVolatile(o, offset, bool2byte(expected), bool2byte(x)));
        +    public final boolean compareAndExchangeBoolean(Object o, long offset,
        +                                                   boolean expected,
        +                                                   boolean x) {
        +        return byte2bool(compareAndExchangeByte(o, offset, bool2byte(expected), bool2byte(x)));
             }
         
             @ForceInline
        @@ -1681,31 +1681,31 @@ public final class Unsafe {
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapBooleanVolatile(Object o, long offset,
        -                                                           boolean expected,
        -                                                           boolean x) {
        -        return weakCompareAndSwapByteVolatile(o, offset, bool2byte(expected), bool2byte(x));
        +    public final boolean weakCompareAndSetBoolean(Object o, long offset,
        +                                                  boolean expected,
        +                                                  boolean x) {
        +        return weakCompareAndSetByte(o, offset, bool2byte(expected), bool2byte(x));
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapBooleanAcquire(Object o, long offset,
        -                                                          boolean expected,
        -                                                          boolean x) {
        -        return weakCompareAndSwapByteAcquire(o, offset, bool2byte(expected), bool2byte(x));
        +    public final boolean weakCompareAndSetBooleanAcquire(Object o, long offset,
        +                                                         boolean expected,
        +                                                         boolean x) {
        +        return weakCompareAndSetByteAcquire(o, offset, bool2byte(expected), bool2byte(x));
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapBooleanRelease(Object o, long offset,
        -                                                          boolean expected,
        -                                                          boolean x) {
        -        return weakCompareAndSwapByteRelease(o, offset, bool2byte(expected), bool2byte(x));
        +    public final boolean weakCompareAndSetBooleanRelease(Object o, long offset,
        +                                                         boolean expected,
        +                                                         boolean x) {
        +        return weakCompareAndSetByteRelease(o, offset, bool2byte(expected), bool2byte(x));
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapBoolean(Object o, long offset,
        -                                                   boolean expected,
        -                                                   boolean x) {
        -        return weakCompareAndSwapByte(o, offset, bool2byte(expected), bool2byte(x));
        +    public final boolean weakCompareAndSetBooleanPlain(Object o, long offset,
        +                                                       boolean expected,
        +                                                       boolean x) {
        +        return weakCompareAndSetBytePlain(o, offset, bool2byte(expected), bool2byte(x));
             }
         
             /**
        @@ -1718,21 +1718,21 @@ public final class Unsafe {
              * @return {@code true} if successful
              */
             @ForceInline
        -    public final boolean compareAndSwapFloat(Object o, long offset,
        -                                             float expected,
        -                                             float x) {
        -        return compareAndSwapInt(o, offset,
        +    public final boolean compareAndSetFloat(Object o, long offset,
        +                                            float expected,
        +                                            float x) {
        +        return compareAndSetInt(o, offset,
                                          Float.floatToRawIntBits(expected),
                                          Float.floatToRawIntBits(x));
             }
         
             @ForceInline
        -    public final float compareAndExchangeFloatVolatile(Object o, long offset,
        -                                                       float expected,
        -                                                       float x) {
        -        int w = compareAndExchangeIntVolatile(o, offset,
        -                                              Float.floatToRawIntBits(expected),
        -                                              Float.floatToRawIntBits(x));
        +    public final float compareAndExchangeFloat(Object o, long offset,
        +                                               float expected,
        +                                               float x) {
        +        int w = compareAndExchangeInt(o, offset,
        +                                      Float.floatToRawIntBits(expected),
        +                                      Float.floatToRawIntBits(x));
                 return Float.intBitsToFloat(w);
             }
         
        @@ -1757,37 +1757,37 @@ public final class Unsafe {
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapFloat(Object o, long offset,
        -                                               float expected,
        -                                               float x) {
        -        return weakCompareAndSwapInt(o, offset,
        +    public final boolean weakCompareAndSetFloatPlain(Object o, long offset,
        +                                                     float expected,
        +                                                     float x) {
        +        return weakCompareAndSetIntPlain(o, offset,
                                              Float.floatToRawIntBits(expected),
                                              Float.floatToRawIntBits(x));
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapFloatAcquire(Object o, long offset,
        -                                                      float expected,
        -                                                      float x) {
        -        return weakCompareAndSwapIntAcquire(o, offset,
        -                                            Float.floatToRawIntBits(expected),
        -                                            Float.floatToRawIntBits(x));
        -    }
        -
        -    @ForceInline
        -    public final boolean weakCompareAndSwapFloatRelease(Object o, long offset,
        -                                                      float expected,
        -                                                      float x) {
        -        return weakCompareAndSwapIntRelease(o, offset,
        -                                            Float.floatToRawIntBits(expected),
        -                                            Float.floatToRawIntBits(x));
        -    }
        -
        -    @ForceInline
        -    public final boolean weakCompareAndSwapFloatVolatile(Object o, long offset,
        +    public final boolean weakCompareAndSetFloatAcquire(Object o, long offset,
                                                                float expected,
                                                                float x) {
        -        return weakCompareAndSwapIntVolatile(o, offset,
        +        return weakCompareAndSetIntAcquire(o, offset,
        +                                            Float.floatToRawIntBits(expected),
        +                                            Float.floatToRawIntBits(x));
        +    }
        +
        +    @ForceInline
        +    public final boolean weakCompareAndSetFloatRelease(Object o, long offset,
        +                                                       float expected,
        +                                                       float x) {
        +        return weakCompareAndSetIntRelease(o, offset,
        +                                            Float.floatToRawIntBits(expected),
        +                                            Float.floatToRawIntBits(x));
        +    }
        +
        +    @ForceInline
        +    public final boolean weakCompareAndSetFloat(Object o, long offset,
        +                                                float expected,
        +                                                float x) {
        +        return weakCompareAndSetInt(o, offset,
                                                      Float.floatToRawIntBits(expected),
                                                      Float.floatToRawIntBits(x));
             }
        @@ -1802,21 +1802,21 @@ public final class Unsafe {
              * @return {@code true} if successful
              */
             @ForceInline
        -    public final boolean compareAndSwapDouble(Object o, long offset,
        -                                              double expected,
        -                                              double x) {
        -        return compareAndSwapLong(o, offset,
        -                                  Double.doubleToRawLongBits(expected),
        -                                  Double.doubleToRawLongBits(x));
        +    public final boolean compareAndSetDouble(Object o, long offset,
        +                                             double expected,
        +                                             double x) {
        +        return compareAndSetLong(o, offset,
        +                                 Double.doubleToRawLongBits(expected),
        +                                 Double.doubleToRawLongBits(x));
             }
         
             @ForceInline
        -    public final double compareAndExchangeDoubleVolatile(Object o, long offset,
        -                                                         double expected,
        -                                                         double x) {
        -        long w = compareAndExchangeLongVolatile(o, offset,
        -                                                Double.doubleToRawLongBits(expected),
        -                                                Double.doubleToRawLongBits(x));
        +    public final double compareAndExchangeDouble(Object o, long offset,
        +                                                 double expected,
        +                                                 double x) {
        +        long w = compareAndExchangeLong(o, offset,
        +                                        Double.doubleToRawLongBits(expected),
        +                                        Double.doubleToRawLongBits(x));
                 return Double.longBitsToDouble(w);
             }
         
        @@ -1841,37 +1841,37 @@ public final class Unsafe {
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapDouble(Object o, long offset,
        -                                                  double expected,
        -                                                  double x) {
        -        return weakCompareAndSwapLong(o, offset,
        +    public final boolean weakCompareAndSetDoublePlain(Object o, long offset,
        +                                                      double expected,
        +                                                      double x) {
        +        return weakCompareAndSetLongPlain(o, offset,
                                              Double.doubleToRawLongBits(expected),
                                              Double.doubleToRawLongBits(x));
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapDoubleAcquire(Object o, long offset,
        -                                                         double expected,
        -                                                         double x) {
        -        return weakCompareAndSwapLongAcquire(o, offset,
        +    public final boolean weakCompareAndSetDoubleAcquire(Object o, long offset,
        +                                                        double expected,
        +                                                        double x) {
        +        return weakCompareAndSetLongAcquire(o, offset,
                                                      Double.doubleToRawLongBits(expected),
                                                      Double.doubleToRawLongBits(x));
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapDoubleRelease(Object o, long offset,
        -                                                         double expected,
        -                                                         double x) {
        -        return weakCompareAndSwapLongRelease(o, offset,
        +    public final boolean weakCompareAndSetDoubleRelease(Object o, long offset,
        +                                                        double expected,
        +                                                        double x) {
        +        return weakCompareAndSetLongRelease(o, offset,
                                                      Double.doubleToRawLongBits(expected),
                                                      Double.doubleToRawLongBits(x));
             }
         
             @ForceInline
        -    public final boolean weakCompareAndSwapDoubleVolatile(Object o, long offset,
        -                                                          double expected,
        -                                                          double x) {
        -        return weakCompareAndSwapLongVolatile(o, offset,
        +    public final boolean weakCompareAndSetDouble(Object o, long offset,
        +                                                 double expected,
        +                                                 double x) {
        +        return weakCompareAndSetLong(o, offset,
                                                       Double.doubleToRawLongBits(expected),
                                                       Double.doubleToRawLongBits(x));
             }
        @@ -1886,55 +1886,55 @@ public final class Unsafe {
              * @return {@code true} if successful
              */
             @HotSpotIntrinsicCandidate
        -    public final native boolean compareAndSwapLong(Object o, long offset,
        -                                                   long expected,
        -                                                   long x);
        +    public final native boolean compareAndSetLong(Object o, long offset,
        +                                                  long expected,
        +                                                  long x);
         
             @HotSpotIntrinsicCandidate
        -    public final native long compareAndExchangeLongVolatile(Object o, long offset,
        -                                                            long expected,
        -                                                            long x);
        +    public final native long compareAndExchangeLong(Object o, long offset,
        +                                                    long expected,
        +                                                    long x);
         
             @HotSpotIntrinsicCandidate
             public final long compareAndExchangeLongAcquire(Object o, long offset,
                                                                    long expected,
                                                                    long x) {
        -        return compareAndExchangeLongVolatile(o, offset, expected, x);
        +        return compareAndExchangeLong(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
             public final long compareAndExchangeLongRelease(Object o, long offset,
                                                                    long expected,
                                                                    long x) {
        -        return compareAndExchangeLongVolatile(o, offset, expected, x);
        +        return compareAndExchangeLong(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapLong(Object o, long offset,
        -                                                       long expected,
        -                                                       long x) {
        -        return compareAndSwapLong(o, offset, expected, x);
        +    public final boolean weakCompareAndSetLongPlain(Object o, long offset,
        +                                                    long expected,
        +                                                    long x) {
        +        return compareAndSetLong(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapLongAcquire(Object o, long offset,
        -                                                              long expected,
        -                                                              long x) {
        -        return compareAndSwapLong(o, offset, expected, x);
        +    public final boolean weakCompareAndSetLongAcquire(Object o, long offset,
        +                                                      long expected,
        +                                                      long x) {
        +        return compareAndSetLong(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapLongRelease(Object o, long offset,
        -                                                              long expected,
        -                                                              long x) {
        -        return compareAndSwapLong(o, offset, expected, x);
        +    public final boolean weakCompareAndSetLongRelease(Object o, long offset,
        +                                                      long expected,
        +                                                      long x) {
        +        return compareAndSetLong(o, offset, expected, x);
             }
         
             @HotSpotIntrinsicCandidate
        -    public final boolean weakCompareAndSwapLongVolatile(Object o, long offset,
        -                                                              long expected,
        -                                                              long x) {
        -        return compareAndSwapLong(o, offset, expected, x);
        +    public final boolean weakCompareAndSetLong(Object o, long offset,
        +                                               long expected,
        +                                               long x) {
        +        return compareAndSetLong(o, offset, expected, x);
             }
         
             /**
        @@ -2316,7 +2316,7 @@ public final class Unsafe {
                 int v;
                 do {
                     v = getIntVolatile(o, offset);
        -        } while (!weakCompareAndSwapIntVolatile(o, offset, v, v + delta));
        +        } while (!weakCompareAndSetInt(o, offset, v, v + delta));
                 return v;
             }
         
        @@ -2325,7 +2325,7 @@ public final class Unsafe {
                 int v;
                 do {
                     v = getInt(o, offset);
        -        } while (!weakCompareAndSwapIntRelease(o, offset, v, v + delta));
        +        } while (!weakCompareAndSetIntRelease(o, offset, v, v + delta));
                 return v;
             }
         
        @@ -2334,7 +2334,7 @@ public final class Unsafe {
                 int v;
                 do {
                     v = getIntAcquire(o, offset);
        -        } while (!weakCompareAndSwapIntAcquire(o, offset, v, v + delta));
        +        } while (!weakCompareAndSetIntAcquire(o, offset, v, v + delta));
                 return v;
             }
         
        @@ -2354,7 +2354,7 @@ public final class Unsafe {
                 long v;
                 do {
                     v = getLongVolatile(o, offset);
        -        } while (!weakCompareAndSwapLongVolatile(o, offset, v, v + delta));
        +        } while (!weakCompareAndSetLong(o, offset, v, v + delta));
                 return v;
             }
         
        @@ -2363,7 +2363,7 @@ public final class Unsafe {
                 long v;
                 do {
                     v = getLong(o, offset);
        -        } while (!weakCompareAndSwapLongRelease(o, offset, v, v + delta));
        +        } while (!weakCompareAndSetLongRelease(o, offset, v, v + delta));
                 return v;
             }
         
        @@ -2372,7 +2372,7 @@ public final class Unsafe {
                 long v;
                 do {
                     v = getLongAcquire(o, offset);
        -        } while (!weakCompareAndSwapLongAcquire(o, offset, v, v + delta));
        +        } while (!weakCompareAndSetLongAcquire(o, offset, v, v + delta));
                 return v;
             }
         
        @@ -2381,7 +2381,7 @@ public final class Unsafe {
                 byte v;
                 do {
                     v = getByteVolatile(o, offset);
        -        } while (!weakCompareAndSwapByteVolatile(o, offset, v, (byte) (v + delta)));
        +        } while (!weakCompareAndSetByte(o, offset, v, (byte) (v + delta)));
                 return v;
             }
         
        @@ -2390,7 +2390,7 @@ public final class Unsafe {
                 byte v;
                 do {
                     v = getByte(o, offset);
        -        } while (!weakCompareAndSwapByteRelease(o, offset, v, (byte) (v + delta)));
        +        } while (!weakCompareAndSetByteRelease(o, offset, v, (byte) (v + delta)));
                 return v;
             }
         
        @@ -2399,7 +2399,7 @@ public final class Unsafe {
                 byte v;
                 do {
                     v = getByteAcquire(o, offset);
        -        } while (!weakCompareAndSwapByteAcquire(o, offset, v, (byte) (v + delta)));
        +        } while (!weakCompareAndSetByteAcquire(o, offset, v, (byte) (v + delta)));
                 return v;
             }
         
        @@ -2408,7 +2408,7 @@ public final class Unsafe {
                 short v;
                 do {
                     v = getShortVolatile(o, offset);
        -        } while (!weakCompareAndSwapShortVolatile(o, offset, v, (short) (v + delta)));
        +        } while (!weakCompareAndSetShort(o, offset, v, (short) (v + delta)));
                 return v;
             }
         
        @@ -2417,7 +2417,7 @@ public final class Unsafe {
                 short v;
                 do {
                     v = getShort(o, offset);
        -        } while (!weakCompareAndSwapShortRelease(o, offset, v, (short) (v + delta)));
        +        } while (!weakCompareAndSetShortRelease(o, offset, v, (short) (v + delta)));
                 return v;
             }
         
        @@ -2426,7 +2426,7 @@ public final class Unsafe {
                 short v;
                 do {
                     v = getShortAcquire(o, offset);
        -        } while (!weakCompareAndSwapShortAcquire(o, offset, v, (short) (v + delta)));
        +        } while (!weakCompareAndSetShortAcquire(o, offset, v, (short) (v + delta)));
                 return v;
             }
         
        @@ -2455,7 +2455,7 @@ public final class Unsafe {
                     // may result in the loop not terminating.
                     expectedBits = getIntVolatile(o, offset);
                     v = Float.intBitsToFloat(expectedBits);
        -        } while (!weakCompareAndSwapIntVolatile(o, offset,
        +        } while (!weakCompareAndSetInt(o, offset,
                                                         expectedBits, Float.floatToRawIntBits(v + delta)));
                 return v;
             }
        @@ -2470,7 +2470,7 @@ public final class Unsafe {
                     // may result in the loop not terminating.
                     expectedBits = getInt(o, offset);
                     v = Float.intBitsToFloat(expectedBits);
        -        } while (!weakCompareAndSwapIntRelease(o, offset,
        +        } while (!weakCompareAndSetIntRelease(o, offset,
                                                        expectedBits, Float.floatToRawIntBits(v + delta)));
                 return v;
             }
        @@ -2485,7 +2485,7 @@ public final class Unsafe {
                     // may result in the loop not terminating.
                     expectedBits = getIntAcquire(o, offset);
                     v = Float.intBitsToFloat(expectedBits);
        -        } while (!weakCompareAndSwapIntAcquire(o, offset,
        +        } while (!weakCompareAndSetIntAcquire(o, offset,
                                                        expectedBits, Float.floatToRawIntBits(v + delta)));
                 return v;
             }
        @@ -2500,7 +2500,7 @@ public final class Unsafe {
                     // may result in the loop not terminating.
                     expectedBits = getLongVolatile(o, offset);
                     v = Double.longBitsToDouble(expectedBits);
        -        } while (!weakCompareAndSwapLongVolatile(o, offset,
        +        } while (!weakCompareAndSetLong(o, offset,
                                                          expectedBits, Double.doubleToRawLongBits(v + delta)));
                 return v;
             }
        @@ -2515,7 +2515,7 @@ public final class Unsafe {
                     // may result in the loop not terminating.
                     expectedBits = getLong(o, offset);
                     v = Double.longBitsToDouble(expectedBits);
        -        } while (!weakCompareAndSwapLongRelease(o, offset,
        +        } while (!weakCompareAndSetLongRelease(o, offset,
                                                         expectedBits, Double.doubleToRawLongBits(v + delta)));
                 return v;
             }
        @@ -2530,7 +2530,7 @@ public final class Unsafe {
                     // may result in the loop not terminating.
                     expectedBits = getLongAcquire(o, offset);
                     v = Double.longBitsToDouble(expectedBits);
        -        } while (!weakCompareAndSwapLongAcquire(o, offset,
        +        } while (!weakCompareAndSetLongAcquire(o, offset,
                                                         expectedBits, Double.doubleToRawLongBits(v + delta)));
                 return v;
             }
        @@ -2551,7 +2551,7 @@ public final class Unsafe {
                 int v;
                 do {
                     v = getIntVolatile(o, offset);
        -        } while (!weakCompareAndSwapIntVolatile(o, offset, v, newValue));
        +        } while (!weakCompareAndSetInt(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2560,7 +2560,7 @@ public final class Unsafe {
                 int v;
                 do {
                     v = getInt(o, offset);
        -        } while (!weakCompareAndSwapIntRelease(o, offset, v, newValue));
        +        } while (!weakCompareAndSetIntRelease(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2569,7 +2569,7 @@ public final class Unsafe {
                 int v;
                 do {
                     v = getIntAcquire(o, offset);
        -        } while (!weakCompareAndSwapIntAcquire(o, offset, v, newValue));
        +        } while (!weakCompareAndSetIntAcquire(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2589,7 +2589,7 @@ public final class Unsafe {
                 long v;
                 do {
                     v = getLongVolatile(o, offset);
        -        } while (!weakCompareAndSwapLongVolatile(o, offset, v, newValue));
        +        } while (!weakCompareAndSetLong(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2598,7 +2598,7 @@ public final class Unsafe {
                 long v;
                 do {
                     v = getLong(o, offset);
        -        } while (!weakCompareAndSwapLongRelease(o, offset, v, newValue));
        +        } while (!weakCompareAndSetLongRelease(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2607,7 +2607,7 @@ public final class Unsafe {
                 long v;
                 do {
                     v = getLongAcquire(o, offset);
        -        } while (!weakCompareAndSwapLongAcquire(o, offset, v, newValue));
        +        } while (!weakCompareAndSetLongAcquire(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2627,7 +2627,7 @@ public final class Unsafe {
                 Object v;
                 do {
                     v = getObjectVolatile(o, offset);
        -        } while (!weakCompareAndSwapObjectVolatile(o, offset, v, newValue));
        +        } while (!weakCompareAndSetObject(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2636,7 +2636,7 @@ public final class Unsafe {
                 Object v;
                 do {
                     v = getObject(o, offset);
        -        } while (!weakCompareAndSwapObjectRelease(o, offset, v, newValue));
        +        } while (!weakCompareAndSetObjectRelease(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2645,7 +2645,7 @@ public final class Unsafe {
                 Object v;
                 do {
                     v = getObjectAcquire(o, offset);
        -        } while (!weakCompareAndSwapObjectAcquire(o, offset, v, newValue));
        +        } while (!weakCompareAndSetObjectAcquire(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2654,7 +2654,7 @@ public final class Unsafe {
                 byte v;
                 do {
                     v = getByteVolatile(o, offset);
        -        } while (!weakCompareAndSwapByteVolatile(o, offset, v, newValue));
        +        } while (!weakCompareAndSetByte(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2663,7 +2663,7 @@ public final class Unsafe {
                 byte v;
                 do {
                     v = getByte(o, offset);
        -        } while (!weakCompareAndSwapByteRelease(o, offset, v, newValue));
        +        } while (!weakCompareAndSetByteRelease(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2672,7 +2672,7 @@ public final class Unsafe {
                 byte v;
                 do {
                     v = getByteAcquire(o, offset);
        -        } while (!weakCompareAndSwapByteAcquire(o, offset, v, newValue));
        +        } while (!weakCompareAndSetByteAcquire(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2696,7 +2696,7 @@ public final class Unsafe {
                 short v;
                 do {
                     v = getShortVolatile(o, offset);
        -        } while (!weakCompareAndSwapShortVolatile(o, offset, v, newValue));
        +        } while (!weakCompareAndSetShort(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2705,7 +2705,7 @@ public final class Unsafe {
                 short v;
                 do {
                     v = getShort(o, offset);
        -        } while (!weakCompareAndSwapShortRelease(o, offset, v, newValue));
        +        } while (!weakCompareAndSetShortRelease(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2714,7 +2714,7 @@ public final class Unsafe {
                 short v;
                 do {
                     v = getShortAcquire(o, offset);
        -        } while (!weakCompareAndSwapShortAcquire(o, offset, v, newValue));
        +        } while (!weakCompareAndSetShortAcquire(o, offset, v, newValue));
                 return v;
             }
         
        @@ -2824,7 +2824,7 @@ public final class Unsafe {
                 byte current;
                 do {
                     current = getByteVolatile(o, offset);
        -        } while (!weakCompareAndSwapByteVolatile(o, offset,
        +        } while (!weakCompareAndSetByte(o, offset,
                                                           current, (byte) (current | mask)));
                 return current;
             }
        @@ -2834,7 +2834,7 @@ public final class Unsafe {
                 byte current;
                 do {
                     current = getByte(o, offset);
        -        } while (!weakCompareAndSwapByteRelease(o, offset,
        +        } while (!weakCompareAndSetByteRelease(o, offset,
                                                          current, (byte) (current | mask)));
                 return current;
             }
        @@ -2845,7 +2845,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getByte(o, offset);
        -        } while (!weakCompareAndSwapByteAcquire(o, offset,
        +        } while (!weakCompareAndSetByteAcquire(o, offset,
                                                          current, (byte) (current | mask)));
                 return current;
             }
        @@ -2855,7 +2855,7 @@ public final class Unsafe {
                 byte current;
                 do {
                     current = getByteVolatile(o, offset);
        -        } while (!weakCompareAndSwapByteVolatile(o, offset,
        +        } while (!weakCompareAndSetByte(o, offset,
                                                           current, (byte) (current & mask)));
                 return current;
             }
        @@ -2865,7 +2865,7 @@ public final class Unsafe {
                 byte current;
                 do {
                     current = getByte(o, offset);
        -        } while (!weakCompareAndSwapByteRelease(o, offset,
        +        } while (!weakCompareAndSetByteRelease(o, offset,
                                                          current, (byte) (current & mask)));
                 return current;
             }
        @@ -2876,7 +2876,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getByte(o, offset);
        -        } while (!weakCompareAndSwapByteAcquire(o, offset,
        +        } while (!weakCompareAndSetByteAcquire(o, offset,
                                                          current, (byte) (current & mask)));
                 return current;
             }
        @@ -2886,7 +2886,7 @@ public final class Unsafe {
                 byte current;
                 do {
                     current = getByteVolatile(o, offset);
        -        } while (!weakCompareAndSwapByteVolatile(o, offset,
        +        } while (!weakCompareAndSetByte(o, offset,
                                                           current, (byte) (current ^ mask)));
                 return current;
             }
        @@ -2896,7 +2896,7 @@ public final class Unsafe {
                 byte current;
                 do {
                     current = getByte(o, offset);
        -        } while (!weakCompareAndSwapByteRelease(o, offset,
        +        } while (!weakCompareAndSetByteRelease(o, offset,
                                                          current, (byte) (current ^ mask)));
                 return current;
             }
        @@ -2907,7 +2907,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getByte(o, offset);
        -        } while (!weakCompareAndSwapByteAcquire(o, offset,
        +        } while (!weakCompareAndSetByteAcquire(o, offset,
                                                          current, (byte) (current ^ mask)));
                 return current;
             }
        @@ -2964,7 +2964,7 @@ public final class Unsafe {
                 short current;
                 do {
                     current = getShortVolatile(o, offset);
        -        } while (!weakCompareAndSwapShortVolatile(o, offset,
        +        } while (!weakCompareAndSetShort(o, offset,
                                                         current, (short) (current | mask)));
                 return current;
             }
        @@ -2974,7 +2974,7 @@ public final class Unsafe {
                 short current;
                 do {
                     current = getShort(o, offset);
        -        } while (!weakCompareAndSwapShortRelease(o, offset,
        +        } while (!weakCompareAndSetShortRelease(o, offset,
                                                        current, (short) (current | mask)));
                 return current;
             }
        @@ -2985,7 +2985,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getShort(o, offset);
        -        } while (!weakCompareAndSwapShortAcquire(o, offset,
        +        } while (!weakCompareAndSetShortAcquire(o, offset,
                                                        current, (short) (current | mask)));
                 return current;
             }
        @@ -2995,7 +2995,7 @@ public final class Unsafe {
                 short current;
                 do {
                     current = getShortVolatile(o, offset);
        -        } while (!weakCompareAndSwapShortVolatile(o, offset,
        +        } while (!weakCompareAndSetShort(o, offset,
                                                         current, (short) (current & mask)));
                 return current;
             }
        @@ -3005,7 +3005,7 @@ public final class Unsafe {
                 short current;
                 do {
                     current = getShort(o, offset);
        -        } while (!weakCompareAndSwapShortRelease(o, offset,
        +        } while (!weakCompareAndSetShortRelease(o, offset,
                                                        current, (short) (current & mask)));
                 return current;
             }
        @@ -3016,7 +3016,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getShort(o, offset);
        -        } while (!weakCompareAndSwapShortAcquire(o, offset,
        +        } while (!weakCompareAndSetShortAcquire(o, offset,
                                                        current, (short) (current & mask)));
                 return current;
             }
        @@ -3026,7 +3026,7 @@ public final class Unsafe {
                 short current;
                 do {
                     current = getShortVolatile(o, offset);
        -        } while (!weakCompareAndSwapShortVolatile(o, offset,
        +        } while (!weakCompareAndSetShort(o, offset,
                                                         current, (short) (current ^ mask)));
                 return current;
             }
        @@ -3036,7 +3036,7 @@ public final class Unsafe {
                 short current;
                 do {
                     current = getShort(o, offset);
        -        } while (!weakCompareAndSwapShortRelease(o, offset,
        +        } while (!weakCompareAndSetShortRelease(o, offset,
                                                        current, (short) (current ^ mask)));
                 return current;
             }
        @@ -3047,7 +3047,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getShort(o, offset);
        -        } while (!weakCompareAndSwapShortAcquire(o, offset,
        +        } while (!weakCompareAndSetShortAcquire(o, offset,
                                                        current, (short) (current ^ mask)));
                 return current;
             }
        @@ -3058,7 +3058,7 @@ public final class Unsafe {
                 int current;
                 do {
                     current = getIntVolatile(o, offset);
        -        } while (!weakCompareAndSwapIntVolatile(o, offset,
        +        } while (!weakCompareAndSetInt(o, offset,
                                                         current, current | mask));
                 return current;
             }
        @@ -3068,7 +3068,7 @@ public final class Unsafe {
                 int current;
                 do {
                     current = getInt(o, offset);
        -        } while (!weakCompareAndSwapIntRelease(o, offset,
        +        } while (!weakCompareAndSetIntRelease(o, offset,
                                                        current, current | mask));
                 return current;
             }
        @@ -3079,7 +3079,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getInt(o, offset);
        -        } while (!weakCompareAndSwapIntAcquire(o, offset,
        +        } while (!weakCompareAndSetIntAcquire(o, offset,
                                                        current, current | mask));
                 return current;
             }
        @@ -3100,7 +3100,7 @@ public final class Unsafe {
                 int current;
                 do {
                     current = getIntVolatile(o, offset);
        -        } while (!weakCompareAndSwapIntVolatile(o, offset,
        +        } while (!weakCompareAndSetInt(o, offset,
                                                         current, current & mask));
                 return current;
             }
        @@ -3110,7 +3110,7 @@ public final class Unsafe {
                 int current;
                 do {
                     current = getInt(o, offset);
        -        } while (!weakCompareAndSwapIntRelease(o, offset,
        +        } while (!weakCompareAndSetIntRelease(o, offset,
                                                        current, current & mask));
                 return current;
             }
        @@ -3121,7 +3121,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getInt(o, offset);
        -        } while (!weakCompareAndSwapIntAcquire(o, offset,
        +        } while (!weakCompareAndSetIntAcquire(o, offset,
                                                        current, current & mask));
                 return current;
             }
        @@ -3131,7 +3131,7 @@ public final class Unsafe {
                 int current;
                 do {
                     current = getIntVolatile(o, offset);
        -        } while (!weakCompareAndSwapIntVolatile(o, offset,
        +        } while (!weakCompareAndSetInt(o, offset,
                                                         current, current ^ mask));
                 return current;
             }
        @@ -3141,7 +3141,7 @@ public final class Unsafe {
                 int current;
                 do {
                     current = getInt(o, offset);
        -        } while (!weakCompareAndSwapIntRelease(o, offset,
        +        } while (!weakCompareAndSetIntRelease(o, offset,
                                                        current, current ^ mask));
                 return current;
             }
        @@ -3152,7 +3152,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getInt(o, offset);
        -        } while (!weakCompareAndSwapIntAcquire(o, offset,
        +        } while (!weakCompareAndSetIntAcquire(o, offset,
                                                        current, current ^ mask));
                 return current;
             }
        @@ -3163,7 +3163,7 @@ public final class Unsafe {
                 long current;
                 do {
                     current = getLongVolatile(o, offset);
        -        } while (!weakCompareAndSwapLongVolatile(o, offset,
        +        } while (!weakCompareAndSetLong(o, offset,
                                                         current, current | mask));
                 return current;
             }
        @@ -3173,7 +3173,7 @@ public final class Unsafe {
                 long current;
                 do {
                     current = getLong(o, offset);
        -        } while (!weakCompareAndSwapLongRelease(o, offset,
        +        } while (!weakCompareAndSetLongRelease(o, offset,
                                                        current, current | mask));
                 return current;
             }
        @@ -3184,7 +3184,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getLong(o, offset);
        -        } while (!weakCompareAndSwapLongAcquire(o, offset,
        +        } while (!weakCompareAndSetLongAcquire(o, offset,
                                                        current, current | mask));
                 return current;
             }
        @@ -3194,7 +3194,7 @@ public final class Unsafe {
                 long current;
                 do {
                     current = getLongVolatile(o, offset);
        -        } while (!weakCompareAndSwapLongVolatile(o, offset,
        +        } while (!weakCompareAndSetLong(o, offset,
                                                         current, current & mask));
                 return current;
             }
        @@ -3204,7 +3204,7 @@ public final class Unsafe {
                 long current;
                 do {
                     current = getLong(o, offset);
        -        } while (!weakCompareAndSwapLongRelease(o, offset,
        +        } while (!weakCompareAndSetLongRelease(o, offset,
                                                        current, current & mask));
                 return current;
             }
        @@ -3215,7 +3215,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getLong(o, offset);
        -        } while (!weakCompareAndSwapLongAcquire(o, offset,
        +        } while (!weakCompareAndSetLongAcquire(o, offset,
                                                        current, current & mask));
                 return current;
             }
        @@ -3225,7 +3225,7 @@ public final class Unsafe {
                 long current;
                 do {
                     current = getLongVolatile(o, offset);
        -        } while (!weakCompareAndSwapLongVolatile(o, offset,
        +        } while (!weakCompareAndSetLong(o, offset,
                                                         current, current ^ mask));
                 return current;
             }
        @@ -3235,7 +3235,7 @@ public final class Unsafe {
                 long current;
                 do {
                     current = getLong(o, offset);
        -        } while (!weakCompareAndSwapLongRelease(o, offset,
        +        } while (!weakCompareAndSetLongRelease(o, offset,
                                                        current, current ^ mask));
                 return current;
             }
        @@ -3246,7 +3246,7 @@ public final class Unsafe {
                 do {
                     // Plain read, the value is a hint, the acquire CAS does the work
                     current = getLong(o, offset);
        -        } while (!weakCompareAndSwapLongAcquire(o, offset,
        +        } while (!weakCompareAndSetLongAcquire(o, offset,
                                                        current, current ^ mask));
                 return current;
             }
        diff --git a/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java b/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
        index a77109ce49c..c4fe1d90e3a 100644
        --- a/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
        +++ b/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2000, 2017, 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
        @@ -872,7 +872,7 @@ public final class Unsafe {
             public final boolean compareAndSwapObject(Object o, long offset,
                                                       Object expected,
                                                       Object x) {
        -        return theInternalUnsafe.compareAndSwapObject(o, offset, expected, x);
        +        return theInternalUnsafe.compareAndSetObject(o, offset, expected, x);
             }
         
             /**
        @@ -888,7 +888,7 @@ public final class Unsafe {
             public final boolean compareAndSwapInt(Object o, long offset,
                                                    int expected,
                                                    int x) {
        -        return theInternalUnsafe.compareAndSwapInt(o, offset, expected, x);
        +        return theInternalUnsafe.compareAndSetInt(o, offset, expected, x);
             }
         
             /**
        @@ -904,7 +904,7 @@ public final class Unsafe {
             public final boolean compareAndSwapLong(Object o, long offset,
                                                     long expected,
                                                     long x) {
        -        return theInternalUnsafe.compareAndSwapLong(o, offset, expected, x);
        +        return theInternalUnsafe.compareAndSetLong(o, offset, expected, x);
             }
         
             /**
        
        From 96d03a13e6f00c40163e3b2dc3343fc473a19be0 Mon Sep 17 00:00:00 2001
        From: Ron Pressler 
        Date: Thu, 11 May 2017 12:55:56 -0700
        Subject: [PATCH 50/55] 8159995: Rename internal Unsafe.compare methods
        
        Reviewed-by: psandoz, dholmes
        ---
         .../hotspot/test/CheckGraalIntrinsics.java    |  56 ++++----
         hotspot/src/share/vm/c1/c1_Compiler.cpp       |   8 +-
         hotspot/src/share/vm/c1/c1_GraphBuilder.cpp   |   8 +-
         hotspot/src/share/vm/c1/c1_LIRGenerator.cpp   |   8 +-
         hotspot/src/share/vm/classfile/vmSymbols.cpp  |  35 ++---
         hotspot/src/share/vm/classfile/vmSymbols.hpp  | 130 +++++++++---------
         hotspot/src/share/vm/opto/c2compiler.cpp      |  72 +++++-----
         hotspot/src/share/vm/opto/library_call.cpp    |  89 ++++++------
         hotspot/src/share/vm/prims/unsafe.cpp         |  22 +--
         .../src/share/vm/shark/sharkIntrinsics.cpp    |  10 +-
         .../src/share/vm/shark/sharkIntrinsics.hpp    |   4 +-
         .../intrinsics/unsafe/TestCAEAntiDep.java     |   3 +-
         .../intrinsics/unsafe/UnsafeTwoCASLong.java   |   7 +-
         ...dkInternalMiscUnsafeAccessTestBoolean.java |  51 ++++---
         .../JdkInternalMiscUnsafeAccessTestByte.java  |  51 ++++---
         .../JdkInternalMiscUnsafeAccessTestChar.java  |  51 ++++---
         ...JdkInternalMiscUnsafeAccessTestDouble.java |  51 ++++---
         .../JdkInternalMiscUnsafeAccessTestFloat.java |  51 ++++---
         .../JdkInternalMiscUnsafeAccessTestInt.java   |  51 ++++---
         .../JdkInternalMiscUnsafeAccessTestLong.java  |  51 ++++---
         ...JdkInternalMiscUnsafeAccessTestObject.java |  51 ++++---
         .../JdkInternalMiscUnsafeAccessTestShort.java |  51 ++++---
         .../SunMiscUnsafeAccessTestBoolean.java       |   3 +-
         .../unsafe/SunMiscUnsafeAccessTestByte.java   |   3 +-
         .../unsafe/SunMiscUnsafeAccessTestChar.java   |   3 +-
         .../unsafe/SunMiscUnsafeAccessTestDouble.java |   3 +-
         .../unsafe/SunMiscUnsafeAccessTestFloat.java  |   3 +-
         .../unsafe/SunMiscUnsafeAccessTestInt.java    |   3 +-
         .../unsafe/SunMiscUnsafeAccessTestLong.java   |   3 +-
         .../unsafe/SunMiscUnsafeAccessTestObject.java |   3 +-
         .../unsafe/SunMiscUnsafeAccessTestShort.java  |   3 +-
         .../unsafe/X-UnsafeAccessTest.java.template   |  61 +++++---
         32 files changed, 504 insertions(+), 495 deletions(-)
        
        diff --git a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java
        index d070eb08fbc..9a73893a4f5 100644
        --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java
        +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2014, 2017, 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
        @@ -246,21 +246,21 @@ public class CheckGraalIntrinsics extends GraalTest {
                                 "jdk/internal/misc/Unsafe.allocateUninitializedArray0(Ljava/lang/Class;I)Ljava/lang/Object;",
                                 "jdk/internal/misc/Unsafe.compareAndExchangeByteAcquire(Ljava/lang/Object;JBB)B",
                                 "jdk/internal/misc/Unsafe.compareAndExchangeByteRelease(Ljava/lang/Object;JBB)B",
        -                        "jdk/internal/misc/Unsafe.compareAndExchangeByteVolatile(Ljava/lang/Object;JBB)B",
        +                        "jdk/internal/misc/Unsafe.compareAndExchangeByte(Ljava/lang/Object;JBB)B",
                                 "jdk/internal/misc/Unsafe.compareAndExchangeIntAcquire(Ljava/lang/Object;JII)I",
                                 "jdk/internal/misc/Unsafe.compareAndExchangeIntRelease(Ljava/lang/Object;JII)I",
        -                        "jdk/internal/misc/Unsafe.compareAndExchangeIntVolatile(Ljava/lang/Object;JII)I",
        +                        "jdk/internal/misc/Unsafe.compareAndExchangeInt(Ljava/lang/Object;JII)I",
                                 "jdk/internal/misc/Unsafe.compareAndExchangeLongAcquire(Ljava/lang/Object;JJJ)J",
                                 "jdk/internal/misc/Unsafe.compareAndExchangeLongRelease(Ljava/lang/Object;JJJ)J",
        -                        "jdk/internal/misc/Unsafe.compareAndExchangeLongVolatile(Ljava/lang/Object;JJJ)J",
        +                        "jdk/internal/misc/Unsafe.compareAndExchangeLong(Ljava/lang/Object;JJJ)J",
                                 "jdk/internal/misc/Unsafe.compareAndExchangeObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
                                 "jdk/internal/misc/Unsafe.compareAndExchangeObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
        -                        "jdk/internal/misc/Unsafe.compareAndExchangeObjectVolatile(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
        +                        "jdk/internal/misc/Unsafe.compareAndExchangeObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
                                 "jdk/internal/misc/Unsafe.compareAndExchangeShortAcquire(Ljava/lang/Object;JSS)S",
                                 "jdk/internal/misc/Unsafe.compareAndExchangeShortRelease(Ljava/lang/Object;JSS)S",
        -                        "jdk/internal/misc/Unsafe.compareAndExchangeShortVolatile(Ljava/lang/Object;JSS)S",
        -                        "jdk/internal/misc/Unsafe.compareAndSwapByte(Ljava/lang/Object;JBB)Z",
        -                        "jdk/internal/misc/Unsafe.compareAndSwapShort(Ljava/lang/Object;JSS)Z",
        +                        "jdk/internal/misc/Unsafe.compareAndExchangeShort(Ljava/lang/Object;JSS)S",
        +                        "jdk/internal/misc/Unsafe.compareAndSetByte(Ljava/lang/Object;JBB)Z",
        +                        "jdk/internal/misc/Unsafe.compareAndSetShort(Ljava/lang/Object;JSS)Z",
                                 "jdk/internal/misc/Unsafe.copyMemory0(Ljava/lang/Object;JLjava/lang/Object;JJ)V",
                                 "jdk/internal/misc/Unsafe.getAndAddByte(Ljava/lang/Object;JB)B",
                                 "jdk/internal/misc/Unsafe.getAndAddShort(Ljava/lang/Object;JS)S",
        @@ -295,26 +295,26 @@ public class CheckGraalIntrinsics extends GraalTest {
                                 "jdk/internal/misc/Unsafe.putObjectOpaque(Ljava/lang/Object;JLjava/lang/Object;)V",
                                 "jdk/internal/misc/Unsafe.putShortOpaque(Ljava/lang/Object;JS)V",
                                 "jdk/internal/misc/Unsafe.unpark(Ljava/lang/Object;)V",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapByte(Ljava/lang/Object;JBB)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapByteAcquire(Ljava/lang/Object;JBB)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapByteRelease(Ljava/lang/Object;JBB)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapByteVolatile(Ljava/lang/Object;JBB)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapInt(Ljava/lang/Object;JII)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapIntAcquire(Ljava/lang/Object;JII)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapIntRelease(Ljava/lang/Object;JII)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapIntVolatile(Ljava/lang/Object;JII)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapLong(Ljava/lang/Object;JJJ)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapLongAcquire(Ljava/lang/Object;JJJ)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapLongRelease(Ljava/lang/Object;JJJ)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapLongVolatile(Ljava/lang/Object;JJJ)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapObjectVolatile(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapShort(Ljava/lang/Object;JSS)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapShortAcquire(Ljava/lang/Object;JSS)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapShortRelease(Ljava/lang/Object;JSS)Z",
        -                        "jdk/internal/misc/Unsafe.weakCompareAndSwapShortVolatile(Ljava/lang/Object;JSS)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetBytePlain(Ljava/lang/Object;JBB)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetByteAcquire(Ljava/lang/Object;JBB)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetByteRelease(Ljava/lang/Object;JBB)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetByte(Ljava/lang/Object;JBB)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetIntPlain(Ljava/lang/Object;JII)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetIntAcquire(Ljava/lang/Object;JII)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetIntRelease(Ljava/lang/Object;JII)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetInt(Ljava/lang/Object;JII)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetLongPlain(Ljava/lang/Object;JJJ)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetLongAcquire(Ljava/lang/Object;JJJ)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetLongRelease(Ljava/lang/Object;JJJ)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetLong(Ljava/lang/Object;JJJ)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetObjectPlain(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetShortPlain(Ljava/lang/Object;JSS)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetShortAcquire(Ljava/lang/Object;JSS)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetShortRelease(Ljava/lang/Object;JSS)Z",
        +                        "jdk/internal/misc/Unsafe.weakCompareAndSetShort(Ljava/lang/Object;JSS)Z",
                                 "jdk/internal/util/Preconditions.checkIndex(IILjava/util/function/BiFunction;)I",
                                 "jdk/jfr/internal/JVM.counterTime()J",
                                 "jdk/jfr/internal/JVM.getBufferWriter()Ljava/lang/Object;",
        diff --git a/hotspot/src/share/vm/c1/c1_Compiler.cpp b/hotspot/src/share/vm/c1/c1_Compiler.cpp
        index 731b9efc96c..416f0f38fc8 100644
        --- a/hotspot/src/share/vm/c1/c1_Compiler.cpp
        +++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -108,7 +108,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
           }
         
           switch (id) {
        -  case vmIntrinsics::_compareAndSwapLong:
        +  case vmIntrinsics::_compareAndSetLong:
             if (!VM_Version::supports_cx8()) return false;
             break;
           case vmIntrinsics::_getAndAddInt:
        @@ -217,8 +217,8 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
           case vmIntrinsics::_updateDirectByteBufferCRC32C:
         #endif
           case vmIntrinsics::_vectorizedMismatch:
        -  case vmIntrinsics::_compareAndSwapInt:
        -  case vmIntrinsics::_compareAndSwapObject:
        +  case vmIntrinsics::_compareAndSetInt:
        +  case vmIntrinsics::_compareAndSetObject:
           case vmIntrinsics::_getCharStringU:
           case vmIntrinsics::_putCharStringU:
         #ifdef TRACE_HAVE_INTRINSICS
        diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
        index 200a3fc782d..d4400483912 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, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 1999, 2017, 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
        @@ -3500,9 +3500,9 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_retur
           case vmIntrinsics::_putLongVolatile    : append_unsafe_put_obj(callee, T_LONG,    true); return;
           case vmIntrinsics::_putFloatVolatile   : append_unsafe_put_obj(callee, T_FLOAT,   true); return;
           case vmIntrinsics::_putDoubleVolatile  : append_unsafe_put_obj(callee, T_DOUBLE,  true); return;
        -  case vmIntrinsics::_compareAndSwapLong:
        -  case vmIntrinsics::_compareAndSwapInt:
        -  case vmIntrinsics::_compareAndSwapObject: append_unsafe_CAS(callee); return;
        +  case vmIntrinsics::_compareAndSetLong:
        +  case vmIntrinsics::_compareAndSetInt:
        +  case vmIntrinsics::_compareAndSetObject: append_unsafe_CAS(callee); return;
           case vmIntrinsics::_getAndAddInt:
           case vmIntrinsics::_getAndAddLong      : append_unsafe_get_and_set_obj(callee, true); return;
           case vmIntrinsics::_getAndSetInt       :
        diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
        index 8143eefb83d..68c959280d7 100644
        --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
        +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2005, 2017, 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
        @@ -3212,13 +3212,13 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) {
           // java.nio.Buffer.checkIndex
           case vmIntrinsics::_checkIndex:     do_NIOCheckIndex(x); break;
         
        -  case vmIntrinsics::_compareAndSwapObject:
        +  case vmIntrinsics::_compareAndSetObject:
             do_CompareAndSwap(x, objectType);
             break;
        -  case vmIntrinsics::_compareAndSwapInt:
        +  case vmIntrinsics::_compareAndSetInt:
             do_CompareAndSwap(x, intType);
             break;
        -  case vmIntrinsics::_compareAndSwapLong:
        +  case vmIntrinsics::_compareAndSetLong:
             do_CompareAndSwap(x, longType);
             break;
         
        diff --git a/hotspot/src/share/vm/classfile/vmSymbols.cpp b/hotspot/src/share/vm/classfile/vmSymbols.cpp
        index ad17837fb0d..e56b4e95d6c 100644
        --- a/hotspot/src/share/vm/classfile/vmSymbols.cpp
        +++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 1997, 2017, 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
        @@ -632,25 +632,28 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
           case vmIntrinsics::_loadFence:
           case vmIntrinsics::_storeFence:
           case vmIntrinsics::_fullFence:
        -  case vmIntrinsics::_compareAndSwapLong:
        -  case vmIntrinsics::_weakCompareAndSwapLong:
        -  case vmIntrinsics::_weakCompareAndSwapLongAcquire:
        -  case vmIntrinsics::_weakCompareAndSwapLongRelease:
        -  case vmIntrinsics::_compareAndSwapInt:
        -  case vmIntrinsics::_weakCompareAndSwapInt:
        -  case vmIntrinsics::_weakCompareAndSwapIntAcquire:
        -  case vmIntrinsics::_weakCompareAndSwapIntRelease:
        -  case vmIntrinsics::_compareAndSwapObject:
        -  case vmIntrinsics::_weakCompareAndSwapObject:
        -  case vmIntrinsics::_weakCompareAndSwapObjectAcquire:
        -  case vmIntrinsics::_weakCompareAndSwapObjectRelease:
        -  case vmIntrinsics::_compareAndExchangeIntVolatile:
        +  case vmIntrinsics::_compareAndSetLong:
        +  case vmIntrinsics::_weakCompareAndSetLong:
        +  case vmIntrinsics::_weakCompareAndSetLongPlain:
        +  case vmIntrinsics::_weakCompareAndSetLongAcquire:
        +  case vmIntrinsics::_weakCompareAndSetLongRelease:
        +  case vmIntrinsics::_compareAndSetInt:
        +  case vmIntrinsics::_weakCompareAndSetInt:
        +  case vmIntrinsics::_weakCompareAndSetIntPlain:
        +  case vmIntrinsics::_weakCompareAndSetIntAcquire:
        +  case vmIntrinsics::_weakCompareAndSetIntRelease:
        +  case vmIntrinsics::_compareAndSetObject:
        +  case vmIntrinsics::_weakCompareAndSetObject:
        +  case vmIntrinsics::_weakCompareAndSetObjectPlain:
        +  case vmIntrinsics::_weakCompareAndSetObjectAcquire:
        +  case vmIntrinsics::_weakCompareAndSetObjectRelease:
        +  case vmIntrinsics::_compareAndExchangeInt:
           case vmIntrinsics::_compareAndExchangeIntAcquire:
           case vmIntrinsics::_compareAndExchangeIntRelease:
        -  case vmIntrinsics::_compareAndExchangeLongVolatile:
        +  case vmIntrinsics::_compareAndExchangeLong:
           case vmIntrinsics::_compareAndExchangeLongAcquire:
           case vmIntrinsics::_compareAndExchangeLongRelease:
        -  case vmIntrinsics::_compareAndExchangeObjectVolatile:
        +  case vmIntrinsics::_compareAndExchangeObject:
           case vmIntrinsics::_compareAndExchangeObjectAcquire:
           case vmIntrinsics::_compareAndExchangeObjectRelease:
             if (!InlineUnsafeOps) return true;
        diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp
        index 633bb8fd98a..4d59a7bd76e 100644
        --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp
        +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp
        @@ -1242,100 +1242,100 @@
           do_intrinsic(_putIntUnaligned,           jdk_internal_misc_Unsafe,    putIntUnaligned_name, putInt_signature,         F_R)  \
           do_intrinsic(_putLongUnaligned,          jdk_internal_misc_Unsafe,    putLongUnaligned_name, putLong_signature,       F_R)  \
                                                                                                                                 \
        -  do_signature(compareAndSwapObject_signature,     "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z")        \
        +  do_signature(compareAndSetObject_signature,      "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z")        \
           do_signature(compareAndExchangeObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") \
        -  do_signature(compareAndSwapLong_signature,       "(Ljava/lang/Object;JJJ)Z")                                          \
        +  do_signature(compareAndSetLong_signature,        "(Ljava/lang/Object;JJJ)Z")                                          \
           do_signature(compareAndExchangeLong_signature,   "(Ljava/lang/Object;JJJ)J")                                          \
        -  do_signature(compareAndSwapInt_signature,        "(Ljava/lang/Object;JII)Z")                                          \
        +  do_signature(compareAndSetInt_signature,         "(Ljava/lang/Object;JII)Z")                                          \
           do_signature(compareAndExchangeInt_signature,    "(Ljava/lang/Object;JII)I")                                          \
        -  do_signature(compareAndSwapByte_signature,       "(Ljava/lang/Object;JBB)Z")                                          \
        +  do_signature(compareAndSetByte_signature,        "(Ljava/lang/Object;JBB)Z")                                          \
           do_signature(compareAndExchangeByte_signature,   "(Ljava/lang/Object;JBB)B")                                          \
        -  do_signature(compareAndSwapShort_signature,      "(Ljava/lang/Object;JSS)Z")                                          \
        +  do_signature(compareAndSetShort_signature,       "(Ljava/lang/Object;JSS)Z")                                          \
           do_signature(compareAndExchangeShort_signature,  "(Ljava/lang/Object;JSS)S")                                          \
                                                                                                                                 \
        -  do_name(compareAndSwapObject_name,             "compareAndSwapObject")                                                \
        -  do_name(compareAndExchangeObjectVolatile_name, "compareAndExchangeObjectVolatile")                                    \
        +  do_name(compareAndSetObject_name,              "compareAndSetObject")                                                 \
        +  do_name(compareAndExchangeObject_name,         "compareAndExchangeObject")                                            \
           do_name(compareAndExchangeObjectAcquire_name,  "compareAndExchangeObjectAcquire")                                     \
           do_name(compareAndExchangeObjectRelease_name,  "compareAndExchangeObjectRelease")                                     \
        -  do_name(compareAndSwapLong_name,               "compareAndSwapLong")                                                  \
        -  do_name(compareAndExchangeLongVolatile_name,   "compareAndExchangeLongVolatile")                                      \
        +  do_name(compareAndSetLong_name,                "compareAndSetLong")                                                   \
        +  do_name(compareAndExchangeLong_name,           "compareAndExchangeLong")                                              \
           do_name(compareAndExchangeLongAcquire_name,    "compareAndExchangeLongAcquire")                                       \
           do_name(compareAndExchangeLongRelease_name,    "compareAndExchangeLongRelease")                                       \
        -  do_name(compareAndSwapInt_name,                "compareAndSwapInt")                                                   \
        -  do_name(compareAndExchangeIntVolatile_name,    "compareAndExchangeIntVolatile")                                       \
        +  do_name(compareAndSetInt_name,                 "compareAndSetInt")                                                    \
        +  do_name(compareAndExchangeInt_name,            "compareAndExchangeInt")                                               \
           do_name(compareAndExchangeIntAcquire_name,     "compareAndExchangeIntAcquire")                                        \
           do_name(compareAndExchangeIntRelease_name,     "compareAndExchangeIntRelease")                                        \
        -  do_name(compareAndSwapByte_name,               "compareAndSwapByte")                                                  \
        -  do_name(compareAndExchangeByteVolatile_name,   "compareAndExchangeByteVolatile")                                      \
        +  do_name(compareAndSetByte_name,                "compareAndSetByte")                                                   \
        +  do_name(compareAndExchangeByte_name,           "compareAndExchangeByte")                                              \
           do_name(compareAndExchangeByteAcquire_name,    "compareAndExchangeByteAcquire")                                       \
           do_name(compareAndExchangeByteRelease_name,    "compareAndExchangeByteRelease")                                       \
        -  do_name(compareAndSwapShort_name,              "compareAndSwapShort")                                                 \
        -  do_name(compareAndExchangeShortVolatile_name,  "compareAndExchangeShortVolatile")                                     \
        +  do_name(compareAndSetShort_name,               "compareAndSetShort")                                                  \
        +  do_name(compareAndExchangeShort_name,          "compareAndExchangeShort")                                             \
           do_name(compareAndExchangeShortAcquire_name,   "compareAndExchangeShortAcquire")                                      \
           do_name(compareAndExchangeShortRelease_name,   "compareAndExchangeShortRelease")                                      \
                                                                                                                                 \
        -  do_name(weakCompareAndSwapObject_name,         "weakCompareAndSwapObject")                                            \
        -  do_name(weakCompareAndSwapObjectAcquire_name,  "weakCompareAndSwapObjectAcquire")                                     \
        -  do_name(weakCompareAndSwapObjectRelease_name,  "weakCompareAndSwapObjectRelease")                                     \
        -  do_name(weakCompareAndSwapObjectVolatile_name, "weakCompareAndSwapObjectVolatile")                                    \
        -  do_name(weakCompareAndSwapLong_name,           "weakCompareAndSwapLong")                                              \
        -  do_name(weakCompareAndSwapLongAcquire_name,    "weakCompareAndSwapLongAcquire")                                       \
        -  do_name(weakCompareAndSwapLongRelease_name,    "weakCompareAndSwapLongRelease")                                       \
        -  do_name(weakCompareAndSwapLongVolatile_name,   "weakCompareAndSwapLongVolatile")                                      \
        -  do_name(weakCompareAndSwapInt_name,            "weakCompareAndSwapInt")                                               \
        -  do_name(weakCompareAndSwapIntAcquire_name,     "weakCompareAndSwapIntAcquire")                                        \
        -  do_name(weakCompareAndSwapIntRelease_name,     "weakCompareAndSwapIntRelease")                                        \
        -  do_name(weakCompareAndSwapIntVolatile_name,    "weakCompareAndSwapIntVolatile")                                       \
        -  do_name(weakCompareAndSwapByte_name,           "weakCompareAndSwapByte")                                              \
        -  do_name(weakCompareAndSwapByteAcquire_name,    "weakCompareAndSwapByteAcquire")                                       \
        -  do_name(weakCompareAndSwapByteRelease_name,    "weakCompareAndSwapByteRelease")                                       \
        -  do_name(weakCompareAndSwapByteVolatile_name,   "weakCompareAndSwapByteVolatile")                                      \
        -  do_name(weakCompareAndSwapShort_name,          "weakCompareAndSwapShort")                                             \
        -  do_name(weakCompareAndSwapShortAcquire_name,   "weakCompareAndSwapShortAcquire")                                      \
        -  do_name(weakCompareAndSwapShortRelease_name,   "weakCompareAndSwapShortRelease")                                      \
        -  do_name(weakCompareAndSwapShortVolatile_name,  "weakCompareAndSwapShortVolatile")                                     \
        +  do_name(weakCompareAndSetObjectPlain_name,     "weakCompareAndSetObjectPlain")                                        \
        +  do_name(weakCompareAndSetObjectAcquire_name,   "weakCompareAndSetObjectAcquire")                                      \
        +  do_name(weakCompareAndSetObjectRelease_name,   "weakCompareAndSetObjectRelease")                                      \
        +  do_name(weakCompareAndSetObject_name,          "weakCompareAndSetObject")                                             \
        +  do_name(weakCompareAndSetLongPlain_name,       "weakCompareAndSetLongPlain")                                          \
        +  do_name(weakCompareAndSetLongAcquire_name,     "weakCompareAndSetLongAcquire")                                        \
        +  do_name(weakCompareAndSetLongRelease_name,     "weakCompareAndSetLongRelease")                                        \
        +  do_name(weakCompareAndSetLong_name,            "weakCompareAndSetLong")                                               \
        +  do_name(weakCompareAndSetIntPlain_name,        "weakCompareAndSetIntPlain")                                           \
        +  do_name(weakCompareAndSetIntAcquire_name,      "weakCompareAndSetIntAcquire")                                         \
        +  do_name(weakCompareAndSetIntRelease_name,      "weakCompareAndSetIntRelease")                                         \
        +  do_name(weakCompareAndSetInt_name,             "weakCompareAndSetInt")                                                \
        +  do_name(weakCompareAndSetBytePlain_name,       "weakCompareAndSetBytePlain")                                          \
        +  do_name(weakCompareAndSetByteAcquire_name,     "weakCompareAndSetByteAcquire")                                        \
        +  do_name(weakCompareAndSetByteRelease_name,     "weakCompareAndSetByteRelease")                                        \
        +  do_name(weakCompareAndSetByte_name,            "weakCompareAndSetByte")                                               \
        +  do_name(weakCompareAndSetShortPlain_name,      "weakCompareAndSetShortPlain")                                         \
        +  do_name(weakCompareAndSetShortAcquire_name,    "weakCompareAndSetShortAcquire")                                       \
        +  do_name(weakCompareAndSetShortRelease_name,    "weakCompareAndSetShortRelease")                                       \
        +  do_name(weakCompareAndSetShort_name,           "weakCompareAndSetShort")                                              \
                                                                                                                                 \
        -  do_intrinsic(_compareAndSwapObject,             jdk_internal_misc_Unsafe,  compareAndSwapObject_name,             compareAndSwapObject_signature,     F_RN) \
        -  do_intrinsic(_compareAndExchangeObjectVolatile, jdk_internal_misc_Unsafe,  compareAndExchangeObjectVolatile_name, compareAndExchangeObject_signature, F_RN) \
        +  do_intrinsic(_compareAndSetObject,              jdk_internal_misc_Unsafe,  compareAndSetObject_name,              compareAndSetObject_signature,      F_RN) \
        +  do_intrinsic(_compareAndExchangeObject,         jdk_internal_misc_Unsafe,  compareAndExchangeObject_name,         compareAndExchangeObject_signature, F_RN) \
           do_intrinsic(_compareAndExchangeObjectAcquire,  jdk_internal_misc_Unsafe,  compareAndExchangeObjectAcquire_name,  compareAndExchangeObject_signature, F_R)  \
           do_intrinsic(_compareAndExchangeObjectRelease,  jdk_internal_misc_Unsafe,  compareAndExchangeObjectRelease_name,  compareAndExchangeObject_signature, F_R)  \
        -  do_intrinsic(_compareAndSwapLong,               jdk_internal_misc_Unsafe,  compareAndSwapLong_name,               compareAndSwapLong_signature,       F_RN) \
        -  do_intrinsic(_compareAndExchangeLongVolatile,   jdk_internal_misc_Unsafe,  compareAndExchangeLongVolatile_name,   compareAndExchangeLong_signature,   F_RN) \
        +  do_intrinsic(_compareAndSetLong,                jdk_internal_misc_Unsafe,  compareAndSetLong_name,                compareAndSetLong_signature,        F_RN) \
        +  do_intrinsic(_compareAndExchangeLong,           jdk_internal_misc_Unsafe,  compareAndExchangeLong_name,           compareAndExchangeLong_signature,   F_RN) \
           do_intrinsic(_compareAndExchangeLongAcquire,    jdk_internal_misc_Unsafe,  compareAndExchangeLongAcquire_name,    compareAndExchangeLong_signature,   F_R)  \
           do_intrinsic(_compareAndExchangeLongRelease,    jdk_internal_misc_Unsafe,  compareAndExchangeLongRelease_name,    compareAndExchangeLong_signature,   F_R)  \
        -  do_intrinsic(_compareAndSwapInt,                jdk_internal_misc_Unsafe,  compareAndSwapInt_name,                compareAndSwapInt_signature,        F_RN) \
        -  do_intrinsic(_compareAndExchangeIntVolatile,    jdk_internal_misc_Unsafe,  compareAndExchangeIntVolatile_name,    compareAndExchangeInt_signature,    F_RN) \
        +  do_intrinsic(_compareAndSetInt,                 jdk_internal_misc_Unsafe,  compareAndSetInt_name,                 compareAndSetInt_signature,         F_RN) \
        +  do_intrinsic(_compareAndExchangeInt,            jdk_internal_misc_Unsafe,  compareAndExchangeInt_name,            compareAndExchangeInt_signature,    F_RN) \
           do_intrinsic(_compareAndExchangeIntAcquire,     jdk_internal_misc_Unsafe,  compareAndExchangeIntAcquire_name,     compareAndExchangeInt_signature,    F_R)  \
           do_intrinsic(_compareAndExchangeIntRelease,     jdk_internal_misc_Unsafe,  compareAndExchangeIntRelease_name,     compareAndExchangeInt_signature,    F_R)  \
        -  do_intrinsic(_compareAndSwapByte,               jdk_internal_misc_Unsafe,  compareAndSwapByte_name,               compareAndSwapByte_signature,       F_R)  \
        -  do_intrinsic(_compareAndExchangeByteVolatile,   jdk_internal_misc_Unsafe,  compareAndExchangeByteVolatile_name,   compareAndExchangeByte_signature,   F_R)  \
        +  do_intrinsic(_compareAndSetByte,                jdk_internal_misc_Unsafe,  compareAndSetByte_name,                compareAndSetByte_signature,        F_R)  \
        +  do_intrinsic(_compareAndExchangeByte,           jdk_internal_misc_Unsafe,  compareAndExchangeByte_name,           compareAndExchangeByte_signature,   F_R)  \
           do_intrinsic(_compareAndExchangeByteAcquire,    jdk_internal_misc_Unsafe,  compareAndExchangeByteAcquire_name,    compareAndExchangeByte_signature,   F_R)  \
           do_intrinsic(_compareAndExchangeByteRelease,    jdk_internal_misc_Unsafe,  compareAndExchangeByteRelease_name,    compareAndExchangeByte_signature,   F_R)  \
        -  do_intrinsic(_compareAndSwapShort,              jdk_internal_misc_Unsafe,  compareAndSwapShort_name,              compareAndSwapShort_signature,      F_R)  \
        -  do_intrinsic(_compareAndExchangeShortVolatile,  jdk_internal_misc_Unsafe,  compareAndExchangeShortVolatile_name,  compareAndExchangeShort_signature,  F_R)  \
        +  do_intrinsic(_compareAndSetShort,               jdk_internal_misc_Unsafe,  compareAndSetShort_name,               compareAndSetShort_signature,       F_R)  \
        +  do_intrinsic(_compareAndExchangeShort,          jdk_internal_misc_Unsafe,  compareAndExchangeShort_name,          compareAndExchangeShort_signature,  F_R)  \
           do_intrinsic(_compareAndExchangeShortAcquire,   jdk_internal_misc_Unsafe,  compareAndExchangeShortAcquire_name,   compareAndExchangeShort_signature,  F_R)  \
           do_intrinsic(_compareAndExchangeShortRelease,   jdk_internal_misc_Unsafe,  compareAndExchangeShortRelease_name,   compareAndExchangeShort_signature,  F_R)  \
                                                                                                                                                                      \
        -  do_intrinsic(_weakCompareAndSwapObject,         jdk_internal_misc_Unsafe,  weakCompareAndSwapObject_name,         compareAndSwapObject_signature,     F_R) \
        -  do_intrinsic(_weakCompareAndSwapObjectAcquire,  jdk_internal_misc_Unsafe,  weakCompareAndSwapObjectAcquire_name,  compareAndSwapObject_signature,     F_R) \
        -  do_intrinsic(_weakCompareAndSwapObjectRelease,  jdk_internal_misc_Unsafe,  weakCompareAndSwapObjectRelease_name,  compareAndSwapObject_signature,     F_R) \
        -  do_intrinsic(_weakCompareAndSwapObjectVolatile, jdk_internal_misc_Unsafe,  weakCompareAndSwapObjectVolatile_name, compareAndSwapObject_signature,     F_R) \
        -  do_intrinsic(_weakCompareAndSwapLong,           jdk_internal_misc_Unsafe,  weakCompareAndSwapLong_name,           compareAndSwapLong_signature,       F_R) \
        -  do_intrinsic(_weakCompareAndSwapLongAcquire,    jdk_internal_misc_Unsafe,  weakCompareAndSwapLongAcquire_name,    compareAndSwapLong_signature,       F_R) \
        -  do_intrinsic(_weakCompareAndSwapLongRelease,    jdk_internal_misc_Unsafe,  weakCompareAndSwapLongRelease_name,    compareAndSwapLong_signature,       F_R) \
        -  do_intrinsic(_weakCompareAndSwapLongVolatile,   jdk_internal_misc_Unsafe,  weakCompareAndSwapLongVolatile_name,   compareAndSwapLong_signature,       F_R) \
        -  do_intrinsic(_weakCompareAndSwapInt,            jdk_internal_misc_Unsafe,  weakCompareAndSwapInt_name,            compareAndSwapInt_signature,        F_R) \
        -  do_intrinsic(_weakCompareAndSwapIntAcquire,     jdk_internal_misc_Unsafe,  weakCompareAndSwapIntAcquire_name,     compareAndSwapInt_signature,        F_R) \
        -  do_intrinsic(_weakCompareAndSwapIntRelease,     jdk_internal_misc_Unsafe,  weakCompareAndSwapIntRelease_name,     compareAndSwapInt_signature,        F_R) \
        -  do_intrinsic(_weakCompareAndSwapIntVolatile,    jdk_internal_misc_Unsafe,  weakCompareAndSwapIntVolatile_name,    compareAndSwapInt_signature,        F_R) \
        -  do_intrinsic(_weakCompareAndSwapByte,           jdk_internal_misc_Unsafe,  weakCompareAndSwapByte_name,           compareAndSwapByte_signature,       F_R) \
        -  do_intrinsic(_weakCompareAndSwapByteAcquire,    jdk_internal_misc_Unsafe,  weakCompareAndSwapByteAcquire_name,    compareAndSwapByte_signature,       F_R) \
        -  do_intrinsic(_weakCompareAndSwapByteRelease,    jdk_internal_misc_Unsafe,  weakCompareAndSwapByteRelease_name,    compareAndSwapByte_signature,       F_R) \
        -  do_intrinsic(_weakCompareAndSwapByteVolatile,   jdk_internal_misc_Unsafe,  weakCompareAndSwapByteVolatile_name,   compareAndSwapByte_signature,       F_R) \
        -  do_intrinsic(_weakCompareAndSwapShort,          jdk_internal_misc_Unsafe,  weakCompareAndSwapShort_name,          compareAndSwapShort_signature,      F_R) \
        -  do_intrinsic(_weakCompareAndSwapShortAcquire,   jdk_internal_misc_Unsafe,  weakCompareAndSwapShortAcquire_name,   compareAndSwapShort_signature,      F_R) \
        -  do_intrinsic(_weakCompareAndSwapShortRelease,   jdk_internal_misc_Unsafe,  weakCompareAndSwapShortRelease_name,   compareAndSwapShort_signature,      F_R) \
        -  do_intrinsic(_weakCompareAndSwapShortVolatile,  jdk_internal_misc_Unsafe,  weakCompareAndSwapShortVolatile_name,  compareAndSwapShort_signature,      F_R) \
        +  do_intrinsic(_weakCompareAndSetObjectPlain,     jdk_internal_misc_Unsafe,  weakCompareAndSetObjectPlain_name,     compareAndSetObject_signature,      F_R) \
        +  do_intrinsic(_weakCompareAndSetObjectAcquire,   jdk_internal_misc_Unsafe,  weakCompareAndSetObjectAcquire_name,   compareAndSetObject_signature,      F_R) \
        +  do_intrinsic(_weakCompareAndSetObjectRelease,   jdk_internal_misc_Unsafe,  weakCompareAndSetObjectRelease_name,   compareAndSetObject_signature,      F_R) \
        +  do_intrinsic(_weakCompareAndSetObject,          jdk_internal_misc_Unsafe,  weakCompareAndSetObject_name,          compareAndSetObject_signature,      F_R) \
        +  do_intrinsic(_weakCompareAndSetLongPlain,       jdk_internal_misc_Unsafe,  weakCompareAndSetLongPlain_name,       compareAndSetLong_signature,        F_R) \
        +  do_intrinsic(_weakCompareAndSetLongAcquire,     jdk_internal_misc_Unsafe,  weakCompareAndSetLongAcquire_name,     compareAndSetLong_signature,        F_R) \
        +  do_intrinsic(_weakCompareAndSetLongRelease,     jdk_internal_misc_Unsafe,  weakCompareAndSetLongRelease_name,     compareAndSetLong_signature,        F_R) \
        +  do_intrinsic(_weakCompareAndSetLong,            jdk_internal_misc_Unsafe,  weakCompareAndSetLong_name,            compareAndSetLong_signature,        F_R) \
        +  do_intrinsic(_weakCompareAndSetIntPlain,        jdk_internal_misc_Unsafe,  weakCompareAndSetIntPlain_name,        compareAndSetInt_signature,         F_R) \
        +  do_intrinsic(_weakCompareAndSetIntAcquire,      jdk_internal_misc_Unsafe,  weakCompareAndSetIntAcquire_name,      compareAndSetInt_signature,         F_R) \
        +  do_intrinsic(_weakCompareAndSetIntRelease,      jdk_internal_misc_Unsafe,  weakCompareAndSetIntRelease_name,      compareAndSetInt_signature,         F_R) \
        +  do_intrinsic(_weakCompareAndSetInt,             jdk_internal_misc_Unsafe,  weakCompareAndSetInt_name,             compareAndSetInt_signature,         F_R) \
        +  do_intrinsic(_weakCompareAndSetBytePlain,       jdk_internal_misc_Unsafe,  weakCompareAndSetBytePlain_name,       compareAndSetByte_signature,        F_R) \
        +  do_intrinsic(_weakCompareAndSetByteAcquire,     jdk_internal_misc_Unsafe,  weakCompareAndSetByteAcquire_name,     compareAndSetByte_signature,        F_R) \
        +  do_intrinsic(_weakCompareAndSetByteRelease,     jdk_internal_misc_Unsafe,  weakCompareAndSetByteRelease_name,     compareAndSetByte_signature,        F_R) \
        +  do_intrinsic(_weakCompareAndSetByte,            jdk_internal_misc_Unsafe,  weakCompareAndSetByte_name,            compareAndSetByte_signature,        F_R) \
        +  do_intrinsic(_weakCompareAndSetShortPlain,      jdk_internal_misc_Unsafe,  weakCompareAndSetShortPlain_name,      compareAndSetShort_signature,       F_R) \
        +  do_intrinsic(_weakCompareAndSetShortAcquire,    jdk_internal_misc_Unsafe,  weakCompareAndSetShortAcquire_name,    compareAndSetShort_signature,       F_R) \
        +  do_intrinsic(_weakCompareAndSetShortRelease,    jdk_internal_misc_Unsafe,  weakCompareAndSetShortRelease_name,    compareAndSetShort_signature,       F_R) \
        +  do_intrinsic(_weakCompareAndSetShort,           jdk_internal_misc_Unsafe,  weakCompareAndSetShort_name,           compareAndSetShort_signature,       F_R) \
                                    \
           do_intrinsic(_getAndAddInt,             jdk_internal_misc_Unsafe,     getAndAddInt_name, getAndAddInt_signature, F_R)       \
            do_name(     getAndAddInt_name,                                      "getAndAddInt")                                       \
        diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp
        index ec7e03c5ff0..69106bbeaa2 100644
        --- a/hotspot/src/share/vm/opto/c2compiler.cpp
        +++ b/hotspot/src/share/vm/opto/c2compiler.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 1999, 2017, 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
        @@ -244,8 +244,8 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
             if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return false;
             break;
         
        -  /* CompareAndSwap, Object: */
        -  case vmIntrinsics::_compareAndSwapObject:
        +  /* CompareAndSet, Object: */
        +  case vmIntrinsics::_compareAndSetObject:
         #ifdef _LP64
             if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapN)) return false;
             if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return false;
        @@ -253,10 +253,10 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
             if (!Matcher::match_rule_supported(Op_CompareAndSwapP)) return false;
         #endif
             break;
        -  case vmIntrinsics::_weakCompareAndSwapObject:
        -  case vmIntrinsics::_weakCompareAndSwapObjectAcquire:
        -  case vmIntrinsics::_weakCompareAndSwapObjectRelease:
        -  case vmIntrinsics::_weakCompareAndSwapObjectVolatile:
        +  case vmIntrinsics::_weakCompareAndSetObjectPlain:
        +  case vmIntrinsics::_weakCompareAndSetObjectAcquire:
        +  case vmIntrinsics::_weakCompareAndSetObjectRelease:
        +  case vmIntrinsics::_weakCompareAndSetObject:
         #ifdef _LP64
             if ( UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapN)) return false;
             if (!UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false;
        @@ -264,52 +264,52 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
             if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false;
         #endif
             break;
        -  /* CompareAndSwap, Long: */
        -  case vmIntrinsics::_compareAndSwapLong:
        +  /* CompareAndSet, Long: */
        +  case vmIntrinsics::_compareAndSetLong:
             if (!Matcher::match_rule_supported(Op_CompareAndSwapL)) return false;
             break;
        -  case vmIntrinsics::_weakCompareAndSwapLong:
        -  case vmIntrinsics::_weakCompareAndSwapLongAcquire:
        -  case vmIntrinsics::_weakCompareAndSwapLongRelease:
        -  case vmIntrinsics::_weakCompareAndSwapLongVolatile:
        +  case vmIntrinsics::_weakCompareAndSetLongPlain:
        +  case vmIntrinsics::_weakCompareAndSetLongAcquire:
        +  case vmIntrinsics::_weakCompareAndSetLongRelease:
        +  case vmIntrinsics::_weakCompareAndSetLong:
             if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false;
             break;
         
        -  /* CompareAndSwap, Int: */
        -  case vmIntrinsics::_compareAndSwapInt:
        +  /* CompareAndSet, Int: */
        +  case vmIntrinsics::_compareAndSetInt:
             if (!Matcher::match_rule_supported(Op_CompareAndSwapI)) return false;
             break;
        -  case vmIntrinsics::_weakCompareAndSwapInt:
        -  case vmIntrinsics::_weakCompareAndSwapIntAcquire:
        -  case vmIntrinsics::_weakCompareAndSwapIntRelease:
        -  case vmIntrinsics::_weakCompareAndSwapIntVolatile:
        +  case vmIntrinsics::_weakCompareAndSetIntPlain:
        +  case vmIntrinsics::_weakCompareAndSetIntAcquire:
        +  case vmIntrinsics::_weakCompareAndSetIntRelease:
        +  case vmIntrinsics::_weakCompareAndSetInt:
             if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false;
             break;
         
        -  /* CompareAndSwap, Byte: */
        -  case vmIntrinsics::_compareAndSwapByte:
        +  /* CompareAndSet, Byte: */
        +  case vmIntrinsics::_compareAndSetByte:
             if (!Matcher::match_rule_supported(Op_CompareAndSwapB)) return false;
             break;
        -  case vmIntrinsics::_weakCompareAndSwapByte:
        -  case vmIntrinsics::_weakCompareAndSwapByteAcquire:
        -  case vmIntrinsics::_weakCompareAndSwapByteRelease:
        -  case vmIntrinsics::_weakCompareAndSwapByteVolatile:
        +  case vmIntrinsics::_weakCompareAndSetBytePlain:
        +  case vmIntrinsics::_weakCompareAndSetByteAcquire:
        +  case vmIntrinsics::_weakCompareAndSetByteRelease:
        +  case vmIntrinsics::_weakCompareAndSetByte:
             if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapB)) return false;
             break;
         
        -  /* CompareAndSwap, Short: */
        -  case vmIntrinsics::_compareAndSwapShort:
        +  /* CompareAndSet, Short: */
        +  case vmIntrinsics::_compareAndSetShort:
             if (!Matcher::match_rule_supported(Op_CompareAndSwapS)) return false;
             break;
        -  case vmIntrinsics::_weakCompareAndSwapShort:
        -  case vmIntrinsics::_weakCompareAndSwapShortAcquire:
        -  case vmIntrinsics::_weakCompareAndSwapShortRelease:
        -  case vmIntrinsics::_weakCompareAndSwapShortVolatile:
        +  case vmIntrinsics::_weakCompareAndSetShortPlain:
        +  case vmIntrinsics::_weakCompareAndSetShortAcquire:
        +  case vmIntrinsics::_weakCompareAndSetShortRelease:
        +  case vmIntrinsics::_weakCompareAndSetShort:
             if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapS)) return false;
             break;
         
           /* CompareAndExchange, Object: */
        -  case vmIntrinsics::_compareAndExchangeObjectVolatile:
        +  case vmIntrinsics::_compareAndExchangeObject:
           case vmIntrinsics::_compareAndExchangeObjectAcquire:
           case vmIntrinsics::_compareAndExchangeObjectRelease:
         #ifdef _LP64
        @@ -321,28 +321,28 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
             break;
         
           /* CompareAndExchange, Long: */
        -  case vmIntrinsics::_compareAndExchangeLongVolatile:
        +  case vmIntrinsics::_compareAndExchangeLong:
           case vmIntrinsics::_compareAndExchangeLongAcquire:
           case vmIntrinsics::_compareAndExchangeLongRelease:
             if (!Matcher::match_rule_supported(Op_CompareAndExchangeL)) return false;
             break;
         
           /* CompareAndExchange, Int: */
        -  case vmIntrinsics::_compareAndExchangeIntVolatile:
        +  case vmIntrinsics::_compareAndExchangeInt:
           case vmIntrinsics::_compareAndExchangeIntAcquire:
           case vmIntrinsics::_compareAndExchangeIntRelease:
             if (!Matcher::match_rule_supported(Op_CompareAndExchangeI)) return false;
             break;
         
           /* CompareAndExchange, Byte: */
        -  case vmIntrinsics::_compareAndExchangeByteVolatile:
        +  case vmIntrinsics::_compareAndExchangeByte:
           case vmIntrinsics::_compareAndExchangeByteAcquire:
           case vmIntrinsics::_compareAndExchangeByteRelease:
             if (!Matcher::match_rule_supported(Op_CompareAndExchangeB)) return false;
             break;
         
           /* CompareAndExchange, Short: */
        -  case vmIntrinsics::_compareAndExchangeShortVolatile:
        +  case vmIntrinsics::_compareAndExchangeShort:
           case vmIntrinsics::_compareAndExchangeShortAcquire:
           case vmIntrinsics::_compareAndExchangeShortRelease:
             if (!Matcher::match_rule_supported(Op_CompareAndExchangeS)) return false;
        diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
        index e1e1c9f188f..4e5051ee01c 100644
        --- a/hotspot/src/share/vm/opto/library_call.cpp
        +++ b/hotspot/src/share/vm/opto/library_call.cpp
        @@ -649,46 +649,46 @@ bool LibraryCallKit::try_to_inline(int predicate) {
           case vmIntrinsics::_putFloatOpaque:           return inline_unsafe_access( is_store, T_FLOAT,    Opaque, false);
           case vmIntrinsics::_putDoubleOpaque:          return inline_unsafe_access( is_store, T_DOUBLE,   Opaque, false);
         
        -  case vmIntrinsics::_compareAndSwapObject:             return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap,      Volatile);
        -  case vmIntrinsics::_compareAndSwapByte:               return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap,      Volatile);
        -  case vmIntrinsics::_compareAndSwapShort:              return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap,      Volatile);
        -  case vmIntrinsics::_compareAndSwapInt:                return inline_unsafe_load_store(T_INT,    LS_cmp_swap,      Volatile);
        -  case vmIntrinsics::_compareAndSwapLong:               return inline_unsafe_load_store(T_LONG,   LS_cmp_swap,      Volatile);
        +  case vmIntrinsics::_compareAndSetObject:              return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap,      Volatile);
        +  case vmIntrinsics::_compareAndSetByte:                return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap,      Volatile);
        +  case vmIntrinsics::_compareAndSetShort:               return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap,      Volatile);
        +  case vmIntrinsics::_compareAndSetInt:                 return inline_unsafe_load_store(T_INT,    LS_cmp_swap,      Volatile);
        +  case vmIntrinsics::_compareAndSetLong:                return inline_unsafe_load_store(T_LONG,   LS_cmp_swap,      Volatile);
         
        -  case vmIntrinsics::_weakCompareAndSwapObject:         return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed);
        -  case vmIntrinsics::_weakCompareAndSwapObjectAcquire:  return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire);
        -  case vmIntrinsics::_weakCompareAndSwapObjectRelease:  return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release);
        -  case vmIntrinsics::_weakCompareAndSwapObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile);
        -  case vmIntrinsics::_weakCompareAndSwapByte:           return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Relaxed);
        -  case vmIntrinsics::_weakCompareAndSwapByteAcquire:    return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Acquire);
        -  case vmIntrinsics::_weakCompareAndSwapByteRelease:    return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Release);
        -  case vmIntrinsics::_weakCompareAndSwapByteVolatile:   return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Volatile);
        -  case vmIntrinsics::_weakCompareAndSwapShort:          return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Relaxed);
        -  case vmIntrinsics::_weakCompareAndSwapShortAcquire:   return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Acquire);
        -  case vmIntrinsics::_weakCompareAndSwapShortRelease:   return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Release);
        -  case vmIntrinsics::_weakCompareAndSwapShortVolatile:  return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Volatile);
        -  case vmIntrinsics::_weakCompareAndSwapInt:            return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Relaxed);
        -  case vmIntrinsics::_weakCompareAndSwapIntAcquire:     return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Acquire);
        -  case vmIntrinsics::_weakCompareAndSwapIntRelease:     return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Release);
        -  case vmIntrinsics::_weakCompareAndSwapIntVolatile:    return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Volatile);
        -  case vmIntrinsics::_weakCompareAndSwapLong:           return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Relaxed);
        -  case vmIntrinsics::_weakCompareAndSwapLongAcquire:    return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Acquire);
        -  case vmIntrinsics::_weakCompareAndSwapLongRelease:    return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Release);
        -  case vmIntrinsics::_weakCompareAndSwapLongVolatile:   return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Volatile);
        +  case vmIntrinsics::_weakCompareAndSetObjectPlain:     return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed);
        +  case vmIntrinsics::_weakCompareAndSetObjectAcquire:   return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire);
        +  case vmIntrinsics::_weakCompareAndSetObjectRelease:   return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release);
        +  case vmIntrinsics::_weakCompareAndSetObject:          return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile);
        +  case vmIntrinsics::_weakCompareAndSetBytePlain:       return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Relaxed);
        +  case vmIntrinsics::_weakCompareAndSetByteAcquire:     return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Acquire);
        +  case vmIntrinsics::_weakCompareAndSetByteRelease:     return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Release);
        +  case vmIntrinsics::_weakCompareAndSetByte:            return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Volatile);
        +  case vmIntrinsics::_weakCompareAndSetShortPlain:      return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Relaxed);
        +  case vmIntrinsics::_weakCompareAndSetShortAcquire:    return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Acquire);
        +  case vmIntrinsics::_weakCompareAndSetShortRelease:    return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Release);
        +  case vmIntrinsics::_weakCompareAndSetShort:           return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Volatile);
        +  case vmIntrinsics::_weakCompareAndSetIntPlain:        return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Relaxed);
        +  case vmIntrinsics::_weakCompareAndSetIntAcquire:      return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Acquire);
        +  case vmIntrinsics::_weakCompareAndSetIntRelease:      return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Release);
        +  case vmIntrinsics::_weakCompareAndSetInt:             return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Volatile);
        +  case vmIntrinsics::_weakCompareAndSetLongPlain:       return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Relaxed);
        +  case vmIntrinsics::_weakCompareAndSetLongAcquire:     return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Acquire);
        +  case vmIntrinsics::_weakCompareAndSetLongRelease:     return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Release);
        +  case vmIntrinsics::_weakCompareAndSetLong:            return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Volatile);
         
        -  case vmIntrinsics::_compareAndExchangeObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange,  Volatile);
        +  case vmIntrinsics::_compareAndExchangeObject:         return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange,  Volatile);
           case vmIntrinsics::_compareAndExchangeObjectAcquire:  return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange,  Acquire);
           case vmIntrinsics::_compareAndExchangeObjectRelease:  return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange,  Release);
        -  case vmIntrinsics::_compareAndExchangeByteVolatile:   return inline_unsafe_load_store(T_BYTE,   LS_cmp_exchange,  Volatile);
        +  case vmIntrinsics::_compareAndExchangeByte:           return inline_unsafe_load_store(T_BYTE,   LS_cmp_exchange,  Volatile);
           case vmIntrinsics::_compareAndExchangeByteAcquire:    return inline_unsafe_load_store(T_BYTE,   LS_cmp_exchange,  Acquire);
           case vmIntrinsics::_compareAndExchangeByteRelease:    return inline_unsafe_load_store(T_BYTE,   LS_cmp_exchange,  Release);
        -  case vmIntrinsics::_compareAndExchangeShortVolatile:  return inline_unsafe_load_store(T_SHORT,  LS_cmp_exchange,  Volatile);
        +  case vmIntrinsics::_compareAndExchangeShort:          return inline_unsafe_load_store(T_SHORT,  LS_cmp_exchange,  Volatile);
           case vmIntrinsics::_compareAndExchangeShortAcquire:   return inline_unsafe_load_store(T_SHORT,  LS_cmp_exchange,  Acquire);
           case vmIntrinsics::_compareAndExchangeShortRelease:   return inline_unsafe_load_store(T_SHORT,  LS_cmp_exchange,  Release);
        -  case vmIntrinsics::_compareAndExchangeIntVolatile:    return inline_unsafe_load_store(T_INT,    LS_cmp_exchange,  Volatile);
        +  case vmIntrinsics::_compareAndExchangeInt:            return inline_unsafe_load_store(T_INT,    LS_cmp_exchange,  Volatile);
           case vmIntrinsics::_compareAndExchangeIntAcquire:     return inline_unsafe_load_store(T_INT,    LS_cmp_exchange,  Acquire);
           case vmIntrinsics::_compareAndExchangeIntRelease:     return inline_unsafe_load_store(T_INT,    LS_cmp_exchange,  Release);
        -  case vmIntrinsics::_compareAndExchangeLongVolatile:   return inline_unsafe_load_store(T_LONG,   LS_cmp_exchange,  Volatile);
        +  case vmIntrinsics::_compareAndExchangeLong:           return inline_unsafe_load_store(T_LONG,   LS_cmp_exchange,  Volatile);
           case vmIntrinsics::_compareAndExchangeLongAcquire:    return inline_unsafe_load_store(T_LONG,   LS_cmp_exchange,  Acquire);
           case vmIntrinsics::_compareAndExchangeLongRelease:    return inline_unsafe_load_store(T_LONG,   LS_cmp_exchange,  Release);
         
        @@ -2587,23 +2587,26 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
         //
         // LS_cmp_swap:
         //
        -//   boolean compareAndSwapObject(Object o, long offset, Object expected, Object x);
        -//   boolean compareAndSwapInt(   Object o, long offset, int    expected, int    x);
        -//   boolean compareAndSwapLong(  Object o, long offset, long   expected, long   x);
        +//   boolean compareAndSetObject(Object o, long offset, Object expected, Object x);
        +//   boolean compareAndSetInt(   Object o, long offset, int    expected, int    x);
        +//   boolean compareAndSetLong(  Object o, long offset, long   expected, long   x);
         //
         // LS_cmp_swap_weak:
         //
        -//   boolean weakCompareAndSwapObject(       Object o, long offset, Object expected, Object x);
        -//   boolean weakCompareAndSwapObjectAcquire(Object o, long offset, Object expected, Object x);
        -//   boolean weakCompareAndSwapObjectRelease(Object o, long offset, Object expected, Object x);
        +//   boolean weakCompareAndSetObject(       Object o, long offset, Object expected, Object x);
        +//   boolean weakCompareAndSetObjectPlain(  Object o, long offset, Object expected, Object x);
        +//   boolean weakCompareAndSetObjectAcquire(Object o, long offset, Object expected, Object x);
        +//   boolean weakCompareAndSetObjectRelease(Object o, long offset, Object expected, Object x);
         //
        -//   boolean weakCompareAndSwapInt(          Object o, long offset, int    expected, int    x);
        -//   boolean weakCompareAndSwapIntAcquire(   Object o, long offset, int    expected, int    x);
        -//   boolean weakCompareAndSwapIntRelease(   Object o, long offset, int    expected, int    x);
        +//   boolean weakCompareAndSetInt(          Object o, long offset, int    expected, int    x);
        +//   boolean weakCompareAndSetIntPlain(     Object o, long offset, int    expected, int    x);
        +//   boolean weakCompareAndSetIntAcquire(   Object o, long offset, int    expected, int    x);
        +//   boolean weakCompareAndSetIntRelease(   Object o, long offset, int    expected, int    x);
         //
        -//   boolean weakCompareAndSwapLong(         Object o, long offset, long   expected, long   x);
        -//   boolean weakCompareAndSwapLongAcquire(  Object o, long offset, long   expected, long   x);
        -//   boolean weakCompareAndSwapLongRelease(  Object o, long offset, long   expected, long   x);
        +//   boolean weakCompareAndSetLong(         Object o, long offset, long   expected, long   x);
        +//   boolean weakCompareAndSetLongPlain(    Object o, long offset, long   expected, long   x);
        +//   boolean weakCompareAndSetLongAcquire(  Object o, long offset, long   expected, long   x);
        +//   boolean weakCompareAndSetLongRelease(  Object o, long offset, long   expected, long   x);
         //
         // LS_cmp_exchange:
         //
        @@ -4965,7 +4968,7 @@ bool LibraryCallKit::inline_arraycopy() {
           // See arraycopy_restore_alloc_state() comment
           // if alloc == NULL we don't have to worry about a tightly coupled allocation so we can emit all needed guards
           // if saved_jvms != NULL (then alloc != NULL) then we can handle guards and a tightly coupled allocation
        -  // if saved_jvms == NULL and alloc != NULL, we can’t emit any guards
        +  // if saved_jvms == NULL and alloc != NULL, we can't emit any guards
           bool can_emit_guards = (alloc == NULL || saved_jvms != NULL);
         
           // The following tests must be performed
        diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
        index 1c98add775b..2f096378201 100644
        --- a/hotspot/src/share/vm/prims/unsafe.cpp
        +++ b/hotspot/src/share/vm/prims/unsafe.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2000, 2017, 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
        @@ -378,7 +378,7 @@ UNSAFE_ENTRY(jobject, Unsafe_GetUncompressedObject(JNIEnv *env, jobject unsafe,
         // On platforms which do not support atomic compare-and-swap of jlong (8 byte)
         // values we have to use a lock-based scheme to enforce atomicity. This has to be
         // applied to all Unsafe operations that set the value of a jlong field. Even so
        -// the compareAndSwapLong operation will not be atomic with respect to direct stores
        +// the compareAndSetLong operation will not be atomic with respect to direct stores
         // to the field from Java code. It is important therefore that any Java code that
         // utilizes these Unsafe jlong operations does not perform direct stores. To permit
         // direct loads of the field from Java code we must also use Atomic::store within the
        @@ -1013,7 +1013,7 @@ UNSAFE_ENTRY(jlong, Unsafe_CompareAndExchangeLong(JNIEnv *env, jobject unsafe, j
         #endif
         } UNSAFE_END
         
        -UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) {
        +UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) {
           oop x = JNIHandles::resolve(x_h);
           oop e = JNIHandles::resolve(e_h);
           oop p = JNIHandles::resolve(obj);
        @@ -1028,14 +1028,14 @@ UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe,
           return true;
         } UNSAFE_END
         
        -UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) {
        +UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) {
           oop p = JNIHandles::resolve(obj);
           jint* addr = (jint *)index_oop_from_field_offset_long(p, offset);
         
           return (jint)(Atomic::cmpxchg(x, addr, e)) == e;
         } UNSAFE_END
         
        -UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) {
        +UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) {
           Handle p(THREAD, JNIHandles::resolve(obj));
           jlong* addr = (jlong*)index_oop_from_field_offset_long(p(), offset);
         
        @@ -1194,12 +1194,12 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
             {CC "defineClass0",       CC "(" DC_Args ")" CLS,    FN_PTR(Unsafe_DefineClass0)},
             {CC "allocateInstance",   CC "(" CLS ")" OBJ,        FN_PTR(Unsafe_AllocateInstance)},
             {CC "throwException",     CC "(" THR ")V",           FN_PTR(Unsafe_ThrowException)},
        -    {CC "compareAndSwapObject", CC "(" OBJ "J" OBJ "" OBJ ")Z", FN_PTR(Unsafe_CompareAndSwapObject)},
        -    {CC "compareAndSwapInt",  CC "(" OBJ "J""I""I"")Z",  FN_PTR(Unsafe_CompareAndSwapInt)},
        -    {CC "compareAndSwapLong", CC "(" OBJ "J""J""J"")Z",  FN_PTR(Unsafe_CompareAndSwapLong)},
        -    {CC "compareAndExchangeObjectVolatile", CC "(" OBJ "J" OBJ "" OBJ ")" OBJ, FN_PTR(Unsafe_CompareAndExchangeObject)},
        -    {CC "compareAndExchangeIntVolatile",  CC "(" OBJ "J""I""I"")I", FN_PTR(Unsafe_CompareAndExchangeInt)},
        -    {CC "compareAndExchangeLongVolatile", CC "(" OBJ "J""J""J"")J", FN_PTR(Unsafe_CompareAndExchangeLong)},
        +    {CC "compareAndSetObject",CC "(" OBJ "J" OBJ "" OBJ ")Z", FN_PTR(Unsafe_CompareAndSetObject)},
        +    {CC "compareAndSetInt",   CC "(" OBJ "J""I""I"")Z",  FN_PTR(Unsafe_CompareAndSetInt)},
        +    {CC "compareAndSetLong",  CC "(" OBJ "J""J""J"")Z",  FN_PTR(Unsafe_CompareAndSetLong)},
        +    {CC "compareAndExchangeObject", CC "(" OBJ "J" OBJ "" OBJ ")" OBJ, FN_PTR(Unsafe_CompareAndExchangeObject)},
        +    {CC "compareAndExchangeInt",  CC "(" OBJ "J""I""I"")I", FN_PTR(Unsafe_CompareAndExchangeInt)},
        +    {CC "compareAndExchangeLong", CC "(" OBJ "J""J""J"")J", FN_PTR(Unsafe_CompareAndExchangeLong)},
         
             {CC "park",               CC "(ZJ)V",                FN_PTR(Unsafe_Park)},
             {CC "unpark",             CC "(" OBJ ")V",           FN_PTR(Unsafe_Unpark)},
        diff --git a/hotspot/src/share/vm/shark/sharkIntrinsics.cpp b/hotspot/src/share/vm/shark/sharkIntrinsics.cpp
        index 51b813f4b8d..15b6679bf4e 100644
        --- a/hotspot/src/share/vm/shark/sharkIntrinsics.cpp
        +++ b/hotspot/src/share/vm/shark/sharkIntrinsics.cpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
          * Copyright 2009 Red Hat, Inc.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
        @@ -66,7 +66,7 @@ bool SharkIntrinsics::is_intrinsic(ciMethod *target) {
             return true;
         
             // Unsafe
        -  case vmIntrinsics::_compareAndSwapInt:
        +  case vmIntrinsics::_compareAndSetInt:
             return true;
         
           default:
        @@ -140,8 +140,8 @@ void SharkIntrinsics::do_intrinsic() {
             break;
         
             // Unsafe
        -  case vmIntrinsics::_compareAndSwapInt:
        -    do_Unsafe_compareAndSwapInt();
        +  case vmIntrinsics::_compareAndSetInt:
        +    do_Unsafe_compareAndSetInt();
             break;
         
           default:
        @@ -241,7 +241,7 @@ void SharkIntrinsics::do_Thread_currentThread() {
               true));
         }
         
        -void SharkIntrinsics::do_Unsafe_compareAndSwapInt() {
        +void SharkIntrinsics::do_Unsafe_compareAndSetInt() {
           // Pop the arguments
           Value *x      = state()->pop()->jint_value();
           Value *e      = state()->pop()->jint_value();
        diff --git a/hotspot/src/share/vm/shark/sharkIntrinsics.hpp b/hotspot/src/share/vm/shark/sharkIntrinsics.hpp
        index f0699f8948e..8a5d60f17b9 100644
        --- a/hotspot/src/share/vm/shark/sharkIntrinsics.hpp
        +++ b/hotspot/src/share/vm/shark/sharkIntrinsics.hpp
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
          * Copyright 2009 Red Hat, Inc.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
        @@ -58,7 +58,7 @@ class SharkIntrinsics : public SharkTargetInvariants {
           void do_Object_getClass();
           void do_System_currentTimeMillis();
           void do_Thread_currentThread();
        -  void do_Unsafe_compareAndSwapInt();
        +  void do_Unsafe_compareAndSetInt();
         };
         
         #endif // SHARE_VM_SHARK_SHARKINTRINSICS_HPP
        diff --git a/hotspot/test/compiler/intrinsics/unsafe/TestCAEAntiDep.java b/hotspot/test/compiler/intrinsics/unsafe/TestCAEAntiDep.java
        index 5bec829dddd..353c73e43ba 100644
        --- a/hotspot/test/compiler/intrinsics/unsafe/TestCAEAntiDep.java
        +++ b/hotspot/test/compiler/intrinsics/unsafe/TestCAEAntiDep.java
        @@ -1,4 +1,5 @@
         /*
        + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
          * Copyright (c) 2016, Red Hat, Inc. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
        @@ -53,7 +54,7 @@ public class TestCAEAntiDep {
             }
         
             static int m(TestCAEAntiDep test, Object expected, Object x) {
        -        C old = (C)UNSAFE.compareAndExchangeObjectVolatile(test, O_OFFSET, expected, x);
        +        C old = (C)UNSAFE.compareAndExchangeObject(test, O_OFFSET, expected, x);
                 int res = old.f1;
                 old.f1 = 0x42;
                 return res;
        diff --git a/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java b/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java
        index 8f65f1d5e04..772b44b60e4 100644
        --- a/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java
        +++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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,9 +72,8 @@ public class UnsafeTwoCASLong {
             }
         
             static void testAccess(Object base, long offset) {
        -        UNSAFE.compareAndSwapLong(base, offset, 1L, 2L);
        -        UNSAFE.compareAndSwapLong(base, offset, 2L, 1L);
        +        UNSAFE.compareAndSetLong(base, offset, 1L, 2L);
        +        UNSAFE.compareAndSetLong(base, offset, 2L, 1L);
             }
         
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java
        index 50e505bd840..75c33c9984c 100644
        --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java
        +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -151,32 +151,32 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
         
                 // Compare
                 {
        -            boolean r = UNSAFE.compareAndSwapBoolean(base, offset, true, false);
        -            assertEquals(r, true, "success compareAndSwap boolean");
        +            boolean r = UNSAFE.compareAndSetBoolean(base, offset, true, false);
        +            assertEquals(r, true, "success compareAndSet boolean");
                     boolean x = UNSAFE.getBoolean(base, offset);
        -            assertEquals(x, false, "success compareAndSwap boolean value");
        +            assertEquals(x, false, "success compareAndSet boolean value");
                 }
         
                 {
        -            boolean r = UNSAFE.compareAndSwapBoolean(base, offset, true, false);
        -            assertEquals(r, false, "failing compareAndSwap boolean");
        +            boolean r = UNSAFE.compareAndSetBoolean(base, offset, true, false);
        +            assertEquals(r, false, "failing compareAndSet boolean");
                     boolean x = UNSAFE.getBoolean(base, offset);
        -            assertEquals(x, false, "failing compareAndSwap boolean value");
        +            assertEquals(x, false, "failing compareAndSet boolean value");
                 }
         
                 // Advanced compare
                 {
        -            boolean r = UNSAFE.compareAndExchangeBooleanVolatile(base, offset, false, true);
        -            assertEquals(r, false, "success compareAndExchangeVolatile boolean");
        +            boolean r = UNSAFE.compareAndExchangeBoolean(base, offset, false, true);
        +            assertEquals(r, false, "success compareAndExchange boolean");
                     boolean x = UNSAFE.getBoolean(base, offset);
        -            assertEquals(x, true, "success compareAndExchangeVolatile boolean value");
        +            assertEquals(x, true, "success compareAndExchange boolean value");
                 }
         
                 {
        -            boolean r = UNSAFE.compareAndExchangeBooleanVolatile(base, offset, false, false);
        -            assertEquals(r, true, "failing compareAndExchangeVolatile boolean");
        +            boolean r = UNSAFE.compareAndExchangeBoolean(base, offset, false, false);
        +            assertEquals(r, true, "failing compareAndExchange boolean");
                     boolean x = UNSAFE.getBoolean(base, offset);
        -            assertEquals(x, true, "failing compareAndExchangeVolatile boolean value");
        +            assertEquals(x, true, "failing compareAndExchange boolean value");
                 }
         
                 {
        @@ -210,41 +210,41 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapBoolean(base, offset, true, false);
        +                success = UNSAFE.weakCompareAndSetBooleanPlain(base, offset, true, false);
                     }
        -            assertEquals(success, true, "weakCompareAndSwap boolean");
        +            assertEquals(success, true, "weakCompareAndSetPlain boolean");
                     boolean x = UNSAFE.getBoolean(base, offset);
        -            assertEquals(x, false, "weakCompareAndSwap boolean value");
        +            assertEquals(x, false, "weakCompareAndSetPlain boolean value");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapBooleanAcquire(base, offset, false, true);
        +                success = UNSAFE.weakCompareAndSetBooleanAcquire(base, offset, false, true);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapAcquire boolean");
        +            assertEquals(success, true, "weakCompareAndSetAcquire boolean");
                     boolean x = UNSAFE.getBoolean(base, offset);
        -            assertEquals(x, true, "weakCompareAndSwapAcquire boolean");
        +            assertEquals(x, true, "weakCompareAndSetAcquire boolean");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapBooleanRelease(base, offset, true, false);
        +                success = UNSAFE.weakCompareAndSetBooleanRelease(base, offset, true, false);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapRelease boolean");
        +            assertEquals(success, true, "weakCompareAndSetRelease boolean");
                     boolean x = UNSAFE.getBoolean(base, offset);
        -            assertEquals(x, false, "weakCompareAndSwapRelease boolean");
        +            assertEquals(x, false, "weakCompareAndSetRelease boolean");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapBooleanVolatile(base, offset, false, true);
        +                success = UNSAFE.weakCompareAndSetBoolean(base, offset, false, true);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapVolatile boolean");
        +            assertEquals(success, true, "weakCompareAndSet boolean");
                     boolean x = UNSAFE.getBoolean(base, offset);
        -            assertEquals(x, true, "weakCompareAndSwapVolatile boolean");
        +            assertEquals(x, true, "weakCompareAndSet boolean");
                 }
         
                 UNSAFE.putBoolean(base, offset, false);
        @@ -260,4 +260,3 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
             }
         
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java
        index e35e5904d93..30ffae395df 100644
        --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java
        +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -180,32 +180,32 @@ public class JdkInternalMiscUnsafeAccessTestByte {
         
                 // Compare
                 {
        -            boolean r = UNSAFE.compareAndSwapByte(base, offset, (byte)0x01, (byte)0x23);
        -            assertEquals(r, true, "success compareAndSwap byte");
        +            boolean r = UNSAFE.compareAndSetByte(base, offset, (byte)0x01, (byte)0x23);
        +            assertEquals(r, true, "success compareAndSet byte");
                     byte x = UNSAFE.getByte(base, offset);
        -            assertEquals(x, (byte)0x23, "success compareAndSwap byte value");
        +            assertEquals(x, (byte)0x23, "success compareAndSet byte value");
                 }
         
                 {
        -            boolean r = UNSAFE.compareAndSwapByte(base, offset, (byte)0x01, (byte)0x45);
        -            assertEquals(r, false, "failing compareAndSwap byte");
        +            boolean r = UNSAFE.compareAndSetByte(base, offset, (byte)0x01, (byte)0x45);
        +            assertEquals(r, false, "failing compareAndSet byte");
                     byte x = UNSAFE.getByte(base, offset);
        -            assertEquals(x, (byte)0x23, "failing compareAndSwap byte value");
        +            assertEquals(x, (byte)0x23, "failing compareAndSet byte value");
                 }
         
                 // Advanced compare
                 {
        -            byte r = UNSAFE.compareAndExchangeByteVolatile(base, offset, (byte)0x23, (byte)0x01);
        -            assertEquals(r, (byte)0x23, "success compareAndExchangeVolatile byte");
        +            byte r = UNSAFE.compareAndExchangeByte(base, offset, (byte)0x23, (byte)0x01);
        +            assertEquals(r, (byte)0x23, "success compareAndExchange byte");
                     byte x = UNSAFE.getByte(base, offset);
        -            assertEquals(x, (byte)0x01, "success compareAndExchangeVolatile byte value");
        +            assertEquals(x, (byte)0x01, "success compareAndExchange byte value");
                 }
         
                 {
        -            byte r = UNSAFE.compareAndExchangeByteVolatile(base, offset, (byte)0x23, (byte)0x45);
        -            assertEquals(r, (byte)0x01, "failing compareAndExchangeVolatile byte");
        +            byte r = UNSAFE.compareAndExchangeByte(base, offset, (byte)0x23, (byte)0x45);
        +            assertEquals(r, (byte)0x01, "failing compareAndExchange byte");
                     byte x = UNSAFE.getByte(base, offset);
        -            assertEquals(x, (byte)0x01, "failing compareAndExchangeVolatile byte value");
        +            assertEquals(x, (byte)0x01, "failing compareAndExchange byte value");
                 }
         
                 {
        @@ -239,41 +239,41 @@ public class JdkInternalMiscUnsafeAccessTestByte {
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapByte(base, offset, (byte)0x01, (byte)0x23);
        +                success = UNSAFE.weakCompareAndSetBytePlain(base, offset, (byte)0x01, (byte)0x23);
                     }
        -            assertEquals(success, true, "weakCompareAndSwap byte");
        +            assertEquals(success, true, "weakCompareAndSetPlain byte");
                     byte x = UNSAFE.getByte(base, offset);
        -            assertEquals(x, (byte)0x23, "weakCompareAndSwap byte value");
        +            assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapByteAcquire(base, offset, (byte)0x23, (byte)0x01);
        +                success = UNSAFE.weakCompareAndSetByteAcquire(base, offset, (byte)0x23, (byte)0x01);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapAcquire byte");
        +            assertEquals(success, true, "weakCompareAndSetAcquire byte");
                     byte x = UNSAFE.getByte(base, offset);
        -            assertEquals(x, (byte)0x01, "weakCompareAndSwapAcquire byte");
        +            assertEquals(x, (byte)0x01, "weakCompareAndSetAcquire byte");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapByteRelease(base, offset, (byte)0x01, (byte)0x23);
        +                success = UNSAFE.weakCompareAndSetByteRelease(base, offset, (byte)0x01, (byte)0x23);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapRelease byte");
        +            assertEquals(success, true, "weakCompareAndSetRelease byte");
                     byte x = UNSAFE.getByte(base, offset);
        -            assertEquals(x, (byte)0x23, "weakCompareAndSwapRelease byte");
        +            assertEquals(x, (byte)0x23, "weakCompareAndSetRelease byte");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapByteVolatile(base, offset, (byte)0x23, (byte)0x01);
        +                success = UNSAFE.weakCompareAndSetByte(base, offset, (byte)0x23, (byte)0x01);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapVolatile byte");
        +            assertEquals(success, true, "weakCompareAndSet byte");
                     byte x = UNSAFE.getByte(base, offset);
        -            assertEquals(x, (byte)0x01, "weakCompareAndSwapVolatile byte");
        +            assertEquals(x, (byte)0x01, "weakCompareAndSet byte");
                 }
         
                 UNSAFE.putByte(base, offset, (byte)0x23);
        @@ -306,4 +306,3 @@ public class JdkInternalMiscUnsafeAccessTestByte {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java
        index 0bb36c898bc..817af4b18c1 100644
        --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java
        +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestChar {
         
                 // Compare
                 {
        -            boolean r = UNSAFE.compareAndSwapChar(base, offset, '\u0123', '\u4567');
        -            assertEquals(r, true, "success compareAndSwap char");
        +            boolean r = UNSAFE.compareAndSetChar(base, offset, '\u0123', '\u4567');
        +            assertEquals(r, true, "success compareAndSet char");
                     char x = UNSAFE.getChar(base, offset);
        -            assertEquals(x, '\u4567', "success compareAndSwap char value");
        +            assertEquals(x, '\u4567', "success compareAndSet char value");
                 }
         
                 {
        -            boolean r = UNSAFE.compareAndSwapChar(base, offset, '\u0123', '\u89AB');
        -            assertEquals(r, false, "failing compareAndSwap char");
        +            boolean r = UNSAFE.compareAndSetChar(base, offset, '\u0123', '\u89AB');
        +            assertEquals(r, false, "failing compareAndSet char");
                     char x = UNSAFE.getChar(base, offset);
        -            assertEquals(x, '\u4567', "failing compareAndSwap char value");
        +            assertEquals(x, '\u4567', "failing compareAndSet char value");
                 }
         
                 // Advanced compare
                 {
        -            char r = UNSAFE.compareAndExchangeCharVolatile(base, offset, '\u4567', '\u0123');
        -            assertEquals(r, '\u4567', "success compareAndExchangeVolatile char");
        +            char r = UNSAFE.compareAndExchangeChar(base, offset, '\u4567', '\u0123');
        +            assertEquals(r, '\u4567', "success compareAndExchange char");
                     char x = UNSAFE.getChar(base, offset);
        -            assertEquals(x, '\u0123', "success compareAndExchangeVolatile char value");
        +            assertEquals(x, '\u0123', "success compareAndExchange char value");
                 }
         
                 {
        -            char r = UNSAFE.compareAndExchangeCharVolatile(base, offset, '\u4567', '\u89AB');
        -            assertEquals(r, '\u0123', "failing compareAndExchangeVolatile char");
        +            char r = UNSAFE.compareAndExchangeChar(base, offset, '\u4567', '\u89AB');
        +            assertEquals(r, '\u0123', "failing compareAndExchange char");
                     char x = UNSAFE.getChar(base, offset);
        -            assertEquals(x, '\u0123', "failing compareAndExchangeVolatile char value");
        +            assertEquals(x, '\u0123', "failing compareAndExchange char value");
                 }
         
                 {
        @@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestChar {
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapChar(base, offset, '\u0123', '\u4567');
        +                success = UNSAFE.weakCompareAndSetCharPlain(base, offset, '\u0123', '\u4567');
                     }
        -            assertEquals(success, true, "weakCompareAndSwap char");
        +            assertEquals(success, true, "weakCompareAndSetPlain char");
                     char x = UNSAFE.getChar(base, offset);
        -            assertEquals(x, '\u4567', "weakCompareAndSwap char value");
        +            assertEquals(x, '\u4567', "weakCompareAndSetPlain char value");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapCharAcquire(base, offset, '\u4567', '\u0123');
        +                success = UNSAFE.weakCompareAndSetCharAcquire(base, offset, '\u4567', '\u0123');
                     }
        -            assertEquals(success, true, "weakCompareAndSwapAcquire char");
        +            assertEquals(success, true, "weakCompareAndSetAcquire char");
                     char x = UNSAFE.getChar(base, offset);
        -            assertEquals(x, '\u0123', "weakCompareAndSwapAcquire char");
        +            assertEquals(x, '\u0123', "weakCompareAndSetAcquire char");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapCharRelease(base, offset, '\u0123', '\u4567');
        +                success = UNSAFE.weakCompareAndSetCharRelease(base, offset, '\u0123', '\u4567');
                     }
        -            assertEquals(success, true, "weakCompareAndSwapRelease char");
        +            assertEquals(success, true, "weakCompareAndSetRelease char");
                     char x = UNSAFE.getChar(base, offset);
        -            assertEquals(x, '\u4567', "weakCompareAndSwapRelease char");
        +            assertEquals(x, '\u4567', "weakCompareAndSetRelease char");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapCharVolatile(base, offset, '\u4567', '\u0123');
        +                success = UNSAFE.weakCompareAndSetChar(base, offset, '\u4567', '\u0123');
                     }
        -            assertEquals(success, true, "weakCompareAndSwapVolatile char");
        +            assertEquals(success, true, "weakCompareAndSet char");
                     char x = UNSAFE.getChar(base, offset);
        -            assertEquals(x, '\u0123', "weakCompareAndSwapVolatile char");
        +            assertEquals(x, '\u0123', "weakCompareAndSet char");
                 }
         
                 UNSAFE.putChar(base, offset, '\u4567');
        @@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestChar {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java
        index 48a98c619fd..37c15e57a6a 100644
        --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java
        +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -180,32 +180,32 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
         
                 // Compare
                 {
        -            boolean r = UNSAFE.compareAndSwapDouble(base, offset, 1.0d, 2.0d);
        -            assertEquals(r, true, "success compareAndSwap double");
        +            boolean r = UNSAFE.compareAndSetDouble(base, offset, 1.0d, 2.0d);
        +            assertEquals(r, true, "success compareAndSet double");
                     double x = UNSAFE.getDouble(base, offset);
        -            assertEquals(x, 2.0d, "success compareAndSwap double value");
        +            assertEquals(x, 2.0d, "success compareAndSet double value");
                 }
         
                 {
        -            boolean r = UNSAFE.compareAndSwapDouble(base, offset, 1.0d, 3.0d);
        -            assertEquals(r, false, "failing compareAndSwap double");
        +            boolean r = UNSAFE.compareAndSetDouble(base, offset, 1.0d, 3.0d);
        +            assertEquals(r, false, "failing compareAndSet double");
                     double x = UNSAFE.getDouble(base, offset);
        -            assertEquals(x, 2.0d, "failing compareAndSwap double value");
        +            assertEquals(x, 2.0d, "failing compareAndSet double value");
                 }
         
                 // Advanced compare
                 {
        -            double r = UNSAFE.compareAndExchangeDoubleVolatile(base, offset, 2.0d, 1.0d);
        -            assertEquals(r, 2.0d, "success compareAndExchangeVolatile double");
        +            double r = UNSAFE.compareAndExchangeDouble(base, offset, 2.0d, 1.0d);
        +            assertEquals(r, 2.0d, "success compareAndExchange double");
                     double x = UNSAFE.getDouble(base, offset);
        -            assertEquals(x, 1.0d, "success compareAndExchangeVolatile double value");
        +            assertEquals(x, 1.0d, "success compareAndExchange double value");
                 }
         
                 {
        -            double r = UNSAFE.compareAndExchangeDoubleVolatile(base, offset, 2.0d, 3.0d);
        -            assertEquals(r, 1.0d, "failing compareAndExchangeVolatile double");
        +            double r = UNSAFE.compareAndExchangeDouble(base, offset, 2.0d, 3.0d);
        +            assertEquals(r, 1.0d, "failing compareAndExchange double");
                     double x = UNSAFE.getDouble(base, offset);
        -            assertEquals(x, 1.0d, "failing compareAndExchangeVolatile double value");
        +            assertEquals(x, 1.0d, "failing compareAndExchange double value");
                 }
         
                 {
        @@ -239,41 +239,41 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapDouble(base, offset, 1.0d, 2.0d);
        +                success = UNSAFE.weakCompareAndSetDoublePlain(base, offset, 1.0d, 2.0d);
                     }
        -            assertEquals(success, true, "weakCompareAndSwap double");
        +            assertEquals(success, true, "weakCompareAndSetPlain double");
                     double x = UNSAFE.getDouble(base, offset);
        -            assertEquals(x, 2.0d, "weakCompareAndSwap double value");
        +            assertEquals(x, 2.0d, "weakCompareAndSetPlain double value");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapDoubleAcquire(base, offset, 2.0d, 1.0d);
        +                success = UNSAFE.weakCompareAndSetDoubleAcquire(base, offset, 2.0d, 1.0d);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapAcquire double");
        +            assertEquals(success, true, "weakCompareAndSetAcquire double");
                     double x = UNSAFE.getDouble(base, offset);
        -            assertEquals(x, 1.0d, "weakCompareAndSwapAcquire double");
        +            assertEquals(x, 1.0d, "weakCompareAndSetAcquire double");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapDoubleRelease(base, offset, 1.0d, 2.0d);
        +                success = UNSAFE.weakCompareAndSetDoubleRelease(base, offset, 1.0d, 2.0d);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapRelease double");
        +            assertEquals(success, true, "weakCompareAndSetRelease double");
                     double x = UNSAFE.getDouble(base, offset);
        -            assertEquals(x, 2.0d, "weakCompareAndSwapRelease double");
        +            assertEquals(x, 2.0d, "weakCompareAndSetRelease double");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapDoubleVolatile(base, offset, 2.0d, 1.0d);
        +                success = UNSAFE.weakCompareAndSetDouble(base, offset, 2.0d, 1.0d);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapVolatile double");
        +            assertEquals(success, true, "weakCompareAndSet double");
                     double x = UNSAFE.getDouble(base, offset);
        -            assertEquals(x, 1.0d, "weakCompareAndSwapVolatile double");
        +            assertEquals(x, 1.0d, "weakCompareAndSet double");
                 }
         
                 UNSAFE.putDouble(base, offset, 2.0d);
        @@ -306,4 +306,3 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java
        index 2a91a7c20c3..0ac9fa1e55a 100644
        --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java
        +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -180,32 +180,32 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
         
                 // Compare
                 {
        -            boolean r = UNSAFE.compareAndSwapFloat(base, offset, 1.0f, 2.0f);
        -            assertEquals(r, true, "success compareAndSwap float");
        +            boolean r = UNSAFE.compareAndSetFloat(base, offset, 1.0f, 2.0f);
        +            assertEquals(r, true, "success compareAndSet float");
                     float x = UNSAFE.getFloat(base, offset);
        -            assertEquals(x, 2.0f, "success compareAndSwap float value");
        +            assertEquals(x, 2.0f, "success compareAndSet float value");
                 }
         
                 {
        -            boolean r = UNSAFE.compareAndSwapFloat(base, offset, 1.0f, 3.0f);
        -            assertEquals(r, false, "failing compareAndSwap float");
        +            boolean r = UNSAFE.compareAndSetFloat(base, offset, 1.0f, 3.0f);
        +            assertEquals(r, false, "failing compareAndSet float");
                     float x = UNSAFE.getFloat(base, offset);
        -            assertEquals(x, 2.0f, "failing compareAndSwap float value");
        +            assertEquals(x, 2.0f, "failing compareAndSet float value");
                 }
         
                 // Advanced compare
                 {
        -            float r = UNSAFE.compareAndExchangeFloatVolatile(base, offset, 2.0f, 1.0f);
        -            assertEquals(r, 2.0f, "success compareAndExchangeVolatile float");
        +            float r = UNSAFE.compareAndExchangeFloat(base, offset, 2.0f, 1.0f);
        +            assertEquals(r, 2.0f, "success compareAndExchange float");
                     float x = UNSAFE.getFloat(base, offset);
        -            assertEquals(x, 1.0f, "success compareAndExchangeVolatile float value");
        +            assertEquals(x, 1.0f, "success compareAndExchange float value");
                 }
         
                 {
        -            float r = UNSAFE.compareAndExchangeFloatVolatile(base, offset, 2.0f, 3.0f);
        -            assertEquals(r, 1.0f, "failing compareAndExchangeVolatile float");
        +            float r = UNSAFE.compareAndExchangeFloat(base, offset, 2.0f, 3.0f);
        +            assertEquals(r, 1.0f, "failing compareAndExchange float");
                     float x = UNSAFE.getFloat(base, offset);
        -            assertEquals(x, 1.0f, "failing compareAndExchangeVolatile float value");
        +            assertEquals(x, 1.0f, "failing compareAndExchange float value");
                 }
         
                 {
        @@ -239,41 +239,41 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapFloat(base, offset, 1.0f, 2.0f);
        +                success = UNSAFE.weakCompareAndSetFloatPlain(base, offset, 1.0f, 2.0f);
                     }
        -            assertEquals(success, true, "weakCompareAndSwap float");
        +            assertEquals(success, true, "weakCompareAndSetPlain float");
                     float x = UNSAFE.getFloat(base, offset);
        -            assertEquals(x, 2.0f, "weakCompareAndSwap float value");
        +            assertEquals(x, 2.0f, "weakCompareAndSetPlain float value");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapFloatAcquire(base, offset, 2.0f, 1.0f);
        +                success = UNSAFE.weakCompareAndSetFloatAcquire(base, offset, 2.0f, 1.0f);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapAcquire float");
        +            assertEquals(success, true, "weakCompareAndSetAcquire float");
                     float x = UNSAFE.getFloat(base, offset);
        -            assertEquals(x, 1.0f, "weakCompareAndSwapAcquire float");
        +            assertEquals(x, 1.0f, "weakCompareAndSetAcquire float");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapFloatRelease(base, offset, 1.0f, 2.0f);
        +                success = UNSAFE.weakCompareAndSetFloatRelease(base, offset, 1.0f, 2.0f);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapRelease float");
        +            assertEquals(success, true, "weakCompareAndSetRelease float");
                     float x = UNSAFE.getFloat(base, offset);
        -            assertEquals(x, 2.0f, "weakCompareAndSwapRelease float");
        +            assertEquals(x, 2.0f, "weakCompareAndSetRelease float");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapFloatVolatile(base, offset, 2.0f, 1.0f);
        +                success = UNSAFE.weakCompareAndSetFloat(base, offset, 2.0f, 1.0f);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapVolatile float");
        +            assertEquals(success, true, "weakCompareAndSet float");
                     float x = UNSAFE.getFloat(base, offset);
        -            assertEquals(x, 1.0f, "weakCompareAndSwapVolatile float");
        +            assertEquals(x, 1.0f, "weakCompareAndSet float");
                 }
         
                 UNSAFE.putFloat(base, offset, 2.0f);
        @@ -306,4 +306,3 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java
        index b55e3672427..0f0f1f101d3 100644
        --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java
        +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestInt {
         
                 // Compare
                 {
        -            boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF);
        -            assertEquals(r, true, "success compareAndSwap int");
        +            boolean r = UNSAFE.compareAndSetInt(base, offset, 0x01234567, 0x89ABCDEF);
        +            assertEquals(r, true, "success compareAndSet int");
                     int x = UNSAFE.getInt(base, offset);
        -            assertEquals(x, 0x89ABCDEF, "success compareAndSwap int value");
        +            assertEquals(x, 0x89ABCDEF, "success compareAndSet int value");
                 }
         
                 {
        -            boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0xCAFEBABE);
        -            assertEquals(r, false, "failing compareAndSwap int");
        +            boolean r = UNSAFE.compareAndSetInt(base, offset, 0x01234567, 0xCAFEBABE);
        +            assertEquals(r, false, "failing compareAndSet int");
                     int x = UNSAFE.getInt(base, offset);
        -            assertEquals(x, 0x89ABCDEF, "failing compareAndSwap int value");
        +            assertEquals(x, 0x89ABCDEF, "failing compareAndSet int value");
                 }
         
                 // Advanced compare
                 {
        -            int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 0x89ABCDEF, 0x01234567);
        -            assertEquals(r, 0x89ABCDEF, "success compareAndExchangeVolatile int");
        +            int r = UNSAFE.compareAndExchangeInt(base, offset, 0x89ABCDEF, 0x01234567);
        +            assertEquals(r, 0x89ABCDEF, "success compareAndExchange int");
                     int x = UNSAFE.getInt(base, offset);
        -            assertEquals(x, 0x01234567, "success compareAndExchangeVolatile int value");
        +            assertEquals(x, 0x01234567, "success compareAndExchange int value");
                 }
         
                 {
        -            int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 0x89ABCDEF, 0xCAFEBABE);
        -            assertEquals(r, 0x01234567, "failing compareAndExchangeVolatile int");
        +            int r = UNSAFE.compareAndExchangeInt(base, offset, 0x89ABCDEF, 0xCAFEBABE);
        +            assertEquals(r, 0x01234567, "failing compareAndExchange int");
                     int x = UNSAFE.getInt(base, offset);
        -            assertEquals(x, 0x01234567, "failing compareAndExchangeVolatile int value");
        +            assertEquals(x, 0x01234567, "failing compareAndExchange int value");
                 }
         
                 {
        @@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestInt {
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF);
        +                success = UNSAFE.weakCompareAndSetIntPlain(base, offset, 0x01234567, 0x89ABCDEF);
                     }
        -            assertEquals(success, true, "weakCompareAndSwap int");
        +            assertEquals(success, true, "weakCompareAndSetPlain int");
                     int x = UNSAFE.getInt(base, offset);
        -            assertEquals(x, 0x89ABCDEF, "weakCompareAndSwap int value");
        +            assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapIntAcquire(base, offset, 0x89ABCDEF, 0x01234567);
        +                success = UNSAFE.weakCompareAndSetIntAcquire(base, offset, 0x89ABCDEF, 0x01234567);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapAcquire int");
        +            assertEquals(success, true, "weakCompareAndSetAcquire int");
                     int x = UNSAFE.getInt(base, offset);
        -            assertEquals(x, 0x01234567, "weakCompareAndSwapAcquire int");
        +            assertEquals(x, 0x01234567, "weakCompareAndSetAcquire int");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapIntRelease(base, offset, 0x01234567, 0x89ABCDEF);
        +                success = UNSAFE.weakCompareAndSetIntRelease(base, offset, 0x01234567, 0x89ABCDEF);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapRelease int");
        +            assertEquals(success, true, "weakCompareAndSetRelease int");
                     int x = UNSAFE.getInt(base, offset);
        -            assertEquals(x, 0x89ABCDEF, "weakCompareAndSwapRelease int");
        +            assertEquals(x, 0x89ABCDEF, "weakCompareAndSetRelease int");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapIntVolatile(base, offset, 0x89ABCDEF, 0x01234567);
        +                success = UNSAFE.weakCompareAndSetInt(base, offset, 0x89ABCDEF, 0x01234567);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapVolatile int");
        +            assertEquals(success, true, "weakCompareAndSet int");
                     int x = UNSAFE.getInt(base, offset);
        -            assertEquals(x, 0x01234567, "weakCompareAndSwapVolatile int");
        +            assertEquals(x, 0x01234567, "weakCompareAndSet int");
                 }
         
                 UNSAFE.putInt(base, offset, 0x89ABCDEF);
        @@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestInt {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java
        index fc78b375071..69a51bb698b 100644
        --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java
        +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestLong {
         
                 // Compare
                 {
        -            boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
        -            assertEquals(r, true, "success compareAndSwap long");
        +            boolean r = UNSAFE.compareAndSetLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
        +            assertEquals(r, true, "success compareAndSet long");
                     long x = UNSAFE.getLong(base, offset);
        -            assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSwap long value");
        +            assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSet long value");
                 }
         
                 {
        -            boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
        -            assertEquals(r, false, "failing compareAndSwap long");
        +            boolean r = UNSAFE.compareAndSetLong(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
        +            assertEquals(r, false, "failing compareAndSet long");
                     long x = UNSAFE.getLong(base, offset);
        -            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSwap long value");
        +            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSet long value");
                 }
         
                 // Advanced compare
                 {
        -            long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
        -            assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeVolatile long");
        +            long r = UNSAFE.compareAndExchangeLong(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
        +            assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchange long");
                     long x = UNSAFE.getLong(base, offset);
        -            assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeVolatile long value");
        +            assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchange long value");
                 }
         
                 {
        -            long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
        -            assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeVolatile long");
        +            long r = UNSAFE.compareAndExchangeLong(base, offset, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
        +            assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchange long");
                     long x = UNSAFE.getLong(base, offset);
        -            assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeVolatile long value");
        +            assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchange long value");
                 }
         
                 {
        @@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestLong {
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
        +                success = UNSAFE.weakCompareAndSetLongPlain(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
                     }
        -            assertEquals(success, true, "weakCompareAndSwap long");
        +            assertEquals(success, true, "weakCompareAndSetPlain long");
                     long x = UNSAFE.getLong(base, offset);
        -            assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSwap long value");
        +            assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapLongAcquire(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
        +                success = UNSAFE.weakCompareAndSetLongAcquire(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapAcquire long");
        +            assertEquals(success, true, "weakCompareAndSetAcquire long");
                     long x = UNSAFE.getLong(base, offset);
        -            assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSwapAcquire long");
        +            assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetAcquire long");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapLongRelease(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
        +                success = UNSAFE.weakCompareAndSetLongRelease(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapRelease long");
        +            assertEquals(success, true, "weakCompareAndSetRelease long");
                     long x = UNSAFE.getLong(base, offset);
        -            assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSwapRelease long");
        +            assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetRelease long");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
        +                success = UNSAFE.weakCompareAndSetLong(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapVolatile long");
        +            assertEquals(success, true, "weakCompareAndSet long");
                     long x = UNSAFE.getLong(base, offset);
        -            assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSwapVolatile long");
        +            assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long");
                 }
         
                 UNSAFE.putLong(base, offset, 0xCAFEBABECAFEBABEL);
        @@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestLong {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java
        index 039b472ccf7..b2e5fc57e1e 100644
        --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java
        +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -151,32 +151,32 @@ public class JdkInternalMiscUnsafeAccessTestObject {
         
                 // Compare
                 {
        -            boolean r = UNSAFE.compareAndSwapObject(base, offset, "foo", "bar");
        -            assertEquals(r, true, "success compareAndSwap Object");
        +            boolean r = UNSAFE.compareAndSetObject(base, offset, "foo", "bar");
        +            assertEquals(r, true, "success compareAndSet Object");
                     Object x = UNSAFE.getObject(base, offset);
        -            assertEquals(x, "bar", "success compareAndSwap Object value");
        +            assertEquals(x, "bar", "success compareAndSet Object value");
                 }
         
                 {
        -            boolean r = UNSAFE.compareAndSwapObject(base, offset, "foo", "baz");
        -            assertEquals(r, false, "failing compareAndSwap Object");
        +            boolean r = UNSAFE.compareAndSetObject(base, offset, "foo", "baz");
        +            assertEquals(r, false, "failing compareAndSet Object");
                     Object x = UNSAFE.getObject(base, offset);
        -            assertEquals(x, "bar", "failing compareAndSwap Object value");
        +            assertEquals(x, "bar", "failing compareAndSet Object value");
                 }
         
                 // Advanced compare
                 {
        -            Object r = UNSAFE.compareAndExchangeObjectVolatile(base, offset, "bar", "foo");
        -            assertEquals(r, "bar", "success compareAndExchangeVolatile Object");
        +            Object r = UNSAFE.compareAndExchangeObject(base, offset, "bar", "foo");
        +            assertEquals(r, "bar", "success compareAndExchange Object");
                     Object x = UNSAFE.getObject(base, offset);
        -            assertEquals(x, "foo", "success compareAndExchangeVolatile Object value");
        +            assertEquals(x, "foo", "success compareAndExchange Object value");
                 }
         
                 {
        -            Object r = UNSAFE.compareAndExchangeObjectVolatile(base, offset, "bar", "baz");
        -            assertEquals(r, "foo", "failing compareAndExchangeVolatile Object");
        +            Object r = UNSAFE.compareAndExchangeObject(base, offset, "bar", "baz");
        +            assertEquals(r, "foo", "failing compareAndExchange Object");
                     Object x = UNSAFE.getObject(base, offset);
        -            assertEquals(x, "foo", "failing compareAndExchangeVolatile Object value");
        +            assertEquals(x, "foo", "failing compareAndExchange Object value");
                 }
         
                 {
        @@ -210,41 +210,41 @@ public class JdkInternalMiscUnsafeAccessTestObject {
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapObject(base, offset, "foo", "bar");
        +                success = UNSAFE.weakCompareAndSetObjectPlain(base, offset, "foo", "bar");
                     }
        -            assertEquals(success, true, "weakCompareAndSwap Object");
        +            assertEquals(success, true, "weakCompareAndSetPlain Object");
                     Object x = UNSAFE.getObject(base, offset);
        -            assertEquals(x, "bar", "weakCompareAndSwap Object value");
        +            assertEquals(x, "bar", "weakCompareAndSetPlain Object value");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapObjectAcquire(base, offset, "bar", "foo");
        +                success = UNSAFE.weakCompareAndSetObjectAcquire(base, offset, "bar", "foo");
                     }
        -            assertEquals(success, true, "weakCompareAndSwapAcquire Object");
        +            assertEquals(success, true, "weakCompareAndSetAcquire Object");
                     Object x = UNSAFE.getObject(base, offset);
        -            assertEquals(x, "foo", "weakCompareAndSwapAcquire Object");
        +            assertEquals(x, "foo", "weakCompareAndSetAcquire Object");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapObjectRelease(base, offset, "foo", "bar");
        +                success = UNSAFE.weakCompareAndSetObjectRelease(base, offset, "foo", "bar");
                     }
        -            assertEquals(success, true, "weakCompareAndSwapRelease Object");
        +            assertEquals(success, true, "weakCompareAndSetRelease Object");
                     Object x = UNSAFE.getObject(base, offset);
        -            assertEquals(x, "bar", "weakCompareAndSwapRelease Object");
        +            assertEquals(x, "bar", "weakCompareAndSetRelease Object");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapObjectVolatile(base, offset, "bar", "foo");
        +                success = UNSAFE.weakCompareAndSetObject(base, offset, "bar", "foo");
                     }
        -            assertEquals(success, true, "weakCompareAndSwapVolatile Object");
        +            assertEquals(success, true, "weakCompareAndSet Object");
                     Object x = UNSAFE.getObject(base, offset);
        -            assertEquals(x, "foo", "weakCompareAndSwapVolatile Object");
        +            assertEquals(x, "foo", "weakCompareAndSet Object");
                 }
         
                 UNSAFE.putObject(base, offset, "bar");
        @@ -260,4 +260,3 @@ public class JdkInternalMiscUnsafeAccessTestObject {
             }
         
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java
        index f854979c73f..a6b845eec6b 100644
        --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java
        +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestShort {
         
                 // Compare
                 {
        -            boolean r = UNSAFE.compareAndSwapShort(base, offset, (short)0x0123, (short)0x4567);
        -            assertEquals(r, true, "success compareAndSwap short");
        +            boolean r = UNSAFE.compareAndSetShort(base, offset, (short)0x0123, (short)0x4567);
        +            assertEquals(r, true, "success compareAndSet short");
                     short x = UNSAFE.getShort(base, offset);
        -            assertEquals(x, (short)0x4567, "success compareAndSwap short value");
        +            assertEquals(x, (short)0x4567, "success compareAndSet short value");
                 }
         
                 {
        -            boolean r = UNSAFE.compareAndSwapShort(base, offset, (short)0x0123, (short)0x89AB);
        -            assertEquals(r, false, "failing compareAndSwap short");
        +            boolean r = UNSAFE.compareAndSetShort(base, offset, (short)0x0123, (short)0x89AB);
        +            assertEquals(r, false, "failing compareAndSet short");
                     short x = UNSAFE.getShort(base, offset);
        -            assertEquals(x, (short)0x4567, "failing compareAndSwap short value");
        +            assertEquals(x, (short)0x4567, "failing compareAndSet short value");
                 }
         
                 // Advanced compare
                 {
        -            short r = UNSAFE.compareAndExchangeShortVolatile(base, offset, (short)0x4567, (short)0x0123);
        -            assertEquals(r, (short)0x4567, "success compareAndExchangeVolatile short");
        +            short r = UNSAFE.compareAndExchangeShort(base, offset, (short)0x4567, (short)0x0123);
        +            assertEquals(r, (short)0x4567, "success compareAndExchange short");
                     short x = UNSAFE.getShort(base, offset);
        -            assertEquals(x, (short)0x0123, "success compareAndExchangeVolatile short value");
        +            assertEquals(x, (short)0x0123, "success compareAndExchange short value");
                 }
         
                 {
        -            short r = UNSAFE.compareAndExchangeShortVolatile(base, offset, (short)0x4567, (short)0x89AB);
        -            assertEquals(r, (short)0x0123, "failing compareAndExchangeVolatile short");
        +            short r = UNSAFE.compareAndExchangeShort(base, offset, (short)0x4567, (short)0x89AB);
        +            assertEquals(r, (short)0x0123, "failing compareAndExchange short");
                     short x = UNSAFE.getShort(base, offset);
        -            assertEquals(x, (short)0x0123, "failing compareAndExchangeVolatile short value");
        +            assertEquals(x, (short)0x0123, "failing compareAndExchange short value");
                 }
         
                 {
        @@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestShort {
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapShort(base, offset, (short)0x0123, (short)0x4567);
        +                success = UNSAFE.weakCompareAndSetShortPlain(base, offset, (short)0x0123, (short)0x4567);
                     }
        -            assertEquals(success, true, "weakCompareAndSwap short");
        +            assertEquals(success, true, "weakCompareAndSetPlain short");
                     short x = UNSAFE.getShort(base, offset);
        -            assertEquals(x, (short)0x4567, "weakCompareAndSwap short value");
        +            assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapShortAcquire(base, offset, (short)0x4567, (short)0x0123);
        +                success = UNSAFE.weakCompareAndSetShortAcquire(base, offset, (short)0x4567, (short)0x0123);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapAcquire short");
        +            assertEquals(success, true, "weakCompareAndSetAcquire short");
                     short x = UNSAFE.getShort(base, offset);
        -            assertEquals(x, (short)0x0123, "weakCompareAndSwapAcquire short");
        +            assertEquals(x, (short)0x0123, "weakCompareAndSetAcquire short");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapShortRelease(base, offset, (short)0x0123, (short)0x4567);
        +                success = UNSAFE.weakCompareAndSetShortRelease(base, offset, (short)0x0123, (short)0x4567);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapRelease short");
        +            assertEquals(success, true, "weakCompareAndSetRelease short");
                     short x = UNSAFE.getShort(base, offset);
        -            assertEquals(x, (short)0x4567, "weakCompareAndSwapRelease short");
        +            assertEquals(x, (short)0x4567, "weakCompareAndSetRelease short");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwapShortVolatile(base, offset, (short)0x4567, (short)0x0123);
        +                success = UNSAFE.weakCompareAndSetShort(base, offset, (short)0x4567, (short)0x0123);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapVolatile short");
        +            assertEquals(success, true, "weakCompareAndSet short");
                     short x = UNSAFE.getShort(base, offset);
        -            assertEquals(x, (short)0x0123, "weakCompareAndSwapVolatile short");
        +            assertEquals(x, (short)0x0123, "weakCompareAndSet short");
                 }
         
                 UNSAFE.putShort(base, offset, (short)0x4567);
        @@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestShort {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java
        index 7200bf754c8..a1b68c7305d 100644
        --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java
        +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -138,4 +138,3 @@ public class SunMiscUnsafeAccessTestBoolean {
             }
         
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java
        index a30c01ff0f6..c086315cb8a 100644
        --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java
        +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestByte {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java
        index 12dbb25030b..3a55939826d 100644
        --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java
        +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestChar {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java
        index 5fedde71510..52bde3f08d6 100644
        --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java
        +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestDouble {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java
        index 621e4ae3863..478efa4dbc3 100644
        --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java
        +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestFloat {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java
        index 1e49aacb287..0bf8b641066 100644
        --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java
        +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -216,4 +216,3 @@ public class SunMiscUnsafeAccessTestInt {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java
        index e484bcec291..64014df3340 100644
        --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java
        +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -216,4 +216,3 @@ public class SunMiscUnsafeAccessTestLong {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java
        index 1241f0fbcd4..0145124c7bd 100644
        --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java
        +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -170,4 +170,3 @@ public class SunMiscUnsafeAccessTestObject {
             }
         
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java
        index d1d7b632389..9a815670595 100644
        --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java
        +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestShort {
                 }
             }
         }
        -
        diff --git a/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template b/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template
        index 55ed81fc059..f28791765a1 100644
        --- a/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template
        +++ b/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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,11 @@
          * @bug 8143628
          * @summary Test unsafe access for $type$
          *
        +#if[JdkInternalMisc]
        + * @modules $module$/$package$:+open
        +#else[JdkInternalMisc]
          * @modules $module$/$package$
        +#end[JdkInternalMisc]
          * @run testng/othervm -Diters=100   -Xint                   compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
          * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
          * @run testng/othervm -Diters=20000 -XX:-TieredCompilation  compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
        @@ -219,33 +223,51 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
         
                 // Compare
                 {
        +#if[JdkInternalMisc]
        +            boolean r = UNSAFE.compareAndSet$Type$(base, offset, $value1$, $value2$);
        +            assertEquals(r, true, "success compareAndSet $type$");
        +#else[JdkInternalMisc]
                     boolean r = UNSAFE.compareAndSwap$Type$(base, offset, $value1$, $value2$);
                     assertEquals(r, true, "success compareAndSwap $type$");
        +#end[JdkInternalMisc]
                     $type$ x = UNSAFE.get$Type$(base, offset);
        +#if[JdkInternalMisc]
        +            assertEquals(x, $value2$, "success compareAndSet $type$ value");
        +#else[JdkInternalMisc]
                     assertEquals(x, $value2$, "success compareAndSwap $type$ value");
        +#end[JdkInternalMisc]
                 }
         
                 {
        +#if[JdkInternalMisc]
        +            boolean r = UNSAFE.compareAndSet$Type$(base, offset, $value1$, $value3$);
        +            assertEquals(r, false, "failing compareAndSet $type$");
        +#else[JdkInternalMisc]
                     boolean r = UNSAFE.compareAndSwap$Type$(base, offset, $value1$, $value3$);
                     assertEquals(r, false, "failing compareAndSwap $type$");
        +#end[JdkInternalMisc]
                     $type$ x = UNSAFE.get$Type$(base, offset);
        +#if[JdkInternalMisc]
        +            assertEquals(x, $value2$, "failing compareAndSet $type$ value");
        +#else[JdkInternalMisc]
                     assertEquals(x, $value2$, "failing compareAndSwap $type$ value");
        +#end[JdkInternalMisc]
                 }
         
         #if[JdkInternalMisc]
                 // Advanced compare
                 {
        -            $type$ r = UNSAFE.compareAndExchange$Type$Volatile(base, offset, $value2$, $value1$);
        -            assertEquals(r, $value2$, "success compareAndExchangeVolatile $type$");
        +            $type$ r = UNSAFE.compareAndExchange$Type$(base, offset, $value2$, $value1$);
        +            assertEquals(r, $value2$, "success compareAndExchange $type$");
                     $type$ x = UNSAFE.get$Type$(base, offset);
        -            assertEquals(x, $value1$, "success compareAndExchangeVolatile $type$ value");
        +            assertEquals(x, $value1$, "success compareAndExchange $type$ value");
                 }
         
                 {
        -            $type$ r = UNSAFE.compareAndExchange$Type$Volatile(base, offset, $value2$, $value3$);
        -            assertEquals(r, $value1$, "failing compareAndExchangeVolatile $type$");
        +            $type$ r = UNSAFE.compareAndExchange$Type$(base, offset, $value2$, $value3$);
        +            assertEquals(r, $value1$, "failing compareAndExchange $type$");
                     $type$ x = UNSAFE.get$Type$(base, offset);
        -            assertEquals(x, $value1$, "failing compareAndExchangeVolatile $type$ value");
        +            assertEquals(x, $value1$, "failing compareAndExchange $type$ value");
                 }
         
                 {
        @@ -279,41 +301,41 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwap$Type$(base, offset, $value1$, $value2$);
        +                success = UNSAFE.weakCompareAndSet$Type$Plain(base, offset, $value1$, $value2$);
                     }
        -            assertEquals(success, true, "weakCompareAndSwap $type$");
        +            assertEquals(success, true, "weakCompareAndSetPlain $type$");
                     $type$ x = UNSAFE.get$Type$(base, offset);
        -            assertEquals(x, $value2$, "weakCompareAndSwap $type$ value");
        +            assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwap$Type$Acquire(base, offset, $value2$, $value1$);
        +                success = UNSAFE.weakCompareAndSet$Type$Acquire(base, offset, $value2$, $value1$);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapAcquire $type$");
        +            assertEquals(success, true, "weakCompareAndSetAcquire $type$");
                     $type$ x = UNSAFE.get$Type$(base, offset);
        -            assertEquals(x, $value1$, "weakCompareAndSwapAcquire $type$");
        +            assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwap$Type$Release(base, offset, $value1$, $value2$);
        +                success = UNSAFE.weakCompareAndSet$Type$Release(base, offset, $value1$, $value2$);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapRelease $type$");
        +            assertEquals(success, true, "weakCompareAndSetRelease $type$");
                     $type$ x = UNSAFE.get$Type$(base, offset);
        -            assertEquals(x, $value2$, "weakCompareAndSwapRelease $type$");
        +            assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
                 }
         
                 {
                     boolean success = false;
                     for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
        -                success = UNSAFE.weakCompareAndSwap$Type$Volatile(base, offset, $value2$, $value1$);
        +                success = UNSAFE.weakCompareAndSet$Type$(base, offset, $value2$, $value1$);
                     }
        -            assertEquals(success, true, "weakCompareAndSwapVolatile $type$");
        +            assertEquals(success, true, "weakCompareAndSet $type$");
                     $type$ x = UNSAFE.get$Type$(base, offset);
        -            assertEquals(x, $value1$, "weakCompareAndSwapVolatile $type$");
        +            assertEquals(x, $value1$, "weakCompareAndSet $type$");
                 }
         
         #end[JdkInternalMisc]
        @@ -354,4 +376,3 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
         #end[!boolean]
         #end[!Object]
         }
        -
        
        From c18fe9b250dd984792127c6b40a97891254637d4 Mon Sep 17 00:00:00 2001
        From: Amy Lu 
        Date: Fri, 12 May 2017 12:53:50 +0800
        Subject: [PATCH 51/55] 8085814: Move stream test library to the jdk test
         library area 8173414: Some testng tests check nothing in java util stream
        
        Reviewed-by: psandoz
        ---
         .../NetworkInterfaceStreamTest.java           |  4 +-
         .../java/nio/file/Files/StreamLinesTest.java  |  4 +-
         .../PermissionCollectionStreamTest.java       |  4 +-
         .../util/BitSet/stream/BitSetStreamTest.java  |  2 +-
         .../java/util/Scanner/ScannerStreamTest.java  |  2 +-
         .../Spliterator/SpliteratorCollisions.java    |  2 +-
         ...SpliteratorTraversingAndSplittingTest.java |  2 +-
         .../java/util/regex/PatternStreamTest.java    |  4 +-
         .../java/util/stream/boottest/TEST.properties |  2 +-
         .../java/util/stream/test/TEST.properties     |  2 +-
         .../tests/java/util/NullArgsTestCase.java     | 70 -------------------
         .../util/SpliteratorOfIntDataBuilder.java     |  0
         .../java/util/SpliteratorTestHelper.java      |  0
         .../java/util/stream/CollectorOps.java        |  0
         .../util/stream/DefaultMethodStreams.java     |  0
         .../stream/DoubleStreamTestDataProvider.java  |  0
         .../util/stream/DoubleStreamTestScenario.java |  0
         .../java/util/stream/FlagDeclaringOp.java     |  0
         .../stream/IntStreamTestDataProvider.java     |  0
         .../util/stream/IntStreamTestScenario.java    |  0
         .../java/util/stream/IntermediateTestOp.java  |  0
         .../java/util/stream/LambdaTestHelpers.java   |  0
         .../java/util/stream/LambdaTestMode.java      |  0
         .../java/util/stream/LoggingTestCase.java     |  0
         .../stream/LongStreamTestDataProvider.java    |  0
         .../util/stream/LongStreamTestScenario.java   |  0
         .../java/util/stream/OpTestCase.java          |  0
         .../java/util/stream/StatefulTestOp.java      |  0
         .../java/util/stream/StatelessTestOp.java     |  0
         .../util/stream/StreamOpFlagTestHelper.java   |  0
         .../util/stream/StreamTestDataProvider.java   |  0
         .../java/util/stream/StreamTestScenario.java  |  0
         .../java.base/java/util/stream/TestData.java  |  0
         .../java/util/stream/TestFlagExpectedOp.java  |  0
         .../java/util/stream/ThrowableHelper.java     |  0
         35 files changed, 14 insertions(+), 84 deletions(-)
         delete mode 100644 jdk/test/java/util/stream/test/org/openjdk/tests/java/util/NullArgsTestCase.java
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/SpliteratorOfIntDataBuilder.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/SpliteratorTestHelper.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/CollectorOps.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/DefaultMethodStreams.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/DoubleStreamTestDataProvider.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/DoubleStreamTestScenario.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/FlagDeclaringOp.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/IntStreamTestDataProvider.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/IntStreamTestScenario.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/IntermediateTestOp.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/LambdaTestHelpers.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/LambdaTestMode.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/LoggingTestCase.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/LongStreamTestDataProvider.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/LongStreamTestScenario.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/OpTestCase.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/StatefulTestOp.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/StatelessTestOp.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/StreamOpFlagTestHelper.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/StreamTestDataProvider.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/StreamTestScenario.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/TestData.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/TestFlagExpectedOp.java (100%)
         rename jdk/test/{java/util/stream => lib/testlibrary}/bootlib/java.base/java/util/stream/ThrowableHelper.java (100%)
        
        diff --git a/jdk/test/java/net/NetworkInterface/NetworkInterfaceStreamTest.java b/jdk/test/java/net/NetworkInterface/NetworkInterfaceStreamTest.java
        index 1fa3a557941..74a5c014dfd 100644
        --- a/jdk/test/java/net/NetworkInterface/NetworkInterfaceStreamTest.java
        +++ b/jdk/test/java/net/NetworkInterface/NetworkInterfaceStreamTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -24,7 +24,7 @@
         /* @test
          * @bug 8081678 8131155
          * @summary Tests for stream returning methods
        - * @library ../../util/stream/bootlib
        + * @library /lib/testlibrary/bootlib
          * @build java.base/java.util.stream.OpTestCase
          * @run testng/othervm NetworkInterfaceStreamTest
          * @run testng/othervm -Djava.net.preferIPv4Stack=true NetworkInterfaceStreamTest
        diff --git a/jdk/test/java/nio/file/Files/StreamLinesTest.java b/jdk/test/java/nio/file/Files/StreamLinesTest.java
        index aa4c9ba3220..2cf90e765a7 100644
        --- a/jdk/test/java/nio/file/Files/StreamLinesTest.java
        +++ b/jdk/test/java/nio/file/Files/StreamLinesTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -23,7 +23,7 @@
         
         /* @test
          * @bug 8072773
        - * @library /lib/testlibrary/ ../../../util/stream/bootlib
        + * @library /lib/testlibrary/ /lib/testlibrary/bootlib
          * @build java.base/java.util.stream.OpTestCase
          * @build jdk.testlibrary.RandomFactory
          * @run testng/othervm StreamLinesTest
        diff --git a/jdk/test/java/security/PermissionCollection/PermissionCollectionStreamTest.java b/jdk/test/java/security/PermissionCollection/PermissionCollectionStreamTest.java
        index 63d962e93b7..e803f0105e5 100644
        --- a/jdk/test/java/security/PermissionCollection/PermissionCollectionStreamTest.java
        +++ b/jdk/test/java/security/PermissionCollection/PermissionCollectionStreamTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, 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
        @@ -24,7 +24,7 @@
         /* @test
          * @bug 8081678
          * @summary Tests for stream returning methods
        - * @library ../../util/stream/bootlib
        + * @library /lib/testlibrary/bootlib
          * @build java.base/java.util.stream.OpTestCase
          * @run testng/othervm PermissionCollectionStreamTest
          */
        diff --git a/jdk/test/java/util/BitSet/stream/BitSetStreamTest.java b/jdk/test/java/util/BitSet/stream/BitSetStreamTest.java
        index e6bf02715fe..608c53582b3 100644
        --- a/jdk/test/java/util/BitSet/stream/BitSetStreamTest.java
        +++ b/jdk/test/java/util/BitSet/stream/BitSetStreamTest.java
        @@ -50,7 +50,7 @@ import static org.testng.Assert.assertTrue;
          * @summary test BitSet stream
          * @bug 8012645 8076442
          * @requires os.maxMemory >= 2g
        - * @library ../../stream/bootlib
        + * @library /lib/testlibrary/bootlib
          * @build java.base/java.util.SpliteratorTestHelper
          *        java.base/java.util.SpliteratorOfIntDataBuilder
          * @run testng/othervm -Xms512m -Xmx1024m BitSetStreamTest
        diff --git a/jdk/test/java/util/Scanner/ScannerStreamTest.java b/jdk/test/java/util/Scanner/ScannerStreamTest.java
        index 99d21dce1c1..a27cae0f437 100644
        --- a/jdk/test/java/util/Scanner/ScannerStreamTest.java
        +++ b/jdk/test/java/util/Scanner/ScannerStreamTest.java
        @@ -47,7 +47,7 @@ import static org.testng.Assert.*;
          * @test
          * @bug 8072722 8150488
          * @summary Tests of stream support in java.util.Scanner
        - * @library ../stream/bootlib
        + * @library /lib/testlibrary/bootlib
          * @build java.base/java.util.stream.OpTestCase
          * @run testng/othervm ScannerStreamTest
          */
        diff --git a/jdk/test/java/util/Spliterator/SpliteratorCollisions.java b/jdk/test/java/util/Spliterator/SpliteratorCollisions.java
        index da9de48f705..0bc18ede700 100644
        --- a/jdk/test/java/util/Spliterator/SpliteratorCollisions.java
        +++ b/jdk/test/java/util/Spliterator/SpliteratorCollisions.java
        @@ -24,7 +24,7 @@
         /**
          * @test
          * @bug 8005698
        - * @library ../stream/bootlib
        + * @library /lib/testlibrary/bootlib
          * @build java.base/java.util.SpliteratorTestHelper
          * @run testng SpliteratorCollisions
          * @summary Spliterator traversing and splitting hash maps containing colliding hashes
        diff --git a/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java b/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java
        index ca45ab758bc..ece63bfe813 100644
        --- a/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java
        +++ b/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java
        @@ -24,7 +24,7 @@
         /**
          * @test
          * @summary Spliterator traversing and splitting tests
        - * @library ../stream/bootlib
        + * @library /lib/testlibrary/bootlib
          * @build java.base/java.util.SpliteratorOfIntDataBuilder
          *        java.base/java.util.SpliteratorTestHelper
          * @run testng SpliteratorTraversingAndSplittingTest
        diff --git a/jdk/test/java/util/regex/PatternStreamTest.java b/jdk/test/java/util/regex/PatternStreamTest.java
        index 9809ea20aef..28d0eb06ccb 100644
        --- a/jdk/test/java/util/regex/PatternStreamTest.java
        +++ b/jdk/test/java/util/regex/PatternStreamTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2013, 2017, 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
        @@ -25,7 +25,7 @@
          * @test
          * @bug 8016846 8024341 8071479 8145006
          * @summary Unit tests stream and lambda-based methods on Pattern and Matcher
        - * @library ../stream/bootlib
        + * @library /lib/testlibrary/bootlib
          * @build java.base/java.util.stream.OpTestCase
          * @run testng/othervm PatternStreamTest
          */
        diff --git a/jdk/test/java/util/stream/boottest/TEST.properties b/jdk/test/java/util/stream/boottest/TEST.properties
        index 3c930e3afa3..565242e959b 100644
        --- a/jdk/test/java/util/stream/boottest/TEST.properties
        +++ b/jdk/test/java/util/stream/boottest/TEST.properties
        @@ -1,4 +1,4 @@
         # This file identifies root(s) of the test-ng hierarchy.
         
         TestNG.dirs = .
        -lib.dirs = /java/util/stream/bootlib
        +lib.dirs = /lib/testlibrary/bootlib
        diff --git a/jdk/test/java/util/stream/test/TEST.properties b/jdk/test/java/util/stream/test/TEST.properties
        index 4128f6afd75..2eb6c198177 100644
        --- a/jdk/test/java/util/stream/test/TEST.properties
        +++ b/jdk/test/java/util/stream/test/TEST.properties
        @@ -2,7 +2,7 @@
         
         TestNG.dirs = .
         
        -lib.dirs = /java/util/stream/bootlib
        +lib.dirs = /lib/testlibrary/bootlib
         
         # Tests that must run in othervm mode
         othervm.dirs= /java/util/stream
        diff --git a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/NullArgsTestCase.java b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/NullArgsTestCase.java
        deleted file mode 100644
        index 5cae1ba7459..00000000000
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/NullArgsTestCase.java
        +++ /dev/null
        @@ -1,70 +0,0 @@
        -/*
        - * 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
        - * under the terms of the GNU General Public License version 2 only, as
        - * published by the Free Software Foundation.
        - *
        - * This code is distributed in the hope that it will be useful, but WITHOUT
        - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        - * version 2 for more details (a copy is included in the LICENSE file that
        - * accompanied this code).
        - *
        - * You should have received a copy of the GNU General Public License version
        - * 2 along with this work; if not, write to the Free Software Foundation,
        - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        - *
        - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        - * or visit www.oracle.com if you need additional information or have any
        - * questions.
        - */
        -package org.openjdk.tests.java.util;
        -
        -import org.testng.annotations.Test;
        -
        -import java.util.Arrays;
        -import java.util.function.Consumer;
        -
        -import static org.testng.Assert.fail;
        -
        -/**
        - * NullArgsTestCase -- Given a Consumer<Object[]>, and an Object[] array of args, call the block with the args,
        - * assert success, and then call the consumer N times, each time setting one of the args to null, and assert that
        - * all these throw NPE.
        - *
        - * Typically this would be combined with a DataProvider that serves up combinations of things to be tested, as in
        - * IteratorsNullTest.
        - */
        -public abstract class NullArgsTestCase {
        -    public final String name;
        -    public final Consumer sink;
        -    public final Object[] args;
        -
        -    protected NullArgsTestCase(String name, Consumer sink, Object[] args) {
        -        this.name = name;
        -        this.sink = sink;
        -        this.args = args;
        -    }
        -
        -    @Test
        -    public void goodNonNull() {
        -        sink.accept(args);
        -    }
        -
        -    @Test
        -    public void throwWithNull() {
        -        for (int i=0; i
        Date: Fri, 12 May 2017 21:13:24 +0200
        Subject: [PATCH 52/55] 8180198: make bootcycle-images fail with uses of -d64
         flags
        
        Reviewed-by: mchung, ksrini, tbell
        ---
         common/autoconf/boot-jdk.m4            |  2 +-
         common/autoconf/build-performance.m4   |  4 +---
         common/autoconf/generated-configure.sh | 22 +++-------------------
         3 files changed, 5 insertions(+), 23 deletions(-)
        
        diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4
        index b7ae10542ed..e286603adef 100644
        --- a/common/autoconf/boot-jdk.m4
        +++ b/common/autoconf/boot-jdk.m4
        @@ -318,7 +318,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
           AC_SUBST(JAVAC_FLAGS)
         
           # Check if the boot jdk is 32 or 64 bit
        -  if "$JAVA" -d64 -version > /dev/null 2>&1; then
        +  if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then
             BOOT_JDK_BITS="64"
           else
             BOOT_JDK_BITS="32"
        diff --git a/common/autoconf/build-performance.m4 b/common/autoconf/build-performance.m4
        index 13578cfa867..72799148692 100644
        --- a/common/autoconf/build-performance.m4
        +++ b/common/autoconf/build-performance.m4
        @@ -417,10 +417,8 @@ AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
           AC_SUBST(SJAVAC_SERVER_JAVA)
         
           if test "$MEMORY_SIZE" -gt "3000"; then
        -    ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA_FLAGS,[$SJAVAC_SERVER_JAVA])
        -    if test "$JVM_ARG_OK" = true; then
        +    if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then
               JVM_64BIT=true
        -      JVM_ARG_OK=false
             fi
           fi
         
        diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
        index 9539c5f0bd9..c2ee6070986 100644
        --- a/common/autoconf/generated-configure.sh
        +++ b/common/autoconf/generated-configure.sh
        @@ -5186,7 +5186,7 @@ VS_SDK_PLATFORM_NAME_2013=
         #CUSTOM_AUTOCONF_INCLUDE
         
         # Do not change or remove the following line, it is needed for consistency checks:
        -DATE_WHEN_GENERATED=1493884285
        +DATE_WHEN_GENERATED=1494615666
         
         ###############################################################################
         #
        @@ -31416,7 +31416,7 @@ $as_echo "no" >&6; }
         
         
           # Check if the boot jdk is 32 or 64 bit
        -  if "$JAVA" -d64 -version > /dev/null 2>&1; then
        +  if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then
             BOOT_JDK_BITS="64"
           else
             BOOT_JDK_BITS="32"
        @@ -65934,24 +65934,8 @@ fi
         
         
           if test "$MEMORY_SIZE" -gt "3000"; then
        -
        -  $ECHO "Check if jvm arg is ok: -d64" >&5
        -  $ECHO "Command: $SJAVAC_SERVER_JAVA -d64 -version" >&5
        -  OUTPUT=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1`
        -  FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
        -  FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
        -  if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
        -    SJAVAC_SERVER_JAVA_FLAGS="$SJAVAC_SERVER_JAVA_FLAGS -d64"
        -    JVM_ARG_OK=true
        -  else
        -    $ECHO "Arg failed:" >&5
        -    $ECHO "$OUTPUT" >&5
        -    JVM_ARG_OK=false
        -  fi
        -
        -    if test "$JVM_ARG_OK" = true; then
        +    if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then
               JVM_64BIT=true
        -      JVM_ARG_OK=false
             fi
           fi
         
        
        From 7466e6f833cbb8d2d9d8e0c6bca864e9acd2cbc6 Mon Sep 17 00:00:00 2001
        From: Christian Tornqvist 
        Date: Fri, 12 May 2017 15:09:23 -0700
        Subject: [PATCH 53/55] 8180304: Add tests to ProblemList that fails on Windows
         when running with subst or different drive than source code is on
        
        Reviewed-by: ksrini, gtriantafill
        ---
         jdk/test/ProblemList.txt | 4 ++++
         1 file changed, 4 insertions(+)
        
        diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
        index 70f0cd40e6f..e88054943eb 100644
        --- a/jdk/test/ProblemList.txt
        +++ b/jdk/test/ProblemList.txt
        @@ -142,6 +142,8 @@ java/lang/management/MemoryMXBean/PendingAllGC.sh               8158837 generic-
         
         # jdk_io
         
        +java/io/pathNames/GeneralWin32.java                             8180264 windows-all
        +
         ############################################################################
         
         # jdk_management
        @@ -210,6 +212,8 @@ sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java      8026393 generic-
         javax/net/ssl/DTLS/PacketLossRetransmission.java                8169086 macosx-x64
         javax/net/ssl/DTLS/RespondToRetransmit.java                     8169086 macosx-x64
         
        +sun/security/krb5/auto/UnboundSSL.java                          8180265 windows-all
        +sun/security/provider/KeyStore/DKSTest.sh                       8180266 windows-all
         sun/security/ssl/X509KeyManager/PreferredKey.java               8176354 generic-all
         
         ############################################################################
        
        From b0e4f83d40af5f3c2ec9e7c8761e53fa4038e295 Mon Sep 17 00:00:00 2001
        From: Kumar Srinivasan 
        Date: Tue, 16 May 2017 07:17:08 -0700
        Subject: [PATCH 54/55] 8180202: -XXaltjvm is not working anymore on MacOSX
        
        Reviewed-by: dholmes
        ---
         jdk/src/java.base/macosx/native/libjli/java_md_macosx.c | 2 +-
         1 file changed, 1 insertion(+), 1 deletion(-)
        
        diff --git a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c
        index 7f6ec0bed8a..0abf273921b 100644
        --- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c
        +++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c
        @@ -424,7 +424,7 @@ GetJVMPath(const char *jrepath, const char *jvmtype,
                  * macosx client library is built thin, i386 only.
                  * 64 bit client requests must load server library
                  */
        -        JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/server/" JVM_DLL, jrepath);
        +        JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/%s/" JVM_DLL, jrepath, jvmtype);
             }
         
             JLI_TraceLauncher("Does `%s' exist ... ", jvmpath);
        
        From c4d2b219641a95d87bc0747d8bc140abf50d8a29 Mon Sep 17 00:00:00 2001
        From: Igor Ignatyev 
        Date: Tue, 16 May 2017 09:04:54 -0700
        Subject: [PATCH 55/55] 8180195: remove jaxp testlibrary
        
        Reviewed-by: fyuan, joehw
        ---
         .../jdk/test/lib/compiler/CompilerUtils.java  | 81 +++++++++++++++++++
         .../jdk/test/lib/process/OutputAnalyzer.java  | 20 +++++
         .../jdk/test/lib/process/ProcessTools.java    | 11 ++-
         3 files changed, 111 insertions(+), 1 deletion(-)
         create mode 100644 test/lib/jdk/test/lib/compiler/CompilerUtils.java
        
        diff --git a/test/lib/jdk/test/lib/compiler/CompilerUtils.java b/test/lib/jdk/test/lib/compiler/CompilerUtils.java
        new file mode 100644
        index 00000000000..5638dba720b
        --- /dev/null
        +++ b/test/lib/jdk/test/lib/compiler/CompilerUtils.java
        @@ -0,0 +1,81 @@
        +/*
        + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +package jdk.test.lib.compiler;
        +
        +import javax.tools.JavaCompiler;
        +import javax.tools.StandardJavaFileManager;
        +import javax.tools.StandardLocation;
        +import javax.tools.ToolProvider;
        +import java.io.IOException;
        +import java.nio.file.Files;
        +import java.nio.file.Path;
        +import java.util.Arrays;
        +import java.util.Collections;
        +import java.util.List;
        +import java.util.stream.Collectors;
        +
        +/**
        + * This class consists exclusively of static utility methods for invoking the
        + * java compiler.
        + */
        +
        +public final class CompilerUtils {
        +    private CompilerUtils() { }
        +
        +    /**
        +     * Compile all the java sources in {@code /**} to
        +     * {@code /**}. The destination directory will be created if
        +     * it doesn't exist.
        +     *
        +     * All warnings/errors emitted by the compiler are output to System.out/err.
        +     *
        +     * @return true if the compilation is successful
        +     *
        +     * @throws IOException if there is an I/O error scanning the source tree or
        +     *                     creating the destination directory
        +     */
        +    public static boolean compile(Path source, Path destination, String ... options)
        +        throws IOException
        +    {
        +        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        +        StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
        +
        +        List sources
        +            = Files.find(source, Integer.MAX_VALUE,
        +                (file, attrs) -> (file.toString().endsWith(".java")))
        +                .collect(Collectors.toList());
        +
        +        Files.createDirectories(destination);
        +        jfm.setLocation(StandardLocation.CLASS_PATH, Collections.emptyList());
        +        jfm.setLocationFromPaths(StandardLocation.CLASS_OUTPUT,
        +                Collections.singletonList(destination));
        +
        +        List opts = Arrays.asList(options);
        +        JavaCompiler.CompilationTask task
        +            = compiler.getTask(null, jfm, null, opts, null,
        +                jfm.getJavaFileObjectsFromPaths(sources));
        +
        +        return task.call();
        +    }
        +}
        diff --git a/test/lib/jdk/test/lib/process/OutputAnalyzer.java b/test/lib/jdk/test/lib/process/OutputAnalyzer.java
        index 572610d788d..73936b26548 100644
        --- a/test/lib/jdk/test/lib/process/OutputAnalyzer.java
        +++ b/test/lib/jdk/test/lib/process/OutputAnalyzer.java
        @@ -24,6 +24,7 @@
         package jdk.test.lib.process;
         
         import java.io.IOException;
        +import java.io.PrintStream;
         import java.util.Arrays;
         import java.util.List;
         import java.util.regex.Matcher;
        @@ -415,6 +416,25 @@ public final class OutputAnalyzer {
               System.err.println(msg);
           }
         
        +  /**
        +   * Print the stdout buffer to the given {@code PrintStream}.
        +   *
        +   * @return this OutputAnalyzer
        +   */
        +  public OutputAnalyzer outputTo(PrintStream out) {
        +      out.println(getStdout());
        +      return this;
        +  }
        +
        +  /**
        +   * Print the stderr buffer to the given {@code PrintStream}.
        +   *
        +   * @return this OutputAnalyzer
        +   */
        +  public OutputAnalyzer errorTo(PrintStream out) {
        +      out.println(getStderr());
        +      return this;
        +  }
         
           /**
            * Get the contents of the output buffer (stdout and stderr)
        diff --git a/test/lib/jdk/test/lib/process/ProcessTools.java b/test/lib/jdk/test/lib/process/ProcessTools.java
        index 83ddee6e813..eff0f361edb 100644
        --- a/test/lib/jdk/test/lib/process/ProcessTools.java
        +++ b/test/lib/jdk/test/lib/process/ProcessTools.java
        @@ -365,7 +365,7 @@ public final class ProcessTools {
              *
              * The jvm process will have exited before this method returns.
              *
        -     * @param cmds User specifed arguments.
        +     * @param cmds User specified arguments.
              * @return The output from the process.
              */
             public static OutputAnalyzer executeTestJvm(String... cmds) throws Exception {
        @@ -373,6 +373,15 @@ public final class ProcessTools {
                 return executeProcess(pb);
             }
         
        +    /**
        +     * @see #executeTestJvm(String...)
        +     * @param cmds User specified arguments.
        +     * @return The output from the process.
        +     */
        +    public static OutputAnalyzer executeTestJava(String... cmds) throws Exception {
        +        return executeTestJvm(cmds);
        +    }
        +
             /**
              * Executes a process, waits for it to finish and returns the process output.
              * The process will have exited before this method returns.