changeset 60080:55985ba51fa8 sealed-types

Summary: Fix sealed types class redefinition test Reviewed-by: vromero
author hseigel
date Tue, 18 Feb 2020 18:00:40 +0000
parents 61dc64ca3023
children 40865a85217a dc8ed953f851
files test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostA/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostA/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostAB/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostAB/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABC/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABC/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABCD/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABD/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostAC/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostACB/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostB/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostBA/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostBAC/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostBCA/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostCAB/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostCBA/redef/Host.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/TestPermittedSubtypesAttr.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/classFour.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/classOne.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/classThree.java test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/classTwo.java
diffstat 21 files changed, 119 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostA/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostA/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Class {
+public sealed class Host permits classOne {
     public static String getID() { return "HostA/Host.java";}
     public int m() {
         return 1; // original class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostA/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostA/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Class {
+public sealed class Host permits classOne {
     public static String getID() { return "HostA/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostAB/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostAB/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Class,java.lang.Object {
+public sealed class Host permits classOne,classTwo {
     public static String getID() { return "HostAB/Host.java";}
     public int m() {
         return 1; // original class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostAB/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostAB/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Class,java.lang.Object {
+public sealed class Host permits classOne,classTwo {
     public static String getID() { return "HostAB/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABC/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABC/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Class,java.lang.Object,java.lang.String {
+public sealed class Host permits classOne,classTwo,classThree {
     public static String getID() { return "HostABC/Host.java";}
     public int m() {
         return 1; // original class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABC/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABC/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Class,java.lang.Object,java.lang.String {
+public sealed class Host permits classOne,classTwo,classThree {
     public static String getID() { return "HostABC/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABCD/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABCD/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Class,java.lang.Object,java.lang.String,java.lang.System {
+public sealed class Host permits classOne,classTwo,classThree,classFour {
     public static String getID() { return "HostABCD/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABD/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostABD/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Class,java.lang.Object,java.lang.System {
+public sealed class Host permits classOne,classTwo,classFour {
     public static String getID() { return "HostABD/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostAC/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostAC/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Class,java.lang.String {
+public sealed class Host permits classOne,classThree {
     public static String getID() { return "HostAC/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostACB/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostACB/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Class,java.lang.String,java.lang.Object {
+public sealed class Host permits classOne,classThree,classTwo {
     public static String getID() { return "HostACB/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostB/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostB/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Object {
+public sealed class Host permits classTwo {
     public static String getID() { return "HostB/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostBA/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostBA/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Object,java.lang.Class {
+public sealed class Host permits classTwo,classOne {
     public static String getID() { return "HostBA/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostBAC/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostBAC/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Object,java.lang.Class,java.lang.String {
+public sealed class Host permits classTwo,classOne,classThree {
     public static String getID() { return "HostBAC/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostBCA/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostBCA/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.Object,java.lang.String,java.lang.Class {
+public sealed class Host permits classTwo,classThree,classOne {
     public static String getID() { return "HostBCA/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostCAB/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostCAB/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.String,java.lang.Class,java.lang.Object {
+public sealed class Host permits classThree,classOne,classTwo {
     public static String getID() { return "HostCAB/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostCBA/redef/Host.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/HostCBA/redef/Host.java	Tue Feb 18 18:00:40 2020 +0000
@@ -21,7 +21,7 @@
  * questions.
  */
 
-public sealed class Host permits java.lang.String,java.lang.Object,java.lang.Class {
+public sealed class Host permits classThree,classTwo,classOne {
     public static String getID() { return "HostCBA/redef/Host.java"; }
     public int m() {
         return 2; // redefined class
--- a/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/TestPermittedSubtypesAttr.java	Fri Feb 14 16:23:52 2020 -0800
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/TestPermittedSubtypesAttr.java	Tue Feb 18 18:00:40 2020 +0000
@@ -33,7 +33,7 @@
  *          java.instrument
  * @compile ../NamedBuffer.java
  * @run main RedefineClassHelper
- * @compile --enable-preview --source ${jdk.version} Host/Host.java
+ * @compile --enable-preview --source ${jdk.version} Host/Host.java classOne.java classTwo.java classThree.java classFour.java
  * @compile --enable-preview --source ${jdk.version} TestPermittedSubtypesAttr.java
  * @run main/othervm -javaagent:redefineagent.jar --enable-preview -Xlog:redefine+class+sealed=trace TestPermittedSubtypesAttr Host
  * @compile --enable-preview --source ${jdk.version} HostA/Host.java
@@ -47,14 +47,13 @@
 /* Test Description
 
 The basic test class is called Host and we have variants that have zero or more
-permitted subtypes java.lang.Class, java.lang.Object, java.lang.String, and
-java.lang.System.  Each variant of Host is defined in source code in its own
-directory i.e.
+permitted subtypes classOne, classTwo, classThree, and classFour. Each variant
+of Host is defined in source code in its own directory i.e.
 
 Host/Host.java defines zero permitted classes
-Sealed type HostA/Host.java permits java.lang.Class.
-Sealed HostAB/Host.java permits java.lang.Class and java.lang.Object (in that order)
-Sealed HostABC/Host.java permits java.lang.Class, java.lang.Object, and java.lang.String (in that order)
+Sealed type HostA/Host.java permits classOne
+Sealed HostAB/Host.java permits classOne and classTwo (in that order)
+Sealed HostABC/Host.java permits classOne, classTwo, and classThree (in that order)
 etc.
 
 Each Host class has the form:
@@ -266,6 +265,7 @@
         CompilerUtils.compile(src.toPath(),
                               dst.toPath(),
                               false /* don't recurse */,
+                              "-classpath", DEST,
                               "--enable-preview",
                               "--source", VERSION);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/classFour.java	Tue Feb 18 18:00:40 2020 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+final public class classFour extends Host { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/classOne.java	Tue Feb 18 18:00:40 2020 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+final public class classOne extends Host { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/classThree.java	Tue Feb 18 18:00:40 2020 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+final public class classThree extends Host { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/instrument/RedefinePermittedSubtypesAttr/classTwo.java	Tue Feb 18 18:00:40 2020 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+final public class classTwo extends Host { }