From c6274c7aa28e470cdce74fb14b2c737e534bab76 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 24 Apr 2017 15:15:55 +0300 Subject: [PATCH 01/49] 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/49] 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 15d2a8831a67292fdbc684e248778c3c4f0c21d5 Mon Sep 17 00:00:00 2001 From: Shafi Ahmad Date: Thu, 27 Apr 2017 00:08:24 -0700 Subject: [PATCH 03/49] 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 04/49] 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 05/49] 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 06/49] 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 db8bc54f61f2541b006cae07093283d29771388f Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Fri, 28 Apr 2017 16:14:57 -0700 Subject: [PATCH 07/49] 8179452: Remove intermittent key from some tests which appear no longer to fail Remove "intermittent" key Reviewed-by: alanb, lancea, darcy --- jdk/test/java/io/FileInputStream/LargeFileAvailable.java | 1 - jdk/test/java/nio/channels/FileChannel/LoopingTruncate.java | 1 - jdk/test/java/nio/channels/FileChannel/Transfer.java | 1 - jdk/test/java/nio/channels/FileChannel/Transfers.java | 1 - 4 files changed, 4 deletions(-) diff --git a/jdk/test/java/io/FileInputStream/LargeFileAvailable.java b/jdk/test/java/io/FileInputStream/LargeFileAvailable.java index 2abfbd88e6d..081a551c15a 100644 --- a/jdk/test/java/io/FileInputStream/LargeFileAvailable.java +++ b/jdk/test/java/io/FileInputStream/LargeFileAvailable.java @@ -24,7 +24,6 @@ /* * @test * @bug 6402006 7030573 8011136 - * @key intermittent * @summary Test if available returns correct value when reading * a large file. * @run main/timeout=300 LargeFileAvailable diff --git a/jdk/test/java/nio/channels/FileChannel/LoopingTruncate.java b/jdk/test/java/nio/channels/FileChannel/LoopingTruncate.java index a0cebab1093..3855b2c47ad 100644 --- a/jdk/test/java/nio/channels/FileChannel/LoopingTruncate.java +++ b/jdk/test/java/nio/channels/FileChannel/LoopingTruncate.java @@ -24,7 +24,6 @@ /** * @test * @bug 8137121 8137230 - * @key intermittent * @summary (fc) Infinite loop FileChannel.truncate * @library /lib/testlibrary * @build jdk.testlibrary.Utils diff --git a/jdk/test/java/nio/channels/FileChannel/Transfer.java b/jdk/test/java/nio/channels/FileChannel/Transfer.java index c36e7cfab28..43d7202408c 100644 --- a/jdk/test/java/nio/channels/FileChannel/Transfer.java +++ b/jdk/test/java/nio/channels/FileChannel/Transfer.java @@ -23,7 +23,6 @@ /* @test * @bug 4434723 4482726 4559072 4795550 5081340 5103988 6984545 - * @key intermittent * @summary Test FileChannel.transferFrom and transferTo (use -Dseed=X to set PRNG seed) * @library .. * @library /lib/testlibrary/ diff --git a/jdk/test/java/nio/channels/FileChannel/Transfers.java b/jdk/test/java/nio/channels/FileChannel/Transfers.java index 32c76166cdf..30bf5294fed 100644 --- a/jdk/test/java/nio/channels/FileChannel/Transfers.java +++ b/jdk/test/java/nio/channels/FileChannel/Transfers.java @@ -22,7 +22,6 @@ */ /* @test - * @key intermittent * @summary Comprehensive test for FileChannel.transfer{From,To} * @bug 4708120 * @author Mark Reinhold From 7ebbf0f8404eb17b70806f4fb7cc289470d31b2e Mon Sep 17 00:00:00 2001 From: Alexandre Iline Date: Fri, 28 Apr 2017 17:21:28 -0700 Subject: [PATCH 08/49] 8179457: Remove demo/jvmti tests Reviewed-by: iignatyev, sspitsyn --- jdk/test/ProblemList.txt | 2 - jdk/test/TEST.groups | 3 +- jdk/test/demo/jvmti/Context.java | 188 ---------------- jdk/test/demo/jvmti/DemoRun.java | 211 ------------------ jdk/test/demo/jvmti/HeapUser.java | 72 ------ jdk/test/demo/jvmti/Hello.java | 35 --- .../CompiledMethodLoadTest.java | 51 ----- jdk/test/demo/jvmti/gctest/BigHello.java | 47 ---- jdk/test/demo/jvmti/gctest/Gctest.java | 51 ----- .../jvmti/heapTracker/HeapTrackerTest.java | 52 ----- .../demo/jvmti/heapViewer/HeapViewerTest.java | 52 ----- jdk/test/demo/jvmti/minst/MinstExample.java | 39 ---- jdk/test/demo/jvmti/minst/MinstTest.java | 52 ----- .../FailsWhenJvmtiVersionDiffers.java | 57 ----- jdk/test/demo/jvmti/waiters/WaitersTest.java | 52 ----- 15 files changed, 1 insertion(+), 963 deletions(-) delete mode 100644 jdk/test/demo/jvmti/Context.java delete mode 100644 jdk/test/demo/jvmti/DemoRun.java delete mode 100644 jdk/test/demo/jvmti/HeapUser.java delete mode 100644 jdk/test/demo/jvmti/Hello.java delete mode 100644 jdk/test/demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java delete mode 100644 jdk/test/demo/jvmti/gctest/BigHello.java delete mode 100644 jdk/test/demo/jvmti/gctest/Gctest.java delete mode 100644 jdk/test/demo/jvmti/heapTracker/HeapTrackerTest.java delete mode 100644 jdk/test/demo/jvmti/heapViewer/HeapViewerTest.java delete mode 100644 jdk/test/demo/jvmti/minst/MinstExample.java delete mode 100644 jdk/test/demo/jvmti/minst/MinstTest.java delete mode 100644 jdk/test/demo/jvmti/versionCheck/FailsWhenJvmtiVersionDiffers.java delete mode 100644 jdk/test/demo/jvmti/waiters/WaitersTest.java diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index c634036a2fd..997cec649cb 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -291,8 +291,6 @@ sun/tools/jstat/jstatClassloadOutput1.sh 8173942 generic- sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java 8057732 generic-all -demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java 8151899 generic-all - ############################################################################ # jdk_other diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups index b4737dae237..2b62b788932 100644 --- a/jdk/test/TEST.groups +++ b/jdk/test/TEST.groups @@ -249,8 +249,7 @@ svc_tools = \ sun/tools \ -sun/tools/java \ -sun/tools/jrunscript \ - sun/jvmstat \ - demo/jvmti + sun/jvmstat jdk_tools = \ :core_tools \ diff --git a/jdk/test/demo/jvmti/Context.java b/jdk/test/demo/jvmti/Context.java deleted file mode 100644 index 2bb822ffbaa..00000000000 --- a/jdk/test/demo/jvmti/Context.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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 - * 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. - */ - - -/* - * - * Sample target application for jvmti demos - * - * java Context [threadCount [iterationCount [sleepContention]]] - * Default: java Context 5 10 0 - * - * threadCount Number of threads - * iterationCount Total turns taken for all threads - * sleepContention Time for main thread to sleep while holding lock - * (creates monitor contention on all other threads) - * - */ - -/* Used to sync up turns and keep track of who's turn it is */ -final class TurnChecker { - int thread_index; - TurnChecker(int thread_index) { - this.thread_index = thread_index; - } -} - -/* Creates a bunch of threads that sequentially take turns */ -public final class Context extends Thread { - /* Used to track threads */ - private static long startTime; - private static TurnChecker turn = new TurnChecker(-1); - private static int total_turns_taken; - - /* Used for each Context thread */ - private final int thread_count; - private final int thread_index; - private final int thread_turns; - - /* Main program */ - public static void main(String[] argv) throws InterruptedException { - int default_thread_count = 5; - int default_thread_turns = 10; - int default_contention_sleep = 0; - int expected_turns_taken; - long sleepTime = 10L; - - /* Override defaults */ - if ( argv.length >= 1 ) { - default_thread_count = Integer.parseInt(argv[0]); - } - if ( argv.length >= 2 ) { - expected_turns_taken = Integer.parseInt(argv[1]); - default_thread_turns = expected_turns_taken/default_thread_count; - } - expected_turns_taken = default_thread_count*default_thread_turns; - if ( argv.length >= 3 ) { - default_contention_sleep = Integer.parseInt(argv[2]); - } - - System.out.println("Context started with " - + default_thread_count + " threads and " - + default_thread_turns + " turns per thread"); - - /* Get all threads running (they will block until we set turn) */ - for (int i = 0; i < default_thread_count; i++) { - new Context(default_thread_count, i, default_thread_turns).start(); - } - - /* Sleep to make sure thread_index 0 make it to the wait call */ - System.out.println("Context sleeping, so threads will start wait"); - Thread.yield(); - Thread.sleep(sleepTime); - - /* Save start time */ - startTime = System.currentTimeMillis(); - - /* This triggers the starting of taking turns */ - synchronized (turn) { - turn.thread_index = 0; - turn.notifyAll(); - } - System.out.println("Context sleeping, so threads can run"); - Thread.yield(); - Thread.sleep(sleepTime); - - /* Wait for threads to finish (after everyone has had their turns) */ - while ( true ) { - boolean done; - done = false; - synchronized (turn) { - if ( total_turns_taken == expected_turns_taken ) { - done = true; - } - /* Create some monitor contention by sleeping with lock */ - if ( default_contention_sleep > 0 ) { - System.out.println("Context sleeping, to create contention"); - Thread.yield(); - Thread.sleep((long)default_contention_sleep); - } - } - if ( done ) - break; - System.out.println("Context sleeping, so threads will complete"); - Thread.sleep(sleepTime); - } - - long endTime = System.currentTimeMillis(); - long totalTime = endTime - startTime; - - System.out.println("Total time (milliseconds): " + totalTime); - System.out.println("Milliseconds per thread: " + - ((double)totalTime / (default_thread_count))); - - System.out.println("Context completed"); - System.exit(0); - } - - /* Thread object to run */ - Context(int thread_count, int thread_index, int thread_turns) { - this.thread_count = thread_count; - this.thread_index = thread_index; - this.thread_turns = thread_turns; - } - - /* Main for thread */ - public void run() { - int next_thread_index = (thread_index + 1) % thread_count; - int turns_taken = 0; - - try { - - /* Loop until we make sure we get all our turns */ - for (int i = 0; i < thread_turns * thread_count; i++) { - synchronized (turn) { - /* Keep waiting for our turn */ - while (turn.thread_index != thread_index) - turn.wait(); - /* MY TURN! Each thread gets thread_turns */ - total_turns_taken++; - turns_taken++; - System.out.println("Turn #" + total_turns_taken - + " taken by thread " + thread_index - + ", " + turns_taken - + " turns taken by this thread"); - /* Give next thread a turn */ - turn.thread_index = next_thread_index; - turn.notifyAll(); - } - /* If we've had all our turns, break out of this loop */ - if (thread_turns == turns_taken) { - System.out.println("Loop end: thread got " + turns_taken - + " turns, expected " + thread_turns); - break; - } - } - } catch (InterruptedException intEx) { - System.out.println("Got an InterruptedException:" + intEx); - /* skip */ - } - - /* Make sure we got all our turns */ - if ( thread_turns != turns_taken ) { - System.out.println("ERROR: thread got " + turns_taken - + " turns, expected " + thread_turns); - System.exit(1); - } - } -} diff --git a/jdk/test/demo/jvmti/DemoRun.java b/jdk/test/demo/jvmti/DemoRun.java deleted file mode 100644 index 1e5f47dd9b3..00000000000 --- a/jdk/test/demo/jvmti/DemoRun.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2004, 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. - */ - - -/* DemoRun: - * - * Support classes for java jvmti demo tests - * - */ - -import java.io.InputStream; -import java.io.IOException; -import java.io.File; -import java.io.BufferedInputStream; -import java.io.PrintStream; - -/* - * Helper class to direct process output to a StringBuffer - */ -class MyInputStream implements Runnable { - private String name; - private BufferedInputStream in; - private StringBuffer buffer; - - /* Create MyInputStream that saves all output to a StringBuffer */ - MyInputStream(String name, InputStream in) { - this.name = name; - this.in = new BufferedInputStream(in); - buffer = new StringBuffer(4096); - Thread thr = new Thread(this); - thr.setDaemon(true); - thr.start(); - } - - /* Dump the buffer */ - void dump(PrintStream x) { - String str = buffer.toString(); - x.println(""); - x.println(str); - x.println(""); - } - - /* Check to see if a pattern is inside the output. */ - boolean contains(String pattern) { - String str = buffer.toString(); - return str.contains(pattern); - } - - /* Runs as a separate thread capturing all output in a StringBuffer */ - public void run() { - try { - byte b[] = new byte[100]; - for (;;) { - int n = in.read(b); - String str; - if (n < 0) { - break; - } - str = new String(b, 0, n); - buffer.append(str); - System.out.print(str); - } - } catch (IOException ioe) { /* skip */ } - } -} - -/* - * Main JVMTI Demo Run class. - */ -public class DemoRun { - - private String demo_name; - private String demo_options; - private MyInputStream output; - private MyInputStream error; - - /* Create a Demo run process */ - public DemoRun(String name, String options) - { - demo_name = name; - demo_options = options; - } - - /* - * Execute a process with an -agentpath or -agentlib command option - */ - public void runit(String class_name) - { - runit(class_name, null); - } - - /* - * Execute a process with an -agentpath or -agentlib command option - * plus any set of other java options. - */ - public void runit(String class_name, String vm_options[]) - { - String sdk_home = System.getProperty("java.home"); - String cdir = System.getProperty("test.classes", "."); - String os_arch = System.getProperty("os.arch"); - String os_name = System.getProperty("os.name"); - String libprefix = os_name.contains("Windows")?"":"lib"; - String libsuffix = os_name.contains("Windows")?".dll": - os_name.contains("OS X")?".dylib":".so"; - String java = sdk_home - + File.separator + "bin" - + File.separator + "java"; - /* Array of strings to be passed in for exec: - * 1. java - * 2. -Dtest.classes=. - * 3. -Xcheck:jni (Just because it finds bugs) - * 4. -Xverify:all (Make sure verification is on full blast) - * 5. -agent - * vm_options - * 6+i. classname - */ - int nvm_options = 0; - if ( vm_options != null ) nvm_options = vm_options.length; - String cmd[] = new String[1 + 7 + nvm_options]; - String cmdLine; - int exitStatus; - int i,j; - - i = 0; - cmdLine = ""; - cmdLine += (cmd[i++] = java); - cmdLine += " "; - cmdLine += (cmd[i++] = "-cp"); - cmdLine += " "; - cmdLine += (cmd[i++] = cdir); - cmdLine += " "; - cmdLine += (cmd[i++] = "-Dtest.classes=" + cdir); - cmdLine += " "; - cmdLine += (cmd[i++] = "-Xcheck:jni"); - cmdLine += " "; - cmdLine += (cmd[i++] = "-Xverify:all"); - String libname = sdk_home - + File.separator + "demo" - + File.separator + "jvmti" - + File.separator + demo_name - + File.separator + "lib" - + File.separator + libprefix + demo_name + libsuffix; - cmdLine += " "; - cmdLine += (cmd[i++] = "-agentpath:" + libname - + (demo_options.equals("") ? "" : ("=" + demo_options))); - /* Add any special VM options */ - for ( j = 0; j < nvm_options; j++ ) { - cmdLine += " "; - cmdLine += (cmd[i++] = vm_options[j]); - } - /* Add classname */ - cmdLine += " "; - cmdLine += (cmd[i++] = class_name); - - /* Begin process */ - Process p; - - System.out.println("Starting: " + cmdLine); - try { - p = Runtime.getRuntime().exec(cmd); - } catch ( IOException e ) { - throw new RuntimeException("Test failed - exec got IO exception"); - } - - /* Save process output in StringBuffers */ - output = new MyInputStream("Input Stream", p.getInputStream()); - error = new MyInputStream("Error Stream", p.getErrorStream()); - - /* Wait for process to complete, and if exit code is non-zero we fail */ - try { - exitStatus = p.waitFor(); - if ( exitStatus != 0) { - System.out.println("Exit code is " + exitStatus); - error.dump(System.out); - output.dump(System.out); - throw new RuntimeException("Test failed - " + - "exit return code non-zero " + - "(exitStatus==" + exitStatus + ")"); - } - } catch ( InterruptedException e ) { - throw new RuntimeException("Test failed - process interrupted"); - } - System.out.println("Completed: " + cmdLine); - } - - /* Does the pattern appear in the output of this process */ - public boolean output_contains(String pattern) - { - return output.contains(pattern) || error.contains(pattern); - } -} diff --git a/jdk/test/demo/jvmti/HeapUser.java b/jdk/test/demo/jvmti/HeapUser.java deleted file mode 100644 index ea99979dd69..00000000000 --- a/jdk/test/demo/jvmti/HeapUser.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - - -/* - * - * Sample target application - * - */ - -class Animal { - int category; - int age; -} - -class Pet extends Animal { - String owner; - String name; - String vet; - String records; - String address; - Pet(String name) { this.name = name; } -} - -class Dog extends Pet { - int breed; - int barks; - Dog(String name) { super(name); } -} - -class Cat extends Pet { - int breed; - int claws; - Cat(String name) { super(name); } -} - -public class HeapUser { - private static Dog dogs[]; - private static Cat cats[]; - public static void main(String args[]) { - System.out.println("HeapUser start, 101 dogs, 1000 cats"); - dogs = new Dog[101]; - for(int i=0; i<101; i++) { - dogs[i] = new Dog("fido " + i); - } - cats = new Cat[1000]; - for(int i=0; i<1000; i++) { - cats[i] = new Cat("feefee " + i); - } - System.out.println("HeapUser end"); - } -} diff --git a/jdk/test/demo/jvmti/Hello.java b/jdk/test/demo/jvmti/Hello.java deleted file mode 100644 index 3161d28b7b9..00000000000 --- a/jdk/test/demo/jvmti/Hello.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - - -/* - * - * Sample target application for jvmti demos - * - */ - -public class Hello { - public static void main(String args[]) { - System.out.println("Hello"); - } -} diff --git a/jdk/test/demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java b/jdk/test/demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java deleted file mode 100644 index c2cb13b174a..00000000000 --- a/jdk/test/demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * 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 6580131 - * @summary Test jvmti demo compiledMethodLoad - * - * @compile ../DemoRun.java ../Hello.java - * @build CompiledMethodLoadTest - * @run main CompiledMethodLoadTest Hello - */ - -public class CompiledMethodLoadTest { - - public static void main(String args[]) throws Exception { - DemoRun demo; - - /* Run demo that uses JVMTI compiledMethodLoad agent (no options) */ - demo = new DemoRun("compiledMethodLoad", "" /* options to compiledMethodLoad */ ); - demo.runit(args[0]); - - /* Make sure patterns in output look ok */ - if (demo.output_contains("ERROR")) { - throw new RuntimeException("Test failed - ERROR seen in output"); - } - - /* Must be a pass. */ - System.out.println("Test passed - cleanly terminated"); - } -} diff --git a/jdk/test/demo/jvmti/gctest/BigHello.java b/jdk/test/demo/jvmti/gctest/BigHello.java deleted file mode 100644 index b08643a5849..00000000000 --- a/jdk/test/demo/jvmti/gctest/BigHello.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - - -/* - * - * Sample target application for gctest demo - * - */ - -public class BigHello { - private final static int NLOOPS = 20000; - private static Object garbage[]; - public static void main(String args[]) { - long count = 0; - System.out.println("Big Hello start"); - for(int i=1; i<=NLOOPS; i++) { - count += i; - garbage = new Object[i]; - garbage[0] = new Object(); - } - System.out.println("Allocated " + count + - " array elements, and " + NLOOPS + - " arrays and Objects."); - System.out.println("Big Hello end"); - } -} diff --git a/jdk/test/demo/jvmti/gctest/Gctest.java b/jdk/test/demo/jvmti/gctest/Gctest.java deleted file mode 100644 index 2683cf2bc89..00000000000 --- a/jdk/test/demo/jvmti/gctest/Gctest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * 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 5027764 - * @summary Test jvmti demo gctest - * - * @compile ../DemoRun.java - * @build BigHello Gctest - * @run main Gctest BigHello - */ - -public class Gctest { - - public static void main(String args[]) throws Exception { - DemoRun demo; - - /* Run demo that uses JVMTI gctest agent (no options) */ - demo = new DemoRun("gctest", "" /* options to gctest */ ); - demo.runit(args[0]); - - /* Make sure patterns in output look ok */ - if (demo.output_contains("ERROR")) { - throw new RuntimeException("Test failed - ERROR seen in output"); - } - - /* Must be a pass. */ - System.out.println("Test passed - cleanly terminated"); - } -} diff --git a/jdk/test/demo/jvmti/heapTracker/HeapTrackerTest.java b/jdk/test/demo/jvmti/heapTracker/HeapTrackerTest.java deleted file mode 100644 index 68c2eb75ff8..00000000000 --- a/jdk/test/demo/jvmti/heapTracker/HeapTrackerTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - * 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 5050116 6299047 - * @summary Test jvmti demo heapTracker - * - * @compile ../DemoRun.java - * @compile ../HeapUser.java - * @build HeapTrackerTest - * @run main HeapTrackerTest HeapUser - */ - -public class HeapTrackerTest { - - public static void main(String args[]) throws Exception { - DemoRun demo; - - /* Run demo that uses JVMTI heapTracker agent (no options) */ - demo = new DemoRun("heapTracker", "" /* options to heapTracker */ ); - demo.runit(args[0]); - - /* Make sure patterns in output look ok */ - if (demo.output_contains("ERROR")) { - throw new RuntimeException("Test failed - ERROR seen in output"); - } - - /* Must be a pass. */ - System.out.println("Test passed - cleanly terminated"); - } -} diff --git a/jdk/test/demo/jvmti/heapViewer/HeapViewerTest.java b/jdk/test/demo/jvmti/heapViewer/HeapViewerTest.java deleted file mode 100644 index a49416a3293..00000000000 --- a/jdk/test/demo/jvmti/heapViewer/HeapViewerTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * 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 5033539 - * @summary Test jvmti demo heapViewer - * - * @compile ../DemoRun.java - * @compile ../HeapUser.java - * @build HeapViewerTest - * @run main HeapViewerTest HeapUser - */ - -public class HeapViewerTest { - - public static void main(String args[]) throws Exception { - DemoRun demo; - - /* Run demo that uses JVMTI heapViewer agent (no options) */ - demo = new DemoRun("heapViewer", "" /* options to heapViewer */ ); - demo.runit(args[0]); - - /* Make sure patterns in output look ok */ - if (demo.output_contains("ERROR")) { - throw new RuntimeException("Test failed - ERROR seen in output"); - } - - /* Must be a pass. */ - System.out.println("Test passed - cleanly terminated"); - } -} diff --git a/jdk/test/demo/jvmti/minst/MinstExample.java b/jdk/test/demo/jvmti/minst/MinstExample.java deleted file mode 100644 index e16decb9ac8..00000000000 --- a/jdk/test/demo/jvmti/minst/MinstExample.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - - -/* MinstExample: - * - */ - -public class MinstExample { - private static int called = 0; - private static void foobar() { - called++; - } - public static void main(String[] args) { - System.out.println("MinstExample started"); - for(int i=0; i<200; i++) foobar(); - System.out.println("MinstExample ended"); - } -} diff --git a/jdk/test/demo/jvmti/minst/MinstTest.java b/jdk/test/demo/jvmti/minst/MinstTest.java deleted file mode 100644 index b40afdf1004..00000000000 --- a/jdk/test/demo/jvmti/minst/MinstTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2006, 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 - * 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 6377205 - * @summary Test jvmti demo minst - * - * @compile ../DemoRun.java - * @compile MinstExample.java - * @build MinstTest - * @run main MinstTest MinstExample - */ - -public class MinstTest { - - public static void main(String args[]) throws Exception { - DemoRun demo; - - /* Run demo that uses JVMTI minst agent (no options) */ - demo = new DemoRun("minst", "exclude=java/*,exclude=javax/*,exclude=com/*,exclude=jdk/*,exclude=sun/*" /* options to minst */ ); - demo.runit(args[0]); - - /* Make sure patterns in output look ok */ - if (demo.output_contains("ERROR")) { - throw new RuntimeException("Test failed - ERROR seen in output"); - } - - /* Must be a pass. */ - System.out.println("Test passed - cleanly terminated"); - } -} diff --git a/jdk/test/demo/jvmti/versionCheck/FailsWhenJvmtiVersionDiffers.java b/jdk/test/demo/jvmti/versionCheck/FailsWhenJvmtiVersionDiffers.java deleted file mode 100644 index d169b938fb0..00000000000 --- a/jdk/test/demo/jvmti/versionCheck/FailsWhenJvmtiVersionDiffers.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * 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 5039613 - * @summary Test jvmti demo versionCheck - * - * @compile ../DemoRun.java ../Hello.java - * @build FailsWhenJvmtiVersionDiffers - * @run main FailsWhenJvmtiVersionDiffers Hello - */ - -public class FailsWhenJvmtiVersionDiffers { - - public static void main(String args[]) throws Exception { - DemoRun demo; - - /* Run demo that uses JVMTI versionCheck agent (no options) */ - demo = new DemoRun("versionCheck", "" /* options to versionCheck */ ); - demo.runit(args[0]); - - /* Make sure patterns in output look ok */ - if (demo.output_contains("ERROR")) { - System.out.println( - "NOTE: The jmvti.h file doesn't match the JVMTI in the VM.\n" - +" This may or may not be a serious issue.\n" - +" Check the jtr file for details.\n" - +" Call your local serviceability representative for help." - ); - throw new RuntimeException("Test failed - ERROR seen in output"); - } - - /* Must be a pass. */ - System.out.println("Test passed - cleanly terminated"); - } -} diff --git a/jdk/test/demo/jvmti/waiters/WaitersTest.java b/jdk/test/demo/jvmti/waiters/WaitersTest.java deleted file mode 100644 index 323615414a7..00000000000 --- a/jdk/test/demo/jvmti/waiters/WaitersTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * 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 5027764 - * @summary Test jvmti demo waiters - * - * @compile ../DemoRun.java - * @compile ../Context.java - * @build WaitersTest - * @run main WaitersTest Context - */ - -public class WaitersTest { - - public static void main(String args[]) throws Exception { - DemoRun demo; - - /* Run demo that uses JVMTI waiters agent (no options) */ - demo = new DemoRun("waiters", "" /* options to waiters */ ); - demo.runit(args[0]); - - /* Make sure patterns in output look ok */ - if (demo.output_contains("ERROR")) { - throw new RuntimeException("Test failed - ERROR seen in output"); - } - - /* Must be a pass. */ - System.out.println("Test passed - cleanly terminated"); - } -} From 4400cbde3ba0bdb734039dfb6e038f2f6aac3233 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Mon, 1 May 2017 07:33:19 -0700 Subject: [PATCH 09/49] 8179415: Update java.management and java.management.rmi to be HTML-5 friendly Reviewed-by: mchung --- .../javax/management/remote/rmi/package.html | 4 +-- .../java/lang/management/LockInfo.java | 11 ++++---- .../lang/management/ManagementFactory.java | 15 ++++++---- .../lang/management/ManagementPermission.java | 5 ++-- .../management/MemoryNotificationInfo.java | 9 +++--- .../lang/management/MemoryPoolMXBean.java | 14 +++++----- .../java/lang/management/MemoryUsage.java | 28 ++++++++++--------- .../java/lang/management/MonitorInfo.java | 9 +++--- .../java/lang/management/RuntimeMXBean.java | 5 ++-- .../java/lang/management/ThreadInfo.java | 20 +++++++------ .../classes/java/lang/management/package.html | 10 +++---- .../classes/javax/management/Descriptor.java | 8 ++++-- .../javax/management/DescriptorKey.java | 8 ++++-- .../javax/management/MBeanPermission.java | 4 +-- .../classes/javax/management/MXBean.java | 25 +++++++++++------ .../modelmbean/ModelMBeanAttributeInfo.java | 3 +- .../modelmbean/ModelMBeanConstructorInfo.java | 3 +- .../management/modelmbean/ModelMBeanInfo.java | 5 ++-- .../ModelMBeanNotificationInfo.java | 3 +- .../modelmbean/ModelMBeanOperationInfo.java | 3 +- .../javax/management/modelmbean/package.html | 2 +- .../javax/management/openmbean/package.html | 2 +- .../remote/JMXConnectionNotification.java | 9 +++--- 23 files changed, 117 insertions(+), 88 deletions(-) diff --git a/jdk/src/java.management.rmi/share/classes/javax/management/remote/rmi/package.html b/jdk/src/java.management.rmi/share/classes/javax/management/remote/rmi/package.html index 9669be24397..fb58ff80547 100644 --- a/jdk/src/java.management.rmi/share/classes/javax/management/remote/rmi/package.html +++ b/jdk/src/java.management.rmi/share/classes/javax/management/remote/rmi/package.html @@ -98,7 +98,7 @@ questions. constructor.

-

Connector addresses generated by the +

Connector addresses generated by the server

If the serviceURL you specify has an empty URL @@ -157,7 +157,7 @@ questions. port.

-

Connector addresses based on directory +

Connector addresses based on directory entries

As an alternative to the generated addresses just described, diff --git a/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java b/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java index 91e5545e387..108b3c9ae59 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java +++ b/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java @@ -34,7 +34,7 @@ import sun.management.LockInfoCompositeData; * an ownable synchronizer, or the {@link Condition Condition} * object associated with synchronizers. *

- * An ownable synchronizer is + * An ownable synchronizer is * a synchronizer that may be exclusively owned by a thread and uses * {@link AbstractOwnableSynchronizer AbstractOwnableSynchronizer} * (or its subclass) to implement its synchronization property. @@ -42,7 +42,7 @@ import sun.management.LockInfoCompositeData; * the read-lock) of {@link ReentrantReadWriteLock ReentrantReadWriteLock} are * two examples of ownable synchronizers provided by the platform. * - *

MXBean Mapping

+ *

MXBean Mapping

* {@code LockInfo} is mapped to a {@link CompositeData CompositeData} * as specified in the {@link #from from} method. * @@ -105,10 +105,11 @@ public class LockInfo { * given {@code CompositeData}. * The given {@code CompositeData} must contain the following attributes: *
- * + *
+ * * - * - * + * + * * * * diff --git a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java index 9a6252add85..90018468ff9 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java +++ b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.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 @@ -67,7 +67,7 @@ import sun.management.spi.PlatformMBeanProvider.PlatformComponent; * the management interface of a component of the Java virtual * machine. * - *

Platform MXBeans

+ *

Platform MXBeans

*

* A platform MXBean is a managed bean that * conforms to the JMX @@ -83,7 +83,7 @@ import sun.management.spi.PlatformMBeanProvider.PlatformComponent; * See * the specification of MXBeans for details. * - * + * *

Each platform MXBean is a {@link PlatformManagedObject} * and it has a unique * {@link javax.management.ObjectName ObjectName} for @@ -141,7 +141,8 @@ import sun.management.spi.PlatformMBeanProvider.PlatformComponent; * interfaces: * *

- *
The attributes and the types the given CompositeData contains
Attribute NameTypeAttribute NameType
className
+ *
+ * * * * @@ -184,7 +185,8 @@ import sun.management.spi.PlatformMBeanProvider.PlatformComponent; * the following management interfaces. * *
- *
The list of Management Interfaces and their single instances
Management InterfaceObjectName
+ *
+ * * * * @@ -201,7 +203,8 @@ import sun.management.spi.PlatformMBeanProvider.PlatformComponent; * A Java virtual machine may have one or more instances of the following * management interfaces. *
- *
The list of Management Interfaces and their single instances
Management InterfaceObjectName
+ *
+ * * * * diff --git a/jdk/src/java.management/share/classes/java/lang/management/ManagementPermission.java b/jdk/src/java.management/share/classes/java/lang/management/ManagementPermission.java index 31d00cf1c7e..8c31a32a707 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/ManagementPermission.java +++ b/jdk/src/java.management/share/classes/java/lang/management/ManagementPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, 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 @@ -34,7 +34,8 @@ package java.lang.management; * provides a summary description of what the permission allows, * and discusses the risks of granting code the permission. * - *
The list of Management Interfaces and their single instances
Management InterfaceObjectName
+ *
+ * * * * diff --git a/jdk/src/java.management/share/classes/java/lang/management/MemoryNotificationInfo.java b/jdk/src/java.management/share/classes/java/lang/management/MemoryNotificationInfo.java index b5a5856794d..881bdcf90b1 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/MemoryNotificationInfo.java +++ b/jdk/src/java.management/share/classes/java/lang/management/MemoryNotificationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 @@ -212,10 +212,11 @@ public class MemoryNotificationInfo { * The given {@code CompositeData} must contain * the following attributes: *
- *
Table shows permission target name, what the permission allows, and associated risks
Permission Target NameWhat the Permission Allows
+ *
+ * * - * - * + * + * * * * diff --git a/jdk/src/java.management/share/classes/java/lang/management/MemoryPoolMXBean.java b/jdk/src/java.management/share/classes/java/lang/management/MemoryPoolMXBean.java index 6a151910397..06158979745 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/MemoryPoolMXBean.java +++ b/jdk/src/java.management/share/classes/java/lang/management/MemoryPoolMXBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, 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 @@ -71,7 +71,7 @@ package java.lang.management; * (only supported by some garbage-collected memory pools) * * - *

1. Memory Usage

+ *

1. Memory Usage

* * The {@link #getUsage} method provides an estimate * of the current usage of a memory pool. @@ -86,14 +86,14 @@ package java.lang.management; * the current memory usage. An implementation should document when * this is the case. * - *

2. Peak Memory Usage

+ *

2. Peak Memory Usage

* * The Java virtual machine maintains the peak memory usage of a memory * pool since the virtual machine was started or the peak was reset. * The peak memory usage is returned by the {@link #getPeakUsage} method * and reset by calling the {@link #resetPeakUsage} method. * - *

3. Usage Threshold

+ *

3. Usage Threshold

* * Each memory pool has a manageable attribute * called the usage threshold which has a default value supplied @@ -141,7 +141,7 @@ package java.lang.management; * threshold notification mechanisms. * *
    - *
  1. Polling + *
  2. Polling *

    * An application can continuously monitor its memory usage * by calling either the {@link #getUsage} method for all @@ -231,7 +231,7 @@ package java.lang.management; * } *


    *
  3. - *
  4. Usage Threshold Notifications + *
  5. Usage Threshold Notifications *

    * Usage threshold notification will be emitted by {@link MemoryMXBean}. * When the Java virtual machine detects that the memory usage of @@ -304,7 +304,7 @@ package java.lang.management; *

  6. *
* - *

4. Collection Usage Threshold

+ *

4. Collection Usage Threshold

* * Collection usage threshold is a manageable attribute only applicable * to some garbage-collected memory pools. diff --git a/jdk/src/java.management/share/classes/java/lang/management/MemoryUsage.java b/jdk/src/java.management/share/classes/java/lang/management/MemoryUsage.java index 39e0019f184..66c78d93042 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/MemoryUsage.java +++ b/jdk/src/java.management/share/classes/java/lang/management/MemoryUsage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, 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 @@ -36,10 +36,11 @@ import sun.management.MemoryUsageCompositeData; * the heap or non-heap memory of the Java virtual machine as a whole. * *

A {@code MemoryUsage} object contains four values: - *

The attributes and the types the given CompositeData contains
Attribute NameTypeAttribute NameType
poolName
+ *
+ * * - * - * + * * * - * - * + * * * - * - * + * * * - * - * + *
Describes the MemoryUsage object content
{@code init} represents the initial amount of memory (in bytes) that + * {@code init} represents the initial amount of memory (in bytes) that * the Java virtual machine requests from the operating system * for memory management during startup. The Java virtual machine * may request additional memory from the operating system and @@ -48,13 +49,13 @@ import sun.management.MemoryUsageCompositeData; *
{@code used} represents the amount of memory currently used (in bytes). + * {@code used} represents the amount of memory currently used (in bytes). *
{@code committed} represents the amount of memory (in bytes) that is + * {@code committed} represents the amount of memory (in bytes) that is * guaranteed to be available for use by the Java virtual machine. * The amount of committed memory may change over time (increase * or decrease). The Java virtual machine may release memory to @@ -64,8 +65,8 @@ import sun.management.MemoryUsageCompositeData; *
{@code max} represents the maximum amount of memory (in bytes) + * {@code max} represents the maximum amount of memory (in bytes) * that can be used for memory management. Its value may be undefined. * The maximum amount of memory may change over time if defined. * The amount of used and committed memory will always be less than @@ -252,10 +253,11 @@ public class MemoryUsage { * must contain the following attributes: * *
- * + *
+ * * - * - * + * + * * * * diff --git a/jdk/src/java.management/share/classes/java/lang/management/MonitorInfo.java b/jdk/src/java.management/share/classes/java/lang/management/MonitorInfo.java index 78601f85072..81b66afd2b4 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/MonitorInfo.java +++ b/jdk/src/java.management/share/classes/java/lang/management/MonitorInfo.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 @@ -106,10 +106,11 @@ public class MonitorInfo extends LockInfo { * * mapped type for the {@link LockInfo} class: *
- *
The attributes and the types the given CompositeData contains
Attribute NameTypeAttribute NameType
init
+ *
+ * * - * - * + * + * * * * diff --git a/jdk/src/java.management/share/classes/java/lang/management/RuntimeMXBean.java b/jdk/src/java.management/share/classes/java/lang/management/RuntimeMXBean.java index 866567a366d..def09b4a00b 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/RuntimeMXBean.java +++ b/jdk/src/java.management/share/classes/java/lang/management/RuntimeMXBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, 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 @@ -312,7 +312,8 @@ public interface RuntimeMXBean extends PlatformManagedObject { * {@link javax.management.openmbean.TabularData TabularData} * with two items in each row as follows: *
- *
The attributes and their types the given CompositeData contains
Attribute NameTypeAttribute NameType
lockedStackFrame
+ *
+ * * * * diff --git a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java index edf758e8731..5cc5861c2d6 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java +++ b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.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 @@ -61,7 +61,7 @@ import static java.lang.Thread.State.*; *
  • Thread priority
  • * * - *

    Synchronization Statistics

    + *

    Synchronization Statistics

    *
      *
    • The number of times that the thread has blocked for * synchronization or waited for notification.
    • @@ -695,10 +695,11 @@ public class ThreadInfo { * The given {@code CompositeData} must contain the following attributes * unless otherwise specified below: *
      - *
    Name and Type for each item
    Item NameItem Type
    + *
    + * * - * - * + * + * * * * @@ -759,16 +760,17 @@ public class ThreadInfo { * * * - * + * *
    The attributes and their types the given CompositeData contains
    Attribute NameTypeAttribute NameType
    threadId{@code java.lang.String}
    stackTracestackTrace{@code javax.management.openmbean.CompositeData[]} *

    * Each element is a {@code CompositeData} representing * StackTraceElement containing the following attributes: *

    - * + *
    + * * - * - * + * + * * * * diff --git a/jdk/src/java.management/share/classes/java/lang/management/package.html b/jdk/src/java.management/share/classes/java/lang/management/package.html index 652253b39bc..67246f00e1e 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/package.html +++ b/jdk/src/java.management/share/classes/java/lang/management/package.html @@ -32,7 +32,7 @@ Java virtual machine and other components in the Java runtime. It allows both local and remote monitoring and management of the running Java virtual machine. -

    Platform MXBean

    +

    Platform MXBean

    A platform MXBean is a managed bean that conforms to the JMX @@ -40,7 +40,7 @@ Instrumentation Specification and only uses a set of basic data types. Each platform MXBean is a {@link java.lang.management.PlatformManagedObject} with a unique {@linkplain java.lang.management.PlatformManagedObject#getObjectName name}. -

    ManagementFactory

    +

    ManagementFactory

    The {@link java.lang.management.ManagementFactory} class is the management factory class for the Java platform. This class provides a set of @@ -58,7 +58,7 @@ the specification of the management interface. This is a single MBeanServer that can be shared by different managed components running within the same Java virtual machine. -

    Interoperability

    +

    Interoperability

    A management application and a platform MBeanServer of a running virtual machine can interoperate @@ -72,7 +72,7 @@ open type when being accessed via MBeanServer interface. See the MXBean specification for details. -

    Ways to Access MXBeans

    +

    Ways to Access MXBeans

    An application can monitor the instrumentation of the Java virtual machine and the runtime in the following ways: @@ -163,7 +163,7 @@ Java virtual machine and the runtime in the following ways: -

    Platform Extension

    +

    Platform Extension

    A Java virtual machine implementation may add its platform extension to the management interface by defining platform-dependent diff --git a/jdk/src/java.management/share/classes/javax/management/Descriptor.java b/jdk/src/java.management/share/classes/javax/management/Descriptor.java index 0b25e34b04f..8945dfb56fe 100644 --- a/jdk/src/java.management/share/classes/javax/management/Descriptor.java +++ b/jdk/src/java.management/share/classes/javax/management/Descriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, 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 @@ -96,7 +96,8 @@ import javax.management.openmbean.OpenType; * of the mapped Java type, called opendata(J) in the MXBean type mapping rules.

    * - *
    The attributes and their types the given CompositeData contains
    Attribute NameTypeAttribute NameType
    moduleName
    + *
    + * * * * @@ -330,7 +331,8 @@ import javax.management.openmbean.OpenType; * interest outside Model MBeans, for example. But only Model MBeans have * a predefined behavior for these fields.

    * - *
    Descriptor Fields
    NameTypeUsed inMeaning
    + *
    + * * * * diff --git a/jdk/src/java.management/share/classes/javax/management/DescriptorKey.java b/jdk/src/java.management/share/classes/javax/management/DescriptorKey.java index 814e234d35c..592cb799f32 100644 --- a/jdk/src/java.management/share/classes/javax/management/DescriptorKey.java +++ b/jdk/src/java.management/share/classes/javax/management/DescriptorKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, 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 @@ -94,7 +94,8 @@ import java.lang.annotation.*; *

    then the resulting {@code Descriptor} will contain the following * fields:

    * - *
    ModelMBean Fields
    NameTypeUsed inMeaning
    + *
    + * * * * @@ -143,7 +144,8 @@ import java.lang.annotation.*; * or an array of annotations. The value of the field is derived from * the value of the annotation element as follows:

    * - *
    Descriptor Fields
    NameValue
    units"bytes"
    descriptionResourceKey"bytes.key"
    + *
    + * * * *
    Descriptor Field Types
    Annotation elementDescriptor field
    Primitive value ({@code 5}, {@code false}, etc)Wrapped value ({@code Integer.valueOf(5)}, diff --git a/jdk/src/java.management/share/classes/javax/management/MBeanPermission.java b/jdk/src/java.management/share/classes/javax/management/MBeanPermission.java index 5aa18b70960..c134ac5ef56 100644 --- a/jdk/src/java.management/share/classes/javax/management/MBeanPermission.java +++ b/jdk/src/java.management/share/classes/javax/management/MBeanPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, 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 @@ -133,7 +133,7 @@ import java.security.Permission; * any value (including another null value) but does not imply any * other value.

    * - *

    The possible actions are these:

    + *

    The possible actions are these:

    * *
      *
    • addNotificationListener
    • diff --git a/jdk/src/java.management/share/classes/javax/management/MXBean.java b/jdk/src/java.management/share/classes/javax/management/MXBean.java index ca5402effda..c69ebe462fe 100644 --- a/jdk/src/java.management/share/classes/javax/management/MXBean.java +++ b/jdk/src/java.management/share/classes/javax/management/MXBean.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 @@ -93,7 +93,8 @@ import javax.management.openmbean.TabularType; Standard MBean concept. Here is how a managed object might be represented as a Standard MBean, and as an MXBean:

      - +
      + @@ -133,7 +134,8 @@ public interface MemoryPoolMXBean {

      So, we might define MemoryUsage like this:

      -
      Standard Bean vs. MXBean
      Standard MBeanMXBean
      +
      + @@ -195,7 +197,8 @@ public class MemoryUsage {

      This becomes clearer if we compare what the clients of the two models might look like:

      -
      Standard Bean vs. MXBean
      Standard MBeanMXBean
      +
      + @@ -232,7 +235,8 @@ String name = (String) managed objects when you know the model beforehand, regardless of whether you are using Standard MBeans or MXBeans:

      -
      Standard Bean vs. MXBean
      Standard MBeanMXBean
      +
      + @@ -265,7 +269,8 @@ long used = usage.getUsed();

      Implementing the MemoryPool object works similarly for both Standard MBeans and MXBeans.

      -
      Standard Bean vs. MXBean
      Standard MBeanMXBean
      +
      + @@ -292,7 +297,8 @@ public class MemoryPool

      Registering the MBean in the MBean Server works in the same way in both cases:

      -
      Standard Bean vs. MXBean
      Standard MBeanMXBean
      +
      + @@ -478,13 +484,14 @@ public class MemoryPool

      The following table summarizes the type mapping rules.

      -
      Standard Bean vs. MXBean
      Standard MBeanMXBean
      +
      + - + diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java index 447273ed9be..ec834ce8e5e 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java @@ -57,7 +57,8 @@ import javax.management.RuntimeOperationsException; * Note that when the Type in this table is Number, a String that is the decimal * representation of a Long can also be used.

      * - *
      Type Mapping Rules
      Java type J opentype(J) opendata(J)
      {@code int}, {@code boolean}, etc
      (the 8 primitive Java types)
      + *
      + * * * * diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java index 9bec078f6f3..cbdd549b13c 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java @@ -58,7 +58,8 @@ import javax.management.RuntimeOperationsException; * Note that when the Type in this table is Number, a String that is the decimal * representation of a Long can also be used.

      * - *
      ModelMBeanAttributeInfo Fields
      NameTypeMeaning
      nameStringAttribute name.
      + *
      + * * * * diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfo.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfo.java index 642cddd3d27..6dd7e2adfb6 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfo.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfo.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 @@ -165,7 +165,8 @@ public interface ModelMBeanInfo * following. Note that when the Type in this table is Number, a String * that is the decimal representation of a Long can also be used.

      * - *
      ModelMBeanConstructorInfo Fields
      NameTypeMeaning
      nameStringConstructor name.
      + *
      + * * * * diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java index 507ba1a34a6..a7545023218 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java @@ -56,7 +56,8 @@ import javax.management.RuntimeOperationsException; * Note that when the Type in this table is Number, a String that is the decimal * representation of a Long can also be used.

      * - *
      ModelMBean Fields
      NameTypeMeaning
      nameStringMBean name.
      + *
      + * * * * diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java index a0541b678f3..123ed9418eb 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java @@ -59,7 +59,8 @@ import javax.management.RuntimeOperationsException; * Note that when the Type in this table is Number, a String that is the decimal * representation of a Long can also be used.

      * - *
      ModelMBeanNotificationInfo Fields
      NameTypeMeaning
      nameStringNotification name.
      + *
      + * * * * diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/package.html b/jdk/src/java.management/share/classes/javax/management/modelmbean/package.html index ddcd3d5545a..6d916044107 100644 --- a/jdk/src/java.management/share/classes/javax/management/modelmbean/package.html +++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/package.html @@ -110,7 +110,7 @@ mbs.invoke(mapName, "get", new Object[] {"key"}, new String[] {Object.class.getN // returns "value" -

      Package Specification

      +

      Package Specification

      • See the JMX 1.4 Specification diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/package.html b/jdk/src/java.management/share/classes/javax/management/openmbean/package.html index 1c852fc4260..36ad2bfece4 100644 --- a/jdk/src/java.management/share/classes/javax/management/openmbean/package.html +++ b/jdk/src/java.management/share/classes/javax/management/openmbean/package.html @@ -77,7 +77,7 @@ questions. describes the items in the CompositeData instances for the attribute.

        -

        Default values and constraints

        +

        Default values and constraints

        In Open MBeans, attributes and parameters can have default values and/or constraints associated with them in the {@code diff --git a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectionNotification.java b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectionNotification.java index 51c233d5411..5bf136430b6 100644 --- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectionNotification.java +++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectionNotification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, 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 @@ -40,11 +40,12 @@ import javax.management.ObjectName; * *

        The notification type is one of the following:

        * - *
      ModelMBeanOperationInfo Fields
      NameTypeMeaning
      nameStringOperation name.
      + *
      + * * * - * - * + * + * * * * From b8116f74c0e6c30389596fa140b169dd3e3fa12b Mon Sep 17 00:00:00 2001 From: Ron Pressler Date: Mon, 1 May 2017 10:43:40 -0700 Subject: [PATCH 10/49] 8177146: MethodHandles.Lookup::bind allows illegal protected access Reviewed-by: psandoz, vlivanov, redestad --- .../java/lang/invoke/MethodHandles.java | 22 +++-- .../invoke/8177146/TestMethodHandleBind.java | 96 +++++++++++++++++++ jdk/test/java/lang/invoke/8177146/pkg/A.java | 40 ++++++++ 3 files changed, 149 insertions(+), 9 deletions(-) create mode 100644 jdk/test/java/lang/invoke/8177146/TestMethodHandleBind.java create mode 100644 jdk/test/java/lang/invoke/8177146/pkg/A.java 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 cb5a398d68d..41b4347c7cf 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 @@ -1691,7 +1691,13 @@ return mh1; public MethodHandle bind(Object receiver, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException { Class refc = receiver.getClass(); // may get NPE MemberName method = resolveOrFail(REF_invokeSpecial, refc, name, type); - MethodHandle mh = getDirectMethodNoRestrict(REF_invokeSpecial, refc, method, findBoundCallerClass(method)); + MethodHandle mh = getDirectMethodNoRestrictInvokeSpecial(refc, method, findBoundCallerClass(method)); + if (!mh.type().leadingReferenceParameter().isAssignableFrom(receiver.getClass())) { + throw new IllegalAccessException("The restricted defining class " + + mh.type().leadingReferenceParameter().getName() + + " is not assignable from receiver class " + + receiver.getClass().getName()); + } return mh.bindArgumentL(0, receiver).setVarargs(method); } @@ -2240,7 +2246,7 @@ return mh1; throw method.makeAccessException("caller class must be a subclass below the method", caller); } MethodType rawType = mh.type(); - if (rawType.parameterType(0) == caller) return mh; + if (caller.isAssignableFrom(rawType.parameterType(0))) return mh; // no need to restrict; already narrow MethodType narrowType = rawType.changeParameterType(0, caller); assert(!mh.isVarargsCollector()); // viewAsType will lose varargs-ness assert(mh.viewAsTypeChecks(narrowType, true)); @@ -2253,11 +2259,11 @@ return mh1; final boolean checkSecurity = true; return getDirectMethodCommon(refKind, refc, method, checkSecurity, doRestrict, callerClass); } - /** Check access and get the requested method, eliding receiver narrowing rules. */ - private MethodHandle getDirectMethodNoRestrict(byte refKind, Class refc, MemberName method, Class callerClass) throws IllegalAccessException { + /** Check access and get the requested method, for invokespecial with no restriction on the application of narrowing rules. */ + private MethodHandle getDirectMethodNoRestrictInvokeSpecial(Class refc, MemberName method, Class callerClass) throws IllegalAccessException { final boolean doRestrict = false; final boolean checkSecurity = true; - return getDirectMethodCommon(refKind, refc, method, checkSecurity, doRestrict, callerClass); + return getDirectMethodCommon(REF_invokeSpecial, refc, method, checkSecurity, doRestrict, callerClass); } /** Check access and get the requested method, eliding security manager checks. */ private MethodHandle getDirectMethodNoSecurityManager(byte refKind, Class refc, MemberName method, Class callerClass) throws IllegalAccessException { @@ -2309,10 +2315,8 @@ return mh1; DirectMethodHandle dmh = DirectMethodHandle.make(refKind, refc, method); MethodHandle mh = dmh; // Optionally narrow the receiver argument to refc using restrictReceiver. - if (doRestrict && - (refKind == REF_invokeSpecial || - (MethodHandleNatives.refKindHasReceiver(refKind) && - restrictProtectedReceiver(method)))) { + if ((doRestrict && refKind == REF_invokeSpecial) || + (MethodHandleNatives.refKindHasReceiver(refKind) && restrictProtectedReceiver(method))) { mh = restrictReceiver(method, dmh, lookupClass()); } mh = maybeBindCaller(method, mh, callerClass); diff --git a/jdk/test/java/lang/invoke/8177146/TestMethodHandleBind.java b/jdk/test/java/lang/invoke/8177146/TestMethodHandleBind.java new file mode 100644 index 00000000000..134cc9f7514 --- /dev/null +++ b/jdk/test/java/lang/invoke/8177146/TestMethodHandleBind.java @@ -0,0 +1,96 @@ +/* + * 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 8177146 + * @run testng/othervm TestMethodHandleBind + */ + +import org.testng.annotations.Test; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodType; + +import static java.lang.invoke.MethodHandles.lookup; + +import static org.testng.Assert.*; + +public class TestMethodHandleBind extends pkg.A { + static class B extends TestMethodHandleBind {} + + @Test + public void testInstanceOfCallerClass() throws Throwable { + MethodHandle bound = lookup().bind(new TestMethodHandleBind() , "m1", MethodType.methodType(String.class)); + String x = (String)bound.invoke(); + assertEquals(x, this.getClass().getSimpleName()); + } + + @Test + public void testInstanceOfCallerSubclass() throws Throwable { + MethodHandle bound = lookup().bind(new B() , "m1", MethodType.methodType(String.class)); + // MethodHandle bound = lookup().findVirtual(B.class, "m1", MethodType.methodType(String.class)).bindTo(new B()); + String x = (String)bound.invoke(); + assertEquals(x, "B"); + } + + @Test + public void testInstanceOfReceiverClass() throws Throwable { + try { + MethodHandle bound = lookup().bind(new pkg.A() , "m1", MethodType.methodType(String.class)); + bound.invoke(); + fail("IllegalAccessException expected"); + } catch (IllegalAccessException e) { + } + } + + @Test + public void testPublicMethod() throws Throwable { + MethodHandle bound = lookup().bind(new pkg.A() , "m2", MethodType.methodType(String.class)); + String x = (String)bound.invoke(); + assertEquals(x, "A"); + } + + @Test + public void testPublicMethod2() throws Throwable { + MethodHandle bound = lookup().bind(new TestMethodHandleBind(), "m2", MethodType.methodType(String.class)); + String x = (String)bound.invoke(); + assertEquals(x, this.getClass().getSimpleName()); + } + + @Test + public void testInstanceOfCallerClassVarargs() throws Throwable { + MethodHandle bound = lookup().bind(new TestMethodHandleBind() , "m3", MethodType.methodType(String.class, String[].class)); + String x = (String)bound.invoke("a", "b", "c"); + assertEquals(x, this.getClass().getSimpleName() + "abc"); + } + + @Test + public void testInstanceOfReceiverClassVarargs() throws Throwable { + try { + MethodHandle bound = lookup().bind(new pkg.A(), "m3", MethodType.methodType(String.class, String[].class)); + bound.invoke(); + fail("IllegalAccessException expected"); + } catch (IllegalAccessException e) { + } + } +} diff --git a/jdk/test/java/lang/invoke/8177146/pkg/A.java b/jdk/test/java/lang/invoke/8177146/pkg/A.java new file mode 100644 index 00000000000..f34d52b8efd --- /dev/null +++ b/jdk/test/java/lang/invoke/8177146/pkg/A.java @@ -0,0 +1,40 @@ +/* + * 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 pkg; + +public class A { + protected String m1() { + return this.getClass().getSimpleName(); + } + + public String m2() { + return this.getClass().getSimpleName(); + } + + protected String m3(String... args) { + StringBuilder sb = new StringBuilder(); + for (String s : args) + sb.append(s); + return this.getClass().getSimpleName() + sb.toString(); + } +} From 0bd3951f5a454cdd6c3419d12f4121fca19f3b8d Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Mon, 1 May 2017 11:16:01 -0700 Subject: [PATCH 11/49] 8167229: Improve VarHandle documentation Reviewed-by: martin, abuckley --- .../java/lang/invoke/MethodHandles.java | 69 ++- .../classes/java/lang/invoke/VarHandle.java | 536 +++++++++--------- 2 files changed, 307 insertions(+), 298 deletions(-) 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 41b4347c7cf..eceba166e24 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 @@ -1447,9 +1447,10 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method } /** - * Produces a VarHandle giving access to non-static fields of type - * {@code T} declared by a receiver class of type {@code R}, supporting - * shape {@code (R : T)}. + * Produces a VarHandle giving access to a non-static field {@code name} + * of type {@code type} declared in a class of type {@code recv}. + * The VarHandle's variable type is {@code type} and it has one + * coordinate type, {@code recv}. *

      * Access checking is performed immediately on behalf of the lookup * class. @@ -1472,7 +1473,7 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method *

      * If the field is declared {@code volatile} then the returned VarHandle * will override access to the field (effectively ignore the - * {@code volatile} declaration) in accordance to it's specified + * {@code volatile} declaration) in accordance to its specified * access modes. *

      * If the field type is {@code float} or {@code double} then numeric @@ -1568,9 +1569,10 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method } /** - * Produces a VarHandle giving access to a static field of type - * {@code T} declared by a given declaring class, supporting shape - * {@code ((empty) : T)}. + * Produces a VarHandle giving access to a static field {@code name} of + * type {@code type} declared in a class of type {@code decl}. + * The VarHandle's variable type is {@code type} and it has no + * coordinate types. *

      * Access checking is performed immediately on behalf of the lookup * class. @@ -1596,7 +1598,7 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method *

      * If the field is declared {@code volatile} then the returned VarHandle * will override access to the field (effectively ignore the - * {@code volatile} declaration) in accordance to it's specified + * {@code volatile} declaration) in accordance to its specified * access modes. *

      * If the field type is {@code float} or {@code double} then numeric @@ -1883,11 +1885,12 @@ return mh1; } /** - * Produces a VarHandle that accesses fields of type {@code T} declared - * by a class of type {@code R}, as described by the given reflected - * field. - * If the field is non-static the VarHandle supports a shape of - * {@code (R : T)}, otherwise supports a shape of {@code ((empty) : T)}. + * Produces a VarHandle giving access to a reflected field {@code f} + * of type {@code T} declared in a class of type {@code R}. + * The VarHandle's variable type is {@code T}. + * If the field is non-static the VarHandle has one coordinate type, + * {@code R}. Otherwise, the field is static, and the VarHandle has no + * coordinate types. *

      * Access checking is performed immediately on behalf of the lookup * class, regardless of the value of the field's {@code accessible} @@ -1915,7 +1918,7 @@ return mh1; *

      * If the field is declared {@code volatile} then the returned VarHandle * will override access to the field (effectively ignore the - * {@code volatile} declaration) in accordance to it's specified + * {@code volatile} declaration) in accordance to its specified * access modes. *

      * If the field type is {@code float} or {@code double} then numeric @@ -2576,9 +2579,11 @@ return mh1; } /** - * - * Produces a VarHandle giving access to elements of an array type - * {@code T[]}, supporting shape {@code (T[], int : T)}. + * Produces a VarHandle giving access to elements of an array of type + * {@code arrayClass}. The VarHandle's variable type is the component type + * of {@code arrayClass} and the list of coordinate types is + * {@code (arrayClass, int)}, where the {@code int} coordinate type + * corresponds to an argument that is an index into an array. *

      * Certain access modes of the returned VarHandle are unsupported under * the following conditions: @@ -2633,13 +2638,14 @@ return mh1; /** * Produces a VarHandle giving access to elements of a {@code byte[]} array * viewed as if it were a different primitive array type, such as - * {@code int[]} or {@code long[]}. The shape of the resulting VarHandle is - * {@code (byte[], int : T)}, where the {@code int} coordinate type - * corresponds to an argument that is an index in a {@code byte[]} array, - * and {@code T} is the component type of the given view array class. The - * returned VarHandle accesses bytes at an index in a {@code byte[]} array, - * composing bytes to or from a value of {@code T} according to the given - * endianness. + * {@code int[]} or {@code long[]}. + * The VarHandle's variable type is the component type of + * {@code viewArrayClass} and the list of coordinate types is + * {@code (byte[], int)}, where the {@code int} coordinate type + * corresponds to an argument that is an index into a {@code byte[]} array. + * The returned VarHandle accesses bytes at an index in a {@code byte[]} + * array, composing bytes to or from a value of the component type of + * {@code viewArrayClass} according to the given endianness. *

      * The supported component types (variables types) are {@code short}, * {@code char}, {@code int}, {@code long}, {@code float} and @@ -2717,13 +2723,14 @@ return mh1; * Produces a VarHandle giving access to elements of a {@code ByteBuffer} * viewed as if it were an array of elements of a different primitive * component type to that of {@code byte}, such as {@code int[]} or - * {@code long[]}. The shape of the resulting VarHandle is - * {@code (ByteBuffer, int : T)}, where the {@code int} coordinate type - * corresponds to an argument that is an index in a {@code ByteBuffer}, and - * {@code T} is the component type of the given view array class. The - * returned VarHandle accesses bytes at an index in a {@code ByteBuffer}, - * composing bytes to or from a value of {@code T} according to the given - * endianness. + * {@code long[]}. + * The VarHandle's variable type is the component type of + * {@code viewArrayClass} and the list of coordinate types is + * {@code (ByteBuffer, int)}, where the {@code int} coordinate type + * corresponds to an argument that is an index into a {@code byte[]} array. + * The returned VarHandle accesses bytes at an index in a + * {@code ByteBuffer}, composing bytes to or from a value of the component + * type of {@code viewArrayClass} according to the given endianness. *

      * The supported component types (variables types) are {@code short}, * {@code char}, {@code int}, {@code long}, {@code float} and diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java index ee0f712635c..9e2533f071e 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java @@ -41,7 +41,7 @@ import static java.lang.invoke.MethodHandleStatics.UNSAFE; import static java.lang.invoke.MethodHandleStatics.newInternalError; /** - * A VarHandle is a dynamically typed reference to a variable, or to a + * A VarHandle is a dynamically strongly typed reference to a variable, or to a * parametrically-defined family of variables, including static fields, * non-static fields, array elements, or components of an off-heap data * structure. Access to such variables is supported under various @@ -53,63 +53,62 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError; * *

      A VarHandle has: *

        - *
      • a {@link #varType variable type}, referred to as {@code T}, which is the - * type of variable(s) referenced by this VarHandle; - *
      • a list of {@link #coordinateTypes coordinate types}, referred to as - * {@code CT}, where the types (primitive and reference) are represented by - * {@link Class} objects). A list of arguments corresponding to instances of - * the coordinate types uniquely locates a variable referenced by this - * VarHandle; and - *
      • a shape, that combines the variable type and coordinate types, - * and is declared with the notation {@code (CT : T)}. An empty list of - * coordinate types is declared as {@code (empty)}. + *
      • a {@link #varType variable type} T, the type of every variable referenced + * by this VarHandle; and + *
      • a list of {@link #coordinateTypes coordinate types} + * {@code CT1, CT2, ..., CTn}, the types of coordinate expressions that + * jointly locate a variable referenced by this VarHandle. *
      + * Variable and coordinate types may be primitive or reference, and are + * represented by {@code Class} objects. The list of coordinate types may be + * empty. * *

      Factory methods that produce or {@link java.lang.invoke.MethodHandles.Lookup - * lookup} VarHandle instances document the supported variable type, coordinate - * types, and shape. + * lookup} VarHandle instances document the supported variable type and the list + * of coordinate types. * - * For example, a VarHandle referencing a non-static field will declare a shape - * of {@code (R : T)}, where {@code R} is the receiver type and - * {@code T} is the field type, and where the VarHandle and an instance of the - * receiver type can be utilized to access the field variable. - * A VarHandle referencing array elements will declare a shape of - * {@code (T[], int : T)}, where {@code T[]} is the array type and {@code T} - * its component type, and where the VarHandle, an instance of the array type, - * and an {@code int} index can be utilized to access an array element variable. + *

      Each access mode is associated with one access mode method, a + * signature polymorphic method named + * for the access mode. When an access mode method is invoked on a VarHandle + * instance, the initial arguments to the invocation are coordinate expressions + * that indicate in precisely which object the variable is to be accessed. + * Trailing arguments to the invocation represent values of importance to the + * access mode. For example, the various compare-and-set or compare-and-exchange + * access modes require two trailing arguments for the variable's expected value + * and new value. * - *

      Each access mode is associated with a - * signature polymorphic method of the - * same name, where the VarHandle shape and access mode uniquely determine the - * canonical {@link #accessModeType(AccessMode) access mode type}, - * which in turn determines the matching constraints on a valid symbolic - * type descriptor at the call site of an access mode's method - * invocation. + *

      The arity and types of arguments to the invocation of an access mode + * method are not checked statically. Instead, each access mode method + * specifies an {@link #accessModeType(AccessMode) access mode type}, + * represented as an instance of {@link MethodType}, that serves as a kind of + * method signature against which the arguments are checked dynamically. An + * access mode type gives formal parameter types in terms of the coordinate + * types of a VarHandle instance and the types for values of importance to the + * access mode. An access mode type also gives a return type, often in terms of + * the variable type of a VarHandle instance. When an access mode method is + * invoked on a VarHandle instance, the symbolic type descriptor at the + * call site, the run time types of arguments to the invocation, and the run + * time type of the return value, must match the types + * given in the access mode type. A runtime exception will be thrown if the + * match fails. * - * As such, VarHandles are dynamically and strongly typed. Their arity, - * argument types, and return type of an access mode method invocation are not - * statically checked. If they, and associated values, do not match the arity - * and types of the access mode's type, an exception will be thrown. - * - * The parameter types of an access mode method type will consist of those that - * are the VarHandles's coordinate types (in order), followed by access mode - * parameter types specific to the access mode. - * - *

      An access mode's method documents the form of its method signature, which - * is derived from the access mode parameter types. The form is declared with - * the notation {@code (CT, P1 p1, P2 p2, ..., PN pn)R}, where {@code CT} is the - * coordinate types (as documented by a VarHandle factory method), {@code P1}, - * {@code P2} and {@code PN} are the first, second and the n'th access mode - * parameters named {@code p1}, {@code p2} and {@code pn} respectively, and - * {@code R} is the return type. - * - * For example, for the generic shape of {@code (CT : T)} the - * {@link #compareAndSet} access mode method documents that its method - * signature is of the form {@code (CT, T expectedValue, T newValue)boolean}, - * where the parameter types named {@code extendedValue} and {@code newValue} - * are the access mode parameter types. If the VarHandle accesses array - * elements with a shape of say {@code (T[], int : T)} then the access mode - * method type is {@code (T[], int, T, T)boolean}. + * For example, the access mode method {@link #compareAndSet} specifies that if + * its receiver is a VarHandle instance with coordinate types + * {@code CT1, ..., CTn} and variable type {@code T}, then its access mode type + * is {@code (CT1 c1, ..., CTn cn, T expectedValue, T newValue)boolean}. + * Suppose that a VarHandle instance can access array elements, and that its + * coordinate types are {@code String[]} and {@code int} while its variable type + * is {@code String}. The access mode type for {@code compareAndSet} on this + * VarHandle instance would be + * {@code (String[] c1, int c2, String expectedValue, String newValue)boolean}. + * Such a VarHandle instance may produced by the + * {@link MethodHandles#arrayElementVarHandle(Class) array factory method} and + * access array elements as follows: + *

       {@code
      + * String[] sa = ...
      + * VarHandle avh = MethodHandles.arrayElementVarHandle(String[].class);
      + * boolean r = avh.compareAndSet(sa, 10, "expected", "new");
      + * }
      * *

      Access modes are grouped into the following categories: *

        @@ -172,10 +171,10 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError; * lookup} VarHandle instances document the set of access modes that are * supported, which may also include documenting restrictions based on the * variable type and whether a variable is read-only. If an access mode is not - * supported then the corresponding signature-polymorphic method will on - * invocation throw an {@code UnsupportedOperationException}. Factory methods - * should document any additional undeclared exceptions that may be thrown by - * access mode methods. + * supported then the corresponding access mode method will on invocation throw + * an {@code UnsupportedOperationException}. Factory methods should document + * any additional undeclared exceptions that may be thrown by access mode + * methods. * The {@link #get get} access mode is supported for all * VarHandle instances and the corresponding method never throws * {@code UnsupportedOperationException}. @@ -215,7 +214,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError; * precise phrasing of the specification of access mode methods and memory fence * methods may accompany future updates of the Java Language Specification. * - *

        Compilation of an access mode's method

        + *

        Compiling invocation of access mode methods

        * A Java method call expression naming an access mode method can invoke a * VarHandle from Java source code. From the viewpoint of source code, these * methods can take any arguments and their polymorphic result (if expressed) @@ -247,7 +246,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError; * except the null reference. * * - *

        Invocation of an access mode's method

        + *

        Performing invocation of access mode methods

        * The first time an {@code invokevirtual} instruction is executed it is linked * by symbolically resolving the names in the instruction and verifying that * the method call is statically legal. This also holds for calls to access mode @@ -264,38 +263,31 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError; * invoking is not present on the individual VarHandle being invoked. * *

        - * Invocation of an access mode's signature-polymorphic method behaves as if an - * invocation of {@link MethodHandle#invoke}, where the receiving method handle - * is bound to a VarHandle instance and the access mode. More specifically, the - * following: + * Invocation of an access mode method behaves as if an invocation of + * {@link MethodHandle#invoke}, where the receiving method handle accepts the + * VarHandle instance as the leading argument. More specifically, the + * following, where {@code {access-mode}} corresponds to the access mode method + * name: *

         {@code
          * VarHandle vh = ..
          * R r = (R) vh.{access-mode}(p1, p2, ..., pN);
          * }
        - * behaves as if (modulo the access mode methods do not declare throwing of - * {@code Throwable}): + * behaves as if: *
         {@code
          * VarHandle vh = ..
        + * VarHandle.AccessMode am = VarHandle.AccessMode.valueFromMethodName("{access-mode}");
          * MethodHandle mh = MethodHandles.varHandleExactInvoker(
        - *                       VarHandle.AccessMode.{access-mode},
        - *                       vh.accessModeType(VarHandle.AccessMode.{access-mode}));
        + *                       am,
        + *                       vh.accessModeType(am));
          *
        - * mh = mh.bindTo(vh);
        - * R r = (R) mh.invoke(p1, p2, ..., pN)
        + * R r = (R) mh.invoke(vh, p1, p2, ..., pN)
          * }
        - * or, more concisely, behaves as if: - *
         {@code
        - * VarHandle vh = ..
        - * MethodHandle mh = vh.toMethodHandle(VarHandle.AccessMode.{access-mode});
        - *
        - * R r = (R) mh.invoke(p1, p2, ..., pN)
        - * }
        - * In terms of equivalent {@code invokevirtual} bytecode behaviour an access - * mode method invocation is equivalent to: + * (modulo access mode methods do not declare throwing of {@code Throwable}). + * This is equivalent to: *
         {@code
          * MethodHandle mh = MethodHandles.lookup().findVirtual(
          *                       VarHandle.class,
        - *                       VarHandle.AccessMode.{access-mode}.methodName(),
        + *                       "{access-mode}",
          *                       MethodType.methodType(R, p1, p2, ..., pN));
          *
          * R r = (R) mh.invokeExact(vh, p1, p2, ..., pN)
        @@ -306,6 +298,17 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
          * widen primitive values, as if by {@link MethodHandle#asType asType} (see also
          * {@link MethodHandles#varHandleInvoker}).
          *
        + * More concisely, such behaviour is equivalent to:
        + * 
         {@code
        + * VarHandle vh = ..
        + * VarHandle.AccessMode am = VarHandle.AccessMode.valueFromMethodName("{access-mode}");
        + * MethodHandle mh = vh.toMethodHandle(am);
        + *
        + * R r = (R) mh.invoke(p1, p2, ..., pN)
        + * }
        + * Where, in this case, the method handle is bound to the VarHandle instance. + * + * *

        Invocation checking

        * In typical programs, VarHandle access mode type matching will usually * succeed. But if a match fails, the JVM will throw a @@ -439,7 +442,7 @@ public abstract class VarHandle { * if the variable was declared non-{@code volatile}. Commonly referred to * as plain read access. * - *

        The method signature is of the form {@code (CT)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn)T}. * *

        The symbolic type descriptor at the call site of {@code get} * must match the access mode type that is the result of calling @@ -449,15 +452,15 @@ public abstract class VarHandle { * throws {@code UnsupportedOperationException}. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT)} + * {@code (CT1 ct1, ..., CTn)} * , statically represented using varargs. * @return the signature-polymorphic result that is the value of the * variable * , statically represented using {@code Object}. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. */ public final native @MethodHandle.PolymorphicSignature @@ -469,21 +472,21 @@ public abstract class VarHandle { * semantics of setting as if the variable was declared non-{@code volatile} * and non-{@code final}. Commonly referred to as plain write access. * - *

        The method signature is of the form {@code (CT, T newValue)void} + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)void} * *

        The symbolic type descriptor at the call site of {@code set} * must match the access mode type that is the result of calling * {@code accessModeType(VarHandle.AccessMode.SET)} on this VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T newValue)} * , statically represented using varargs. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. */ public final native @MethodHandle.PolymorphicSignature @@ -497,7 +500,7 @@ public abstract class VarHandle { * Returns the value of a variable, with memory semantics of reading as if * the variable was declared {@code volatile}. * - *

        The method signature is of the form {@code (CT)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn)T}. * *

        The symbolic type descriptor at the call site of {@code getVolatile} * must match the access mode type that is the result of calling @@ -505,17 +508,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT)} + * {@code (CT1 ct1, ..., CTn ctn)} * , statically represented using varargs. * @return the signature-polymorphic result that is the value of the * variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. */ public final native @MethodHandle.PolymorphicSignature @@ -526,7 +529,7 @@ public abstract class VarHandle { * Sets the value of a variable to the {@code newValue}, with memory * semantics of setting as if the variable was declared {@code volatile}. * - *

        The method signature is of the form {@code (CT, T newValue)void}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)void}. * *

        The symbolic type descriptor at the call site of {@code setVolatile} * must match the access mode type that is the result of calling @@ -538,14 +541,14 @@ public abstract class VarHandle { * memory ordering effects compatible with {@code memory_order_seq_cst}. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T newValue)} * , statically represented using varargs. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. */ public final native @MethodHandle.PolymorphicSignature @@ -557,7 +560,7 @@ public abstract class VarHandle { * Returns the value of a variable, accessed in program order, but with no * assurance of memory ordering effects with respect to other threads. * - *

        The method signature is of the form {@code (CT)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn)T}. * *

        The symbolic type descriptor at the call site of {@code getOpaque} * must match the access mode type that is the result of calling @@ -565,17 +568,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT)} + * {@code (CT1 ct1, ..., CTn ctn)} * , statically represented using varargs. * @return the signature-polymorphic result that is the value of the * variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. */ public final native @MethodHandle.PolymorphicSignature @@ -587,7 +590,7 @@ public abstract class VarHandle { * but with no assurance of memory ordering effects with respect to other * threads. * - *

        The method signature is of the form {@code (CT, T newValue)void}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)void}. * *

        The symbolic type descriptor at the call site of {@code setOpaque} * must match the access mode type that is the result of calling @@ -595,14 +598,14 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T newValue)} * , statically represented using varargs. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. */ public final native @MethodHandle.PolymorphicSignature @@ -616,7 +619,7 @@ public abstract class VarHandle { * Returns the value of a variable, and ensures that subsequent loads and * stores are not reordered before this access. * - *

        The method signature is of the form {@code (CT)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn)T}. * *

        The symbolic type descriptor at the call site of {@code getAcquire} * must match the access mode type that is the result of calling @@ -629,17 +632,17 @@ public abstract class VarHandle { * ordering. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT)} + * {@code (CT1 ct1, ..., CTn ctn)} * , statically represented using varargs. * @return the signature-polymorphic result that is the value of the * variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. */ public final native @MethodHandle.PolymorphicSignature @@ -650,7 +653,7 @@ public abstract class VarHandle { * Sets the value of a variable to the {@code newValue}, and ensures that * prior loads and stores are not reordered after this access. * - *

        The method signature is of the form {@code (CT, T newValue)void}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)void}. * *

        The symbolic type descriptor at the call site of {@code setRelease} * must match the access mode type that is the result of calling @@ -663,14 +666,14 @@ public abstract class VarHandle { * ordering. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T newValue)} * , statically represented using varargs. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. */ public final native @MethodHandle.PolymorphicSignature @@ -687,7 +690,7 @@ public abstract class VarHandle { * {@code expectedValue}, as accessed with the memory semantics of * {@link #getVolatile}. * - *

        The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean}. * *

        The symbolic type descriptor at the call site of {@code * compareAndSet} must match the access mode type that is the result of @@ -695,16 +698,16 @@ public abstract class VarHandle { * this VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T expectedValue, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)} * , statically represented using varargs. * @return {@code true} if successful, otherwise {@code false} if the * witness value was not the same as the {@code expectedValue}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -720,7 +723,7 @@ public abstract class VarHandle { * {@code expectedValue}, as accessed with the memory semantics of * {@link #getVolatile}. * - *

        The method signature is of the form {@code (CT, T expectedValue, T newValue)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)T}. * *

        The symbolic type descriptor at the call site of {@code * compareAndExchange} @@ -729,7 +732,7 @@ public abstract class VarHandle { * on this VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T expectedValue, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)} * , statically represented using varargs. * @return the signature-polymorphic result that is the witness value, which * will be the same as the {@code expectedValue} if successful @@ -755,7 +758,7 @@ public abstract class VarHandle { * {@code expectedValue}, as accessed with the memory semantics of * {@link #getAcquire}. * - *

        The method signature is of the form {@code (CT, T expectedValue, T newValue)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)T}. * *

        The symbolic type descriptor at the call site of {@code * compareAndExchangeAcquire} @@ -764,17 +767,17 @@ public abstract class VarHandle { * this VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T expectedValue, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)} * , statically represented using varargs. * @return the signature-polymorphic result that is the witness value, which * will be the same as the {@code expectedValue} if successful * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #set(Object...) * @see #getAcquire(Object...) */ @@ -790,7 +793,7 @@ public abstract class VarHandle { * {@code expectedValue}, as accessed with the memory semantics of * {@link #get}. * - *

        The method signature is of the form {@code (CT, T expectedValue, T newValue)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)T}. * *

        The symbolic type descriptor at the call site of {@code * compareAndExchangeRelease} @@ -799,17 +802,17 @@ public abstract class VarHandle { * on this VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T expectedValue, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)} * , statically represented using varargs. * @return the signature-polymorphic result that is the witness value, which * will be the same as the {@code expectedValue} if successful * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setRelease(Object...) * @see #get(Object...) */ @@ -830,7 +833,7 @@ public abstract class VarHandle { *

        This operation may fail spuriously (typically, due to memory * contention) even if the witness value does match the expected value. * - *

        The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean}. * *

        The symbolic type descriptor at the call site of {@code * weakCompareAndSetPlain} must match the access mode type that is the result of @@ -838,17 +841,17 @@ public abstract class VarHandle { * on this VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T expectedValue, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)} * , statically represented using varargs. * @return {@code true} if successful, otherwise {@code false} if the * witness value was not the same as the {@code expectedValue} or if this * operation spuriously failed. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #set(Object...) * @see #get(Object...) */ @@ -867,7 +870,7 @@ public abstract class VarHandle { *

        This operation may fail spuriously (typically, due to memory * contention) even if the witness value does match the expected value. * - *

        The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean}. * *

        The symbolic type descriptor at the call site of {@code * weakCompareAndSet} must match the access mode type that is the @@ -875,17 +878,17 @@ public abstract class VarHandle { * on this VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T expectedValue, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)} * , statically represented using varargs. * @return {@code true} if successful, otherwise {@code false} if the * witness value was not the same as the {@code expectedValue} or if this * operation spuriously failed. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -904,7 +907,7 @@ public abstract class VarHandle { *

        This operation may fail spuriously (typically, due to memory * contention) even if the witness value does match the expected value. * - *

        The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean}. * *

        The symbolic type descriptor at the call site of {@code * weakCompareAndSetAcquire} @@ -913,17 +916,17 @@ public abstract class VarHandle { * on this VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T expectedValue, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)} * , statically represented using varargs. * @return {@code true} if successful, otherwise {@code false} if the * witness value was not the same as the {@code expectedValue} or if this * operation spuriously failed. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #set(Object...) * @see #getAcquire(Object...) */ @@ -942,7 +945,7 @@ public abstract class VarHandle { *

        This operation may fail spuriously (typically, due to memory * contention) even if the witness value does match the expected value. * - *

        The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)boolean}. * *

        The symbolic type descriptor at the call site of {@code * weakCompareAndSetRelease} @@ -951,17 +954,17 @@ public abstract class VarHandle { * on this VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T expectedValue, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T expectedValue, T newValue)} * , statically represented using varargs. * @return {@code true} if successful, otherwise {@code false} if the * witness value was not the same as the {@code expectedValue} or if this * operation spuriously failed. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setRelease(Object...) * @see #get(Object...) */ @@ -976,7 +979,7 @@ public abstract class VarHandle { * previous value, as accessed with the memory semantics of * {@link #getVolatile}. * - *

        The method signature is of the form {@code (CT, T newValue)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)T}. * *

        The symbolic type descriptor at the call site of {@code getAndSet} * must match the access mode type that is the result of calling @@ -984,17 +987,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T newValue)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -1009,7 +1012,7 @@ public abstract class VarHandle { * previous value, as accessed with the memory semantics of * {@link #getAcquire}. * - *

        The method signature is of the form {@code (CT, T newValue)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)T}. * *

        The symbolic type descriptor at the call site of {@code getAndSetAcquire} * must match the access mode type that is the result of calling @@ -1017,17 +1020,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T newValue)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -1042,7 +1045,7 @@ public abstract class VarHandle { * previous value, as accessed with the memory semantics of * {@link #get}. * - *

        The method signature is of the form {@code (CT, T newValue)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T newValue)T}. * *

        The symbolic type descriptor at the call site of {@code getAndSetRelease} * must match the access mode type that is the result of calling @@ -1050,17 +1053,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T newValue)} + * {@code (CT1 ct1, ..., CTn ctn, T newValue)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -1078,7 +1081,7 @@ public abstract class VarHandle { * previous value, as accessed with the memory semantics of * {@link #getVolatile}. * - *

        The method signature is of the form {@code (CT, T value)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T value)T}. * *

        The symbolic type descriptor at the call site of {@code getAndAdd} * must match the access mode type that is the result of calling @@ -1086,17 +1089,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T value)} + * {@code (CT1 ct1, ..., CTn ctn, T value)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -1111,7 +1114,7 @@ public abstract class VarHandle { * previous value, as accessed with the memory semantics of * {@link #getAcquire}. * - *

        The method signature is of the form {@code (CT, T value)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T value)T}. * *

        The symbolic type descriptor at the call site of {@code getAndAddAcquire} * must match the access mode type that is the result of calling @@ -1119,17 +1122,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T value)} + * {@code (CT1 ct1, ..., CTn ctn, T value)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -1144,7 +1147,7 @@ public abstract class VarHandle { * previous value, as accessed with the memory semantics of * {@link #get}. * - *

        The method signature is of the form {@code (CT, T value)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T value)T}. * *

        The symbolic type descriptor at the call site of {@code getAndAddRelease} * must match the access mode type that is the result of calling @@ -1152,17 +1155,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T value)} + * {@code (CT1 ct1, ..., CTn ctn, T value)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -1185,7 +1188,7 @@ public abstract class VarHandle { *

        If the variable type is the non-integral {@code boolean} type then a * logical OR is performed instead of a bitwise OR. * - *

        The method signature is of the form {@code (CT, T mask)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T mask)T}. * *

        The symbolic type descriptor at the call site of {@code getAndBitwiseOr} * must match the access mode type that is the result of calling @@ -1193,17 +1196,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T mask)} + * {@code (CT1 ct1, ..., CTn ctn, T mask)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -1222,7 +1225,7 @@ public abstract class VarHandle { *

        If the variable type is the non-integral {@code boolean} type then a * logical OR is performed instead of a bitwise OR. * - *

        The method signature is of the form {@code (CT, T mask)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T mask)T}. * *

        The symbolic type descriptor at the call site of {@code getAndBitwiseOrAcquire} * must match the access mode type that is the result of calling @@ -1230,17 +1233,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T mask)} + * {@code (CT1 ct1, ..., CTn ctn, T mask)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #set(Object...) * @see #getAcquire(Object...) */ @@ -1259,7 +1262,7 @@ public abstract class VarHandle { *

        If the variable type is the non-integral {@code boolean} type then a * logical OR is performed instead of a bitwise OR. * - *

        The method signature is of the form {@code (CT, T mask)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T mask)T}. * *

        The symbolic type descriptor at the call site of {@code getAndBitwiseOrRelease} * must match the access mode type that is the result of calling @@ -1267,17 +1270,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T mask)} + * {@code (CT1 ct1, ..., CTn ctn, T mask)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setRelease(Object...) * @see #get(Object...) */ @@ -1296,7 +1299,7 @@ public abstract class VarHandle { *

        If the variable type is the non-integral {@code boolean} type then a * logical AND is performed instead of a bitwise AND. * - *

        The method signature is of the form {@code (CT, T mask)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T mask)T}. * *

        The symbolic type descriptor at the call site of {@code getAndBitwiseAnd} * must match the access mode type that is the result of calling @@ -1304,17 +1307,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T mask)} + * {@code (CT1 ct1, ..., CTn ctn, T mask)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -1333,7 +1336,7 @@ public abstract class VarHandle { *

        If the variable type is the non-integral {@code boolean} type then a * logical AND is performed instead of a bitwise AND. * - *

        The method signature is of the form {@code (CT, T mask)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T mask)T}. * *

        The symbolic type descriptor at the call site of {@code getAndBitwiseAndAcquire} * must match the access mode type that is the result of calling @@ -1341,17 +1344,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T mask)} + * {@code (CT1 ct1, ..., CTn ctn, T mask)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #set(Object...) * @see #getAcquire(Object...) */ @@ -1370,7 +1373,7 @@ public abstract class VarHandle { *

        If the variable type is the non-integral {@code boolean} type then a * logical AND is performed instead of a bitwise AND. * - *

        The method signature is of the form {@code (CT, T mask)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T mask)T}. * *

        The symbolic type descriptor at the call site of {@code getAndBitwiseAndRelease} * must match the access mode type that is the result of calling @@ -1378,17 +1381,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T mask)} + * {@code (CT1 ct1, ..., CTn ctn, T mask)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setRelease(Object...) * @see #get(Object...) */ @@ -1407,7 +1410,7 @@ public abstract class VarHandle { *

        If the variable type is the non-integral {@code boolean} type then a * logical XOR is performed instead of a bitwise XOR. * - *

        The method signature is of the form {@code (CT, T mask)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T mask)T}. * *

        The symbolic type descriptor at the call site of {@code getAndBitwiseXor} * must match the access mode type that is the result of calling @@ -1415,17 +1418,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T mask)} + * {@code (CT1 ct1, ..., CTn ctn, T mask)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setVolatile(Object...) * @see #getVolatile(Object...) */ @@ -1444,7 +1447,7 @@ public abstract class VarHandle { *

        If the variable type is the non-integral {@code boolean} type then a * logical XOR is performed instead of a bitwise XOR. * - *

        The method signature is of the form {@code (CT, T mask)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T mask)T}. * *

        The symbolic type descriptor at the call site of {@code getAndBitwiseXorAcquire} * must match the access mode type that is the result of calling @@ -1452,17 +1455,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T mask)} + * {@code (CT1 ct1, ..., CTn ctn, T mask)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #set(Object...) * @see #getAcquire(Object...) */ @@ -1481,7 +1484,7 @@ public abstract class VarHandle { *

        If the variable type is the non-integral {@code boolean} type then a * logical XOR is performed instead of a bitwise XOR. * - *

        The method signature is of the form {@code (CT, T mask)T}. + *

        The method signature is of the form {@code (CT1 ct1, ..., CTn ctn, T mask)T}. * *

        The symbolic type descriptor at the call site of {@code getAndBitwiseXorRelease} * must match the access mode type that is the result of calling @@ -1489,17 +1492,17 @@ public abstract class VarHandle { * VarHandle. * * @param args the signature-polymorphic parameter list of the form - * {@code (CT, T mask)} + * {@code (CT1 ct1, ..., CTn ctn, T mask)} * , statically represented using varargs. * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported * for this VarHandle. - * @throws WrongMethodTypeException if the access mode type is not - * compatible with the caller's symbolic type descriptor. - * @throws ClassCastException if the access mode type is compatible with the - * caller's symbolic type descriptor, but a reference cast fails. + * @throws WrongMethodTypeException if the access mode type does not + * match the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type matches the caller's + * symbolic type descriptor, but a reference cast fails. * @see #setRelease(Object...) * @see #get(Object...) */ @@ -1790,7 +1793,7 @@ public abstract class VarHandle { /** * Returns the {@code VarHandle} signature-polymorphic method name - * associated with this {@code AccessMode} value + * associated with this {@code AccessMode} value. * * @return the signature-polymorphic method name * @see #valueFromMethodName @@ -1861,14 +1864,13 @@ public abstract class VarHandle { } /** - * Obtains the canonical access mode type for this VarHandle and a given - * access mode. + * Obtains the access mode type for this VarHandle and a given access mode. * *

        The access mode type's parameter types will consist of a prefix that * is the coordinate types of this VarHandle followed by further - * types as defined by the access mode's method. + * types as defined by the access mode method. * The access mode type's return type is defined by the return type of the - * access mode's method. + * access mode method. * * @param accessMode the access mode, corresponding to the * signature-polymorphic method of the same name @@ -1891,7 +1893,7 @@ public abstract class VarHandle { * *

        The return of a {@code false} value for a given access mode indicates * that an {@code UnsupportedOperationException} is thrown on invocation - * of the corresponding access mode's signature-polymorphic method. + * of the corresponding access mode method. * * @param accessMode the access mode, corresponding to the * signature-polymorphic method of the same name @@ -1908,7 +1910,7 @@ public abstract class VarHandle { * * @apiNote This method, for a VarHandle {@code vh} and access mode * {@code {access-mode}}, returns a method handle that is equivalent to - * method handle {@code bhm} in the following code (though it may be more + * method handle {@code bmh} in the following code (though it may be more * efficient): *

        {@code
              * MethodHandle mh = MethodHandles.varHandleExactInvoker(
        
        From 1e4314a63825346b18c0c9a6540d585176bbf812 Mon Sep 17 00:00:00 2001
        From: Doug Simon 
        Date: Fri, 28 Apr 2017 12:22:53 -0700
        Subject: [PATCH 12/49] 8179434:
         test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java fails due
         to JDK-8177845
        
        Reviewed-by: mchung
        ---
         .../lang/Class/getDeclaredField/FieldSetAccessibleTest.java | 6 +++++-
         1 file changed, 5 insertions(+), 1 deletion(-)
        
        diff --git a/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java b/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java
        index 6f8c336cf5f..d39dc6c9cac 100644
        --- a/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java
        +++ b/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java
        @@ -286,7 +286,11 @@ public class FieldSetAccessibleTest {
                  * Filter deployment modules
                  */
                 static Set systemModules() {
        -            Set mods = Set.of("javafx.deploy", "jdk.deploy", "jdk.plugin", "jdk.javaws");
        +            Set mods = Set.of("javafx.deploy", "jdk.deploy", "jdk.plugin", "jdk.javaws",
        +                // All JVMCI packages other than jdk.vm.ci.services are dynamically
        +                // exported to jdk.internal.vm.compiler and jdk.aot
        +                "jdk.internal.vm.compiler", "jdk.aot"
        +            );
                     return ModuleFinder.ofSystem().findAll().stream()
                                        .map(mref -> mref.descriptor().name())
                                        .filter(mn -> !mods.contains(mn))
        
        From 9fe1a3b3e05036a8d018c5116324b7390c9a8450 Mon Sep 17 00:00:00 2001
        From: Semyon Sadetsky 
        Date: Mon, 1 May 2017 10:24:07 -0700
        Subject: [PATCH 13/49] 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 ea8aed80d340b1bb4c1502bf3e5e67e5dc2ed627 Mon Sep 17 00:00:00 2001
        From: Mark Sheppard 
        Date: Tue, 2 May 2017 15:50:46 +0100
        Subject: [PATCH 14/49] 8179512: Typo in HttpURLConnection documentation
        
        Reviewed-by: chegar
        ---
         jdk/src/java.base/share/classes/java/net/HttpURLConnection.java | 2 +-
         1 file changed, 1 insertion(+), 1 deletion(-)
        
        diff --git a/jdk/src/java.base/share/classes/java/net/HttpURLConnection.java b/jdk/src/java.base/share/classes/java/net/HttpURLConnection.java
        index 9e428e59584..448034e6225 100644
        --- a/jdk/src/java.base/share/classes/java/net/HttpURLConnection.java
        +++ b/jdk/src/java.base/share/classes/java/net/HttpURLConnection.java
        @@ -54,7 +54,7 @@ import java.util.Date;
          * Security permissions
          * 

        * If a security manager is installed, and if a method is called which results in an - * attempt to open a connection, the caller must possess either:- + * attempt to open a connection, the caller must possess either: *

        • a "connect" {@link SocketPermission} to the host/port combination of the * destination URL or
        • *
        • a {@link URLPermission} that permits this request.
        • From 0eb6c339c348b9ab90d18719b2c6bab219800a85 Mon Sep 17 00:00:00 2001 From: Bradford Wetmore Date: Tue, 2 May 2017 10:34:22 -0700 Subject: [PATCH 15/49] 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 16/49] 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 17/49] 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 48c6f05cf3e9eb70aabb4cb651d5a043e253ce85 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 3 May 2017 08:46:45 +0200 Subject: [PATCH 18/49] 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 19/49] 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. * - *
      JMXConnectionNotification Types
      TypeMeaningTypeMeaning
      + *
      + * * * * 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 20/49] 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 6aff2d0db6f574cd321d56fdfb3a82cc1a023c5b Mon Sep 17 00:00:00 2001 From: John Jiang Date: Wed, 3 May 2017 21:15:07 -0700 Subject: [PATCH 21/49] 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 4c0e26e374b2ab6320b70cb39c6ad865c8bd9644 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Thu, 4 May 2017 07:26:55 +0000 Subject: [PATCH 22/49] 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 29/49] 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 429e4ac085d2cea8d4056520414304e547011dc8 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Mon, 8 May 2017 21:21:39 -0700 Subject: [PATCH 30/49] 8020801: Apply the restriction of invoking MethodHandles.lookup to j.l.r.Method.invoke Reviewed-by: plevart, psandoz --- .../java/lang/invoke/MethodHandles.java | 34 ++++---- .../internal/reflect/ReflectionFactory.java | 25 ++++++ .../invoke/lookup/ReflectiveLookupTest.java | 79 +++++++++++++++++++ .../java.base/java/lang/LookupTest.java | 72 +++++++++++++++++ 4 files changed, 192 insertions(+), 18 deletions(-) create mode 100644 jdk/test/java/lang/invoke/lookup/ReflectiveLookupTest.java create mode 100644 jdk/test/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java 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 47e5aeacb65..ae40f169ff2 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 @@ -112,6 +112,19 @@ public class MethodHandles { return new Lookup(Reflection.getCallerClass()); } + /** + * This reflected$lookup method is the alternate implementation of + * the lookup method when being invoked by reflection. + */ + @CallerSensitive + private static Lookup reflected$lookup() { + Class caller = Reflection.getCallerClass(); + if (caller.getClassLoader() == null) { + throw newIllegalArgumentException("illegal lookupClass: "+caller); + } + return new Lookup(caller); + } + /** * Returns a {@link Lookup lookup object} which is trusted minimally. * The lookup has the {@code PUBLIC} and {@code UNCONDITIONAL} modes. @@ -747,7 +760,7 @@ public class MethodHandles { Lookup(Class 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 97df63049cf4266cd508cd4ff186e60b3ce66c4f Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 9 May 2017 12:57:30 +0200 Subject: [PATCH 31/49] 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 @@ - javax.sql.rowset Package - + Standard interfaces and base classes for JDBC RowSet @@ -48,7 +48,7 @@ that a standard RowSet implementation either implements or extends.

      • 5.0 Related Documentation -

        1.0 Package Specification

        +

        1.0 Package Specification

        This package specifies five standard JDBC RowSet interfaces. All five extend the RowSet interface described in the JDBC 3.0 @@ -63,7 +63,7 @@ developers who intend to provide their own compliant RowSet impleme should pay particular attention to the assertions detailed in specification interfaces. -

        2.0 Standard RowSet Definitions

        +

        2.0 Standard RowSet Definitions

        • JdbcRowSet - A wrapper around a ResultSet object that makes it possible to use the result set as a @@ -136,7 +136,7 @@ column matches, a JoinRowSet object establishes relationships betwe RowSet instances without the need to touch the originating data source.
        -

        3.0 Implementer's Guide

        +

        3.0 Implementer's Guide

        Compliant implementations of JDBC RowSet Implementations must follow the assertions described in this specification. In accordance with the terms of the Java Community Process, a @@ -173,47 +173,40 @@ the BaseRowSet class as a basis for their implementations. The following table illustrates the features that the BaseRowSet abstract class provides.
        - +
        + + + + + + + - - - - - - + +the standard RowSet properties. - - + +by compliant implementations. - - + + - - + +
        Features in BaseRowSet
        FeatureDetails
        Feature
        -
        Details
        -
        Properties
        -
        Provides standard JavaBeans property manipulation + PropertiesProvides standard JavaBeans property manipulation mechanisms to allow applications to get and set RowSet command and property values. Refer to the documentation of the javax.sql.RowSet interface (available in the JDBC 3.0 specification) for more details on -the standard RowSet properties.
        -
        Event notification
        -
        Provides standard JavaBeans event notifications + Event notificationProvides standard JavaBeans event notifications to registered event listeners. Refer to the documentation of javax.sql.RowSetEvent interface (available in the JDBC 3.0 specification) for more details on how to register and handle standard RowSet events generated -by compliant implementations.
        -
        Setters for a RowSet object's command
        -
        Provides a complete set of setter methods - for setting RowSet command parameters.
        -
        Setters for a RowSet object's commandProvides a complete set of setter methods + for setting RowSet command parameters.
        Streams
        -
        Provides fields for storing of stream instances - in addition to providing a set of constants for stream type designation.
        -
        StreamsProvides fields for storing of stream instances + in addition to providing a set of constants for stream type designation.
        @@ -289,13 +282,13 @@ match column as a basis for adding the RowSet object.
      • -

        4.0 Related Specifications

        +

        4.0 Related Specifications

        -

        5.0 Related Documentation

        +

        5.0 Related Documentation

        • JDBC RowSet Tutorial diff --git a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html index b5aada863b4..3c3dbc5eec1 100644 --- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html +++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html @@ -1,5 +1,5 @@ - - + +