diff options
author | asaha <none@none> | 2014-12-17 12:50:15 -0800 |
---|---|---|
committer | asaha <none@none> | 2014-12-17 12:50:15 -0800 |
commit | ade4b6063b819e5ca021151c2c1fa7a04ffeae4c (patch) | |
tree | ee897640dcb54dcb68c45492eb4a796524ef7e20 /src/share | |
parent | 6fc7ab73925e66f64d0672506d562e7e972a3e16 (diff) | |
parent | d47c11d9888f5b6645de45b2156b9ebab232ceac (diff) | |
download | jdk8u_jdk-ade4b6063b819e5ca021151c2c1fa7a04ffeae4c.tar.gz |
Merge
Diffstat (limited to 'src/share')
25 files changed, 245 insertions, 224 deletions
diff --git a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java index fb1afc8b70..530cecea29 100644 --- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java @@ -1285,7 +1285,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { /** * Render different filters */ - public class FilterComboBoxRenderer extends DefaultListCellRenderer implements UIResource { + public class FilterComboBoxRenderer extends DefaultListCellRenderer { public String getName() { // As SynthComboBoxRenderer's are asked for a size BEFORE they // are parented getName is overriden to force the name to be diff --git a/src/share/classes/com/sun/jndi/ldap/Connection.java b/src/share/classes/com/sun/jndi/ldap/Connection.java index c5a957ce6d..64b625dac2 100644 --- a/src/share/classes/com/sun/jndi/ldap/Connection.java +++ b/src/share/classes/com/sun/jndi/ldap/Connection.java @@ -111,7 +111,6 @@ public final class Connection implements Runnable { private static final boolean debug = false; private static final int dump = 0; // > 0 r, > 1 rw - public static final long DEFAULT_READ_TIMEOUT_MILLIS = 15 * 1000; // 15 second timeout; final private Thread worker; // Initialized in constructor @@ -460,10 +459,13 @@ public final class Connection implements Runnable { // will be woken up before readTimeout only if reply is // available ldr.wait(readTimeout); + waited = true; } else { - ldr.wait(DEFAULT_READ_TIMEOUT_MILLIS); + // no timeout is set so we wait infinitely until + // a response is received + // http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP + ldr.wait(); } - waited = true; } else { break; } diff --git a/src/share/classes/java/awt/SplashScreen.java b/src/share/classes/java/awt/SplashScreen.java index 9ec56251a3..05a38e7e11 100644 --- a/src/share/classes/java/awt/SplashScreen.java +++ b/src/share/classes/java/awt/SplashScreen.java @@ -293,6 +293,7 @@ public final class SplashScreen { */ public Graphics2D createGraphics() throws IllegalStateException { synchronized (SplashScreen.class) { + checkVisible(); if (image==null) { // get unscaled splash image size Dimension dim = _getBounds(splashPtr).getSize(); @@ -419,4 +420,4 @@ public final class SplashScreen { private native static boolean _setImageData(long SplashPtr, byte[] data); private native static float _getScaleFactor(long SplashPtr); -}; +} diff --git a/src/share/classes/java/awt/event/KeyListener.java b/src/share/classes/java/awt/event/KeyListener.java index 896b5fc9b9..2a4f3dd4f8 100644 --- a/src/share/classes/java/awt/event/KeyListener.java +++ b/src/share/classes/java/awt/event/KeyListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2014, 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 @@ -44,7 +44,7 @@ import java.util.EventListener; * * @see KeyAdapter * @see KeyEvent - * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/keylistener.html">Tutorial: Writing a Key Listener</a> + * @see <a href="https://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html">Tutorial: Writing a Key Listener</a> * * @since 1.1 */ diff --git a/src/share/classes/java/lang/Class.java b/src/share/classes/java/lang/Class.java index 43c8c0e8ec..4c35cbce11 100644 --- a/src/share/classes/java/lang/Class.java +++ b/src/share/classes/java/lang/Class.java @@ -689,6 +689,8 @@ public final class Class<T> implements java.io.Serializable, ClassLoader getClassLoader0() { return classLoader; } // Initialized in JVM not by private constructor + // This field is filtered from reflection access, i.e. getDeclaredField + // will throw NoSuchFieldException private final ClassLoader classLoader; /** diff --git a/src/share/classes/java/lang/System.java b/src/share/classes/java/lang/System.java index 69d1d0fe1e..b2747fa7a4 100644 --- a/src/share/classes/java/lang/System.java +++ b/src/share/classes/java/lang/System.java @@ -584,7 +584,10 @@ public final class System { * <tr><td><code>java.compiler</code></td> * <td>Name of JIT compiler to use</td></tr> * <tr><td><code>java.ext.dirs</code></td> - * <td>Path of extension directory or directories</td></tr> + * <td>Path of extension directory or directories + * <b>Deprecated.</b> <i>This property, and the mechanism + * which implements it, may be removed in a future + * release.</i> </td></tr> * <tr><td><code>os.name</code></td> * <td>Operating system name</td></tr> * <tr><td><code>os.arch</code></td> diff --git a/src/share/classes/java/lang/invoke/LambdaForm.java b/src/share/classes/java/lang/invoke/LambdaForm.java index e1791719c0..2129f8618b 100644 --- a/src/share/classes/java/lang/invoke/LambdaForm.java +++ b/src/share/classes/java/lang/invoke/LambdaForm.java @@ -125,7 +125,7 @@ class LambdaForm { MemberName vmentry; // low-level behavior, or null if not yet prepared private boolean isCompiled; - Object transformCache; // managed by LambdaFormEditor + volatile Object transformCache; // managed by LambdaFormEditor public static final int VOID_RESULT = -1, LAST_RESULT = -2; diff --git a/src/share/classes/java/lang/invoke/LambdaFormBuffer.java b/src/share/classes/java/lang/invoke/LambdaFormBuffer.java index 872a2a5992..cdc88be325 100644 --- a/src/share/classes/java/lang/invoke/LambdaFormBuffer.java +++ b/src/share/classes/java/lang/invoke/LambdaFormBuffer.java @@ -46,19 +46,16 @@ final class LambdaFormBuffer { private static final int F_TRANS = 0x10, F_OWNED = 0x03; LambdaFormBuffer(LambdaForm lf) { - this(lf.arity, lf.names, lf.result); + this.arity = lf.arity; + setNames(lf.names); + int result = lf.result; + if (result == LAST_RESULT) result = length - 1; + if (result >= 0 && lf.names[result].type != V_TYPE) + resultName = lf.names[result]; debugName = lf.debugName; assert(lf.nameRefsAreLegal()); } - private LambdaFormBuffer(int arity, Name[] names, int result) { - this.arity = arity; - setNames(names); - if (result == LAST_RESULT) result = length - 1; - if (result >= 0 && names[result].type != V_TYPE) - resultName = names[result]; - } - private LambdaForm lambdaForm() { assert(!inTrans()); // need endEdit call to tidy things up return new LambdaForm(debugName, arity, nameArray(), resultIndex()); diff --git a/src/share/classes/java/lang/invoke/LambdaFormEditor.java b/src/share/classes/java/lang/invoke/LambdaFormEditor.java index 1c29d73b4c..1c23e94995 100644 --- a/src/share/classes/java/lang/invoke/LambdaFormEditor.java +++ b/src/share/classes/java/lang/invoke/LambdaFormEditor.java @@ -25,6 +25,7 @@ package java.lang.invoke; +import java.lang.ref.SoftReference; import java.util.Arrays; import static java.lang.invoke.LambdaForm.*; import static java.lang.invoke.LambdaForm.BasicType.*; @@ -58,10 +59,9 @@ class LambdaFormEditor { * The sequence is unterminated, ending with an indefinite number of zero bytes. * Sequences that are simple (short enough and with small enough values) pack into a 64-bit long. */ - private static final class Transform { + private static final class Transform extends SoftReference<LambdaForm> { final long packedBytes; final byte[] fullBytes; - final LambdaForm result; // result of transform, or null, if there is none available private enum Kind { NO_KIND, // necessary because ordinal must be greater than zero @@ -140,9 +140,9 @@ class LambdaFormEditor { Kind kind() { return Kind.values()[byteAt(0)]; } private Transform(long packedBytes, byte[] fullBytes, LambdaForm result) { + super(result); this.packedBytes = packedBytes; this.fullBytes = fullBytes; - this.result = result; } private Transform(long packedBytes) { this(packedBytes, null, null); @@ -243,6 +243,7 @@ class LambdaFormEditor { buf.append("unpacked"); buf.append(Arrays.toString(fullBytes)); } + LambdaForm result = get(); if (result != null) { buf.append(" result="); buf.append(result); @@ -253,7 +254,7 @@ class LambdaFormEditor { /** Find a previously cached transform equivalent to the given one, and return its result. */ private LambdaForm getInCache(Transform key) { - assert(key.result == null); + assert(key.get() == null); // The transformCache is one of null, Transform, Transform[], or ConcurrentHashMap. Object c = lambdaForm.transformCache; Transform k = null; @@ -276,7 +277,7 @@ class LambdaFormEditor { } } assert(k == null || key.equals(k)); - return k == null ? null : k.result; + return (k != null) ? k.get() : null; } /** Arbitrary but reasonable limits on Transform[] size for cache. */ @@ -293,7 +294,17 @@ class LambdaFormEditor { @SuppressWarnings("unchecked") ConcurrentHashMap<Transform,Transform> m = (ConcurrentHashMap<Transform,Transform>) c; Transform k = m.putIfAbsent(key, key); - return k != null ? k.result : form; + if (k == null) return form; + LambdaForm result = k.get(); + if (result != null) { + return result; + } else { + if (m.replace(key, k, key)) { + return form; + } else { + continue; + } + } } assert(pass == 0); synchronized (lambdaForm) { @@ -308,17 +319,27 @@ class LambdaFormEditor { if (c instanceof Transform) { Transform k = (Transform)c; if (k.equals(key)) { - return k.result; + LambdaForm result = k.get(); + if (result == null) { + lambdaForm.transformCache = key; + return form; + } else { + return result; + } + } else if (k.get() == null) { // overwrite stale entry + lambdaForm.transformCache = key; + return form; } // expand one-element cache to small array ta = new Transform[MIN_CACHE_ARRAY_SIZE]; ta[0] = k; - lambdaForm.transformCache = c = ta; + lambdaForm.transformCache = ta; } else { // it is already expanded ta = (Transform[])c; } int len = ta.length; + int stale = -1; int i; for (i = 0; i < len; i++) { Transform k = ta[i]; @@ -326,10 +347,18 @@ class LambdaFormEditor { break; } if (k.equals(key)) { - return k.result; + LambdaForm result = k.get(); + if (result == null) { + ta[i] = key; + return form; + } else { + return result; + } + } else if (stale < 0 && k.get() == null) { + stale = i; // remember 1st stale entry index } } - if (i < len) { + if (i < len || stale >= 0) { // just fall through to cache update } else if (len < MAX_CACHE_ARRAY_SIZE) { len = Math.min(len * 2, MAX_CACHE_ARRAY_SIZE); @@ -344,7 +373,8 @@ class LambdaFormEditor { // The second iteration will update for this query, concurrently. continue; } - ta[i] = key; + int idx = (stale >= 0) ? stale : i; + ta[idx] = key; return form; } } diff --git a/src/share/classes/java/lang/invoke/MethodHandles.java b/src/share/classes/java/lang/invoke/MethodHandles.java index 3c60a8c3c9..8511890481 100644 --- a/src/share/classes/java/lang/invoke/MethodHandles.java +++ b/src/share/classes/java/lang/invoke/MethodHandles.java @@ -2029,7 +2029,7 @@ return invoker; MethodType oldType = target.type(); if (oldType == newType) return target; if (oldType.explicitCastEquivalentToAsType(newType)) { - return target.asType(newType); + return target.asFixedArity().asType(newType); } return MethodHandleImpl.makePairwiseConvert(target, newType, false); } diff --git a/src/share/classes/java/lang/invoke/MethodTypeForm.java b/src/share/classes/java/lang/invoke/MethodTypeForm.java index 6733e29ef9..bcf16dba9d 100644 --- a/src/share/classes/java/lang/invoke/MethodTypeForm.java +++ b/src/share/classes/java/lang/invoke/MethodTypeForm.java @@ -26,9 +26,8 @@ package java.lang.invoke; import sun.invoke.util.Wrapper; +import java.lang.ref.SoftReference; import static java.lang.invoke.MethodHandleStatics.*; -import static java.lang.invoke.MethodHandleNatives.Constants.*; - import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; /** * Shared information for a group of method types, which differ @@ -51,7 +50,7 @@ final class MethodTypeForm { final MethodType basicType; // the canonical erasure, with primitives simplified // Cached adapter information: - @Stable final MethodHandle[] methodHandles; + @Stable final SoftReference<MethodHandle>[] methodHandles; // Indexes into methodHandles: static final int MH_BASIC_INV = 0, // cached instance of MH.invokeBasic @@ -60,7 +59,7 @@ final class MethodTypeForm { MH_LIMIT = 3; // Cached lambda form information, for basic types only: - final @Stable LambdaForm[] lambdaForms; + final @Stable SoftReference<LambdaForm>[] lambdaForms; // Indexes into lambdaForms: static final int LF_INVVIRTUAL = 0, // DMH invokeVirtual @@ -108,26 +107,40 @@ final class MethodTypeForm { public MethodHandle cachedMethodHandle(int which) { assert(assertIsBasicType()); - return methodHandles[which]; + SoftReference<MethodHandle> entry = methodHandles[which]; + return (entry != null) ? entry.get() : null; } synchronized public MethodHandle setCachedMethodHandle(int which, MethodHandle mh) { // Simulate a CAS, to avoid racy duplication of results. - MethodHandle prev = methodHandles[which]; - if (prev != null) return prev; - return methodHandles[which] = mh; + SoftReference<MethodHandle> entry = methodHandles[which]; + if (entry != null) { + MethodHandle prev = entry.get(); + if (prev != null) { + return prev; + } + } + methodHandles[which] = new SoftReference<>(mh); + return mh; } public LambdaForm cachedLambdaForm(int which) { assert(assertIsBasicType()); - return lambdaForms[which]; + SoftReference<LambdaForm> entry = lambdaForms[which]; + return (entry != null) ? entry.get() : null; } synchronized public LambdaForm setCachedLambdaForm(int which, LambdaForm form) { // Simulate a CAS, to avoid racy duplication of results. - LambdaForm prev = lambdaForms[which]; - if (prev != null) return prev; - return lambdaForms[which] = form; + SoftReference<LambdaForm> entry = lambdaForms[which]; + if (entry != null) { + LambdaForm prev = entry.get(); + if (prev != null) { + return prev; + } + } + lambdaForms[which] = new SoftReference<>(form); + return form; } /** @@ -135,6 +148,7 @@ final class MethodTypeForm { * This MTF will stand for that type and all un-erased variations. * Eagerly compute some basic properties of the type, common to all variations. */ + @SuppressWarnings({"rawtypes", "unchecked"}) protected MethodTypeForm(MethodType erasedType) { this.erasedType = erasedType; @@ -234,8 +248,8 @@ final class MethodTypeForm { // Initialize caches, but only for basic types assert(basicType == erasedType); - this.lambdaForms = new LambdaForm[LF_LIMIT]; - this.methodHandles = new MethodHandle[MH_LIMIT]; + this.lambdaForms = new SoftReference[LF_LIMIT]; + this.methodHandles = new SoftReference[MH_LIMIT]; } private static long pack(int a, int b, int c, int d) { @@ -409,5 +423,4 @@ final class MethodTypeForm { public String toString() { return "Form"+erasedType; } - } diff --git a/src/share/classes/java/lang/reflect/AccessibleObject.java b/src/share/classes/java/lang/reflect/AccessibleObject.java index 0bf5e0eea4..45e051c454 100644 --- a/src/share/classes/java/lang/reflect/AccessibleObject.java +++ b/src/share/classes/java/lang/reflect/AccessibleObject.java @@ -140,13 +140,6 @@ public class AccessibleObject implements AnnotatedElement { throw new SecurityException("Cannot make a java.lang.Class" + " constructor accessible"); } - } else if (obj instanceof Field && flag == true) { - Field f = (Field)obj; - if (f.getDeclaringClass() == Class.class && - f.getName().equals("classLoader")) { - throw new SecurityException("Cannot make java.lang.Class.classLoader" + - " accessible"); - } } obj.override = flag; } diff --git a/src/share/classes/java/util/SplittableRandom.java b/src/share/classes/java/util/SplittableRandom.java index 00de113a6f..285655d40c 100644 --- a/src/share/classes/java/util/SplittableRandom.java +++ b/src/share/classes/java/util/SplittableRandom.java @@ -25,7 +25,6 @@ package java.util; -import java.net.NetworkInterface; import java.util.concurrent.atomic.AtomicLong; import java.util.function.IntConsumer; import java.util.function.LongConsumer; @@ -140,11 +139,10 @@ public final class SplittableRandom { * other cases, this split must be performed in a thread-safe * manner, so we use an AtomicLong to represent the seed rather * than use an explicit SplittableRandom. To bootstrap the - * defaultGen, we start off using a seed based on current time and - * network interface address unless the java.util.secureRandomSeed - * property is set. This serves as a slimmed-down (and insecure) - * variant of SecureRandom that also avoids stalls that may occur - * when using /dev/random. + * defaultGen, we start off using a seed based on current time + * unless the java.util.secureRandomSeed property is set. This + * serves as a slimmed-down (and insecure) variant of SecureRandom + * that also avoids stalls that may occur when using /dev/random. * * It is a relatively simple matter to apply the basic design here * to use 128 bit seeds. However, emulating 128bit arithmetic and @@ -237,34 +235,7 @@ public final class SplittableRandom { s = (s << 8) | ((long)(seedBytes[i]) & 0xffL); return s; } - long h = 0L; - try { - Enumeration<NetworkInterface> ifcs = - NetworkInterface.getNetworkInterfaces(); - boolean retry = false; // retry once if getHardwareAddress is null - while (ifcs.hasMoreElements()) { - NetworkInterface ifc = ifcs.nextElement(); - if (!ifc.isVirtual()) { // skip fake addresses - byte[] bs = ifc.getHardwareAddress(); - if (bs != null) { - int n = bs.length; - int m = Math.min(n >>> 1, 4); - for (int i = 0; i < m; ++i) - h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i]; - if (m < 4) - h = (h << 8) ^ bs[n-1-m]; - h = mix64(h); - break; - } - else if (!retry) - retry = true; - else - break; - } - } - } catch (Exception ignore) { - } - return (h ^ mix64(System.currentTimeMillis()) ^ + return (mix64(System.currentTimeMillis()) ^ mix64(System.nanoTime())); } diff --git a/src/share/classes/java/util/concurrent/ThreadLocalRandom.java b/src/share/classes/java/util/concurrent/ThreadLocalRandom.java index 2606bed44b..95cc6549b9 100644 --- a/src/share/classes/java/util/concurrent/ThreadLocalRandom.java +++ b/src/share/classes/java/util/concurrent/ThreadLocalRandom.java @@ -36,8 +36,6 @@ package java.util.concurrent; import java.io.ObjectStreamField; -import java.net.NetworkInterface; -import java.util.Enumeration; import java.util.Random; import java.util.Spliterator; import java.util.concurrent.atomic.AtomicInteger; @@ -147,34 +145,7 @@ public class ThreadLocalRandom extends Random { s = (s << 8) | ((long)(seedBytes[i]) & 0xffL); return s; } - long h = 0L; - try { - Enumeration<NetworkInterface> ifcs = - NetworkInterface.getNetworkInterfaces(); - boolean retry = false; // retry once if getHardwareAddress is null - while (ifcs.hasMoreElements()) { - NetworkInterface ifc = ifcs.nextElement(); - if (!ifc.isVirtual()) { // skip fake addresses - byte[] bs = ifc.getHardwareAddress(); - if (bs != null) { - int n = bs.length; - int m = Math.min(n >>> 1, 4); - for (int i = 0; i < m; ++i) - h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i]; - if (m < 4) - h = (h << 8) ^ bs[n-1-m]; - h = mix64(h); - break; - } - else if (!retry) - retry = true; - else - break; - } - } - } catch (Exception ignore) { - } - return (h ^ mix64(System.currentTimeMillis()) ^ + return (mix64(System.currentTimeMillis()) ^ mix64(System.nanoTime())); } diff --git a/src/share/classes/java/util/jar/Attributes.java b/src/share/classes/java/util/jar/Attributes.java index 026b2a88eb..795b80900d 100644 --- a/src/share/classes/java/util/jar/Attributes.java +++ b/src/share/classes/java/util/jar/Attributes.java @@ -550,8 +550,8 @@ public class Attributes implements Map<Object,Object>, Cloneable { * <code>Name</code> object for <code>Class-Path</code> * manifest attribute. Bundled extensions can use this attribute * to find other JAR files containing needed classes. - * @see <a href="../../../../technotes/guides/extensions/spec.html#bundled"> - * Extensions Specification</a> + * @see <a href="../../../../technotes/guides/jar/jar.html#classpath"> + * JAR file specification</a> */ public static final Name CLASS_PATH = new Name("Class-Path"); @@ -567,8 +567,8 @@ public class Attributes implements Map<Object,Object>, Cloneable { /** * <code>Name</code> object for <code>Sealed</code> manifest attribute * used for sealing. - * @see <a href="../../../../technotes/guides/extensions/spec.html#sealing"> - * Extension Sealing</a> + * @see <a href="../../../../technotes/guides/jar/jar.html#sealing"> + * Package Sealing</a> */ public static final Name SEALED = new Name("Sealed"); @@ -591,9 +591,12 @@ public class Attributes implements Map<Object,Object>, Cloneable { /** * <code>Name</code> object for <code>Extension-Name</code> manifest attribute * used for declaring dependencies on installed extensions. + * @deprecated Extension mechanism will be removed in a future release. + * Use class path instead. * @see <a href="../../../../technotes/guides/extensions/spec.html#dependency"> * Installed extension dependency</a> */ + @Deprecated public static final Name EXTENSION_INSTALLATION = new Name("Extension-Installation"); /** @@ -623,17 +626,23 @@ public class Attributes implements Map<Object,Object>, Cloneable { /** * <code>Name</code> object for <code>Implementation-Vendor-Id</code> * manifest attribute used for package versioning. - * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779"> - * Java Product Versioning Specification</a> + * @deprecated Extension mechanism will be removed in a future release. + * Use class path instead. + * @see <a href="../../../../technotes/guides/extensions/versioning.html#applet"> + * Optional Package Versioning</a> */ + @Deprecated public static final Name IMPLEMENTATION_VENDOR_ID = new Name("Implementation-Vendor-Id"); /** * <code>Name</code> object for <code>Implementation-URL</code> * manifest attribute used for package versioning. - * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779"> - * Java Product Versioning Specification</a> + * @deprecated Extension mechanism will be removed in a future release. + * Use class path instead. + * @see <a href="../../../../technotes/guides/extensions/versioning.html#applet"> + * Optional Package Versioning</a> */ + @Deprecated public static final Name IMPLEMENTATION_URL = new Name("Implementation-URL"); /** diff --git a/src/share/classes/java/util/logging/LogManager.java b/src/share/classes/java/util/logging/LogManager.java index 6c12f49f8c..1681c8bd35 100644 --- a/src/share/classes/java/util/logging/LogManager.java +++ b/src/share/classes/java/util/logging/LogManager.java @@ -502,11 +502,11 @@ public class LogManager { JavaAWTAccess javaAwtAccess = SharedSecrets.getJavaAWTAccess(); if (sm != null && javaAwtAccess != null) { // for each applet, it has its own LoggerContext isolated from others - synchronized (javaAwtAccess) { - // find the AppContext of the applet code - // will be null if we are in the main app context. - final Object ecx = javaAwtAccess.getAppletContext(); - if (ecx != null) { + final Object ecx = javaAwtAccess.getAppletContext(); + if (ecx != null) { + synchronized (javaAwtAccess) { + // find the AppContext of the applet code + // will be null if we are in the main app context. if (contextsMap == null) { contextsMap = new WeakHashMap<>(); } diff --git a/src/share/classes/javax/swing/JComboBox.java b/src/share/classes/javax/swing/JComboBox.java index 6e71c43cb8..0862f437a5 100644 --- a/src/share/classes/javax/swing/JComboBox.java +++ b/src/share/classes/javax/swing/JComboBox.java @@ -1308,8 +1308,8 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { */ public void actionPerformed(ActionEvent e) { ComboBoxEditor editor = getEditor(); - if ((editor != null) && (e != null) - && (editor.getEditorComponent() == e.getSource())) { + if ((editor != null) && (e != null) && (editor == e.getSource() + || editor.getEditorComponent() == e.getSource())) { setPopupVisible(false); getModel().setSelectedItem(editor.getItem()); String oldCommand = getActionCommand(); diff --git a/src/share/classes/sun/awt/datatransfer/DataTransferer.java b/src/share/classes/sun/awt/datatransfer/DataTransferer.java index e1677b9c84..79c2792800 100644 --- a/src/share/classes/sun/awt/datatransfer/DataTransferer.java +++ b/src/share/classes/sun/awt/datatransfer/DataTransferer.java @@ -274,7 +274,7 @@ public abstract class DataTransferer { * instead, null will be returned. */ public static synchronized DataTransferer getInstance() { - return ((SunToolkit) Toolkit.getDefaultToolkit()).getDataTransferer(); + return ((ComponentFactory) Toolkit.getDefaultToolkit()).getDataTransferer(); } /** diff --git a/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java b/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java index bde59ab627..46ef09fdbe 100644 --- a/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java +++ b/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java @@ -80,7 +80,7 @@ public class MultiResolutionToolkitImage extends ToolkitImage implements MultiRe } synchronized (ObserverCache.INSTANCE) { - ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(image); + ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(observer); if (o == null) { @@ -109,7 +109,7 @@ public class MultiResolutionToolkitImage extends ToolkitImage implements MultiRe image, flags, x, y, width, height); }; - ObserverCache.INSTANCE.put(image, o); + ObserverCache.INSTANCE.put(observer, o); } return o; } diff --git a/src/share/classes/sun/java2d/pipe/DrawImage.java b/src/share/classes/sun/java2d/pipe/DrawImage.java index 6b10d247e4..cfa130b819 100644 --- a/src/share/classes/sun/java2d/pipe/DrawImage.java +++ b/src/share/classes/sun/java2d/pipe/DrawImage.java @@ -364,8 +364,53 @@ public class DrawImage implements DrawImagePipe int sx1, int sy1, int sx2, int sy2, Color bgColor) { + final AffineTransform itx; + try { + itx = tx.createInverse(); + } catch (final NoninvertibleTransformException ignored) { + // Non-invertible transform means no output + return; + } + + /* + * Find the maximum bounds on the destination that will be + * affected by the transformed source. First, transform all + * four corners of the source and then min and max the resulting + * destination coordinates of the transformed corners. + * Note that tx already has the offset to sx1,sy1 accounted + * for so we use the box (0, 0, sx2-sx1, sy2-sy1) as the + * source coordinates. + */ + final double[] coords = new double[8]; + /* corner: UL UR LL LR */ + /* index: 0 1 2 3 4 5 6 7 */ + /* coord: (0, 0), (w, 0), (0, h), (w, h) */ + coords[2] = coords[6] = sx2 - sx1; + coords[5] = coords[7] = sy2 - sy1; + tx.transform(coords, 0, coords, 0, 4); + double ddx1, ddy1, ddx2, ddy2; + ddx1 = ddx2 = coords[0]; + ddy1 = ddy2 = coords[1]; + for (int i = 2; i < coords.length; i += 2) { + double d = coords[i]; + if (ddx1 > d) ddx1 = d; + else if (ddx2 < d) ddx2 = d; + d = coords[i+1]; + if (ddy1 > d) ddy1 = d; + else if (ddy2 < d) ddy2 = d; + } + Region clip = sg.getCompClip(); - SurfaceData dstData = sg.surfaceData; + final int dx1 = Math.max((int) Math.floor(ddx1), clip.lox); + final int dy1 = Math.max((int) Math.floor(ddy1), clip.loy); + final int dx2 = Math.min((int) Math.ceil(ddx2), clip.hix); + final int dy2 = Math.min((int) Math.ceil(ddy2), clip.hiy); + if (dx2 <= dx1 || dy2 <= dy1) { + // empty destination means no output + return; + } + + final SurfaceData dstData = sg.surfaceData; SurfaceData srcData = dstData.getSourceSurfaceData(img, SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, @@ -429,56 +474,13 @@ public class DrawImage implements DrawImagePipe // assert(helper != null); } - AffineTransform itx; - try { - itx = tx.createInverse(); - } catch (NoninvertibleTransformException e) { - // Non-invertible transform means no output - return; - } - - /* - * Find the maximum bounds on the destination that will be - * affected by the transformed source. First, transform all - * four corners of the source and then min and max the resulting - * destination coordinates of the transformed corners. - * Note that tx already has the offset to sx1,sy1 accounted - * for so we use the box (0, 0, sx2-sx1, sy2-sy1) as the - * source coordinates. - */ - double coords[] = new double[8]; - /* corner: UL UR LL LR */ - /* index: 0 1 2 3 4 5 6 7 */ - /* coord: (0, 0), (w, 0), (0, h), (w, h) */ - coords[2] = coords[6] = sx2 - sx1; - coords[5] = coords[7] = sy2 - sy1; - tx.transform(coords, 0, coords, 0, 4); - double ddx1, ddy1, ddx2, ddy2; - ddx1 = ddx2 = coords[0]; - ddy1 = ddy2 = coords[1]; - for (int i = 2; i < coords.length; i += 2) { - double d = coords[i]; - if (ddx1 > d) ddx1 = d; - else if (ddx2 < d) ddx2 = d; - d = coords[i+1]; - if (ddy1 > d) ddy1 = d; - else if (ddy2 < d) ddy2 = d; - } - int dx1 = (int) Math.floor(ddx1); - int dy1 = (int) Math.floor(ddy1); - int dx2 = (int) Math.ceil(ddx2); - int dy2 = (int) Math.ceil(ddy2); - SurfaceType dstType = dstData.getSurfaceType(); - MaskBlit maskblit; - Blit blit; if (sg.compositeState <= SunGraphics2D.COMP_ALPHA) { /* NOTE: We either have, or we can make, * a MaskBlit for any alpha composite type */ - maskblit = MaskBlit.getFromCache(SurfaceType.IntArgbPre, - sg.imageComp, - dstType); + MaskBlit maskblit = MaskBlit.getFromCache(SurfaceType.IntArgbPre, + sg.imageComp, dstType); /* NOTE: We can only use the native TransformHelper * func to go directly to the dest if both the helper @@ -496,27 +498,19 @@ public class DrawImage implements DrawImagePipe null, 0, 0); return; } - blit = null; - } else { - /* NOTE: We either have, or we can make, - * a Blit for any composite type, even Custom - */ - maskblit = null; - blit = Blit.getFromCache(SurfaceType.IntArgbPre, - sg.imageComp, - dstType); } // We need to transform to a temp image and then copy // just the pieces that are valid data to the dest. - BufferedImage tmpimg = new BufferedImage(dx2-dx1, dy2-dy1, + final int w = dx2 - dx1; + final int h = dy2 - dy1; + BufferedImage tmpimg = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE); SurfaceData tmpData = SurfaceData.getPrimarySurfaceData(tmpimg); SurfaceType tmpType = tmpData.getSurfaceType(); - MaskBlit tmpmaskblit = - MaskBlit.getFromCache(SurfaceType.IntArgbPre, - CompositeType.SrcNoEa, - tmpType); + MaskBlit tmpmaskblit = MaskBlit.getFromCache(SurfaceType.IntArgbPre, + CompositeType.SrcNoEa, + tmpType); /* * The helper function fills a temporary edges buffer * for us with the bounding coordinates of each scanline @@ -531,7 +525,7 @@ public class DrawImage implements DrawImagePipe * * edges thus has to be h*2+2 in length */ - int edges[] = new int[(dy2-dy1)*2+2]; + final int[] edges = new int[h * 2 + 2]; // It is important that edges[0]=edges[1]=0 when we call // Transform in case it must return early and we would // not want to render anything on an error condition. @@ -539,35 +533,17 @@ public class DrawImage implements DrawImagePipe AlphaComposite.Src, null, itx, interpType, sx1, sy1, sx2, sy2, - 0, 0, dx2-dx1, dy2-dy1, + 0, 0, w, h, edges, dx1, dy1); - /* - * Now copy the results, scanline by scanline, into the dest. - * The edges array helps us minimize the work. + final Region region = Region.getInstance(dx1, dy1, dx2, dy2, edges); + clip = clip.getIntersection(region); + + /* NOTE: We either have, or we can make, + * a Blit for any composite type, even Custom */ - int index = 2; - for (int y = edges[0]; y < edges[1]; y++) { - int relx1 = edges[index++]; - int relx2 = edges[index++]; - if (relx1 >= relx2) { - continue; - } - if (maskblit != null) { - maskblit.MaskBlit(tmpData, dstData, - sg.composite, clip, - relx1, y, - dx1+relx1, dy1+y, - relx2 - relx1, 1, - null, 0, 0); - } else { - blit.Blit(tmpData, dstData, - sg.composite, clip, - relx1, y, - dx1+relx1, dy1+y, - relx2 - relx1, 1); - } - } + final Blit blit = Blit.getFromCache(tmpType, sg.imageComp, dstType); + blit.Blit(tmpData, dstData, sg.composite, clip, 0, 0, dx1, dy1, w, h); } // Render an image using only integer translation diff --git a/src/share/classes/sun/java2d/pipe/Region.java b/src/share/classes/sun/java2d/pipe/Region.java index d3981268e7..dc0460b786 100644 --- a/src/share/classes/sun/java2d/pipe/Region.java +++ b/src/share/classes/sun/java2d/pipe/Region.java @@ -30,6 +30,8 @@ import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.RectangularShape; +import sun.java2d.loops.TransformHelper; + /** * This class encapsulates a definition of a two dimensional region which * consists of a number of Y ranges each containing multiple X bands. @@ -160,6 +162,15 @@ public class Region { this.hiy = hiy; } + private Region(int lox, int loy, int hix, int hiy, int[] bands, int end) { + this.lox = lox; + this.loy = loy; + this.hix = hix; + this.hiy = hiy; + this.bands = bands; + this.endIndex = end; + } + /** * Returns a Region object covering the pixels which would be * touched by a fill or clip operation on a Graphics implementation @@ -256,6 +267,44 @@ public class Region { } /** + * Returns a Region object with a rectangle of interest specified by the + * indicated rectangular area in lox, loy, hix, hiy and edges array, which + * is located relative to the rectangular area. Edges array - 0,1 are y + * range, 2N,2N+1 are x ranges, 1 per y range. + * + * @see TransformHelper + */ + static Region getInstance(final int lox, final int loy, final int hix, + final int hiy, final int[] edges) { + final int y1 = edges[0]; + final int y2 = edges[1]; + if (hiy <= loy || hix <= lox || y2 <= y1) { + return EMPTY_REGION; + } + // rowsNum * (3 + 1 * 2) + final int[] bands = new int[(y2 - y1) * 5]; + int end = 0; + int index = 2; + for (int y = y1; y < y2; ++y) { + final int spanlox = Math.max(clipAdd(lox, edges[index++]), lox); + final int spanhix = Math.min(clipAdd(lox, edges[index++]), hix); + if (spanlox < spanhix) { + final int spanloy = Math.max(clipAdd(loy, y), loy); + final int spanhiy = Math.min(clipAdd(spanloy, 1), hiy); + if (spanloy < spanhiy) { + bands[end++] = spanloy; + bands[end++] = spanhiy; + bands[end++] = 1; // 1 span per row + bands[end++] = spanlox; + bands[end++] = spanhix; + } + } + } + return end != 0 ? new Region(lox, loy, hix, hiy, bands, end) + : EMPTY_REGION; + } + + /** * Returns a Region object with a rectangle of interest specified * by the indicated Rectangle object. * <p> diff --git a/src/share/classes/sun/reflect/Reflection.java b/src/share/classes/sun/reflect/Reflection.java index 63baa42aba..bc3e13e23c 100644 --- a/src/share/classes/sun/reflect/Reflection.java +++ b/src/share/classes/sun/reflect/Reflection.java @@ -46,6 +46,7 @@ public class Reflection { map.put(Reflection.class, new String[] {"fieldFilterMap", "methodFilterMap"}); map.put(System.class, new String[] {"security"}); + map.put(Class.class, new String[] {"classLoader"}); fieldFilterMap = map; methodFilterMap = new HashMap<>(); diff --git a/src/share/native/sun/java2d/opengl/OGLBlitLoops.c b/src/share/native/sun/java2d/opengl/OGLBlitLoops.c index fa9a2fe34a..c96791f76c 100644 --- a/src/share/native/sun/java2d/opengl/OGLBlitLoops.c +++ b/src/share/native/sun/java2d/opengl/OGLBlitLoops.c @@ -674,6 +674,9 @@ OGLBlitLoops_Blit(JNIEnv *env, viaTexture = JNI_TRUE; break; #endif + case OGLC_VENDOR_INTEL: + viaTexture = JNI_TRUE; + break; default: // just use the glDrawPixels() codepath viaTexture = JNI_FALSE; diff --git a/src/share/native/sun/java2d/opengl/OGLContext.c b/src/share/native/sun/java2d/opengl/OGLContext.c index 013949126a..af1eb9c1ad 100644 --- a/src/share/native/sun/java2d/opengl/OGLContext.c +++ b/src/share/native/sun/java2d/opengl/OGLContext.c @@ -917,8 +917,8 @@ OGLContext_GetExtensionInfo(JNIEnv *env, jint *caps) vcap = OGLC_VENDOR_ATI; } else if (strncmp(vendor, "NVIDIA", 6) == 0) { vcap = OGLC_VENDOR_NVIDIA; - } else if (strncmp(vendor, "Sun", 3) == 0) { - vcap = OGLC_VENDOR_SUN; + } else if (strncmp(vendor, "Intel", 5) == 0) { + vcap = OGLC_VENDOR_INTEL; } // REMIND: new in 7 - check if needs fixing *caps |= ((vcap & OGLC_VCAP_MASK) << OGLC_VCAP_OFFSET); diff --git a/src/share/native/sun/java2d/opengl/OGLContext.h b/src/share/native/sun/java2d/opengl/OGLContext.h index 0f44232f31..27c5cec590 100644 --- a/src/share/native/sun/java2d/opengl/OGLContext.h +++ b/src/share/native/sun/java2d/opengl/OGLContext.h @@ -152,7 +152,7 @@ typedef struct { #define OGLC_VENDOR_OTHER 0 #define OGLC_VENDOR_ATI 1 #define OGLC_VENDOR_NVIDIA 2 -#define OGLC_VENDOR_SUN 3 +#define OGLC_VENDOR_INTEL 3 #define OGLC_VCAP_MASK 0x3 #define OGLC_VCAP_OFFSET 24 |