This commit is contained in:
Lana Steuck 2015-05-14 20:15:26 -07:00
commit e2f7063479
446 changed files with 11550 additions and 7966 deletions
jdk
make
src
java.base
java.desktop

@ -396,7 +396,7 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
$(eval $(call SetupNativeCompilation,BUILD_LIBPOLLER, \
SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(SHARED_LIBRARY_FLAGS) \
CFLAGS := $(CFLAGS_JDKLIB) \
-I$(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \
LDFLAGS := $(LDFLAGS_JDKLIB), \
LDFLAGS_SUFFIX_solaris := -lc, \

@ -1833,10 +1833,3 @@ charset x-JIS0212_MS5022X JIS_X_0212_MS5022X
##
########################################################
charset x-COMPOUND_TEXT COMPOUND_TEXT
package sun.nio.cs.ext
type source
os unix
alias COMPOUND_TEXT # JDK historical
alias x11-compound_text
alias x-compound-text

@ -39,7 +39,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
CFLAGS := $(filter-out -Zc:wchar_t-, $(CFLAGS_JDKEXE)) -Zc:wchar_t \
-analyze- -Od -Gd -D_WINDOWS \
-D_UNICODE -DUNICODE -RTC1 -EHsc, \
DISABLED_WARNINGS_microsoft := 4267, \
DISABLED_WARNINGS_microsoft := 4267 4996, \
LDFLAGS := $(LDFLAGS_JDKEXE) \
Advapi32.lib Version.lib User32.lib, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jabswitch, \

@ -84,6 +84,7 @@ $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
CFLAGS_linux := -fPIC, \
CFLAGS_solaris := -KPIC, \
CFLAGS_macosx := -fPIC, \
DISABLED_WARNINGS_gcc := unused-result, \
MAPFILE := $(UNPACK_MAPFILE),\
LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \

@ -246,9 +246,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
format-nonliteral parentheses, \
DISABLED_WARNINGS_clang := logical-op-parentheses, \
DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
DISABLED_WARNINGS_microsoft := 4297 4244 4267, \
DISABLED_WARNINGS_microsoft := 4297 4244 4267 4996, \
WARNINGS_AS_ERRORS_gcc := false, \
ASFLAGS := $(LIBAWT_ASFLAGS), \
MAPFILE := $(LIBAWT_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
@ -357,6 +358,7 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
format-security int-to-pointer-cast parentheses, \
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
WARNINGS_AS_ERRORS_gcc := false, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_xawt/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(X_LIBS) $(LIBAWT_XAWT_LDFLAGS) \
@ -408,11 +410,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
OPTIMIZATION := HIGHEST, \
CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
$(SHARED_LIBRARY_FLAGS) $(LIBLCMS_CPPFLAGS) \
$(LIBLCMS_CPPFLAGS) \
$(LCMS_CFLAGS), \
CFLAGS_solaris := -xc99=no_lib, \
CFLAGS_windows := -DCMS_IS_WINDOWS_, \
DISABLED_WARNINGS_gcc := format-nonliteral, \
DISABLED_WARNINGS_gcc := format-nonliteral type-limits, \
DISABLED_WARNINGS_clang := tautological-compare, \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
@ -647,10 +649,13 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
CFLAGS_windows = -DCC_NOEX, \
DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast reorder \
delete-non-virtual-dtor, \
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types, \
delete-non-virtual-dtor type-limits, \
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
tautological-constant-out-of-range-compare int-to-pointer-cast, \
DISABLED_WARNINGS_solstudio := truncwarn, \
DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090, \
DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146, \
WARNINGS_AS_ERRORS_gcc := false, \
WARNINGS_AS_ERRORS_solstudio := false, \
MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@ -880,10 +885,10 @@ ifndef BUILD_HEADLESS_ONLY
OPTIMIZATION := LOW, \
CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
$(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
DISABLED_WARNINGS_gcc := type-limits unused-result maybe-uninitialized, \
DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result maybe-uninitialized, \
DISABLED_WARNINGS_clang := incompatible-pointer-types, \
DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST, \
DISABLED_WARNINGS_microsoft := 4244 4267, \
DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE, \
DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@ -956,6 +961,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
DISABLED_WARNINGS_clang := incomplete-implementation \
deprecated-declarations objc-method-access bitwise-op-parentheses \
incompatible-pointer-types parentheses-equality extra-tokens, \
WARNINGS_AS_ERRORS_clang := false, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN) \
-L$(INSTALL_LIBRARIES_HERE), \

@ -149,7 +149,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
DISABLED_WARNINGS_gcc := type-limits format-nonliteral, \
DISABLED_WARNINGS_clang := int-conversion, \
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
DISABLED_WARNINGS_microsoft := 4022 4267, \
DISABLED_WARNINGS_microsoft := 4022 4267 4996, \
WARNINGS_AS_ERRORS_solstudio := false, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \

@ -38,6 +38,7 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(addprefix -I, $(LIBJ2UCRYPTO_SRC)), \
DISABLED_WARNINGS_solstudio := E_MACRO_REDEFINED, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2ucrypto/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB), \
LDFLAGS_SUFFIX := $(LIBDL), \

@ -34,7 +34,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNET, \
$(LIBJAVA_HEADER_FLAGS) $(addprefix -I, $(LIBNET_SRC_DIRS)), \
DISABLED_WARNINGS_gcc := format-nonliteral, \
DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
DISABLED_WARNINGS_microsoft := 4244 4047 4133, \
DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnet/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \

@ -70,7 +70,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
$(BUILD_LIBNIO_CFLAGS), \
DISABLED_WARNINGS_gcc := type-limits, \
DISABLED_WARNINGS_clang := tautological-compare, \
DISABLED_WARNINGS_microsoft := 4244, \
DISABLED_WARNINGS_microsoft := 4244 4996, \
MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
$(call SET_SHARED_LIBRARY_ORIGIN), \

@ -111,10 +111,6 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
endif # OPENJDK_TARGET_OS solaris
ifeq ($(OPENJDK_TARGET_CPU), aarch64)
LIBJSOUND_CFLAGS += -DX_ARCH=X_AARCH64
endif
LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
@ -129,6 +125,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
DISABLED_WARNINGS_clang := implicit-function-declaration \
deprecated-writable-strings, \
WARNINGS_AS_ERRORS_clang := false, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \

@ -948,8 +948,15 @@ SetMainClassForAWT(JNIEnv *env, jclass mainClass) {
jmethodID getCanonicalNameMID = NULL;
NULL_CHECK(getCanonicalNameMID = (*env)->GetMethodID(env, classClass, "getCanonicalName", "()Ljava/lang/String;"));
jstring mainClassString = NULL;
NULL_CHECK(mainClassString = (*env)->CallObjectMethod(env, mainClass, getCanonicalNameMID));
jstring mainClassString = (*env)->CallObjectMethod(env, mainClass, getCanonicalNameMID);
if ((*env)->ExceptionCheck(env)) {
/*
* Clears all errors caused by getCanonicalName() on the mainclass and
* leaves the JAVA_MAIN_CLASS__<pid> empty.
*/
(*env)->ExceptionClear(env);
return;
}
const char *mainClassName = NULL;
NULL_CHECK(mainClassName = (*env)->GetStringUTFChars(env, mainClassString, NULL));
@ -1056,7 +1063,7 @@ JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
* Note the jvmInstance must be initialized first before entering into
* ShowSplashScreen, as there is a callback into the JLI_GetJavaVMInstance.
*/
void PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm) {
void PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm) {
jvmInstance = vm;
SetMainClassForAWT(env, mainClass);
CHECK_EXCEPTION_RETURN();

@ -272,6 +272,7 @@ public class BufferedReader extends Reader {
* stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
synchronized (lock) {

@ -116,6 +116,7 @@ public class CharArrayReader extends Reader {
* the end of the stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char b[], int off, int len) throws IOException {
synchronized (lock) {

@ -69,6 +69,7 @@ public abstract class FilterReader extends Reader {
* Reads characters into a portion of an array.
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
return in.read(cbuf, off, len);

@ -179,6 +179,7 @@ public class InputStreamReader extends Reader {
* stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int offset, int length) throws IOException {
return sd.read(cbuf, offset, length);

@ -159,6 +159,8 @@ public class LineNumberReader extends BufferedReader {
*
* @throws IOException
* If an I/O error occurs
*
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
@SuppressWarnings("fallthrough")
public int read(char cbuf[], int off, int len) throws IOException {

@ -286,6 +286,7 @@ public class PipedReader extends Reader {
* <a href=PipedInputStream.html#BROKEN> <code>broken</code></a>,
* {@link #connect(java.io.PipedWriter) unconnected}, closed,
* or an I/O error occurs.
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public synchronized int read(char cbuf[], int off, int len) throws IOException {
if (!connected) {

@ -102,6 +102,7 @@ public class PushbackReader extends FilterReader {
* stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
synchronized (lock) {

@ -153,6 +153,9 @@ public abstract class Reader implements Readable, Closeable {
* stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException
* If {@code off} is negative, or {@code len} is negative,
* or {@code len} is greater than {@code cbuf.length - off}
*/
abstract public int read(char cbuf[], int off, int len) throws IOException;

@ -84,6 +84,7 @@ public class StringReader extends Reader {
* stream has been reached
*
* @exception IOException If an I/O error occurs
* @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
synchronized (lock) {

@ -26,12 +26,24 @@
package java.lang.annotation;
/**
* Indicates that annotations with a type are to be documented by javadoc
* and similar tools by default. This type should be used to annotate the
* declarations of types whose annotations affect the use of annotated
* elements by their clients. If a type declaration is annotated with
* Documented, its annotations become part of the public API
* of the annotated elements.
* If the annotation {@code @Documented} is present on the declaration
* of an annotation type <i>A</i>, then any {@code @A} annotation on
* an element is considered part of the element's public contract.
*
* In more detail, when an annotation type <i>A</i> is annotated with
* {@code Documented}, the presence and value of annotations of type
* <i>A</i> are a part of the public contract of the elements <i>A</i>
* annotates.
*
* Conversely, if an annotation type <i>B</i> is <em>not</em>
* annotated with {@code Documented}, the presence and value of
* <i>B</i> annotations are <em>not</em> part of the public contract
* of the elements <i>B</i> annotates.
*
* Concretely, if an annotation type is annotated with {@code
* Documented}, by default a tool like javadoc will display
* annotations of that type in its output while annotations of
* annotation types without {@code Documented} will not be displayed.
*
* @author Joshua Bloch
* @since 1.5

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -49,7 +49,8 @@ import sun.security.util.SecurityConstants;
* implementation (a default subclass implementation of this abstract class).
* The default Policy implementation can be changed by setting the value
* of the {@code policy.provider} security property to the fully qualified
* name of the desired Policy subclass implementation.
* name of the desired Policy subclass implementation. The system class loader
* is used to load this class.
*
* <p> Application code can directly subclass Policy to provide a custom
* implementation. In addition, an instance of a Policy object can be
@ -111,6 +112,10 @@ public abstract class Policy {
private static final Debug debug = Debug.getInstance("policy");
// Default policy provider
private static final String DEFAULT_POLICY =
"sun.security.provider.PolicyFile";
// Cache mapping ProtectionDomain.Key to PermissionCollection
private WeakHashMap<ProtectionDomain.Key, PermissionCollection> pdMapping;
@ -169,74 +174,7 @@ public abstract class Policy {
synchronized (Policy.class) {
PolicyInfo pinfo = policy.get();
if (pinfo.policy == null) {
String policy_class = AccessController.doPrivileged(
new PrivilegedAction<>() {
public String run() {
return Security.getProperty("policy.provider");
}
});
if (policy_class == null) {
policy_class = "sun.security.provider.PolicyFile";
}
try {
pinfo = new PolicyInfo(
(Policy) Class.forName(policy_class).newInstance(),
true);
} catch (Exception e) {
/*
* The policy_class seems to be an extension
* so we have to bootstrap loading it via a policy
* provider that is on the bootclasspath.
* If it loads then shift gears to using the configured
* provider.
*/
// install the bootstrap provider to avoid recursion
Policy polFile = new sun.security.provider.PolicyFile();
pinfo = new PolicyInfo(polFile, false);
policy.set(pinfo);
final String pc = policy_class;
Policy pol = AccessController.doPrivileged(
new PrivilegedAction<>() {
public Policy run() {
try {
ClassLoader cl =
ClassLoader.getSystemClassLoader();
// we want the extension loader
ClassLoader extcl = null;
while (cl != null) {
extcl = cl;
cl = cl.getParent();
}
return (extcl != null ? (Policy)Class.forName(
pc, true, extcl).newInstance() : null);
} catch (Exception e) {
if (debug != null) {
debug.println("policy provider " +
pc +
" not available");
e.printStackTrace();
}
return null;
}
}
});
/*
* if it loaded install it as the policy provider. Otherwise
* continue to use the system default implementation
*/
if (pol != null) {
pinfo = new PolicyInfo(pol, true);
} else {
if (debug != null) {
debug.println("using sun.security.provider.PolicyFile");
}
pinfo = new PolicyInfo(polFile, true);
}
}
policy.set(pinfo);
return loadPolicyProvider();
}
return pinfo.policy;
}
@ -244,6 +182,70 @@ public abstract class Policy {
return pi.policy;
}
/**
* Loads and instantiates a Policy implementation specified by the
* policy.provider security property. Note that this method should only
* be called by getPolicyNoCheck and from within a synchronized block with
* an intrinsic lock on the Policy.class.
*/
private static Policy loadPolicyProvider() {
String policyProvider =
AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public String run() {
return Security.getProperty("policy.provider");
}
});
/*
* If policy.provider is not set or is set to the default provider,
* simply instantiate it and return.
*/
if (policyProvider == null || policyProvider.isEmpty() ||
policyProvider.equals(DEFAULT_POLICY))
{
Policy polFile = new sun.security.provider.PolicyFile();
policy.set(new PolicyInfo(polFile, true));
return polFile;
}
/*
* Locate, load, and instantiate the policy.provider impl using
* the system class loader. While doing so, install the bootstrap
* provider to avoid potential recursion.
*/
Policy polFile = new sun.security.provider.PolicyFile();
policy.set(new PolicyInfo(polFile, false));
Policy pol = AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public Policy run() {
try {
ClassLoader scl = ClassLoader.getSystemClassLoader();
Class<?> c = Class.forName(policyProvider, true, scl);
return (Policy)c.newInstance();
} catch (Exception e) {
if (debug != null) {
debug.println("policy provider " + policyProvider +
" not available");
e.printStackTrace();
}
return null;
}
}
});
if (pol == null) {
// Fallback and use the system default implementation
if (debug != null) {
debug.println("using " + DEFAULT_POLICY);
}
pol = polFile;
}
policy.set(new PolicyInfo(pol, true));
return pol;
}
/**
* Sets the system-wide Policy object. This method first calls
* {@code SecurityManager.checkPermission} with a

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, 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
@ -30,7 +30,12 @@ package java.security.cert;
* <p>
* This class is used to provide necessary configuration parameters (server
* name and port number) to implementations of the LDAP {@code CertStore}
* algorithm.
* algorithm. However, if you are retrieving certificates or CRLs from
* an ldap URI as specified by RFC 5280, use the
* {@link java.security.cert.URICertStoreParameters URICertStoreParameters}
* instead as the URI may contain additional information such as the
* distinguished name that will help the LDAP CertStore find the specific
* certificates and CRLs.
* <p>
* <b>Concurrent Access</b>
* <p>

@ -0,0 +1,149 @@
/*
* Copyright (c) 2015, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package java.security.cert;
import java.net.URI;
/**
* Parameters used as input for {@code CertStore} algorithms which use
* information contained in a URI to retrieve certificates and CRLs.
* <p>
* This class is used to provide necessary configuration parameters
* through a URI as defined in RFC 5280 to implementations of
* {@code CertStore} algorithms.
* <p>
* <b>Concurrent Access</b>
* <p>
* Unless otherwise specified, the methods defined in this class are not
* thread-safe. Multiple threads that need to access a single
* object concurrently should synchronize amongst themselves and
* provide the necessary locking. Multiple threads each manipulating
* separate objects need not synchronize.
*
* @since 1.9
* @see CertStore
* @see java.net.URI
*/
public final class URICertStoreParameters implements CertStoreParameters {
/**
* The uri, cannot be null
*/
private final URI uri;
/*
* Hash code for this parameters.
*/
private int myhash = -1;
/**
* Creates an instance of {@code URICertStoreParameters} with the
* specified URI.
*
* @param uri the URI which contains configuration information.
* @throws NullPointerException if {@code uri} is null
*/
public URICertStoreParameters(URI uri) {
if (uri == null) {
throw new NullPointerException();
}
this.uri = uri;
}
/**
* Returns the URI used to construct this
* {@code URICertStoreParameters} object.
*
* @return the URI.
*/
public URI getURI() {
return uri;
}
/**
* Returns a copy of this object. Changes to the copy will not affect
* the original and vice versa.
*
* @return the copy
*/
@Override
public URICertStoreParameters clone() {
try {
return new URICertStoreParameters(uri);
} catch (NullPointerException e) {
/* Cannot happen */
throw new InternalError(e.toString(), e);
}
}
/**
* Returns a hash code value for this parameters object.
* The hash code is generated using the URI supplied at construction.
*
* @return a hash code value for this parameters.
*/
@Override
public int hashCode() {
if (myhash == -1) {
myhash = uri.hashCode()*7;
}
return myhash;
}
/**
* Compares the specified object with this parameters object for equality.
* Two URICertStoreParameters are considered equal if the URIs used
* to construct them are equal.
*
* @param p the object to test for equality with this parameters.
*
* @return true if the specified object is equal to this parameters object.
*/
@Override
public boolean equals(Object p) {
if (p == null || (!(p instanceof URICertStoreParameters))) {
return false;
}
if (p == this) {
return true;
}
URICertStoreParameters other = (URICertStoreParameters)p;
return uri.equals(other.getURI());
}
/**
* Returns a formatted string describing the parameters
* including the URI used to construct this object.
*
* @return a formatted string describing the parameters
*/
@Override
public String toString() {
return "URICertStoreParameters: " + uri.toString();
}
}

@ -64,6 +64,7 @@ import java.util.function.DoubleBinaryOperator;
import java.util.function.Function;
import java.util.function.IntBinaryOperator;
import java.util.function.LongBinaryOperator;
import java.util.function.Predicate;
import java.util.function.ToDoubleBiFunction;
import java.util.function.ToDoubleFunction;
import java.util.function.ToIntBiFunction;
@ -1618,6 +1619,45 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
}
/**
* Helper method for EntrySet.removeIf
*/
boolean removeEntryIf(Predicate<? super Entry<K, V>> function) {
if (function == null) throw new NullPointerException();
Node<K,V>[] t;
boolean removed = false;
if ((t = table) != null) {
Traverser<K,V> it = new Traverser<K,V>(t, t.length, 0, t.length);
for (Node<K,V> p; (p = it.advance()) != null; ) {
K k = p.key;
V v = p.val;
Map.Entry<K,V> e = new AbstractMap.SimpleImmutableEntry<>(k, v);
if (function.test(e) && replaceNode(k, null, v) != null)
removed = true;
}
}
return removed;
}
/**
* Helper method for Values.removeIf
*/
boolean removeValueIf(Predicate<? super V> function) {
if (function == null) throw new NullPointerException();
Node<K,V>[] t;
boolean removed = false;
if ((t = table) != null) {
Traverser<K,V> it = new Traverser<K,V>(t, t.length, 0, t.length);
for (Node<K,V> p; (p = it.advance()) != null; ) {
K k = p.key;
V v = p.val;
if (function.test(v) && replaceNode(k, null, v) != null)
removed = true;
}
}
return removed;
}
/**
* If the specified key is not already associated with a value,
* attempts to compute its value using the given mapping function
@ -4690,6 +4730,10 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
throw new UnsupportedOperationException();
}
public boolean removeIf(Predicate<? super V> filter) {
return map.removeValueIf(filter);
}
public Spliterator<V> spliterator() {
Node<K,V>[] t;
ConcurrentHashMap<K,V> m = map;
@ -4759,6 +4803,10 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
return added;
}
public boolean removeIf(Predicate<? super Entry<K, V>> filter) {
return map.removeEntryIf(filter);
}
public final int hashCode() {
int h = 0;
Node<K,V>[] t;

@ -34,6 +34,7 @@
*/
package java.util.concurrent;
import java.util.Map;
import java.util.Objects;
import java.util.function.BiConsumer;
@ -44,6 +45,14 @@ import java.util.function.Function;
* A {@link java.util.Map} providing thread safety and atomicity
* guarantees.
*
* <p>To maintain the specified guarantees, default implementations of
* methods including {@link #putIfAbsent} inherited from {@link Map}
* must be overridden by implementations of this interface. Similarly,
* implementations of the collections returned by methods {@link
* #keySet}, {@link #values}, and {@link #entrySet} must override
* methods such as {@code removeIf} when necessary to
* preserve atomicity guarantees.
*
* <p>Memory consistency effects: As with other concurrent
* collections, actions in a thread prior to placing an object into a
* {@code ConcurrentMap} as a key or value
@ -60,7 +69,7 @@ import java.util.function.Function;
* @param <K> the type of keys maintained by this map
* @param <V> the type of mapped values
*/
public interface ConcurrentMap<K, V> extends Map<K, V> {
public interface ConcurrentMap<K,V> extends Map<K,V> {
/**
* {@inheritDoc}
@ -86,9 +95,9 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* @implSpec The default implementation is equivalent to, for this
* {@code map}:
* <pre> {@code
* for ((Map.Entry<K, V> entry : map.entrySet())
* action.accept(entry.getKey(), entry.getValue());
* }</pre>
* for (Map.Entry<K,V> entry : map.entrySet()) {
* action.accept(entry.getKey(), entry.getValue());
* }}</pre>
*
* @implNote The default implementation assumes that
* {@code IllegalStateException} thrown by {@code getKey()} or
@ -101,13 +110,13 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
@Override
default void forEach(BiConsumer<? super K, ? super V> action) {
Objects.requireNonNull(action);
for (Map.Entry<K, V> entry : entrySet()) {
for (Map.Entry<K,V> entry : entrySet()) {
K k;
V v;
try {
k = entry.getKey();
v = entry.getValue();
} catch(IllegalStateException ise) {
} catch (IllegalStateException ise) {
// this usually means the entry is no longer in the map.
continue;
}
@ -117,14 +126,13 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
/**
* If the specified key is not already associated
* with a value, associate it with the given value.
* This is equivalent to
* <pre> {@code
* with a value, associates it with the given value.
* This is equivalent to, for this {@code map}:
* <pre> {@code
* if (!map.containsKey(key))
* return map.put(key, value);
* else
* return map.get(key);
* }</pre>
* return map.get(key);}</pre>
*
* except that the action is performed atomically.
*
@ -147,18 +155,19 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* @throws IllegalArgumentException if some property of the specified key
* or value prevents it from being stored in this map
*/
V putIfAbsent(K key, V value);
V putIfAbsent(K key, V value);
/**
* Removes the entry for a key only if currently mapped to a given value.
* This is equivalent to
* <pre> {@code
* if (map.containsKey(key) && Objects.equals(map.get(key), value)) {
* This is equivalent to, for this {@code map}:
* <pre> {@code
* if (map.containsKey(key)
* && Objects.equals(map.get(key), value)) {
* map.remove(key);
* return true;
* } else
* } else {
* return false;
* }</pre>
* }}</pre>
*
* except that the action is performed atomically.
*
@ -181,14 +190,15 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
/**
* Replaces the entry for a key only if currently mapped to a given value.
* This is equivalent to
* <pre> {@code
* if (map.containsKey(key) && Objects.equals(map.get(key), oldValue)) {
* This is equivalent to, for this {@code map}:
* <pre> {@code
* if (map.containsKey(key)
* && Objects.equals(map.get(key), oldValue)) {
* map.put(key, newValue);
* return true;
* } else
* } else {
* return false;
* }</pre>
* }}</pre>
*
* except that the action is performed atomically.
*
@ -212,13 +222,12 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
/**
* Replaces the entry for a key only if currently mapped to some value.
* This is equivalent to
* <pre> {@code
* if (map.containsKey(key)) {
* This is equivalent to, for this {@code map}:
* <pre> {@code
* if (map.containsKey(key))
* return map.put(key, value);
* } else
* return null;
* }</pre>
* else
* return null;}</pre>
*
* except that the action is performed atomically.
*
@ -249,12 +258,14 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* @implSpec
* <p>The default implementation is equivalent to, for this {@code map}:
* <pre> {@code
* for ((Map.Entry<K, V> entry : map.entrySet())
* do {
* K k = entry.getKey();
* V v = entry.getValue();
* } while(!replace(k, v, function.apply(k, v)));
* }</pre>
* for (Map.Entry<K,V> entry : map.entrySet()) {
* K k;
* V v;
* do {
* k = entry.getKey();
* v = entry.getValue();
* } while (!map.replace(k, v, function.apply(k, v)));
* }}</pre>
*
* The default implementation may retry these steps when multiple
* threads attempt updates including potentially calling the function
@ -275,7 +286,7 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
default void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
Objects.requireNonNull(function);
forEach((k,v) -> {
while(!replace(k, v, function.apply(k, v))) {
while (!replace(k, v, function.apply(k, v))) {
// v changed or k is gone
if ( (v = get(k)) == null) {
// k is no longer in the map.
@ -295,11 +306,10 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
*
* <pre> {@code
* if (map.get(key) == null) {
* V newValue = mappingFunction.apply(key);
* if (newValue != null)
* return map.putIfAbsent(key, newValue);
* }
* }</pre>
* V newValue = mappingFunction.apply(key);
* if (newValue != null)
* return map.putIfAbsent(key, newValue);
* }}</pre>
*
* The default implementation may retry these steps when multiple
* threads attempt updates including potentially calling the mapping
@ -331,18 +341,17 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* @implSpec
* The default implementation is equivalent to performing the following
* steps for this {@code map}, then returning the current value or
* {@code null} if now absent. :
* {@code null} if now absent:
*
* <pre> {@code
* if (map.get(key) != null) {
* V oldValue = map.get(key);
* V newValue = remappingFunction.apply(key, oldValue);
* if (newValue != null)
* map.replace(key, oldValue, newValue);
* else
* map.remove(key, oldValue);
* }
* }</pre>
* V oldValue = map.get(key);
* V newValue = remappingFunction.apply(key, oldValue);
* if (newValue != null)
* map.replace(key, oldValue, newValue);
* else
* map.remove(key, oldValue);
* }}</pre>
*
* The default implementation may retry these steps when multiple threads
* attempt updates including potentially calling the remapping function
@ -363,13 +372,13 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
V oldValue;
while((oldValue = get(key)) != null) {
while ((oldValue = get(key)) != null) {
V newValue = remappingFunction.apply(key, oldValue);
if (newValue != null) {
if (replace(key, oldValue, newValue))
return newValue;
} else if (remove(key, oldValue))
return null;
return null;
}
return oldValue;
}
@ -386,17 +395,16 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* V oldValue = map.get(key);
* V newValue = remappingFunction.apply(key, oldValue);
* if (oldValue != null ) {
* if (newValue != null)
* map.replace(key, oldValue, newValue);
* else
* map.remove(key, oldValue);
* if (newValue != null)
* map.replace(key, oldValue, newValue);
* else
* map.remove(key, oldValue);
* } else {
* if (newValue != null)
* map.putIfAbsent(key, newValue);
* else
* return null;
* }
* }</pre>
* if (newValue != null)
* map.putIfAbsent(key, newValue);
* else
* return null;
* }}</pre>
*
* The default implementation may retry these steps when multiple
* threads attempt updates including potentially calling the remapping
@ -417,7 +425,7 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
V oldValue = get(key);
for(;;) {
for (;;) {
V newValue = remappingFunction.apply(key, oldValue);
if (newValue == null) {
// delete mapping
@ -458,7 +466,6 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
}
}
/**
* {@inheritDoc}
*
@ -470,12 +477,11 @@ public interface ConcurrentMap<K, V> extends Map<K, V> {
* <pre> {@code
* V oldValue = map.get(key);
* V newValue = (oldValue == null) ? value :
* remappingFunction.apply(oldValue, value);
* remappingFunction.apply(oldValue, value);
* if (newValue == null)
* map.remove(key);
* map.remove(key);
* else
* map.put(key, newValue);
* }</pre>
* map.put(key, newValue);}</pre>
*
* <p>The default implementation may retry these steps when multiple
* threads attempt updates including potentially calling the remapping

@ -58,6 +58,7 @@ import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* A scalable concurrent {@link ConcurrentNavigableMap} implementation.
@ -2492,6 +2493,22 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
else
return (Spliterator<E>)((SubMap<?,E>)m).valueIterator();
}
public boolean removeIf(Predicate<? super E> filter) {
if (filter == null) throw new NullPointerException();
if (m instanceof ConcurrentSkipListMap)
return ((ConcurrentSkipListMap<?,E>)m).removeValueIf(filter);
// else use iterator
@SuppressWarnings("unchecked") Iterator<Map.Entry<Object,E>> it =
((SubMap<Object,E>)m).entryIterator();
boolean removed = false;
while (it.hasNext()) {
Map.Entry<Object,E> e = it.next();
E v = e.getValue();
if (filter.test(v) && m.remove(e.getKey(), v))
removed = true;
}
return removed;
}
}
static final class EntrySet<K1,V1> extends AbstractSet<Map.Entry<K1,V1>> {
@ -2554,6 +2571,20 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
return (Spliterator<Map.Entry<K1,V1>>)
((SubMap<K1,V1>)m).entryIterator();
}
public boolean removeIf(Predicate<? super Entry<K1, V1>> filter) {
if (filter == null) throw new NullPointerException();
if (m instanceof ConcurrentSkipListMap)
return ((ConcurrentSkipListMap<K1,V1>)m).removeEntryIf(filter);
// else use iterator
Iterator<Map.Entry<K1,V1>> it = ((SubMap<K1,V1>)m).entryIterator();
boolean removed = false;
while (it.hasNext()) {
Map.Entry<K1,V1> e = it.next();
if (filter.test(e) && m.remove(e.getKey(), e.getValue()))
removed = true;
}
return removed;
}
}
/**
@ -3266,6 +3297,41 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
}
}
/**
* Helper method for EntrySet.removeIf
*/
boolean removeEntryIf(Predicate<? super Entry<K, V>> function) {
if (function == null) throw new NullPointerException();
boolean removed = false;
for (Node<K,V> n = findFirst(); n != null; n = n.next) {
V v;
if ((v = n.getValidValue()) != null) {
K k = n.key;
Map.Entry<K,V> e = new AbstractMap.SimpleImmutableEntry<>(k, v);
if (function.test(e) && remove(k, v))
removed = true;
}
}
return removed;
}
/**
* Helper method for Values.removeIf
*/
boolean removeValueIf(Predicate<? super V> function) {
if (function == null) throw new NullPointerException();
boolean removed = false;
for (Node<K,V> n = findFirst(); n != null; n = n.next) {
V v;
if ((v = n.getValidValue()) != null) {
K k = n.key;
if (function.test(v) && remove(k, v))
removed = true;
}
}
return removed;
}
/**
* Base class providing common structure for Spliterators.
* (Although not all that much common functionality; as usual for

@ -1522,17 +1522,20 @@ public final class Subject implements java.io.Serializable {
}
}
@Override
public int size() {
return set.size();
}
@Override
public Iterator<T> iterator() {
return set.iterator();
}
@Override
public boolean add(T o) {
if (!o.getClass().isAssignableFrom(c)) {
if (!c.isAssignableFrom(o.getClass())) {
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("attempting.to.add.an.object.which.is.not.an.instance.of.class"));
Object[] source = {c.toString()};

@ -67,10 +67,6 @@ import java.security.*;
* in RFC 5280. The ValidationAlgorithm attribute notes the
* specification that this provider implements.
*
* - LDAP is the CertStore type for LDAP repositories. The
* LDAPSchema attribute notes the specification defining the
* schema that this provider uses to find certificates and CRLs.
*
* - JavaPolicy is the default file-based Policy type.
*
* - JavaLoginConfig is the default file-based LoginModule Configuration type.
@ -275,9 +271,6 @@ final class SunEntries {
/*
* CertStores
*/
map.put("CertStore.LDAP",
"sun.security.provider.certpath.ldap.LDAPCertStore");
map.put("CertStore.LDAP LDAPSchema", "RFC2587");
map.put("CertStore.Collection",
"sun.security.provider.certpath.CollectionCertStore");
map.put("CertStore.com.sun.security.IndexedCollection",
@ -310,7 +303,6 @@ final class SunEntries {
map.put("KeyStore.JKS ImplementedIn", "Software");
map.put("CertPathValidator.PKIX ImplementedIn", "Software");
map.put("CertPathBuilder.PKIX ImplementedIn", "Software");
map.put("CertStore.LDAP ImplementedIn", "Software");
map.put("CertStore.Collection ImplementedIn", "Software");
map.put("CertStore.com.sun.security.IndexedCollection ImplementedIn",
"Software");

@ -1,148 +0,0 @@
/*
* Copyright (c) 2009, 2012, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package sun.security.provider.certpath;
import java.net.URI;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.security.AccessController;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidAlgorithmParameterException;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.security.cert.CertStore;
import java.security.cert.CertStoreException;
import java.security.cert.X509CertSelector;
import java.security.cert.X509CRLSelector;
import javax.security.auth.x500.X500Principal;
import java.io.IOException;
import sun.security.util.Cache;
/**
* Helper used by URICertStore and others when delegating to another CertStore
* to fetch certs and CRLs.
*/
public abstract class CertStoreHelper {
private static final int NUM_TYPES = 2;
private final static Map<String,String> classMap = new HashMap<>(NUM_TYPES);
static {
classMap.put(
"LDAP",
"sun.security.provider.certpath.ldap.LDAPCertStoreHelper");
classMap.put(
"SSLServer",
"sun.security.provider.certpath.ssl.SSLServerCertStoreHelper");
};
private static Cache<String, CertStoreHelper> cache
= Cache.newSoftMemoryCache(NUM_TYPES);
public static CertStoreHelper getInstance(final String type)
throws NoSuchAlgorithmException
{
CertStoreHelper helper = cache.get(type);
if (helper != null) {
return helper;
}
final String cl = classMap.get(type);
if (cl == null) {
throw new NoSuchAlgorithmException(type + " not available");
}
try {
helper = AccessController.doPrivileged(
new PrivilegedExceptionAction<CertStoreHelper>() {
public CertStoreHelper run() throws ClassNotFoundException {
try {
Class<?> c = Class.forName(cl, true, null);
CertStoreHelper csh
= (CertStoreHelper)c.newInstance();
cache.put(type, csh);
return csh;
} catch (InstantiationException |
IllegalAccessException e) {
throw new AssertionError(e);
}
}
});
return helper;
} catch (PrivilegedActionException e) {
throw new NoSuchAlgorithmException(type + " not available",
e.getException());
}
}
static boolean isCausedByNetworkIssue(String type, CertStoreException cse) {
switch (type) {
case "LDAP":
case "SSLServer":
try {
CertStoreHelper csh = CertStoreHelper.getInstance(type);
return csh.isCausedByNetworkIssue(cse);
} catch (NoSuchAlgorithmException nsae) {
return false;
}
case "URI":
Throwable t = cse.getCause();
return (t != null && t instanceof IOException);
default:
// we don't know about any other remote CertStore types
return false;
}
}
/**
* Returns a CertStore using the given URI as parameters.
*/
public abstract CertStore getCertStore(URI uri)
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException;
/**
* Wraps an existing X509CertSelector when needing to avoid DN matching
* issues.
*/
public abstract X509CertSelector wrap(X509CertSelector selector,
X500Principal certSubject,
String dn)
throws IOException;
/**
* Wraps an existing X509CRLSelector when needing to avoid DN matching
* issues.
*/
public abstract X509CRLSelector wrap(X509CRLSelector selector,
Collection<X500Principal> certIssuers,
String dn)
throws IOException;
/**
* Returns true if the cause of the CertStoreException is a network
* related issue.
*/
public abstract boolean isCausedByNetworkIssue(CertStoreException e);
}

@ -466,6 +466,34 @@ class RevocationChecker extends PKIXRevocationChecker {
stackedCerts, params.trustAnchors());
}
static boolean isCausedByNetworkIssue(String type, CertStoreException cse) {
boolean result;
Throwable t = cse.getCause();
switch (type) {
case "LDAP":
if (t != null) {
// These two exception classes are inside java.naming module
String cn = t.getClass().getName();
result = (cn.equals("javax.naming.ServiceUnavailableException") ||
cn.equals("javax.naming.CommunicationException"));
} else {
result = false;
}
break;
case "SSLServer":
result = (t != null && t instanceof IOException);
break;
case "URI":
result = (t != null && t instanceof IOException);
break;
default:
// we don't know about any other remote CertStore types
return false;
}
return result;
}
private void checkCRLs(X509Certificate cert, PublicKey prevKey,
X509Certificate prevCert, boolean signFlag,
boolean allowSeparateKey,
@ -510,7 +538,7 @@ class RevocationChecker extends PKIXRevocationChecker {
"CertStoreException: " + e.getMessage());
}
if (networkFailureException == null &&
CertStoreHelper.isCausedByNetworkIssue(store.getType(),e)) {
isCausedByNetworkIssue(store.getType(),e)) {
// save this exception, we may need to throw it later
networkFailureException = new CertPathValidatorException(
"Unable to determine revocation status due to " +
@ -557,8 +585,7 @@ class RevocationChecker extends PKIXRevocationChecker {
} catch (CertStoreException e) {
if (e instanceof CertStoreTypeException) {
CertStoreTypeException cste = (CertStoreTypeException)e;
if (CertStoreHelper.isCausedByNetworkIssue(cste.getType(),
e)) {
if (isCausedByNetworkIssue(cste.getType(), e)) {
throw new CertPathValidatorException(
"Unable to determine revocation status due to " +
"network error", e, null, -1,

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2015, 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
@ -42,6 +42,7 @@ import java.security.cert.CertStoreParameters;
import java.security.cert.CertStoreSpi;
import java.security.cert.CRLException;
import java.security.cert.CRLSelector;
import java.security.cert.URICertStoreParameters;
import java.security.cert.X509Certificate;
import java.security.cert.X509CertSelector;
import java.security.cert.X509CRL;
@ -118,9 +119,7 @@ class URICertStore extends CertStoreSpi {
// true if URI is ldap
private boolean ldap = false;
private CertStoreHelper ldapHelper;
private CertStore ldapCertStore;
private String ldapPath;
// Default maximum connect timeout in milliseconds (15 seconds)
// allowed when downloading CRLs
@ -165,13 +164,8 @@ class URICertStore extends CertStoreSpi {
// if ldap URI, use an LDAPCertStore to fetch certs and CRLs
if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals("ldap")) {
ldap = true;
ldapHelper = CertStoreHelper.getInstance("LDAP");
ldapCertStore = ldapHelper.getCertStore(uri);
ldapPath = uri.getPath();
// strip off leading '/'
if (ldapPath.charAt(0) == '/') {
ldapPath = ldapPath.substring(1);
}
URICertStoreParameters lparams = new URICertStoreParameters(uri);
ldapCertStore = CertStore.getInstance("LDAP", lparams);
}
try {
factory = CertificateFactory.getInstance("X.509");
@ -246,20 +240,10 @@ class URICertStore extends CertStoreSpi {
public synchronized Collection<X509Certificate> engineGetCertificates
(CertSelector selector) throws CertStoreException {
// if ldap URI we wrap the CertSelector in an LDAPCertSelector to
// avoid LDAP DN matching issues (see LDAPCertSelector for more info)
if (ldap) {
X509CertSelector xsel = (X509CertSelector) selector;
try {
xsel = ldapHelper.wrap(xsel, xsel.getSubject(), ldapPath);
} catch (IOException ioe) {
throw new CertStoreException(ioe);
}
// Fetch the certificates via LDAP. LDAPCertStore has its own
// caching mechanism, see the class description for more info.
// Safe cast since xsel is an X509 certificate selector.
return (Collection<X509Certificate>)
ldapCertStore.getCertificates(xsel);
ldapCertStore.getCertificates(selector);
}
// Return the Certificates for this entry. It returns the cached value
@ -356,20 +340,11 @@ class URICertStore extends CertStoreSpi {
public synchronized Collection<X509CRL> engineGetCRLs(CRLSelector selector)
throws CertStoreException {
// if ldap URI we wrap the CRLSelector in an LDAPCRLSelector to
// avoid LDAP DN matching issues (see LDAPCRLSelector for more info)
if (ldap) {
X509CRLSelector xsel = (X509CRLSelector) selector;
try {
xsel = ldapHelper.wrap(xsel, null, ldapPath);
} catch (IOException ioe) {
throw new CertStoreException(ioe);
}
// Fetch the CRLs via LDAP. LDAPCertStore has its own
// caching mechanism, see the class description for more info.
// Safe cast since xsel is an X509 certificate selector.
try {
return (Collection<X509CRL>) ldapCertStore.getCRLs(xsel);
return (Collection<X509CRL>) ldapCertStore.getCRLs(selector);
} catch (CertStoreException cse) {
throw new PKIX.CertStoreTypeException("LDAP", cse);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -153,7 +153,7 @@ public final class SSLServerCertStore extends CertStoreSpi {
throw new UnsupportedOperationException();
}
static CertStore getInstance(URI uri)
public static CertStore getInstance(URI uri)
throws InvalidAlgorithmParameterException
{
return new CS(new SSLServerCertStore(uri), null, "SSLServer", null);

@ -1,76 +0,0 @@
/*
* Copyright (c) 2011, 2012, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package sun.security.provider.certpath.ssl;
import java.io.IOException;
import java.net.URI;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidAlgorithmParameterException;
import java.security.cert.CertStore;
import java.security.cert.CertStoreException;
import java.security.cert.X509CertSelector;
import java.security.cert.X509CRLSelector;
import java.util.Collection;
import javax.security.auth.x500.X500Principal;
import sun.security.provider.certpath.CertStoreHelper;
/**
* SSL implementation of CertStoreHelper.
*/
public final class SSLServerCertStoreHelper extends CertStoreHelper {
@Override
public CertStore getCertStore(URI uri)
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException
{
return SSLServerCertStore.getInstance(uri);
}
@Override
public X509CertSelector wrap(X509CertSelector selector,
X500Principal certSubject,
String ldapDN)
throws IOException
{
throw new UnsupportedOperationException();
}
@Override
public X509CRLSelector wrap(X509CRLSelector selector,
Collection<X500Principal> certIssuers,
String ldapDN)
throws IOException
{
throw new UnsupportedOperationException();
}
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
Throwable t = e.getCause();
return (t != null && t instanceof IOException);
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -46,6 +46,9 @@ import java.security.cert.CertStoreException;
import java.security.cert.CRL;
import java.security.cert.X509Certificate;
import java.security.cert.CertificateException;
import java.security.cert.URICertStoreParameters;
import java.text.Collator;
import java.text.MessageFormat;
import java.util.*;
@ -69,7 +72,7 @@ import sun.security.util.ObjectIdentifier;
import sun.security.pkcs10.PKCS10;
import sun.security.pkcs10.PKCS10Attribute;
import sun.security.provider.X509Factory;
import sun.security.provider.certpath.CertStoreHelper;
import sun.security.provider.certpath.ssl.SSLServerCertStore;
import sun.security.util.Password;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
@ -2208,14 +2211,10 @@ public final class Main {
}
}
} else { // must be LDAP, and uri is not null
// Lazily load LDAPCertStoreHelper if present
CertStoreHelper helper = CertStoreHelper.getInstance("LDAP");
String path = uri.getPath();
if (path.charAt(0) == '/') path = path.substring(1);
CertStore s = helper.getCertStore(uri);
X509CRLSelector sel =
helper.wrap(new X509CRLSelector(), null, path);
return s.getCRLs(sel);
URICertStoreParameters params =
new URICertStoreParameters(uri);
CertStore s = CertStore.getInstance("LDAP", params);
return s.getCRLs(new X509CRLSelector());
}
}
@ -2463,9 +2462,7 @@ public final class Main {
out.println(rb.getString("Not.a.signed.jar.file"));
}
} else if (sslserver != null) {
// Lazily load SSLCertStoreHelper if present
CertStoreHelper helper = CertStoreHelper.getInstance("SSLServer");
CertStore cs = helper.getCertStore(new URI("https://" + sslserver));
CertStore cs = SSLServerCertStore.getInstance(new URI("https://" + sslserver));
Collection<? extends Certificate> chain;
try {
chain = cs.getCertificates(null);

@ -78,6 +78,7 @@ security.provider.tbd=sun.security.jgss.SunProvider
security.provider.tbd=com.sun.security.sasl.Provider
security.provider.tbd=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.tbd=sun.security.smartcardio.SunPCSC
security.provider.tbd=sun.security.provider.certpath.ldap.JdkLDAP
#ifdef windows
security.provider.tbd=sun.security.mscapi.SunMSCAPI
#endif
@ -156,7 +157,8 @@ login.configuration.provider=sun.security.provider.ConfigFile
#
# Class to instantiate as the system Policy. This is the name of the class
# that will be used as the Policy object.
# that will be used as the Policy object. The system class loader is used to
# locate this class.
#
policy.provider=sun.security.provider.PolicyFile

@ -194,7 +194,7 @@ void InitLauncher(jboolean javaw);
* For MacOSX and Windows/Unix compatibility we require these
* entry points, some of them may be stubbed out on Windows/Unixes.
*/
void PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm);
void PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm);
void ShowSplashScreen();
void RegisterThread();
/*

@ -1206,7 +1206,7 @@ ZIP_GetEntry2(jzfile *zip, char *name, jint ulen, jboolean addSlash)
}
/* Slash is already there? */
if (name[ulen-1] == '/') {
if (ulen > 0 && name[ulen - 1] == '/') {
break;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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

@ -938,7 +938,7 @@ JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
}
void
PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm)
PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm)
{
// stubbed out for windows and *nixes.
}

@ -970,7 +970,7 @@ JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
}
void
PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm)
PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm)
{
// stubbed out for windows and *nixes.
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -25,14 +25,18 @@
package com.apple.eawt;
import java.awt.*;
import java.awt.peer.*;
import java.awt.Image;
import java.awt.Point;
import java.awt.PopupMenu;
import java.awt.Toolkit;
import java.awt.Window;
import java.beans.Beans;
import javax.swing.JMenuBar;
import sun.lwawt.*;
import sun.lwawt.macosx.*;
import sun.awt.AWTAccessor;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.macosx.CPlatformWindow;
/**
* The <code>Application</code> class allows you to integrate your Java application with the native Mac OS X environment.
@ -385,10 +389,8 @@ public class Application {
*
* @since Java for Mac OS X 10.7 Update 1
*/
@SuppressWarnings("deprecation")
public void requestToggleFullScreen(final Window window) {
final ComponentPeer peer = window.getPeer();
final Object peer = AWTAccessor.getComponentAccessor().getPeer(window);
if (!(peer instanceof LWWindowPeer)) return;
Object platformWindow = ((LWWindowPeer) peer).getPlatformWindow();
if (!(platformWindow instanceof CPlatformWindow)) return;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -28,6 +28,7 @@ package com.apple.eawt;
import java.awt.*;
import java.lang.reflect.*;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*;
import sun.lwawt.macosx.CImage.Creator;
@ -41,7 +42,6 @@ class _AppDockIconHandler {
_AppDockIconHandler() { }
@SuppressWarnings("deprecation")
public void setDockMenu(final PopupMenu menu) {
fDockMenu = menu;
@ -61,8 +61,8 @@ class _AppDockIconHandler {
// instantiate the menu peer and set the native fDockMenu ivar
menu.addNotify();
final long nsMenuPtr = ((CMenu)fDockMenu.getPeer()).getNativeMenu();
nativeSetDockMenu(nsMenuPtr);
CMenu peer = AWTAccessor.getMenuComponentAccessor().getPeer(fDockMenu);
nativeSetDockMenu(peer.getNativeMenu());
}
public PopupMenu getDockMenu() {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -32,6 +32,7 @@ import javax.swing.*;
import javax.swing.plaf.MenuBarUI;
import com.apple.laf.ScreenMenuBar;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar;
import com.apple.laf.AquaMenuBarUI;
@ -49,7 +50,10 @@ class _AppMenuBarHandler {
}
// callback from the native delegate -init function
private static void initMenuStates(final boolean aboutMenuItemVisible, final boolean aboutMenuItemEnabled, final boolean prefsMenuItemVisible, final boolean prefsMenuItemEnabled) {
private static void initMenuStates(final boolean aboutMenuItemVisible,
final boolean aboutMenuItemEnabled,
final boolean prefsMenuItemVisible,
final boolean prefsMenuItemEnabled) {
synchronized (instance) {
instance.aboutMenuItemVisible = aboutMenuItemVisible;
instance.aboutMenuItemEnabled = aboutMenuItemEnabled;
@ -92,7 +96,6 @@ class _AppMenuBarHandler {
return (frame.getExtendedState() & Frame.ICONIFIED) != 0;
}
@SuppressWarnings("deprecation")
static void installDefaultMenuBar(final JMenuBar menuBar) {
if (menuBar == null) {
// intentionally clearing the default menu
@ -114,7 +117,7 @@ class _AppMenuBarHandler {
}
screenMenuBar.addNotify();
final MenuComponentPeer peer = screenMenuBar.getPeer();
final Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(screenMenuBar);
if (!(peer instanceof CMenuBar)) {
// such a thing should not be possible
throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar");

@ -151,20 +151,6 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
editor.getDocument().addDocumentListener(this);
}
@Override
public void focusGained(final FocusEvent e) {
if (arrowButton != null) {
arrowButton.repaint();
}
}
@Override
public void focusLost(final FocusEvent e) {
if (arrowButton != null) {
arrowButton.repaint();
}
}
@Override
public void changedUpdate(final DocumentEvent e) {
editorTextChanged();
@ -252,6 +238,16 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
*/
protected FocusListener createFocusListener() {
return new BasicComboBoxUI.FocusHandler() {
@Override
public void focusGained(FocusEvent e) {
super.focusGained(e);
if (arrowButton != null) {
arrowButton.repaint();
}
}
@Override
public void focusLost(final FocusEvent e) {
hasFocus = false;
if (!e.isTemporary()) {
@ -264,6 +260,10 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
if (ac != null) {
ac.firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, AccessibleState.FOCUSED, null);
}
if (arrowButton != null) {
arrowButton.repaint();
}
}
};
}
@ -438,6 +438,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
if (editor != null) {
final Rectangle editorRect = rectangleForCurrentValue();
editorRect.width += 4;
editorRect.height += 1;
editor.setBounds(editorRect);
}
}

@ -124,7 +124,7 @@ public class AquaTextFieldBorder extends AquaBorder {
public Insets getBorderInsets(final Component c) {
if (!(c instanceof JTextComponent) || c.isOpaque()) return new InsetsUIResource(3, 7, 3, 7);
return new InsetsUIResource(6, 7, 6, 7);
return new InsetsUIResource(5, 5, 5, 5);
}
protected static State getStateFor(final JTextComponent jc) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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,11 +27,11 @@ package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.MenuComponentPeer;
import java.util.Hashtable;
import javax.swing.*;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.lwawt.LWToolkit;
import sun.lwawt.macosx.*;
@ -212,24 +212,36 @@ final class ScreenMenu extends Menu
// Send a mouseExited to the previously hilited item, if it wasn't 0.
if (target != fLastMouseEventTarget) {
if (fLastMouseEventTarget != null) {
LWToolkit.postEvent(new MouseEvent(fLastMouseEventTarget, MouseEvent.MOUSE_EXITED, when, modifiers, x - fLastTargetRect.x, y - fLastTargetRect.y, 0, false));
LWToolkit.postEvent(
new MouseEvent(fLastMouseEventTarget,
MouseEvent.MOUSE_EXITED, when,
modifiers, x - fLastTargetRect.x,
y - fLastTargetRect.y, 0,
false));
}
// Send a mouseEntered to the current hilited item, if it wasn't 0.
// Send a mouseEntered to the current hilited item, if it
// wasn't 0.
if (target != null) {
LWToolkit.postEvent(new MouseEvent(target, MouseEvent.MOUSE_ENTERED, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false));
LWToolkit.postEvent(
new MouseEvent(target, MouseEvent.MOUSE_ENTERED,
when, modifiers,
x - targetRect.x,
y - targetRect.y, 0, false));
}
fLastMouseEventTarget = target;
fLastTargetRect = targetRect;
}
// Post a mouse event to the current item.
if (target == null) return;
LWToolkit.postEvent(new MouseEvent(target, kind, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false));
LWToolkit.postEvent(
new MouseEvent(target, kind, when, modifiers,
x - targetRect.x, y - targetRect.y, 0,
false));
}
});
}
@Override
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
super.addNotify();
@ -248,7 +260,8 @@ final class ScreenMenu extends Menu
if (tooltipText != null) {
setToolTipText(tooltipText);
}
final MenuComponentPeer peer = getPeer();
final Object peer = AWTAccessor.getMenuComponentAccessor()
.getPeer(this);
if (peer instanceof CMenu) {
final CMenu menu = (CMenu) peer;
final long nativeMenu = menu.getNativeMenu();
@ -355,9 +368,8 @@ final class ScreenMenu extends Menu
public void setIndeterminate(boolean indeterminate) { }
@Override
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
@ -365,9 +377,8 @@ final class ScreenMenu extends Menu
}
@Override
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -25,19 +25,21 @@
package com.apple.laf;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar;
import java.awt.*;
import java.awt.event.*;
import java.lang.reflect.*;
import java.security.*;
import java.util.*;
import javax.swing.*;
import static sun.awt.AWTAccessor.*;
@SuppressWarnings("serial") // JDK implementation class
public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenMenuPropertyHandler, ComponentListener {
public class ScreenMenuBar extends MenuBar
implements ContainerListener, ScreenMenuPropertyHandler,
ComponentListener {
static boolean sJMenuBarHasHelpMenus = false; //$ could check by calling getHelpMenu in a try block
JMenuBar fSwingBar;
@ -246,22 +248,23 @@ public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenM
fSubmenus.remove(menu);
}
@SuppressWarnings("deprecation")
public Menu add(final Menu m, final int index) {
synchronized (getTreeLock()) {
if (m.getParent() != null) {
m.getParent().remove(m);
}
final Vector<Menu> menus = AWTAccessor.getMenuBarAccessor().getMenus(this);
final Vector<Menu> menus = getMenuBarAccessor().getMenus(this);
menus.insertElementAt(m, index);
AWTAccessor.getMenuComponentAccessor().setParent(m, this);
final MenuComponentAccessor acc = getMenuComponentAccessor();
acc.setParent(m, this);
final CMenuBar peer = (CMenuBar)getPeer();
final CMenuBar peer = acc.getPeer(this);
if (peer == null) return m;
peer.setNextInsertionIndex(index);
if (m.getPeer() == null) {
final CMenuBar mPeer = acc.getPeer(m);
if (mPeer == null) {
m.addNotify();
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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,18 @@ package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.MenuComponentPeer;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuItem;
@SuppressWarnings("serial") // JDK implementation class
final class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler {
final class ScreenMenuItem extends MenuItem
implements ActionListener, ComponentListener,
ScreenMenuPropertyHandler {
ScreenMenuPropertyListener fListener;
JMenuItem fMenuItem;
@ -97,9 +100,8 @@ final class ScreenMenuItem extends MenuItem implements ActionListener, Component
fMenuItem.removeComponentListener(this);
}
@SuppressWarnings("deprecation")
static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
final MenuComponentPeer peer = menuItem.getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(menuItem);
if (!(peer instanceof CMenuItem)) {
//Is it possible?
return;
@ -166,18 +168,16 @@ final class ScreenMenuItem extends MenuItem implements ActionListener, Component
}
}
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
cmi.setToolTipText(text);
}
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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,17 +27,20 @@ package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.MenuComponentPeer;
import javax.swing.*;
import javax.swing.plaf.ButtonUI;
import com.apple.laf.AquaMenuItemUI.IndeterminateListener;
import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*;
@SuppressWarnings("serial") // JDK implementation class
final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener {
final class ScreenMenuItemCheckbox extends CheckboxMenuItem
implements ActionListener, ComponentListener, ScreenMenuPropertyHandler,
ItemListener {
JMenuItem fMenuItem;
MenuContainer fParent;
@ -57,12 +60,12 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
}
ScreenMenuPropertyListener fPropertyListener;
@SuppressWarnings("deprecation")
public void addNotify() {
super.addNotify();
// Avoid the Auto toggle behavior of AWT CheckBoxMenuItem
CCheckboxMenuItem ccb = (CCheckboxMenuItem) getPeer();
CCheckboxMenuItem ccb = AWTAccessor.getMenuComponentAccessor().getPeer(this);
ccb.setAutoToggle(false);
fMenuItem.addComponentListener(this);
@ -155,17 +158,15 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
setVisible(false);
}
@SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
((CMenuItem)peer).setToolTipText(text);
}
@SuppressWarnings("deprecation")
public void setIcon(final Icon i) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
final CMenuItem cmi = (CMenuItem)peer;
@ -208,9 +209,8 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionLis
}
}
@SuppressWarnings("deprecation")
public void setIndeterminate(final boolean indeterminate) {
final MenuComponentPeer peer = getPeer();
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (peer instanceof CCheckboxMenuItem) {
((CCheckboxMenuItem)peer).setIsIndeterminate(indeterminate);
}

@ -72,7 +72,8 @@ public abstract class CGraphicsConfig extends GraphicsConfiguration
@Override
public AffineTransform getDefaultTransform() {
return new AffineTransform();
double scaleFactor = device.getScaleFactor();
return AffineTransform.getScaleInstance(scaleFactor, scaleFactor);
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, 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
@ -206,17 +206,15 @@ public final class CGraphicsDevice extends GraphicsDevice
return true;
}
@SuppressWarnings("deprecation")
private static void enterFullScreenExclusive(Window w) {
FullScreenCapable peer = (FullScreenCapable)w.getPeer();
FullScreenCapable peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
peer.enterFullScreenMode();
}
}
@SuppressWarnings("deprecation")
private static void exitFullScreenExclusive(Window w) {
FullScreenCapable peer = (FullScreenCapable)w.getPeer();
FullScreenCapable peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
peer.exitFullScreenMode();
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -33,13 +33,14 @@ import java.awt.Transparency;
import java.awt.image.ColorModel;
import java.awt.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager;
import sun.java2d.BackBufferCapsProvider;
import sun.java2d.SurfaceData;
import static sun.java2d.opengl.OGLContext.OGLContextCaps.*;
import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
import static sun.java2d.pipe.hw.AccelSurface.*;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
public class CGLVolatileSurfaceManager extends VolatileSurfaceManager {
@ -74,11 +75,11 @@ public class CGLVolatileSurfaceManager extends VolatileSurfaceManager {
* Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig)
*/
@SuppressWarnings("deprecation")
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData = null;
Component comp = vImg.getComponent();
final ComponentPeer peer = (comp != null) ? comp.getPeer() : null;
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
final ComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;
try {
boolean createVSynced = false;

@ -930,8 +930,8 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
return false;
}
final LWWindowPeer parentPeer =
(LWWindowPeer) AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (parentPeer == null) {
focusLog.fine("request rejected, parentPeer is null");
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());

@ -33,6 +33,7 @@ import java.util.List;
import javax.swing.*;
import sun.awt.*;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.java2d.*;
import sun.java2d.loops.Blit;
import sun.java2d.loops.CompositeType;
@ -505,7 +506,7 @@ public class LWWindowPeer
@Override
public void repositionSecurityWarning() {
if (warningWindow != null) {
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
Window target = getTarget();
int x = compAccessor.getX(target);
int y = compAccessor.getY(target);
@ -563,8 +564,7 @@ public class LWWindowPeer
public void blockWindows(List<Window> windows) {
//TODO: LWX will probably need some collectJavaToplevels to speed this up
for (Window w : windows) {
WindowPeer wp =
(WindowPeer) AWTAccessor.getComponentAccessor().getPeer(w);
WindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
if (wp != null) {
wp.setModalBlocked((Dialog)getTarget(), true);
}
@ -1247,7 +1247,8 @@ public class LWWindowPeer
private boolean isOneOfOwnersOf(LWWindowPeer peer) {
Window owner = (peer != null ? peer.getTarget().getOwner() : null);
while (owner != null) {
if ((LWWindowPeer)owner.getPeer() == this) {
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (acc.getPeer(owner) == this) {
return true;
}
owner = owner.getOwner();
@ -1321,8 +1322,8 @@ public class LWWindowPeer
while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) {
owner = owner.getOwner();
}
return owner == null ? null :
(LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner);
return owner == null ? null : AWTAccessor.getComponentAccessor()
.getPeer(owner);
}
/**

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -39,6 +39,7 @@ import javax.accessibility.*;
import java.util.Map;
import java.util.concurrent.Callable;
import sun.awt.AWTAccessor;
import sun.awt.dnd.*;
import sun.lwawt.LWComponentPeer;
import sun.lwawt.LWWindowPeer;
@ -88,7 +89,6 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
super.startDrag(dsc, cursor, dragImage, dragImageOffset);
}
@SuppressWarnings("deprecation")
protected void startDrag(Transferable transferable, long[] formats, Map<Long, DataFlavor> formatMap) {
DragGestureEvent trigger = getTrigger();
InputEvent triggerEvent = trigger.getTriggerEvent();
@ -135,7 +135,9 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
try {
//It sure will be LWComponentPeer instance as rootComponent is a Window
PlatformWindow platformWindow = ((LWComponentPeer)rootComponent.getPeer()).getPlatformWindow();
LWComponentPeer<?, ?> peer = AWTAccessor.getComponentAccessor()
.getPeer(rootComponent);
PlatformWindow platformWindow = peer.getPlatformWindow();
long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow);
if (nativeViewPtr == 0L) throw new InvalidDnDOperationException("Unsupported platform window implementation");

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -30,6 +30,7 @@ import java.awt.AWTKeyStroke;
import java.awt.Point;
import java.awt.Toolkit;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame;
import sun.lwawt.LWWindowPeer;
@ -46,9 +47,8 @@ public class CEmbeddedFrame extends EmbeddedFrame {
show();
}
@SuppressWarnings("deprecation")
public void addNotify() {
if (getPeer() == null) {
if (!isDisplayable()) {
LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
setPeer(peer);
@ -61,10 +61,9 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public void unregisterAccelerator(AWTKeyStroke stroke) {}
@SuppressWarnings("deprecation")
protected long getLayerPtr() {
LWWindowPeer peer = (LWWindowPeer)getPeer();
return peer.getLayerPtr();
return AWTAccessor.getComponentAccessor().<LWWindowPeer>getPeer(this)
.getLayerPtr();
}
// -----------------------------------------------------------------------

@ -138,17 +138,6 @@ public class CImage extends CFRetainedResource {
return ((DataBufferInt)bimg.getRaster().getDataBuffer()).getData();
}
public CImage createFromImageImmediately(final Image image) {
int[] buffer = imageToArray(image, false);
if (buffer == null) {
return null;
}
return new CImage(nativeCreateNSImageFromArray(buffer, image.getWidth(null),
image.getHeight(null)));
}
public byte[] getPlatformImageBytes(final Image image) {
int[] buffer = imageToArray(image, false);
@ -168,20 +157,33 @@ public class CImage extends CFRetainedResource {
// This is used to create a CImage from a Image
public CImage createFromImage(final Image image) {
return createFromImage(image, true);
}
public CImage createFromImageImmediately(final Image image) {
return createFromImage(image, false);
}
// This is used to create a CImage from a Image
private CImage createFromImage(final Image image, final boolean prepareImage) {
if (image instanceof MultiResolutionImage) {
List<Image> resolutionVariants
= ((MultiResolutionImage) image).getResolutionVariants();
return createFromImages(resolutionVariants);
return createFromImages(resolutionVariants, prepareImage);
}
int[] buffer = imageToArray(image, true);
int[] buffer = imageToArray(image, prepareImage);
if (buffer == null) {
return null;
}
return new CImage(nativeCreateNSImageFromArray(buffer, image.getWidth(null), image.getHeight(null)));
}
public CImage createFromImages(List<Image> images) {
public CImage createFromImages(final List<Image> images) {
return createFromImages(images, true);
}
private CImage createFromImages(final List<Image> images, final boolean prepareImage) {
if (images == null || images.isEmpty()) {
return null;
}
@ -194,8 +196,8 @@ public class CImage extends CFRetainedResource {
num = 0;
for (Image img : images) {
buffers[num] = imageToArray(img, true);
for (final Image img : images) {
buffers[num] = imageToArray(img, prepareImage);
if (buffers[num] == null) {
// Unable to process the image
continue;
@ -210,9 +212,9 @@ public class CImage extends CFRetainedResource {
}
return new CImage(nativeCreateNSImageFromArrays(
Arrays.copyOf(buffers, num),
Arrays.copyOf(w, num),
Arrays.copyOf(h, num)));
Arrays.copyOf(buffers, num),
Arrays.copyOf(w, num),
Arrays.copyOf(h, num)));
}
static int getSelectorAsInt(final String fromString) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -38,9 +38,12 @@ import java.text.AttributedCharacterIterator.Attribute;
import java.text.*;
import javax.swing.text.JTextComponent;
import sun.awt.AWTAccessor;
import sun.awt.im.InputMethodAdapter;
import sun.lwawt.*;
import static sun.awt.AWTAccessor.ComponentAccessor;
public class CInputMethod extends InputMethodAdapter {
private InputMethodContext fIMContext;
private Component fAwtFocussedComponent;
@ -385,12 +388,11 @@ public class CInputMethod extends InputMethodAdapter {
// java.awt.Toolkit#getNativeContainer() is not available
// from this package
@SuppressWarnings("deprecation")
private LWComponentPeer<?, ?> getNearestNativePeer(Component comp) {
if (comp==null)
return null;
ComponentPeer peer = comp.getPeer();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = acc.getPeer(comp);
if (peer==null)
return null;
@ -398,7 +400,7 @@ public class CInputMethod extends InputMethodAdapter {
comp = comp.getParent();
if (comp==null)
return null;
peer = comp.getPeer();
peer = acc.getPeer(comp);
if (peer==null)
return null;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -29,6 +29,8 @@ import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.peer.MenuBarPeer;
import sun.awt.AWTAccessor;
public class CMenuBar extends CMenuComponent implements MenuBarPeer {
private int nextInsertionIndex = -1;
@ -43,9 +45,8 @@ public class CMenuBar extends CMenuComponent implements MenuBarPeer {
}
@Override
@SuppressWarnings("deprecation")
public void addHelpMenu(Menu m) {
CMenu cMenu = (CMenu)m.getPeer();
CMenu cMenu = AWTAccessor.getMenuComponentAccessor().getPeer(m);
nativeSetHelpMenu(getModel(), cMenu.getModel());
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -31,12 +31,11 @@ import java.awt.event.*;
import java.awt.peer.WindowPeer;
import java.beans.*;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Objects;
import javax.swing.*;
import sun.awt.*;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.java2d.SurfaceData;
import sun.java2d.opengl.CGLSurfaceData;
import sun.lwawt.*;
@ -193,8 +192,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@SuppressWarnings("deprecation")
public CPlatformWindow convertJComponentToTarget(final JRootPane p) {
Component root = SwingUtilities.getRoot(p);
if (root == null || (LWWindowPeer)root.getPeer() == null) return null;
return (CPlatformWindow)((LWWindowPeer)root.getPeer()).getPlatformWindow();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (root == null || acc.getPeer(root) == null) return null;
return (CPlatformWindow)((LWWindowPeer)acc.getPeer(root)).getPlatformWindow();
}
};
@ -523,15 +523,15 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
@Override // PlatformWindow
@SuppressWarnings("deprecation")
public void setVisible(boolean visible) {
final long nsWindowPtr = getNSWindowPtr();
// Process parent-child relationship when hiding
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (!visible) {
// Unparent my children
for (Window w : target.getOwnedWindows()) {
WindowPeer p = (WindowPeer)w.getPeer();
WindowPeer p = acc.getPeer(w);
if (p instanceof LWWindowPeer) {
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
if (pw != null && pw.isVisible()) {
@ -627,7 +627,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Add my own children to myself
for (Window w : target.getOwnedWindows()) {
WindowPeer p = (WindowPeer)w.getPeer();
final Object p = acc.getPeer(w);
if (p instanceof LWWindowPeer) {
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
if (pw != null && pw.isVisible()) {
@ -679,13 +679,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
@Override // PlatformWindow
@SuppressWarnings("deprecation")
public void toFront() {
final long nsWindowPtr = getNSWindowPtr();
LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
if( w != null && w.getPeer() != null
&& ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if( w != null && acc.getPeer(w) != null
&& ((LWWindowPeer)acc.getPeer(w)).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
&& !lwcToolkit.isApplicationActive()) {
lwcToolkit.activateApplicationIgnoringOtherApps();
}

@ -36,6 +36,10 @@ import java.security.PrivilegedAction;
import javax.print.*;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.standard.Media;
import javax.print.attribute.standard.MediaPrintableArea;
import javax.print.attribute.standard.MediaSize;
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.PageRanges;
import sun.java2d.*;
@ -745,4 +749,34 @@ public final class CPrinterJob extends RasterPrinterJob {
protected void startPage(PageFormat arg0, Printable arg1, int arg2, boolean arg3) throws PrinterException {
// TODO Auto-generated method stub
}
}
@Override
protected MediaSize getMediaSize(Media media, PrintService service,
PageFormat page) {
if (media == null || !(media instanceof MediaSizeName)) {
return getDefaultMediaSize(page);
}
MediaSize size = MediaSize.getMediaSizeForName((MediaSizeName) media);
return size != null ? size : getDefaultMediaSize(page);
}
private MediaSize getDefaultMediaSize(PageFormat page){
final int inch = 72;
Paper paper = page.getPaper();
float width = (float) (paper.getWidth() / inch);
float height = (float) (paper.getHeight() / inch);
return new MediaSize(width, height, MediaSize.INCH);
}
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
final float dpi = 72.0f;
Paper paper = page.getPaper();
return new MediaPrintableArea(
(float) (paper.getImageableX() / dpi),
(float) (paper.getImageableY() / dpi),
(float) (paper.getImageableWidth() / dpi),
(float) (paper.getImageableHeight() / dpi),
MediaPrintableArea.INCH);
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -37,6 +37,8 @@ import java.awt.peer.TrayIconPeer;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import static sun.awt.AWTAccessor.*;
public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
private TrayIcon target;
private PopupMenu popup;
@ -68,15 +70,15 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
updateImage();
}
@SuppressWarnings("deprecation")
private CPopupMenu checkAndCreatePopupPeer() {
CPopupMenu menuPeer = null;
if (popup != null) {
try {
menuPeer = (CPopupMenu)popup.getPeer();
final MenuComponentAccessor acc = getMenuComponentAccessor();
menuPeer = acc.getPeer(popup);
if (menuPeer == null) {
popup.addNotify();
menuPeer = (CPopupMenu)popup.getPeer();
menuPeer = acc.getPeer(popup);
}
} catch (Exception e) {
e.printStackTrace();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, 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
@ -30,6 +30,7 @@ import java.awt.AWTKeyStroke;
import java.awt.Toolkit;
import java.lang.reflect.InvocationTargetException;
import sun.awt.AWTAccessor;
import sun.awt.EmbeddedFrame;
import sun.lwawt.LWWindowPeer;
@ -48,10 +49,9 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
this.nsViewPtr = nsViewPtr;
}
@SuppressWarnings("deprecation")
@Override
public void addNotify() {
if (getPeer() == null) {
if (!isDisplayable()) {
LWCToolkit toolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
setPeer(toolkit.createEmbeddedFrame(this));
}
@ -78,11 +78,12 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
* Synthetic event delivery for focus management
*/
@Override
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(boolean activated) {
if (isActive != activated) {
isActive = activated;
((LWWindowPeer)getPeer()).notifyActivation(activated, null);
final LWWindowPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
peer.notifyActivation(activated, null);
}
}
@ -91,13 +92,14 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
* Designed to be called from the main thread
* This method should be called once from the initialization of the SWT_AWT Bridge
*/
@SuppressWarnings("deprecation")
public void validateWithBounds(final int x, final int y, final int width, final int height) {
try {
final LWWindowPeer peer = AWTAccessor.getComponentAccessor()
.getPeer(this);
LWCToolkit.invokeAndWait(new Runnable() {
@Override
public void run() {
((LWWindowPeer) getPeer()).setBoundsPrivate(0, 0, width, height);
peer.setBoundsPrivate(0, 0, width, height);
validate();
setVisible(true);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015, 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
@ -293,7 +293,7 @@ public final class LWCToolkit extends LWToolkit {
}
@Override
protected DesktopPeer createDesktopPeer(Desktop target) {
public DesktopPeer createDesktopPeer(Desktop target) {
return new CDesktopPeer();
}
@ -575,7 +575,8 @@ public final class LWCToolkit extends LWToolkit {
final boolean[] ret = new boolean[1];
try { invokeAndWait(new Runnable() { public void run() { synchronized(ret) {
try { invokeAndWait(new Runnable() { @Override
public void run() { synchronized(ret) {
ret[0] = a.equals(b);
}}}, c); } catch (Exception e) { e.printStackTrace(); }

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -168,13 +168,12 @@ public class Button extends Component implements Accessible {
* application to change the look of the button without changing
* its functionality.
*
* @see java.awt.Toolkit#createButton(java.awt.Button)
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized(getTreeLock()) {
if (peer == null)
peer = getToolkit().createButton(this);
peer = getComponentFactory().createButton(this);
super.addNotify();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -58,11 +58,13 @@ public class Canvas extends Component implements Accessible {
}
/**
* Constructs a new Canvas given a GraphicsConfiguration object.
* Constructs a new Canvas given a GraphicsConfiguration object. If null is
* passed, then the default GraphicsConfiguration will be used.
*
* @param config a reference to a GraphicsConfiguration object.
* @param config a reference to a GraphicsConfiguration object or null
*
* @see GraphicsConfiguration
* @see Component#getGraphicsConfiguration()
*/
public Canvas(GraphicsConfiguration config) {
this();
@ -70,10 +72,9 @@ public class Canvas extends Component implements Accessible {
}
@Override
@SuppressWarnings("deprecation")
void setGraphicsConfiguration(GraphicsConfiguration gc) {
synchronized(getTreeLock()) {
CanvasPeer peer = (CanvasPeer)getPeer();
CanvasPeer peer = (CanvasPeer) this.peer;
if (peer != null) {
gc = peer.getAppropriateGraphicsConfiguration(gc);
}
@ -94,13 +95,12 @@ public class Canvas extends Component implements Accessible {
/**
* Creates the peer of the canvas. This peer allows you to change the
* user interface of the canvas without changing its functionality.
* @see java.awt.Toolkit#createCanvas(java.awt.Canvas)
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createCanvas(this);
peer = getComponentFactory().createCanvas(this);
super.addNotify();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -239,13 +239,12 @@ public class Checkbox extends Component implements ItemSelectable, Accessible {
* Creates the peer of the Checkbox. The peer allows you to change the
* look of the Checkbox without changing its functionality.
*
* @see java.awt.Toolkit#createCheckbox(java.awt.Checkbox)
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createCheckbox(this);
peer = getComponentFactory().createCheckbox(this);
super.addNotify();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -155,13 +155,12 @@ public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Access
* change the look of the checkbox item without changing its
* functionality.
* Most applications do not call this method directly.
* @see java.awt.Toolkit#createCheckboxMenuItem(java.awt.CheckboxMenuItem)
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = Toolkit.getDefaultToolkit().createCheckboxMenuItem(this);
peer = getComponentFactory().createCheckboxMenuItem(this);
super.addNotify();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -143,13 +143,12 @@ public class Choice extends Component implements ItemSelectable, Accessible {
* Creates the <code>Choice</code>'s peer. This peer allows us
* to change the look
* of the <code>Choice</code> without changing its functionality.
* @see java.awt.Toolkit#createChoice(java.awt.Choice)
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createChoice(this);
peer = getComponentFactory().createChoice(this);
super.addNotify();
}
}

@ -61,6 +61,7 @@ import java.security.AccessControlContext;
import javax.accessibility.*;
import java.applet.Applet;
import sun.awt.ComponentFactory;
import sun.security.action.GetPropertyAction;
import sun.awt.AppContext;
import sun.awt.AWTAccessor;
@ -198,7 +199,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #addNotify
* @see #removeNotify
*/
transient ComponentPeer peer;
transient volatile ComponentPeer peer;
/**
* The parent of the object. It may be <code>null</code>
@ -924,8 +925,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
public Cursor getCursor(Component comp) {
return comp.getCursor_NoClientCode();
}
public ComponentPeer getPeer(Component comp) {
return comp.peer;
@SuppressWarnings("unchecked")
public <T extends ComponentPeer> T getPeer(Component comp) {
return (T) comp.peer;
}
public void setPeer(Component comp, ComponentPeer peer) {
comp.peer = peer;
@ -1068,17 +1070,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
return getParent_NoClientCode();
}
/**
* @deprecated As of JDK version 1.1,
* programs should not directly manipulate peers;
* replaced by <code>boolean isDisplayable()</code>.
* @return the peer for this component
*/
@Deprecated
public ComponentPeer getPeer() {
return peer;
}
/**
* Associate a <code>DropTarget</code> with this component.
* The <code>Component</code> will receive drops only if it
@ -1095,7 +1086,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
DropTarget old;
if ((old = dropTarget) != null) {
if (peer != null) dropTarget.removeNotify(peer);
dropTarget.removeNotify();
DropTarget t = dropTarget;
@ -1113,12 +1104,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
if ((dropTarget = dt) != null) {
try {
dropTarget.setComponent(this);
if (peer != null) dropTarget.addNotify(peer);
dropTarget.addNotify();
} catch (IllegalArgumentException iae) {
if (old != null) {
try {
old.setComponent(this);
if (peer != null) dropTarget.addNotify(peer);
dropTarget.addNotify();
} catch (IllegalArgumentException iae1) {
// ignore it!
}
@ -1179,7 +1170,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
graphicsConfig = gc;
ComponentPeer peer = getPeer();
ComponentPeer peer = this.peer;
if (peer != null) {
return peer.updateGraphicsData(gc);
}
@ -1239,6 +1230,14 @@ public abstract class Component implements ImageObserver, MenuContainer,
return Toolkit.getDefaultToolkit();
}
final ComponentFactory getComponentFactory() {
final Toolkit toolkit = getToolkit();
if (toolkit instanceof ComponentFactory) {
return (ComponentFactory) toolkit;
}
throw new AWTError("UI components are unsupported by: " + toolkit);
}
/**
* Determines whether this component is valid. A component is valid
* when it is correctly sized and positioned within its parent
@ -1281,7 +1280,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2
*/
public boolean isDisplayable() {
return getPeer() != null;
return peer != null;
}
/**
@ -1336,7 +1335,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return null;
}
Window win = getContainingWindow();
if (!Toolkit.getDefaultToolkit().getMouseInfoPeer().isWindowUnderMouse(win)) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (!(toolkit instanceof ComponentFactory)) {
return null;
}
if (!((ComponentFactory) toolkit).getMouseInfoPeer().isWindowUnderMouse(win)) {
return null;
}
final boolean INCLUDE_DISABLED = true;
@ -2582,7 +2585,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2
*/
public boolean isOpaque() {
if (getPeer() == null) {
if (peer == null) {
return false;
}
else {
@ -2608,7 +2611,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.2
*/
public boolean isLightweight() {
return getPeer() instanceof LightweightPeer;
return peer instanceof LightweightPeer;
}
@ -3126,7 +3129,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
* obtained
* @return the font metrics for <code>font</code>
* @see #getFont
* @see #getPeer
* @see java.awt.peer.ComponentPeer#getFontMetrics(Font)
* @see Toolkit#getFontMetrics(Font)
* @since 1.0
@ -3186,7 +3188,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (nativeContainer == null) return;
ComponentPeer cPeer = nativeContainer.getPeer();
ComponentPeer cPeer = nativeContainer.peer;
if (cPeer != null) {
cPeer.updateCursorImmediately();
@ -5019,7 +5021,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (source != null) {
Container target = source.getNativeContainer();
if (target != null) {
tpeer = target.getPeer();
tpeer = target.peer;
}
}
}
@ -6972,7 +6974,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (peer == null) {
// Update both the Component's peer variable and the local
// variable we use for thread safety.
this.peer = peer = getToolkit().createComponent(this);
this.peer = peer = getComponentFactory().createComponent(this);
}
// This is a lightweight component which means it won't be
@ -7022,7 +7024,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
popup.addNotify();
}
if (dropTarget != null) dropTarget.addNotify(peer);
if (dropTarget != null) dropTarget.addNotify();
peerFont = getFont();
@ -7109,7 +7111,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
((FlipBufferStrategy)bufferStrategy).destroyBuffers();
}
if (dropTarget != null) dropTarget.removeNotify(peer);
if (dropTarget != null) dropTarget.removeNotify();
// Hide peer first to stop system events such as cursor moves.
if (visible) {
@ -9851,7 +9853,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
if (!isLightweight()) {
ComponentPeer peer = getPeer();
ComponentPeer peer = this.peer;
if (peer != null) {
// The Region class has some optimizations. That's why
// we should manually check whether it's empty and
@ -9975,7 +9977,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
for (int i = indexAbove; i > -1; i--) {
Component comp = cont.getComponent(i);
if (comp != null && comp.isDisplayable() && !comp.isLightweight()) {
return comp.getPeer();
return comp.peer;
}
}
// traversing the hierarchy up to the closest HW container;

@ -820,7 +820,7 @@ public class Container extends Component {
}
} else {
// Q: Need to update NativeInLightFixer?
comp.getPeer().reparent(parentPeer);
comp.peer.reparent(parentPeer);
}
}
}
@ -840,10 +840,10 @@ public class Container extends Component {
// If component is lightweight container we need to reparent all its explicit heavyweight children
if (comp instanceof Container) {
// Traverse component's tree till depth-first until encountering heavyweight component
reparentTraverse((ContainerPeer)getPeer(), (Container)comp);
reparentTraverse((ContainerPeer)peer, (Container)comp);
}
} else {
comp.getPeer().reparent((ContainerPeer)getPeer());
comp.peer.reparent((ContainerPeer) peer);
}
}
@ -4195,7 +4195,7 @@ public class Container extends Component {
}
} else {
if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer();
ComponentPeer peer = comp.peer;
if (peer != null) {
peer.setVisible(true);
}
@ -4217,7 +4217,7 @@ public class Container extends Component {
}
} else {
if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer();
ComponentPeer peer = comp.peer;
if (peer != null) {
peer.setVisible(false);
}
@ -4239,7 +4239,7 @@ public class Container extends Component {
((Container)comp).recursiveRelocateHeavyweightChildren(newOrigin);
}
} else {
ComponentPeer peer = comp.getPeer();
ComponentPeer peer = comp.peer;
if (peer != null) {
peer.setBounds(origin.x + comp.getX(), origin.y + comp.getY(),
comp.getWidth(), comp.getHeight(),

@ -504,7 +504,10 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
} else if (comp instanceof Container && comp != aContainer) {
Container cont = (Container)comp;
if (cont.isFocusTraversalPolicyProvider()) {
return cont.getFocusTraversalPolicy().getLastComponent(cont);
Component retComp = cont.getFocusTraversalPolicy().getLastComponent(cont);
if (retComp != null) {
return retComp;
}
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, 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
@ -93,7 +93,6 @@ public class DefaultFocusTraversalPolicy
* @return <code>true</code> if aComponent meets the above requirements;
* <code>false</code> otherwise
*/
@SuppressWarnings("deprecation")
protected boolean accept(Component aComponent) {
if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
aComponent.isEnabled()))
@ -123,7 +122,7 @@ public class DefaultFocusTraversalPolicy
return focusable;
}
ComponentPeer peer = aComponent.getPeer();
ComponentPeer peer = aComponent.peer;
return (peer != null && peer.isFocusable());
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, 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
@ -796,7 +796,6 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
* @return <code>true</code>
* @see Component#dispatchEvent
*/
@SuppressWarnings("deprecation")
public boolean dispatchKeyEvent(KeyEvent e) {
Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();
@ -824,14 +823,14 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
// Allow the peer to process KeyEvent
Component source = e.getComponent();
ComponentPeer peer = source.getPeer();
ComponentPeer peer = source.peer;
if (peer == null || peer instanceof LightweightPeer) {
// if focus owner is lightweight then its native container
// processes event
Container target = source.getNativeContainer();
if (target != null) {
peer = target.getPeer();
peer = target.peer;
}
}
if (peer != null) {
@ -1049,7 +1048,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
Component source = (Component)ke.getSource();
Container target = source.getNativeContainer();
if (target != null) {
ComponentPeer peer = target.getPeer();
ComponentPeer peer = target.peer;
if (peer != null) {
peer.handleEvent(ke);
/**

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, 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
@ -25,19 +25,16 @@
package java.awt;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URI;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.AWTPermission;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
import java.awt.peer.DesktopPeer;
import sun.awt.SunToolkit;
import sun.awt.HeadlessToolkit;
import java.io.File;
import java.io.FilePermission;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import sun.awt.SunToolkit;
import sun.security.util.SecurityConstants;
/**
@ -122,7 +119,11 @@ public class Desktop {
* Suppresses default constructor for noninstantiability.
*/
private Desktop() {
peer = Toolkit.getDefaultToolkit().createDesktopPeer(this);
Toolkit defaultToolkit = Toolkit.getDefaultToolkit();
// same cast as in isDesktopSupported()
if (defaultToolkit instanceof SunToolkit) {
peer = ((SunToolkit) defaultToolkit).createDesktopPeer(this);
}
}
/**

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -36,11 +36,9 @@ import javax.accessibility.*;
import sun.awt.AppContext;
import sun.awt.AWTPermissions;
import sun.awt.SunToolkit;
import sun.awt.PeerEvent;
import sun.awt.util.IdentityArrayList;
import sun.awt.util.IdentityLinkedList;
import java.security.AccessControlException;
import java.util.function.BooleanSupplier;
/**
* A Dialog is a top-level window with a title and a border
@ -749,15 +747,14 @@ public class Dialog extends Window {
* @see Component#isDisplayable
* @see #removeNotify
*/
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
if (parent != null && parent.getPeer() == null) {
if (parent != null && parent.peer == null) {
parent.addNotify();
}
if (peer == null) {
peer = getToolkit().createDialog(this);
peer = getComponentFactory().createDialog(this);
}
super.addNotify();
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -314,14 +314,13 @@ public class FileDialog extends Dialog {
* Creates the file dialog's peer. The peer allows us to change the look
* of the file dialog without changing its functionality.
*/
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized(getTreeLock()) {
if (parent != null && parent.getPeer() == null) {
if (parent != null && parent.peer == null) {
parent.addNotify();
}
if (peer == null)
peer = getToolkit().createFileDialog(this);
peer = getComponentFactory().createFileDialog(this);
super.addNotify();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -41,10 +41,11 @@ import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.text.AttributedCharacterIterator.Attribute;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Map;
import sun.awt.ComponentFactory;
import sun.font.StandardGlyphVector;
import sun.font.AttributeMap;
@ -239,6 +240,11 @@ public class Font implements java.io.Serializable
public boolean isCreatedFont(Font font) {
return font.createdFont;
}
@Override
public FontPeer getFontPeer(final Font font) {
return font.getFontPeer();
}
}
static {
@ -434,24 +440,16 @@ public class Font implements java.io.Serializable
private static final long serialVersionUID = -4206021311591459213L;
/**
* Gets the peer of this <code>Font</code>.
* @return the peer of the <code>Font</code>.
* @since 1.1
* @deprecated Font rendering is now platform independent.
* Gets the peer of this {@code Font}.
*
* @return the peer of the {@code Font}.
*/
@Deprecated
public FontPeer getPeer(){
return getPeer_NoClientCode();
}
// NOTE: This method is called by privileged threads.
// We implement this functionality in a package-private method
// to insure that it cannot be overridden by client subclasses.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() {
private FontPeer getFontPeer() {
if(peer == null) {
Toolkit tk = Toolkit.getDefaultToolkit();
this.peer = tk.getFontPeer(name, style);
if (tk instanceof ComponentFactory) {
peer = ((ComponentFactory) tk).getFontPeer(name, style);
}
}
return peer;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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,21 +24,23 @@
*/
package java.awt;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import java.awt.peer.FramePeer;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
import java.io.Serializable;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.IOException;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Vector;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
import sun.awt.AWTAccessor;
import java.lang.ref.WeakReference;
import javax.accessibility.*;
import sun.awt.SunToolkit;
/**
* A <code>Frame</code> is a top-level window with a title and a border.
@ -474,7 +476,7 @@ public class Frame extends Window implements MenuContainer {
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null) {
peer = getToolkit().createFrame(this);
peer = getComponentFactory().createFrame(this);
}
FramePeer p = (FramePeer)peer;
MenuBar menuBar = this.menuBar;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, 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
@ -3054,11 +3054,10 @@ public abstract class KeyboardFocusManager
return (wto != wfrom);
}
@SuppressWarnings("deprecation")
static Component getHeavyweight(Component comp) {
if (comp == null || comp.getPeer() == null) {
if (comp == null || comp.peer == null) {
return null;
} else if (comp.getPeer() instanceof LightweightPeer) {
} else if (comp.peer instanceof LightweightPeer) {
return comp.getNativeContainer();
} else {
return comp;

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -184,7 +184,7 @@ public class Label extends Component implements Accessible {
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createLabel(this);
peer = getComponentFactory().createLabel(this);
super.addNotify();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -252,7 +252,7 @@ public class List extends Component implements ItemSelectable, Accessible {
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createList(this);
peer = getComponentFactory().createList(this);
super.addNotify();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -174,7 +174,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = Toolkit.getDefaultToolkit().createMenu(this);
peer = getComponentFactory().createMenu(this);
int nitems = getItemCount();
for (int i = 0 ; i < nitems ; i++) {
MenuItem mi = getItem(i);

@ -143,7 +143,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = Toolkit.getDefaultToolkit().createMenuBar(this);
peer = getComponentFactory().createMenuBar(this);
int nmenus = getMenuCount();
for (int i = 0 ; i < nmenus ; i++) {

@ -30,6 +30,8 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import sun.awt.AppContext;
import sun.awt.AWTAccessor;
import sun.awt.ComponentFactory;
import javax.accessibility.*;
import java.security.AccessControlContext;
@ -57,7 +59,7 @@ public abstract class MenuComponent implements java.io.Serializable {
}
}
transient MenuComponentPeer peer;
transient volatile MenuComponentPeer peer;
transient MenuContainer parent;
/**
@ -142,6 +144,11 @@ public abstract class MenuComponent implements java.io.Serializable {
menuComp.appContext = appContext;
}
@Override
@SuppressWarnings("unchecked")
public <T extends MenuComponentPeer> T getPeer(MenuComponent menuComp) {
return (T) menuComp.peer;
}
@Override
public MenuContainer getParent(MenuComponent menuComp) {
return menuComp.parent;
}
@ -179,6 +186,14 @@ public abstract class MenuComponent implements java.io.Serializable {
// getName()
}
final ComponentFactory getComponentFactory() {
final Toolkit toolkit = Toolkit.getDefaultToolkit();
if (toolkit instanceof ComponentFactory) {
return (ComponentFactory) toolkit;
}
throw new AWTError("UI components are unsupported by: " + toolkit);
}
/**
* Gets the name of the menu component.
* @return the name of the menu component
@ -225,16 +240,6 @@ public abstract class MenuComponent implements java.io.Serializable {
return parent;
}
/**
* @deprecated As of JDK version 1.1,
* programs should not directly manipulate peers.
* @return the peer for this component
*/
@Deprecated
public MenuComponentPeer getPeer() {
return peer;
}
/**
* Gets the font used for this menu component.
* @return the font used in this menu component, if there is one;

@ -233,7 +233,7 @@ public class MenuItem extends MenuComponent implements Accessible {
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = Toolkit.getDefaultToolkit().createMenuItem(this);
peer = getComponentFactory().createMenuItem(this);
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, 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
@ -26,6 +26,7 @@
package java.awt;
import sun.awt.AWTPermissions;
import sun.awt.ComponentFactory;
/**
* <code>MouseInfo</code> provides methods for getting information about the mouse,
@ -80,8 +81,13 @@ public class MouseInfo {
security.checkPermission(AWTPermissions.WATCH_MOUSE_PERMISSION);
}
Toolkit toolkit = Toolkit.getDefaultToolkit();
Point point = new Point(0, 0);
int deviceNum = Toolkit.getDefaultToolkit().getMouseInfoPeer().fillPointWithCoords(point);
int deviceNum = 0;
if (toolkit instanceof ComponentFactory) {
deviceNum = ((ComponentFactory) toolkit).getMouseInfoPeer().fillPointWithCoords(point);
}
GraphicsDevice[] gds = GraphicsEnvironment.getLocalGraphicsEnvironment().
getScreenDevices();
PointerInfo retval = null;
@ -113,9 +119,13 @@ public class MouseInfo {
/**
* Returns the number of buttons on the mouse.
* On systems without a mouse, returns <code>-1</code>.
* The number of buttons is obtained from the AWT Toolkit
* by requesting the {@code "awt.mouse.numButtons"} desktop property
* which is set by the underlying native platform.
*
* @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true
* @return number of buttons on the mouse
* @see Toolkit#getDesktopProperty
* @since 1.5
*/
public static int getNumberOfButtons() throws HeadlessException {

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -83,7 +83,7 @@ public class Panel extends Container implements Accessible {
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createPanel(this);
peer = getComponentFactory().createPanel(this);
super.addNotify();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2015, 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
@ -121,7 +121,7 @@ public class PopupMenu extends Menu {
}
else {
if (peer == null)
peer = Toolkit.getDefaultToolkit().createPopupMenu(this);
peer = getComponentFactory().createPopupMenu(this);
int nitems = getItemCount();
for (int i = 0 ; i < nitems ; i++) {
MenuItem mi = getItem(i);
@ -153,7 +153,6 @@ public class PopupMenu extends Menu {
* parent's hierarchy
* @exception RuntimeException if the parent is not showing on screen
*/
@SuppressWarnings("deprecation")
public void show(Component origin, int x, int y) {
// Use localParent for thread safety.
MenuContainer localParent = parent;
@ -177,7 +176,7 @@ public class PopupMenu extends Menu {
throw new IllegalArgumentException("origin not in parent's hierarchy");
}
}
if (compParent.getPeer() == null || !compParent.isShowing()) {
if (compParent.peer == null || !compParent.isShowing()) {
throw new RuntimeException("parent not showing on screen");
}
if (peer == null) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2015, 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,7 +24,6 @@
*/
package java.awt;
import java.awt.peer.LightweightPeer;
import java.awt.peer.ScrollPanePeer;
import java.awt.event.*;
import javax.accessibility.*;
@ -562,7 +561,7 @@ public class ScrollPane extends Container implements Accessible {
}
if (peer == null)
peer = getToolkit().createScrollPane(this);
peer = getComponentFactory().createScrollPane(this);
super.addNotify();
// Bug 4124460. Restore the adjustable values.

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -433,7 +433,7 @@ public class Scrollbar extends Component implements Adjustable, Accessible {
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createScrollbar(this);
peer = getComponentFactory().createScrollbar(this);
super.addNotify();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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,15 +24,15 @@
*/
package java.awt;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.peer.TextAreaPeer;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.HashSet;
import java.util.Set;
import javax.accessibility.*;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
/**
* A <code>TextArea</code> object is a multi-line region
@ -290,7 +290,7 @@ public class TextArea extends TextComponent {
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createTextArea(this);
peer = getComponentFactory().createTextArea(this);
super.addNotify();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2015, 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
@ -219,7 +219,7 @@ public class TextField extends TextComponent {
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
peer = getToolkit().createTextField(this);
peer = getComponentFactory().createTextField(this);
super.addNotify();
}
}

@ -25,36 +25,37 @@
package java.awt;
import java.beans.PropertyChangeEvent;
import java.awt.datatransfer.Clipboard;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragGestureRecognizer;
import java.awt.dnd.DragSource;
import java.awt.event.*;
import java.awt.peer.*;
import java.awt.im.InputMethodHighlight;
import java.awt.image.ColorModel;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.ColorModel;
import java.awt.datatransfer.Clipboard;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragGestureRecognizer;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.InvalidDnDOperationException;
import java.awt.dnd.peer.DragSourceContextPeer;
import java.net.URL;
import java.io.File;
import java.io.FileInputStream;
import java.util.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import sun.awt.AppContext;
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.EventListener;
import java.util.HashMap;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import java.util.WeakHashMap;
import sun.awt.HeadlessToolkit;
import sun.awt.NullComponentPeer;
import sun.awt.PeerEvent;
import sun.awt.SunToolkit;
import sun.awt.AWTAccessor;
import sun.awt.AWTPermissions;
import sun.awt.AppContext;
import sun.awt.HeadlessToolkit;
import sun.awt.PeerEvent;
import sun.awt.SunToolkit;
import sun.util.CoreResourceBundleControl;
/**
@ -112,341 +113,6 @@ import sun.util.CoreResourceBundleControl;
*/
public abstract class Toolkit {
/**
* Creates this toolkit's implementation of the <code>Desktop</code>
* using the specified peer interface.
* @param target the desktop to be implemented
* @return this toolkit's implementation of the <code>Desktop</code>
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Desktop
* @see java.awt.peer.DesktopPeer
* @since 1.6
*/
protected abstract DesktopPeer createDesktopPeer(Desktop target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>Button</code> using
* the specified peer interface.
* @param target the button to be implemented.
* @return this toolkit's implementation of <code>Button</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Button
* @see java.awt.peer.ButtonPeer
*/
protected abstract ButtonPeer createButton(Button target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>TextField</code> using
* the specified peer interface.
* @param target the text field to be implemented.
* @return this toolkit's implementation of <code>TextField</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.TextField
* @see java.awt.peer.TextFieldPeer
*/
protected abstract TextFieldPeer createTextField(TextField target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>Label</code> using
* the specified peer interface.
* @param target the label to be implemented.
* @return this toolkit's implementation of <code>Label</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Label
* @see java.awt.peer.LabelPeer
*/
protected abstract LabelPeer createLabel(Label target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>List</code> using
* the specified peer interface.
* @param target the list to be implemented.
* @return this toolkit's implementation of <code>List</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.List
* @see java.awt.peer.ListPeer
*/
protected abstract ListPeer createList(java.awt.List target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>Checkbox</code> using
* the specified peer interface.
* @param target the check box to be implemented.
* @return this toolkit's implementation of <code>Checkbox</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Checkbox
* @see java.awt.peer.CheckboxPeer
*/
protected abstract CheckboxPeer createCheckbox(Checkbox target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>Scrollbar</code> using
* the specified peer interface.
* @param target the scroll bar to be implemented.
* @return this toolkit's implementation of <code>Scrollbar</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Scrollbar
* @see java.awt.peer.ScrollbarPeer
*/
protected abstract ScrollbarPeer createScrollbar(Scrollbar target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>ScrollPane</code> using
* the specified peer interface.
* @param target the scroll pane to be implemented.
* @return this toolkit's implementation of <code>ScrollPane</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.ScrollPane
* @see java.awt.peer.ScrollPanePeer
* @since 1.1
*/
protected abstract ScrollPanePeer createScrollPane(ScrollPane target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>TextArea</code> using
* the specified peer interface.
* @param target the text area to be implemented.
* @return this toolkit's implementation of <code>TextArea</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.TextArea
* @see java.awt.peer.TextAreaPeer
*/
protected abstract TextAreaPeer createTextArea(TextArea target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>Choice</code> using
* the specified peer interface.
* @param target the choice to be implemented.
* @return this toolkit's implementation of <code>Choice</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Choice
* @see java.awt.peer.ChoicePeer
*/
protected abstract ChoicePeer createChoice(Choice target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>Frame</code> using
* the specified peer interface.
* @param target the frame to be implemented.
* @return this toolkit's implementation of <code>Frame</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Frame
* @see java.awt.peer.FramePeer
*/
protected abstract FramePeer createFrame(Frame target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>Canvas</code> using
* the specified peer interface.
* @param target the canvas to be implemented.
* @return this toolkit's implementation of <code>Canvas</code>.
* @see java.awt.Canvas
* @see java.awt.peer.CanvasPeer
*/
protected abstract CanvasPeer createCanvas(Canvas target);
/**
* Creates this toolkit's implementation of <code>Panel</code> using
* the specified peer interface.
* @param target the panel to be implemented.
* @return this toolkit's implementation of <code>Panel</code>.
* @see java.awt.Panel
* @see java.awt.peer.PanelPeer
*/
protected abstract PanelPeer createPanel(Panel target);
/**
* Creates this toolkit's implementation of <code>Window</code> using
* the specified peer interface.
* @param target the window to be implemented.
* @return this toolkit's implementation of <code>Window</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Window
* @see java.awt.peer.WindowPeer
*/
protected abstract WindowPeer createWindow(Window target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>Dialog</code> using
* the specified peer interface.
* @param target the dialog to be implemented.
* @return this toolkit's implementation of <code>Dialog</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Dialog
* @see java.awt.peer.DialogPeer
*/
protected abstract DialogPeer createDialog(Dialog target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>MenuBar</code> using
* the specified peer interface.
* @param target the menu bar to be implemented.
* @return this toolkit's implementation of <code>MenuBar</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.MenuBar
* @see java.awt.peer.MenuBarPeer
*/
protected abstract MenuBarPeer createMenuBar(MenuBar target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>Menu</code> using
* the specified peer interface.
* @param target the menu to be implemented.
* @return this toolkit's implementation of <code>Menu</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Menu
* @see java.awt.peer.MenuPeer
*/
protected abstract MenuPeer createMenu(Menu target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>PopupMenu</code> using
* the specified peer interface.
* @param target the popup menu to be implemented.
* @return this toolkit's implementation of <code>PopupMenu</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.PopupMenu
* @see java.awt.peer.PopupMenuPeer
* @since 1.1
*/
protected abstract PopupMenuPeer createPopupMenu(PopupMenu target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>MenuItem</code> using
* the specified peer interface.
* @param target the menu item to be implemented.
* @return this toolkit's implementation of <code>MenuItem</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.MenuItem
* @see java.awt.peer.MenuItemPeer
*/
protected abstract MenuItemPeer createMenuItem(MenuItem target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>FileDialog</code> using
* the specified peer interface.
* @param target the file dialog to be implemented.
* @return this toolkit's implementation of <code>FileDialog</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.FileDialog
* @see java.awt.peer.FileDialogPeer
*/
protected abstract FileDialogPeer createFileDialog(FileDialog target)
throws HeadlessException;
/**
* Creates this toolkit's implementation of <code>CheckboxMenuItem</code> using
* the specified peer interface.
* @param target the checkbox menu item to be implemented.
* @return this toolkit's implementation of <code>CheckboxMenuItem</code>.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.CheckboxMenuItem
* @see java.awt.peer.CheckboxMenuItemPeer
*/
protected abstract CheckboxMenuItemPeer createCheckboxMenuItem(
CheckboxMenuItem target) throws HeadlessException;
/**
* Obtains this toolkit's implementation of helper class for
* <code>MouseInfo</code> operations.
* @return this toolkit's implementation of helper for <code>MouseInfo</code>
* @throws UnsupportedOperationException if this operation is not implemented
* @see java.awt.peer.MouseInfoPeer
* @see java.awt.MouseInfo
* @since 1.5
*/
protected MouseInfoPeer getMouseInfoPeer() {
throw new UnsupportedOperationException("Not implemented");
}
private static LightweightPeer lightweightMarker;
/**
* Creates a peer for a component or container. This peer is windowless
* and allows the Component and Container classes to be extended directly
* to create windowless components that are defined entirely in java.
*
* @param target The Component to be created.
* @return the peer for the specified component
*/
protected LightweightPeer createComponent(Component target) {
if (lightweightMarker == null) {
lightweightMarker = new NullComponentPeer();
}
return lightweightMarker;
}
/**
* Creates this toolkit's implementation of <code>Font</code> using
* the specified peer interface.
* @param name the font to be implemented
* @param style the style of the font, such as <code>PLAIN</code>,
* <code>BOLD</code>, <code>ITALIC</code>, or a combination
* @return this toolkit's implementation of <code>Font</code>
* @see java.awt.Font
* @see java.awt.peer.FontPeer
* @see java.awt.GraphicsEnvironment#getAllFonts
* @deprecated see java.awt.GraphicsEnvironment#getAllFonts
*/
@Deprecated
protected abstract FontPeer getFontPeer(String name, int style);
// The following method is called by the private method
// <code>updateSystemColors</code> in <code>SystemColor</code>.
@ -1748,17 +1414,6 @@ public abstract class Toolkit {
return getDefaultToolkit().getSystemEventQueueImpl();
}
/**
* Creates the peer for a DragSourceContext.
* Always throws InvalidDndOperationException if
* GraphicsEnvironment.isHeadless() returns true.
*
* @param dge the {@code DragGestureEvent}
* @return the peer created
* @see java.awt.GraphicsEnvironment#isHeadless
*/
public abstract DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException;
/**
* Creates a concrete, platform dependent, subclass of the abstract
* DragGestureRecognizer class requested, and associates it with the

@ -29,7 +29,6 @@ import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.awt.im.InputContext;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.awt.peer.ComponentPeer;
import java.awt.peer.WindowPeer;
import java.beans.PropertyChangeListener;
@ -56,7 +55,6 @@ import sun.awt.AppContext;
import sun.awt.CausedFocusEvent;
import sun.awt.SunToolkit;
import sun.awt.util.IdentityArrayList;
import sun.java2d.Disposer;
import sun.java2d.pipe.Region;
import sun.security.action.GetPropertyAction;
import sun.util.logging.PlatformLogger;
@ -755,15 +753,14 @@ public class Window extends Container implements Accessible {
* @see Container#removeNotify
* @since 1.0
*/
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized (getTreeLock()) {
Container parent = this.parent;
if (parent != null && parent.getPeer() == null) {
if (parent != null && parent.peer == null) {
parent.addNotify();
}
if (peer == null) {
peer = getToolkit().createWindow(this);
peer = getComponentFactory().createWindow(this);
}
synchronized (allWindows) {
allWindows.add(this);
@ -802,7 +799,7 @@ public class Window extends Container implements Accessible {
@SuppressWarnings("deprecation")
public void pack() {
Container parent = this.parent;
if (parent != null && parent.getPeer() == null) {
if (parent != null && parent.peer == null) {
parent.addNotify();
}
if (peer == null) {
@ -1072,10 +1069,9 @@ public class Window extends Container implements Accessible {
}
}
@SuppressWarnings("deprecation")
static void updateChildFocusableWindowState(Window w) {
if (w.getPeer() != null && w.isShowing()) {
((WindowPeer)w.getPeer()).updateFocusableWindowState();
if (w.peer != null && w.isShowing()) {
((WindowPeer)w.peer).updateFocusableWindowState();
}
for (int i = 0; i < w.ownedWindowList.size(); i++) {
Window child = w.ownedWindowList.elementAt(i).get();
@ -1160,10 +1156,9 @@ public class Window extends Container implements Accessible {
* as reported in javadoc. So we need to implement this functionality even if a
* child overrides dispose() in a wrong way without calling super.dispose().
*/
@SuppressWarnings("deprecation")
void disposeImpl() {
dispose();
if (getPeer() != null) {
if (peer != null) {
doDispose();
}
}
@ -3651,7 +3646,7 @@ public class Window extends Container implements Accessible {
}
}
this.opacity = opacity;
WindowPeer peer = (WindowPeer)getPeer();
WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.setOpacity(opacity);
}
@ -3728,7 +3723,6 @@ public class Window extends Container implements Accessible {
*
* @since 1.7
*/
@SuppressWarnings("deprecation")
public void setShape(Shape shape) {
synchronized (getTreeLock()) {
if (shape != null) {
@ -3746,7 +3740,7 @@ public class Window extends Container implements Accessible {
}
}
this.shape = (shape == null) ? null : new Path2D.Float(shape);
WindowPeer peer = (WindowPeer)getPeer();
WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.applyShape(shape == null ? null : Region.getInstance(shape, null));
}
@ -3846,7 +3840,6 @@ public class Window extends Container implements Accessible {
* @see GraphicsConfiguration#isTranslucencyCapable()
*/
@Override
@SuppressWarnings("deprecation")
public void setBackground(Color bgColor) {
Color oldBg = getBackground();
super.setBackground(bgColor);
@ -3874,7 +3867,7 @@ public class Window extends Container implements Accessible {
} else if ((oldAlpha < 255) && (alpha == 255)) {
setLayersOpaque(this, true);
}
WindowPeer peer = (WindowPeer)getPeer();
WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.setOpaque(alpha == 255);
}
@ -3899,10 +3892,9 @@ public class Window extends Container implements Accessible {
return bg != null ? bg.getAlpha() == 255 : true;
}
@SuppressWarnings("deprecation")
private void updateWindow() {
synchronized (getTreeLock()) {
WindowPeer peer = (WindowPeer)getPeer();
WindowPeer peer = (WindowPeer) this.peer;
if (peer != null) {
peer.updateWindow();
}
@ -4090,7 +4082,6 @@ public class Window extends Container implements Accessible {
window.securityWarningHeight = height;
}
@SuppressWarnings("deprecation")
public void setSecurityWarningPosition(Window window,
Point2D point, float alignmentX, float alignmentY)
{
@ -4100,7 +4091,7 @@ public class Window extends Container implements Accessible {
window.securityWarningAlignmentY = alignmentY;
synchronized (window.getTreeLock()) {
WindowPeer peer = (WindowPeer)window.getPeer();
WindowPeer peer = (WindowPeer) window.peer;
if (peer != null) {
peer.repositionSecurityWarning();
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -35,13 +35,15 @@ import java.awt.Toolkit;
import java.awt.datatransfer.FlavorMap;
import java.awt.datatransfer.SystemFlavorMap;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.peer.DragSourceContextPeer;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.security.AccessController;
import java.util.EventListener;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.DragSourceContextAccessor;
import sun.awt.dnd.SunDragSourceContextPeer;
import sun.security.action.GetIntegerAction;
@ -303,22 +305,16 @@ public class DragSource implements Serializable {
try {
if (flavorMap != null) this.flavorMap = flavorMap;
DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
DragSourceContext dsc = createDragSourceContext(dscp,
trigger,
dragCursor,
dragImage,
imageOffset,
transferable,
dsl
);
DragSourceContext dsc = createDragSourceContext(trigger, dragCursor,
dragImage,
imageOffset,
transferable, dsl);
if (dsc == null) {
throw new InvalidDnDOperationException();
}
dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
DragSourceContextAccessor acc = AWTAccessor.getDragSourceContextAccessor();
acc.getPeer(dsc).startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
} catch (RuntimeException e) {
SunDragSourceContextPeer.setDragDropInProgress(false);
throw e;
@ -442,7 +438,6 @@ public class DragSource implements Serializable {
* is registered with the created <code>DragSourceContext</code>,
* but <code>NullPointerException</code> is not thrown.
*
* @param dscp The <code>DragSourceContextPeer</code> for this drag
* @param dgl The <code>DragGestureEvent</code> that triggered the
* drag
* @param dragCursor The initial {@code Cursor} for this drag operation
@ -473,8 +468,13 @@ public class DragSource implements Serializable {
* event are equal to <code>DnDConstants.ACTION_NONE</code>.
*/
protected DragSourceContext createDragSourceContext(DragSourceContextPeer dscp, DragGestureEvent dgl, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable t, DragSourceListener dsl) {
return new DragSourceContext(dscp, dgl, dragCursor, dragImage, imageOffset, t, dsl);
protected DragSourceContext createDragSourceContext(DragGestureEvent dgl,
Cursor dragCursor,
Image dragImage,
Point imageOffset,
Transferable t,
DragSourceListener dsl) {
return new DragSourceContext(dgl, dragCursor, dragImage, imageOffset, t, dsl);
}
/**

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -25,25 +25,26 @@
package java.awt.dnd;
import java.awt.AWTError;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.peer.DragSourceContextPeer;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.TooManyListenersException;
import sun.awt.AWTAccessor;
import sun.awt.ComponentFactory;
/**
* The <code>DragSourceContext</code> class is responsible for managing the
* initiator side of the Drag and Drop protocol. In particular, it is responsible
@ -123,6 +124,10 @@ public class DragSourceContext
protected static final int CHANGED = 3;
static {
AWTAccessor.setDragSourceContextAccessor(dsc -> dsc.peer);
}
/**
* Called from <code>DragSource</code>, this constructor creates a new
* <code>DragSourceContext</code> given the
@ -155,7 +160,6 @@ public class DragSourceContext
* If <code>DragSourceListener</code> is <code>null</code> no exception
* is thrown.
*
* @param dscp the <code>DragSourceContextPeer</code> for this drag
* @param trigger the triggering event
* @param dragCursor the initial {@code Cursor} for this drag operation
* or {@code null} for the default cursor handling;
@ -179,10 +183,16 @@ public class DragSourceContext
* @throws NullPointerException if dscp, trigger, or t are null, or
* if dragImage is non-null and offset is null
*/
public DragSourceContext(DragSourceContextPeer dscp,
DragGestureEvent trigger, Cursor dragCursor,
public DragSourceContext(DragGestureEvent trigger, Cursor dragCursor,
Image dragImage, Point offset, Transferable t,
DragSourceListener dsl) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (!(toolkit instanceof ComponentFactory)) {
throw new AWTError("Unsupported toolkit: " + toolkit);
}
DragSourceContextPeer dscp = ((ComponentFactory) toolkit).
createDragSourceContextPeer(trigger);
if (dscp == null) {
throw new NullPointerException("DragSourceContextPeer");
}
@ -623,8 +633,7 @@ public class DragSourceContext
/*
* fields
*/
private transient DragSourceContextPeer peer;
private final transient DragSourceContextPeer peer;
/**
* The event which triggered the start of the drag.

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -49,6 +49,9 @@ import java.awt.peer.ComponentPeer;
import java.awt.peer.LightweightPeer;
import java.awt.dnd.peer.DropTargetPeer;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
/**
* The <code>DropTarget</code> is associated
@ -204,19 +207,13 @@ public class DropTarget implements DropTargetListener, Serializable {
if (component == c || component != null && component.equals(c))
return;
Component old;
ComponentPeer oldPeer = null;
final Component old = component;
if ((old = component) != null) {
if (old != null) {
clearAutoscroll();
component = null;
if (componentPeer != null) {
oldPeer = componentPeer;
removeNotify(componentPeer);
}
removeNotify();
old.setDropTarget(null);
}
@ -226,7 +223,7 @@ public class DropTarget implements DropTargetListener, Serializable {
} catch (Exception e) { // undo the change
if (old != null) {
old.setDropTarget(this);
addNotify(oldPeer);
addNotify();
}
}
}
@ -494,24 +491,24 @@ public class DropTarget implements DropTargetListener, Serializable {
* association of the ComponentPeer with the Component may result in
* a malfunction of the DnD system.
**********************************************************************
*
* @param peer The Peer of the Component we are associated with!
*
*/
@SuppressWarnings("deprecation")
public void addNotify(ComponentPeer peer) {
if (peer == componentPeer) return;
public void addNotify() {
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
ComponentPeer peer = acc.getPeer(component);
if (peer == null || peer == componentPeer) {
return;
}
componentPeer = peer;
for (Component c = component;
c != null && peer instanceof LightweightPeer; c = c.getParent()) {
peer = c.getPeer();
peer = acc.getPeer(c);
}
if (peer instanceof DropTargetPeer) {
nativePeer = peer;
nativePeer = (DropTargetPeer) peer;
((DropTargetPeer)peer).addDropTarget(this);
} else {
nativePeer = null;
@ -530,15 +527,14 @@ public class DropTarget implements DropTargetListener, Serializable {
* disassociation of the ComponentPeer from the Component may result in
* a malfunction of the DnD system.
**********************************************************************
*
* @param peer The Peer of the Component we are being disassociated from!
*/
public void removeNotify(ComponentPeer peer) {
if (nativePeer != null)
((DropTargetPeer)nativePeer).removeDropTarget(this);
componentPeer = nativePeer = null;
public void removeNotify() {
if (nativePeer != null) {
nativePeer.removeDropTarget(this);
}
componentPeer = null;
nativePeer = null;
synchronized (this) {
if (isDraggingInside) {
@ -834,7 +830,7 @@ public class DropTarget implements DropTargetListener, Serializable {
/*
* That Component's "native" Peer
*/
private transient ComponentPeer nativePeer;
private transient DropTargetPeer nativePeer;
/**

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -39,6 +39,8 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.DropTargetContextAccessor;
/**
* A <code>DropTargetContext</code> is created
@ -58,6 +60,19 @@ public class DropTargetContext implements Serializable {
private static final long serialVersionUID = -634158968993743371L;
static {
AWTAccessor.setDropTargetContextAccessor(new DropTargetContextAccessor() {
@Override
public void reset(DropTargetContext dtc) {
dtc.reset();
}
@Override
public void setDropTargetContextPeer(DropTargetContext dtc,
DropTargetContextPeer dtcp) {
dtc.setDropTargetContextPeer(dtcp);
}
});
}
/**
* Construct a <code>DropTargetContext</code>
* given a specified <code>DropTarget</code>.
@ -89,21 +104,10 @@ public class DropTargetContext implements Serializable {
public Component getComponent() { return dropTarget.getComponent(); }
/**
* Called when associated with the <code>DropTargetContextPeer</code>.
*
* @param dtcp the <code>DropTargetContextPeer</code>
*/
public void addNotify(DropTargetContextPeer dtcp) {
dropTargetContextPeer = dtcp;
}
/**
* Called when disassociated with the <code>DropTargetContextPeer</code>.
*/
public void removeNotify() {
void reset() {
dropTargetContextPeer = null;
transferable = null;
}
@ -282,11 +286,17 @@ public class DropTargetContext implements Serializable {
*
* @return the platform peer
*/
DropTargetContextPeer getDropTargetContextPeer() {
return dropTargetContextPeer;
}
/**
* Sets the {@code DropTargetContextPeer}
*/
void setDropTargetContextPeer(final DropTargetContextPeer dtcp) {
dropTargetContextPeer = dtcp;
}
/**
* Creates a TransferableProxy to proxy for the specified
* Transferable.
@ -412,7 +422,7 @@ public class DropTargetContext implements Serializable {
*
* @serial
*/
private DropTarget dropTarget;
private final DropTarget dropTarget;
private transient DropTargetContextPeer dropTargetContextPeer;

Some files were not shown because too many files have changed in this diff Show More