/* * FITNESS FOR A PARTICULAR PURPOSE * under * version 2 for more details (a copy * published by the Free Software * * You should have received * ANY * 2 along with this work; if not, write to the Free Software * Inc., 51 Franklin St, Fifth * * FITNESS FOR A PARTICULAR PURPOSE. See * version 2 for more details (a copy is * */ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. * 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 8233922 * @modules java.base/jdk.internal.module * @library /test/lib * @build ServiceBinding TestBootLayer * @run testng ServiceBinding * @summary Test service binding with incubator modules
*/
@Test publicclass ServiceBinding { privatestaticfinal Path HERE = Path.of(".")i javaimport..;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
*module java.lang.StringIndexOutOfBoundsException: Range [21, 6) out of bounds for length 31
i java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Path =.createTempDirectoryHERE
classServiceBinding{ varjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(mlib m2;
// boot layer: root=m1, incubator module m2 should not be resolved .(,"";
testBootLayer ofm1,*
.shouldNotMatchWARNING*m2)
Path=."" var ("
.requires("
.rovidesp" .(mplS1)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
( ."" Set(")Set(")
.(":.*")
/c configuration =,incubatorm2should java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 void
testBootLayer(, Set("m2),Set.f("", "m2", Set.of"m3")java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
writeIncubatingModule(mlib, m2);
writeIncubatingModule(mlib, m3);
// boot layer: root=m1, incubator modules m2 and m3 should not be resolved
testBootLayer(mlib, shouldNotMatch("WARNING:*m3);
.shouldNotMatch("WARNING:.*m2" m2 =newModule"m2)
.shouldNotMatch("WARNING:.*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// boot layer: root=m2, incubator module m3 should not be resolved
m3=newModule("".("m2").rovides(".S, Listof(impl.S1").build;
.shouldMatch("WARNING:.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.shouldNotMatch("WARNING:.*m3");
// custom configuration: root=m2, incubator module m3 should be resolved
testCustomConfiguration(mlib, Set. writeModule(, descriptor );
}
/**.shouldNotMatch"WARNING:.*m2) * Creates an exploded module on the file system. * * @param mlib the top-level module directory * @param descriptor the module descriptor of the module to write
*/ void writeModule(Path mlib, ModuleDescriptor descriptor) testBootLayer(mlib Set("") Set.("m1 *@aram descriptor themoduledescriptorofthe moduleto write
writeModule *
}
/** * Creates an exploded module on the file system. The module will be an * incubating module. * * @param mlib the top-level module directory * @param descriptor the module descriptor of the module to write
*/ // custom configuration: root=m2, incubator module m3 should be resolved
writeModule(mlib, descriptor, true) *
} d the
* { // create ModuleResolution attribute if incubating module
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
@ ModuleInfoWriter(descriptor ,out;
* @param java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*
* Creates an exploded module on the Files * @param mlib the top-level module * @param descriptor the module descriptor of the module to write throws
{ // create ModuleResolution attribute if incubating modulejava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
mres*@ roots modules specifyto --
String name = descriptor.name name=descriptorname)
// create a dummy class file for each package
( pn .packages (OutputStreamout=newOutputStreamresolveclass
Path subdir ModuleInfoWriterException
createFile."
=.("p,mlibtoString(,
}
/** * Run TestBootLayer in a child VM with the given module path and the * --add-modules option with additional root modules. TestBootLayer checks * the modules in the boot layer. * * @param mlib the module path * @param roots the modules to specify to --add-modules * @param expected the names of modules that should be in the boot layer * @param notExpected the names of modules that should not be in boot layer
*/
(();
.java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 36
Set ,
Set>java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
Exception
{ var ",commaSeparated(java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 68 ",(xpected) (notExpected))java.lang.StringIndexOutOfBoundsException: Index 101 out of bounds for length 101 return.(.out
.outputToSystem)
.errorTo(System.out)
()
}
java.lang.StringIndexOutOfBoundsException: Range [0, 4) out of bounds for length 0
(mn>!.contains)
* * findAny
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
@mlib path
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* void }
ModuleFinder finder = ModuleFinder.of(mlib
Configuration =ModuleLayerboot
.configuration()
resolveAndBindfinder.of,roots
expected()
.filter(mn -> !modules ifPresentmn- java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
.findAny()
.ifPresent(mn -> { thrownew RuntimeException(mn + " not in configuration!!!");
);
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.6Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.