changeset 51888:8b02303915bc

Merge
author coleenp
date Wed, 26 Sep 2018 14:56:10 -0400
parents 32161fbea3fe bdf62f266de4
children 76a3e8be46e6
files
diffstat 9 files changed, 834 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/util/Arrays.java	Wed Sep 26 14:01:48 2018 -0400
+++ b/src/java.base/share/classes/java/util/Arrays.java	Wed Sep 26 14:56:10 2018 -0400
@@ -28,6 +28,7 @@
 import jdk.internal.HotSpotIntrinsicCandidate;
 import jdk.internal.util.ArraysSupport;
 
+import java.io.Serializable;
 import java.lang.reflect.Array;
 import java.util.concurrent.ForkJoinPool;
 import java.util.function.BinaryOperator;
@@ -4288,21 +4289,41 @@
     // Misc
 
     /**
-     * Returns a fixed-size list backed by the specified array.  (Changes to
-     * the returned list "write through" to the array.)  This method acts
-     * as bridge between array-based and collection-based APIs, in
-     * combination with {@link Collection#toArray}.  The returned list is
-     * serializable and implements {@link RandomAccess}.
+     * Returns a fixed-size list backed by the specified array. Changes made to
+     * the array will be visible in the returned list, and changes made to the
+     * list will be visible in the array. The returned list is
+     * {@link Serializable} and implements {@link RandomAccess}.
+     *
+     * <p>The returned list implements the optional {@code Collection} methods, except
+     * those that would change the size of the returned list. Those methods leave
+     * the list unchanged and throw {@link UnsupportedOperationException}.
+     *
+     * @apiNote
+     * This method acts as bridge between array-based and collection-based
+     * APIs, in combination with {@link Collection#toArray}.
+     *
+     * <p>This method provides a way to wrap an existing array:
+     * <pre>{@code
+     *     Integer[] numbers = ...
+     *     ...
+     *     List<Integer> values = Arrays.asList(numbers);
+     * }</pre>
      *
      * <p>This method also provides a convenient way to create a fixed-size
      * list initialized to contain several elements:
-     * <pre>
-     *     List&lt;String&gt; stooges = Arrays.asList("Larry", "Moe", "Curly");
-     * </pre>
+     * <pre>{@code
+     *     List<String> stooges = Arrays.asList("Larry", "Moe", "Curly");
+     * }</pre>
+     *
+     * <p><em>The list returned by this method is modifiable.</em>
+     * To create an unmodifiable list, use
+     * {@link Collections#unmodifiableList Collections.unmodifiableList}
+     * or <a href="List.html#unmodifiable">Unmodifiable Lists</a>.
      *
      * @param <T> the class of the objects in the array
      * @param a the array by which the list will be backed
      * @return a list view of the specified array
+     * @throws NullPointerException if the specified array is {@code null}
      */
     @SafeVarargs
     @SuppressWarnings("varargs")
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java	Wed Sep 26 14:01:48 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java	Wed Sep 26 14:56:10 2018 -0400
@@ -50,6 +50,9 @@
 import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.security.CodeSigner;
+import java.security.CodeSource;
+import java.security.ProtectionDomain;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -182,7 +185,7 @@
     public void run(String[] runtimeArgs, String[] args) throws Fault, InvocationTargetException {
         Path file = getFile(args);
 
-        Context context = new Context();
+        Context context = new Context(file.toAbsolutePath());
         String mainClassName = compile(file, getJavacOpts(runtimeArgs), context);
 
         String[] appArgs = Arrays.copyOfRange(args, 1, args.length);
@@ -193,7 +196,7 @@
      * Returns the path for the filename found in the first of an array of arguments.
      *
      * @param args the array
-     * @return the path
+     * @return the path, as given in the array of args
      * @throws Fault if there is a problem determining the path, or if the file does not exist
      */
     private Path getFile(String[] args) throws Fault {
@@ -478,14 +481,19 @@
      * a class loader.
      */
     private static class Context {
-        private Map<String, byte[]> inMemoryClasses = new HashMap<>();
+        private final Path file;
+        private final Map<String, byte[]> inMemoryClasses = new HashMap<>();
+
+        Context(Path file) {
+            this.file = file;
+        }
 
         JavaFileManager getFileManager(StandardJavaFileManager delegate) {
             return new MemoryFileManager(inMemoryClasses, delegate);
         }
 
         ClassLoader getClassLoader(ClassLoader parent) {
-            return new MemoryClassLoader(inMemoryClasses, parent);
+            return new MemoryClassLoader(inMemoryClasses, parent, file);
         }
     }
 
@@ -546,9 +554,22 @@
          */
         private final Map<String, byte[]> sourceFileClasses;
 
-        MemoryClassLoader(Map<String, byte[]> sourceFileClasses, ClassLoader parent) {
+        /**
+         * A minimal protection domain, specifying a code source of the source file itself,
+         * used for classes found in the source file and defined by this loader.
+         */
+        private final ProtectionDomain domain;
+
+        MemoryClassLoader(Map<String, byte[]> sourceFileClasses, ClassLoader parent, Path file) {
             super(parent);
             this.sourceFileClasses = sourceFileClasses;
+            CodeSource codeSource;
+            try {
+                codeSource = new CodeSource(file.toUri().toURL(), (CodeSigner[]) null);
+            } catch (MalformedURLException e) {
+                codeSource = null;
+            }
+            domain = new ProtectionDomain(codeSource, null, this, null);
         }
 
         /**
@@ -632,7 +653,7 @@
             if (bytes == null) {
                 throw new ClassNotFoundException(name);
             }
-            return defineClass(name, bytes, 0, bytes.length);
+            return defineClass(name, bytes, 0, bytes.length, domain);
         }
 
         @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/SwingSet/src/FrameDemoTest.java	Wed Sep 26 14:56:10 2018 -0400
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * 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 static com.sun.swingset3.demos.frame.FrameDemo.BUSY_CHECKBOX;
+import static com.sun.swingset3.demos.frame.FrameDemo.CONTENT_LABEL;
+import static com.sun.swingset3.demos.frame.FrameDemo.CONTENT_LABEL_COLOR;
+import static com.sun.swingset3.demos.frame.FrameDemo.CONTENT_LABEL_SIZE;
+import static com.sun.swingset3.demos.frame.FrameDemo.DEMO_TITLE;
+import static com.sun.swingset3.demos.frame.FrameDemo.INTERNAL_FRAME;
+import static com.sun.swingset3.demos.frame.FrameDemo.MENU;
+import static com.sun.swingset3.demos.frame.FrameDemo.MENU_ITEM1;
+import static com.sun.swingset3.demos.frame.FrameDemo.MENU_ITEM2;
+import static com.sun.swingset3.demos.frame.FrameDemo.SHOW_BUTTON;
+import static com.sun.swingset3.demos.frame.FrameDemo.STATUS_LABEL;
+import static com.sun.swingset3.demos.frame.FrameDemo.STATUS_LABEL_BORDER;
+import static com.sun.swingset3.demos.frame.FrameDemo.STATUS_LABEL_HOR_ALIGNMENT;
+import static com.sun.swingset3.demos.frame.FrameDemo.TOOLBAR_BUTTON;
+import static org.jemmy2ext.JemmyExt.EXACT_STRING_COMPARATOR;
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Point;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.UIManager;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
+
+import org.jtregext.GuiTestListener;
+import org.netbeans.jemmy.ClassReference;
+import org.netbeans.jemmy.ComponentChooser;
+import org.netbeans.jemmy.WindowWaiter;
+import org.netbeans.jemmy.operators.ComponentOperator;
+import org.netbeans.jemmy.operators.FrameOperator;
+import org.netbeans.jemmy.operators.JButtonOperator;
+import org.netbeans.jemmy.operators.JCheckBoxOperator;
+import org.netbeans.jemmy.operators.JFrameOperator;
+import org.netbeans.jemmy.operators.JLabelOperator;
+import org.netbeans.jemmy.operators.JMenuBarOperator;
+import org.netbeans.jemmy.operators.JMenuItemOperator;
+import org.netbeans.jemmy.operators.JMenuOperator;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
+import com.sun.swingset3.demos.frame.FrameDemo;
+
+/*
+ * @test
+ * @key headful
+ * @summary Verifies SwingSet3 FrameDemo page by checking the different actions
+ *  on the frame, properties and different actions on subcomponents of frame
+ *  and control panel actions by checking and unchecking the busy check box and
+ *  pressing the show button.
+ *
+ * @library /sanity/client/lib/jemmy/src
+ * @library /sanity/client/lib/Extensions/src
+ * @library /sanity/client/lib/SwingSet3/src
+ * @modules java.desktop
+ *          java.logging
+ * @build org.jemmy2ext.JemmyExt
+ * @build com.sun.swingset3.demos.frame.FrameDemo
+ * @run testng FrameDemoTest
+ */
+@Listeners(GuiTestListener.class)
+public class FrameDemoTest {
+
+    private final static Dimension NEW_SIZE = new Dimension(500, 500);
+    private final static Point NEW_LOCATION = new Point(200, 200);
+    private final static int NUMBER_OF_MENUS = 1;
+    private final static int NUMBER_OF_MENU_ITEMS = 2;
+    private final static int MAX_NUMBER_OF_FRAMES = 1;
+    private final static int DELAY_AFTER_SHOW_BUTTON_PRESS = 500;
+
+    /**
+     * Testing the different actions on the frame, properties and different
+     * actions on subcomponents of the frame and control panel action by
+     * checking and unchecking the busy check box and pressing the show button.
+     *
+     * @throws Exception
+     */
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
+        new ClassReference(FrameDemo.class.getCanonicalName()).startApplication();
+
+        JFrameOperator masterFrameOperator = new JFrameOperator(DEMO_TITLE);
+        masterFrameOperator.setComparator(EXACT_STRING_COMPARATOR);
+
+        JFrameOperator internalFrameOperator = new JFrameOperator(INTERNAL_FRAME);
+        internalFrameOperator.setComparator(EXACT_STRING_COMPARATOR);
+        internalFrameOperator.setVerification(true);
+        internalFrameOperator.waitComponentVisible(true);
+
+        checkSubComponents(internalFrameOperator);
+        checkFrameActions(internalFrameOperator);
+        checkControlPanelActions(masterFrameOperator, internalFrameOperator);
+    }
+
+    /**
+     * Verifying the status of added components to the frame
+     * @param internalFrameOperator
+     */
+    private void checkSubComponents(JFrameOperator internalFrameOperator) {
+        // Verifying the properties of added button to the frame
+        JButtonOperator buttonOperator =
+                new JButtonOperator(internalFrameOperator, TOOLBAR_BUTTON);
+        AtomicBoolean buttonActionStatus = new AtomicBoolean(false);
+        buttonOperator.addActionListener(event -> buttonActionStatus.set(true));
+        buttonOperator.push();
+        buttonOperator.waitStateOnQueue(comp -> buttonActionStatus.get());
+
+        // Verifying the properties of added labels to the frame
+        JLabelOperator contentLabelOperator =
+                new JLabelOperator(internalFrameOperator, CONTENT_LABEL);
+        contentLabelOperator.waitStateOnQueue(comp
+                -> CONTENT_LABEL_SIZE.equals(comp.getSize()));
+        contentLabelOperator.waitStateOnQueue(comp
+                -> CONTENT_LABEL_COLOR.equals(comp.getBackground()));
+        JLabelOperator statusLabelOperator =
+                new JLabelOperator(internalFrameOperator, STATUS_LABEL);
+        statusLabelOperator.waitStateOnQueue(comp
+                -> STATUS_LABEL_BORDER.equals(((JLabel)comp).getBorder()));
+        statusLabelOperator.waitStateOnQueue((component) -> STATUS_LABEL_HOR_ALIGNMENT
+                == ((JLabel)component).getHorizontalAlignment());
+
+        // Verifying the properties of added menu to the frame
+        JMenuBarOperator menuBarOperator = new JMenuBarOperator(internalFrameOperator);
+        menuBarOperator.waitStateOnQueue(comp -> NUMBER_OF_MENUS
+                == ((JMenuBar)comp).getMenuCount());
+        JMenuOperator menuOperator = new JMenuOperator(internalFrameOperator, MENU);
+        menuOperator.waitStateOnQueue(comp -> NUMBER_OF_MENU_ITEMS
+                == ((JMenu)comp).getMenuComponentCount());
+        AtomicBoolean menuActionStatus = new AtomicBoolean(false);
+        addMenuListener(menuOperator, menuActionStatus);
+        menuOperator.push();
+        menuOperator.waitStateOnQueue(comp -> menuActionStatus.get());
+
+        // Verifying the properties of the menu items
+        checkMenuItem((JMenuItem) menuOperator.getMenuComponent(0), MENU_ITEM1);
+        checkMenuItem((JMenuItem) menuOperator.getMenuComponent(1), MENU_ITEM2);
+    }
+
+    /**
+     * Verifying different actions on the frame
+     * @param internalFrameOperator
+     */
+    private void checkFrameActions(JFrameOperator internalFrameOperator)
+            throws InterruptedException {
+        // Verifying the maximized status
+        internalFrameOperator.maximize();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
+        internalFrameOperator.demaximize();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
+
+        // Verifying the iconified status
+        internalFrameOperator.iconify();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
+        internalFrameOperator.deiconify();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
+
+        // Verifying the resize of the frame
+        TestHelpers.checkChangeSize(internalFrameOperator, NEW_SIZE);
+
+        // Verifying the change of location of the frame
+        TestHelpers.checkChangeLocation(internalFrameOperator, NEW_LOCATION);
+    }
+
+    /**
+     * Verifying control panel actions on the frame
+     * @param masterFrameOprator
+     * @param internalFrameOperator
+     * @throws InterruptedException
+     */
+    private void checkControlPanelActions(JFrameOperator masterFrameOprator,
+            JFrameOperator internalFrameOperator) throws InterruptedException {
+        // Verifying the visibility and number of frames after pressing Show Button
+        internalFrameOperator.requestClose();
+        internalFrameOperator.waitClosed();
+        JButtonOperator showButtonOperator = new JButtonOperator(masterFrameOprator, SHOW_BUTTON);
+        showButtonOperator.push();
+        internalFrameOperator.waitComponentVisible(true);
+        showButtonOperator.push();
+        showButtonOperator.push();
+        Thread.sleep(DELAY_AFTER_SHOW_BUTTON_PRESS);
+        int count = WindowWaiter.countWindows(masterFrameOprator.getOwner(),
+                new FrameOperator.FrameFinder(new ComponentChooser() {
+
+            @Override
+            public String getDescription() {
+                return "frames with name != " + DEMO_TITLE;
+            }
+
+            @Override
+            public boolean checkComponent(Component comp) {
+                return comp.isShowing()
+                        && ((Frame) comp).getTitle() != DEMO_TITLE;
+            }
+        }));
+        assertEquals("Number of frames after clicking Show Button two times"
+                + " validation failed,", MAX_NUMBER_OF_FRAMES, count);
+
+        // Verifying the visibility and cursor type after selecting busy check box
+        JCheckBoxOperator busyCheckBoxOperator =
+                new JCheckBoxOperator(masterFrameOprator, BUSY_CHECKBOX);
+        busyCheckBoxOperator.setVerification(true);
+        checkBusyCheckBox(internalFrameOperator, busyCheckBoxOperator, true);
+        internalFrameOperator.waitStateOnQueue(comp -> Cursor.WAIT_CURSOR
+                == internalFrameOperator.getGlassPane().getCursor().getType());
+
+        checkBusyCheckBox(internalFrameOperator, busyCheckBoxOperator, false);
+        internalFrameOperator.waitStateOnQueue(comp -> Cursor.DEFAULT_CURSOR
+                == internalFrameOperator.getCursor().getType());
+    }
+
+    private void checkBusyCheckBox(JFrameOperator internalFrameOperator,
+            JCheckBoxOperator busyCheckBoxOperator, boolean isSelect) {
+        busyCheckBoxOperator.changeSelection(isSelect);
+        new ComponentOperator(internalFrameOperator.
+                getGlassPane()).waitComponentVisible(isSelect);
+    }
+
+    /**
+     * Verifying the properties of the menu item
+     * @param menuItem : menu item component
+     * @param menuExpectedName : expected menu item name/text
+     */
+    private void checkMenuItem(JMenuItem menuItem, String menuExpectedName) {
+        JMenuItemOperator menuItemOperator = new JMenuItemOperator(menuItem);
+        AtomicBoolean menuItemActionStatus = new AtomicBoolean(false);
+        menuItemOperator.addActionListener(event -> menuItemActionStatus.set(true));
+        menuItemOperator.waitStateOnQueue((component)
+                -> menuExpectedName.equals(((JMenuItem)component).getText()));
+        menuItemOperator.push();
+        menuItemOperator.waitStateOnQueue(comp -> menuItemActionStatus.get());
+    }
+
+    /**
+     * Add menu listener to the operator
+     * @param menuOperator : JMenuOperator on which menu listener has to be added
+     * @param menuActionStatus : menu action status variable
+     */
+    private void addMenuListener(JMenuOperator menuOperator,
+            AtomicBoolean menuActionStatus) {
+        menuOperator.addMenuListener(new MenuListener() {
+
+            @Override
+            public void menuSelected(MenuEvent e) {
+                menuActionStatus.set(true);
+            }
+
+            @Override
+            public void menuDeselected(MenuEvent e) {
+            }
+
+            @Override
+            public void menuCanceled(MenuEvent e) {
+            }
+        });
+    }
+
+}
\ No newline at end of file
--- a/test/jdk/sanity/client/SwingSet/src/InternalFrameDemoTest.java	Wed Sep 26 14:01:48 2018 -0400
+++ b/test/jdk/sanity/client/SwingSet/src/InternalFrameDemoTest.java	Wed Sep 26 14:56:10 2018 -0400
@@ -138,6 +138,9 @@
                 orignalSize.height - PARENT_FRAME_NEW_SIZE_DELTA);
         parentFrameOperator.resize(newSize.width, newSize.height);
         parentFrameOperator.waitComponentSize(newSize);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
         // keeping some delay before checking the internal frame property
         // as it is a negative scenario
         Thread.sleep(DELAY);
@@ -145,26 +148,41 @@
         // Resizing parent frame back to original size
         parentFrameOperator.resize(orignalSize.width, orignalSize.height);
         parentFrameOperator.waitComponentSize(orignalSize);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
 
         // Iconifying the parent frame and verifying the iconified status of the internal
         // frame(it should not be iconified)
         parentFrameOperator.iconify();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
         // keeping some delay before checking the internal frame property
         // as it is a negative scenario
         Thread.sleep(DELAY);
         assertFalse("Internal Frame should not be iconified when parent frame"
                 + " alone is iconified.", internalFrameOperator.isIcon());
         parentFrameOperator.deiconify();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
 
         // Maximizing the parent frame and verifying the maximized status of the internal
         // frame(it should not be maximized)
         parentFrameOperator.maximize();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
         // keeping some delay before checking the internal frame property
         // as it is a negative scenario
         Thread.sleep(DELAY);
         assertFalse("Internal Frame should not be maximized when parent frame"
                 + " alone is maximized.", internalFrameOperator.isMaximum());
         parentFrameOperator.demaximize();
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
 
         // Relocating the parent frame and verifying the location of the internal
         // frame(it should not be changed the location)
@@ -173,6 +191,9 @@
                 (orignalLocation.y + PARENT_FRAME_NEW_LOCATION_DELTA));
         parentFrameOperator.move(newLocation.x, newLocation.y);
         parentFrameOperator.waitComponentLocation(newLocation);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
         // keeping some delay before checking the internal frame property
         // as it is a negative scenario
         Thread.sleep(DELAY);
@@ -180,15 +201,19 @@
         // Moving back parent frame to original location
         parentFrameOperator.move(orignalLocation.x, orignalLocation.y);
         parentFrameOperator.waitComponentLocation(orignalLocation);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        TestHelpers.delayBetweenFrameStateChange();
     }
 
     /**
      * Verifying different actions on the internal frame.
      *
      * @param internalFrameOperator : internal fame operator
+     * @throws InterruptedException
      */
-    private void checkInternalFrameAction(
-            JInternalFrameOperator internalFrameOperator) {
+    private void checkInternalFrameAction(JInternalFrameOperator
+            internalFrameOperator) throws InterruptedException {
         // Verifying maximize and demaximize actions
         internalFrameOperator.waitStateOnQueue(comp
                 -> ((JInternalFrame)comp).isMaximizable());
--- a/test/jdk/sanity/client/SwingSet/src/TestHelpers.java	Wed Sep 26 14:01:48 2018 -0400
+++ b/test/jdk/sanity/client/SwingSet/src/TestHelpers.java	Wed Sep 26 14:56:10 2018 -0400
@@ -1,16 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * 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.awt.Dimension;
 import java.awt.Point;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.channels.FileChannel;
-import java.nio.file.Path;
+
 import javax.swing.UIManager;
+
 import org.netbeans.jemmy.operators.ComponentOperator;
 import org.testng.annotations.DataProvider;
 
 public class TestHelpers {
 
+    public static final long DELAY_BTWN_FRAME_STATE_CHANGE = 2000;
+
     /**
      * A DataProvider having the class name of all the available look and feels
      *
@@ -29,21 +51,40 @@
     }
 
     public static void checkChangeLocation(ComponentOperator component,
-            Point finalLocation) {
+            Point finalLocation) throws InterruptedException {
         Point initialLocation = component.getLocation();
         component.setLocation(finalLocation);
         component.waitComponentLocation(finalLocation);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        delayBetweenFrameStateChange();
         component.setLocation(initialLocation);
         component.waitComponentLocation(initialLocation);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        delayBetweenFrameStateChange();
     }
 
     public static void checkChangeSize(ComponentOperator component,
-            Dimension dimensionFinal) {
+            Dimension dimensionFinal) throws InterruptedException {
         Dimension dimensionInitial = component.getSize();
         component.setSize(dimensionFinal);
         component.waitComponentSize(dimensionFinal);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        delayBetweenFrameStateChange();
         component.setSize(dimensionInitial);
         component.waitComponentSize(dimensionInitial);
+        // TODO This is a workaround for JDK-8210638, this delay has to remove
+        // after fixing this bug, this is an unstable code.
+        delayBetweenFrameStateChange();
     }
 
-}
+    // TODO This is a workaround for JDK-8210638, this delay has to remove
+    // after fixing this bug, this is an unstable code.
+    public static void delayBetweenFrameStateChange()
+            throws InterruptedException {
+        Thread.sleep(DELAY_BTWN_FRAME_STATE_CHANGE);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/frame/BusyGlass.java	Wed Sep 26 14:56:10 2018 -0400
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * 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.sun.swingset3.demos.frame;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Graphics;
+import javax.swing.JPanel;
+
+/**
+ * GlassPane component which can be set on toplevel
+ * containers to makes those containers "busy" be disabling input.
+ *
+ * Example usage:
+ * <pre><code>
+ *    // Install glasspane
+ *    frame.setGlassPane(new BusyGlass());
+ *
+ *    // Make frame busy
+ *    frame.getGlassPane().setVisible(true);
+ * </code></pre>
+ *
+ * Caution: A well-written client should rarely need to make
+ * a window "busy" because the app should be as responsive as possible;
+ * long-winded operations should be off-loaded to non-GUI threads
+ * whenever possible.
+ *
+ * @author aim
+ */
+//<snip>Make toplevel "busy"
+public class BusyGlass extends JPanel {
+
+    /**
+     * Create GlassPane component to block input on toplevel
+     */
+    public BusyGlass() {
+        setLayout(new BorderLayout());
+        setVisible(false); //initially invisible
+        setOpaque(false);
+        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+    }
+
+    protected void paintComponent(Graphics g) {
+        // Render partially opaque to 'veil' the frame's contents so
+        // that the user has visual feedback that the components
+        // arn't responsive.
+        Color bgColor = getBackground();
+        g.setColor(new Color(bgColor.getRed(),
+                bgColor.getGreen(),
+                bgColor.getBlue(), 150));
+        g.fillRect(0, 0, getWidth(), getHeight());
+    }
+}
+//</snip>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/frame/FrameDemo.java	Wed Sep 26 14:56:10 2018 -0400
@@ -0,0 +1,272 @@
+/*
+* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+* 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.sun.swingset3.demos.frame;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+
+import javax.imageio.ImageIO;
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JPanel;
+import javax.swing.JToolBar;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import com.sun.swingset3.DemoProperties;
+import com.sun.swingset3.demos.DemoUtilities;
+
+/**
+* Demo for Swing's JFrame toplevel component.
+*
+* @author aim
+*/
+@DemoProperties(
+value = "JFrame Demo",
+category = "Toplevel Containers",
+description = "Demonstrates JFrame, Swing's top-level primary window container.",
+sourceFiles = {
+"com/sun/swingset3/demos/frame/BusyGlass.java",
+"com/sun/swingset3/demos/frame/FrameDemo.java",
+"com/sun/swingset3/demos/DemoUtilities.java",
+"com/sun/swingset3/demos/frame/resources/FrameDemo.html",
+"com/sun/swingset3/demos/frame/resources/images/FrameDemo.gif"
+}
+)
+public class FrameDemo extends JPanel {
+
+public static final String DEMO_TITLE = FrameDemo.class.getAnnotation(DemoProperties.class).value();
+public static final String INTERNAL_FRAME = "Demo JFrame";
+public static final String MENU = "File";
+public static final String MENU_ITEM1 = "Open";
+public static final String MENU_ITEM2 = "Save";
+public static final String TOOLBAR = "Toolbar";
+public static final String TOOLBAR_BUTTON = "Toolbar Button";
+public static final String CONTENT_LABEL = "I'm content but a little blue.";
+public static final String STATUS_LABEL = "I show status.";
+public static final String SHOW_BUTTON = "Show JFrame...";
+public static final String BUSY_CHECKBOX = "Frame busy";
+public static final Dimension CONTENT_LABEL_SIZE = new Dimension(300, 160);
+public static final Color CONTENT_LABEL_COLOR = new Color(197, 216, 236);
+public static final int STATUS_LABEL_HOR_ALIGNMENT = JLabel.LEADING;
+public static final EmptyBorder STATUS_LABEL_BORDER = new EmptyBorder(4, 4, 4, 4);
+
+//<snip>Ensure system menubar is used on Mac OSX
+static {
+// Property must be set *early* due to Apple Bug#3909714
+// ignored on other platforms
+if (System.getProperty("os.name").equals("Mac OS X")) {
+System.setProperty("apple.laf.useScreenMenuBar", "true");
+}
+}
+//</snip>
+
+// Toplevel frame component
+private JFrame frame;
+
+private JComponent frameSpaceholder;
+
+public FrameDemo() {
+initComponents();
+}
+
+protected void initComponents() {
+frame = createFrame();
+
+setLayout(new BorderLayout());
+add(createControlPanel(), BorderLayout.WEST);
+frameSpaceholder = createFrameSpaceholder(frame);
+add(frameSpaceholder, BorderLayout.CENTER);
+}
+
+protected JComponent createControlPanel() {
+Box controlPanel = Box.createVerticalBox();
+controlPanel.setBorder(new EmptyBorder(8, 8, 8, 8));
+
+// Create button to control visibility of frame
+JButton showButton = new JButton(SHOW_BUTTON);
+showButton.addActionListener(new ShowActionListener());
+controlPanel.add(showButton);
+
+// Create checkbox to control busy state of frame
+JCheckBox busyCheckBox = new JCheckBox(BUSY_CHECKBOX);
+busyCheckBox.setSelected(false);
+busyCheckBox.addChangeListener(new BusyChangeListener());
+controlPanel.add(busyCheckBox);
+
+return controlPanel;
+}
+
+private static JComponent createFrameSpaceholder(JFrame frame) {
+JPanel framePlaceholder = new JPanel();
+Dimension prefSize = frame.getPreferredSize();
+prefSize.width += 12;
+prefSize.height += 12;
+framePlaceholder.setPreferredSize(prefSize);
+
+return framePlaceholder;
+}
+
+private static JFrame createFrame() {
+
+//<snip>Create frame and set simple properties
+JFrame frame = new JFrame(INTERNAL_FRAME);
+frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
+//</snip>
+
+//<snip>Set Minimized/titlebar icon Image
+//Note: How the image is used is platform-dependent
+Image iconImage = null;
+try {
+// todo: swingingduke.gif doesn't exist
+URL imageURL = FrameDemo.class.getResource("resources/images/swingingduke.gif");
+iconImage = ImageIO.read(imageURL);
+} catch (Exception e) {
+// handle image IO exception
+}
+frame.setIconImage(iconImage);
+//</snip>
+
+//<snip>Make toplevel "busy"
+// busy glasspane is initially invisible
+frame.setGlassPane(new BusyGlass());
+//</snip>
+
+//<snip>Add a menubar
+JMenuBar menubar = new JMenuBar();
+frame.setJMenuBar(menubar);
+JMenu menu = new JMenu(MENU);
+menubar.add(menu);
+menu.add(MENU_ITEM1);
+menu.add(MENU_ITEM2);
+//</snip>
+
+//<snip>Add a horizontal toolbar
+JToolBar toolbar = new JToolBar(TOOLBAR);
+frame.add(toolbar, BorderLayout.NORTH);
+toolbar.add(new JButton(TOOLBAR_BUTTON));
+//</snip>
+
+//<snip>Add the content area
+JLabel label = new JLabel(CONTENT_LABEL);
+label.setHorizontalAlignment(JLabel.CENTER);
+label.setPreferredSize(CONTENT_LABEL_SIZE);
+label.setBackground(CONTENT_LABEL_COLOR);
+label.setOpaque(true); // labels non-opaque by default
+frame.add(label);
+//snip
+
+//<snip>Add a statusbar
+JLabel statusLabel = new JLabel(STATUS_LABEL);
+statusLabel.setBorder(STATUS_LABEL_BORDER);
+statusLabel.setHorizontalAlignment(STATUS_LABEL_HOR_ALIGNMENT);
+frame.add(statusLabel, BorderLayout.SOUTH);
+//</snip>
+
+//<snip>Initialize frame's size to fit it's content
+frame.pack();
+//</snip>
+
+return frame;
+}
+
+public void start() {
+DemoUtilities.setToplevelLocation(frame, frameSpaceholder, SwingConstants.CENTER);
+showFrame();
+}
+
+public void stop() {
+//<snip>Hide frame
+frame.setVisible(false);
+//</snip>
+}
+
+public void showFrame() {
+//<snip>Show frame
+// if frame already visible, then bring to the front
+if (frame.isShowing()) {
+frame.toFront();
+} else {
+frame.setVisible(true);
+}
+//</snip>
+}
+
+//<snip>Make toplevel "busy"
+public void setFrameBusy(boolean busy) {
+frame.getGlassPane().setVisible(busy);
+// Must explicitly disable the menubar because on OSX it will be
+// in the system menubar and not covered by the glasspane
+frame.getJMenuBar().setEnabled(!busy);
+}
+
+public boolean isFrameBusy() {
+return frame.getGlassPane().isVisible();
+}
+//</snip
+
+// remind(aim): replace with Beans binding
+
+private class ShowActionListener implements ActionListener {
+public void actionPerformed(ActionEvent actionEvent) {
+showFrame();
+}
+}
+
+private class BusyChangeListener implements ChangeListener {
+public void stateChanged(ChangeEvent changeEvent) {
+JCheckBox busyCheckBox = (JCheckBox) changeEvent.getSource();
+setFrameBusy(busyCheckBox.isSelected());
+showFrame(); // bring frame back to front for demo purposes
+}
+}
+
+public static void main(String args[]) {
+EventQueue.invokeLater(new Runnable() {
+public void run() {
+JFrame frame = new JFrame(DEMO_TITLE);
+FrameDemo demo = new FrameDemo();
+frame.add(demo);
+frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+frame.pack();
+frame.setVisible(true);
+demo.start();
+}
+});
+}
+}
Binary file test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/frame/resources/images/FrameDemo.gif has changed
--- a/test/langtools/tools/javac/launcher/SourceLauncherTest.java	Wed Sep 26 14:01:48 2018 -0400
+++ b/test/langtools/tools/javac/launcher/SourceLauncherTest.java	Wed Sep 26 14:56:10 2018 -0400
@@ -192,6 +192,64 @@
         checkEqual("stdout", log.trim(), "Hello World! [1, 2, 3]");
     }
 
+    @Test
+    public void testCodeSource(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "import java.net.URL;\n" +
+            "class ShowCodeSource {\n" +
+            "    public static void main(String... args) {\n" +
+            "        URL u = ShowCodeSource.class.getProtectionDomain().getCodeSource().getLocation();\n" +
+            "        System.out.println(u);\n" +
+            "    }\n" +
+            "}");
+
+        Path file = base.resolve("ShowCodeSource.java");
+        String log = new JavaTask(tb)
+                .className(file.toString())
+                .run(Task.Expect.SUCCESS)
+                .getOutput(Task.OutputKind.STDOUT);
+        checkEqual("stdout", log.trim(), file.toAbsolutePath().toUri().toURL().toString());
+    }
+
+    @Test
+    public void testPermissions(Path base) throws IOException {
+        Path policyFile = base.resolve("test.policy");
+        Path sourceFile = base.resolve("TestPermissions.java");
+
+        tb.writeFile(policyFile,
+            "grant codeBase \"jrt:/jdk.compiler\" {\n" +
+            "    permission java.security.AllPermission;\n" +
+            "};\n" +
+            "grant codeBase \"" + sourceFile.toUri().toURL() + "\" {\n" +
+            "    permission java.util.PropertyPermission \"user.dir\", \"read\";\n" +
+            "};\n");
+
+        tb.writeJavaFiles(base,
+            "import java.net.URL;\n" +
+            "class TestPermissions {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(\"user.dir=\" + System.getProperty(\"user.dir\"));\n" +
+            "        try {\n" +
+            "            System.setProperty(\"user.dir\", \"\");\n" +
+            "            System.out.println(\"no exception\");\n" +
+            "            System.exit(1);\n" +
+            "        } catch (SecurityException e) {\n" +
+            "            System.out.println(\"exception: \" + e);\n" +
+            "        }\n" +
+            "    }\n" +
+            "}");
+
+        String log = new JavaTask(tb)
+                .vmOptions("-Djava.security.manager", "-Djava.security.policy=" + policyFile)
+                .className(sourceFile.toString())
+                .run(Task.Expect.SUCCESS)
+                .getOutput(Task.OutputKind.STDOUT);
+        checkEqual("stdout", log.trim().replace(tb.lineSeparator, "\n"),
+                "user.dir=" + System.getProperty("user.dir") + "\n" +
+                "exception: java.security.AccessControlException: " +
+                    "access denied (\"java.util.PropertyPermission\" \"user.dir\" \"write\")");
+    }
+
     void testSuccess(Path file, String expect) throws IOException {
         Result r = run(file, Collections.emptyList(), List.of("1", "2", "3"));
         checkEqual("stdout", r.stdOut, expect);