This commit is contained in:
Lana Steuck 2016-09-08 22:14:00 +00:00
commit 1e5d88277f
44 changed files with 326 additions and 153 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -476,7 +476,8 @@ class Package {
} else if (localICs.isEmpty()) {
// It was a non-empty diff, but the local ICs were absent.
actualICs = null;
changed = 0; // [] => null, no tuple change
// [] => null, no tuple change, but attribute deletion.
changed = -1;
} else {
// Non-trivial diff was transmitted.
actualICs = computeICdiff();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1193,18 +1193,21 @@ class PackageReader extends BandStructure {
cls.visitRefs(VRM_CLASSIC, cpRefs);
ArrayList<BootstrapMethodEntry> bsms = new ArrayList<>();
/*
* BootstrapMethod(BSMs) are added here before InnerClasses(ICs),
* so as to ensure the order. Noting that the BSMs may be
* removed if they are not found in the CP, after the ICs expansion.
*/
cls.addAttribute(Package.attrBootstrapMethodsEmpty.canonicalInstance());
// flesh out the local constant pool
ConstantPool.completeReferencesIn(cpRefs, true, bsms);
// add the bsm and references as required
if (!bsms.isEmpty()) {
cls.addAttribute(Package.attrBootstrapMethodsEmpty.canonicalInstance());
cpRefs.add(Package.getRefString("BootstrapMethods"));
Collections.sort(bsms);
cls.setBootstrapMethods(bsms);
}
// Now that we know all our local class references,
// compute the InnerClasses attribute.
// An InnerClasses attribute usually gets added here,
// although it might already have been present.
int changed = cls.expandLocalICs();
if (changed != 0) {
@ -1221,16 +1224,6 @@ class PackageReader extends BandStructure {
ConstantPool.completeReferencesIn(cpRefs, true, bsms);
}
// remove the attr previously set, otherwise add the bsm and
// references as required
if (bsms.isEmpty()) {
cls.attributes.remove(Package.attrBootstrapMethodsEmpty.canonicalInstance());
} else {
cpRefs.add(Package.getRefString("BootstrapMethods"));
Collections.sort(bsms);
cls.setBootstrapMethods(bsms);
}
// construct a local constant pool
int numDoubles = 0;
for (Entry e : cpRefs) {

View File

@ -1167,17 +1167,7 @@ public abstract class ClassLoader {
protected final Class<?> findSystemClass(String name)
throws ClassNotFoundException
{
ClassLoader system = getSystemClassLoader();
if (system == null) {
if (!checkName(name))
throw new ClassNotFoundException(name);
Class<?> cls = findBootstrapClass(name);
if (cls == null) {
throw new ClassNotFoundException(name);
}
return cls;
}
return system.loadClass(name);
return getSystemClassLoader().loadClass(name);
}
/**
@ -1437,11 +1427,7 @@ public abstract class ClassLoader {
* @since 1.1
*/
public static URL getSystemResource(String name) {
ClassLoader system = getSystemClassLoader();
if (system == null) {
return BootLoader.findResource(name);
}
return system.getResource(name);
return getSystemClassLoader().getResource(name);
}
/**
@ -1464,17 +1450,13 @@ public abstract class ClassLoader {
*
* @throws IOException
* If I/O errors occur
*
* @since 1.2
*/
public static Enumeration<URL> getSystemResources(String name)
throws IOException
{
ClassLoader system = getSystemClassLoader();
if (system == null) {
return BootLoader.findResources(name);
}
return system.getResources(name);
return getSystemClassLoader().getResources(name);
}
/**
@ -1631,8 +1613,7 @@ public abstract class ClassLoader {
* this method during startup should take care not to cache the return
* value until the system is fully initialized.
*
* @return The system <tt>ClassLoader</tt> for delegation, or
* <tt>null</tt> if none
* @return The system <tt>ClassLoader</tt> for delegation
*
* @throws SecurityException
* If a security manager is present, and the caller's class loader

View File

@ -733,6 +733,7 @@ public class Runtime {
* @deprecated
* This method was intended to control instruction tracing.
* It has been superseded by JVM-specific tracing mechanisms.
* This method is subject to removal in a future version of Java SE.
*
* @param on ignored
*/
@ -745,6 +746,7 @@ public class Runtime {
* @deprecated
* This method was intended to control method call tracing.
* It has been superseded by JVM-specific tracing mechanisms.
* This method is subject to removal in a future version of Java SE.
*
* @param on ignored
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -323,11 +323,9 @@ import java.util.StringTokenizer;
* <td>usePolicy</td>
* <td>Granting this permission disables the Java Plug-In's default
* security prompting behavior.</td>
* <td>For more information, refer to Java Plug-In's guides, <a href=
* "../../../technotes/guides/plugin/developer_guide/security.html">
* Applet Security Basics</a> and <a href=
* "../../../technotes/guides/plugin/developer_guide/rsa_how.html#use">
* usePolicy Permission</a>.</td>
* <td>For more information, refer to the <a href=
* "../../../technotes/guides/deploy/index.html">deployment guide</a>.
* </td>
* </tr>
* <tr>
* <td>manageProcess</td>

View File

@ -52,7 +52,7 @@ import java.io.ByteArrayInputStream;
* {@link MessageDigest}),
* so that in order to compute intermediate digests, a caller should
* retain a handle onto the digest object, and clone it for each
* digest to be computed, leaving the orginal digest untouched.
* digest to be computed, leaving the original digest untouched.
*
* @see MessageDigest
*

View File

@ -76,7 +76,7 @@ import sun.security.util.Debug;
* {@code g} parameters. If the modulus size is not one of the above
* values, the <i>Sun</i> provider creates a new set of parameters. Other
* providers might have precomputed parameter sets for more than just the
* three modulus sizes mentioned above. Still others might not have a list of
* modulus sizes mentioned above. Still others might not have a list of
* precomputed parameters at all and instead always create new parameter sets.
*
* <li><b>Algorithm-Specific Initialization</b>
@ -393,7 +393,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
* of randomness.
* (If none of the installed providers supply an implementation of
* {@code SecureRandom}, a system-provided source of randomness is
* used.).
* used.)
*
* <p>This concrete method has been added to this previously-defined
* abstract class.

View File

@ -38,7 +38,7 @@ import sun.security.jca.JCAUtil;
* for the {@code Signature} class, which is used to provide the
* functionality of a digital signature algorithm. Digital signatures are used
* for authentication and integrity assurance of digital data.
*.
*
* <p> All the abstract methods in this class must be implemented by each
* cryptographic service provider who wishes to supply the implementation
* of a particular signature algorithm.

View File

@ -31,6 +31,10 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
/**
* Container class for immutable collections. Not part of the public API.
@ -61,9 +65,25 @@ class ImmutableCollections {
*/
static final double EXPAND_FACTOR = 2.0;
static UnsupportedOperationException uoe() { return new UnsupportedOperationException(); }
// ---------- List Implementations ----------
static final class List0<E> extends AbstractList<E> implements RandomAccess, Serializable {
abstract static class AbstractImmutableList<E> extends AbstractList<E>
implements RandomAccess, Serializable {
@Override public boolean add(E e) { throw uoe(); }
@Override public boolean addAll(Collection<? extends E> c) { throw uoe(); }
@Override public boolean addAll(int index, Collection<? extends E> c) { throw uoe(); }
@Override public void clear() { throw uoe(); }
@Override public boolean remove(Object o) { throw uoe(); }
@Override public boolean removeAll(Collection<?> c) { throw uoe(); }
@Override public boolean removeIf(Predicate<? super E> filter) { throw uoe(); }
@Override public void replaceAll(UnaryOperator<E> operator) { throw uoe(); }
@Override public boolean retainAll(Collection<?> c) { throw uoe(); }
@Override public void sort(Comparator<? super E> c) { throw uoe(); }
}
static final class List0<E> extends AbstractImmutableList<E> {
List0() { }
@Override
@ -86,7 +106,7 @@ class ImmutableCollections {
}
}
static final class List1<E> extends AbstractList<E> implements RandomAccess, Serializable {
static final class List1<E> extends AbstractImmutableList<E> {
private final E e0;
List1(E e0) {
@ -114,7 +134,7 @@ class ImmutableCollections {
}
}
static final class List2<E> extends AbstractList<E> implements RandomAccess, Serializable {
static final class List2<E> extends AbstractImmutableList<E> {
private final E e0;
private final E e1;
@ -147,7 +167,7 @@ class ImmutableCollections {
}
}
static final class ListN<E> extends AbstractList<E> implements RandomAccess, Serializable {
static final class ListN<E> extends AbstractImmutableList<E> {
private final E[] elements;
@SafeVarargs
@ -183,7 +203,17 @@ class ImmutableCollections {
// ---------- Set Implementations ----------
static final class Set0<E> extends AbstractSet<E> implements Serializable {
abstract static class AbstractImmutableSet<E> extends AbstractSet<E> implements Serializable {
@Override public boolean add(E e) { throw uoe(); }
@Override public boolean addAll(Collection<? extends E> c) { throw uoe(); }
@Override public void clear() { throw uoe(); }
@Override public boolean remove(Object o) { throw uoe(); }
@Override public boolean removeAll(Collection<?> c) { throw uoe(); }
@Override public boolean removeIf(Predicate<? super E> filter) { throw uoe(); }
@Override public boolean retainAll(Collection<?> c) { throw uoe(); }
}
static final class Set0<E> extends AbstractImmutableSet<E> {
Set0() { }
@Override
@ -210,7 +240,7 @@ class ImmutableCollections {
}
}
static final class Set1<E> extends AbstractSet<E> implements Serializable {
static final class Set1<E> extends AbstractImmutableSet<E> {
private final E e0;
Set1(E e0) {
@ -241,7 +271,7 @@ class ImmutableCollections {
}
}
static final class Set2<E> extends AbstractSet<E> implements Serializable {
static final class Set2<E> extends AbstractImmutableSet<E> {
private final E e0;
private final E e1;
@ -312,7 +342,7 @@ class ImmutableCollections {
* least one null is always present.
* @param <E> the element type
*/
static final class SetN<E> extends AbstractSet<E> implements Serializable {
static final class SetN<E> extends AbstractImmutableSet<E> {
private final E[] elements;
private final int size;
@ -403,7 +433,23 @@ class ImmutableCollections {
// ---------- Map Implementations ----------
static final class Map0<K,V> extends AbstractMap<K,V> implements Serializable {
abstract static class AbstractImmutableMap<K,V> extends AbstractMap<K,V> implements Serializable {
@Override public void clear() { throw uoe(); }
@Override public V compute(K key, BiFunction<? super K,? super V,? extends V> rf) { throw uoe(); }
@Override public V computeIfAbsent(K key, Function<? super K,? extends V> mf) { throw uoe(); }
@Override public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> rf) { throw uoe(); }
@Override public V merge(K key, V value, BiFunction<? super V,? super V,? extends V> rf) { throw uoe(); }
@Override public V put(K key, V value) { throw uoe(); }
@Override public void putAll(Map<? extends K,? extends V> m) { throw uoe(); }
@Override public V putIfAbsent(K key, V value) { throw uoe(); }
@Override public V remove(Object key) { throw uoe(); }
@Override public boolean remove(Object key, Object value) { throw uoe(); }
@Override public V replace(K key, V value) { throw uoe(); }
@Override public boolean replace(K key, V oldValue, V newValue) { throw uoe(); }
@Override public void replaceAll(BiFunction<? super K,? super V,? extends V> f) { throw uoe(); }
}
static final class Map0<K,V> extends AbstractImmutableMap<K,V> {
Map0() { }
@Override
@ -430,7 +476,7 @@ class ImmutableCollections {
}
}
static final class Map1<K,V> extends AbstractMap<K,V> implements Serializable {
static final class Map1<K,V> extends AbstractImmutableMap<K,V> {
private final K k0;
private final V v0;
@ -472,7 +518,7 @@ class ImmutableCollections {
* @param <K> the key type
* @param <V> the value type
*/
static final class MapN<K,V> extends AbstractMap<K,V> implements Serializable {
static final class MapN<K,V> extends AbstractImmutableMap<K,V> {
private final Object[] table; // pairs of key, value
private final int size; // number of pairs

View File

@ -94,7 +94,8 @@ import java.util.function.UnaryOperator;
*
* <ul>
* <li>They are <em>structurally immutable</em>. Elements cannot be added, removed,
* or replaced. Attempts to do so result in {@code UnsupportedOperationException}.
* or replaced. Calling any mutator method will always cause
* {@code UnsupportedOperationException} to be thrown.
* However, if the contained elements are themselves mutable,
* this may cause the List's contents to appear to change.
* <li>They disallow {@code null} elements. Attempts to create them with

View File

@ -119,7 +119,8 @@ import java.io.Serializable;
*
* <ul>
* <li>They are <em>structurally immutable</em>. Keys and values cannot be added,
* removed, or updated. Attempts to do so result in {@code UnsupportedOperationException}.
* removed, or updated. Calling any mutator method will always cause
* {@code UnsupportedOperationException} to be thrown.
* However, if the contained keys or values are themselves mutable, this may cause the
* Map to behave inconsistently or its contents to appear to change.
* <li>They disallow {@code null} keys and values. Attempts to create them with

View File

@ -70,7 +70,8 @@ package java.util;
*
* <ul>
* <li>They are <em>structurally immutable</em>. Elements cannot be added or
* removed. Attempts to do so result in {@code UnsupportedOperationException}.
* removed. Calling any mutator method will always cause
* {@code UnsupportedOperationException} to be thrown.
* However, if the contained elements are themselves mutable, this may cause the
* Set to behave inconsistently or its contents to appear to change.
* <li>They disallow {@code null} elements. Attempts to create them with

View File

@ -80,7 +80,7 @@ import jdk.internal.org.objectweb.asm.Opcodes;
* ClassWriter cw = new ClassWriter(...);
* ClassVisitor sv = new SerialVersionUIDAdder(cw);
* ClassVisitor ca = new MyClassAdapter(sv);
* new ClassReader(orginalClass).accept(ca, false);
* new ClassReader(originalClass).accept(ca, false);
* </pre>
*
* The SVUID algorithm can be found <a href=

View File

@ -1185,7 +1185,7 @@ final class ClientHandshaker extends Handshaker {
/*
* FOURTH, if we sent a Certificate, we need to send a signed
* CertificateVerify (unless the key in the client's certificate
* was a Diffie-Hellman key).).
* was a Diffie-Hellman key).
*
* This uses a hash of the previous handshake messages ... either
* a nonfinal one (if the particular implementation supports it)

View File

@ -95,7 +95,7 @@ public final class DLSInfo {
public String subject = null;
/**
* (ISRC) Name of person or orginization who supplied
* orginal material for the file.
* original material for the file.
*/
public String source = null;
/**

View File

@ -189,12 +189,12 @@ public final class DefaultImageBuilder implements ImageBuilder {
storeFiles(modules, release);
if (Files.getFileStore(root).supportsFileAttributeView(PosixFileAttributeView.class)) {
// launchers in the bin directory need execute permission
// launchers in the bin directory need execute permission.
// On Windows, "bin" also subdirectories containing jvm.dll.
if (Files.isDirectory(bin)) {
Files.list(bin)
.filter(f -> !f.toString().endsWith(".diz"))
.filter(f -> Files.isRegularFile(f))
.forEach(this::setExecutable);
Files.find(bin, 2, (path, attrs) -> {
return attrs.isRegularFile() && !path.toString().endsWith(".diz");
}).forEach(this::setExecutable);
}
// jspawnhelper is in lib or lib/<arch>

View File

@ -103,7 +103,9 @@ public final class ExcludeVMPlugin implements Plugin {
List<ResourcePoolEntry> ret = javaBase.entries().filter((t) -> {
String path = t.path();
for (String jvmlib : jvmlibs) {
return t.path().endsWith("/" + jvmlib);
if (t.path().endsWith("/" + jvmlib)) {
return true;
}
}
return false;
}).collect(Collectors.toList());

View File

@ -310,8 +310,6 @@ sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java 8157338 generic-
tools/pack200/CommandLineTests.java 7143279,8059906 generic-all
tools/pack200/Pack200Test.java 8059906,8151901 generic-all
tools/launcher/FXLauncherTest.java 8068049 linux-all,macosx-all
tools/pack200/Pack200Props.java 8155857 generic-all

View File

@ -27,7 +27,7 @@
* @bug 8048052
* @summary Test a series of methods which requires "setFactory" runtime permission
* @modules java.rmi
* @run main SetFactoryPermission success
* @run main/othervm SetFactoryPermission success
* @run main/othervm/policy=policy.fail SetFactoryPermission fail
* @run main/othervm/policy=policy.success SetFactoryPermission success
*/

View File

@ -1,4 +1,6 @@
# Threeten test uses TestNG
TestNG.dirs = .
othervm.dirs = tck/java/time/chrono test/java/time/chrono test/java/time/format
modules = jdk.localedata
lib.dirs = ../../lib/testlibrary
lib.build = jdk.testlibrary.RandomFactory

View File

@ -24,6 +24,7 @@
/*
* @test
* @bug 4302966
* @modules jdk.localedata
* @summary In Czech Republic first day of week is Monday not Sunday
*/

View File

@ -112,7 +112,6 @@ public class MOAT {
testCollection(Arrays.asList(1,2,3));
testCollection(nCopies(25,1));
testImmutableList(nCopies(25,1));
testImmutableList(unmodifiableList(Arrays.asList(1,2,3)));
testMap(new HashMap<Integer,Integer>());
testMap(new LinkedHashMap<Integer,Integer>());
@ -134,6 +133,20 @@ public class MOAT {
testMap(Collections.synchronizedSortedMap(new TreeMap<Integer,Integer>()));
testMap(Collections.synchronizedNavigableMap(new TreeMap<Integer,Integer>()));
// Unmodifiable wrappers
testImmutableSet(unmodifiableSet(new HashSet<>(Arrays.asList(1,2,3))));
testImmutableList(unmodifiableList(Arrays.asList(1,2,3)));
testImmutableMap(unmodifiableMap(Collections.singletonMap(1,2)));
testCollMutatorsAlwaysThrow(unmodifiableSet(new HashSet<>(Arrays.asList(1,2,3))));
testCollMutatorsAlwaysThrow(unmodifiableSet(Collections.emptySet()));
testEmptyCollMutatorsAlwaysThrow(unmodifiableSet(Collections.emptySet()));
testListMutatorsAlwaysThrow(unmodifiableList(Arrays.asList(1,2,3)));
testListMutatorsAlwaysThrow(unmodifiableList(Collections.emptyList()));
testEmptyListMutatorsAlwaysThrow(unmodifiableList(Collections.emptyList()));
testMapMutatorsAlwaysThrow(unmodifiableMap(Collections.singletonMap(1,2)));
testMapMutatorsAlwaysThrow(unmodifiableMap(Collections.emptyMap()));
testEmptyMapMutatorsAlwaysThrow(unmodifiableMap(Collections.emptyMap()));
// Empty collections
final List<Integer> emptyArray = Arrays.asList(new Integer[]{});
testCollection(emptyArray);
@ -196,6 +209,8 @@ public class MOAT {
// Immutable List
testEmptyList(List.of());
testListMutatorsAlwaysThrow(List.of());
testEmptyListMutatorsAlwaysThrow(List.of());
for (List<Integer> list : Arrays.asList(
List.<Integer>of(),
List.of(1),
@ -211,10 +226,13 @@ public class MOAT {
List.of(integerArray))) {
testCollection(list);
testImmutableList(list);
testListMutatorsAlwaysThrow(list);
}
// Immutable Set
testEmptySet(Set.of());
testCollMutatorsAlwaysThrow(Set.of());
testEmptyCollMutatorsAlwaysThrow(Set.of());
for (Set<Integer> set : Arrays.asList(
Set.<Integer>of(),
Set.of(1),
@ -230,6 +248,7 @@ public class MOAT {
Set.of(integerArray))) {
testCollection(set);
testImmutableSet(set);
testCollMutatorsAlwaysThrow(set);
}
// Immutable Map
@ -241,6 +260,8 @@ public class MOAT {
}
testEmptyMap(Map.of());
testMapMutatorsAlwaysThrow(Map.of());
testEmptyMapMutatorsAlwaysThrow(Map.of());
for (Map<Integer,Integer> map : Arrays.asList(
Map.<Integer,Integer>of(),
Map.of(1, 101),
@ -256,6 +277,7 @@ public class MOAT {
Map.ofEntries(ea))) {
testMap(map);
testImmutableMap(map);
testMapMutatorsAlwaysThrow(map);
}
}
@ -358,6 +380,93 @@ public class MOAT {
it.remove(); });
}
/**
* Test that calling a mutator always throws UOE, even if the mutator
* wouldn't actually do anything, given its arguments.
*
* @param c the collection instance to test
*/
private static void testCollMutatorsAlwaysThrow(Collection<Integer> c) {
THROWS(UnsupportedOperationException.class,
() -> c.addAll(Collections.emptyList()),
() -> c.remove(ABSENT_VALUE),
() -> c.removeAll(Collections.emptyList()),
() -> c.removeIf(x -> false),
() -> c.retainAll(c));
}
/**
* Test that calling a mutator always throws UOE, even if the mutator
* wouldn't actually do anything on an empty collection.
*
* @param c the collection instance to test, must be empty
*/
private static void testEmptyCollMutatorsAlwaysThrow(Collection<Integer> c) {
if (! c.isEmpty()) {
fail("collection is not empty");
}
THROWS(UnsupportedOperationException.class,
() -> c.clear());
}
/**
* As above, for a list.
*
* @param c the list instance to test
*/
private static void testListMutatorsAlwaysThrow(List<Integer> c) {
testCollMutatorsAlwaysThrow(c);
THROWS(UnsupportedOperationException.class,
() -> c.addAll(0, Collections.emptyList()));
}
/**
* As above, for an empty list.
*
* @param c the list instance to test, must be empty
*/
private static void testEmptyListMutatorsAlwaysThrow(List<Integer> c) {
if (! c.isEmpty()) {
fail("list is not empty");
}
testEmptyCollMutatorsAlwaysThrow(c);
THROWS(UnsupportedOperationException.class,
() -> c.replaceAll(x -> x),
() -> c.sort(null));
}
/**
* As above, for a map.
*
* @param m the map instance to test
*/
private static void testMapMutatorsAlwaysThrow(Map<Integer,Integer> m) {
THROWS(UnsupportedOperationException.class,
() -> m.compute(ABSENT_VALUE, (k, v) -> null),
() -> m.computeIfAbsent(ABSENT_VALUE, k -> null),
() -> m.computeIfPresent(ABSENT_VALUE, (k, v) -> null),
() -> m.merge(ABSENT_VALUE, 0, (k, v) -> null),
() -> m.putAll(Collections.emptyMap()),
() -> m.remove(ABSENT_VALUE),
() -> m.remove(ABSENT_VALUE, 0),
() -> m.replace(ABSENT_VALUE, 0),
() -> m.replace(ABSENT_VALUE, 0, 1));
}
/**
* As above, for an empty map.
*
* @param map the map instance to test, must be empty
*/
private static void testEmptyMapMutatorsAlwaysThrow(Map<Integer,Integer> m) {
if (! m.isEmpty()) {
fail("map is not empty");
}
THROWS(UnsupportedOperationException.class,
() -> m.clear(),
() -> m.replaceAll((k, v) -> v));
}
private static void clear(Collection<Integer> c) {
try { c.clear(); }
catch (Throwable t) { unexpected(t); }

View File

@ -24,6 +24,7 @@
/*
* @test
* @bug 8135055
* @modules java.sql
* @summary Test java.sql.TimeStamp instance should come after java.util.Date
* if Nanos component of TimeStamp is not equal to 0 milliseconds.
*/

View File

@ -24,6 +24,7 @@
/**
* @test
* @bug 8146156 8159548
* @modules jdk.localedata
* @summary test whether uppercasing follows Locale.Category.FORMAT locale.
* @run main/othervm FormatLocale
*/

View File

@ -69,6 +69,7 @@ public class TestPermission {
@Test
public void runTest() throws Exception {
int exitValue = executeTestJava("--module-path", MODS_DIR.toString(),
"--add-modules", "m1",
"-m", "test/jdk.test.Main")
.outputTo(System.out)
.errorTo(System.out)

View File

@ -42,7 +42,7 @@ import static org.testng.Assert.*;
* @test
* @library /lib/testlibrary
* @modules java.scripting
jdk.compiler
* jdk.compiler
* @build ServicesTest CompilerUtils jdk.testlibrary.*
* @run testng ServicesTest
* @summary Tests ServiceLoader to locate service providers on the module path
@ -112,6 +112,7 @@ public class ServicesTest {
public void runWithModulePath() throws Exception {
int exitValue
= executeTestJava("--module-path", MODS_DIR.toString(),
"--add-modules", "bananascript",
"-m", "test/test.Main",
"BananaScriptEngine")
.outputTo(System.out)
@ -131,6 +132,7 @@ public class ServicesTest {
int exitValue
= executeTestJava("--module-path", MODS_DIR.toString(),
"-cp", CLASSES_DIR.toString(),
"--add-modules", "bananascript",
"-m", "test/test.Main",
"BananaScriptEngine", "PearScriptEngine")
.outputTo(System.out)

View File

@ -24,6 +24,7 @@
/*
* @test
* @bug 4487276 8008577
* @modules jdk.localedata
* @summary Verify that Hong Kong locale uses traditional Chinese names.
* @run main/othervm -Djava.locale.providers=COMPAT,SPI HongKong
*/

View File

@ -37,6 +37,7 @@ import static org.testng.Assert.*;
* @bug 8129126 8136802 8137316 8137317 8136804 8139350
* @library /lib/testlibrary
* @modules jdk.compiler
* java.logging
* @build GetResourceBundleTest CompilerUtils jdk.testlibrary.ProcessTools
* @run testng GetResourceBundleTest
* @summary Tests Logger.getLogger + logger.getResourceBundle in an named/unnamed module,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,15 +27,25 @@
* @summary Test for changes in 8038436
* @modules java.base/sun.util.locale.provider
* java.base/sun.util.spi
* jdk.localedata
* @compile -XDignore.symbol.file Bug8038436.java
* @run main/othervm --limit-modules java.base Bug8038436 security
* @run main/othervm -Djava.locale.providers=COMPAT Bug8038436 availlocs
*/
import java.security.*;
import java.util.*;
import java.util.stream.*;
import sun.util.locale.provider.*;
import java.security.CodeSource;
import java.security.Permission;
import java.security.PermissionCollection;
import java.security.Permissions;
import java.security.Policy;
import java.security.ProtectionDomain;
import java.util.Arrays;
import java.util.Formatter;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import sun.util.locale.provider.LocaleProviderAdapter;
public class Bug8038436 {
public static void main(String[] args) {

View File

@ -28,6 +28,7 @@
* @bug 8152817
* @summary Make sure that resource bundles in the jdk.localedata module are
* loaded under a security manager.
* @modules jdk.localedata
* @run main/othervm -Djava.locale.providers=COMPAT
* -Djava.security.debug=access,failure,codebase=jrt:/jdk.localedata Bug8152817
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,9 +22,10 @@
*/
/*
*@test
*@bug 4518811
*@summary Verifies the minimum days of the week for euro locales
* @test
* @bug 4518811
* @modules jdk.localedata
* @summary Verifies the minimum days of the week for euro locales
*/
// this code is a bit brute-force, but I've been coding in nothing but Shell for the last year, so I'm rusty.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
/*
* @test 1.1 11/02/01
* @bug 4527203
* @modules jdk.localedata
* @summary In Hungary and Ukraine first day of week is Monday not Sunday
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,12 +20,13 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
@test
@summary checking localised language/country names in finnish
@bug 4429024 4964035 6558856 8008577
@run main/othervm -Djava.locale.providers=JRE,SPI Bug4429024
*/
/*
* @test
* @summary checking localised language/country names in finnish
* @modules jdk.localedata
* @bug 4429024 4964035 6558856 8008577
* @run main/othervm -Djava.locale.providers=JRE,SPI Bug4429024
*/
import java.util.Locale;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,11 +20,12 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
*@test
*@bug 4965260 8008577
*@summary Verifies the language name of "nl" for supported locales
*@run main/othervm -Djava.locale.providers=JRE,SPI Bug4965260
/*
* @test
* @bug 4965260 8008577
* @modules jdk.localedata
* @summary Verifies the language name of "nl" for supported locales
* @run main/othervm -Djava.locale.providers=JRE,SPI Bug4965260
*/
import java.util.Locale;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -21,10 +21,11 @@
* questions.
*/
/**
@test
@summary Verifying that the language names starts with lowercase in spanish
@bug 6275682
/*
* @test
* @summary Verifying that the language names starts with lowercase in spanish
* @modules jdk.localedata
* @bug 6275682
*/
import java.util.Locale;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,10 +22,11 @@
*/
/*
*@test
*@bug 4938846 8008577
*@summary Test case for en_IE TimeZone info
*@run main/othervm -Djava.locale.providers=JRE,SPI Bug4938846
* @test
* @bug 4938846 8008577
* @modules jdk.localedata
* @summary Test case for en_IE TimeZone info
* @run main/othervm -Djava.locale.providers=JRE,SPI Bug4938846
*/
import java.util.Locale;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,10 +22,11 @@
*/
/*
*@test
*@bug 6271396 8008577
*@summary Test case for verifying typo of timezone display name Australia/Lord_Howe
*@run main/othervm -Djava.locale.providers=JRE,SPI Bug6271396
* @test
* @bug 6271396 8008577
* @modules jdk.localedata
* @summary Test case for verifying typo of timezone display name Australia/Lord_Howe
* @run main/othervm -Djava.locale.providers=JRE,SPI Bug6271396
*/
import java.util.Locale;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,10 +22,11 @@
*/
/*
*@test
*@bug 6317929 6409419 8008577
*@summary Test case for tzdata2005m support for 9 locales
*@run main/othervm -Djava.locale.providers=JRE,SPI Bug6317929
* @test
* @bug 6317929 6409419 8008577
* @modules jdk.localedata
* @summary Test case for tzdata2005m support for 9 locales
* @run main/othervm -Djava.locale.providers=JRE,SPI Bug6317929
*/
import java.util.Locale;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,10 +22,11 @@
*/
/*
*@test
*@bug 6377794
*@summary Test case for tzdata2005r support for 9 locales
*@run main/othervm -Djava.locale.providers=JRE,SPI Bug6377794
* @test
* @bug 6377794
* @modules jdk.localedata
* @summary Test case for tzdata2005r support for 9 locales
* @run main/othervm -Djava.locale.providers=JRE,SPI Bug6377794
*/
import java.util.Locale;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,10 +22,11 @@
*/
/*
*@test
*@bug 6442006 8008577
*@summary Test case for verifying timezone display name for Asia/Taipei
*@run main/othervm -Djava.locale.providers=JRE,SPI Bug6442006
* @test
* @bug 6442006 8008577
* @modules jdk.localedata
* @summary Test case for verifying timezone display name for Asia/Taipei
* @run main/othervm -Djava.locale.providers=JRE,SPI Bug6442006
*/
import java.util.Locale;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
/*
* @test
* @bug 8134250 8134520
* @modules jdk.localedata
* @summary Tests CLDR/LDML features are correctly reflected in JDK.
* @run main/othervm -Djava.locale.providers=CLDR Bug8134250
*/
@ -31,10 +32,15 @@
// Note this test highly depends on a particular version of CLDR. Results
// may vary in the future.
import java.time.*;
import java.time.chrono.*;
import java.time.format.*;
import java.util.*;
import java.time.LocalDate;
import java.time.Month;
import java.time.ZoneId;
import java.time.chrono.Chronology;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.FormatStyle;
import java.time.format.TextStyle;
import java.util.Locale;
public class Bug8134250 {
public static void main(String [] args) {

View File

@ -25,6 +25,7 @@
/*
* @test
* @bug 8145136
* @modules jdk.localedata
* @summary Tests CLDR 28/29 newly added feature LikelySubtags is correctly reflected in JDK.
* @run main/othervm -Djava.locale.providers=CLDR Bug8145136
*/

View File

@ -21,6 +21,14 @@
* questions.
*/
/*
* @test
* @bug 6521334 6712743 8007902 8151901
* @summary test general packer/unpacker functionality
* using native and java unpackers
* @compile -XDignore.symbol.file Utils.java Pack200Test.java
* @run main/othervm/timeout=1200 -Xmx1280m -Xshare:off Pack200Test
*/
import java.util.*;
import java.io.*;
@ -28,17 +36,6 @@ import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.util.jar.*;
/*
* @test
* @bug 6521334 6712743 8007902
* @key intermittent
* @summary check for memory leaks, test general packer/unpacker functionality\
* using native and java unpackers
* @compile -XDignore.symbol.file Utils.java Pack200Test.java
* @run main/othervm/timeout=1200 -Xmx1280m -Xshare:off Pack200Test
* @author ksrini
*/
/**
* Tests the packing/unpacking via the APIs.
*/
@ -48,6 +45,9 @@ public class Pack200Test {
static final MemoryMXBean mmxbean = ManagementFactory.getMemoryMXBean();
static final long m0 = getUsedMemory();
static final int LEAK_TOLERANCE = 21000; // OS and GC related variations.
// enable leak checks only if required, GC charecteristics vary on
// platforms and this may not yield consistent results
static final boolean LEAK_CHECK = Boolean.getBoolean("Pack200Test.enableLeakCheck");
/** Creates a new instance of Pack200Test */
private Pack200Test() {}
@ -60,9 +60,11 @@ public class Pack200Test {
}
private static void leakCheck() throws Exception {
if (!LEAK_CHECK)
return;
long diff = getUsedMemory() - m0;
System.out.println(" Info: memory diff = " + diff + "K");
if ( diff > LEAK_TOLERANCE) {
if (diff > LEAK_TOLERANCE) {
throw new Exception("memory leak detected " + diff);
}
}
@ -126,7 +128,7 @@ public class Pack200Test {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
public static void main(String[] args) throws Exception {
// select the jars carefully, adding more jars will increase the
// testing time, especially for jprt.
jarList.add(Utils.createRtJar());