2015-12-04 20:46:19 +00:00
/ *
2022-07-08 15:55:14 +00:00
* Copyright ( c ) 2016 , 2022 , Oracle and / or its affiliates . All rights reserved .
2015-12-04 20:46:19 +00:00
* 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 .
* /
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
/ * *
* @test
2016-11-17 21:28:45 +00:00
* @modules java . base / jdk . internal . misc
2021-03-12 20:48:51 +00:00
* @library / test / lib
2016-11-17 21:28:45 +00:00
* @compile p2 / c2 . java
* @compile p4 / c4 . java
2022-07-08 15:55:14 +00:00
* @build jdk . test . whitebox . WhiteBox
2017-04-07 08:04:46 +00:00
* @compile / module = java . base java / lang / ModuleHelper . java
2022-07-08 15:55:14 +00:00
* @run driver jdk . test . lib . helpers . ClassFileInstaller jdk . test . whitebox . WhiteBox
2016-11-17 21:28:45 +00:00
* @run main / othervm - Xbootclasspath / a : . - XX : + UnlockDiagnosticVMOptions - XX : + WhiteBoxAPI CCE_module_msg
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
* /
2015-12-04 20:46:19 +00:00
2016-11-17 21:28:45 +00:00
import java.io.* ;
import java.net.URL ;
import java.net.URLClassLoader ;
import java.nio.file.Path ;
import java.nio.file.Paths ;
import static jdk.test.lib.Asserts.* ;
2021-03-12 20:48:51 +00:00
import jdk.test.lib.classloader.ClassUnloadCommon ;
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
// Test that the message in a runtime ClassCastException contains module info.
public class CCE_module_msg {
2016-11-17 21:28:45 +00:00
private static final Path CLASSES_DIR = Paths . get ( " classes " ) ;
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
2016-11-17 21:28:45 +00:00
public static void main ( String [ ] args ) throws Throwable {
// Should not display version
invalidObjectToDerived ( ) ;
2018-06-25 15:33:11 +00:00
invalidOriginalInnerToDerived ( ) ;
2018-06-14 14:33:54 +00:00
invalidTimeToDerived ( ) ;
invalidHeadersToDerived ( ) ;
2016-11-17 21:28:45 +00:00
// Should display version
invalidClassToString ( ) ;
// Should display customer class loader
invalidClassToStringCustomLoader ( ) ;
2015-12-04 20:46:19 +00:00
}
2016-11-17 21:28:45 +00:00
public static void invalidObjectToDerived ( ) {
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
java . lang . Object instance = new java . lang . Object ( ) ;
int left = 23 ;
int right = 42 ;
try {
for ( int i = 0 ; i < 1 ; i + = 1 ) {
left = ( ( Derived ) instance ) . method ( left , right ) ;
}
throw new RuntimeException ( " ClassCastException wasn't thrown, test failed. " ) ;
} catch ( ClassCastException cce ) {
2018-06-25 15:33:11 +00:00
System . out . println ( cce . toString ( ) ) ;
if ( ! cce . getMessage ( ) . contains ( " class java.lang.Object cannot be cast to class Derived (java.lang.Object is in module java.base of loader 'bootstrap'; Derived is in unnamed module of loader 'app') " ) ) {
throw new RuntimeException ( " Wrong message: " + cce . getMessage ( ) ) ;
}
}
}
public static void invalidOriginalInnerToDerived ( ) {
OriginalInner instance = new OriginalInner ( ) ;
int left = 23 ;
int right = 42 ;
try {
for ( int i = 0 ; i < 1 ; i + = 1 ) {
left = ( ( Derived ) ( java . lang . Object ) instance ) . method ( left , right ) ;
}
throw new RuntimeException ( " ClassCastException wasn't thrown, test failed. " ) ;
} catch ( ClassCastException cce ) {
System . out . println ( cce . toString ( ) ) ;
if ( ! cce . getMessage ( ) . contains ( " class OriginalInner cannot be cast to class Derived (OriginalInner and Derived are in unnamed module of loader 'app') " ) ) {
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
throw new RuntimeException ( " Wrong message: " + cce . getMessage ( ) ) ;
}
2018-06-14 14:33:54 +00:00
}
}
// Test with a non-upgradeable 'java.' module other than java.base.
public static void invalidTimeToDerived ( ) {
java . sql . Time instance = new java . sql . Time ( 10000 ) ;
int left = 23 ;
int right = 42 ;
try {
for ( int i = 0 ; i < 1 ; i + = 1 ) {
left = ( ( Derived ) ( java . lang . Object ) instance ) . method ( left , right ) ;
}
throw new RuntimeException ( " ClassCastException wasn't thrown, test failed. " ) ;
} catch ( ClassCastException cce ) {
2018-06-25 15:33:11 +00:00
System . out . println ( cce . toString ( ) ) ;
if ( ! cce . getMessage ( ) . contains ( " class java.sql.Time cannot be cast to class Derived (java.sql.Time is in module java.sql of loader 'platform'; Derived is in unnamed module of loader 'app') " ) ) {
2018-06-14 14:33:54 +00:00
throw new RuntimeException ( " Wrong message: " + cce . getMessage ( ) ) ;
}
}
}
// Test with a non-upgradeable 'jdk.' module.
public static void invalidHeadersToDerived ( ) {
com . sun . net . httpserver . Headers instance = new com . sun . net . httpserver . Headers ( ) ;
int left = 23 ;
int right = 42 ;
try {
for ( int i = 0 ; i < 1 ; i + = 1 ) {
left = ( ( Derived ) ( java . lang . Object ) instance ) . method ( left , right ) ;
}
throw new RuntimeException ( " ClassCastException wasn't thrown, test failed. " ) ;
} catch ( ClassCastException cce ) {
2018-06-25 15:33:11 +00:00
System . out . println ( cce . toString ( ) ) ;
if ( ! cce . getMessage ( ) . contains ( " class com.sun.net.httpserver.Headers cannot be cast to class Derived (com.sun.net.httpserver.Headers is in module jdk.httpserver of loader 'platform'; Derived is in unnamed module of loader 'app') " ) ) {
2018-06-14 14:33:54 +00:00
throw new RuntimeException ( " Wrong message: " + cce . getMessage ( ) ) ;
}
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
}
2015-12-04 20:46:19 +00:00
}
2016-11-17 21:28:45 +00:00
public static void invalidClassToString ( ) throws Throwable {
2017-04-07 08:04:46 +00:00
// Get the java.lang.Module object for module java.base.
2016-11-17 21:28:45 +00:00
Class jlObject = Class . forName ( " java.lang.Object " ) ;
2017-04-07 08:04:46 +00:00
Object jlObject_jlM = jlObject . getModule ( ) ;
assertNotNull ( jlObject_jlM , " jlModule object of java.lang.Object should not be null " ) ;
2016-11-17 21:28:45 +00:00
// Get the class loader for CCE_module_msg and assume it's also used to
// load classes p1.c1 and p2.c2.
ClassLoader this_cldr = CCE_module_msg . class . getClassLoader ( ) ;
// Define a module for p2.
2017-02-10 09:03:55 +00:00
Object m2x = ModuleHelper . ModuleObject ( " module_two " , this_cldr , new String [ ] { " p2 " } ) ;
assertNotNull ( m2x , " Module should not be null " ) ;
2017-04-24 16:08:28 +00:00
ModuleHelper . DefineModule ( m2x , false , " 9.0 " , " m2x/there " , new String [ ] { " p2 " } ) ;
2017-04-07 08:04:46 +00:00
ModuleHelper . AddReadsModule ( m2x , jlObject_jlM ) ;
2016-11-17 21:28:45 +00:00
try {
2017-02-10 09:03:55 +00:00
ModuleHelper . AddModuleExportsToAll ( m2x , " p2 " ) ;
2016-11-17 21:28:45 +00:00
Object p2Obj = new p2 . c2 ( ) ;
System . out . println ( ( String ) p2Obj ) ;
throw new RuntimeException ( " ClassCastException wasn't thrown, test failed. " ) ;
} catch ( ClassCastException cce ) {
String exception = cce . getMessage ( ) ;
2018-06-25 15:33:11 +00:00
System . out . println ( cce . toString ( ) ) ;
if ( ! exception . contains ( " class p2.c2 cannot be cast to class java.lang.String (p2.c2 is in module module_two@ " ) | |
! exception . contains ( " of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap') " ) ) {
2016-11-17 21:28:45 +00:00
throw new RuntimeException ( " Wrong message: " + exception ) ;
}
}
}
public static void invalidClassToStringCustomLoader ( ) throws Throwable {
2017-04-07 08:04:46 +00:00
// Get the java.lang.Module object for module java.base.
2016-11-17 21:28:45 +00:00
Class jlObject = Class . forName ( " java.lang.Object " ) ;
2017-04-07 08:04:46 +00:00
Object jlObject_jlM = jlObject . getModule ( ) ;
assertNotNull ( jlObject_jlM , " jlModule object of java.lang.Object should not be null " ) ;
2016-11-17 21:28:45 +00:00
// Create a customer class loader to load class p4/c4.
URL [ ] urls = new URL [ ] { CLASSES_DIR . toUri ( ) . toURL ( ) } ;
ClassLoader parent = ClassLoader . getSystemClassLoader ( ) ;
MyURLClassLoader myCldr = new MyURLClassLoader ( " MyClassLoader " , urls , parent ) ;
try {
// Class p4.c4 should be defined to the unnamed module of myCldr
Class p4_c4_class = myCldr . loadClass ( " p4.c4 " ) ;
Object c4Obj = p4_c4_class . newInstance ( ) ;
System . out . println ( ( String ) c4Obj ) ;
throw new RuntimeException ( " ClassCastException wasn't thrown, test failed. " ) ;
} catch ( ClassCastException cce ) {
String exception = cce . getMessage ( ) ;
2018-06-25 15:33:11 +00:00
System . out . println ( cce . toString ( ) ) ;
if ( ! exception . contains ( " class p4.c4 cannot be cast to class java.lang.String (p4.c4 is in unnamed module of loader 'MyClassLoader' @ " ) | |
! exception . contains ( " ; java.lang.String is in module java.base of loader 'bootstrap') " ) ) {
2016-11-17 21:28:45 +00:00
throw new RuntimeException ( " Wrong message: " + exception ) ;
}
}
}
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
}
2015-12-04 20:46:19 +00:00
2018-06-25 15:33:11 +00:00
class OriginalInner extends java . lang . Object {
public int method ( int left , int right ) {
return right ;
}
}
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
class Derived extends java . lang . Object {
public int method ( int left , int right ) {
return right ;
2015-12-04 20:46:19 +00:00
}
}
2016-11-17 21:28:45 +00:00
class MyURLClassLoader extends URLClassLoader {
public MyURLClassLoader ( String name ,
URL [ ] urls ,
ClassLoader parent ) {
super ( name , urls , parent ) ;
}
public Class loadClass ( String name ) throws ClassNotFoundException {
if ( ! name . equals ( " p4.c4 " ) ) {
return super . loadClass ( name ) ;
}
2021-03-12 20:48:51 +00:00
byte [ ] data = ClassUnloadCommon . getClassData ( name ) ;
2016-11-17 21:28:45 +00:00
return defineClass ( name , data , 0 , data . length ) ;
}
}