--- a/.hgtags Thu Jul 24 09:15:38 2014 +0200
+++ b/.hgtags Fri Jul 25 09:44:53 2014 +0000
@@ -265,3 +265,4 @@
89731ae72a761afdf4262e8b9513f302f6563f89 jdk9-b20
28dd0c7beb3cad9cf95f17b4b5ad87eb447a4084 jdk9-b21
9678e0db8ff6ed845d4c2ee4a3baf7f386a777e5 jdk9-b22
+39cfdc2dcaf3f195c55398e4e677ab053b07e3d2 jdk9-b23
--- a/.hgtags-top-repo Thu Jul 24 09:15:38 2014 +0200
+++ b/.hgtags-top-repo Fri Jul 25 09:44:53 2014 +0000
@@ -265,3 +265,4 @@
ee4fd72b2ec3d92497f37163352f294aa695c6fb jdk9-b20
9052803f4d01feda28b3d65f2b64dd457d21c7b6 jdk9-b21
8e4bdab4c362aadde2d321f968cd503a2f779e2f jdk9-b22
+88567461a2cd9b7fb431fee6440005a694df1f47 jdk9-b23
--- a/common/autoconf/flags.m4 Thu Jul 24 09:15:38 2014 +0200
+++ b/common/autoconf/flags.m4 Fri Jul 25 09:44:53 2014 +0000
@@ -407,11 +407,7 @@
C_O_FLAG_HI="-O3"
C_O_FLAG_NORM="-O2"
fi
- if test "x$HAS_CFLAG_OPTIMIZE_DEBUG" = "xtrue"; then
- C_O_FLAG_DEBUG="$CFLAG_OPTIMIZE_DEBUG_FLAG"
- else
- C_O_FLAG_DEBUG="-O0"
- fi
+ C_O_FLAG_DEBUG="-O0"
C_O_FLAG_NONE="-O0"
elif test "x$TOOLCHAIN_TYPE" = xclang; then
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
--- a/common/autoconf/generated-configure.sh Thu Jul 24 09:15:38 2014 +0200
+++ b/common/autoconf/generated-configure.sh Fri Jul 25 09:44:53 2014 +0000
@@ -4311,7 +4311,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1403557683
+DATE_WHEN_GENERATED=1404942241
###############################################################################
#
@@ -42011,11 +42011,7 @@
C_O_FLAG_HI="-O3"
C_O_FLAG_NORM="-O2"
fi
- if test "x$HAS_CFLAG_OPTIMIZE_DEBUG" = "xtrue"; then
- C_O_FLAG_DEBUG="$CFLAG_OPTIMIZE_DEBUG_FLAG"
- else
- C_O_FLAG_DEBUG="-O0"
- fi
+ C_O_FLAG_DEBUG="-O0"
C_O_FLAG_NONE="-O0"
elif test "x$TOOLCHAIN_TYPE" = xclang; then
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
--- a/corba/.hgtags Thu Jul 24 09:15:38 2014 +0200
+++ b/corba/.hgtags Fri Jul 25 09:44:53 2014 +0000
@@ -265,3 +265,4 @@
87f36eecb1665012d01c5cf102494e591c943ea6 jdk9-b20
3615a4e7f0542ca7552ad6454b742c73ee211d8e jdk9-b21
ddc07abf4307855c0dc904cc5c96cc764023a930 jdk9-b22
+57735d66face054440a63ce99789eac5a5ee1dfd jdk9-b23
--- a/hotspot/.hgtags Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/.hgtags Fri Jul 25 09:44:53 2014 +0000
@@ -425,3 +425,4 @@
c1af79d122ec9f715fa29312b5e91763f3a4dfc4 jdk9-b20
17b4a5e831b398738feedb0afe75245744510153 jdk9-b21
518d1fcc0799494f013e00e0a94a91b6f212d54f jdk9-b22
+dd472cdacc32e3afc7c5bfa7ef16ea0e0befb7fa jdk9-b23
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Fri Jul 25 09:44:53 2014 +0000
@@ -55,7 +55,10 @@
layoutHelper = new IntField(type.getJIntField("_layout_helper"), 0);
name = type.getAddressField("_name");
accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0);
- traceIDField = type.getField("_trace_id");
+ try {
+ traceIDField = type.getField("_trace_id");
+ } catch(Exception e) {
+ }
subklass = new MetadataField(type.getAddressField("_subklass"), 0);
nextSibling = new MetadataField(type.getAddressField("_next_sibling"), 0);
@@ -108,7 +111,11 @@
public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags()); }
public Klass getSubklassKlass() { return (Klass) subklass.getValue(this); }
public Klass getNextSiblingKlass() { return (Klass) nextSibling.getValue(this); }
- public long traceID() { return traceIDField.getJLong(addr); }
+
+ public long traceID() {
+ if (traceIDField == null) return 0;
+ return traceIDField.getJLong(addr);
+ }
// computed access flags - takes care of inner classes etc.
// This is closer to actual source level than getAccessFlags() etc.
--- a/hotspot/make/jprt.properties Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/make/jprt.properties Fri Jul 25 09:44:53 2014 +0000
@@ -126,7 +126,7 @@
${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-jvm98, \
${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-jvm98_nontiered, \
${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-scimark, \
- ${jprt.my.solaris.sparcv9}-product-c2-runThese, \
+ ${jprt.my.solaris.sparcv9}-product-c2-runThese8, \
${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-GCBasher_SerialGC, \
${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-GCBasher_ParallelGC, \
${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-GCBasher_ParNewGC, \
@@ -150,8 +150,9 @@
${jprt.my.solaris.x64}-{product|fastdebug}-c2-jvm98, \
${jprt.my.solaris.x64}-{product|fastdebug}-c2-jvm98_nontiered, \
${jprt.my.solaris.x64}-{product|fastdebug}-c2-scimark, \
- ${jprt.my.solaris.x64}-product-c2-runThese, \
- ${jprt.my.solaris.x64}-product-c2-runThese_Xcomp, \
+ ${jprt.my.solaris.x64}-product-c2-runThese8, \
+ ${jprt.my.solaris.x64}-product-c2-runThese8_Xcomp_lang, \
+ ${jprt.my.solaris.x64}-product-c2-runThese8_Xcomp_vm, \
${jprt.my.solaris.x64}-{product|fastdebug}-c2-GCBasher_SerialGC, \
${jprt.my.solaris.x64}-{product|fastdebug}-c2-GCBasher_ParallelGC, \
${jprt.my.solaris.x64}-{product|fastdebug}-c2-GCBasher_ParNewGC, \
@@ -175,9 +176,11 @@
${jprt.my.linux.i586}-{product|fastdebug}-{c1|c2}-jvm98, \
${jprt.my.linux.i586}-{product|fastdebug}-c2-jvm98_nontiered, \
${jprt.my.linux.i586}-{product|fastdebug}-{c1|c2}-scimark, \
- ${jprt.my.linux.i586}-product-c1-runThese_Xcomp, \
- ${jprt.my.linux.i586}-fastdebug-c1-runThese_Xshare, \
- ${jprt.my.linux.i586}-fastdebug-c2-runThese_Xcomp, \
+ ${jprt.my.linux.i586}-product-c1-runThese8_Xcomp_lang, \
+ ${jprt.my.linux.i586}-product-c1-runThese8_Xcomp_vm, \
+ ${jprt.my.linux.i586}-fastdebug-c1-runThese8_Xshare, \
+ ${jprt.my.linux.i586}-fastdebug-c2-runThese8_Xcomp_lang, \
+ ${jprt.my.linux.i586}-fastdebug-c2-runThese8_Xcomp_vm, \
${jprt.my.linux.i586}-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC, \
${jprt.my.linux.i586}-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC, \
${jprt.my.linux.i586}-{product|fastdebug}-{c1|c2}-GCBasher_ParNewGC, \
@@ -243,9 +246,10 @@
${jprt.my.windows.i586}-{product|fastdebug}-{c1|c2}-jvm98, \
${jprt.my.windows.i586}-{product|fastdebug}-c2-jvm98_nontiered, \
${jprt.my.windows.i586}-{product|fastdebug}-{c1|c2}-scimark, \
- ${jprt.my.windows.i586}-product-{c1|c2}-runThese, \
- ${jprt.my.windows.i586}-product-{c1|c2}-runThese_Xcomp, \
- ${jprt.my.windows.i586}-fastdebug-c1-runThese_Xshare, \
+ ${jprt.my.windows.i586}-product-{c1|c2}-runThese8, \
+ ${jprt.my.windows.i586}-product-{c1|c2}-runThese8_Xcomp_lang, \
+ ${jprt.my.windows.i586}-product-{c1|c2}-runThese8_Xcomp_vm, \
+ ${jprt.my.windows.i586}-fastdebug-c1-runThese8_Xshare, \
${jprt.my.windows.i586}-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC, \
${jprt.my.windows.i586}-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC, \
${jprt.my.windows.i586}-{product|fastdebug}-{c1|c2}-GCBasher_ParNewGC, \
@@ -269,8 +273,9 @@
${jprt.my.windows.x64}-{product|fastdebug}-c2-jvm98, \
${jprt.my.windows.x64}-{product|fastdebug}-c2-jvm98_nontiered, \
${jprt.my.windows.x64}-{product|fastdebug}-c2-scimark, \
- ${jprt.my.windows.x64}-product-c2-runThese, \
- ${jprt.my.windows.x64}-product-c2-runThese_Xcomp, \
+ ${jprt.my.windows.x64}-product-c2-runThese8, \
+ ${jprt.my.windows.x64}-product-c2-runThese8_Xcomp_lang, \
+ ${jprt.my.windows.x64}-product-c2-runThese8_Xcomp_vm, \
${jprt.my.windows.x64}-{product|fastdebug}-c2-GCBasher_SerialGC, \
${jprt.my.windows.x64}-{product|fastdebug}-c2-GCBasher_ParallelGC, \
${jprt.my.windows.x64}-{product|fastdebug}-c2-GCBasher_ParNewGC, \
--- a/hotspot/src/cpu/ppc/vm/frame_ppc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/frame_ppc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -36,7 +36,6 @@
#include "runtime/signature.hpp"
#include "runtime/stubCodeGenerator.hpp"
#include "runtime/stubRoutines.hpp"
-#include "vmreg_ppc.inline.hpp"
#ifdef COMPILER1
#include "c1/c1_Runtime1.hpp"
#include "runtime/vframeArray.hpp"
@@ -155,15 +154,6 @@
}
}
-void frame::pd_gc_epilog() {
- if (is_interpreted_frame()) {
- // Set constant pool cache entry for interpreter.
- Method* m = interpreter_frame_method();
-
- *interpreter_frame_cpoolcache_addr() = m->constants()->cache();
- }
-}
-
bool frame::is_interpreted_frame_valid(JavaThread* thread) const {
// Is there anything to do?
assert(is_interpreted_frame(), "Not an interpreted frame");
--- a/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2014 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -27,6 +27,7 @@
#define CPU_PPC_VM_FRAME_PPC_INLINE_HPP
#include "code/codeCache.hpp"
+#include "code/vmreg.inline.hpp"
// Inline functions for ppc64 frames:
@@ -134,12 +135,12 @@
return (intptr_t**)&istate->_locals;
}
-inline intptr_t* frame::interpreter_frame_bcx_addr() const {
+inline intptr_t* frame::interpreter_frame_bcp_addr() const {
interpreterState istate = get_interpreterState();
return (intptr_t*)&istate->_bcp;
}
-inline intptr_t* frame::interpreter_frame_mdx_addr() const {
+inline intptr_t* frame::interpreter_frame_mdp_addr() const {
interpreterState istate = get_interpreterState();
return (intptr_t*)&istate->_mdx;
}
@@ -209,10 +210,10 @@
inline intptr_t** frame::interpreter_frame_locals_addr() const {
return (intptr_t**) &(get_ijava_state()->locals);
}
-inline intptr_t* frame::interpreter_frame_bcx_addr() const {
+inline intptr_t* frame::interpreter_frame_bcp_addr() const {
return (intptr_t*) &(get_ijava_state()->bcp);
}
-inline intptr_t* frame::interpreter_frame_mdx_addr() const {
+inline intptr_t* frame::interpreter_frame_mdp_addr() const {
return (intptr_t*) &(get_ijava_state()->mdx);
}
// Pointer beyond the "oldest/deepest" BasicObjectLock on stack.
--- a/hotspot/src/cpu/ppc/vm/icache_ppc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/icache_ppc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -68,7 +68,6 @@
}
void ICacheStubGenerator::generate_icache_flush(ICache::flush_icache_stub_t* flush_icache_stub) {
- StubCodeMark mark(this, "ICache", "flush_icache_stub");
*flush_icache_stub = (ICache::flush_icache_stub_t)ICache::ppc64_flush_icache;
--- a/hotspot/src/cpu/ppc/vm/interpreterRT_ppc.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/interpreterRT_ppc.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. 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 @@
#ifndef CPU_PPC_VM_INTERPRETERRT_PPC_HPP
#define CPU_PPC_VM_INTERPRETERRT_PPC_HPP
+#include "asm/macroAssembler.hpp"
#include "memory/allocation.hpp"
// native method calls
--- a/hotspot/src/cpu/ppc/vm/interpreter_ppc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/interpreter_ppc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -30,6 +30,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "oops/arrayOop.hpp"
#include "oops/methodData.hpp"
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -32,6 +32,7 @@
#include "memory/resourceArea.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/biasedLocking.hpp"
+#include "runtime/icache.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/os.hpp"
--- a/hotspot/src/cpu/ppc/vm/ppc.ad Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/ppc.ad Fri Jul 25 09:44:53 2014 +0000
@@ -267,7 +267,7 @@
// It's worth about 1% on SPEC geomean to get this right.
// Chunk0, chunk1, and chunk2 form the MachRegisterNumbers enumeration
-// in adGlobals_ppc64.hpp which defines the <register>_num values, e.g.
+// in adGlobals_ppc.hpp which defines the <register>_num values, e.g.
// R3_num. Therefore, R3_num may not be (and in reality is not)
// the same as R3->encoding()! Furthermore, we cannot make any
// assumptions on ordering, e.g. R3_num may be less than R2_num.
@@ -1632,7 +1632,7 @@
static enum RC rc_class(OptoReg::Name reg) {
// Return the register class for the given register. The given register
// reg is a <register>_num value, which is an index into the MachRegisterNumbers
- // enumeration in adGlobals_ppc64.hpp.
+ // enumeration in adGlobals_ppc.hpp.
if (reg == OptoReg::Bad) return rc_bad;
--- a/hotspot/src/cpu/ppc/vm/register_ppc.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/register_ppc.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2014 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -27,7 +27,6 @@
#define CPU_PPC_VM_REGISTER_PPC_HPP
#include "asm/register.hpp"
-#include "vm_version_ppc.hpp"
// forward declaration
class Address;
@@ -92,8 +91,8 @@
inline friend Register as_Register(int encoding);
// accessors
- int encoding() const { assert(is_valid(), "invalid register"); return value(); }
- VMReg as_VMReg();
+ int encoding() const { assert(is_valid(), "invalid register"); return value(); }
+ inline VMReg as_VMReg();
Register successor() const { return as_Register(encoding() + 1); }
// testers
@@ -208,8 +207,8 @@
inline friend ConditionRegister as_ConditionRegister(int encoding);
// accessors
- int encoding() const { assert(is_valid(), "invalid register"); return value(); }
- VMReg as_VMReg();
+ int encoding() const { assert(is_valid(), "invalid register"); return value(); }
+ inline VMReg as_VMReg();
// testers
bool is_valid() const { return (0 <= value() && value() < number_of_registers); }
@@ -264,7 +263,7 @@
// accessors
int encoding() const { assert(is_valid(), "invalid register"); return value(); }
- VMReg as_VMReg();
+ inline VMReg as_VMReg();
FloatRegister successor() const { return as_FloatRegister(encoding() + 1); }
// testers
@@ -365,7 +364,7 @@
// accessors
int encoding() const { assert(is_valid(), "invalid register"); return value(); }
- VMReg as_VMReg();
+ inline VMReg as_VMReg();
// testers
bool is_valid() const { return 0 <= value() && value() < number_of_registers; }
--- a/hotspot/src/cpu/ppc/vm/runtime_ppc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/runtime_ppc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. 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 @@
#include "classfile/systemDictionary.hpp"
#include "code/vmreg.hpp"
#include "interpreter/interpreter.hpp"
+#include "interpreter/interp_masm.hpp"
#include "nativeInst_ppc.hpp"
#include "opto/runtime.hpp"
#include "runtime/interfaceSupport.hpp"
@@ -37,7 +38,6 @@
#include "runtime/stubRoutines.hpp"
#include "runtime/vframeArray.hpp"
#include "utilities/globalDefinitions.hpp"
-#include "vmreg_ppc.inline.hpp"
#endif
#define __ masm->
--- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2014 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,16 +29,17 @@
#include "code/icBuffer.hpp"
#include "code/vtableStubs.hpp"
#include "interpreter/interpreter.hpp"
+#include "interpreter/interp_masm.hpp"
#include "oops/compiledICHolder.hpp"
#include "prims/jvmtiRedefineClassesTrace.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/vframeArray.hpp"
#include "vmreg_ppc.inline.hpp"
-#include "adfiles/ad_ppc_64.hpp"
#ifdef COMPILER1
#include "c1/c1_Runtime1.hpp"
#endif
#ifdef COMPILER2
+#include "adfiles/ad_ppc_64.hpp"
#include "opto/runtime.hpp"
#endif
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2014 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -401,11 +401,11 @@
__ load_const(exception_file, (void*)__FILE__);
__ load_const(exception_line, (void*)__LINE__);
- __ std(R3_ARG1, thread_(pending_exception));
+ __ std(R3_ARG1, in_bytes(JavaThread::pending_exception_offset()), R16_thread);
// store into `char *'
- __ std(exception_file, thread_(exception_file));
+ __ std(exception_file, in_bytes(JavaThread::exception_file_offset()), R16_thread);
// store into `int'
- __ stw(exception_line, thread_(exception_line));
+ __ stw(exception_line, in_bytes(JavaThread::exception_line_offset()), R16_thread);
// complete return to VM
assert(StubRoutines::_call_stub_return_address != NULL, "must have been generated before");
@@ -524,8 +524,6 @@
int frame_size_in_bytes = frame::abi_reg_args_size;
OopMap* map = new OopMap(frame_size_in_bytes / sizeof(jint), 0);
- StubCodeMark mark(this, "StubRoutines", "throw_exception");
-
address start = __ pc();
__ save_LR_CR(R11_scratch1);
@@ -846,8 +844,6 @@
//
// Don't generate, rather use C++ code.
address generate_verify_oop() {
- StubCodeMark mark(this, "StubRoutines", "verify_oop");
-
// this is actually a `FunctionDescriptor*'.
address start = 0;
--- a/hotspot/src/cpu/ppc/vm/templateInterpreter_ppc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/templateInterpreter_ppc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -30,6 +30,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "oops/arrayOop.hpp"
#include "oops/methodData.hpp"
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -27,6 +27,7 @@
#include "asm/macroAssembler.inline.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateInterpreter.hpp"
#include "interpreter/templateTable.hpp"
#include "memory/universe.inline.hpp"
--- a/hotspot/src/cpu/ppc/vm/vmreg_ppc.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/vmreg_ppc.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -26,10 +26,28 @@
#ifndef CPU_PPC_VM_VMREG_PPC_HPP
#define CPU_PPC_VM_VMREG_PPC_HPP
- bool is_Register();
- Register as_Register();
+inline bool is_Register() {
+ return (unsigned int)value() < (unsigned int)ConcreteRegisterImpl::max_gpr;
+}
+
+inline bool is_FloatRegister() {
+ return value() >= ConcreteRegisterImpl::max_gpr &&
+ value() < ConcreteRegisterImpl::max_fpr;
+}
- bool is_FloatRegister();
- FloatRegister as_FloatRegister();
+inline Register as_Register() {
+ assert(is_Register() && is_even(value()), "even-aligned GPR name");
+ return ::as_Register(value()>>1);
+}
+
+inline FloatRegister as_FloatRegister() {
+ assert(is_FloatRegister() && is_even(value()), "must be");
+ return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1);
+}
+
+inline bool is_concrete() {
+ assert(is_reg(), "must be");
+ return is_even(value());
+}
#endif // CPU_PPC_VM_VMREG_PPC_HPP
--- a/hotspot/src/cpu/ppc/vm/vmreg_ppc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/vmreg_ppc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -44,28 +44,5 @@
return VMRegImpl::as_VMReg((encoding()) + ConcreteRegisterImpl::max_cnd);
}
-inline bool VMRegImpl::is_Register() {
- return (unsigned int)value() < (unsigned int)ConcreteRegisterImpl::max_gpr;
-}
-
-inline bool VMRegImpl::is_FloatRegister() {
- return value() >= ConcreteRegisterImpl::max_gpr &&
- value() < ConcreteRegisterImpl::max_fpr;
-}
-
-inline Register VMRegImpl::as_Register() {
- assert(is_Register() && is_even(value()), "even-aligned GPR name");
- return ::as_Register(value()>>1);
-}
-
-inline FloatRegister VMRegImpl::as_FloatRegister() {
- assert(is_FloatRegister() && is_even(value()), "must be");
- return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1);
-}
-
-inline bool VMRegImpl::is_concrete() {
- assert(is_reg(), "must be");
- return is_even(value());
-}
#endif // CPU_PPC_VM_VMREG_PPC_INLINE_HPP
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -31,7 +31,6 @@
#include "oops/compiledICHolder.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
-#include "register_sparc.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/signature.hpp"
#include "runtime/vframeArray.hpp"
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "code/codeCache.hpp"
#include "interpreter/interpreter.hpp"
#include "memory/resourceArea.hpp"
#include "oops/markOop.hpp"
@@ -593,17 +594,6 @@
return this->fp() == fp;
}
-
-void frame::pd_gc_epilog() {
- if (is_interpreted_frame()) {
- // set constant pool cache entry for interpreter
- Method* m = interpreter_frame_method();
-
- *interpreter_frame_cpoolcache_addr() = m->constants()->cache();
- }
-}
-
-
bool frame::is_interpreted_frame_valid(JavaThread* thread) const {
#ifdef CC_INTERP
// Is there anything to do?
@@ -641,10 +631,10 @@
return false;
}
- // validate bci/bcx
+ // validate bci/bcp
- intptr_t bcx = interpreter_frame_bcx();
- if (m->validate_bci_from_bcx(bcx) < 0) {
+ address bcp = interpreter_frame_bcp();
+ if (m->validate_bci_from_bcp(bcp) < 0) {
return false;
}
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -78,7 +78,6 @@
// Lesp first free element of expression stack
// (which grows towards __higher__ addresses)
// Lbcp is set to address of bytecode to execute
-// It is accessed in the frame under the name "bcx".
// It may at times (during GC) be an index instead.
// Lmethod the method being interpreted
// Llocals the base pointer for accessing the locals array
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,6 +26,7 @@
#define CPU_SPARC_VM_FRAME_SPARC_INLINE_HPP
#include "asm/macroAssembler.hpp"
+#include "code/vmreg.inline.hpp"
// Inline functions for SPARC frames:
@@ -98,12 +99,12 @@
return (intptr_t**) &istate->_locals;
}
-inline intptr_t* frame::interpreter_frame_bcx_addr() const {
+inline intptr_t* frame::interpreter_frame_bcp_addr() const {
interpreterState istate = get_interpreterState();
return (intptr_t*) &istate->_bcp;
}
-inline intptr_t* frame::interpreter_frame_mdx_addr() const {
+inline intptr_t* frame::interpreter_frame_mdp_addr() const {
interpreterState istate = get_interpreterState();
return (intptr_t*) &istate->_mdx;
}
@@ -165,12 +166,11 @@
return (intptr_t**) sp_addr_at( Llocals->sp_offset_in_saved_window());
}
-inline intptr_t* frame::interpreter_frame_bcx_addr() const {
- // %%%%% reinterpreting Lbcp as a bcx
+inline intptr_t* frame::interpreter_frame_bcp_addr() const {
return (intptr_t*) sp_addr_at( Lbcp->sp_offset_in_saved_window());
}
-inline intptr_t* frame::interpreter_frame_mdx_addr() const {
+inline intptr_t* frame::interpreter_frame_mdp_addr() const {
// %%%%% reinterpreting ImethodDataPtr as a mdx
return (intptr_t*) sp_addr_at( ImethodDataPtr->sp_offset_in_saved_window());
}
--- a/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "asm/macroAssembler.inline.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "memory/allocation.inline.hpp"
--- a/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/interpreter_sparc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,6 +28,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "oops/arrayOop.hpp"
#include "oops/methodData.hpp"
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -23,7 +23,7 @@
*/
#include "precompiled.hpp"
-#include "asm/assembler.inline.hpp"
+#include "asm/macroAssembler.inline.hpp"
#include "compiler/disassembler.hpp"
#include "gc_interface/collectedHeap.inline.hpp"
#include "interpreter/interpreter.hpp"
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -186,8 +186,7 @@
// the interpreter to work right
// (These assignments must be compatible with L7_thread_cache; see above.)
-// Since Lbcp points into the middle of the method object,
-// it is temporarily converted into a "bcx" during GC.
+// Lbcp points into the middle of the method object.
// Exception processing
// These registers are passed into exception handlers.
--- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "interpreter/interpreter.hpp"
+#include "interpreter/interp_masm.hpp"
#include "memory/allocation.inline.hpp"
#include "prims/methodHandles.hpp"
--- a/hotspot/src/cpu/sparc/vm/register_sparc.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/register_sparc.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -26,7 +26,6 @@
#define CPU_SPARC_VM_REGISTER_SPARC_HPP
#include "asm/register.hpp"
-#include "vm_version_sparc.hpp"
// forward declaration
class Address;
@@ -65,7 +64,7 @@
friend Register as_oRegister(int number);
friend Register as_gRegister(int number);
- VMReg as_VMReg();
+ inline VMReg as_VMReg();
// accessors
int encoding() const { assert(is_valid(), "invalid register"); return value(); }
@@ -234,7 +233,7 @@
};
// construction
- VMReg as_VMReg( );
+ inline VMReg as_VMReg( );
// accessors
int encoding() const { assert(is_valid(), "invalid register"); return value(); }
--- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,6 +28,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "oops/arrayOop.hpp"
#include "oops/methodData.hpp"
@@ -1785,7 +1786,7 @@
__ verify_thread();
// expression stack is undefined here
// O0: exception, i.e. Oexception
- // Lbcp: exception bcx
+ // Lbcp: exception bcp
__ verify_oop(Oexception);
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "memory/universe.inline.hpp"
#include "oops/methodData.hpp"
--- a/hotspot/src/cpu/sparc/vm/vmreg_sparc.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/vmreg_sparc.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -25,10 +25,35 @@
#ifndef CPU_SPARC_VM_VMREG_SPARC_HPP
#define CPU_SPARC_VM_VMREG_SPARC_HPP
- bool is_Register();
- Register as_Register();
+inline bool is_Register() { return value() >= 0 && value() < ConcreteRegisterImpl::max_gpr; }
+inline bool is_FloatRegister() { return value() >= ConcreteRegisterImpl::max_gpr &&
+ value() < ConcreteRegisterImpl::max_fpr; }
+inline Register as_Register() {
+
+ assert( is_Register() && is_even(value()), "even-aligned GPR name" );
+ // Yuk
+ return ::as_Register(value()>>1);
+}
- bool is_FloatRegister();
- FloatRegister as_FloatRegister();
+inline FloatRegister as_FloatRegister() {
+ assert( is_FloatRegister(), "must be" );
+ // Yuk
+ return ::as_FloatRegister( value() - ConcreteRegisterImpl::max_gpr );
+}
+
+inline bool is_concrete() {
+ assert(is_reg(), "must be");
+ int v = value();
+ if ( v < ConcreteRegisterImpl::max_gpr ) {
+ return is_even(v);
+ }
+ // F0..F31
+ if ( v <= ConcreteRegisterImpl::max_gpr + 31) return true;
+ if ( v < ConcreteRegisterImpl::max_fpr) {
+ return is_even(v);
+ }
+ assert(false, "what register?");
+ return false;
+}
#endif // CPU_SPARC_VM_VMREG_SPARC_HPP
--- a/hotspot/src/cpu/sparc/vm/vmreg_sparc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/vmreg_sparc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -33,35 +33,5 @@
inline VMReg FloatRegisterImpl::as_VMReg() { return VMRegImpl::as_VMReg( ConcreteRegisterImpl::max_gpr + encoding() ); }
-inline bool VMRegImpl::is_Register() { return value() >= 0 && value() < ConcreteRegisterImpl::max_gpr; }
-inline bool VMRegImpl::is_FloatRegister() { return value() >= ConcreteRegisterImpl::max_gpr &&
- value() < ConcreteRegisterImpl::max_fpr; }
-inline Register VMRegImpl::as_Register() {
-
- assert( is_Register() && is_even(value()), "even-aligned GPR name" );
- // Yuk
- return ::as_Register(value()>>1);
-}
-
-inline FloatRegister VMRegImpl::as_FloatRegister() {
- assert( is_FloatRegister(), "must be" );
- // Yuk
- return ::as_FloatRegister( value() - ConcreteRegisterImpl::max_gpr );
-}
-
-inline bool VMRegImpl::is_concrete() {
- assert(is_reg(), "must be");
- int v = value();
- if ( v < ConcreteRegisterImpl::max_gpr ) {
- return is_even(v);
- }
- // F0..F31
- if ( v <= ConcreteRegisterImpl::max_gpr + 31) return true;
- if ( v < ConcreteRegisterImpl::max_fpr) {
- return is_even(v);
- }
- assert(false, "what register?");
- return false;
-}
#endif // CPU_SPARC_VM_VMREG_SPARC_INLINE_HPP
--- a/hotspot/src/cpu/x86/vm/frame_x86.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -537,10 +537,6 @@
return _fp == (fp - diff);
}
-void frame::pd_gc_epilog() {
- // nothing done here now
-}
-
bool frame::is_interpreted_frame_valid(JavaThread* thread) const {
// QQQ
#ifdef CC_INTERP
@@ -577,10 +573,10 @@
return false;
}
- // validate bci/bcx
+ // validate bci/bcp
- intptr_t bcx = interpreter_frame_bcx();
- if (m->validate_bci_from_bcx(bcx) < 0) {
+ address bcp = interpreter_frame_bcp();
+ if (m->validate_bci_from_bcp(bcp) < 0) {
return false;
}
@@ -692,10 +688,10 @@
DESCRIBE_FP_OFFSET(interpreter_frame_sender_sp);
DESCRIBE_FP_OFFSET(interpreter_frame_last_sp);
DESCRIBE_FP_OFFSET(interpreter_frame_method);
- DESCRIBE_FP_OFFSET(interpreter_frame_mdx);
+ DESCRIBE_FP_OFFSET(interpreter_frame_mdp);
DESCRIBE_FP_OFFSET(interpreter_frame_cache);
DESCRIBE_FP_OFFSET(interpreter_frame_locals);
- DESCRIBE_FP_OFFSET(interpreter_frame_bcx);
+ DESCRIBE_FP_OFFSET(interpreter_frame_bcp);
DESCRIBE_FP_OFFSET(interpreter_frame_initial_sp);
#endif
}
--- a/hotspot/src/cpu/x86/vm/frame_x86.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/frame_x86.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -40,7 +40,7 @@
// ... | monitor block size
// [monitors ] /
// [monitor block size ]
-// [byte code index/pointr] = bcx() bcx_offset
+// [byte code pointer ] = bcp() bcp_offset
// [pointer to locals ] = locals() locals_offset
// [constant pool cache ] = cache() cache_offset
// [methodData ] = mdp() mdx_offset
@@ -111,11 +111,11 @@
// outgoing sp before a call to an invoked method
interpreter_frame_last_sp_offset = interpreter_frame_sender_sp_offset - 1,
interpreter_frame_method_offset = interpreter_frame_last_sp_offset - 1,
- interpreter_frame_mdx_offset = interpreter_frame_method_offset - 1,
- interpreter_frame_cache_offset = interpreter_frame_mdx_offset - 1,
+ interpreter_frame_mdp_offset = interpreter_frame_method_offset - 1,
+ interpreter_frame_cache_offset = interpreter_frame_mdp_offset - 1,
interpreter_frame_locals_offset = interpreter_frame_cache_offset - 1,
- interpreter_frame_bcx_offset = interpreter_frame_locals_offset - 1,
- interpreter_frame_initial_sp_offset = interpreter_frame_bcx_offset - 1,
+ interpreter_frame_bcp_offset = interpreter_frame_locals_offset - 1,
+ interpreter_frame_initial_sp_offset = interpreter_frame_bcp_offset - 1,
interpreter_frame_monitor_block_top_offset = interpreter_frame_initial_sp_offset,
interpreter_frame_monitor_block_bottom_offset = interpreter_frame_initial_sp_offset,
--- a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,6 +26,7 @@
#define CPU_X86_VM_FRAME_X86_INLINE_HPP
#include "code/codeCache.hpp"
+#include "code/vmreg.inline.hpp"
// Inline functions for Intel frames:
@@ -168,7 +169,7 @@
return &(get_interpreterState()->_locals);
}
-inline intptr_t* frame::interpreter_frame_bcx_addr() const {
+inline intptr_t* frame::interpreter_frame_bcp_addr() const {
assert(is_interpreted_frame(), "must be interpreted");
return (intptr_t*) &(get_interpreterState()->_bcp);
}
@@ -188,7 +189,7 @@
return &(get_interpreterState()->_method);
}
-inline intptr_t* frame::interpreter_frame_mdx_addr() const {
+inline intptr_t* frame::interpreter_frame_mdp_addr() const {
assert(is_interpreted_frame(), "must be interpreted");
return (intptr_t*) &(get_interpreterState()->_mdx);
}
@@ -210,13 +211,13 @@
return *(intptr_t**)addr_at(interpreter_frame_last_sp_offset);
}
-inline intptr_t* frame::interpreter_frame_bcx_addr() const {
- return (intptr_t*)addr_at(interpreter_frame_bcx_offset);
+inline intptr_t* frame::interpreter_frame_bcp_addr() const {
+ return (intptr_t*)addr_at(interpreter_frame_bcp_offset);
}
-inline intptr_t* frame::interpreter_frame_mdx_addr() const {
- return (intptr_t*)addr_at(interpreter_frame_mdx_offset);
+inline intptr_t* frame::interpreter_frame_mdp_addr() const {
+ return (intptr_t*)addr_at(interpreter_frame_mdp_offset);
}
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -134,7 +134,7 @@
shll(tmp, exact_log2(DataLayout::cell_size));
addptr(mdp, tmp);
}
- movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp);
+ movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp);
} else {
assert(MethodData::profile_return(), "either profile call args or call ret");
update_mdp_by_constant(mdp, in_bytes(TypeEntriesAtCall::return_only_size()));
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -826,7 +826,7 @@
// Test ImethodDataPtr. If it is null, continue at the specified label
void InterpreterMacroAssembler::test_method_data_pointer(Register mdp, Label& zero_continue) {
assert(ProfileInterpreter, "must be profiling interpreter");
- movptr(mdp, Address(rbp, frame::interpreter_frame_mdx_offset * wordSize));
+ movptr(mdp, Address(rbp, frame::interpreter_frame_mdp_offset * wordSize));
testptr(mdp, mdp);
jcc(Assembler::zero, zero_continue);
}
@@ -853,7 +853,7 @@
addptr(rbx, in_bytes(MethodData::data_offset()));
addptr(rax, rbx);
bind(set_mdp);
- movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rax);
+ movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), rax);
pop(rbx);
pop(rax);
}
@@ -975,7 +975,7 @@
assert(ProfileInterpreter, "must be profiling interpreter");
Address disp_address(mdp_in, offset_of_disp);
addptr(mdp_in,disp_address);
- movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in);
+ movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
}
@@ -983,14 +983,14 @@
assert(ProfileInterpreter, "must be profiling interpreter");
Address disp_address(mdp_in, reg, Address::times_1, offset_of_disp);
addptr(mdp_in, disp_address);
- movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in);
+ movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
}
void InterpreterMacroAssembler::update_mdp_by_constant(Register mdp_in, int constant) {
assert(ProfileInterpreter, "must be profiling interpreter");
addptr(mdp_in, constant);
- movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in);
+ movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
}
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -61,8 +61,8 @@
#else
- void save_bcp() { movptr(Address(rbp, frame::interpreter_frame_bcx_offset * wordSize), rsi); }
- void restore_bcp() { movptr(rsi, Address(rbp, frame::interpreter_frame_bcx_offset * wordSize)); }
+ void save_bcp() { movptr(Address(rbp, frame::interpreter_frame_bcp_offset * wordSize), rsi); }
+ void restore_bcp() { movptr(rsi, Address(rbp, frame::interpreter_frame_bcp_offset * wordSize)); }
void restore_locals() { movptr(rdi, Address(rbp, frame::interpreter_frame_locals_offset * wordSize)); }
// Helpers for runtime call arguments/results
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -841,7 +841,7 @@
void InterpreterMacroAssembler::test_method_data_pointer(Register mdp,
Label& zero_continue) {
assert(ProfileInterpreter, "must be profiling interpreter");
- movptr(mdp, Address(rbp, frame::interpreter_frame_mdx_offset * wordSize));
+ movptr(mdp, Address(rbp, frame::interpreter_frame_mdp_offset * wordSize));
testptr(mdp, mdp);
jcc(Assembler::zero, zero_continue);
}
@@ -868,7 +868,7 @@
addptr(rbx, in_bytes(MethodData::data_offset()));
addptr(rax, rbx);
bind(set_mdp);
- movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rax);
+ movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), rax);
pop(rbx);
pop(rax);
}
@@ -991,7 +991,7 @@
assert(ProfileInterpreter, "must be profiling interpreter");
Address disp_address(mdp_in, offset_of_disp);
addptr(mdp_in, disp_address);
- movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in);
+ movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
}
@@ -1001,7 +1001,7 @@
assert(ProfileInterpreter, "must be profiling interpreter");
Address disp_address(mdp_in, reg, Address::times_1, offset_of_disp);
addptr(mdp_in, disp_address);
- movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in);
+ movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
}
@@ -1009,7 +1009,7 @@
int constant) {
assert(ProfileInterpreter, "must be profiling interpreter");
addptr(mdp_in, constant);
- movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in);
+ movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
}
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -58,11 +58,11 @@
// Interpreter-specific registers
void save_bcp() {
- movptr(Address(rbp, frame::interpreter_frame_bcx_offset * wordSize), r13);
+ movptr(Address(rbp, frame::interpreter_frame_bcp_offset * wordSize), r13);
}
void restore_bcp() {
- movptr(r13, Address(rbp, frame::interpreter_frame_bcx_offset * wordSize));
+ movptr(r13, Address(rbp, frame::interpreter_frame_bcp_offset * wordSize));
}
void restore_locals() {
--- a/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/interpreter_x86_32.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,6 +28,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "oops/arrayOop.hpp"
#include "oops/methodData.hpp"
--- a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -28,6 +28,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "oops/arrayOop.hpp"
#include "oops/methodData.hpp"
--- a/hotspot/src/cpu/x86/vm/register_x86.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/register_x86.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -26,7 +26,6 @@
#define CPU_X86_VM_REGISTER_X86_HPP
#include "asm/register.hpp"
-#include "vm_version_x86.hpp"
class VMRegImpl;
typedef VMRegImpl* VMReg;
@@ -59,7 +58,7 @@
// construction
inline friend Register as_Register(int encoding);
- VMReg as_VMReg();
+ inline VMReg as_VMReg();
// accessors
int encoding() const { assert(is_valid(), "invalid register"); return (intptr_t)this; }
@@ -110,9 +109,10 @@
// construction
inline friend FloatRegister as_FloatRegister(int encoding);
- VMReg as_VMReg();
+ inline VMReg as_VMReg();
// derived registers, offsets, and addresses
+
FloatRegister successor() const { return as_FloatRegister(encoding() + 1); }
// accessors
@@ -152,7 +152,7 @@
// construction
friend XMMRegister as_XMMRegister(int encoding);
- VMReg as_VMReg();
+ inline VMReg as_VMReg();
// derived registers, offsets, and addresses
XMMRegister successor() const { return as_XMMRegister(encoding() + 1); }
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,6 +28,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "oops/arrayOop.hpp"
#include "oops/methodData.hpp"
@@ -51,7 +52,7 @@
#ifndef CC_INTERP
const int method_offset = frame::interpreter_frame_method_offset * wordSize;
-const int bci_offset = frame::interpreter_frame_bcx_offset * wordSize;
+const int bcp_offset = frame::interpreter_frame_bcp_offset * wordSize;
const int locals_offset = frame::interpreter_frame_locals_offset * wordSize;
//------------------------------------------------------------------------------------------------------------------------
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -28,6 +28,7 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "oops/arrayOop.hpp"
#include "oops/methodData.hpp"
@@ -51,7 +52,7 @@
#ifndef CC_INTERP
const int method_offset = frame::interpreter_frame_method_offset * wordSize;
-const int bci_offset = frame::interpreter_frame_bcx_offset * wordSize;
+const int bcp_offset = frame::interpreter_frame_bcp_offset * wordSize;
const int locals_offset = frame::interpreter_frame_locals_offset * wordSize;
//-----------------------------------------------------------------------------
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,6 +26,7 @@
#include "asm/macroAssembler.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "memory/universe.inline.hpp"
#include "oops/methodData.hpp"
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -26,6 +26,7 @@
#include "asm/macroAssembler.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "memory/universe.inline.hpp"
#include "oops/methodData.hpp"
--- a/hotspot/src/cpu/x86/vm/vmreg_x86.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/vmreg_x86.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -25,13 +25,49 @@
#ifndef CPU_X86_VM_VMREG_X86_HPP
#define CPU_X86_VM_VMREG_X86_HPP
- bool is_Register();
- Register as_Register();
+
+
+inline bool is_Register() {
+ return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr;
+}
+
+inline bool is_FloatRegister() {
+ return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr;
+}
+
+inline bool is_XMMRegister() {
+ return value() >= ConcreteRegisterImpl::max_fpr && value() < ConcreteRegisterImpl::max_xmm;
+}
+
+inline Register as_Register() {
- bool is_FloatRegister();
- FloatRegister as_FloatRegister();
+ assert( is_Register(), "must be");
+ // Yuk
+#ifdef AMD64
+ return ::as_Register(value() >> 1);
+#else
+ return ::as_Register(value());
+#endif // AMD64
+}
- bool is_XMMRegister();
- XMMRegister as_XMMRegister();
+inline FloatRegister as_FloatRegister() {
+ assert( is_FloatRegister() && is_even(value()), "must be" );
+ // Yuk
+ return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1);
+}
+
+inline XMMRegister as_XMMRegister() {
+ assert( is_XMMRegister() && is_even(value()), "must be" );
+ // Yuk
+ return ::as_XMMRegister((value() - ConcreteRegisterImpl::max_fpr) >> 3);
+}
+
+inline bool is_concrete() {
+ assert(is_reg(), "must be");
+#ifndef AMD64
+ if (is_Register()) return true;
+#endif // AMD64
+ return is_even(value());
+}
#endif // CPU_X86_VM_VMREG_X86_HPP
--- a/hotspot/src/cpu/x86/vm/vmreg_x86.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/vmreg_x86.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -42,48 +42,4 @@
return VMRegImpl::as_VMReg((encoding() << 3) + ConcreteRegisterImpl::max_fpr);
}
-
-inline bool VMRegImpl::is_Register() {
- return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr;
-}
-
-inline bool VMRegImpl::is_FloatRegister() {
- return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr;
-}
-
-inline bool VMRegImpl::is_XMMRegister() {
- return value() >= ConcreteRegisterImpl::max_fpr && value() < ConcreteRegisterImpl::max_xmm;
-}
-
-inline Register VMRegImpl::as_Register() {
-
- assert( is_Register(), "must be");
- // Yuk
-#ifdef AMD64
- return ::as_Register(value() >> 1);
-#else
- return ::as_Register(value());
-#endif // AMD64
-}
-
-inline FloatRegister VMRegImpl::as_FloatRegister() {
- assert( is_FloatRegister() && is_even(value()), "must be" );
- // Yuk
- return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> 1);
-}
-
-inline XMMRegister VMRegImpl::as_XMMRegister() {
- assert( is_XMMRegister() && is_even(value()), "must be" );
- // Yuk
- return ::as_XMMRegister((value() - ConcreteRegisterImpl::max_fpr) >> 3);
-}
-
-inline bool VMRegImpl::is_concrete() {
- assert(is_reg(), "must be");
-#ifndef AMD64
- if (is_Register()) return true;
-#endif // AMD64
- return is_even(value());
-}
-
#endif // CPU_X86_VM_VMREG_X86_INLINE_HPP
--- a/hotspot/src/cpu/x86/vm/x86.ad Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/x86.ad Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2011, 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
@@ -487,6 +487,8 @@
// To keep related declarations/definitions/uses close together,
// we switch between source %{ }% and source_hpp %{ }% freely as needed.
+class NativeJump;
+
class CallStubImpl {
//--------------------------------------------------------------
--- a/hotspot/src/cpu/zero/vm/frame_zero.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/zero/vm/frame_zero.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -119,9 +119,6 @@
return false;
}
-void frame::pd_gc_epilog() {
-}
-
bool frame::is_interpreted_frame_valid(JavaThread *thread) const {
ShouldNotCallThis();
return false;
--- a/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -101,7 +101,7 @@
return &(get_interpreterState()->_locals);
}
-inline intptr_t* frame::interpreter_frame_bcx_addr() const {
+inline intptr_t* frame::interpreter_frame_bcp_addr() const {
return (intptr_t*) &(get_interpreterState()->_bcp);
}
@@ -113,7 +113,7 @@
return &(get_interpreterState()->_method);
}
-inline intptr_t* frame::interpreter_frame_mdx_addr() const {
+inline intptr_t* frame::interpreter_frame_mdp_addr() const {
return (intptr_t*) &(get_interpreterState()->_mdx);
}
--- a/hotspot/src/os/aix/vm/os_aix.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os/aix/vm/os_aix.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -66,6 +66,7 @@
#include "runtime/thread.inline.hpp"
#include "runtime/threadCritical.hpp"
#include "runtime/timer.hpp"
+#include "runtime/vm_version.hpp"
#include "services/attachListener.hpp"
#include "services/runtimeService.hpp"
#include "utilities/decoder.hpp"
--- a/hotspot/src/os/aix/vm/os_aix.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os/aix/vm/os_aix.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -36,9 +36,6 @@
#include <sys/ioctl.h>
#include <netdb.h>
-// Defined in the system headers included above.
-#undef rem_size
-
inline void* os::thread_local_storage_at(int index) {
return pthread_getspecific((pthread_key_t)index);
}
--- a/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -202,11 +202,11 @@
GEN_VALUE(OFFSET_interpreter_frame_method, 2 * pointer_size); /* L2 in saved window */
GEN_VALUE(OFFSET_interpreter_frame_sender_sp, 13 * pointer_size); /* I5 in saved window */
// Fake value for consistency. It is not going to be used.
- GEN_VALUE(OFFSET_interpreter_frame_bcx_offset, 0xFFFF);
+ GEN_VALUE(OFFSET_interpreter_frame_bcp_offset, 0xFFFF);
#elif defined(i386) || defined(__i386) || defined(__amd64)
GEN_VALUE(OFFSET_interpreter_frame_sender_sp, -1 * pointer_size);
GEN_VALUE(OFFSET_interpreter_frame_method, -3 * pointer_size);
- GEN_VALUE(OFFSET_interpreter_frame_bcx_offset, -7 * pointer_size);
+ GEN_VALUE(OFFSET_interpreter_frame_bcp_offset, -7 * pointer_size);
#endif
GEN_OFFS(Klass, _name);
--- a/hotspot/src/os/bsd/dtrace/libjvm_db.c Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os/bsd/dtrace/libjvm_db.c Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -164,7 +164,7 @@
int32_t SIZE_CodeCache_log2_segment;
uint64_t methodPtr;
- uint64_t bcx;
+ uint64_t bcp;
Nmethod_t *N; /*Inlined methods support */
Frame_t prev_fr;
@@ -260,6 +260,9 @@
uint64_t base;
int err;
+ /* Clear *vmp now in case we jump to fail: */
+ memset(vmp, 0, sizeof(VMStructEntry));
+
err = ps_pglobal_lookup(J->P, LIBJVM_SO, "gHotSpotVMStructs", &sym_addr);
CHECK_FAIL(err);
err = read_pointer(J, sym_addr, &gHotSpotVMStructs);
@@ -1068,19 +1071,9 @@
return err;
}
-int is_bci(intptr_t bcx) {
- switch (DATA_MODEL) {
- case PR_MODEL_LP64:
- return ((uintptr_t) bcx) <= ((uintptr_t) MAX_METHOD_CODE_SIZE) ;
- case PR_MODEL_ILP32:
- default:
- return 0 <= bcx && bcx <= MAX_METHOD_CODE_SIZE;
- }
-}
-
static int
name_for_imethod(jvm_agent_t* J,
- uint64_t bcx,
+ uint64_t bcp,
uint64_t method,
char *result,
size_t size,
@@ -1095,7 +1088,7 @@
err = read_pointer(J, method + OFFSET_Method_constMethod, &constMethod);
CHECK_FAIL(err);
- bci = is_bci(bcx) ? bcx : bcx - (constMethod + (uint64_t) SIZE_ConstMethod);
+ bci = bcp - (constMethod + (uint64_t) SIZE_ConstMethod);
if (debug)
fprintf(stderr, "\t name_for_imethod: BEGIN: method: %#llx\n", method);
@@ -1169,7 +1162,7 @@
if (err == PS_OK && strncmp(name, "Interpreter", 11) == 0) {
*is_interpreted = 1;
if (is_method(J, J->methodPtr)) {
- return name_for_imethod(J, J->bcx, J->methodPtr, result, size, jframe);
+ return name_for_imethod(J, J->bcp, J->methodPtr, result, size, jframe);
}
}
@@ -1326,7 +1319,7 @@
/* arguments given to read_pointer need to be worst case sized */
uint64_t methodPtr = 0;
uint64_t sender_sp;
- uint64_t bcx = 0;
+ uint64_t bcp = 0;
int is_interpreted = 0;
int result = PS_OK;
int err = PS_OK;
@@ -1357,7 +1350,7 @@
* regs[R_PC] contains a CALL instruction pc offset.
*/
pc += 8;
- bcx = (uintptr_t) regs[R_L1];
+ bcp = (uintptr_t) regs[R_L1];
methodPtr = (uintptr_t) regs[R_L2];
sender_sp = regs[R_I5];
if (debug > 2) {
@@ -1385,13 +1378,13 @@
if (read_pointer(J, fp + OFFSET_interpreter_frame_sender_sp, &sender_sp) != PS_OK) {
sender_sp = 0;
}
- if (read_pointer(J, fp + OFFSET_interpreter_frame_bcx_offset, &bcx) != PS_OK) {
- bcx = 0;
+ if (read_pointer(J, fp + OFFSET_interpreter_frame_bcp_offset, &bcp) != PS_OK) {
+ bcp = 0;
}
#endif /* i386 */
J->methodPtr = methodPtr;
- J->bcx = bcx;
+ J->bcp = bcp;
/* On x86 with C2 JVM: native frame may have wrong regs[R_FP]
* For example: JVM_SuspendThread frame poins to the top interpreted frame.
@@ -1402,7 +1395,7 @@
*/
#ifndef X86_COMPILER2
if (is_method(J, J->methodPtr)) {
- result = name_for_imethod(J, bcx, J->methodPtr, name, size, jframe);
+ result = name_for_imethod(J, bcp, J->methodPtr, name, size, jframe);
/* If the methodPtr is a method then this is highly likely to be
an interpreter frame */
if (result >= 0) {
@@ -1416,7 +1409,7 @@
}
#ifdef X86_COMPILER2
else if (is_method(J, J->methodPtr)) {
- result = name_for_imethod(J, bcx, J->methodPtr, name, size, jframe);
+ result = name_for_imethod(J, bcp, J->methodPtr, name, size, jframe);
/* If the methodPtr is a method then this is highly likely to be
an interpreter frame */
if (result >= 0) {
--- a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -197,11 +197,11 @@
GEN_VALUE(OFFSET_interpreter_frame_method, 2 * pointer_size); /* L2 in saved window */
GEN_VALUE(OFFSET_interpreter_frame_sender_sp, 13 * pointer_size); /* I5 in saved window */
// Fake value for consistency. It is not going to be used.
- GEN_VALUE(OFFSET_interpreter_frame_bcx_offset, 0xFFFF);
+ GEN_VALUE(OFFSET_interpreter_frame_bcp_offset, 0xFFFF);
#elif defined(i386) || defined(__i386) || defined(__amd64)
GEN_VALUE(OFFSET_interpreter_frame_sender_sp, -1 * pointer_size);
GEN_VALUE(OFFSET_interpreter_frame_method, -3 * pointer_size);
- GEN_VALUE(OFFSET_interpreter_frame_bcx_offset, -7 * pointer_size);
+ GEN_VALUE(OFFSET_interpreter_frame_bcp_offset, -7 * pointer_size);
#endif
GEN_OFFS(Klass, _name);
--- a/hotspot/src/os/solaris/dtrace/libjvm_db.c Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -164,7 +164,7 @@
int32_t SIZE_CodeCache_log2_segment;
uint64_t methodPtr;
- uint64_t bcx;
+ uint64_t bcp;
Nmethod_t *N; /*Inlined methods support */
Frame_t prev_fr;
@@ -260,6 +260,9 @@
uint64_t base;
int err;
+ /* Clear *vmp now in case we jump to fail: */
+ memset(vmp, 0, sizeof(VMStructEntry));
+
err = ps_pglobal_lookup(J->P, LIBJVM_SO, "gHotSpotVMStructs", &sym_addr);
CHECK_FAIL(err);
err = read_pointer(J, sym_addr, &gHotSpotVMStructs);
@@ -1068,19 +1071,9 @@
return err;
}
-int is_bci(intptr_t bcx) {
- switch (DATA_MODEL) {
- case PR_MODEL_LP64:
- return ((uintptr_t) bcx) <= ((uintptr_t) MAX_METHOD_CODE_SIZE) ;
- case PR_MODEL_ILP32:
- default:
- return 0 <= bcx && bcx <= MAX_METHOD_CODE_SIZE;
- }
-}
-
static int
name_for_imethod(jvm_agent_t* J,
- uint64_t bcx,
+ uint64_t bcp,
uint64_t method,
char *result,
size_t size,
@@ -1095,7 +1088,7 @@
err = read_pointer(J, method + OFFSET_Method_constMethod, &constMethod);
CHECK_FAIL(err);
- bci = is_bci(bcx) ? bcx : bcx - (constMethod + (uint64_t) SIZE_ConstMethod);
+ bci = bcp - (constMethod + (uint64_t) SIZE_ConstMethod);
if (debug)
fprintf(stderr, "\t name_for_imethod: BEGIN: method: %#llx\n", method);
@@ -1169,7 +1162,7 @@
if (err == PS_OK && strncmp(name, "Interpreter", 11) == 0) {
*is_interpreted = 1;
if (is_method(J, J->methodPtr)) {
- return name_for_imethod(J, J->bcx, J->methodPtr, result, size, jframe);
+ return name_for_imethod(J, J->bcp, J->methodPtr, result, size, jframe);
}
}
@@ -1326,7 +1319,7 @@
/* arguments given to read_pointer need to be worst case sized */
uint64_t methodPtr = 0;
uint64_t sender_sp;
- uint64_t bcx = 0;
+ uint64_t bcp = 0;
int is_interpreted = 0;
int result = PS_OK;
int err = PS_OK;
@@ -1357,7 +1350,7 @@
* regs[R_PC] contains a CALL instruction pc offset.
*/
pc += 8;
- bcx = (uintptr_t) regs[R_L1];
+ bcp = (uintptr_t) regs[R_L1];
methodPtr = (uintptr_t) regs[R_L2];
sender_sp = regs[R_I5];
if (debug > 2) {
@@ -1385,13 +1378,13 @@
if (read_pointer(J, fp + OFFSET_interpreter_frame_sender_sp, &sender_sp) != PS_OK) {
sender_sp = 0;
}
- if (read_pointer(J, fp + OFFSET_interpreter_frame_bcx_offset, &bcx) != PS_OK) {
- bcx = 0;
+ if (read_pointer(J, fp + OFFSET_interpreter_frame_bcp_offset, &bcp) != PS_OK) {
+ bcp = 0;
}
#endif /* i386 */
J->methodPtr = methodPtr;
- J->bcx = bcx;
+ J->bcp = bcp;
/* On x86 with C2 JVM: native frame may have wrong regs[R_FP]
* For example: JVM_SuspendThread frame poins to the top interpreted frame.
@@ -1402,7 +1395,7 @@
*/
#ifndef X86_COMPILER2
if (is_method(J, J->methodPtr)) {
- result = name_for_imethod(J, bcx, J->methodPtr, name, size, jframe);
+ result = name_for_imethod(J, bcp, J->methodPtr, name, size, jframe);
/* If the methodPtr is a method then this is highly likely to be
an interpreter frame */
if (result >= 0) {
@@ -1416,7 +1409,7 @@
}
#ifdef X86_COMPILER2
else if (is_method(J, J->methodPtr)) {
- result = name_for_imethod(J, bcx, J->methodPtr, name, size, jframe);
+ result = name_for_imethod(J, bcp, J->methodPtr, name, size, jframe);
/* If the methodPtr is a method then this is highly likely to be
an interpreter frame */
if (result >= 0) {
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -59,6 +59,7 @@
#include "runtime/thread.inline.hpp"
#include "runtime/threadCritical.hpp"
#include "runtime/timer.hpp"
+#include "runtime/vm_version.hpp"
#include "services/attachListener.hpp"
#include "services/memTracker.hpp"
#include "services/runtimeService.hpp"
--- a/hotspot/src/os/windows/vm/os_windows.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -62,6 +62,7 @@
#include "runtime/thread.inline.hpp"
#include "runtime/threadCritical.hpp"
#include "runtime/timer.hpp"
+#include "runtime/vm_version.hpp"
#include "services/attachListener.hpp"
#include "services/memTracker.hpp"
#include "services/runtimeService.hpp"
--- a/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, SAP AG. 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,7 +28,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
-#include "vm_version_ppc.hpp"
#ifndef _LP64
#error "Atomic currently only impleneted for PPC64"
--- a/hotspot/src/os_cpu/aix_ppc/vm/orderAccess_aix_ppc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/aix_ppc/vm/orderAccess_aix_ppc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, SAP AG. 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,7 +27,6 @@
#define OS_CPU_AIX_OJDKPPC_VM_ORDERACCESS_AIX_PPC_INLINE_HPP
#include "runtime/orderAccess.hpp"
-#include "vm_version_ppc.hpp"
// Implementation of class OrderAccess.
--- a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,7 +27,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
-#include "vm_version_x86.hpp"
// Implementation of class atomic
--- a/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -28,7 +28,6 @@
#include "runtime/atomic.inline.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/os.hpp"
-#include "vm_version_x86.hpp"
// Implementation of class OrderAccess.
--- a/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -28,7 +28,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
-#include "vm_version_zero.hpp"
// Implementation of class atomic
--- a/hotspot/src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -27,7 +27,6 @@
#define OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_INLINE_HPP
#include "runtime/orderAccess.hpp"
-#include "vm_version_zero.hpp"
#ifdef ARM
--- a/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, SAP AG. 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,7 +28,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
-#include "vm_version_ppc.hpp"
#ifndef PPC64
#error "Atomic currently only implemented for PPC64"
--- a/hotspot/src/os_cpu/linux_ppc/vm/orderAccess_linux_ppc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/linux_ppc/vm/orderAccess_linux_ppc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, SAP AG. 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,7 +27,6 @@
#define OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_INLINE_HPP
#include "runtime/orderAccess.hpp"
-#include "vm_version_ppc.hpp"
#ifndef PPC64
#error "OrderAccess currently only implemented for PPC64"
--- a/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,7 +27,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
-#include "vm_version_sparc.hpp"
// Implementation of class atomic
--- a/hotspot/src/os_cpu/linux_sparc/vm/orderAccess_linux_sparc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/linux_sparc/vm/orderAccess_linux_sparc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -26,7 +26,6 @@
#define OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_INLINE_HPP
#include "runtime/orderAccess.hpp"
-#include "vm_version_sparc.hpp"
// Implementation of class OrderAccess.
--- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -118,7 +118,7 @@
*ret_sp = os::Linux::ucontext_get_sp(uc);
}
if (ret_fp) {
- *ret_fp = os::Linux::ucontext_get_fp(uc);
+ *ret_fp = (intptr_t*)NULL;
}
} else {
// construct empty ExtendedPC for return value checking
@@ -136,18 +136,15 @@
frame os::fetch_frame_from_context(void* ucVoid) {
intptr_t* sp;
- intptr_t* fp;
- ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
- return frame(sp, fp, epc.pc());
+ ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, NULL);
+ return frame(sp, frame::unpatchable, epc.pc());
}
frame os::get_sender_for_C_frame(frame* fr) {
- return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
+ return frame(fr->sender_sp(), frame::unpatchable, fr->sender_pc());
}
frame os::current_frame() {
- fprintf(stderr, "current_frame()");
-
intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
frame myframe(sp, frame::unpatchable,
CAST_FROM_FN_PTR(address, os::current_frame));
--- a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,7 +27,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
-#include "vm_version_x86.hpp"
// Implementation of class atomic
--- a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -28,7 +28,6 @@
#include "runtime/atomic.inline.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/os.hpp"
-#include "vm_version_x86.hpp"
// Implementation of class OrderAccess.
--- a/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -28,7 +28,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
-#include "vm_version_zero.hpp"
// Implementation of class atomic
--- a/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -27,7 +27,6 @@
#define OS_CPU_LINUX_ZERO_VM_ORDERACCESS_LINUX_ZERO_INLINE_HPP
#include "runtime/orderAccess.hpp"
-#include "vm_version_zero.hpp"
#ifdef ARM
--- a/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,7 +27,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
-#include "vm_version_sparc.hpp"
// Implementation of class atomic
--- a/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -27,7 +27,6 @@
#include "runtime/atomic.inline.hpp"
#include "runtime/orderAccess.hpp"
-#include "vm_version_sparc.hpp"
// Implementation of class OrderAccess.
--- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -27,6 +27,7 @@
#include "classfile/classLoader.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
+#include "code/codeCache.hpp"
#include "code/icBuffer.hpp"
#include "code/vtableStubs.hpp"
#include "interpreter/interpreter.hpp"
--- a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,7 +27,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
-#include "vm_version_x86.hpp"
inline void Atomic::store (jbyte store_value, jbyte* dest) { *dest = store_value; }
inline void Atomic::store (jshort store_value, jshort* dest) { *dest = store_value; }
--- a/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -28,7 +28,6 @@
#include "runtime/atomic.inline.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/os.hpp"
-#include "vm_version_x86.hpp"
// Implementation of class OrderAccess.
--- a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,7 +27,6 @@
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
-#include "vm_version_x86.hpp"
// The following alternative implementations are needed because
// Windows 95 doesn't support (some of) the corresponding Windows NT
--- a/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -28,7 +28,6 @@
#include "runtime/atomic.inline.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/os.hpp"
-#include "vm_version_x86.hpp"
// Implementation of class OrderAccess.
--- a/hotspot/src/share/vm/adlc/main.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/adlc/main.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -213,7 +213,8 @@
AD.addInclude(AD._CPP_file, "memory/allocation.inline.hpp");
AD.addInclude(AD._CPP_file, "asm/macroAssembler.inline.hpp");
AD.addInclude(AD._CPP_file, "code/compiledIC.hpp");
- AD.addInclude(AD._CPP_file, "code/vmreg.hpp");
+ AD.addInclude(AD._CPP_file, "code/nativeInst.hpp");
+ AD.addInclude(AD._CPP_file, "code/vmreg.inline.hpp");
AD.addInclude(AD._CPP_file, "gc_interface/collectedHeap.inline.hpp");
AD.addInclude(AD._CPP_file, "oops/compiledICHolder.hpp");
AD.addInclude(AD._CPP_file, "oops/markOop.hpp");
@@ -230,23 +231,8 @@
AD.addInclude(AD._CPP_file, "runtime/sharedRuntime.hpp");
AD.addInclude(AD._CPP_file, "runtime/stubRoutines.hpp");
AD.addInclude(AD._CPP_file, "utilities/growableArray.hpp");
-#ifdef TARGET_ARCH_x86
- AD.addInclude(AD._CPP_file, "nativeInst_x86.hpp");
- AD.addInclude(AD._CPP_file, "vmreg_x86.inline.hpp");
-#endif
-#ifdef TARGET_ARCH_sparc
- AD.addInclude(AD._CPP_file, "nativeInst_sparc.hpp");
- AD.addInclude(AD._CPP_file, "vmreg_sparc.inline.hpp");
-#endif
-#ifdef TARGET_ARCH_arm
- AD.addInclude(AD._CPP_file, "nativeInst_arm.hpp");
- AD.addInclude(AD._CPP_file, "vmreg_arm.inline.hpp");
-#endif
-#ifdef TARGET_ARCH_ppc
- AD.addInclude(AD._CPP_file, "nativeInst_ppc.hpp");
- AD.addInclude(AD._CPP_file, "vmreg_ppc.inline.hpp");
-#endif
AD.addInclude(AD._HPP_file, "memory/allocation.hpp");
+ AD.addInclude(AD._HPP_file, "code/nativeInst.hpp");
AD.addInclude(AD._HPP_file, "opto/machnode.hpp");
AD.addInclude(AD._HPP_file, "opto/node.hpp");
AD.addInclude(AD._HPP_file, "opto/regalloc.hpp");
--- a/hotspot/src/share/vm/asm/assembler.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/asm/assembler.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,34 +26,15 @@
#define SHARE_VM_ASM_ASSEMBLER_HPP
#include "asm/codeBuffer.hpp"
+#include "asm/register.hpp"
#include "code/oopRecorder.hpp"
#include "code/relocInfo.hpp"
#include "memory/allocation.hpp"
+#include "runtime/vm_version.hpp"
#include "utilities/debug.hpp"
#include "utilities/growableArray.hpp"
#include "utilities/top.hpp"
-#ifdef TARGET_ARCH_x86
-# include "register_x86.hpp"
-# include "vm_version_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "register_sparc.hpp"
-# include "vm_version_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "register_zero.hpp"
-# include "vm_version_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "register_arm.hpp"
-# include "vm_version_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "register_ppc.hpp"
-# include "vm_version_ppc.hpp"
-#endif
-
// This file contains platform-independent assembler declarations.
class MacroAssembler;
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -28,6 +28,7 @@
#include "memory/gcLocker.hpp"
#include "oops/methodData.hpp"
#include "oops/oop.inline.hpp"
+#include "runtime/icache.hpp"
#include "utilities/copy.hpp"
#include "utilities/xmlstream.hpp"
--- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -30,6 +30,7 @@
#include "c1/c1_Instruction.hpp"
#include "c1/c1_LIR.hpp"
#include "c1/c1_Runtime1.hpp"
+#include "code/nativeInst.hpp"
#include "utilities/array.hpp"
#include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/c1/c1_Defs.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_Defs.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -26,21 +26,7 @@
#define SHARE_VM_C1_C1_DEFS_HPP
#include "utilities/globalDefinitions.hpp"
-#ifdef TARGET_ARCH_x86
-# include "register_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "register_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "register_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "register_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "register_ppc.hpp"
-#endif
+#include "asm/register.hpp"
// set frame size and return address offset to these values in blobs
// (if the compiled frame uses ebp as link pointer on IA; otherwise,
--- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -25,24 +25,8 @@
#include "precompiled.hpp"
#include "c1/c1_FrameMap.hpp"
#include "c1/c1_LIR.hpp"
+#include "code/vmreg.inline.hpp"
#include "runtime/sharedRuntime.hpp"
-#ifdef TARGET_ARCH_x86
-# include "vmreg_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vmreg_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vmreg_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vmreg_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vmreg_ppc.inline.hpp"
-#endif
-
-
//-----------------------------------------------------
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -36,6 +36,7 @@
#include "interpreter/bytecode.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/compilationPolicy.hpp"
+#include "runtime/vm_version.hpp"
#include "utilities/bitMap.inline.hpp"
class BlockListBuilder VALUE_OBJ_CLASS_SPEC {
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -30,27 +30,6 @@
#include "c1/c1_MacroAssembler.hpp"
#include "c1/c1_ValueStack.hpp"
#include "ci/ciInstance.hpp"
-#ifdef TARGET_ARCH_x86
-# include "nativeInst_x86.hpp"
-# include "vmreg_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "nativeInst_sparc.hpp"
-# include "vmreg_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "nativeInst_zero.hpp"
-# include "vmreg_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "nativeInst_arm.hpp"
-# include "vmreg_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "nativeInst_ppc.hpp"
-# include "vmreg_ppc.inline.hpp"
-#endif
-
void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
// we must have enough patching space so that call can be inserted
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -34,6 +34,7 @@
#include "ci/ciObjArray.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
+#include "runtime/vm_version.hpp"
#include "utilities/bitMap.inline.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -31,23 +31,8 @@
#include "c1/c1_LIRGenerator.hpp"
#include "c1/c1_LinearScan.hpp"
#include "c1/c1_ValueStack.hpp"
+#include "code/vmreg.inline.hpp"
#include "utilities/bitMap.inline.hpp"
-#ifdef TARGET_ARCH_x86
-# include "vmreg_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vmreg_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vmreg_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vmreg_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vmreg_ppc.inline.hpp"
-#endif
-
#ifndef PRODUCT
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -56,6 +56,7 @@
#include "runtime/threadCritical.hpp"
#include "runtime/vframe.hpp"
#include "runtime/vframeArray.hpp"
+#include "runtime/vm_version.hpp"
#include "utilities/copy.hpp"
#include "utilities/events.hpp"
--- a/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, 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
@@ -28,22 +28,7 @@
#include "interpreter/bytecodes.hpp"
#include "memory/oopFactory.hpp"
#include "oops/constantPool.hpp"
-
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
+#include "utilities/bytes.hpp"
u2 BytecodeConstantPool::find_or_add(BytecodeCPEntry const& bcpe) {
u2 index;
--- a/hotspot/src/share/vm/classfile/classFileStream.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/classfile/classFileStream.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -25,22 +25,8 @@
#ifndef SHARE_VM_CLASSFILE_CLASSFILESTREAM_HPP
#define SHARE_VM_CLASSFILE_CLASSFILESTREAM_HPP
+#include "utilities/bytes.hpp"
#include "utilities/top.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
// Input stream for reading .class file
//
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1639,9 +1639,9 @@
if (fr.is_first_frame()) break;
address pc = fr.pc();
if (fr.is_interpreted_frame()) {
- intptr_t bcx = fr.interpreter_frame_bcx();
+ address bcp = fr.interpreter_frame_bcp();
method = fr.interpreter_frame_method();
- bci = fr.is_bci(bcx) ? bcx : method->bci_from((address)bcx);
+ bci = method->bci_from(bcp);
fr = fr.sender(&map);
} else {
CodeBlob* cb = fr.cb();
--- a/hotspot/src/share/vm/classfile/stackMapTable.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/classfile/stackMapTable.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -30,22 +30,8 @@
#include "memory/allocation.hpp"
#include "oops/constantPool.hpp"
#include "oops/method.hpp"
+#include "utilities/bytes.hpp"
#include "utilities/globalDefinitions.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
class StackMapReader;
--- a/hotspot/src/share/vm/classfile/verifier.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/classfile/verifier.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -45,21 +45,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
+#include "utilities/bytes.hpp"
#define NOFAILOVER_MAJOR_VERSION 51
#define NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION 51
@@ -439,7 +425,7 @@
if (_bci != -1 && method != NULL) {
streamIndentor si(ss);
const char* bytecode_name = "<invalid>";
- if (method->validate_bci_from_bcx(_bci) != -1) {
+ if (method->validate_bci(_bci) != -1) {
Bytecodes::Code code = Bytecodes::code_or_bp_at(method->bcp_from(_bci));
if (Bytecodes::is_defined(code)) {
bytecode_name = Bytecodes::name(code);
--- a/hotspot/src/share/vm/code/codeBlob.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/code/codeBlob.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -39,21 +39,6 @@
#include "runtime/sharedRuntime.hpp"
#include "runtime/vframe.hpp"
#include "services/memoryService.hpp"
-#ifdef TARGET_ARCH_x86
-# include "nativeInst_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "nativeInst_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "nativeInst_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "nativeInst_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "nativeInst_ppc.hpp"
-#endif
#ifdef COMPILER1
#include "c1/c1_Runtime1.hpp"
#endif
--- a/hotspot/src/share/vm/code/compiledIC.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/code/compiledIC.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -25,23 +25,9 @@
#ifndef SHARE_VM_CODE_COMPILEDIC_HPP
#define SHARE_VM_CODE_COMPILEDIC_HPP
+#include "code/nativeInst.hpp"
#include "interpreter/linkResolver.hpp"
#include "oops/compiledICHolder.hpp"
-#ifdef TARGET_ARCH_x86
-# include "nativeInst_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "nativeInst_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "nativeInst_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "nativeInst_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "nativeInst_ppc.hpp"
-#endif
//-----------------------------------------------------------------------------
// The CompiledIC represents a compiled inline cache.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/code/nativeInst.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_CODE_NATIVEINST_HPP
+#define SHARE_VM_CODE_NATIVEINST_HPP
+
+#ifdef TARGET_ARCH_x86
+# include "nativeInst_x86.hpp"
+#endif
+#ifdef TARGET_ARCH_sparc
+# include "nativeInst_sparc.hpp"
+#endif
+#ifdef TARGET_ARCH_zero
+# include "nativeInst_zero.hpp"
+#endif
+#ifdef TARGET_ARCH_arm
+# include "nativeInst_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "nativeInst_ppc.hpp"
+#endif
+
+#endif // SHARE_VM_CODE_NATIVEINST_HPP
--- a/hotspot/src/share/vm/code/vmreg.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/code/vmreg.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -25,34 +25,13 @@
#ifndef SHARE_VM_CODE_VMREG_HPP
#define SHARE_VM_CODE_VMREG_HPP
+#include "asm/register.hpp"
#include "memory/allocation.hpp"
#include "utilities/globalDefinitions.hpp"
-#include "asm/register.hpp"
#ifdef COMPILER2
#include "opto/adlcVMDeps.hpp"
#include "utilities/ostream.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/adGlobals_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/adGlobals_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/adGlobals_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/adGlobals_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/adGlobals_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/adGlobals_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/adGlobals_ppc_64.hpp"
-#endif
#endif
//------------------------------VMReg------------------------------------------
@@ -107,7 +86,7 @@
// also a register you could use in the assembler. On machines with
// 64bit registers only one half of the VMReg (and OptoReg) is considered
// concrete.
- bool is_concrete();
+ // bool is_concrete();
// VMRegs are 4 bytes wide on all platforms
static const int stack_slot_size;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/code/vmreg.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_CODE_VMREG_INLINE_HPP
+#define SHARE_VM_CODE_VMREG_INLINE_HPP
+
+#include "asm/register.hpp"
+#include "code/vmreg.hpp"
+#ifdef TARGET_ARCH_x86
+# include "vmreg_x86.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_sparc
+# include "vmreg_sparc.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_zero
+# include "vmreg_zero.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_arm
+# include "vmreg_arm.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "vmreg_ppc.inline.hpp"
+#endif
+
+#endif // SHARE_VM_CODE_VMREG_INLINE_HPP
--- a/hotspot/src/share/vm/compiler/compileLog.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/compiler/compileLog.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "ci/ciMethod.hpp"
+#include "code/codeCache.hpp"
#include "compiler/compileLog.hpp"
#include "memory/allocation.inline.hpp"
#include "oops/method.hpp"
--- a/hotspot/src/share/vm/compiler/oopMap.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/compiler/oopMap.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -36,6 +36,9 @@
#ifdef COMPILER1
#include "c1/c1_Defs.hpp"
#endif
+#ifdef COMPILER2
+#include "opto/optoreg.hpp"
+#endif
// OopMapStream
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1904,12 +1904,12 @@
assert(size > new_size, "Split from a smaller block?");
assert(is_aligned(chunk), "alignment problem");
assert(size == adjustObjectSize(size), "alignment problem");
- size_t rem_size = size - new_size;
- assert(rem_size == adjustObjectSize(rem_size), "alignment problem");
- assert(rem_size >= MinChunkSize, "Free chunk smaller than minimum");
+ size_t rem_sz = size - new_size;
+ assert(rem_sz == adjustObjectSize(rem_sz), "alignment problem");
+ assert(rem_sz >= MinChunkSize, "Free chunk smaller than minimum");
FreeChunk* ffc = (FreeChunk*)((HeapWord*)chunk + new_size);
assert(is_aligned(ffc), "alignment problem");
- ffc->set_size(rem_size);
+ ffc->set_size(rem_sz);
ffc->link_next(NULL);
ffc->link_prev(NULL); // Mark as a free block for other (parallel) GC threads.
// Above must occur before BOT is updated below.
@@ -1917,18 +1917,18 @@
OrderAccess::storestore();
assert(chunk->is_free() && ffc->is_free(), "Error");
_bt.split_block((HeapWord*)chunk, chunk->size(), new_size);
- if (rem_size < SmallForDictionary) {
+ if (rem_sz < SmallForDictionary) {
bool is_par = (SharedHeap::heap()->n_par_threads() > 0);
- if (is_par) _indexedFreeListParLocks[rem_size]->lock();
+ if (is_par) _indexedFreeListParLocks[rem_sz]->lock();
assert(!is_par ||
(SharedHeap::heap()->n_par_threads() ==
SharedHeap::heap()->workers()->active_workers()), "Mismatch");
returnChunkToFreeList(ffc);
- split(size, rem_size);
- if (is_par) _indexedFreeListParLocks[rem_size]->unlock();
+ split(size, rem_sz);
+ if (is_par) _indexedFreeListParLocks[rem_sz]->unlock();
} else {
returnChunkToDictionary(ffc);
- split(size ,rem_size);
+ split(size, rem_sz);
}
chunk->set_size(new_size);
return chunk;
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -891,6 +891,10 @@
guarantee(!g1h->mark_in_progress(), "invariant");
}
+bool ConcurrentMark::nextMarkBitmapIsClear() {
+ return _nextMarkBitMap->getNextMarkedWordAddress(_heap_start, _heap_end) == _heap_end;
+}
+
class NoteStartOfMarkHRClosure: public HeapRegionClosure {
public:
bool doHeapRegion(HeapRegion* r) {
@@ -3358,7 +3362,8 @@
// abandon current marking iteration due to a Full GC
void ConcurrentMark::abort() {
- // Clear all marks to force marking thread to do nothing
+ // Clear all marks in the next bitmap for the next marking cycle. This will allow us to skip the next
+ // concurrent bitmap clearing.
_nextMarkBitMap->clearAll();
// Note we cannot clear the previous marking bitmap here
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -736,6 +736,9 @@
// Clear the next marking bitmap (will be called concurrently).
void clearNextBitmap();
+ // Return whether the next mark bitmap has no marks set.
+ bool nextMarkBitmapIsClear();
+
// These two do the work that needs to be done before and after the
// initial root checkpoint. Since this checkpoint can be done at two
// different points (i.e. an explicit pause or piggy-backed on a
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -277,9 +277,13 @@
// We now want to allow clearing of the marking bitmap to be
// suspended by a collection pause.
- {
+ // We may have aborted just before the remark. Do not bother clearing the
+ // bitmap then, as it has been done during mark abort.
+ if (!cm()->has_aborted()) {
SuspendibleThreadSetJoiner sts;
_cm->clearNextBitmap();
+ } else {
+ assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear");
}
}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -2950,10 +2950,17 @@
}
}
-CompactibleSpace* G1CollectedHeap::first_compactible_space() {
- return n_regions() > 0 ? region_at(0) : NULL;
-}
-
+HeapRegion* G1CollectedHeap::next_compaction_region(const HeapRegion* from) const {
+ // We're not using an iterator given that it will wrap around when
+ // it reaches the last region and this is not what we want here.
+ for (uint index = from->hrs_index() + 1; index < n_regions(); index++) {
+ HeapRegion* hr = region_at(index);
+ if (!hr->isHumongous()) {
+ return hr;
+ }
+ }
+ return NULL;
+}
Space* G1CollectedHeap::space_containing(const void* addr) const {
return heap_region_containing(addr);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1158,19 +1158,19 @@
}
// The total number of regions in the heap.
- uint n_regions() { return _hrs.length(); }
+ uint n_regions() const { return _hrs.length(); }
// The max number of regions in the heap.
- uint max_regions() { return _hrs.max_length(); }
+ uint max_regions() const { return _hrs.max_length(); }
// The number of regions that are completely free.
- uint free_regions() { return _free_list.length(); }
+ uint free_regions() const { return _free_list.length(); }
// The number of regions that are not completely free.
- uint used_regions() { return n_regions() - free_regions(); }
+ uint used_regions() const { return n_regions() - free_regions(); }
// The number of regions available for "regular" expansion.
- uint expansion_regions() { return _expansion_regions; }
+ uint expansion_regions() const { return _expansion_regions; }
// Factory method for HeapRegion instances. It will return NULL if
// the allocation fails.
@@ -1392,8 +1392,7 @@
// As above but starting from region r
void collection_set_iterate_from(HeapRegion* r, HeapRegionClosure *blk);
- // Returns the first (lowest address) compactible space in the heap.
- virtual CompactibleSpace* first_compactible_space();
+ HeapRegion* next_compaction_region(const HeapRegion* from) const;
// A CollectedHeap will contain some number of spaces. This finds the
// space containing a given address, or else returns NULL.
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1047,7 +1047,7 @@
bool new_in_marking_window = _in_marking_window;
bool new_in_marking_window_im = false;
- if (during_initial_mark_pause()) {
+ if (last_pause_included_initial_mark) {
new_in_marking_window = true;
new_in_marking_window_im = true;
}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -76,7 +76,6 @@
// When collecting the permanent generation Method*s may be moving,
// so we either have to flush all bcp data or convert it into bci.
CodeCache::gc_prologue();
- Threads::gc_prologue();
bool marked_for_unloading = false;
@@ -106,7 +105,6 @@
// Universe::set_heap_capacity_at_last_gc(Universe::heap()->capacity());
// Universe::set_heap_used_at_last_gc(Universe::heap()->used());
- Threads::gc_epilogue();
CodeCache::gc_epilogue();
JvmtiExport::gc_epilogue();
@@ -201,6 +199,23 @@
CompactPoint _cp;
HeapRegionSetCount _humongous_regions_removed;
+ bool is_cp_initialized() const {
+ return _cp.space != NULL;
+ }
+
+ void prepare_for_compaction(HeapRegion* hr, HeapWord* end) {
+ // If this is the first live region that we came across which we can compact,
+ // initialize the CompactPoint.
+ if (!is_cp_initialized()) {
+ _cp.space = hr;
+ _cp.threshold = hr->initialize_threshold();
+ }
+ hr->prepare_for_compaction(&_cp);
+ // Also clear the part of the card table that will be unused after
+ // compaction.
+ _mrbs->clear(MemRegion(hr->compaction_top(), end));
+ }
+
void free_humongous_region(HeapRegion* hr) {
HeapWord* end = hr->end();
FreeRegionList dummy_free_list("Dummy Free List for G1MarkSweep");
@@ -212,18 +227,15 @@
_humongous_regions_removed.increment(1u, hr->capacity());
_g1h->free_humongous_region(hr, &dummy_free_list, false /* par */);
- hr->prepare_for_compaction(&_cp);
- // Also clear the part of the card table that will be unused after
- // compaction.
- _mrbs->clear(MemRegion(hr->compaction_top(), end));
+ prepare_for_compaction(hr, end);
dummy_free_list.remove_all();
}
public:
- G1PrepareCompactClosure(CompactibleSpace* cs)
+ G1PrepareCompactClosure()
: _g1h(G1CollectedHeap::heap()),
_mrbs(_g1h->g1_barrier_set()),
- _cp(NULL, cs, cs->initialize_threshold()),
+ _cp(NULL),
_humongous_regions_removed() { }
void update_sets() {
@@ -246,10 +258,7 @@
assert(hr->continuesHumongous(), "Invalid humongous.");
}
} else {
- hr->prepare_for_compaction(&_cp);
- // Also clear the part of the card table that will be unused after
- // compaction.
- _mrbs->clear(MemRegion(hr->compaction_top(), hr->end()));
+ prepare_for_compaction(hr, hr->end());
}
return false;
}
@@ -267,14 +276,7 @@
GCTraceTime tm("phase 2", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id());
GenMarkSweep::trace("2");
- // find the first region
- HeapRegion* r = g1h->region_at(0);
- CompactibleSpace* sp = r;
- if (r->isHumongous() && oop(r->bottom())->is_gc_marked()) {
- sp = r->next_compaction_space();
- }
-
- G1PrepareCompactClosure blk(sp);
+ G1PrepareCompactClosure blk;
g1h->heap_region_iterate(&blk);
blk.update_sets();
}
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -381,18 +381,7 @@
}
CompactibleSpace* HeapRegion::next_compaction_space() const {
- // We're not using an iterator given that it will wrap around when
- // it reaches the last region and this is not what we want here.
- G1CollectedHeap* g1h = G1CollectedHeap::heap();
- uint index = hrs_index() + 1;
- while (index < g1h->n_regions()) {
- HeapRegion* hr = g1h->region_at(index);
- if (!hr->isHumongous()) {
- return hr;
- }
- index += 1;
- }
- return NULL;
+ return G1CollectedHeap::heap()->next_compaction_region(this);
}
void HeapRegion::note_self_forwarding_removal_start(bool during_initial_mark,
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -119,7 +119,7 @@
public:
const char* name() { return _name; }
- uint length() { return _count.length(); }
+ uint length() const { return _count.length(); }
bool is_empty() { return _count.length() == 0; }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -180,7 +180,6 @@
size_policy->major_collection_begin();
CodeCache::gc_prologue();
- Threads::gc_prologue();
BiasedLocking::preserve_marks();
// Capture heap size before collection for printing.
@@ -251,7 +250,6 @@
MetaspaceAux::verify_metrics();
BiasedLocking::restore_marks();
- Threads::gc_epilogue();
CodeCache::gc_epilogue();
JvmtiExport::gc_epilogue();
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1066,7 +1066,6 @@
ClassLoaderDataGraph::purge();
MetaspaceAux::verify_metrics();
- Threads::gc_epilogue();
CodeCache::gc_epilogue();
JvmtiExport::gc_epilogue();
@@ -2068,7 +2067,6 @@
size_policy->major_collection_begin();
CodeCache::gc_prologue();
- Threads::gc_prologue();
COMPILER2_PRESENT(DerivedPointerTable::clear());
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -25,29 +25,12 @@
#ifndef SHARE_VM_INTERPRETER_ABSTRACTINTERPRETER_HPP
#define SHARE_VM_INTERPRETER_ABSTRACTINTERPRETER_HPP
+#include "asm/macroAssembler.hpp"
#include "code/stubs.hpp"
#include "interpreter/bytecodes.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/top.hpp"
-#ifdef TARGET_ARCH_x86
-# include "interp_masm_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "interp_masm_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "interp_masm_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "interp_masm_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "interp_masm_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "interp_masm_ppc_64.hpp"
-#endif
// This file contains the platform-independent parts
// of the abstract interpreter and the abstract interpreter generator.
@@ -75,6 +58,8 @@
//------------------------------------------------------------------------------------------------------------------------
// The C++ interface to the bytecode interpreter(s).
+class InterpreterMacroAssembler;
+
class AbstractInterpreter: AllStatic {
friend class VMStructs;
friend class Interpreter;
--- a/hotspot/src/share/vm/interpreter/bytecode.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/bytecode.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,21 +28,7 @@
#include "interpreter/bytecodes.hpp"
#include "memory/allocation.hpp"
#include "oops/method.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
+#include "utilities/bytes.hpp"
class ciBytecodeStream;
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -32,21 +32,6 @@
#include "runtime/frame.hpp"
#include "runtime/globals.hpp"
#include "utilities/globalDefinitions.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
#ifdef CC_INTERP
@@ -56,6 +41,8 @@
// CVM definitions find hotspot equivalents...
+class InterpreterMacroAssembler;
+
union VMJavaVal64 {
jlong l;
jdouble d;
--- a/hotspot/src/share/vm/interpreter/bytecodeStream.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/bytecodeStream.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -29,21 +29,7 @@
#include "memory/allocation.hpp"
#include "oops/method.hpp"
#include "runtime/handles.inline.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
+#include "utilities/bytes.hpp"
// A BytecodeStream is used for fast iteration over the bytecodes
// of a Method*.
--- a/hotspot/src/share/vm/interpreter/bytecodes.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/bytecodes.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,21 +26,7 @@
#include "interpreter/bytecodes.hpp"
#include "memory/resourceArea.hpp"
#include "oops/method.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
+#include "utilities/bytes.hpp"
#if defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER < 1600))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/interpreter/interp_masm.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_INTERPRETER_INTERP_MASM_HPP
+#define SHARE_VM_INTERPRETER_INTERP_MASM_HPP
+
+#include "asm/macroAssembler.hpp"
+
+#ifdef TARGET_ARCH_x86
+# include "interp_masm_x86.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_sparc
+# include "interp_masm_sparc.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_zero
+# include "interp_masm_zero.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_arm
+# include "interp_masm_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_ppc_32
+# include "interp_masm_ppc_32.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_ppc_64
+# include "interp_masm_ppc_64.hpp"
+#endif
+
+#endif // SHARE_VM_INTERPRETER_INTERP_MASM_HPP
--- a/hotspot/src/share/vm/interpreter/interpreter.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -30,6 +30,7 @@
#include "interpreter/bytecodeInterpreter.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
@@ -80,9 +81,35 @@
}
}
+CodeletMark::CodeletMark(InterpreterMacroAssembler*& masm,
+ const char* description,
+ Bytecodes::Code bytecode) :
+ _clet((InterpreterCodelet*)AbstractInterpreter::code()->request(codelet_size())),
+ _cb(_clet->code_begin(), _clet->code_size()) {
+ // Request all space (add some slack for Codelet data).
+ assert(_clet != NULL, "we checked not enough space already");
+
+ // Initialize Codelet attributes.
+ _clet->initialize(description, bytecode);
+ // Create assembler for code generation.
+ masm = new InterpreterMacroAssembler(&_cb);
+ _masm = &masm;
+}
+
+CodeletMark::~CodeletMark() {
+ // Align so printing shows nop's instead of random code at the end (Codelets are aligned).
+ (*_masm)->align(wordSize);
+ // Make sure all code is in code buffer.
+ (*_masm)->flush();
+
+ // Commit Codelet.
+ AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size(), (*_masm)->code()->strings());
+ // Make sure nobody can use _masm outside a CodeletMark lifespan.
+ *_masm = NULL;
+}
//------------------------------------------------------------------------------------------------------------------------
-// Implementation of platform independent aspects of Interpreter
+// Implementation of platform independent aspects of Interpreter
void AbstractInterpreter::initialize() {
if (_code != NULL) return;
--- a/hotspot/src/share/vm/interpreter/interpreter.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/interpreter.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -37,6 +37,8 @@
// This file contains the platform-independent parts
// of the interpreter and the interpreter generator.
+class InterpreterMacroAssembler;
+
//------------------------------------------------------------------------------------------------------------------------
// An InterpreterCodelet is a piece of interpreter code. All
// interpreter code is generated into little codelets which
@@ -99,42 +101,17 @@
int codelet_size = AbstractInterpreter::code()->available_space() - 2*K;
// Guarantee there's a little bit of code space left.
- guarantee (codelet_size > 0 && (size_t)codelet_size > 2*K,
- "not enough space for interpreter generation");
+ guarantee(codelet_size > 0 && (size_t)codelet_size > 2*K,
+ "not enough space for interpreter generation");
return codelet_size;
}
public:
- CodeletMark(
- InterpreterMacroAssembler*& masm,
- const char* description,
- Bytecodes::Code bytecode = Bytecodes::_illegal):
- _clet((InterpreterCodelet*)AbstractInterpreter::code()->request(codelet_size())),
- _cb(_clet->code_begin(), _clet->code_size())
-
- { // request all space (add some slack for Codelet data)
- assert (_clet != NULL, "we checked not enough space already");
-
- // initialize Codelet attributes
- _clet->initialize(description, bytecode);
- // create assembler for code generation
- masm = new InterpreterMacroAssembler(&_cb);
- _masm = &masm;
- }
-
- ~CodeletMark() {
- // align so printing shows nop's instead of random code at the end (Codelets are aligned)
- (*_masm)->align(wordSize);
- // make sure all code is in code buffer
- (*_masm)->flush();
-
-
- // commit Codelet
- AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size(), (*_masm)->code()->strings());
- // make sure nobody can use _masm outside a CodeletMark lifespan
- *_masm = NULL;
- }
+ CodeletMark(InterpreterMacroAssembler*& masm,
+ const char* description,
+ Bytecodes::Code bytecode = Bytecodes::_illegal);
+ ~CodeletMark();
};
// Wrapper classes to produce Interpreter/InterpreterGenerator from either
@@ -142,9 +119,10 @@
class Interpreter: public CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) {
- public:
+ public:
// Debugging/printing
- static InterpreterCodelet* codelet_containing(address pc) { return (InterpreterCodelet*)_code->stub_containing(pc); }
+ static InterpreterCodelet* codelet_containing(address pc) { return (InterpreterCodelet*)_code->stub_containing(pc); }
+
#ifdef TARGET_ARCH_x86
# include "interpreter_x86.hpp"
#endif
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -48,6 +48,7 @@
#include "runtime/deoptimization.hpp"
#include "runtime/fieldDescriptor.hpp"
#include "runtime/handles.inline.hpp"
+#include "runtime/icache.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/java.hpp"
#include "runtime/jfieldIDWorkaround.hpp"
@@ -57,21 +58,6 @@
#include "runtime/synchronizer.hpp"
#include "runtime/threadCritical.hpp"
#include "utilities/events.hpp"
-#ifdef TARGET_ARCH_x86
-# include "vm_version_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vm_version_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vm_version_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vm_version_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vm_version_ppc.hpp"
-#endif
#ifdef COMPILER2
#include "opto/runtime.hpp"
#endif
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -26,6 +26,8 @@
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreterRuntime.hpp"
+#include "interpreter/interp_masm.hpp"
+#include "interpreter/templateInterpreter.hpp"
#include "interpreter/templateTable.hpp"
#ifndef CC_INTERP
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -33,6 +33,8 @@
#ifndef CC_INTERP
+class InterpreterMacroAssembler;
+
//------------------------------------------------------------------------------------------------------------------------
// A little wrapper class to group tosca-specific entry points into a unit.
// (tosca = Top-Of-Stack CAche)
--- a/hotspot/src/share/vm/interpreter/templateTable.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/templateTable.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "gc_interface/collectedHeap.hpp"
+#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "runtime/timer.hpp"
--- a/hotspot/src/share/vm/interpreter/templateTable.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/templateTable.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,24 +28,6 @@
#include "interpreter/bytecodes.hpp"
#include "memory/allocation.hpp"
#include "runtime/frame.hpp"
-#ifdef TARGET_ARCH_x86
-# include "interp_masm_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "interp_masm_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "interp_masm_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "interp_masm_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "interp_masm_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "interp_masm_ppc_64.hpp"
-#endif
#ifndef CC_INTERP
// All the necessary definitions used for (bytecode) template generation. Instead of
@@ -53,6 +35,7 @@
// and the snippet generator, a template is assigned to each bytecode which can be
// used to generate the bytecode's implementation if needed.
+class InterpreterMacroAssembler;
// A Template describes the properties of a code template for a given bytecode
// and provides a generator to generate the code template.
--- a/hotspot/src/share/vm/memory/filemap.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/memory/filemap.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -30,6 +30,7 @@
#include "runtime/arguments.hpp"
#include "runtime/java.hpp"
#include "runtime/os.hpp"
+#include "runtime/vm_version.hpp"
#include "services/memTracker.hpp"
#include "utilities/defaultStream.hpp"
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1088,7 +1088,7 @@
guarantee(_n_gens = 2, "Wrong number of generations");
Generation* old_gen = _gens[1];
// Start by compacting into same gen.
- CompactPoint cp(old_gen, NULL, NULL);
+ CompactPoint cp(old_gen);
old_gen->prepare_for_compaction(&cp);
Generation* young_gen = _gens[0];
young_gen->prepare_for_compaction(&cp);
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -76,7 +76,6 @@
// When collecting the permanent generation Method*s may be moving,
// so we either have to flush all bcp data or convert it into bci.
CodeCache::gc_prologue();
- Threads::gc_prologue();
// Increment the invocation count
_total_invocations++;
@@ -132,7 +131,6 @@
rs->invalidate_or_clear(old_gen);
}
- Threads::gc_epilogue();
CodeCache::gc_epilogue();
JvmtiExport::gc_epilogue();
--- a/hotspot/src/share/vm/memory/space.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/memory/space.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -330,9 +330,9 @@
Generation* gen;
CompactibleSpace* space;
HeapWord* threshold;
- CompactPoint(Generation* _gen, CompactibleSpace* _space,
- HeapWord* _threshold) :
- gen(_gen), space(_space), threshold(_threshold) {}
+
+ CompactPoint(Generation* _gen) :
+ gen(_gen), space(NULL), threshold(0) {}
};
--- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -28,6 +28,7 @@
#include "gc_implementation/shared/gcUtil.hpp"
#include "oops/typeArrayOop.hpp"
#include "runtime/perfData.hpp"
+#include "runtime/vm_version.hpp"
class GlobalTLABStats;
--- a/hotspot/src/share/vm/oops/constantPool.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/oops/constantPool.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -31,22 +31,8 @@
#include "oops/symbol.hpp"
#include "oops/typeArrayOop.hpp"
#include "runtime/handles.hpp"
+#include "utilities/bytes.hpp"
#include "utilities/constantTag.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
// A ConstantPool is an array containing class constants as described in the
// class file.
--- a/hotspot/src/share/vm/oops/method.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/oops/method.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -240,6 +240,9 @@
int Method::bci_from(address bcp) const {
+ if (is_native() && bcp == 0) {
+ return 0;
+ }
#ifdef ASSERT
{ ResourceMark rm;
assert(is_native() && bcp == code_base() || contains(bcp) || is_error_reported(),
@@ -250,24 +253,23 @@
}
-// Return (int)bcx if it appears to be a valid BCI.
-// Return bci_from((address)bcx) if it appears to be a valid BCP.
+int Method::validate_bci(int bci) const {
+ return (bci == 0 || bci < code_size()) ? bci : -1;
+}
+
+// Return bci if it appears to be a valid bcp
// Return -1 otherwise.
// Used by profiling code, when invalid data is a possibility.
// The caller is responsible for validating the Method* itself.
-int Method::validate_bci_from_bcx(intptr_t bcx) const {
+int Method::validate_bci_from_bcp(address bcp) const {
// keep bci as -1 if not a valid bci
int bci = -1;
- if (bcx == 0 || (address)bcx == code_base()) {
+ if (bcp == 0 || bcp == code_base()) {
// code_size() may return 0 and we allow 0 here
// the method may be native
bci = 0;
- } else if (frame::is_bci(bcx)) {
- if (bcx < code_size()) {
- bci = (int)bcx;
- }
- } else if (contains((address)bcx)) {
- bci = (address)bcx - code_base();
+ } else if (contains(bcp)) {
+ bci = bcp - code_base();
}
// Assert that if we have dodged any asserts, bci is negative.
assert(bci == -1 || bci == bci_from(bcp_from(bci)), "sane bci if >=0");
--- a/hotspot/src/share/vm/oops/method.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/oops/method.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -649,7 +649,8 @@
// Returns the byte code index from the byte code pointer
int bci_from(address bcp) const;
address bcp_from(int bci) const;
- int validate_bci_from_bcx(intptr_t bcx) const;
+ int validate_bci_from_bcp(address bcp) const;
+ int validate_bci(int bci) const;
// Returns the line number for a bci if debugging information for the method is prowided,
// -1 is returned otherwise.
--- a/hotspot/src/share/vm/oops/methodData.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/oops/methodData.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -2338,10 +2338,6 @@
return dp - ((address)_data);
}
- address di_to_dp(int di) {
- return (address)data_layout_at(di);
- }
-
// bci to di/dp conversion.
address bci_to_dp(int bci);
int bci_to_di(int bci) {
--- a/hotspot/src/share/vm/oops/oop.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -42,21 +42,6 @@
#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
#include "utilities/macros.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
// Implementation of all inlined member functions defined in oop.hpp
// We need a separate file to avoid circular references
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/opto/ad.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_OPTO_AD_HPP
+#define SHARE_VM_OPTO_AD_HPP
+
+#ifdef TARGET_ARCH_MODEL_x86_32
+# include "adfiles/ad_x86_32.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_x86_64
+# include "adfiles/ad_x86_64.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_sparc
+# include "adfiles/ad_sparc.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_zero
+# include "adfiles/ad_zero.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_arm
+# include "adfiles/ad_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_ppc_32
+# include "adfiles/ad_ppc_32.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_ppc_64
+# include "adfiles/ad_ppc_64.hpp"
+#endif
+
+#endif // SHARE_VM_OPTO_AD_HPP
--- a/hotspot/src/share/vm/opto/buildOopMap.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/buildOopMap.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "code/vmreg.inline.hpp"
#include "compiler/oopMap.hpp"
#include "opto/addnode.hpp"
#include "opto/callnode.hpp"
@@ -32,21 +33,6 @@
#include "opto/phase.hpp"
#include "opto/regalloc.hpp"
#include "opto/rootnode.hpp"
-#ifdef TARGET_ARCH_x86
-# include "vmreg_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vmreg_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vmreg_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vmreg_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vmreg_ppc.inline.hpp"
-#endif
// The functions in this file builds OopMaps after all scheduling is done.
//
--- a/hotspot/src/share/vm/opto/c2compiler.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -24,28 +24,8 @@
#include "precompiled.hpp"
#include "opto/c2compiler.hpp"
+#include "opto/optoreg.hpp"
#include "opto/runtime.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/ad_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/ad_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#endif
// register information defined by ADLC
extern const char register_save_policy[];
--- a/hotspot/src/share/vm/opto/compile.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/compile.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -69,27 +69,6 @@
#include "runtime/timer.hpp"
#include "trace/tracing.hpp"
#include "utilities/copy.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/ad_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/ad_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#endif
// -------------------- Compile::mach_constant_base_node -----------------------
--- a/hotspot/src/share/vm/opto/gcm.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/gcm.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -35,28 +35,6 @@
#include "opto/rootnode.hpp"
#include "opto/runtime.hpp"
#include "runtime/deoptimization.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/ad_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/ad_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#endif
-
// Portions of code courtesy of Clifford Click
--- a/hotspot/src/share/vm/opto/lcm.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/lcm.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -24,33 +24,13 @@
#include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
+#include "opto/ad.hpp"
#include "opto/block.hpp"
#include "opto/c2compiler.hpp"
#include "opto/callnode.hpp"
#include "opto/cfgnode.hpp"
#include "opto/machnode.hpp"
#include "opto/runtime.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/ad_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/ad_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#endif
// Optimization - Graph Style
--- a/hotspot/src/share/vm/opto/library_call.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/library_call.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "asm/macroAssembler.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "compiler/compileBroker.hpp"
--- a/hotspot/src/share/vm/opto/locknode.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/locknode.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -28,27 +28,9 @@
#include "opto/node.hpp"
#include "opto/opcodes.hpp"
#include "opto/subnode.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/ad_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/ad_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#endif
+
+class BiasedLockingCounters;
+class RTMLockingCounters;
//------------------------------BoxLockNode------------------------------------
class BoxLockNode : public Node {
--- a/hotspot/src/share/vm/opto/matcher.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/matcher.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
+#include "opto/ad.hpp"
#include "opto/addnode.hpp"
#include "opto/callnode.hpp"
#include "opto/idealGraphPrinter.hpp"
@@ -37,27 +38,6 @@
#include "opto/type.hpp"
#include "opto/vectornode.hpp"
#include "runtime/os.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/ad_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/ad_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#endif
OptoReg::Name OptoReg::c_frame_pointer;
--- a/hotspot/src/share/vm/opto/optoreg.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/optoreg.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -25,6 +25,30 @@
#ifndef SHARE_VM_OPTO_OPTOREG_HPP
#define SHARE_VM_OPTO_OPTOREG_HPP
+// AdGlobals contains c2 specific register handling code as specified
+// in the .ad files.
+#ifdef TARGET_ARCH_MODEL_x86_32
+# include "adfiles/adGlobals_x86_32.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_x86_64
+# include "adfiles/adGlobals_x86_64.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_sparc
+# include "adfiles/adGlobals_sparc.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_zero
+# include "adfiles/adGlobals_zero.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_arm
+# include "adfiles/adGlobals_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_ppc_32
+# include "adfiles/adGlobals_ppc_32.hpp"
+#endif
+#ifdef TARGET_ARCH_MODEL_ppc_64
+# include "adfiles/adGlobals_ppc_64.hpp"
+#endif
+
//------------------------------OptoReg----------------------------------------
// We eventually need Registers for the Real World. Registers are essentially
// non-SSA names. A Register is represented as a number. Non-regular values
--- a/hotspot/src/share/vm/opto/output.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/output.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -30,10 +30,12 @@
#include "compiler/compileBroker.hpp"
#include "compiler/oopMap.hpp"
#include "memory/allocation.inline.hpp"
+#include "opto/ad.hpp"
#include "opto/callnode.hpp"
#include "opto/cfgnode.hpp"
#include "opto/locknode.hpp"
#include "opto/machnode.hpp"
+#include "opto/optoreg.hpp"
#include "opto/output.hpp"
#include "opto/regalloc.hpp"
#include "opto/runtime.hpp"
--- a/hotspot/src/share/vm/opto/output.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/output.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -25,29 +25,9 @@
#ifndef SHARE_VM_OPTO_OUTPUT_HPP
#define SHARE_VM_OPTO_OUTPUT_HPP
+#include "opto/ad.hpp"
#include "opto/block.hpp"
#include "opto/node.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/ad_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/ad_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#endif
class Arena;
class Bundle;
--- a/hotspot/src/share/vm/opto/regmask.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/regmask.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -23,29 +23,9 @@
*/
#include "precompiled.hpp"
+#include "opto/ad.hpp"
#include "opto/compile.hpp"
#include "opto/regmask.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/ad_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/ad_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#endif
#define RM_SIZE _RM_SIZE /* a constant private to the class RegMask */
--- a/hotspot/src/share/vm/opto/regmask.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/regmask.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,27 +27,6 @@
#include "code/vmreg.hpp"
#include "opto/optoreg.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/adGlobals_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/adGlobals_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/adGlobals_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/adGlobals_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/adGlobals_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/adGlobals_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/adGlobals_ppc_64.hpp"
-#endif
// Some fun naming (textual) substitutions:
//
--- a/hotspot/src/share/vm/opto/runtime.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/runtime.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
+#include "code/codeCache.hpp"
#include "code/compiledIC.hpp"
#include "code/icBuffer.hpp"
#include "code/nmethod.hpp"
@@ -45,6 +46,7 @@
#include "memory/oopFactory.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
+#include "opto/ad.hpp"
#include "opto/addnode.hpp"
#include "opto/callnode.hpp"
#include "opto/cfgnode.hpp"
@@ -68,27 +70,6 @@
#include "runtime/vframe_hp.hpp"
#include "utilities/copy.hpp"
#include "utilities/preserveException.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/ad_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/ad_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#endif
// For debugging purposes:
--- a/hotspot/src/share/vm/opto/runtime.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/opto/runtime.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -27,6 +27,7 @@
#include "code/codeBlob.hpp"
#include "opto/machnode.hpp"
+#include "opto/optoreg.hpp"
#include "opto/type.hpp"
#include "runtime/biasedLocking.hpp"
#include "runtime/rtmLocking.hpp"
--- a/hotspot/src/share/vm/precompiled/precompiled.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/precompiled/precompiled.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -70,6 +70,7 @@
# include "code/exceptionHandlerTable.hpp"
# include "code/jvmticmlr.h"
# include "code/location.hpp"
+# include "code/nativeInst.hpp"
# include "code/nmethod.hpp"
# include "code/oopRecorder.hpp"
# include "code/pcDesc.hpp"
@@ -106,6 +107,7 @@
# include "interpreter/bytecodes.hpp"
# include "interpreter/cppInterpreter.hpp"
# include "interpreter/interpreter.hpp"
+# include "interpreter/interp_masm.hpp"
# include "interpreter/invocationCounter.hpp"
# include "interpreter/linkResolver.hpp"
# include "interpreter/templateInterpreter.hpp"
@@ -228,6 +230,7 @@
# include "utilities/array.hpp"
# include "utilities/bitMap.hpp"
# include "utilities/bitMap.inline.hpp"
+# include "utilities/bytes.hpp"
# include "utilities/constantTag.hpp"
# include "utilities/copy.hpp"
# include "utilities/debug.hpp"
@@ -250,6 +253,7 @@
# include "libadt/dict.hpp"
# include "libadt/set.hpp"
# include "libadt/vectset.hpp"
+# include "opto/ad.hpp"
# include "opto/addnode.hpp"
# include "opto/adlcVMDeps.hpp"
# include "opto/block.hpp"
--- a/hotspot/src/share/vm/prims/forte.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/prims/forte.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -234,9 +234,8 @@
*method_p = method;
if (!method->is_valid_method()) return false;
- intptr_t bcx = fr->interpreter_frame_bcx();
-
- int bci = method->validate_bci_from_bcx(bcx);
+ address bcp = fr->interpreter_frame_bcp();
+ int bci = method->validate_bci_from_bcp(bcp);
// note: bci is set to -1 if not a valid bci
*bci_p = bci;
--- a/hotspot/src/share/vm/prims/jniCheck.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -37,21 +37,6 @@
#include "runtime/interfaceSupport.hpp"
#include "runtime/jfieldIDWorkaround.hpp"
#include "runtime/thread.inline.hpp"
-#ifdef TARGET_ARCH_x86
-# include "jniTypes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "jniTypes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "jniTypes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "jniTypes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "jniTypes_ppc.hpp"
-#endif
// Complain every extra number of unplanned local refs
#define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32
--- a/hotspot/src/share/vm/prims/jvm.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvm.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -59,6 +59,7 @@
#include "runtime/thread.inline.hpp"
#include "runtime/vframe.hpp"
#include "runtime/vm_operations.hpp"
+#include "runtime/vm_version.hpp"
#include "services/attachListener.hpp"
#include "services/management.hpp"
#include "services/threadService.hpp"
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -28,21 +28,8 @@
#include "oops/fieldStreams.hpp"
#include "prims/jvmtiClassFileReconstituter.hpp"
#include "runtime/signature.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
+#include "utilities/bytes.hpp"
+
// FIXME: add Deprecated attribute
// FIXME: fix Synthetic attribute
// FIXME: per Serguei, add error return handling for ConstantPool::copy_cpool_bytes()
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -26,6 +26,7 @@
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
+#include "code/codeCache.hpp"
#include "jvmtifiles/jvmtiEnv.hpp"
#include "oops/instanceMirrorKlass.hpp"
#include "oops/objArrayKlass.hpp"
--- a/hotspot/src/share/vm/prims/unsafe.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/prims/unsafe.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -38,6 +38,7 @@
#include "runtime/orderAccess.inline.hpp"
#include "runtime/reflection.hpp"
#include "runtime/synchronizer.hpp"
+#include "runtime/vm_version.hpp"
#include "services/threadService.hpp"
#include "trace/tracing.hpp"
#include "utilities/copy.hpp"
--- a/hotspot/src/share/vm/prims/whitebox.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/prims/whitebox.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
+#include "code/codeCache.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
@@ -38,6 +39,7 @@
#include "runtime/arguments.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/os.hpp"
+#include "runtime/vm_version.hpp"
#include "utilities/array.hpp"
#include "utilities/debug.hpp"
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "code/codeCache.hpp"
#include "runtime/advancedThresholdPolicy.hpp"
#include "runtime/simpleThresholdPolicy.inline.hpp"
--- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -38,6 +38,7 @@
#include "runtime/globals_extension.hpp"
#include "runtime/java.hpp"
#include "runtime/os.hpp"
+#include "runtime/vm_version.hpp"
#include "services/management.hpp"
#include "services/memTracker.hpp"
#include "utilities/defaultStream.hpp"
@@ -1537,8 +1538,10 @@
heap_alignment = G1CollectedHeap::conservative_max_heap_alignment();
}
#endif // INCLUDE_ALL_GCS
- _conservative_max_heap_alignment = MAX3(heap_alignment, os::max_page_size(),
- CollectorPolicy::compute_heap_alignment());
+ _conservative_max_heap_alignment = MAX4(heap_alignment,
+ (size_t)os::vm_allocation_granularity(),
+ os::max_page_size(),
+ CollectorPolicy::compute_heap_alignment());
}
void Arguments::set_ergonomics_flags() {
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
+#include "code/codeCache.hpp"
#include "code/debugInfoRec.hpp"
#include "code/nmethod.hpp"
#include "code/pcDesc.hpp"
@@ -50,44 +51,6 @@
#include "runtime/vframe_hp.hpp"
#include "utilities/events.hpp"
#include "utilities/xmlstream.hpp"
-#ifdef TARGET_ARCH_x86
-# include "vmreg_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vmreg_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vmreg_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vmreg_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vmreg_ppc.inline.hpp"
-#endif
-#ifdef COMPILER2
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/ad_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/ad_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/ad_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/ad_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/ad_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/ad_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/ad_ppc_64.hpp"
-#endif
-#endif // COMPILER2
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
--- a/hotspot/src/share/vm/runtime/dtraceJSDT.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/dtraceJSDT.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "classfile/javaClasses.hpp"
#include "code/codeBlob.hpp"
+#include "code/nativeInst.hpp"
#include "memory/allocation.hpp"
#include "prims/jvm.h"
#include "runtime/dtraceJSDT.hpp"
--- a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,21 +26,6 @@
#define SHARE_VM_RUNTIME_DTRACEJSDT_HPP
#include "code/nmethod.hpp"
-#ifdef TARGET_ARCH_x86
-# include "nativeInst_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "nativeInst_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "nativeInst_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "nativeInst_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "nativeInst_ppc.hpp"
-#endif
class RegisteredProbes;
typedef jlong OpaqueProbes;
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "classfile/classLoader.hpp"
+#include "code/codeCache.hpp"
#include "code/vtableStubs.hpp"
#include "gc_interface/collectedHeap.inline.hpp"
#include "interpreter/interpreter.hpp"
--- a/hotspot/src/share/vm/runtime/frame.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/frame.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -23,6 +23,8 @@
*/
#include "precompiled.hpp"
+#include "code/codeCache.hpp"
+#include "code/vmreg.inline.hpp"
#include "compiler/abstractCompiler.hpp"
#include "compiler/disassembler.hpp"
#include "gc_interface/collectedHeap.inline.hpp"
@@ -48,21 +50,6 @@
#include "runtime/thread.inline.hpp"
#include "utilities/decoder.hpp"
-#ifdef TARGET_ARCH_x86
-# include "nativeInst_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "nativeInst_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "nativeInst_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "nativeInst_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "nativeInst_ppc.hpp"
-#endif
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
@@ -412,91 +399,32 @@
*interpreter_frame_method_addr() = method;
}
-void frame::interpreter_frame_set_bcx(intptr_t bcx) {
- assert(is_interpreted_frame(), "Not an interpreted frame");
- if (ProfileInterpreter) {
- bool formerly_bci = is_bci(interpreter_frame_bcx());
- bool is_now_bci = is_bci(bcx);
- *interpreter_frame_bcx_addr() = bcx;
-
- intptr_t mdx = interpreter_frame_mdx();
-
- if (mdx != 0) {
- if (formerly_bci) {
- if (!is_now_bci) {
- // The bcx was just converted from bci to bcp.
- // Convert the mdx in parallel.
- MethodData* mdo = interpreter_frame_method()->method_data();
- assert(mdo != NULL, "");
- int mdi = mdx - 1; // We distinguish valid mdi from zero by adding one.
- address mdp = mdo->di_to_dp(mdi);
- interpreter_frame_set_mdx((intptr_t)mdp);
- }
- } else {
- if (is_now_bci) {
- // The bcx was just converted from bcp to bci.
- // Convert the mdx in parallel.
- MethodData* mdo = interpreter_frame_method()->method_data();
- assert(mdo != NULL, "");
- int mdi = mdo->dp_to_di((address)mdx);
- interpreter_frame_set_mdx((intptr_t)mdi + 1); // distinguish valid from 0.
- }
- }
- }
- } else {
- *interpreter_frame_bcx_addr() = bcx;
- }
-}
-
jint frame::interpreter_frame_bci() const {
assert(is_interpreted_frame(), "interpreted frame expected");
- intptr_t bcx = interpreter_frame_bcx();
- return is_bci(bcx) ? bcx : interpreter_frame_method()->bci_from((address)bcx);
-}
-
-void frame::interpreter_frame_set_bci(jint bci) {
- assert(is_interpreted_frame(), "interpreted frame expected");
- assert(!is_bci(interpreter_frame_bcx()), "should not set bci during GC");
- interpreter_frame_set_bcx((intptr_t)interpreter_frame_method()->bcp_from(bci));
+ address bcp = interpreter_frame_bcp();
+ return interpreter_frame_method()->bci_from(bcp);
}
address frame::interpreter_frame_bcp() const {
assert(is_interpreted_frame(), "interpreted frame expected");
- intptr_t bcx = interpreter_frame_bcx();
- return is_bci(bcx) ? interpreter_frame_method()->bcp_from(bcx) : (address)bcx;
+ return (address)*interpreter_frame_bcp_addr();
}
void frame::interpreter_frame_set_bcp(address bcp) {
assert(is_interpreted_frame(), "interpreted frame expected");
- assert(!is_bci(interpreter_frame_bcx()), "should not set bcp during GC");
- interpreter_frame_set_bcx((intptr_t)bcp);
-}
-
-void frame::interpreter_frame_set_mdx(intptr_t mdx) {
- assert(is_interpreted_frame(), "Not an interpreted frame");
- assert(ProfileInterpreter, "must be profiling interpreter");
- *interpreter_frame_mdx_addr() = mdx;
+ *interpreter_frame_bcp_addr() = (intptr_t)bcp;
}
address frame::interpreter_frame_mdp() const {
assert(ProfileInterpreter, "must be profiling interpreter");
assert(is_interpreted_frame(), "interpreted frame expected");
- intptr_t bcx = interpreter_frame_bcx();
- intptr_t mdx = interpreter_frame_mdx();
-
- assert(!is_bci(bcx), "should not access mdp during GC");
- return (address)mdx;
+ return (address)*interpreter_frame_mdp_addr();
}
void frame::interpreter_frame_set_mdp(address mdp) {
assert(is_interpreted_frame(), "interpreted frame expected");
- if (mdp == NULL) {
- // Always allow the mdp to be cleared.
- interpreter_frame_set_mdx((intptr_t)mdp);
- }
- intptr_t bcx = interpreter_frame_bcx();
- assert(!is_bci(bcx), "should not set mdp during GC");
- interpreter_frame_set_mdx((intptr_t)mdp);
+ assert(ProfileInterpreter, "must be profiling interpreter");
+ *interpreter_frame_mdp_addr() = (intptr_t)mdp;
}
BasicObjectLock* frame::next_monitor_in_interpreter_frame(BasicObjectLock* current) const {
@@ -1182,24 +1110,6 @@
}
}
-void frame::gc_prologue() {
- if (is_interpreted_frame()) {
- // set bcx to bci to become Method* position independent during GC
- interpreter_frame_set_bcx(interpreter_frame_bci());
- }
-}
-
-
-void frame::gc_epilogue() {
- if (is_interpreted_frame()) {
- // set bcx back to bcp for interpreter
- interpreter_frame_set_bcx((intptr_t)interpreter_frame_bcp());
- }
- // call processor specific epilog function
- pd_gc_epilog();
-}
-
-
# ifdef ENABLE_ZAP_DEAD_LOCALS
void frame::CheckValueClosure::do_oop(oop* p) {
--- a/hotspot/src/share/vm/runtime/frame.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/frame.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -30,29 +30,6 @@
#include "runtime/monitorChunk.hpp"
#include "runtime/registerMap.hpp"
#include "utilities/top.hpp"
-#ifdef COMPILER2
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/adGlobals_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/adGlobals_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/adGlobals_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/adGlobals_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/adGlobals_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/adGlobals_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/adGlobals_ppc_64.hpp"
-#endif
-#endif // COMPILER2
#ifdef ZERO
#ifdef TARGET_ARCH_zero
# include "stack_zero.hpp"
@@ -241,8 +218,8 @@
private:
intptr_t** interpreter_frame_locals_addr() const;
- intptr_t* interpreter_frame_bcx_addr() const;
- intptr_t* interpreter_frame_mdx_addr() const;
+ intptr_t* interpreter_frame_bcp_addr() const;
+ intptr_t* interpreter_frame_mdp_addr() const;
public:
// Locals
@@ -252,23 +229,13 @@
void interpreter_frame_set_locals(intptr_t* locs);
- // byte code index/pointer (use these functions for unchecked frame access only!)
- intptr_t interpreter_frame_bcx() const { return *interpreter_frame_bcx_addr(); }
- void interpreter_frame_set_bcx(intptr_t bcx);
-
// byte code index
jint interpreter_frame_bci() const;
- void interpreter_frame_set_bci(jint bci);
// byte code pointer
address interpreter_frame_bcp() const;
void interpreter_frame_set_bcp(address bcp);
- // Unchecked access to the method data index/pointer.
- // Only use this if you know what you are doing.
- intptr_t interpreter_frame_mdx() const { return *interpreter_frame_mdx_addr(); }
- void interpreter_frame_set_mdx(intptr_t mdx);
-
// method data pointer
address interpreter_frame_mdp() const;
void interpreter_frame_set_mdp(address dp);
@@ -437,10 +404,6 @@
// RedefineClasses support for finding live interpreted methods on the stack
void metadata_do(void f(Metadata*));
- void gc_prologue();
- void gc_epilogue();
- void pd_gc_epilog();
-
# ifdef ENABLE_ZAP_DEAD_LOCALS
private:
class CheckValueClosure: public OopClosure {
@@ -477,7 +440,6 @@
// Verification
void verify(const RegisterMap* map);
static bool verify_return_pc(address x);
- static bool is_bci(intptr_t bcx);
// Usage:
// assert(frame::verify_return_pc(return_address), "must be a return pc");
--- a/hotspot/src/share/vm/runtime/frame.inline.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/frame.inline.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -31,21 +31,6 @@
#include "oops/method.hpp"
#include "runtime/frame.hpp"
#include "runtime/signature.hpp"
-#ifdef TARGET_ARCH_x86
-# include "jniTypes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "jniTypes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "jniTypes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "jniTypes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "jniTypes_ppc.hpp"
-#endif
#ifdef ZERO
#ifdef TARGET_ARCH_zero
# include "entryFrame_zero.hpp"
@@ -55,26 +40,6 @@
#endif
#endif
-// This file holds platform-independent bodies of inline functions for frames.
-
-// Note: The bcx usually contains the bcp; however during GC it contains the bci
-// (changed by gc_prologue() and gc_epilogue()) to be Method* position
-// independent. These accessors make sure the correct value is returned
-// by testing the range of the bcx value. bcp's are guaranteed to be above
-// max_method_code_size, since methods are always allocated in OldSpace and
-// Eden is allocated before OldSpace.
-//
-// The bcp is accessed sometimes during GC for ArgumentDescriptors; than
-// the correct translation has to be performed (was bug).
-
-inline bool frame::is_bci(intptr_t bcx) {
-#ifdef _LP64
- return ((uintptr_t) bcx) <= ((uintptr_t) max_method_code_size) ;
-#else
- return 0 <= bcx && bcx <= max_method_code_size;
-#endif
-}
-
inline bool frame::is_entry_frame() const {
return StubRoutines::returns_to_call_stub(pc());
}
--- a/hotspot/src/share/vm/runtime/java.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/java.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -65,21 +65,6 @@
#include "utilities/histogram.hpp"
#include "utilities/macros.hpp"
#include "utilities/vmError.hpp"
-#ifdef TARGET_ARCH_x86
-# include "vm_version_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vm_version_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vm_version_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vm_version_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vm_version_ppc.hpp"
-#endif
#if INCLUDE_ALL_GCS
#include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
--- a/hotspot/src/share/vm/runtime/os.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/os.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -27,6 +27,7 @@
#include "classfile/javaClasses.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
+#include "code/codeCache.hpp"
#include "code/icBuffer.hpp"
#include "code/vtableStubs.hpp"
#include "gc_implementation/shared/vmGCOperations.hpp"
@@ -49,6 +50,7 @@
#include "runtime/os.inline.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
+#include "runtime/vm_version.hpp"
#include "services/attachListener.hpp"
#include "services/memTracker.hpp"
#include "services/threadService.hpp"
--- a/hotspot/src/share/vm/runtime/registerMap.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/registerMap.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -27,21 +27,6 @@
#include "code/vmreg.hpp"
#include "utilities/globalDefinitions.hpp"
-#ifdef TARGET_ARCH_x86
-# include "register_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "register_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "register_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "register_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "register_ppc.hpp"
-#endif
class JavaThread;
--- a/hotspot/src/share/vm/runtime/relocator.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/relocator.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,21 +27,7 @@
#include "interpreter/bytecodes.hpp"
#include "oops/method.hpp"
-#ifdef TARGET_ARCH_x86
-# include "bytes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytes_ppc.hpp"
-#endif
+#include "utilities/bytes.hpp"
// This code has been converted from the 1.1E java virtual machine
// Thanks to the JavaTopics group for using the code
--- a/hotspot/src/share/vm/runtime/rframe.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/rframe.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "code/codeCache.hpp"
#include "interpreter/interpreter.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
--- a/hotspot/src/share/vm/runtime/safepoint.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -56,26 +56,6 @@
#include "services/runtimeService.hpp"
#include "utilities/events.hpp"
#include "utilities/macros.hpp"
-#ifdef TARGET_ARCH_x86
-# include "nativeInst_x86.hpp"
-# include "vmreg_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "nativeInst_sparc.hpp"
-# include "vmreg_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "nativeInst_zero.hpp"
-# include "vmreg_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "nativeInst_arm.hpp"
-# include "vmreg_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "nativeInst_ppc.hpp"
-# include "vmreg_ppc.inline.hpp"
-#endif
#if INCLUDE_ALL_GCS
#include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
#include "gc_implementation/shared/suspendibleThreadSet.hpp"
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
+#include "code/codeCache.hpp"
#include "code/compiledIC.hpp"
#include "code/scopeDesc.hpp"
#include "code/vtableStubs.hpp"
@@ -59,26 +60,6 @@
#include "utilities/hashtable.inline.hpp"
#include "utilities/macros.hpp"
#include "utilities/xmlstream.hpp"
-#ifdef TARGET_ARCH_x86
-# include "nativeInst_x86.hpp"
-# include "vmreg_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "nativeInst_sparc.hpp"
-# include "vmreg_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "nativeInst_zero.hpp"
-# include "vmreg_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "nativeInst_arm.hpp"
-# include "vmreg_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "nativeInst_ppc.hpp"
-# include "vmreg_ppc.inline.hpp"
-#endif
#ifdef COMPILER1
#include "c1/c1_Runtime1.hpp"
#endif
--- a/hotspot/src/share/vm/runtime/stackValueCollection.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -24,21 +24,6 @@
#include "precompiled.hpp"
#include "runtime/stackValueCollection.hpp"
-#ifdef TARGET_ARCH_x86
-# include "jniTypes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "jniTypes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "jniTypes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "jniTypes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "jniTypes_ppc.hpp"
-#endif
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
--- a/hotspot/src/share/vm/runtime/statSampler.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/statSampler.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -33,21 +33,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/os.hpp"
#include "runtime/statSampler.hpp"
-#ifdef TARGET_ARCH_x86
-# include "vm_version_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vm_version_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vm_version_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vm_version_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vm_version_ppc.hpp"
-#endif
+#include "runtime/vm_version.hpp"
// --------------------------------------------------------
// StatSamplerTask
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -31,21 +31,6 @@
#include "runtime/mutexLocker.hpp"
#include "runtime/stubCodeGenerator.hpp"
#include "utilities/top.hpp"
-#ifdef TARGET_ARCH_x86
-# include "nativeInst_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "nativeInst_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "nativeInst_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "nativeInst_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "nativeInst_ppc.hpp"
-#endif
// StubRoutines provides entry points to assembly routines used by
// compiled code and the run-time system. Platform-specific entry
--- a/hotspot/src/share/vm/runtime/thread.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -27,6 +27,7 @@
#include "classfile/javaClasses.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
+#include "code/codeCache.hpp"
#include "code/scopeDesc.hpp"
#include "compiler/compileBroker.hpp"
#include "interpreter/interpreter.hpp"
@@ -74,6 +75,7 @@
#include "runtime/vframe_hp.hpp"
#include "runtime/vmThread.hpp"
#include "runtime/vm_operations.hpp"
+#include "runtime/vm_version.hpp"
#include "services/attachListener.hpp"
#include "services/management.hpp"
#include "services/memTracker.hpp"
@@ -2647,20 +2649,6 @@
}
-// GC support
-static void frame_gc_epilogue(frame* f, const RegisterMap* map) { f->gc_epilogue(); }
-
-void JavaThread::gc_epilogue() {
- frames_do(frame_gc_epilogue);
-}
-
-
-static void frame_gc_prologue(frame* f, const RegisterMap* map) { f->gc_prologue(); }
-
-void JavaThread::gc_prologue() {
- frames_do(frame_gc_prologue);
-}
-
// If the caller is a NamedThread, then remember, in the current scope,
// the given JavaThread in its _processed_thread field.
class RememberProcessedThread: public StackObj {
@@ -4149,18 +4137,6 @@
}
}
-void Threads::gc_epilogue() {
- ALL_JAVA_THREADS(p) {
- p->gc_epilogue();
- }
-}
-
-void Threads::gc_prologue() {
- ALL_JAVA_THREADS(p) {
- p->gc_prologue();
- }
-}
-
void Threads::deoptimized_wrt_marked_nmethods() {
ALL_JAVA_THREADS(p) {
p->deoptimized_wrt_marked_nmethods();
--- a/hotspot/src/share/vm/runtime/thread.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/thread.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1416,10 +1416,6 @@
// RedefineClasses Support
void metadata_do(void f(Metadata*));
- // Memory management operations
- void gc_epilogue();
- void gc_prologue();
-
// Misc. operations
char* name() const { return (char*)get_thread_name(); }
void print_on(outputStream* st) const;
@@ -1899,8 +1895,6 @@
// RedefineClasses support
static void metadata_do(void f(Metadata*));
- static void gc_epilogue();
- static void gc_prologue();
#ifdef ASSERT
static bool is_vm_complete() { return _vm_complete; }
#endif
--- a/hotspot/src/share/vm/runtime/vframe.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vframe.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -511,8 +511,8 @@
inline void vframeStreamCommon::fill_from_interpreter_frame() {
Method* method = _frame.interpreter_frame_method();
- intptr_t bcx = _frame.interpreter_frame_bcx();
- int bci = method->validate_bci_from_bcx(bcx);
+ address bcp = _frame.interpreter_frame_bcp();
+ int bci = method->validate_bci_from_bcp(bcp);
// 6379830 AsyncGetCallTrace sometimes feeds us wild frames.
if (bci < 0) {
found_bad_method_frame();
--- a/hotspot/src/share/vm/runtime/vframeArray.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vframeArray.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "classfile/vmSymbols.hpp"
+#include "code/vmreg.inline.hpp"
#include "interpreter/bytecode.hpp"
#include "interpreter/interpreter.hpp"
#include "memory/allocation.inline.hpp"
@@ -296,9 +297,9 @@
src->lock()->move_to(src->obj(), top->lock());
}
if (ProfileInterpreter) {
- iframe()->interpreter_frame_set_mdx(0); // clear out the mdp.
+ iframe()->interpreter_frame_set_mdp(0); // clear out the mdp.
}
- iframe()->interpreter_frame_set_bcx((intptr_t)bcp); // cannot use bcp because frame is not initialized yet
+ iframe()->interpreter_frame_set_bcp(bcp);
if (ProfileInterpreter) {
MethodData* mdo = method()->method_data();
if (mdo != NULL) {
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -193,33 +193,13 @@
#include "opto/movenode.hpp"
#include "opto/narrowptrnode.hpp"
#include "opto/opaquenode.hpp"
+#include "opto/optoreg.hpp"
#include "opto/phaseX.hpp"
#include "opto/parse.hpp"
#include "opto/regalloc.hpp"
#include "opto/rootnode.hpp"
#include "opto/subnode.hpp"
#include "opto/vectornode.hpp"
-#ifdef TARGET_ARCH_MODEL_x86_32
-# include "adfiles/adGlobals_x86_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_x86_64
-# include "adfiles/adGlobals_x86_64.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_sparc
-# include "adfiles/adGlobals_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_zero
-# include "adfiles/adGlobals_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_arm
-# include "adfiles/adGlobals_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_32
-# include "adfiles/adGlobals_ppc_32.hpp"
-#endif
-#ifdef TARGET_ARCH_MODEL_ppc_64
-# include "adfiles/adGlobals_ppc_64.hpp"
-#endif
#endif // COMPILER2
// Note: the cross-product of (c1, c2, product, nonproduct, ...),
--- a/hotspot/src/share/vm/runtime/vm_operations.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/vmSymbols.hpp"
+#include "code/codeCache.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/compilerOracle.hpp"
#include "gc_implementation/shared/isGCActiveMark.hpp"
--- a/hotspot/src/share/vm/runtime/vm_version.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -26,21 +26,7 @@
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/arguments.hpp"
-#ifdef TARGET_ARCH_x86
-# include "vm_version_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vm_version_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vm_version_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vm_version_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vm_version_ppc.hpp"
-#endif
+#include "runtime/vm_version.hpp"
const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release();
const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string();
--- a/hotspot/src/share/vm/runtime/vm_version.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vm_version.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -128,4 +128,20 @@
static unsigned int calc_parallel_worker_threads();
};
+#ifdef TARGET_ARCH_x86
+# include "vm_version_x86.hpp"
+#endif
+#ifdef TARGET_ARCH_sparc
+# include "vm_version_sparc.hpp"
+#endif
+#ifdef TARGET_ARCH_zero
+# include "vm_version_zero.hpp"
+#endif
+#ifdef TARGET_ARCH_arm
+# include "vm_version_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "vm_version_ppc.hpp"
+#endif
+
#endif // SHARE_VM_RUNTIME_VM_VERSION_HPP
--- a/hotspot/src/share/vm/services/diagnosticCommand.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/services/diagnosticCommand.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -25,17 +25,16 @@
#ifndef SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP
#define SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP
+#include "classfile/vmSymbols.hpp"
#include "runtime/arguments.hpp"
-#include "classfile/vmSymbols.hpp"
-#include "utilities/ostream.hpp"
-#include "runtime/vm_version.hpp"
+#include "runtime/os.hpp"
#include "runtime/vmThread.hpp"
-#include "runtime/os.hpp"
#include "services/diagnosticArgument.hpp"
#include "services/diagnosticCommand.hpp"
+#include "services/diagnosticCommand_ext.hpp"
#include "services/diagnosticFramework.hpp"
-#include "services/diagnosticCommand_ext.hpp"
#include "utilities/macros.hpp"
+#include "utilities/ostream.hpp"
class HelpDCmd : public DCmdWithParser {
protected:
--- a/hotspot/src/share/vm/services/diagnosticFramework.hpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/services/diagnosticFramework.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -29,7 +29,6 @@
#include "memory/allocation.hpp"
#include "runtime/arguments.hpp"
#include "runtime/os.hpp"
-#include "runtime/vm_version.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/ostream.hpp"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/utilities/bytes.hpp Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_UTILITIES_BYTES_HPP
+#define SHARE_VM_UTILITIES_BYTES_HPP
+
+#ifdef TARGET_ARCH_x86
+# include "bytes_x86.hpp"
+#endif
+#ifdef TARGET_ARCH_sparc
+# include "bytes_sparc.hpp"
+#endif
+#ifdef TARGET_ARCH_zero
+# include "bytes_zero.hpp"
+#endif
+#ifdef TARGET_ARCH_arm
+# include "bytes_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "bytes_ppc.hpp"
+#endif
+
+#endif // SHARE_VM_UTILITIES_BYTES_HPP
--- a/hotspot/src/share/vm/utilities/debug.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/utilities/debug.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -48,6 +48,7 @@
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/vframe.hpp"
+#include "runtime/vm_version.hpp"
#include "services/heapDumper.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/events.hpp"
--- a/hotspot/src/share/vm/utilities/ostream.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/utilities/ostream.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -28,6 +28,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/arguments.hpp"
#include "runtime/os.hpp"
+#include "runtime/vm_version.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/ostream.hpp"
#include "utilities/top.hpp"
--- a/hotspot/src/share/vm/utilities/vmError.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/hotspot/src/share/vm/utilities/vmError.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "code/codeCache.hpp"
#include "compiler/compileBroker.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "prims/whitebox.hpp"
--- a/jaxp/.hgtags Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/.hgtags Fri Jul 25 09:44:53 2014 +0000
@@ -265,3 +265,4 @@
94fd4d9d3a75819644b21e18c8a567fd0e973eaf jdk9-b20
7eb0ab676ea75cb1dd31c613e77008a7d8cb0af7 jdk9-b21
82b94ff002c6e007a03bf0f364ca94b381e09135 jdk9-b22
+2e5b63006187bfc64d8eace374dbc2806267a160 jdk9-b23
--- a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java Fri Jul 25 09:44:53 2014 +0000
@@ -90,6 +90,13 @@
*/
public static final String JDK_XML_NAME_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit";
+
+ /**
+ * JDK maxElementDepth limit
+ */
+ public static final String JDK_MAX_ELEMENT_DEPTH =
+ ORACLE_JAXP_PROPERTY_PREFIX + "maxElementDepth";
+
/**
* JDK property indicating whether the parser shall print out entity
* count information
@@ -138,6 +145,11 @@
*/
public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit";
+ /**
+ * JDK maxElementDepth limit
+ */
+ public static final String SP_MAX_ELEMENT_DEPTH = "jdk.xml.maxElementDepth";
+
//legacy System Properties
public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/ObjectFactory.java Fri Jul 25 09:44:53 2014 +0000
@@ -38,8 +38,8 @@
//
// Constants
//
- private static final String XALAN_INTERNAL = "com.sun.org.apache.xalan.internal";
- private static final String XERCES_INTERNAL = "com.sun.org.apache.xerces.internal";
+ private static final String JAXP_INTERNAL = "com.sun.org.apache";
+ private static final String STAX_INTERNAL = "com.sun.xml.internal";
/** Set to true for debugging */
private static final boolean DEBUG = false;
@@ -160,12 +160,8 @@
public static Class<?> findProviderClass(String className, boolean doFallback)
throws ClassNotFoundException, ConfigurationError
{
- if (System.getSecurityManager()!=null) {
- return Class.forName(className);
- } else {
- return findProviderClass (className,
+ return findProviderClass (className,
findClassLoader (), doFallback);
- }
}
/**
@@ -180,8 +176,8 @@
SecurityManager security = System.getSecurityManager();
try{
if (security != null){
- if (className.startsWith(XALAN_INTERNAL) ||
- className.startsWith(XERCES_INTERNAL)) {
+ if (className.startsWith(JAXP_INTERNAL) ||
+ className.startsWith(STAX_INTERNAL)) {
cl = null;
} else {
final int lastDot = className.lastIndexOf(".");
@@ -196,16 +192,7 @@
Class<?> providerClass;
if (cl == null) {
- // XXX Use the bootstrap ClassLoader. There is no way to
- // load a class using the bootstrap ClassLoader that works
- // in both JDK 1.1 and Java 2. However, this should still
- // work b/c the following should be true:
- //
- // (cl == null) iff current ClassLoader == null
- //
- // Thus Class.forName(String) will use the current
- // ClassLoader which will be the bootstrap ClassLoader.
- providerClass = Class.forName(className);
+ providerClass = Class.forName(className, false, ObjectFactory.class.getClassLoader());
} else {
try {
providerClass = cl.loadClass(className);
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java Fri Jul 25 09:44:53 2014 +0000
@@ -76,7 +76,9 @@
GENERAL_ENTITY_SIZE_LIMIT(XalanConstants.JDK_GENERAL_ENTITY_SIZE_LIMIT,
XalanConstants.SP_GENERAL_ENTITY_SIZE_LIMIT, 0, 0),
PARAMETER_ENTITY_SIZE_LIMIT(XalanConstants.JDK_PARAMETER_ENTITY_SIZE_LIMIT,
- XalanConstants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000);
+ XalanConstants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000),
+ MAX_ELEMENT_DEPTH_LIMIT(XalanConstants.JDK_MAX_ELEMENT_DEPTH,
+ XalanConstants.SP_MAX_ELEMENT_DEPTH, 0, 0);
final String apiProperty;
final String systemProperty;
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java Fri Jul 25 09:44:53 2014 +0000
@@ -251,6 +251,13 @@
*/
public static final String JDK_XML_NAME_LIMIT =
ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit";
+
+ /**
+ * JDK maxElementDepth limit
+ */
+ public static final String JDK_MAX_ELEMENT_DEPTH =
+ ORACLE_JAXP_PROPERTY_PREFIX + "maxElementDepth";
+
/**
* JDK property to allow printing out information from the limit analyzer
*/
@@ -296,6 +303,11 @@
*/
public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit";
+ /**
+ * JDK maxElementDepth limit
+ */
+ public static final String SP_MAX_ELEMENT_DEPTH = "jdk.xml.maxElementDepth";
+
//legacy System Properties
public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -1308,6 +1308,7 @@
fAttributes.removeAllAttributes();
+ checkDepth(rawname);
if(!seekCloseOfStartTag()){
fReadingAttributes = true;
fAttributeCacheUsedCount =0;
@@ -1912,6 +1913,21 @@
// utility methods
/**
+ * Check if the depth exceeds the maxElementDepth limit
+ * @param elementName name of the current element
+ */
+ void checkDepth(String elementName) {
+ fLimitAnalyzer.addValue(Limit.MAX_ELEMENT_DEPTH_LIMIT, elementName, fElementStack.fDepth);
+ if (fSecurityManager.isOverLimit(Limit.MAX_ELEMENT_DEPTH_LIMIT,fLimitAnalyzer)) {
+ fSecurityManager.debugPrint(fLimitAnalyzer);
+ reportFatalError("MaxElementDepthLimit", new Object[]{elementName,
+ fLimitAnalyzer.getTotalValue(Limit.MAX_ELEMENT_DEPTH_LIMIT),
+ fSecurityManager.getLimit(Limit.MAX_ELEMENT_DEPTH_LIMIT),
+ "maxElementDepth"});
+ }
+ }
+
+ /**
* Calls document handler with a single character resulting from
* built-in entity resolution.
*
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -219,6 +219,7 @@
fCurrentElement = fElementQName;
String rawname = fElementQName.rawname;
+ checkDepth(rawname);
if (fBindNamespaces) {
fNamespaceContext.pushContext();
if (fScannerState == SCANNER_STATE_ROOT_ELEMENT) {
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties Fri Jul 25 09:44:53 2014 +0000
@@ -299,4 +299,5 @@
MaxEntitySizeLimit=JAXP00010003: The length of entity \"{0}\" is \"{1}\" that exceeds the \"{2}\" limit set by \"{3}\".
TotalEntitySizeLimit=JAXP00010004: The accumulated size \"{0}\" of entities exceeded the \"{1}\" limit set by \"{2}\".
MaxXMLNameLimit=JAXP00010005: The name \"{0}\" exceeded the \"{1}\" limit set by \"{2}\".
+ MaxElementDepthLimit=JAXP00010006: The element \"{0}\" has a depth of \"{1}\" that exceeds the limit \"{2}\" set by \"{3}\".
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java Fri Jul 25 09:44:53 2014 +0000
@@ -452,7 +452,8 @@
}
private void propagateFeatures(AbstractXMLSchema schema) {
- schema.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, fSecurityManager != null);
+ schema.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
+ (fSecurityManager != null && fSecurityManager.isSecureProcessing()));
schema.setFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM, fUseServicesMechanism);
String[] features = fXMLSchemaLoader.getRecognizedFeatures();
for (int i = 0; i < features.length; ++i) {
--- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/ObjectFactory.java Fri Jul 25 09:44:53 2014 +0000
@@ -38,7 +38,8 @@
//
// Constants
//
- private static final String DEFAULT_INTERNAL_CLASSES = "com.sun.org.apache.";
+ private static final String JAXP_INTERNAL = "com.sun.org.apache";
+ private static final String STAX_INTERNAL = "com.sun.xml.internal";
/** Set to true for debugging */
private static final boolean DEBUG = isDebugEnabled();
@@ -174,12 +175,8 @@
public static Class findProviderClass(String className, boolean doFallback)
throws ClassNotFoundException, ConfigurationError
{
- if (System.getSecurityManager()!=null) {
- return Class.forName(className);
- } else {
- return findProviderClass (className,
+ return findProviderClass (className,
findClassLoader (), doFallback);
- }
}
/**
* Find a Class using the specified ClassLoader
@@ -192,7 +189,8 @@
//restrict the access to package as speicified in java.security policy
SecurityManager security = System.getSecurityManager();
if (security != null) {
- if (className.startsWith(DEFAULT_INTERNAL_CLASSES)) {
+ if (className.startsWith(JAXP_INTERNAL) ||
+ className.startsWith(STAX_INTERNAL)) {
cl = null;
} else {
final int lastDot = className.lastIndexOf(".");
@@ -204,7 +202,7 @@
Class providerClass;
if (cl == null) {
//use the bootstrap ClassLoader.
- providerClass = Class.forName(className);
+ providerClass = Class.forName(className, false, ObjectFactory.class.getClassLoader());
} else {
try {
providerClass = cl.loadClass(className);
--- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java Fri Jul 25 09:44:53 2014 +0000
@@ -132,6 +132,10 @@
totalValue[index] += value;
return;
}
+ if (index == Limit.MAX_ELEMENT_DEPTH_LIMIT.ordinal()) {
+ totalValue[index] = value;
+ return;
+ }
Map<String, Integer> cache;
if (caches[index] == null) {
--- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java Fri Jul 25 09:44:53 2014 +0000
@@ -66,7 +66,8 @@
ELEMENT_ATTRIBUTE_LIMIT(Constants.JDK_ELEMENT_ATTRIBUTE_LIMIT, Constants.SP_ELEMENT_ATTRIBUTE_LIMIT, 0, 10000),
TOTAL_ENTITY_SIZE_LIMIT(Constants.JDK_TOTAL_ENTITY_SIZE_LIMIT, Constants.SP_TOTAL_ENTITY_SIZE_LIMIT, 0, 50000000),
GENERAL_ENTITY_SIZE_LIMIT(Constants.JDK_GENERAL_ENTITY_SIZE_LIMIT, Constants.SP_GENERAL_ENTITY_SIZE_LIMIT, 0, 0),
- PARAMETER_ENTITY_SIZE_LIMIT(Constants.JDK_PARAMETER_ENTITY_SIZE_LIMIT, Constants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000);
+ PARAMETER_ENTITY_SIZE_LIMIT(Constants.JDK_PARAMETER_ENTITY_SIZE_LIMIT, Constants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000),
+ MAX_ELEMENT_DEPTH_LIMIT(Constants.JDK_MAX_ELEMENT_DEPTH, Constants.SP_MAX_ELEMENT_DEPTH, 0, 0);
final String apiProperty;
final String systemProperty;
@@ -429,9 +430,10 @@
return false;
}
- if (index==Limit.ELEMENT_ATTRIBUTE_LIMIT.ordinal() ||
- index==Limit.ENTITY_EXPANSION_LIMIT.ordinal() ||
- index==Limit.TOTAL_ENTITY_SIZE_LIMIT.ordinal()) {
+ if (index == Limit.ELEMENT_ATTRIBUTE_LIMIT.ordinal() ||
+ index == Limit.ENTITY_EXPANSION_LIMIT.ordinal() ||
+ index == Limit.TOTAL_ENTITY_SIZE_LIMIT.ordinal() ||
+ index == Limit.MAX_ELEMENT_DEPTH_LIMIT.ordinal()) {
return (limitAnalyzer.getTotalValue(index) > values[index]);
} else {
return (limitAnalyzer.getValue(index) > values[index]);
--- a/jaxws/.hgtags Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxws/.hgtags Fri Jul 25 09:44:53 2014 +0000
@@ -268,3 +268,4 @@
6a9f8ff45c04a172df446a418c586da6a86564d5 jdk9-b20
4a099451fd7e17b6cc4772fe9547907576a45b6f jdk9-b21
7f5e5902cde75fd9335c52f469491f061fe0239e jdk9-b22
+ce19e0403ec8a80223cc47320c905b2a4d45881d jdk9-b23
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,22 +40,32 @@
* Utils class.
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,22 +40,32 @@
* Utils class.
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,22 +40,32 @@
* Utils class.
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,22 +40,32 @@
* Utils class.
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,22 +40,32 @@
* Utils class.
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,22 +40,32 @@
* Utils class.
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -41,22 +43,32 @@
*
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -41,22 +43,32 @@
*
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
--- a/jdk/.hgtags Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/.hgtags Fri Jul 25 09:44:53 2014 +0000
@@ -265,3 +265,4 @@
f87c5be90e01a7ffb47947108eb3e0b0b1920880 jdk9-b20
2df45ac1bf491278f38c12e0dfbeebadb6c54c8c jdk9-b21
85bcf0f99edc08873614afbe5a5563e13ce13c83 jdk9-b22
+9febf9dbc0a4b15323f2dbd29931cfbf086332b4 jdk9-b23
--- a/jdk/make/lib/Awt2dLibraries.gmk Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/make/lib/Awt2dLibraries.gmk Fri Jul 25 09:44:53 2014 +0000
@@ -1358,7 +1358,7 @@
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBAWT_LWAWT_FILES := \
- awt.m \
+ AWT_debug.m \
ApplicationDelegate.m \
CFRetainedResource.m \
CGLGraphicsConfig.m \
--- a/jdk/make/mapfiles/libsplashscreen/mapfile-vers Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/make/mapfiles/libsplashscreen/mapfile-vers Fri Jul 25 09:44:53 2014 +0000
@@ -35,6 +35,7 @@
Java_java_awt_SplashScreen__1getImageFileName;
Java_java_awt_SplashScreen__1getImageJarName;
Java_java_awt_SplashScreen__1setImageData;
+ Java_java_awt_SplashScreen__1getScaleFactor;
SplashLoadMemory;
SplashLoadFile;
--- a/jdk/make/mapfiles/libsunec/mapfile-vers Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/make/mapfiles/libsunec/mapfile-vers Fri Jul 25 09:44:53 2014 +0000
@@ -28,10 +28,9 @@
SUNWprivate_1.1 {
global:
Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair;
- Java_sun_security_ec_ECKeyPairGenerator_getEncodedBytes;
- Java_sun_security_ec_ECDSASignature_signDigest;
- Java_sun_security_ec_ECDSASignature_verifySignedDigest;
- Java_sun_security_ec_ECDHKeyAgreement_deriveKey;
+ Java_sun_security_ec_ECDSASignature_signDigest;
+ Java_sun_security_ec_ECDSASignature_verifySignedDigest;
+ Java_sun_security_ec_ECDHKeyAgreement_deriveKey;
local:
*;
};
--- a/jdk/make/profile-includes.txt Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/make/profile-includes.txt Fri Jul 25 09:44:53 2014 +0000
@@ -71,6 +71,7 @@
rt.jar \
security/US_export_policy.jar \
security/blacklist \
+ security/blacklisted.certs \
security/cacerts \
security/java.policy \
security/java.security \
--- a/jdk/src/macosx/bin/java_md_macosx.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/bin/java_md_macosx.c Fri Jul 25 09:44:53 2014 +0000
@@ -994,7 +994,7 @@
sameThread = JNI_TRUE;
// Set a variable that tells us we started on the main thread.
- // This is used by the AWT during startup. (See awt.m)
+ // This is used by the AWT during startup. (See LWCToolkit.m)
char envVar[80];
snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
setenv(envVar, "1", 1);
--- a/jdk/src/macosx/classes/com/apple/eawt/Application.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/classes/com/apple/eawt/Application.java Fri Jul 25 09:44:53 2014 +0000
@@ -58,15 +58,8 @@
static Application sApplication = null;
static {
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<Void>() {
- public Void run() {
- System.loadLibrary("awt");
- return null;
- }
- });
-
checkSecurity();
+ Toolkit.getDefaultToolkit(); // Start AppKit
if (!Beans.isDesignTime()) {
nativeInitializeApplicationDelegate();
}
--- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java Fri Jul 25 09:44:53 2014 +0000
@@ -121,10 +121,6 @@
public void show() {
final int startItemCount = comboBox.getItemCount();
- if (startItemCount == 0) {
- return;
- }
-
final Rectangle popupBounds = adjustPopupAndGetBounds();
if (popupBounds == null) return; // null means don't show
--- a/jdk/src/macosx/classes/com/apple/laf/AquaMenuBarUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaMenuBarUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -26,11 +26,14 @@
package com.apple.laf;
import java.awt.*;
+import java.security.AccessController;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicMenuBarUI;
+import sun.lwawt.macosx.LWCToolkit;
+import sun.security.action.GetBooleanAction;
import sun.security.action.GetPropertyAction;
// MenuBar implementation for Mac L&F
@@ -131,28 +134,20 @@
ScreenMenuBar fScreenMenuBar;
boolean useScreenMenuBar = getScreenMenuBarProperty();
- private static String getPrivSysProp(final String propName) {
- return java.security.AccessController.doPrivileged(new GetPropertyAction(propName));
- }
-
static boolean getScreenMenuBarProperty() {
- final String props[] = new String[]{""};
-
- boolean useScreenMenuBar = false;
- try {
- props[0] = getPrivSysProp(AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");
-
- if (props[0] != null && props[0].equals("true")) useScreenMenuBar = true;
- else {
- props[0] = getPrivSysProp(AquaLookAndFeel.sOldPropertyPrefix + "useScreenMenuBar");
-
- if (props[0] != null && props[0].equals("true")) {
- System.err.println(AquaLookAndFeel.sOldPropertyPrefix + "useScreenMenuBar has been deprecated. Please switch to " + AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");
- useScreenMenuBar = true;
- }
- }
- } catch(final Throwable t) { };
-
- return useScreenMenuBar;
+ // Do not allow AWT to set the screen menu bar if it's embedded in another UI toolkit
+ if (LWCToolkit.isEmbedded()) return false;
+ if (AccessController.doPrivileged(
+ new GetBooleanAction(AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar"))) {
+ return true;
+ }
+ if (AccessController.doPrivileged(
+ new GetBooleanAction(AquaLookAndFeel.sOldPropertyPrefix + "useScreenMenuBar"))) {
+ System.err.println(AquaLookAndFeel.sOldPropertyPrefix +
+ "useScreenMenuBar has been deprecated. Please switch to " +
+ AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");
+ return true;
+ }
+ return false;
}
}
--- a/jdk/src/macosx/classes/sun/awt/CGraphicsEnvironment.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/classes/sun/awt/CGraphicsEnvironment.java Fri Jul 25 09:44:53 2014 +0000
@@ -40,9 +40,6 @@
*/
public final class CGraphicsEnvironment extends SunGraphicsEnvironment {
- // Global initialization of the Cocoa runtime.
- private static native void initCocoa();
-
/**
* Fetch an array of all valid CoreGraphics display identifiers.
*/
@@ -60,21 +57,8 @@
public static void init() { }
static {
- java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
- public Void run() {
- System.loadLibrary("awt");
- return null;
- }
- });
-
- java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
- public Void run() {
- if (isHeadless()) return null;
- initCocoa();
- return null;
- }
- });
-
+ // Load libraries and initialize the Toolkit.
+ Toolkit.getDefaultToolkit();
// Install the correct surface manager factory.
SurfaceManagerFactory.setInstance(new MacosxSurfaceManagerFactory());
}
--- a/jdk/src/macosx/classes/sun/font/CFontConfiguration.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/classes/sun/font/CFontConfiguration.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -106,6 +106,6 @@
@Override
protected void initReorderMap() {
- reorderMap = new HashMap();
+ reorderMap = new HashMap<>();
}
}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Fri Jul 25 09:44:53 2014 +0000
@@ -44,6 +44,7 @@
import sun.awt.*;
import sun.awt.datatransfer.DataTransferer;
+import sun.awt.util.ThreadGroupUtils;
import sun.java2d.opengl.OGLRenderQueue;
import sun.lwawt.*;
import sun.lwawt.LWWindowPeer.PeerType;
@@ -70,7 +71,7 @@
private static final int BUTTONS = 5;
private static native void initIDs();
-
+ private static native void initAppkit(ThreadGroup appKitThreadGroup, boolean headless);
private static CInputMethodDescriptor sInputMethodDescriptor;
static {
@@ -119,6 +120,7 @@
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
+ initAppkit(ThreadGroupUtils.getRootThreadGroup(), GraphicsEnvironment.isHeadless());
}
/*
@@ -166,7 +168,7 @@
// This is only called from native code.
static void systemColorsChanged() {
EventQueue.invokeLater(() -> {
- AccessController.doPrivileged ((PrivilegedAction<Object>) () -> {
+ AccessController.doPrivileged( (PrivilegedAction<Object>) () -> {
AWTAccessor.getSystemColorAccessor().updateSystemColors();
return null;
});
@@ -790,6 +792,13 @@
*/
native boolean isApplicationActive();
+ /**
+ * Returns true if AWT toolkit is embedded, false otherwise.
+ *
+ * @return true if AWT toolkit is embedded, false otherwise
+ */
+ public static native boolean isEmbedded();
+
/************************
* Native methods section
************************/
--- a/jdk/src/macosx/native/sun/awt/CGraphicsEnv.m Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/CGraphicsEnv.m Fri Jul 25 09:44:53 2014 +0000
@@ -30,24 +30,6 @@
#import "AWT_debug.h"
-/*
- * Class: sun_awt_CGraphicsEnvironment
- * Method: initCocoa
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_CGraphicsEnvironment_initCocoa
-(JNIEnv *env, jclass self)
-{
-JNF_COCOA_ENTER(env);
-
- // Inform Cocoa that we're multi-threaded.
- // Creating a short-lived NSThread is the recommended way of doing so.
- [NSThread detachNewThreadSelector:@selector(self) toTarget:[NSObject class] withObject:nil];
-
-JNF_COCOA_EXIT(env);
-}
-
#define MAX_DISPLAYS 64
/*
--- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m Fri Jul 25 09:44:53 2014 +0000
@@ -24,7 +24,12 @@
*/
#import <dlfcn.h>
+#import <pthread.h>
+#import <objc/runtime.h>
+#import <Cocoa/Cocoa.h>
+#import <Security/AuthSession.h>
#import <JavaNativeFoundation/JavaNativeFoundation.h>
+#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
#include "jni_util.h"
#import "CMenuBar.h"
@@ -34,6 +39,8 @@
#import "AWT_debug.h"
#import "CSystemColors.h"
#import "NSApplicationAWT.h"
+#import "PropertiesUtilities.h"
+#import "ApplicationDelegate.h"
#import "sun_lwawt_macosx_LWCToolkit.h"
@@ -42,6 +49,20 @@
int gNumberOfButtons;
jint* gButtonDownMasks;
+// Indicates that the app has been started with -XstartOnFirstThread
+// (directly or via WebStart settings), and AWT should not run its
+// own event loop in this mode. Even if a loop isn't running yet,
+// we expect an embedder (e.g. SWT) to start it some time later.
+static BOOL forceEmbeddedMode = NO;
+
+// Indicates if awt toolkit is embedded into another UI toolkit
+static BOOL isEmbedded = NO;
+
+// This is the data necessary to have JNI_OnLoad wait for AppKit to start.
+static BOOL sAppKitStarted = NO;
+static pthread_mutex_t sAppKitStarted_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t sAppKitStarted_cv = PTHREAD_COND_INITIALIZER;
+
@implementation AWTToolkit
static long eventCount;
@@ -115,6 +136,232 @@
}
@end
+void setBusy(BOOL busy) {
+ AWT_ASSERT_APPKIT_THREAD;
+
+ JNIEnv *env = [ThreadUtilities getJNIEnv];
+ static JNF_CLASS_CACHE(jc_AWTAutoShutdown, "sun/awt/AWTAutoShutdown");
+
+ if (busy) {
+ static JNF_STATIC_MEMBER_CACHE(jm_notifyBusyMethod, jc_AWTAutoShutdown, "notifyToolkitThreadBusy", "()V");
+ JNFCallStaticVoidMethod(env, jm_notifyBusyMethod);
+ } else {
+ static JNF_STATIC_MEMBER_CACHE(jm_notifyFreeMethod, jc_AWTAutoShutdown, "notifyToolkitThreadFree", "()V");
+ JNFCallStaticVoidMethod(env, jm_notifyFreeMethod);
+ }
+}
+
+static void setUpAWTAppKit(BOOL installObservers)
+{
+ if (installObservers) {
+ AWT_STARTUP_LOG(@"Setting up busy observers");
+
+ // Add CFRunLoopObservers to call into AWT so that AWT knows that the
+ // AWT thread (which is the AppKit main thread) is alive. This way AWT
+ // will not automatically shutdown.
+ CFRunLoopObserverRef busyObserver = CFRunLoopObserverCreateWithHandler(
+ NULL, // CFAllocator
+ kCFRunLoopAfterWaiting, // CFOptionFlags
+ true, // repeats
+ NSIntegerMax, // order
+ ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
+ setBusy(YES);
+ });
+
+ CFRunLoopObserverRef notBusyObserver = CFRunLoopObserverCreateWithHandler(
+ NULL, // CFAllocator
+ kCFRunLoopBeforeWaiting, // CFOptionFlags
+ true, // repeats
+ NSIntegerMin, // order
+ ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
+ setBusy(NO);
+ });
+
+ CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
+ CFRunLoopAddObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
+ CFRunLoopAddObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode);
+
+ CFRelease(busyObserver);
+ CFRelease(notBusyObserver);
+
+ setBusy(YES);
+ }
+
+ JNIEnv* env = [ThreadUtilities getJNIEnv];
+ static JNF_CLASS_CACHE(jc_LWCToolkit, "sun/lwawt/macosx/LWCToolkit");
+ static JNF_STATIC_MEMBER_CACHE(jsm_installToolkitThreadInJava, jc_LWCToolkit, "installToolkitThreadInJava", "()V");
+ JNFCallStaticVoidMethod(env, jsm_installToolkitThreadInJava);
+}
+
+BOOL isSWTInWebStart(JNIEnv* env) {
+ NSString *swtWebStart = [PropertiesUtilities javaSystemPropertyForKey:@"com.apple.javaws.usingSWT" withEnv:env];
+ return [@"true" isCaseInsensitiveLike:swtWebStart];
+}
+
+static void AWT_NSUncaughtExceptionHandler(NSException *exception) {
+ NSLog(@"Apple AWT Internal Exception: %@", [exception description]);
+}
+
+@interface AWTStarter : NSObject
++ (void)start:(BOOL)headless;
++ (void)starter:(BOOL)onMainThread headless:(BOOL)headless;
++ (void)appKitIsRunning:(id)arg;
+@end
+
+@implementation AWTStarter
+
++ (BOOL) isConnectedToWindowServer {
+ SecuritySessionId session_id;
+ SessionAttributeBits session_info;
+ OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info);
+ if (status != noErr) return NO;
+ if (!(session_info & sessionHasGraphicAccess)) return NO;
+ return YES;
+}
+
++ (BOOL) markAppAsDaemon {
+ id jrsAppKitAWTClass = objc_getClass("JRSAppKitAWT");
+ SEL markAppSel = @selector(markAppIsDaemon);
+ if (![jrsAppKitAWTClass respondsToSelector:markAppSel]) return NO;
+ return [jrsAppKitAWTClass performSelector:markAppSel] ? YES : NO;
+}
+
++ (void)appKitIsRunning:(id)arg {
+ AWT_ASSERT_APPKIT_THREAD;
+ AWT_STARTUP_LOG(@"About to message AppKit started");
+
+ // Signal that AppKit has started (or is already running).
+ pthread_mutex_lock(&sAppKitStarted_mutex);
+ sAppKitStarted = YES;
+ pthread_cond_signal(&sAppKitStarted_cv);
+ pthread_mutex_unlock(&sAppKitStarted_mutex);
+
+ AWT_STARTUP_LOG(@"Finished messaging AppKit started");
+}
+
++ (void)start:(BOOL)headless
+{
+ // onMainThread is NOT the same at SWT mode!
+ // If the JVM was started on the first thread for SWT, but the SWT loads the AWT on a secondary thread,
+ // onMainThread here will be false but SWT mode will be true. If we are currently on the main thread, we don't
+ // need to throw AWT startup over to another thread.
+ BOOL onMainThread = [NSThread isMainThread];
+
+ NSString* msg = [NSString stringWithFormat:@"+[AWTStarter start headless:%d] { onMainThread:%d }", headless, onMainThread];
+ AWT_STARTUP_LOG(msg);
+
+ if (!headless)
+ {
+ // Listen for the NSApp to start. This indicates that JNI_OnLoad can proceed.
+ // It must wait because there is a chance that another java thread will grab
+ // the AppKit lock before the +[NSApplication sharedApplication] returns.
+ // See <rdar://problem/3492666> for an example.
+ [[NSNotificationCenter defaultCenter] addObserver:[AWTStarter class]
+ selector:@selector(appKitIsRunning:)
+ name:NSApplicationDidFinishLaunchingNotification
+ object:nil];
+
+ AWT_STARTUP_LOG(@"+[AWTStarter start:::]: registered NSApplicationDidFinishLaunchingNotification");
+ }
+
+ [ThreadUtilities performOnMainThreadWaiting:NO block:^() {
+ [AWTStarter starter:onMainThread headless:headless];
+ }];
+
+
+ if (!headless && !onMainThread) {
+
+ AWT_STARTUP_LOG(@"about to wait on AppKit startup mutex");
+
+ // Wait here for AppKit to have started (or for AWT to have been loaded into
+ // an already running NSApplication).
+ pthread_mutex_lock(&sAppKitStarted_mutex);
+ while (sAppKitStarted == NO) {
+ pthread_cond_wait(&sAppKitStarted_cv, &sAppKitStarted_mutex);
+ }
+ pthread_mutex_unlock(&sAppKitStarted_mutex);
+
+ // AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called.
+ AWT_STARTUP_LOG(@"got out of the AppKit startup mutex");
+ }
+
+ if (!headless) {
+ // Don't set the delegate until the NSApplication has been created and
+ // its finishLaunching has initialized it.
+ // ApplicationDelegate is the support code for com.apple.eawt.
+ [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+ id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
+ if (delegate != nil) {
+ OSXAPP_SetApplicationDelegate(delegate);
+ }
+ }];
+ }
+}
+
++ (void)starter:(BOOL)wasOnMainThread headless:(BOOL)headless {
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+ // Add the exception handler of last resort
+ NSSetUncaughtExceptionHandler(AWT_NSUncaughtExceptionHandler);
+
+ // Headless mode trumps either ordinary AWT or SWT-in-AWT mode. Declare us a daemon and return.
+ if (headless) {
+ // Note that we don't install run loop observers in headless mode
+ // because we don't need them (see 7174704)
+ if (!forceEmbeddedMode) {
+ setUpAWTAppKit(false);
+ }
+ [AWTStarter markAppAsDaemon];
+ return;
+ }
+
+ if (forceEmbeddedMode) {
+ AWT_STARTUP_LOG(@"in SWT or SWT/WebStart mode");
+
+ // Init a default NSApplication instance instead of the NSApplicationAWT.
+ // Note that [NSApp isRunning] will return YES after that, though
+ // this behavior isn't specified anywhere. We rely on that.
+ NSApplicationLoad();
+ }
+
+ // This will create a NSApplicationAWT for standalone AWT programs, unless there is
+ // already a NSApplication instance. If there is already a NSApplication instance,
+ // and -[NSApplication isRunning] returns YES, AWT is embedded inside another
+ // AppKit Application.
+ NSApplication *app = [NSApplicationAWT sharedApplication];
+ isEmbedded = ![NSApp isKindOfClass:[NSApplicationAWT class]];
+
+ if (!isEmbedded) {
+ // Install run loop observers and set the AppKit Java thread name
+ setUpAWTAppKit(true);
+ }
+
+ // AWT gets to this point BEFORE NSApplicationDidFinishLaunchingNotification is sent.
+ if (![app isRunning]) {
+ AWT_STARTUP_LOG(@"+[AWTStarter startAWT]: ![app isRunning]");
+ // This is where the AWT AppKit thread parks itself to process events.
+ [NSApplicationAWT runAWTLoopWithApp: app];
+ } else {
+ // We're either embedded, or showing a splash screen
+ if (isEmbedded) {
+ AWT_STARTUP_LOG(@"running embedded");
+
+ // We don't track if the runloop is busy, so set it free to let AWT finish when it needs
+ setBusy(NO);
+ } else {
+ AWT_STARTUP_LOG(@"running after showing a splash screen");
+ }
+
+ // Signal so that JNI_OnLoad can proceed.
+ if (!wasOnMainThread) [AWTStarter appKitIsRunning:nil];
+
+ // Proceed to exit this call as there is no reason to run the NSApplication event loop.
+ }
+
+ [pool drain];
+}
+
+@end
+
/*
* Class: sun_lwawt_macosx_LWCToolkit
* Method: nativeSyncQueue
@@ -169,52 +416,6 @@
NSBeep(); // produces both sound and visual flash, if configured in System Preferences
}
-/*
- * Class: sun_lwawt_macosx_LWCToolkit
- * Method: initIDs
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_LWCToolkit_initIDs
-(JNIEnv *env, jclass klass) {
- // set thread names
- if (![ThreadUtilities isAWTEmbedded]) {
- dispatch_async(dispatch_get_main_queue(), ^(void){
- [[NSThread currentThread] setName:@"AppKit Thread"];
- JNIEnv *env = [ThreadUtilities getJNIEnv];
- static JNF_CLASS_CACHE(jc_LWCToolkit, "sun/lwawt/macosx/LWCToolkit");
- static JNF_STATIC_MEMBER_CACHE(jsm_installToolkitThreadInJava, jc_LWCToolkit, "installToolkitThreadInJava", "()V");
- JNFCallStaticVoidMethod(env, jsm_installToolkitThreadInJava);
- });
- }
-
- gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS;
-
- jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
- CHECK_NULL(inputEventClazz);
- jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
- CHECK_NULL(getButtonDownMasksID);
- jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
- jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
- CHECK_NULL(tmp);
-
- gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons);
- if (gButtonDownMasks == NULL) {
- gNumberOfButtons = 0;
- (*env)->ReleaseIntArrayElements(env, obj, tmp, JNI_ABORT);
- JNU_ThrowOutOfMemoryError(env, NULL);
- return;
- }
-
- int i;
- for (i = 0; i < gNumberOfButtons; i++) {
- gButtonDownMasks[i] = tmp[i];
- }
-
- (*env)->ReleaseIntArrayElements(env, obj, tmp, 0);
- (*env)->DeleteLocalRef(env, obj);
-}
-
static UInt32 RGB(NSColor *c) {
c = [c colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
if (c == nil)
@@ -443,3 +644,95 @@
{
}
+
+/*
+ * Class: sun_lwawt_macosx_LWCToolkit
+ * Method: initIDs
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_sun_lwawt_macosx_LWCToolkit_initIDs
+(JNIEnv *env, jclass klass) {
+
+ JNF_COCOA_ENTER(env)
+
+ gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS;
+
+ jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
+ CHECK_NULL(inputEventClazz);
+ jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
+ CHECK_NULL(getButtonDownMasksID);
+ jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
+ jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
+ CHECK_NULL(tmp);
+
+ gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons);
+ if (gButtonDownMasks == NULL) {
+ gNumberOfButtons = 0;
+ (*env)->ReleaseIntArrayElements(env, obj, tmp, JNI_ABORT);
+ JNU_ThrowOutOfMemoryError(env, NULL);
+ return;
+ }
+
+ int i;
+ for (i = 0; i < gNumberOfButtons; i++) {
+ gButtonDownMasks[i] = tmp[i];
+ }
+
+ (*env)->ReleaseIntArrayElements(env, obj, tmp, 0);
+ (*env)->DeleteLocalRef(env, obj);
+
+ JNF_COCOA_EXIT(env)
+}
+
+/*
+ * Class: sun_lwawt_macosx_LWCToolkit
+ * Method: initAppkit
+ * Signature: (Ljava/lang/ThreadGroup;)V
+ */
+JNIEXPORT void JNICALL
+Java_sun_lwawt_macosx_LWCToolkit_initAppkit
+(JNIEnv *env, jclass klass, jobject appkitThreadGroup, jboolean headless) {
+ JNF_COCOA_ENTER(env)
+
+ [ThreadUtilities setAppkitThreadGroup:(*env)->NewGlobalRef(env, appkitThreadGroup)];
+
+ // Launcher sets this env variable if -XstartOnFirstThread is specified
+ char envVar[80];
+ snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
+ if (getenv(envVar) != NULL) {
+ forceEmbeddedMode = YES;
+ unsetenv(envVar);
+ }
+
+ if (isSWTInWebStart(env)) {
+ forceEmbeddedMode = YES;
+ }
+
+ [AWTStarter start:headless ? YES : NO];
+
+ JNF_COCOA_EXIT(env)
+}
+
+JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
+ OSXAPP_SetJavaVM(vm);
+
+ // We need to let Foundation know that this is a multithreaded application, if it isn't already.
+ if (![NSThread isMultiThreaded]) {
+ [NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil];
+ }
+
+ return JNI_VERSION_1_4;
+}
+
+/*
+ * Class: sun_lwawt_macosx_LWCToolkit
+ * Method: isEmbedded
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_sun_lwawt_macosx_LWCToolkit_isEmbedded
+(JNIEnv *env, jclass klass) {
+ return isEmbedded ? JNI_TRUE : JNI_FALSE;
+}
+
--- a/jdk/src/macosx/native/sun/awt/awt.m Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,460 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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.
- */
-
-#import <pthread.h>
-#import <objc/runtime.h>
-#import <Cocoa/Cocoa.h>
-#import <Security/AuthSession.h>
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
-
-#import "NSApplicationAWT.h"
-#import "PropertiesUtilities.h"
-#import "ThreadUtilities.h"
-#import "AWT_debug.h"
-#import "ApplicationDelegate.h"
-
-#define DEBUG 0
-
-
-// The symbol is defined in libosxapp.dylib (ThreadUtilities.m)
-extern JavaVM *jvm;
-
-// Indicates if AWT is running embedded (in SWT, FX, elsewhere)
-static BOOL isEmbedded = NO;
-
-// Indicates that the app has been started with -XstartOnFirstThread
-// (directly or via WebStart settings), and AWT should not run its
-// own event loop in this mode. Even if a loop isn't running yet,
-// we expect an embedder (e.g. SWT) to start it some time later.
-static BOOL forceEmbeddedMode = NO;
-
-static bool ShouldPrintVerboseDebugging() {
- static int debug = -1;
- if (debug == -1) {
- debug = (int)(getenv("JAVA_AWT_VERBOSE") != NULL) || (DEBUG != 0);
- }
- return (bool)debug;
-}
-
-// This is the data necessary to have JNI_OnLoad wait for AppKit to start.
-static BOOL sAppKitStarted = NO;
-static pthread_mutex_t sAppKitStarted_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t sAppKitStarted_cv = PTHREAD_COND_INITIALIZER;
-
-void setBusy(BOOL isBusy);
-static void BusyObserver(CFRunLoopObserverRef ref, CFRunLoopActivity what, void* arg);
-static void NotBusyObserver(CFRunLoopObserverRef ref, CFRunLoopActivity what, void* arg);
-static void AWT_NSUncaughtExceptionHandler(NSException *exception);
-
-static CFRunLoopObserverRef busyObserver = NULL;
-static CFRunLoopObserverRef notBusyObserver = NULL;
-
-static void setUpAWTAppKit()
-{
- BOOL verbose = ShouldPrintVerboseDebugging();
- if (verbose) AWT_DEBUG_LOG(@"setting up busy observers");
-
- // Add CFRunLoopObservers to call into AWT so that AWT knows that the
- // AWT thread (which is the AppKit main thread) is alive. This way AWT
- // will not automatically shutdown.
- busyObserver = CFRunLoopObserverCreate(
- NULL, // CFAllocator
- kCFRunLoopAfterWaiting, // CFOptionFlags
- true, // repeats
- NSIntegerMax, // order
- &BusyObserver, // CFRunLoopObserverCallBack
- NULL); // CFRunLoopObserverContext
-
- notBusyObserver = CFRunLoopObserverCreate(
- NULL, // CFAllocator
- kCFRunLoopBeforeWaiting, // CFOptionFlags
- true, // repeats
- NSIntegerMin, // order
- &NotBusyObserver, // CFRunLoopObserverCallBack
- NULL); // CFRunLoopObserverContext
-
- CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
- CFRunLoopAddObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
- CFRunLoopAddObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode);
-
- CFRelease(busyObserver);
- CFRelease(notBusyObserver);
-
- setBusy(YES);
-}
-
-static void setUpAppKitThreadName()
-{
- BOOL verbose = ShouldPrintVerboseDebugging();
- JNIEnv *env = [ThreadUtilities getJNIEnv];
-
- // Set the java name of the AppKit main thread appropriately.
- jclass threadClass = NULL;
- jstring name = NULL;
- jobject curThread = NULL;
-
- threadClass = (*env)->FindClass(env, "java/lang/Thread");
- if (threadClass == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
- jmethodID currentThreadID = (*env)->GetStaticMethodID(env, threadClass, "currentThread", "()Ljava/lang/Thread;");
- if (currentThreadID == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
- jmethodID setName = (*env)->GetMethodID(env, threadClass, "setName", "(Ljava/lang/String;)V");
- if (setName == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
-
- curThread = (*env)->CallStaticObjectMethod(env, threadClass, currentThreadID); // AWT_THREADING Safe (known object)
- if (curThread == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
- name = (*env)->NewStringUTF(env, "AWT-AppKit");
- if (name == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
- (*env)->CallVoidMethod(env, curThread, setName, name); // AWT_THREADING Safe (known object)
- if ((*env)->ExceptionCheck(env)) goto cleanup;
-
-cleanup:
- if (threadClass != NULL) {
- (*env)->DeleteLocalRef(env, threadClass);
- }
- if (name != NULL) {
- (*env)->DeleteLocalRef(env, name);
- }
- if (curThread != NULL) {
- (*env)->DeleteLocalRef(env, curThread);
- }
- if ((*env)->ExceptionCheck(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->ExceptionClear(env);
- }
-
- if (verbose) AWT_DEBUG_LOG(@"finished setting thread name");
-}
-
-
-// Returns true if java believes it is running headless
-BOOL isHeadless(JNIEnv *env) {
- // Just access the property directly, instead of using GraphicsEnvironment.isHeadless.
- // This is because this may be called while AWT is being loaded, and calling AWT
- // while it is being loaded will deadlock.
- static JNF_CLASS_CACHE(jc_Toolkit, "java/awt/GraphicsEnvironment");
- static JNF_STATIC_MEMBER_CACHE(jm_isHeadless, jc_Toolkit, "isHeadless", "()Z");
- return JNFCallStaticBooleanMethod(env, jm_isHeadless);
-}
-
-BOOL isSWTInWebStart(JNIEnv* env) {
- NSString *swtWebStart = [PropertiesUtilities javaSystemPropertyForKey:@"com.apple.javaws.usingSWT" withEnv:env];
- return [@"true" isCaseInsensitiveLike:swtWebStart];
-}
-
-void setBusy(BOOL busy) {
-AWT_ASSERT_APPKIT_THREAD;
-
- JNIEnv *env = [ThreadUtilities getJNIEnv];
- static JNF_CLASS_CACHE(jc_AWTAutoShutdown, "sun/awt/AWTAutoShutdown");
-
- if (busy) {
- static JNF_STATIC_MEMBER_CACHE(jm_notifyBusyMethod, jc_AWTAutoShutdown, "notifyToolkitThreadBusy", "()V");
- JNFCallStaticVoidMethod(env, jm_notifyBusyMethod);
- } else {
- static JNF_STATIC_MEMBER_CACHE(jm_notifyFreeMethod, jc_AWTAutoShutdown, "notifyToolkitThreadFree", "()V");
- JNFCallStaticVoidMethod(env, jm_notifyFreeMethod);
- }
-}
-
-static void BusyObserver(CFRunLoopObserverRef ref, CFRunLoopActivity what, void* arg) {
-AWT_ASSERT_APPKIT_THREAD;
-
- // This is only called with the selector kCFRunLoopAfterWaiting.
-#ifndef PRODUCT_BUILD
- assert(what == kCFRunLoopAfterWaiting);
-#endif /* PRODUCT_BUILD */
-
- setBusy(YES);
-}
-
-static void NotBusyObserver(CFRunLoopObserverRef ref, CFRunLoopActivity what, void* arg) {
-AWT_ASSERT_APPKIT_THREAD;
-
- // This is only called with the selector kCFRunLoopBeforeWaiting.
-#ifndef PRODUCT_BUILD
- assert(what == kCFRunLoopBeforeWaiting);
-#endif /* PRODUCT_BUILD */
-
- setBusy(NO);
-}
-
-static void AWT_NSUncaughtExceptionHandler(NSException *exception) {
- NSLog(@"Apple AWT Internal Exception: %@", [exception description]);
-}
-
-// This is an empty Obj-C object just so that -peformSelectorOnMainThread can be used.
-@interface AWTStarter : NSObject { }
-+ (void)start:(BOOL)headless;
-- (void)starter:(NSArray*)args;
-+ (void)appKitIsRunning:(id)arg;
-@end
-
-@implementation AWTStarter
-
-+ (BOOL) isConnectedToWindowServer {
- SecuritySessionId session_id;
- SessionAttributeBits session_info;
- OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info);
- if (status != noErr) return NO;
- if (!(session_info & sessionHasGraphicAccess)) return NO;
- return YES;
-}
-
-+ (BOOL) markAppAsDaemon {
- id jrsAppKitAWTClass = objc_getClass("JRSAppKitAWT");
- SEL markAppSel = @selector(markAppIsDaemon);
- if (![jrsAppKitAWTClass respondsToSelector:markAppSel]) return NO;
- return [jrsAppKitAWTClass performSelector:markAppSel] ? YES : NO;
-}
-
-+ (void)appKitIsRunning:(id)arg {
- // Headless: NO
- // Embedded: BOTH
- // Multiple Calls: NO
- // Callers: AppKit's NSApplicationDidFinishLaunchingNotification or +[AWTStarter startAWT:]
-AWT_ASSERT_APPKIT_THREAD;
-
- BOOL verbose = ShouldPrintVerboseDebugging();
- if (verbose) AWT_DEBUG_LOG(@"about to message AppKit started");
-
- // Signal that AppKit has started (or is already running).
- pthread_mutex_lock(&sAppKitStarted_mutex);
- sAppKitStarted = YES;
- pthread_cond_signal(&sAppKitStarted_cv);
- pthread_mutex_unlock(&sAppKitStarted_mutex);
-
- if (verbose) AWT_DEBUG_LOG(@"finished messaging AppKit started");
-}
-
-+ (void)start:(BOOL)headless
-{
- BOOL verbose = ShouldPrintVerboseDebugging();
-
- // Headless: BOTH
- // Embedded: BOTH
- // Multiple Calls: NO
- // Caller: JNI_OnLoad
-
- // onMainThread is NOT the same at SWT mode!
- // If the JVM was started on the first thread for SWT, but the SWT loads the AWT on a secondary thread,
- // onMainThread here will be false but SWT mode will be true. If we are currently on the main thread, we don't
- // need to throw AWT startup over to another thread.
- BOOL onMainThread = (pthread_main_np() != 0);
-
- if (verbose) {
- NSString *msg = [NSString stringWithFormat:@"+[AWTStarter start headless:%d] { onMainThread:%d }", headless, onMainThread];
- AWT_DEBUG_LOG(msg);
- }
-
- if (!headless)
- {
- // Listen for the NSApp to start. This indicates that JNI_OnLoad can proceed.
- // It must wait because there is a chance that another java thread will grab
- // the AppKit lock before the +[NSApplication sharedApplication] returns.
- // See <rdar://problem/3492666> for an example.
- [[NSNotificationCenter defaultCenter] addObserver:[AWTStarter class]
- selector:@selector(appKitIsRunning:)
- name:NSApplicationDidFinishLaunchingNotification
- object:nil];
-
- if (verbose) NSLog(@"+[AWTStarter start:::]: registered NSApplicationDidFinishLaunchingNotification");
- }
-
- id st = [[AWTStarter alloc] init];
-
- NSArray * args = [NSArray arrayWithObjects:
- [NSNumber numberWithBool: onMainThread],
- [NSNumber numberWithBool: headless],
- [NSNumber numberWithBool: verbose],
- nil];
-
- if (onMainThread) {
- [st starter:args];
- } else {
- [st performSelectorOnMainThread: @selector(starter:) withObject:args waitUntilDone:NO];
- }
-
- if (!headless && !onMainThread) {
- if (verbose) AWT_DEBUG_LOG(@"about to wait on AppKit startup mutex");
-
- // Wait here for AppKit to have started (or for AWT to have been loaded into
- // an already running NSApplication).
- pthread_mutex_lock(&sAppKitStarted_mutex);
- while (sAppKitStarted == NO) {
- pthread_cond_wait(&sAppKitStarted_cv, &sAppKitStarted_mutex);
- }
- pthread_mutex_unlock(&sAppKitStarted_mutex);
-
- // AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called.
- if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex");
- }
-
- if (!headless) {
- // Don't set the delegate until the NSApplication has been created and
- // its finishLaunching has initialized it.
- // ApplicationDelegate is the support code for com.apple.eawt.
- [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
- id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
- if (delegate != nil) {
- OSXAPP_SetApplicationDelegate(delegate);
- }
- }];
- }
-}
-
-- (void)starter:(NSArray*)args {
- NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
- BOOL onMainThread = [[args objectAtIndex:0] boolValue];
- BOOL headless = [[args objectAtIndex:1] boolValue];
- BOOL verbose = [[args objectAtIndex:2] boolValue];
-
- BOOL wasOnMainThread = onMainThread;
-
- // Add the exception handler of last resort
- NSSetUncaughtExceptionHandler(AWT_NSUncaughtExceptionHandler);
-
- // Headless mode trumps either ordinary AWT or SWT-in-AWT mode. Declare us a daemon and return.
- if (headless) {
- // Note that we don't install run loop observers in headless mode
- // because we don't need them (see 7174704)
- if (!forceEmbeddedMode) {
- setUpAppKitThreadName();
- }
- [AWTStarter markAppAsDaemon];
- return;
- }
-
- if (forceEmbeddedMode) {
- if (verbose) NSLog(@"in SWT or SWT/WebStart mode");
-
- // Init a default NSApplication instance instead of the NSApplicationAWT.
- // Note that [NSApp isRunning] will return YES after that, though
- // this behavior isn't specified anywhere. We rely on that.
- NSApplicationLoad();
- }
-
- // This will create a NSApplicationAWT for standalone AWT programs, unless there is
- // already a NSApplication instance. If there is already a NSApplication instance,
- // and -[NSApplication isRunning] returns YES, AWT is embedded inside another
- // AppKit Application.
- NSApplication *app = [NSApplicationAWT sharedApplication];
- isEmbedded = ![NSApp isKindOfClass:[NSApplicationAWT class]];
- [ThreadUtilities setAWTEmbedded:isEmbedded];
-
- if (!isEmbedded) {
- // Install run loop observers and set the AppKit Java thread name
- setUpAWTAppKit();
- setUpAppKitThreadName();
- }
-
- // AWT gets to this point BEFORE NSApplicationDidFinishLaunchingNotification is sent.
- if (![app isRunning]) {
- if (verbose) AWT_DEBUG_LOG(@"+[AWTStarter startAWT]: ![app isRunning]");
-
- // This is where the AWT AppKit thread parks itself to process events.
- [NSApplicationAWT runAWTLoopWithApp: app];
- } else {
- // We're either embedded, or showing a splash screen
- if (isEmbedded) {
- if (verbose) AWT_DEBUG_LOG(@"running embedded");
-
- // We don't track if the runloop is busy, so set it free to let AWT finish when it needs
- setBusy(NO);
- } else {
- if (verbose) AWT_DEBUG_LOG(@"running after showing a splash screen");
- }
-
- // Signal so that JNI_OnLoad can proceed.
- if (!wasOnMainThread) [AWTStarter appKitIsRunning:nil];
-
- // Proceed to exit this call as there is no reason to run the NSApplication event loop.
- }
-
- [pool drain];
-}
-
-@end
-
-
-JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
- BOOL verbose = ShouldPrintVerboseDebugging();
- if (verbose) AWT_DEBUG_LOG(@"entered JNI_OnLoad");
-
- // Headless: BOTH
- // Embedded: BOTH
- // Multiple Calls: NO
- // Caller: JavaVM classloader
-
- // Keep a static reference for other archives.
- OSXAPP_SetJavaVM(vm);
-
- JNIEnv *env = NULL;
-
- // Need JNIEnv for JNF_COCOA_ENTER(env); macro below
- jint status = (*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_4);
- if (status != JNI_OK || env == NULL) {
- AWT_DEBUG_LOG(@"Can't get JNIEnv");
- return JNI_VERSION_1_4;
- }
-
-JNF_COCOA_ENTER(env);
-
- // Launcher sets this env variable if -XstartOnFirstThread is specified
- char envVar[80];
- snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
- if (getenv(envVar) != NULL) {
- forceEmbeddedMode = YES;
- unsetenv(envVar);
- }
-
- if (isSWTInWebStart(env)) {
- forceEmbeddedMode = YES;
- }
- JNIEnv* env = [ThreadUtilities getJNIEnvUncached];
- jclass jc_ThreadGroupUtils = (*env)->FindClass(env, "sun/awt/util/ThreadGroupUtils");
- jmethodID sjm_getRootThreadGroup = (*env)->GetStaticMethodID(env, jc_ThreadGroupUtils, "getRootThreadGroup", "()Ljava/lang/ThreadGroup;");
- jobject rootThreadGroup = (*env)->CallStaticObjectMethod(env, jc_ThreadGroupUtils, sjm_getRootThreadGroup);
- [ThreadUtilities setAppkitThreadGroup:(*env)->NewGlobalRef(env, rootThreadGroup)];
- // The current thread was attached in getJNIEnvUnchached.
- // Detach it back. It will be reattached later if needed with a proper TG
- [ThreadUtilities detachCurrentThread];
-
- BOOL headless = isHeadless(env);
-
- // We need to let Foundation know that this is a multithreaded application, if it isn't already.
- if (![NSThread isMultiThreaded]) {
- [NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil];
- }
-
- [AWTStarter start:headless];
-
-JNF_COCOA_EXIT(env);
-
- if (verbose) AWT_DEBUG_LOG(@"exiting JNI_OnLoad");
-
- return JNI_VERSION_1_4;
-}
--- a/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m Fri Jul 25 09:44:53 2014 +0000
@@ -125,6 +125,39 @@
return buf;
}
+char* SplashGetScaledImageName(const char* jar, const char* file,
+ float *scaleFactor) {
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+ *scaleFactor = 1;
+ char* scaledFile = nil;
+ float screenScaleFactor = [SplashNSScreen() backingScaleFactor];
+
+ if (screenScaleFactor > 1) {
+ NSString *fileName = [NSString stringWithUTF8String: file];
+ NSUInteger length = [fileName length];
+ NSRange range = [fileName rangeOfString: @"."
+ options:NSBackwardsSearch];
+ NSUInteger dotIndex = range.location;
+ NSString *fileName2x = nil;
+
+ if (dotIndex == NSNotFound) {
+ fileName2x = [fileName stringByAppendingString: @"@2x"];
+ } else {
+ fileName2x = [fileName substringToIndex: dotIndex];
+ fileName2x = [fileName2x stringByAppendingString: @"@2x"];
+ fileName2x = [fileName2x stringByAppendingString:
+ [fileName substringFromIndex: dotIndex]];
+ }
+
+ if ((fileName2x != nil) && (jar || [[NSFileManager defaultManager]
+ fileExistsAtPath: fileName2x])){
+ *scaleFactor = 2;
+ scaledFile = strdup([fileName2x UTF8String]);
+ }
+ }
+ [pool drain];
+ return scaledFile;
+}
void
SplashInitPlatform(Splash * splash) {
@@ -132,7 +165,7 @@
splash->maskRequired = 0;
-
+
//TODO: the following is too much of a hack but should work in 90% cases.
// besides we don't use device-dependant drawing, so probably
// that's very fine indeed
@@ -225,7 +258,15 @@
[image setBackgroundColor: [NSColor clearColor]];
[image addRepresentation: rep];
-
+ float scaleFactor = splash->scaleFactor;
+ if (scaleFactor > 0 && scaleFactor != 1) {
+ [image setScalesWhenResized:YES];
+ NSSize size = [image size];
+ size.width /= scaleFactor;
+ size.height /= scaleFactor;
+ [image setSize: size];
+ }
+
NSImageView * view = [[NSImageView alloc] init];
[view setImage: image];
--- a/jdk/src/macosx/native/sun/osxapp/AWT_debug.h Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/native/sun/osxapp/AWT_debug.h Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -28,12 +28,16 @@
#import <Cocoa/Cocoa.h>
+bool ShouldPrintVerboseDebugging();
#define kInternalError "java/lang/InternalError"
#define AWT_DEBUG_LOG(str) \
NSLog(@"\tCocoa AWT: %@ %@", str, [NSThread callStackSymbols])
+#define AWT_STARTUP_LOG(str) \
+ if (ShouldPrintVerboseDebugging()) AWT_DEBUG_LOG((str))
+
#define AWT_DEBUG_BUG_REPORT_MESSAGE \
NSLog(@"\tPlease file a bug report at http://bugreport.java.com/bugreport \
with this message and a reproducible test case.")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/native/sun/osxapp/AWT_debug.m Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 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
+ * 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.
+ */
+
+#import "AWT_debug.h"
+
+bool ShouldPrintVerboseDebugging() {
+ static int debug = -1;
+ if (debug == -1) {
+ debug = (int)(getenv("JAVA_AWT_VERBOSE") != NULL);
+ }
+ return (bool)debug;
+}
--- a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.h Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.h Fri Jul 25 09:44:53 2014 +0000
@@ -129,8 +129,6 @@
+ (JNIEnv*)getJNIEnvUncached;
+ (void)detachCurrentThread;
+ (void)setAppkitThreadGroup:(jobject)group;
-+ (void)setAWTEmbedded:(BOOL)embedded;
-+ (BOOL)isAWTEmbedded;
//Wrappers for the corresponding JNFRunLoop methods with a check for main thread
+ (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block;
--- a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m Fri Jul 25 09:44:53 2014 +0000
@@ -34,7 +34,6 @@
JavaVM *jvm = NULL;
static JNIEnv *appKitEnv = NULL;
static jobject appkitThreadGroup = NULL;
-static BOOL awtEmbedded = NO;
static inline void attachCurrentThread(void** env) {
if ([NSThread isMainThread]) {
@@ -88,14 +87,6 @@
}
}
-+ (void)setAWTEmbedded:(BOOL)embedded {
- awtEmbedded = embedded;
-}
-
-+ (BOOL)isAWTEmbedded {
- return awtEmbedded;
-}
-
@end
--- a/jdk/src/share/bin/java.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/bin/java.c Fri Jul 25 09:44:53 2014 +0000
@@ -1816,20 +1816,48 @@
const char *jar_name = getenv(SPLASH_JAR_ENV_ENTRY);
const char *file_name = getenv(SPLASH_FILE_ENV_ENTRY);
int data_size;
- void *image_data;
+ void *image_data = NULL;
+ float scale_factor = 1;
+ char *scaled_splash_name = NULL;
+
+ if (file_name == NULL){
+ return;
+ }
+
+ scaled_splash_name = DoSplashGetScaledImageName(
+ jar_name, file_name, &scale_factor);
if (jar_name) {
- image_data = JLI_JarUnpackFile(jar_name, file_name, &data_size);
+
+ if (scaled_splash_name) {
+ image_data = JLI_JarUnpackFile(
+ jar_name, scaled_splash_name, &data_size);
+ }
+
+ if (!image_data) {
+ scale_factor = 1;
+ image_data = JLI_JarUnpackFile(
+ jar_name, file_name, &data_size);
+ }
if (image_data) {
DoSplashInit();
+ DoSplashSetScaleFactor(scale_factor);
DoSplashLoadMemory(image_data, data_size);
JLI_MemFree(image_data);
}
- } else if (file_name) {
+ } else {
DoSplashInit();
- DoSplashLoadFile(file_name);
- } else {
- return;
+ if (scaled_splash_name) {
+ DoSplashSetScaleFactor(scale_factor);
+ DoSplashLoadFile(scaled_splash_name);
+ } else {
+ DoSplashLoadFile(file_name);
+ }
}
+
+ if (scaled_splash_name) {
+ JLI_MemFree(scaled_splash_name);
+ }
+
DoSplashSetFileJarName(file_name, jar_name);
/*
--- a/jdk/src/share/bin/splashscreen.h Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/bin/splashscreen.h Fri Jul 25 09:44:53 2014 +0000
@@ -29,3 +29,6 @@
void DoSplashInit(void);
void DoSplashClose(void);
void DoSplashSetFileJarName(const char* fileName, const char* jarName);
+void DoSplashSetScaleFactor(float scaleFactor);
+char* DoSplashGetScaledImageName(const char* jarName, const char* fileName,
+ float* scaleFactor);
--- a/jdk/src/share/bin/splashscreen_stubs.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/bin/splashscreen_stubs.c Fri Jul 25 09:44:53 2014 +0000
@@ -37,6 +37,9 @@
typedef void (*SplashClose_t)(void);
typedef void (*SplashSetFileJarName_t)(const char* fileName,
const char* jarName);
+typedef void (*SplashSetScaleFactor_t)(float scaleFactor);
+typedef char* (*SplashGetScaledImageName_t)(const char* fileName,
+ const char* jarName, float* scaleFactor);
/*
* This macro invokes a function from the shared lib.
@@ -58,11 +61,11 @@
#define INVOKEV(name) _INVOKE(name, ,;)
int DoSplashLoadMemory(void* pdata, int size) {
- INVOKE(SplashLoadMemory,0)(pdata, size);
+ INVOKE(SplashLoadMemory, NULL)(pdata, size);
}
int DoSplashLoadFile(const char* filename) {
- INVOKE(SplashLoadFile,0)(filename);
+ INVOKE(SplashLoadFile, NULL)(filename);
}
void DoSplashInit(void) {
@@ -76,3 +79,12 @@
void DoSplashSetFileJarName(const char* fileName, const char* jarName) {
INVOKEV(SplashSetFileJarName)(fileName, jarName);
}
+
+void DoSplashSetScaleFactor(float scaleFactor) {
+ INVOKEV(SplashSetScaleFactor)(scaleFactor);
+}
+
+char* DoSplashGetScaledImageName(const char* fileName, const char* jarName,
+ float* scaleFactor) {
+ INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor);
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/introspect/ClassInfo.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 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
+ * 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 com.sun.beans.introspect;
+
+import com.sun.beans.util.Cache;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+
+import static sun.reflect.misc.ReflectUtil.checkPackageAccess;
+
+public final class ClassInfo {
+ private static final ClassInfo DEFAULT = new ClassInfo(null);
+ private static final Cache<Class<?>,ClassInfo> CACHE
+ = new Cache<Class<?>,ClassInfo>(Cache.Kind.SOFT, Cache.Kind.SOFT) {
+ @Override
+ public ClassInfo create(Class<?> type) {
+ return new ClassInfo(type);
+ }
+ };
+
+ public static ClassInfo get(Class<?> type) {
+ if (type == null) {
+ return DEFAULT;
+ }
+ try {
+ checkPackageAccess(type);
+ return CACHE.get(type);
+ } catch (SecurityException exception) {
+ return DEFAULT;
+ }
+ }
+
+ private final Object mutex = new Object();
+ private final Class<?> type;
+ private List<Method> methods;
+ private Map<String,PropertyInfo> properties;
+ private Map<String,EventSetInfo> eventSets;
+
+ private ClassInfo(Class<?> type) {
+ this.type = type;
+ }
+
+ public List<Method> getMethods() {
+ if (this.methods == null) {
+ synchronized (this.mutex) {
+ if (this.methods == null) {
+ this.methods = MethodInfo.get(this.type);
+ }
+ }
+ }
+ return this.methods;
+ }
+
+ public Map<String,PropertyInfo> getProperties() {
+ if (this.properties == null) {
+ synchronized (this.mutex) {
+ if (this.properties == null) {
+ this.properties = PropertyInfo.get(this.type);
+ }
+ }
+ }
+ return this.properties;
+ }
+
+ public Map<String,EventSetInfo> getEventSets() {
+ if (this.eventSets == null) {
+ synchronized (this.mutex) {
+ if (this.eventSets == null) {
+ this.eventSets = EventSetInfo.get(this.type);
+ }
+ }
+ }
+ return this.eventSets;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/introspect/EventSetInfo.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 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
+ * 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 com.sun.beans.introspect;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.EventListener;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TooManyListenersException;
+import java.util.TreeMap;
+
+public final class EventSetInfo {
+ private MethodInfo add;
+ private MethodInfo remove;
+ private MethodInfo get;
+
+ private EventSetInfo() {
+ }
+
+ private boolean initialize() {
+ if ((this.add == null) || (this.remove == null) || (this.remove.type != this.add.type)) {
+ return false;
+ }
+ if ((this.get != null) && (this.get.type != this.add.type)) {
+ this.get = null;
+ }
+ return true;
+ }
+
+ public Class<?> getListenerType() {
+ return this.add.type;
+ }
+
+ public Method getAddMethod() {
+ return this.add.method;
+ }
+
+ public Method getRemoveMethod() {
+ return this.remove.method;
+ }
+
+ public Method getGetMethod() {
+ return (this.get == null) ? null : this.get.method;
+ }
+
+ public boolean isUnicast() {
+ // if the adder method throws the TooManyListenersException
+ // then it is an Unicast event source
+ return this.add.isThrow(TooManyListenersException.class);
+ }
+
+ private static MethodInfo getInfo(MethodInfo info, Method method, int prefix, int postfix) {
+ Class<?> type = (postfix > 0)
+ ? MethodInfo.resolve(method, method.getGenericReturnType()).getComponentType()
+ : MethodInfo.resolve(method, method.getGenericParameterTypes()[0]);
+
+ if ((type != null) && EventListener.class.isAssignableFrom(type)) {
+ String name = method.getName();
+ if (prefix + postfix < name.length()) {
+ if (type.getName().endsWith(name.substring(prefix, name.length() - postfix))) {
+ if ((info == null) || info.type.isAssignableFrom(type)) {
+ return new MethodInfo(method, type);
+ }
+ }
+ }
+ }
+ return info;
+ }
+
+ private static EventSetInfo getInfo(Map<String,EventSetInfo> map, String key) {
+ EventSetInfo info = map.get(key);
+ if (info == null) {
+ info = new EventSetInfo();
+ map.put(key, info);
+ }
+ return info;
+ }
+
+ public static Map<String,EventSetInfo> get(Class<?> type) {
+ List<Method> methods = ClassInfo.get(type).getMethods();
+ if (methods.isEmpty()) {
+ return Collections.emptyMap();
+ }
+ Map<String,EventSetInfo> map = new TreeMap<>();
+ for (Method method : ClassInfo.get(type).getMethods()) {
+ if (!Modifier.isStatic(method.getModifiers())) {
+ Class<?> returnType = method.getReturnType();
+ String name = method.getName();
+ switch (method.getParameterCount()) {
+ case 1:
+ if ((returnType == void.class) && name.endsWith("Listener")) {
+ if (name.startsWith("add")) {
+ EventSetInfo info = getInfo(map, name.substring(3, name.length() - 8));
+ info.add = getInfo(info.add, method, 3, 0);
+ } else if (name.startsWith("remove")) {
+ EventSetInfo info = getInfo(map, name.substring(6, name.length() - 8));
+ info.remove = getInfo(info.remove, method, 6, 0);
+ }
+ }
+ break;
+ case 0:
+ if (returnType.isArray() && name.startsWith("get") && name.endsWith("Listeners")) {
+ EventSetInfo info = getInfo(map, name.substring(3, name.length() - 9));
+ info.get = getInfo(info.get, method, 3, 1);
+ }
+ break;
+ }
+ }
+ }
+ Iterator<EventSetInfo> iterator = map.values().iterator();
+ while (iterator.hasNext()) {
+ if (!iterator.next().initialize()) {
+ iterator.remove();
+ }
+ }
+ return !map.isEmpty()
+ ? Collections.unmodifiableMap(map)
+ : Collections.emptyMap();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/introspect/MethodInfo.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 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
+ * 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 com.sun.beans.introspect;
+
+import com.sun.beans.TypeResolver;
+import com.sun.beans.finder.MethodFinder;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+final class MethodInfo {
+ final Method method;
+ final Class<?> type;
+
+ MethodInfo(Method method, Class<?> type) {
+ this.method = method;
+ this.type = type;
+ }
+
+ MethodInfo(Method method, Type type) {
+ this.method = method;
+ this.type = resolve(method, type);
+ }
+
+ boolean isThrow(Class<?> exception) {
+ for (Class<?> type : this.method.getExceptionTypes()) {
+ if (type == exception) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static Class<?> resolve(Method method, Type type) {
+ return TypeResolver.erase(TypeResolver.resolveInClass(method.getDeclaringClass(), type));
+ }
+
+ static List<Method> get(Class<?> type) {
+ List<Method> list = null;
+ if (type != null) {
+ boolean inaccessible = !Modifier.isPublic(type.getModifiers());
+ for (Method method : type.getMethods()) {
+ if (method.getDeclaringClass().equals(type)) {
+ if (inaccessible) {
+ try {
+ method = MethodFinder.findAccessibleMethod(method);
+ if (!method.getDeclaringClass().isInterface()) {
+ method = null; // ignore methods from superclasses
+ }
+ } catch (NoSuchMethodException exception) {
+ // commented out because of 6976577
+ // method = null; // ignore inaccessible methods
+ }
+ }
+ if (method != null) {
+ if (list == null) {
+ list = new ArrayList<>();
+ }
+ list.add(method);
+ }
+ }
+ }
+ }
+ return (list != null)
+ ? Collections.unmodifiableList(list)
+ : Collections.emptyList();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/introspect/PropertyInfo.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 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
+ * 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 com.sun.beans.introspect;
+
+import java.beans.BeanProperty;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import static com.sun.beans.finder.ClassFinder.findClass;
+
+public final class PropertyInfo {
+ public enum Name {bound, expert, hidden, preferred, visualUpdate, description, enumerationValues}
+
+ private static final String VETO_EXCEPTION_NAME = "java.beans.PropertyVetoException";
+ private static final Class<?> VETO_EXCEPTION;
+
+ static {
+ Class<?> type;
+ try {
+ type = Class.forName(VETO_EXCEPTION_NAME);
+ } catch (Exception exception) {
+ type = null;
+ }
+ VETO_EXCEPTION = type;
+ }
+
+ private Class<?> type;
+ private MethodInfo read;
+ private MethodInfo write;
+ private PropertyInfo indexed;
+ private List<MethodInfo> readList;
+ private List<MethodInfo> writeList;
+ private Map<Name,Object> map;
+
+ private PropertyInfo() {
+ }
+
+ private boolean initialize() {
+ if (this.read != null) {
+ this.type = this.read.type;
+ }
+ if (this.readList != null) {
+ for (MethodInfo info : this.readList) {
+ if ((this.read == null) || this.read.type.isAssignableFrom(info.type)) {
+ this.read = info;
+ this.type = info.type;
+ }
+ }
+ this.readList = null;
+ }
+ if (this.writeList != null) {
+ for (MethodInfo info : this.writeList) {
+ if (this.type == null) {
+ this.write = info;
+ this.type = info.type;
+ } else if (this.type.isAssignableFrom(info.type)) {
+ if ((this.write == null) || this.write.type.isAssignableFrom(info.type)) {
+ this.write = info;
+ }
+ }
+ }
+ this.writeList = null;
+ }
+ if (this.indexed != null) {
+ if ((this.type != null) && !this.type.isArray()) {
+ this.indexed = null; // property type is not an array
+ } else if (!this.indexed.initialize()) {
+ this.indexed = null; // cannot initialize indexed methods
+ } else if ((this.type != null) && (this.indexed.type != this.type.getComponentType())) {
+ this.indexed = null; // different property types
+ } else {
+ this.map = this.indexed.map;
+ this.indexed.map = null;
+ }
+ }
+ if ((this.type == null) && (this.indexed == null)) {
+ return false;
+ }
+ initialize(this.write);
+ initialize(this.read);
+ return true;
+ }
+
+ private void initialize(MethodInfo info) {
+ if (info != null) {
+ BeanProperty annotation = info.method.getAnnotation(BeanProperty.class);
+ if (annotation != null) {
+ if (!annotation.bound()) {
+ put(Name.bound, Boolean.FALSE);
+ }
+ put(Name.expert, annotation.expert());
+ put(Name.hidden, annotation.hidden());
+ put(Name.preferred, annotation.preferred());
+ put(Name.visualUpdate, annotation.visualUpdate());
+ put(Name.description, annotation.description());
+ String[] values = annotation.enumerationValues();
+ if (0 < values.length) {
+ try {
+ Object[] array = new Object[3 * values.length];
+ int index = 0;
+ for (String value : values) {
+ Class<?> type = info.method.getDeclaringClass();
+ String name = value;
+ int pos = value.lastIndexOf('.');
+ if (pos > 0) {
+ name = value.substring(0, pos);
+ if (name.indexOf('.') < 0) {
+ String pkg = type.getName();
+ name = pkg.substring(0, 1 + Math.max(
+ pkg.lastIndexOf('.'),
+ pkg.lastIndexOf('$'))) + name;
+ }
+ type = findClass(name);
+ name = value.substring(pos + 1);
+ }
+ Field field = type.getField(name);
+ if (Modifier.isStatic(field.getModifiers()) && info.type.isAssignableFrom(field.getType())) {
+ array[index++] = name;
+ array[index++] = field.get(null);
+ array[index++] = value;
+ }
+ }
+ if (index == array.length) {
+ put(Name.enumerationValues, array);
+ }
+ } catch (Exception ignored) {
+ ignored.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ public Class<?> getPropertyType() {
+ return this.type;
+ }
+
+ public Method getReadMethod() {
+ return (this.read == null) ? null : this.read.method;
+ }
+
+ public Method getWriteMethod() {
+ return (this.write == null) ? null : this.write.method;
+ }
+
+ public PropertyInfo getIndexed() {
+ return this.indexed;
+ }
+
+ public boolean isConstrained() {
+ if (this.write != null) {
+ if (VETO_EXCEPTION == null) {
+ for (Class<?> type : this.write.method.getExceptionTypes()) {
+ if (type.getName().equals(VETO_EXCEPTION_NAME)) {
+ return true;
+ }
+ }
+ } else if (this.write.isThrow(VETO_EXCEPTION)) {
+ return true;
+ }
+ }
+ return (this.indexed != null) && this.indexed.isConstrained();
+ }
+
+ public boolean is(Name name) {
+ Object value = get(name);
+ return (value instanceof Boolean)
+ ? (Boolean) value
+ : Name.bound.equals(name);
+ }
+
+ public Object get(Name name) {
+ return this.map == null ? null : this.map.get(name);
+ }
+
+ private void put(Name name, boolean value) {
+ if (value) {
+ put(name, Boolean.TRUE);
+ }
+ }
+
+ private void put(Name name, String value) {
+ if (0 < value.length()) {
+ put(name, (Object) value);
+ }
+ }
+
+ private void put(Name name, Object value) {
+ if (this.map == null) {
+ this.map = new EnumMap<>(Name.class);
+ }
+ this.map.put(name, value);
+ }
+
+ private static List<MethodInfo> add(List<MethodInfo> list, Method method, Type type) {
+ if (list == null) {
+ list = new ArrayList<>();
+ }
+ list.add(new MethodInfo(method, type));
+ return list;
+ }
+
+ private static boolean isPrefix(String name, String prefix) {
+ return name.length() > prefix.length() && name.startsWith(prefix);
+ }
+
+ private static PropertyInfo getInfo(Map<String,PropertyInfo> map, String key, boolean indexed) {
+ PropertyInfo info = map.get(key);
+ if (info == null) {
+ info = new PropertyInfo();
+ map.put(key, info);
+ }
+ if (!indexed) {
+ return info;
+ }
+ if (info.indexed == null) {
+ info.indexed = new PropertyInfo();
+ }
+ return info.indexed;
+ }
+
+ public static Map<String,PropertyInfo> get(Class<?> type) {
+ List<Method> methods = ClassInfo.get(type).getMethods();
+ if (methods.isEmpty()) {
+ return Collections.emptyMap();
+ }
+ Map<String,PropertyInfo> map = new TreeMap<>();
+ for (Method method : methods) {
+ if (!Modifier.isStatic(method.getModifiers())) {
+ Class<?> returnType = method.getReturnType();
+ String name = method.getName();
+ switch (method.getParameterCount()) {
+ case 0:
+ if (returnType.equals(boolean.class) && isPrefix(name, "is")) {
+ PropertyInfo info = getInfo(map, name.substring(2), false);
+ info.read = new MethodInfo(method, boolean.class);
+ } else if (!returnType.equals(void.class) && isPrefix(name, "get")) {
+ PropertyInfo info = getInfo(map, name.substring(3), false);
+ info.readList = add(info.readList, method, method.getGenericReturnType());
+ }
+ break;
+ case 1:
+ if (returnType.equals(void.class) && isPrefix(name, "set")) {
+ PropertyInfo info = getInfo(map, name.substring(3), false);
+ info.writeList = add(info.writeList, method, method.getGenericParameterTypes()[0]);
+ } else if (!returnType.equals(void.class) && method.getParameterTypes()[0].equals(int.class) && isPrefix(name, "get")) {
+ PropertyInfo info = getInfo(map, name.substring(3), true);
+ info.readList = add(info.readList, method, method.getGenericReturnType());
+ }
+ break;
+ case 2:
+ if (returnType.equals(void.class) && method.getParameterTypes()[0].equals(int.class) && isPrefix(name, "set")) {
+ PropertyInfo info = getInfo(map, name.substring(3), true);
+ info.writeList = add(info.writeList, method, method.getGenericParameterTypes()[1]);
+ }
+ break;
+ }
+ }
+ }
+ Iterator<PropertyInfo> iterator = map.values().iterator();
+ while (iterator.hasNext()) {
+ if (!iterator.next().initialize()) {
+ iterator.remove();
+ }
+ }
+ return !map.isEmpty()
+ ? Collections.unmodifiableMap(map)
+ : Collections.emptyMap();
+ }
+}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -82,14 +82,14 @@
private String renameFileErrorTitle = null;
private String renameFileErrorText = null;
- private JComboBox filterComboBox;
+ private JComboBox<FileFilter> filterComboBox;
private FilterComboBoxModel filterComboBoxModel;
// From Motif
private JPanel rightPanel;
- private JList directoryList;
- private JList fileList;
+ private JList<File> directoryList;
+ private JList<File> fileList;
private JLabel pathField;
private JTextField fileNameTextField;
@@ -116,7 +116,7 @@
private int pathLabelMnemonic = 0;
private int filterLabelMnemonic = 0;
- private JComboBox directoryComboBox;
+ private JComboBox<File> directoryComboBox;
private DirectoryComboBoxModel directoryComboBoxModel;
private Action directoryComboBoxAction = new DirectoryComboBoxAction();
private JPanel bottomButtonPanel;
@@ -153,7 +153,7 @@
}
int mode = fc.getFileSelectionMode();
- JList list = mode == JFileChooser.DIRECTORIES_ONLY ?
+ JList<File> list = mode == JFileChooser.DIRECTORIES_ONLY ?
directoryList : fileList;
Object[] files = list.getSelectedValues();
int len = files.length;
@@ -369,8 +369,8 @@
}
class DoubleClickListener extends MouseAdapter {
- JList list;
- public DoubleClickListener(JList list) {
+ JList<?> list;
+ public DoubleClickListener(JList<?> list) {
this.list = list;
}
@@ -413,7 +413,7 @@
}
}
- protected MouseListener createDoubleClickListener(JFileChooser fc, JList list) {
+ protected MouseListener createDoubleClickListener(JFileChooser fc, JList<?> list) {
return new DoubleClickListener(list);
}
@@ -423,7 +423,7 @@
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
JFileChooser chooser = getFileChooser();
- JList list = (JList) e.getSource();
+ JList<?> list = (JList) e.getSource();
if (chooser.isMultiSelectionEnabled()) {
File[] files = null;
@@ -554,7 +554,7 @@
0, 0) {
public void layoutContainer(Container target) {
super.layoutContainer(target);
- JComboBox comboBox = directoryComboBox;
+ JComboBox<?> comboBox = directoryComboBox;
if (comboBox.getWidth() > target.getWidth()) {
comboBox.setBounds(0, comboBox.getY(), target.getWidth(),
comboBox.getHeight());
@@ -565,7 +565,7 @@
comboBoxPanel.setName("GTKFileChooser.directoryComboBoxPanel");
// CurrentDir ComboBox
directoryComboBoxModel = createDirectoryComboBoxModel(fc);
- directoryComboBox = new JComboBox(directoryComboBoxModel);
+ directoryComboBox = new JComboBox<>(directoryComboBoxModel);
directoryComboBox.setName("GTKFileChooser.directoryComboBox");
directoryComboBox.putClientProperty( "JComboBox.lightweightKeyboardNavigation", "Lightweight" );
directoryComboBox.addActionListener(directoryComboBoxAction);
@@ -710,7 +710,7 @@
filterComboBoxModel = createFilterComboBoxModel();
fc.addPropertyChangeListener(filterComboBoxModel);
- filterComboBox = new JComboBox(filterComboBoxModel);
+ filterComboBox = new JComboBox<>(filterComboBoxModel);
filterComboBox.setRenderer(createFilterComboBoxRenderer());
filterLabel.setLabelFor(filterComboBox);
@@ -851,7 +851,7 @@
}
protected JScrollPane createFilesList() {
- fileList = new JList();
+ fileList = new JList<>();
fileList.setName("GTKFileChooser.fileList");
fileList.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, filesLabelText);
@@ -877,7 +877,7 @@
}
protected JScrollPane createDirectoryList() {
- directoryList = new JList();
+ directoryList = new JList<>();
directoryList.setName("GTKFileChooser.directoryList");
directoryList.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, foldersLabelText);
align(directoryList);
@@ -930,7 +930,7 @@
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
- protected class GTKDirectoryListModel extends AbstractListModel implements ListDataListener {
+ protected class GTKDirectoryListModel extends AbstractListModel<File> implements ListDataListener {
File curDir;
public GTKDirectoryListModel() {
getModel().addListDataListener(this);
@@ -941,7 +941,8 @@
return getModel().getDirectories().size() + 1;
}
- public Object getElementAt(int index) {
+ @Override
+ public File getElementAt(int index) {
return index > 0 ? getModel().getDirectories().elementAt(index - 1):
curDir;
}
@@ -974,7 +975,7 @@
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
- protected class GTKFileListModel extends AbstractListModel implements ListDataListener {
+ protected class GTKFileListModel extends AbstractListModel<File> implements ListDataListener {
public GTKFileListModel() {
getModel().addListDataListener(this);
}
@@ -991,7 +992,8 @@
return getModel().getFiles().indexOf(o);
}
- public Object getElementAt(int index) {
+ @Override
+ public File getElementAt(int index) {
return getModel().getFiles().elementAt(index);
}
@@ -1019,7 +1021,7 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class FileCellRenderer extends DefaultListCellRenderer {
- public Component getListCellRendererComponent(JList list, Object value, int index,
+ public Component getListCellRendererComponent(JList<?> list, Object value, int index,
boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@@ -1033,7 +1035,7 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DirectoryCellRenderer extends DefaultListCellRenderer {
- public Component getListCellRendererComponent(JList list, Object value, int index,
+ public Component getListCellRendererComponent(JList<?> list, Object value, int index,
boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@@ -1095,7 +1097,7 @@
* Data model for a type-face selection combo-box.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
- protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel {
+ protected class DirectoryComboBoxModel extends AbstractListModel<File> implements ComboBoxModel<File> {
Vector<File> directories = new Vector<File>();
File selectedDirectory = null;
JFileChooser chooser = getFileChooser();
@@ -1163,7 +1165,8 @@
return directories.size();
}
- public Object getElementAt(int index) {
+ @Override
+ public File getElementAt(int index) {
return directories.elementAt(index);
}
}
@@ -1314,7 +1317,7 @@
return name;
}
- public Component getListCellRendererComponent(JList list, Object value,
+ public Component getListCellRendererComponent(JList<?> list, Object value,
int index, boolean isSelected,
boolean cellHasFocus) {
@@ -1345,8 +1348,8 @@
* Data model for filter combo-box.
*/
@SuppressWarnings("serial") // JDK implementation class
- protected class FilterComboBoxModel extends AbstractListModel
- implements ComboBoxModel, PropertyChangeListener {
+ protected class FilterComboBoxModel extends AbstractListModel<FileFilter>
+ implements ComboBoxModel<FileFilter>, PropertyChangeListener {
protected FileFilter[] filters;
protected FilterComboBoxModel() {
@@ -1400,7 +1403,8 @@
}
}
- public Object getElementAt(int index) {
+ @Override
+ public FileFilter getElementAt(int index) {
if (index > getSize() - 1) {
// This shouldn't happen. Try to recover gracefully.
return getFileChooser().getFileFilter();
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -151,7 +151,7 @@
private static class DelegatingIcon extends SynthIcon implements
UIResource {
- private static final Class[] PARAM_TYPES = new Class[] {
+ private static final Class<?>[] PARAM_TYPES = new Class<?>[] {
SynthContext.class, Graphics.class, int.class,
int.class, int.class, int.class, int.class
};
@@ -190,7 +190,7 @@
return (Method)method;
}
- protected Class[] getMethodParamTypes() {
+ protected Class<?>[] getMethodParamTypes() {
return PARAM_TYPES;
}
@@ -262,7 +262,7 @@
// we create a unique icon per ToolBar and lookup the style for the
// HandleBox.
private static class ToolBarHandleIcon extends DelegatingIcon {
- private static final Class[] PARAM_TYPES = new Class[] {
+ private static final Class<?>[] PARAM_TYPES = new Class<?>[] {
SynthContext.class, Graphics.class, int.class,
int.class, int.class, int.class, int.class, Orientation.class,
};
@@ -273,7 +273,7 @@
super(TOOL_BAR_HANDLE_ICON);
}
- protected Class[] getMethodParamTypes() {
+ protected Class<?>[] getMethodParamTypes() {
return PARAM_TYPES;
}
@@ -323,7 +323,7 @@
}
private static class MenuArrowIcon extends DelegatingIcon {
- private static final Class[] PARAM_TYPES = new Class[] {
+ private static final Class<?>[] PARAM_TYPES = new Class<?>[] {
SynthContext.class, Graphics.class, int.class,
int.class, int.class, int.class, int.class, ArrowType.class,
};
@@ -332,7 +332,7 @@
super(MENU_ARROW_ICON);
}
- protected Class[] getMethodParamTypes() {
+ protected Class<?>[] getMethodParamTypes() {
return PARAM_TYPES;
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -1086,13 +1086,13 @@
public Object createValue(UIDefaults table) {
try {
- Class c = Class.forName(className, true,Thread.currentThread().
- getContextClassLoader());
+ Class<?> c = Class.forName(className, true,Thread.currentThread().
+ getContextClassLoader());
if (methodName == null) {
return c.newInstance();
}
- Method m = c.getMethod(methodName, (Class[])null);
+ Method m = c.getMethod(methodName, (Class<?>[])null);
return m.invoke(c, (Object[])null);
} catch (ClassNotFoundException cnfe) {
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -764,7 +764,7 @@
} else {
return;
}
- Map gm = getFrameGeometry();
+ Map<String, Object> gm = getFrameGeometry();
int w = titlePane.getWidth();
int h = titlePane.getHeight();
@@ -828,11 +828,11 @@
}
} // end TitlePaneLayout
- protected Map getFrameGeometry() {
+ protected Map<String, Object> getFrameGeometry() {
return frameGeometry;
}
- protected void setFrameGeometry(JComponent titlePane, Map gm) {
+ protected void setFrameGeometry(JComponent titlePane, Map<String, Object> gm) {
this.frameGeometry = gm;
if (getInt("top_height") == 0 && titlePane != null) {
gm.put("top_height", Integer.valueOf(titlePane.getHeight()));
@@ -1501,7 +1501,7 @@
"name", getStringAttr(frame, "style")
});
if (frame_style != null) {
- Map gm = frameGeometries.get(getStringAttr(frame_style, "geometry"));
+ Map<String, Object> gm = frameGeometries.get(getStringAttr(frame_style, "geometry"));
setFrameGeometry(titlePane, gm);
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/XColors.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/XColors.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -34,7 +34,7 @@
*/
class XColors {
- private static class XColor implements Comparable {
+ private static class XColor implements Comparable<XColor> {
String name;
int red;
@@ -52,10 +52,8 @@
return new ColorUIResource(red, green, blue);
}
- public int compareTo(Object o) {
- XColor other = (XColor)o;
-
- return name.compareTo(other.name);
+ public int compareTo(XColor o) {
+ return name.compareTo(o.name);
}
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifComboBoxUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifComboBoxUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -97,7 +97,7 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class MotifComboPopup extends BasicComboPopup {
- public MotifComboPopup( JComboBox comboBox ) {
+ public MotifComboPopup( JComboBox<Object> comboBox ) {
super( comboBox );
}
@@ -177,7 +177,7 @@
}
public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) {
- ListCellRenderer renderer = comboBox.getRenderer();
+ ListCellRenderer<Object> renderer = comboBox.getRenderer();
Component c;
Dimension d;
c = renderer.getListCellRendererComponent(listBox, comboBox.getSelectedItem(), -1, false, false);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -342,7 +342,7 @@
leftPanel.add(l);
@SuppressWarnings("serial") // anonymous class
- JComboBox tmp2 = new JComboBox<FileFilter>() {
+ JComboBox<FileFilter> tmp2 = new JComboBox<FileFilter>() {
public Dimension getMaximumSize() {
Dimension d = super.getMaximumSize();
d.height = getPreferredSize().height;
@@ -655,7 +655,7 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class FileCellRenderer extends DefaultListCellRenderer {
- public Component getListCellRendererComponent(JList list, Object value, int index,
+ public Component getListCellRendererComponent(JList<?> list, Object value, int index,
boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@@ -667,7 +667,7 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DirectoryCellRenderer extends DefaultListCellRenderer {
- public Component getListCellRendererComponent(JList list, Object value, int index,
+ public Component getListCellRendererComponent(JList<?> list, Object value, int index,
boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@@ -778,7 +778,7 @@
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class FilterComboBoxRenderer extends DefaultListCellRenderer {
- public Component getListCellRendererComponent(JList list,
+ public Component getListCellRendererComponent(JList<?> list,
Object value, int index, boolean isSelected,
boolean cellHasFocus) {
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -130,11 +130,14 @@
//one second seems plausible value
duration = 1000;
} else {
- duration = XPStyle.getXP().getThemeTransitionDuration(
- c, part,
- normalizeState(oldState),
- normalizeState(newState),
- Prop.TRANSITIONDURATIONS);
+ XPStyle xp = XPStyle.getXP();
+ duration = (xp != null)
+ ? xp.getThemeTransitionDuration(
+ c, part,
+ normalizeState(oldState),
+ normalizeState(newState),
+ Prop.TRANSITIONDURATIONS)
+ : 1000;
}
controller.startAnimation(c, part, oldState, newState, duration);
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -102,7 +102,7 @@
private static void updateAllUIs() {
// Check if the current UI is WindowsLookAndfeel and flush the XP style map.
// Note: Change the package test if this class is moved to a different package.
- Class uiClass = UIManager.getLookAndFeel().getClass();
+ Class<?> uiClass = UIManager.getLookAndFeel().getClass();
if (uiClass.getPackage().equals(DesktopProperty.class.getPackage())) {
XPStyle.invalidateStyle();
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/TMSchema.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/TMSchema.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -446,7 +446,7 @@
initStates();
}
- Enum[] states = stateMap.get(part);
+ Enum<?>[] states = stateMap.get(part);
if (states != null) {
for (int i = 0; i < states.length; i++) {
if (state == states[i]) {
@@ -504,10 +504,10 @@
TRANSITIONDURATIONS(Integer.class, 6000);
- private final Class type;
+ private final Class<?> type;
private final int value;
- private Prop(Class type, int value) {
+ private Prop(Class<?> type, int value) {
this.type = type;
this.value = value;
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -37,6 +37,7 @@
import static com.sun.java.swing.plaf.windows.TMSchema.Part;
import static com.sun.java.swing.plaf.windows.TMSchema.State;
import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
+
import sun.swing.DefaultLookup;
import sun.swing.StringUIClientPropertyKey;
@@ -60,7 +61,7 @@
private static final MouseListener rolloverListener =
new MouseAdapter() {
private void handleRollover(MouseEvent e, boolean isRollover) {
- JComboBox comboBox = getComboBox(e);
+ JComboBox<?> comboBox = getComboBox(e);
WindowsComboBoxUI comboBoxUI = getWindowsComboBoxUI(e);
if (comboBox == null || comboBoxUI == null) {
return;
@@ -88,9 +89,9 @@
handleRollover(e, false);
}
- private JComboBox getComboBox(MouseEvent event) {
+ private JComboBox<?> getComboBox(MouseEvent event) {
Object source = event.getSource();
- JComboBox rv = null;
+ JComboBox<?> rv = null;
if (source instanceof JComboBox) {
rv = (JComboBox) source;
} else if (source instanceof XPComboBoxButton) {
@@ -101,7 +102,7 @@
}
private WindowsComboBoxUI getWindowsComboBoxUI(MouseEvent event) {
- JComboBox comboBox = getComboBox(event);
+ JComboBox<?> comboBox = getComboBox(event);
WindowsComboBoxUI rv = null;
if (comboBox != null
&& comboBox.getUI() instanceof WindowsComboBoxUI) {
@@ -122,7 +123,7 @@
&& (source = e.getSource()) instanceof JComboBox
&& ((JComboBox) source).getUI() instanceof
WindowsComboBoxUI) {
- JComboBox comboBox = (JComboBox) source;
+ JComboBox<?> comboBox = (JComboBox) source;
WindowsComboBoxUI comboBoxUI = (WindowsComboBoxUI) comboBox.getUI();
if (comboBoxUI.arrowButton instanceof XPComboBoxButton) {
((XPComboBoxButton) comboBoxUI.arrowButton).setPart(
@@ -231,6 +232,9 @@
private void paintXPComboBoxBackground(Graphics g, JComponent c) {
XPStyle xp = XPStyle.getXP();
+ if (xp == null) {
+ return;
+ }
State state = getXPComboBoxState(c);
Skin skin = null;
if (! comboBox.isEditable()
@@ -273,7 +277,7 @@
// color for currentValue is the same as for any other item
// mostly copied from javax.swing.plaf.basic.BasicComboBoxUI.paintCurrentValue
- ListCellRenderer renderer = comboBox.getRenderer();
+ ListCellRenderer<Object> renderer = comboBox.getRenderer();
Component c;
if ( hasFocus && !isPopupVisible(comboBox) ) {
c = renderer.getListCellRendererComponent(
@@ -384,7 +388,7 @@
* @since 1.6
*/
@Override
- protected ListCellRenderer createRenderer() {
+ protected ListCellRenderer<Object> createRenderer() {
XPStyle xp = XPStyle.getXP();
if (xp != null && xp.isSkinDefined(comboBox, Part.CP_READONLY)) {
return new WindowsComboBoxRenderer();
@@ -400,8 +404,9 @@
* @return a button which represents the popup control
*/
protected JButton createArrowButton() {
- if (XPStyle.getXP() != null) {
- return new XPComboBoxButton();
+ XPStyle xp = XPStyle.getXP();
+ if (xp != null) {
+ return new XPComboBoxButton(xp);
} else {
return super.createArrowButton();
}
@@ -409,9 +414,9 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
private class XPComboBoxButton extends XPStyle.GlyphButton {
- public XPComboBoxButton() {
+ public XPComboBoxButton(XPStyle xp) {
super(null,
- (! XPStyle.getXP().isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
+ (! xp.isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
? Part.CP_DROPDOWNBUTTON
: (comboBox.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
? Part.CP_DROPDOWNBUTTONLEFT
@@ -424,10 +429,11 @@
protected State getState() {
State rv;
rv = super.getState();
+ XPStyle xp = XPStyle.getXP();
if (rv != State.DISABLED
&& comboBox != null && ! comboBox.isEditable()
- && XPStyle.getXP().isSkinDefined(comboBox,
- Part.CP_DROPDOWNBUTTONRIGHT)) {
+ && xp != null && xp.isSkinDefined(comboBox,
+ Part.CP_DROPDOWNBUTTONRIGHT)) {
/*
* for non editable ComboBoxes Vista seems to have the
* same glyph for all non DISABLED states
@@ -463,7 +469,7 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class WindowsComboPopup extends BasicComboPopup {
- public WindowsComboPopup( JComboBox cBox ) {
+ public WindowsComboPopup( JComboBox<Object> cBox ) {
super( cBox );
}
@@ -523,7 +529,7 @@
*/
@Override
public Component getListCellRendererComponent(
- JList list,
+ JList<?> list,
Object value,
int index,
boolean isSelected,
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -191,7 +191,7 @@
return WindowsFileChooserUI.this.getNewFolderAction();
}
- public MouseListener createDoubleClickListener(JList list) {
+ public MouseListener createDoubleClickListener(JList<?> list) {
return WindowsFileChooserUI.this.createDoubleClickListener(getFileChooser(),
list);
}
@@ -994,7 +994,7 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
class DirectoryComboBoxRenderer extends DefaultListCellRenderer {
IndentIcon ii = new IndentIcon();
- public Component getListCellRendererComponent(JList list, Object value,
+ public Component getListCellRendererComponent(JList<?> list, Object value,
int index, boolean isSelected,
boolean cellHasFocus) {
@@ -1184,7 +1184,7 @@
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class FilterComboBoxRenderer extends DefaultListCellRenderer {
- public Component getListCellRendererComponent(JList list,
+ public Component getListCellRendererComponent(JList<?> list,
Object value, int index, boolean isSelected,
boolean cellHasFocus) {
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -125,6 +125,9 @@
static void paintXPText(AbstractButton b, Part part, State state,
Graphics g, int x, int y, String text, int mnemIndex) {
XPStyle xp = XPStyle.getXP();
+ if (xp == null) {
+ return;
+ }
Color textColor = b.getForeground();
if (textColor instanceof UIResource) {
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java Fri Jul 25 09:44:53 2014 +0000
@@ -623,8 +623,8 @@
@SuppressWarnings("serial") // Same-version serialization only
private static class MenuArrowIcon implements Icon, UIResource, Serializable {
public void paintIcon(Component c, Graphics g, int x, int y) {
- if (WindowsMenuItemUI.isVistaPainting()) {
- XPStyle xp = XPStyle.getXP();
+ XPStyle xp = XPStyle.getXP();
+ if (WindowsMenuItemUI.isVistaPainting(xp)) {
State state = State.NORMAL;
if (c instanceof JMenuItem) {
state = ((JMenuItem) c).getModel().isEnabled()
@@ -657,16 +657,18 @@
}
}
public int getIconWidth() {
- if (WindowsMenuItemUI.isVistaPainting()) {
- Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
+ XPStyle xp = XPStyle.getXP();
+ if (WindowsMenuItemUI.isVistaPainting(xp)) {
+ Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
return skin.getWidth();
} else {
return 4;
}
}
public int getIconHeight() {
- if (WindowsMenuItemUI.isVistaPainting()) {
- Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
+ XPStyle xp = XPStyle.getXP();
+ if (WindowsMenuItemUI.isVistaPainting(xp)) {
+ Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
return skin.getHeight();
} else {
return 8;
@@ -692,7 +694,8 @@
}
static int getIconWidth() {
- return XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK).getWidth()
+ XPStyle xp = XPStyle.getXP();
+ return ((xp != null) ? xp.getSkin(null, Part.MP_POPUPCHECK).getWidth() : 16)
+ 2 * OFFSET;
}
@@ -756,12 +759,17 @@
Icon icon = getIcon();
int height = 0;
if (icon != null) {
- height = icon.getIconHeight() + 2 * OFFSET;
+ height = icon.getIconHeight();
} else {
- Skin skin =
- XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK);
- height = skin.getHeight() + 2 * OFFSET;
+ XPStyle xp = XPStyle.getXP();
+ if (xp != null) {
+ Skin skin = xp.getSkin(null, Part.MP_POPUPCHECK);
+ height = skin.getHeight();
+ } else {
+ height = 16;
+ }
}
+ height += 2 * OFFSET;
return height;
}
@@ -809,14 +817,16 @@
? State.BULLETDISABLED
: State.CHECKMARKDISABLED;
}
- Skin skin;
XPStyle xp = XPStyle.getXP();
- skin = xp.getSkin(c, backgroundPart);
- skin.paintSkin(g, x, y,
- getIconWidth(), getIconHeight(), backgroundState);
- if (icon == null) {
- skin = xp.getSkin(c, part);
- skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
+ if (xp != null) {
+ Skin skin;
+ skin = xp.getSkin(c, backgroundPart);
+ skin.paintSkin(g, x, y,
+ getIconWidth(), getIconHeight(), backgroundState);
+ if (icon == null) {
+ skin = xp.getSkin(c, part);
+ skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
+ }
}
}
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -86,14 +86,15 @@
}
} else {
buttonWidth += 2;
- selectedTitleGradientColor =
- UIManager.getColor("InternalFrame.activeTitleGradient");
- notSelectedTitleGradientColor =
- UIManager.getColor("InternalFrame.inactiveTitleGradient");
Color activeBorderColor =
UIManager.getColor("InternalFrame.activeBorderColor");
setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
}
+ // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
+ selectedTitleGradientColor =
+ UIManager.getColor("InternalFrame.activeTitleGradient");
+ notSelectedTitleGradientColor =
+ UIManager.getColor("InternalFrame.inactiveTitleGradient");
}
protected void uninstallListeners() {
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Fri Jul 25 09:44:53 2014 +0000
@@ -2326,8 +2326,9 @@
}
public Object getXPValue(UIDefaults table) {
- Border xpBorder = XPStyle.getXP().getBorder(null, (Part)xpValue);
- if (extraMargin != null) {
+ XPStyle xp = XPStyle.getXP();
+ Border xpBorder = xp != null ? xp.getBorder(null, (Part)xpValue) : null;
+ if (xpBorder != null && extraMargin != null) {
return new BorderUIResource.
CompoundBorderUIResource(xpBorder, extraMargin);
} else {
@@ -2343,7 +2344,8 @@
public Object getXPValue(UIDefaults table) {
XPColorValueKey key = (XPColorValueKey)xpValue;
- return XPStyle.getXP().getColor(key.skin, key.prop, null);
+ XPStyle xp = XPStyle.getXP();
+ return xp != null ? xp.getColor(key.skin, key.prop, null) : null;
}
private static class XPColorValueKey {
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -156,8 +156,8 @@
@Override
public void paint(Graphics g, JComponent c) {
- if (WindowsMenuItemUI.isVistaPainting()) {
- XPStyle xp = XPStyle.getXP();
+ XPStyle xp = XPStyle.getXP();
+ if (WindowsMenuItemUI.isVistaPainting(xp)) {
Skin skin;
skin = xp.getSkin(c, Part.MP_BARBACKGROUND);
int width = c.getWidth();
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -108,8 +108,9 @@
static void paintBackground(WindowsMenuItemUIAccessor menuItemUI,
Graphics g, JMenuItem menuItem, Color bgColor) {
- assert isVistaPainting();
- if (isVistaPainting()) {
+ XPStyle xp = XPStyle.getXP();
+ assert isVistaPainting(xp);
+ if (isVistaPainting(xp)) {
int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight();
if (menuItem.isOpaque()) {
@@ -118,7 +119,6 @@
g.fillRect(0,0, menuWidth, menuHeight);
g.setColor(oldColor);
}
- XPStyle xp = XPStyle.getXP();
Part part = menuItemUI.getPart(menuItem);
Skin skin = xp.getSkin(menuItem, part);
skin.paintSkin(g, 0 , 0,
@@ -170,8 +170,11 @@
* is it possible that in some theme some Vista parts are not defined while
* others are?
*/
- static boolean isVistaPainting() {
- XPStyle xp = XPStyle.getXP();
+ static boolean isVistaPainting(final XPStyle xp) {
return xp != null && xp.isSkinDefined(null, Part.MP_POPUPITEM);
}
+
+ static boolean isVistaPainting() {
+ return isVistaPainting(XPStyle.getXP());
+ }
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -50,7 +50,8 @@
public void paint(Graphics g, JComponent c) {
Dimension s = c.getSize();
- if (WindowsMenuItemUI.isVistaPainting()) {
+ XPStyle xp = XPStyle.getXP();
+ if (WindowsMenuItemUI.isVistaPainting(xp)) {
int x = 1;
Component parent = c.getParent();
if (parent instanceof JComponent) {
@@ -67,7 +68,7 @@
x += WindowsPopupMenuUI.getGutterWidth();
}
}
- Skin skin = XPStyle.getXP().getSkin(c, Part.MP_POPUPSEPARATOR);
+ Skin skin = xp.getSkin(c, Part.MP_POPUPSEPARATOR);
int skinHeight = skin.getHeight();
int y = (s.height - skinHeight) / 2;
skin.paintSkin(g, x, y, s.width - x - 1, skinHeight, State.NORMAL);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -194,8 +194,8 @@
@Override
public void paint(Graphics g, JComponent c) {
- if (WindowsMenuItemUI.isVistaPainting()) {
- XPStyle xp = XPStyle.getXP();
+ XPStyle xp = XPStyle.getXP();
+ if (WindowsMenuItemUI.isVistaPainting(xp)) {
Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
int textOffset = getTextOffset(c);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -322,8 +322,9 @@
private Rectangle getFullChunkBounds(Rectangle box) {
boolean vertical = (progressBar.getOrientation() == JProgressBar.VERTICAL);
XPStyle xp = XPStyle.getXP();
- int gap = xp.getInt(progressBar, Part.PP_PROGRESS, null,
- Prop.PROGRESSSPACESIZE, 0);
+ int gap = (xp != null) ? xp.getInt(progressBar, Part.PP_PROGRESS,
+ null, Prop.PROGRESSSPACESIZE, 0)
+ : 0;
if (!vertical) {
int chunksize = box.width+gap;
@@ -338,6 +339,9 @@
boolean vertical,
int bgwidth, int bgheight) {
XPStyle xp = XPStyle.getXP();
+ if (xp == null) {
+ return;
+ }
// create a new graphics to keep drawing surface state
Graphics2D gfx = (Graphics2D)g.create();
@@ -396,6 +400,9 @@
private void paintXPBackground(Graphics g, boolean vertical,
int barRectWidth, int barRectHeight) {
XPStyle xp = XPStyle.getXP();
+ if (xp == null) {
+ return;
+ }
Part part = vertical ? Part.PP_BARVERT : Part.PP_BAR;
Skin skin = xp.getSkin(progressBar, part);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -215,7 +215,6 @@
}
private Part getXPThumbPart() {
- XPStyle xp = XPStyle.getXP();
Part part;
boolean vertical = (slider.getOrientation() == JSlider.VERTICAL);
boolean leftToRight = slider.getComponentOrientation().isLeftToRight();
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -63,6 +63,9 @@
private void paintXPBackground(Graphics g, JComponent c) {
XPStyle xp = XPStyle.getXP();
+ if (xp == null) {
+ return;
+ }
Skin skin = xp.getSkin(c, Part.EP_EDIT);
State state = getXPState(c);
skin.paintSkin(g, 0, 0, c.getWidth(), c.getHeight(), state);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -91,9 +91,10 @@
this.column = column;
this.hasRollover = (column == getRolloverColumn());
if (skin == null) {
- skin = XPStyle.getXP().getSkin(header, Part.HP_HEADERITEM);
+ XPStyle xp = XPStyle.getXP();
+ skin = (xp != null) ? xp.getSkin(header, Part.HP_HEADERITEM) : null;
}
- Insets margins = skin.getContentMargin();
+ Insets margins = (skin != null) ? skin.getContentMargin() : null;
Border border = null;
int contentTop = 0;
int contentLeft = 0;
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java Fri Jul 25 09:44:53 2014 +0000
@@ -115,7 +115,7 @@
}
}
}
- return xp;
+ return ThemeReader.isXPStyleEnabled() ? xp : null;
}
static boolean isVista() {
@@ -180,9 +180,10 @@
* should probably be cached there instead of here.
*/
Dimension getDimension(Component c, Part part, State state, Prop prop) {
- return ThemeReader.getPosition(part.getControlName(c), part.getValue(),
- State.getValue(part, state),
- prop.getValue());
+ Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
+ State.getValue(part, state),
+ prop.getValue());
+ return (d != null) ? d : new Dimension();
}
/** Get a named <code>Point</code> (e.g. a location or an offset) value
@@ -199,11 +200,7 @@
Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
State.getValue(part, state),
prop.getValue());
- if (d != null) {
- return new Point(d.width, d.height);
- } else {
- return null;
- }
+ return (d != null) ? new Point(d.width, d.height) : new Point();
}
/** Get a named <code>Insets</code> value from the current style
@@ -217,9 +214,10 @@
* The return value is already cached in those places.
*/
Insets getMargin(Component c, Part part, State state, Prop prop) {
- return ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
- State.getValue(part, state),
- prop.getValue());
+ Insets insets = ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
+ State.getValue(part, state),
+ prop.getValue());
+ return (insets != null) ? insets : new Insets(0, 0, 0, 0);
}
@@ -349,7 +347,7 @@
// special casing for comboboxes.
// there may be more special cases in the future
if(c instanceof JComboBox) {
- JComboBox cb = (JComboBox)c;
+ JComboBox<?> cb = (JComboBox)c;
// note. in the future this should be replaced with a call
// to BasicLookAndFeel.getUIOfType()
if(cb.getUI() instanceof WindowsComboBoxUI) {
@@ -509,16 +507,17 @@
int boundingWidth = 100;
int boundingHeight = 100;
- return ThemeReader.getThemeBackgroundContentMargins(
+ Insets insets = ThemeReader.getThemeBackgroundContentMargins(
part.getControlName(null), part.getValue(),
0, boundingWidth, boundingHeight);
+ return (insets != null) ? insets : new Insets(0, 0, 0, 0);
}
private int getWidth(State state) {
if (size == null) {
size = getPartSize(part, state);
}
- return size.width;
+ return (size != null) ? size.width : 0;
}
int getWidth() {
@@ -529,7 +528,7 @@
if (size == null) {
size = getPartSize(part, state);
}
- return size.height;
+ return (size != null) ? size.height : 0;
}
int getHeight() {
@@ -586,6 +585,9 @@
* @param state which state to paint
*/
void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
+ if (XPStyle.getXP() == null) {
+ return;
+ }
if (ThemeReader.isGetThemeTransitionDurationDefined()
&& component instanceof JComponent
&& SwingUtilities.getAncestorOfClass(CellRendererPane.class,
@@ -611,6 +613,9 @@
* @param state which state to paint
*/
void paintSkinRaw(Graphics g, int dx, int dy, int dw, int dh, State state) {
+ if (XPStyle.getXP() == null) {
+ return;
+ }
skinPainter.paint(null, g, dx, dy, dw, dh, this, state);
}
@@ -629,6 +634,9 @@
*/
void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state,
boolean borderFill) {
+ if (XPStyle.getXP() == null) {
+ return;
+ }
if(borderFill && "borderfill".equals(getTypeEnumName(component, part,
state, Prop.BGTYPE))) {
return;
@@ -684,7 +692,7 @@
public GlyphButton(Component parent, Part part) {
XPStyle xp = getXP();
- skin = xp.getSkin(parent, part);
+ skin = xp != null ? xp.getSkin(parent, part) : null;
setBorder(null);
setContentAreaFilled(false);
setMinimumSize(new Dimension(5, 5));
@@ -709,13 +717,16 @@
}
public void paintComponent(Graphics g) {
+ if (XPStyle.getXP() == null || skin == null) {
+ return;
+ }
Dimension d = getSize();
skin.paintSkin(g, 0, 0, d.width, d.height, getState());
}
public void setPart(Component parent, Part part) {
XPStyle xp = getXP();
- skin = xp.getSkin(parent, part);
+ skin = xp != null ? xp.getSkin(parent, part) : null;
revalidate();
repaint();
}
--- a/jdk/src/share/classes/com/sun/jmx/remote/security/SubjectDelegator.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jmx/remote/security/SubjectDelegator.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -34,22 +34,14 @@
import javax.management.remote.SubjectDelegationPermission;
-import com.sun.jmx.remote.util.CacheMap;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.*;
public class SubjectDelegator {
- private static final int PRINCIPALS_CACHE_SIZE = 10;
- private static final int ACC_CACHE_SIZE = 10;
-
- private CacheMap<Subject, Principal[]> principalsCache;
- private CacheMap<Subject, AccessControlContext> accCache;
-
/* Return the AccessControlContext appropriate to execute an
operation on behalf of the delegatedSubject. If the
authenticatedAccessControlContext does not have permission to
delegate to that subject, throw SecurityException. */
- public synchronized AccessControlContext
+ public AccessControlContext
delegatedContext(AccessControlContext authenticatedACC,
Subject delegatedSubject,
boolean removeCallerContext)
@@ -58,56 +50,14 @@
if (System.getSecurityManager() != null && authenticatedACC == null) {
throw new SecurityException("Illegal AccessControlContext: null");
}
- if (principalsCache == null || accCache == null) {
- principalsCache =
- new CacheMap<>(PRINCIPALS_CACHE_SIZE);
- accCache =
- new CacheMap<>(ACC_CACHE_SIZE);
- }
-
- // Retrieve the principals for the given
- // delegated subject from the cache
- //
- Principal[] delegatedPrincipals = principalsCache.get(delegatedSubject);
-
- // Convert the set of principals stored in the
- // delegated subject into an array of principals
- // and store it in the cache
- //
- if (delegatedPrincipals == null) {
- delegatedPrincipals =
- delegatedSubject.getPrincipals().toArray(new Principal[0]);
- principalsCache.put(delegatedSubject, delegatedPrincipals);
- }
-
- // Retrieve the access control context for the
- // given delegated subject from the cache
- //
- AccessControlContext delegatedACC = accCache.get(delegatedSubject);
-
- // Build the access control context to be used
- // when executing code as the delegated subject
- // and store it in the cache
- //
- if (delegatedACC == null) {
- if (removeCallerContext) {
- delegatedACC =
- JMXSubjectDomainCombiner.getDomainCombinerContext(
- delegatedSubject);
- } else {
- delegatedACC =
- JMXSubjectDomainCombiner.getContext(delegatedSubject);
- }
- accCache.put(delegatedSubject, delegatedACC);
- }
// Check if the subject delegation permission allows the
// authenticated subject to assume the identity of each
// principal in the delegated subject
//
- final Principal[] dp = delegatedPrincipals;
- final Collection<Permission> permissions = new ArrayList<>(dp.length);
- for(Principal p : dp) {
+ Collection<Principal> ps = getSubjectPrincipals(delegatedSubject);
+ final Collection<Permission> permissions = new ArrayList<>(ps.size());
+ for(Principal p : ps) {
final String pname = p.getClass().getName() + "." + p.getName();
permissions.add(new SubjectDelegationPermission(pname));
}
@@ -122,7 +72,15 @@
};
AccessController.doPrivileged(action, authenticatedACC);
- return delegatedACC;
+ return getDelegatedAcc(delegatedSubject, removeCallerContext);
+ }
+
+ private AccessControlContext getDelegatedAcc(Subject delegatedSubject, boolean removeCallerContext) {
+ if (removeCallerContext) {
+ return JMXSubjectDomainCombiner.getDomainCombinerContext(delegatedSubject);
+ } else {
+ return JMXSubjectDomainCombiner.getContext(delegatedSubject);
+ }
}
/**
@@ -137,11 +95,9 @@
public static synchronized boolean
checkRemoveCallerContext(Subject subject) {
try {
- final Principal[] dp =
- subject.getPrincipals().toArray(new Principal[0]);
- for (int i = 0 ; i < dp.length ; i++) {
+ for (Principal p : getSubjectPrincipals(subject)) {
final String pname =
- dp[i].getClass().getName() + "." + dp[i].getName();
+ p.getClass().getName() + "." + p.getName();
final Permission sdp =
new SubjectDelegationPermission(pname);
AccessController.checkPermission(sdp);
@@ -151,4 +107,19 @@
}
return true;
}
+
+ /**
+ * Retrieves the {@linkplain Subject} principals
+ * @param subject The subject
+ * @return If the {@code Subject} is immutable it will return the principals directly.
+ * If the {@code Subject} is mutable it will create an unmodifiable copy.
+ */
+ private static Collection<Principal> getSubjectPrincipals(Subject subject) {
+ if (subject.isReadOnly()) {
+ return subject.getPrincipals();
+ }
+
+ List<Principal> principals = Arrays.asList(subject.getPrincipals().toArray(new Principal[0]));
+ return Collections.unmodifiableList(principals);
+ }
}
--- a/jdk/src/share/classes/com/sun/jmx/remote/util/CacheMap.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2003, 2006, 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 com.sun.jmx.remote.util;
-
-import java.lang.ref.SoftReference;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.WeakHashMap;
-
-import com.sun.jmx.mbeanserver.Util;
-
-/**
- * <p>Like WeakHashMap, except that the keys of the <em>n</em> most
- * recently-accessed entries are kept as {@link SoftReference soft
- * references}. Accessing an element means creating it, or retrieving
- * it with {@link #get(Object) get}. Because these entries are kept
- * with soft references, they will tend to remain even if their keys
- * are not referenced elsewhere. But if memory is short, they will
- * be removed.</p>
- */
-public class CacheMap<K, V> extends WeakHashMap<K, V> {
- /**
- * <p>Create a <code>CacheMap</code> that can keep up to
- * <code>nSoftReferences</code> as soft references.</p>
- *
- * @param nSoftReferences Maximum number of keys to keep as soft
- * references. Access times for {@link #get(Object) get} and
- * {@link #put(Object, Object) put} have a component that scales
- * linearly with <code>nSoftReferences</code>, so this value
- * should not be too great.
- *
- * @throws IllegalArgumentException if
- * <code>nSoftReferences</code> is negative.
- */
- public CacheMap(int nSoftReferences) {
- if (nSoftReferences < 0) {
- throw new IllegalArgumentException("nSoftReferences = " +
- nSoftReferences);
- }
- this.nSoftReferences = nSoftReferences;
- }
-
- public V put(K key, V value) {
- cache(key);
- return super.put(key, value);
- }
-
- public V get(Object key) {
- cache(Util.<K>cast(key));
- return super.get(key);
- }
-
- /* We don't override remove(Object) or try to do something with
- the map's iterators to detect removal. So we may keep useless
- entries in the soft reference list for keys that have since
- been removed. The assumption is that entries are added to the
- cache but never removed. But the behavior is not wrong if
- they are in fact removed -- the caching is just less
- performant. */
-
- private void cache(K key) {
- Iterator<SoftReference<K>> it = cache.iterator();
- while (it.hasNext()) {
- SoftReference<K> sref = it.next();
- K key1 = sref.get();
- if (key1 == null)
- it.remove();
- else if (key.equals(key1)) {
- // Move this element to the head of the LRU list
- it.remove();
- cache.add(0, sref);
- return;
- }
- }
-
- int size = cache.size();
- if (size == nSoftReferences) {
- if (size == 0)
- return; // degenerate case, equivalent to WeakHashMap
- it.remove();
- }
-
- cache.add(0, new SoftReference<K>(key));
- }
-
- /* List of soft references for the most-recently referenced keys.
- The list is in most-recently-used order, i.e. the first element
- is the most-recently referenced key. There are never more than
- nSoftReferences elements of this list.
-
- If we didn't care about J2SE 1.3 compatibility, we could use
- LinkedHashSet in conjunction with a subclass of SoftReference
- whose equals and hashCode reflect the referent. */
- private final LinkedList<SoftReference<K>> cache =
- new LinkedList<SoftReference<K>>();
- private final int nSoftReferences;
-}
--- a/jdk/src/share/classes/com/sun/jmx/snmp/EnumRowStatus.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/EnumRowStatus.java Fri Jul 25 09:44:53 2014 +0000
@@ -284,20 +284,20 @@
final static Hashtable<Integer, String> intTable = new Hashtable<>();
final static Hashtable<String, Integer> stringTable = new Hashtable<>();
static {
- intTable.put(new Integer(0), "unspecified");
- intTable.put(new Integer(3), "notReady");
- intTable.put(new Integer(6), "destroy");
- intTable.put(new Integer(2), "notInService");
- intTable.put(new Integer(5), "createAndWait");
- intTable.put(new Integer(1), "active");
- intTable.put(new Integer(4), "createAndGo");
- stringTable.put("unspecified", new Integer(0));
- stringTable.put("notReady", new Integer(3));
- stringTable.put("destroy", new Integer(6));
- stringTable.put("notInService", new Integer(2));
- stringTable.put("createAndWait", new Integer(5));
- stringTable.put("active", new Integer(1));
- stringTable.put("createAndGo", new Integer(4));
+ intTable.put(0, "unspecified");
+ intTable.put(3, "notReady");
+ intTable.put(6, "destroy");
+ intTable.put(2, "notInService");
+ intTable.put(5, "createAndWait");
+ intTable.put(1, "active");
+ intTable.put(4, "createAndGo");
+ stringTable.put("unspecified", 0);
+ stringTable.put("notReady", 3);
+ stringTable.put("destroy", 6);
+ stringTable.put("notInService", 2);
+ stringTable.put("createAndWait", 5);
+ stringTable.put("active", 1);
+ stringTable.put("createAndGo", 4);
}
--- a/jdk/src/share/classes/com/sun/jmx/snmp/Enumerated.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/Enumerated.java Fri Jul 25 09:44:53 2014 +0000
@@ -71,7 +71,7 @@
* the method is illegal or inappropriate.
*/
public Enumerated(int valueIndex) throws IllegalArgumentException {
- if (getIntTable().get(new Integer(valueIndex)) == null) {
+ if (getIntTable().get(valueIndex) == null) {
throw new IllegalArgumentException() ;
}
value = valueIndex ;
@@ -181,7 +181,7 @@
*/
@Override
public String toString() {
- return getIntTable().get(new Integer(value)) ;
+ return getIntTable().get(value);
}
--- a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java Fri Jul 25 09:44:53 2014 +0000
@@ -100,7 +100,7 @@
void openNodeScope(Node n) {
- marks.push(new Integer(mk));
+ marks.push(mk);
mk = sp;
n.jjtOpen();
}
--- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java Fri Jul 25 09:44:53 2014 +0000
@@ -100,7 +100,7 @@
* @return The <CODE>Integer</CODE> representation of the value.
*/
public Integer toInteger() {
- return new Integer((int)value) ;
+ return (int)value;
}
/**
--- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpInt.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpInt.java Fri Jul 25 09:44:53 2014 +0000
@@ -146,7 +146,7 @@
* @return The <CODE>Integer</CODE> representation of the value.
*/
public Integer toInteger() {
- return new Integer((int)value) ;
+ return (int)value;
}
/**
--- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java Fri Jul 25 09:44:53 2014 +0000
@@ -1272,8 +1272,8 @@
message, // message
"State", // attribute name
"int", // attribute type
- new Integer(oldState), // old value
- new Integer(newState) ); // new value
+ oldState, // old value
+ newState ); // new value
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag,
"sendStateChangeNotification","Sending AttributeChangeNotification #"
--- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java Fri Jul 25 09:44:53 2014 +0000
@@ -569,7 +569,7 @@
*/
@Override
public Integer getTrapPort() {
- return new Integer(trapPort) ;
+ return trapPort;
}
/**
@@ -639,7 +639,7 @@
*/
@Override
public Integer getBufferSize() {
- return new Integer(bufferSize) ;
+ return bufferSize;
}
/**
--- a/jdk/src/share/classes/com/sun/jmx/snmp/internal/SnmpLcd.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/internal/SnmpLcd.java Fri Jul 25 09:44:53 2014 +0000
@@ -43,15 +43,15 @@
public void addModelLcd(int id,
SnmpModelLcd usmlcd) {
- models.put(new Integer(id), usmlcd);
+ models.put(id, usmlcd);
}
public SnmpModelLcd getModelLcd(int id) {
- return models.get(new Integer(id));
+ return models.get(id);
}
public SnmpModelLcd removeModelLcd(int id) {
- return models.remove(new Integer(id));
+ return models.remove(id);
}
}
--- a/jdk/src/share/classes/com/sun/jndi/cosnaming/RemoteToCorba.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jndi/cosnaming/RemoteToCorba.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -71,17 +71,10 @@
if (orig instanceof Remote) {
// Turn remote object into org.omg.CORBA.Object
- try {
- // Returns null if JRMP; let next factory try
- // CNCtx will eventually throw IllegalArgumentException if
- // no CORBA object gotten
- return
- CorbaUtils.remoteToCorba((Remote)orig, ((CNCtx)ctx)._orb);
- } catch (ClassNotFoundException e) {
- // RMI-IIOP library not available
- throw new ConfigurationException(
- "javax.rmi packages not available");
- }
+ // Returns null if JRMP; let next factory try
+ // CNCtx will eventually throw IllegalArgumentException if
+ // no CORBA object gotten
+ return CorbaUtils.remoteToCorba((Remote)orig, ((CNCtx)ctx)._orb);
}
return null; // pass and let next state factory try
}
--- a/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -86,9 +86,8 @@
try {
Class<?> socketFactoryClass =
Obj.helper.loadClass(socketFactory);
- Class<?> objClass = Class.forName("java.lang.Object");
this.sockComparator = socketFactoryClass.getMethod(
- "compare", new Class<?>[]{objClass, objClass});
+ "compare", new Class<?>[]{Object.class, Object.class});
Method getDefault = socketFactoryClass.getMethod(
"getDefault", new Class<?>[]{});
this.factory =
--- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Fri Jul 25 09:44:53 2014 +0000
@@ -31,6 +31,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.InputStream;
+import java.net.InetSocketAddress;
import java.net.Socket;
import javax.net.ssl.SSLSocket;
@@ -42,11 +43,10 @@
import javax.naming.ldap.Control;
import java.lang.reflect.Method;
-import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import sun.misc.IOUtils;
-//import javax.net.SocketFactory;
+import javax.net.SocketFactory;
/**
* A thread that creates a connection to an LDAP server.
@@ -219,9 +219,7 @@
ce.setRootCause(realException);
throw ce;
} catch (Exception e) {
- // Class.forName() seems to do more error checking
- // and will throw IllegalArgumentException and such.
- // That's why we need to have a catch all here and
+ // We need to have a catch all here and
// ignore generic exceptions.
// Also catches all IO errors generated by socket creation.
CommunicationException ce =
@@ -238,27 +236,8 @@
/*
* Create an InetSocketAddress using the specified hostname and port number.
*/
- private Object createInetSocketAddress(String host, int port)
- throws NoSuchMethodException {
-
- try {
- Class<?> inetSocketAddressClass =
- Class.forName("java.net.InetSocketAddress");
-
- Constructor<?> inetSocketAddressCons =
- inetSocketAddressClass.getConstructor(new Class<?>[]{
- String.class, int.class});
-
- return inetSocketAddressCons.newInstance(new Object[]{
- host, new Integer(port)});
-
- } catch (ClassNotFoundException |
- InstantiationException |
- InvocationTargetException |
- IllegalAccessException e) {
- throw new NoSuchMethodException();
-
- }
+ private InetSocketAddress createInetSocketAddress(String host, int port) {
+ return new InetSocketAddress(host, port);
}
/*
@@ -279,82 +258,57 @@
// create the factory
- Class<?> socketFactoryClass = Obj.helper.loadClass(socketFactory);
+ @SuppressWarnings("unchecked")
+ Class<? extends SocketFactory> socketFactoryClass =
+ (Class<? extends SocketFactory>)Obj.helper.loadClass(socketFactory);
Method getDefault =
socketFactoryClass.getMethod("getDefault", new Class<?>[]{});
- Object factory = getDefault.invoke(null, new Object[]{});
+ SocketFactory factory = (SocketFactory) getDefault.invoke(null, new Object[]{});
// create the socket
- Method createSocket = null;
-
if (connectTimeout > 0) {
- try {
- createSocket = socketFactoryClass.getMethod("createSocket",
- new Class<?>[]{});
+ InetSocketAddress endpoint =
+ createInetSocketAddress(host, port);
- Method connect = Socket.class.getMethod("connect",
- new Class<?>[]{Class.forName("java.net.SocketAddress"),
- int.class});
- Object endpoint = createInetSocketAddress(host, port);
-
- // unconnected socket
- socket =
- (Socket)createSocket.invoke(factory, new Object[]{});
+ // unconnected socket
+ socket = factory.createSocket();
- if (debug) {
- System.err.println("Connection: creating socket with " +
+ if (debug) {
+ System.err.println("Connection: creating socket with " +
"a timeout using supplied socket factory");
- }
+ }
- // connected socket
- connect.invoke(socket, new Object[]{
- endpoint, new Integer(connectTimeout)});
-
- } catch (NoSuchMethodException e) {
- // continue (but ignore connectTimeout)
- }
+ // connected socket
+ socket.connect(endpoint, connectTimeout);
}
+ // continue (but ignore connectTimeout)
if (socket == null) {
- createSocket = socketFactoryClass.getMethod("createSocket",
- new Class<?>[]{String.class, int.class});
-
if (debug) {
System.err.println("Connection: creating socket using " +
"supplied socket factory");
}
// connected socket
- socket = (Socket) createSocket.invoke(factory,
- new Object[]{host, new Integer(port)});
+ socket = factory.createSocket(host, port);
}
} else {
if (connectTimeout > 0) {
- try {
- Constructor<Socket> socketCons =
- Socket.class.getConstructor(new Class<?>[]{});
+ InetSocketAddress endpoint = createInetSocketAddress(host, port);
- Method connect = Socket.class.getMethod("connect",
- new Class<?>[]{Class.forName("java.net.SocketAddress"),
- int.class});
- Object endpoint = createInetSocketAddress(host, port);
-
- socket = socketCons.newInstance(new Object[]{});
+ socket = new Socket();
if (debug) {
System.err.println("Connection: creating socket with " +
"a timeout");
}
- connect.invoke(socket, new Object[]{
- endpoint, new Integer(connectTimeout)});
+ socket.connect(endpoint, connectTimeout);
+ }
- } catch (NoSuchMethodException e) {
- // continue (but ignore connectTimeout)
- }
- }
+ // continue (but ignore connectTimeout)
if (socket == null) {
if (debug) {
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java Fri Jul 25 09:44:53 2014 +0000
@@ -406,7 +406,7 @@
try {
return Integer.getInteger(propName, defVal);
} catch (SecurityException e) {
- return new Integer(defVal);
+ return defVal;
}
}
});
--- a/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -30,32 +30,10 @@
abstract class VersionHelper {
- private static VersionHelper helper = null;
+ private static final VersionHelper helper = new VersionHelper12();
VersionHelper() {} // Disallow anyone from creating one of these.
- static {
- try {
- Class.forName("java.net.URLClassLoader"); // 1.2 test
- Class.forName("java.security.PrivilegedAction"); // 1.2 test
- helper = (VersionHelper)
- Class.forName(
- "com.sun.jndi.ldap.VersionHelper12").newInstance();
- } catch (Exception e) {
- }
-
- // Use 1.1 helper if 1.2 test fails, or if we cannot create 1.2 helper
- if (helper == null) {
- try {
- helper = (VersionHelper)
- Class.forName(
- "com.sun.jndi.ldap.VersionHelper11").newInstance();
- } catch (Exception e) {
- // should never happen
- }
- }
- }
-
static VersionHelper getVersionHelper() {
return helper;
}
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -28,16 +28,18 @@
// Needed for RMI/IIOP
import java.rmi.Remote;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
+import java.rmi.RemoteException;
import java.util.Hashtable;
import java.util.Properties;
import java.util.Enumeration;
+import java.applet.Applet;
import org.omg.CORBA.ORB;
import javax.naming.Context;
import javax.naming.ConfigurationException;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.PortableRemoteObject;
/**
* Contains utilities for performing CORBA-related tasks:
@@ -76,71 +78,43 @@
* @param orb The non-null ORB to connect the remote object to
* @return The CORBA Object for remoteObj; null if <tt>remoteObj</tt>
* is a JRMP implementation or JRMP stub.
- * @exception ClassNotFoundException The RMI-IIOP package is not available
* @exception ConfigurationException The CORBA Object cannot be obtained
* because of configuration problems.
*/
public static org.omg.CORBA.Object remoteToCorba(Remote remoteObj, ORB orb)
- throws ClassNotFoundException, ConfigurationException {
- synchronized (CorbaUtils.class) {
- if (toStubMethod == null) {
- initMethodHandles();
- }
- }
+ throws ConfigurationException {
// First, get remoteObj's stub
// javax.rmi.CORBA.Stub stub = PortableRemoteObject.toStub(remoteObj);
- java.lang.Object stub;
+ Remote stub;
try {
- stub = toStubMethod.invoke(null, new java.lang.Object[]{remoteObj});
-
- } catch (InvocationTargetException e) {
- Throwable realException = e.getTargetException();
- // realException.printStackTrace();
-
+ stub = PortableRemoteObject.toStub(remoteObj);
+ } catch (Throwable t) {
ConfigurationException ce = new ConfigurationException(
"Problem with PortableRemoteObject.toStub(); object not exported or stub not found");
- ce.setRootCause(realException);
- throw ce;
-
- } catch (IllegalAccessException e) {
- ConfigurationException ce = new ConfigurationException(
- "Cannot invoke javax.rmi.PortableRemoteObject.toStub(java.rmi.Remote)");
-
- ce.setRootCause(e);
+ ce.setRootCause(t);
throw ce;
}
// Next, make sure that the stub is javax.rmi.CORBA.Stub
- if (!corbaStubClass.isInstance(stub)) {
+ if (!(stub instanceof Stub)) {
return null; // JRMP implementation or JRMP stub
}
// Next, make sure that the stub is connected
- // Invoke stub.connect(orb)
try {
- connectMethod.invoke(stub, new java.lang.Object[]{orb});
-
- } catch (InvocationTargetException e) {
- Throwable realException = e.getTargetException();
- // realException.printStackTrace();
-
- if (!(realException instanceof java.rmi.RemoteException)) {
- ConfigurationException ce = new ConfigurationException(
- "Problem invoking javax.rmi.CORBA.Stub.connect()");
- ce.setRootCause(realException);
- throw ce;
- }
+ ((Stub) stub).connect(orb);
+ } catch (RemoteException e) {
// ignore RemoteException because stub might have already
// been connected
- } catch (IllegalAccessException e) {
+ } catch (Throwable t) {
ConfigurationException ce = new ConfigurationException(
- "Cannot invoke javax.rmi.CORBA.Stub.connect()");
- ce.setRootCause(e);
+ "Problem invoking javax.rmi.CORBA.Stub.connect()");
+ ce.setRootCause(t);
throw ce;
}
// Finally, return stub
@@ -192,83 +166,13 @@
// Get Applet from environment
if (env != null) {
- Object applet = env.get(Context.APPLET);
+ Applet applet = (Applet) env.get(Context.APPLET);
if (applet != null) {
- // Create ORBs for an applet
- return initAppletORB(applet, orbProp);
+ // Create ORBs using applet and orbProp
+ return ORB.init(applet, orbProp);
}
}
- // Create ORBs using orbProp for a standalone application
return ORB.init(new String[0], orbProp);
}
-
- /**
- * This method returns a new ORB instance for the given applet
- * without creating a static dependency on java.applet.
- */
- private static ORB initAppletORB(Object applet, Properties orbProp) {
- try {
- Class<?> appletClass = Class.forName("java.applet.Applet", true, null);
- if (!appletClass.isInstance(applet)) {
- throw new ClassCastException(applet.getClass().getName());
- }
-
- // invoke the static method ORB.init(applet, orbProp);
- Method method = ORB.class.getMethod("init", appletClass, Properties.class);
- return (ORB) method.invoke(null, applet, orbProp);
- } catch (ClassNotFoundException e) {
- // java.applet.Applet doesn't exist and the applet parameter is
- // non-null; so throw CCE
- throw new ClassCastException(applet.getClass().getName());
- } catch (NoSuchMethodException e) {
- throw new AssertionError(e);
- } catch (InvocationTargetException e) {
- Throwable cause = e.getCause();
- if (cause instanceof RuntimeException) {
- throw (RuntimeException) cause;
- } else if (cause instanceof Error) {
- throw (Error) cause;
- }
- throw new AssertionError(e);
- } catch (IllegalAccessException iae) {
- throw new AssertionError(iae);
- }
- }
-
- // Fields used for reflection of RMI-IIOP
- private static Method toStubMethod = null;
- private static Method connectMethod = null;
- private static Class<?> corbaStubClass = null;
- /**
- * Initializes reflection method handles for RMI-IIOP.
- * @exception ClassNotFoundException javax.rmi.CORBA.* not available
- */
- private static void initMethodHandles() throws ClassNotFoundException {
- // Get javax.rmi.CORBA.Stub class
- corbaStubClass = Class.forName("javax.rmi.CORBA.Stub");
-
- // Get javax.rmi.CORBA.Stub.connect(org.omg.CORBA.ORB) method
-
- try {
- connectMethod = corbaStubClass.getMethod("connect",
- new Class<?>[] {org.omg.CORBA.ORB.class});
- } catch (NoSuchMethodException e) {
- throw new IllegalStateException(
- "No method definition for javax.rmi.CORBA.Stub.connect(org.omg.CORBA.ORB)");
- }
-
- // Get javax.rmi.PortableRemoteObject class
- Class<?> proClass = Class.forName("javax.rmi.PortableRemoteObject");
-
- // Get javax.rmi.PortableRemoteObject.toStub(java.rmi.Remote) method
- try {
- toStubMethod = proClass.getMethod("toStub",
- new Class<?>[] {java.rmi.Remote.class});
-
- } catch (NoSuchMethodException e) {
- throw new IllegalStateException(
-"No method definition for javax.rmi.PortableRemoteObject.toStub(java.rmi.Remote)");
- }
- }
}
--- a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Base.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Base.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -32,6 +32,7 @@
import java.security.NoSuchAlgorithmException;
import java.security.MessageDigest;
+import java.util.Arrays;
import java.util.logging.Logger;
/**
@@ -159,7 +160,7 @@
MessageDigest md5 = MessageDigest.getInstance("MD5");
/* digest the key if longer than 64 bytes */
- if (key.length > 64) {
+ if (key.length > MD5_BLOCKSIZE) {
key = md5.digest(key);
}
@@ -169,13 +170,9 @@
int i;
/* store key in pads */
- for (i = 0; i < MD5_BLOCKSIZE; i++) {
- for ( ; i < key.length; i++) {
- ipad[i] = key[i];
- opad[i] = key[i];
- }
- ipad[i] = 0x00;
- opad[i] = 0x00;
+ for (i = 0; i < key.length; i++) {
+ ipad[i] = key[i];
+ opad[i] = key[i];
}
/* XOR key with pads */
@@ -207,6 +204,11 @@
}
}
+ Arrays.fill(ipad, (byte)0);
+ Arrays.fill(opad, (byte)0);
+ ipad = null;
+ opad = null;
+
return (digestString.toString());
}
--- a/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java Fri Jul 25 09:44:53 2014 +0000
@@ -1410,7 +1410,7 @@
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST,
"DIGEST33:Expecting sequence num: {0}",
- new Integer(peerSeqNum));
+ peerSeqNum);
traceOutput(DP_CLASS_NAME, "unwrap", "DIGEST34:incoming: ",
encryptedMsg);
}
--- a/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Client.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Client.java Fri Jul 25 09:44:53 2014 +0000
@@ -439,7 +439,7 @@
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "DIGEST61:Raw send size: {0}",
- new Integer(rawSendSize));
+ rawSendSize);
}
}
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java Fri Jul 25 09:44:53 2014 +0000
@@ -275,9 +275,9 @@
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,
"KRB5CLNT07:Client max recv size: {0}; server max recv size: {1}; rawSendSize: {2}",
- new Object[] {new Integer(recvMaxBufSize),
- new Integer(srvMaxBufSize),
- new Integer(rawSendSize)});
+ new Object[] {recvMaxBufSize,
+ srvMaxBufSize,
+ rawSendSize});
}
// Construct negotiated security layers and client's max
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java Fri Jul 25 09:44:53 2014 +0000
@@ -222,7 +222,7 @@
logger.log(Level.FINE,
"KRB5SRV06:Supported protections: {0}; recv max buf size: {1}",
new Object[]{allQop,
- new Integer(recvMaxBufSize)});
+ recvMaxBufSize});
}
handshakeStage = 2; // progress to next stage
@@ -293,9 +293,9 @@
Boolean.valueOf(integrity)});
logger.log(Level.FINE,
"KRB5SRV11:Client max recv size: {0}; server max send size: {1}; rawSendSize: {2}",
- new Object[] {new Integer(clntMaxBufSize),
- new Integer(sendMaxBufSize),
- new Integer(rawSendSize)});
+ new Object[] {clntMaxBufSize,
+ sendMaxBufSize,
+ rawSendSize});
}
// Get authorization identity, if any
--- a/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -286,7 +286,7 @@
// Message id supplied by caller as part of traceTag
logger.logp(lev, srcClass, srcMethod, "{0} ( {1} ): {2}",
- new Object[] {traceTag, new Integer(origlen), content});
+ new Object[] {traceTag, origlen, content});
} catch (Exception e) {
logger.logp(Level.WARNING, srcClass, srcMethod,
"SASLIMPL09:Error generating trace output: {0}", e);
--- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java Fri Jul 25 09:44:53 2014 +0000
@@ -211,7 +211,7 @@
}
private void setCurrentFrameIndex(ThreadInfo tinfo, int index) {
- tinfo.setUserObject(new Integer(index));
+ tinfo.setUserObject(index);
//### In fact, the value may not have changed at this point.
//### We need to signal that the user attempted to change it,
//### however, so that the selection can be "warped" to the
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java Fri Jul 25 09:44:53 2014 +0000
@@ -84,7 +84,7 @@
MessageOutput.println("Current thread isnt suspended.");
} catch (ArrayIndexOutOfBoundsException e) {
MessageOutput.println("Requested stack frame is no longer active:",
- new Object []{new Integer(stackFrame)});
+ new Object []{stackFrame});
}
}
MessageOutput.printPrompt();
@@ -942,14 +942,14 @@
}
if (pc != -1) {
MessageOutput.println("stack frame dump with pc",
- new Object [] {new Integer(frameNumber + 1),
+ new Object [] {(frameNumber + 1),
meth.declaringType().name(),
meth.name(),
methodInfo,
Long.valueOf(pc)});
} else {
MessageOutput.println("stack frame dump",
- new Object [] {new Integer(frameNumber + 1),
+ new Object [] {(frameNumber + 1),
meth.declaringType().name(),
meth.name(),
methodInfo});
@@ -2093,8 +2093,8 @@
VirtualMachineManager vmm) {
MessageOutput.println("minus version",
new Object [] { debuggerName,
- new Integer(vmm.majorInterfaceVersion()),
- new Integer(vmm.minorInterfaceVersion()),
+ vmm.majorInterfaceVersion(),
+ vmm.minorInterfaceVersion(),
System.getProperty("java.version")});
if (Env.connection() != null) {
try {
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java Fri Jul 25 09:44:53 2014 +0000
@@ -241,7 +241,7 @@
}
if (line != null) {
MessageOutput.println("source line number and line",
- new Object [] {new Integer(loc.lineNumber()),
+ new Object [] {loc.lineNumber(),
line});
}
}
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaLazyReadObject.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaLazyReadObject.java Fri Jul 25 09:44:53 2014 +0000
@@ -100,7 +100,7 @@
// make Integer or Long for given object ID
protected static Number makeId(long id) {
if ((id & ~Snapshot.SMALL_ID_MASK) == 0) {
- return new Integer((int)id);
+ return (int)id;
} else {
return id;
}
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/Snapshot.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/Snapshot.java Fri Jul 25 09:44:53 2014 +0000
@@ -581,7 +581,7 @@
// Internals only below this point
private Number makeId(long id) {
if (identifierSize == 4) {
- return new Integer((int)id);
+ return (int)id;
} else {
return id;
}
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java Fri Jul 25 09:44:53 2014 +0000
@@ -227,7 +227,7 @@
String nm = getNameFromID(classNameID).replace('/', '.');
classNameFromObjectID.put(classIdI, nm);
if (classNameFromSerialNo != null) {
- classNameFromSerialNo.put(new Integer(serialNo), nm);
+ classNameFromSerialNo.put(serialNo, nm);
}
break;
}
@@ -297,7 +297,7 @@
String methodSig = getNameFromID(readID());
String sourceFile = getNameFromID(readID());
int classSer = in.readInt();
- String className = classNameFromSerialNo.get(new Integer(classSer));
+ String className = classNameFromSerialNo.get(classSer);
int lineNumber = in.readInt();
if (lineNumber < StackFrame.LINE_NUMBER_NATIVE) {
warn("Weird stack frame line number: " + lineNumber);
@@ -324,7 +324,7 @@
throw new IOException("Stack frame " + toHex(fid) + " not found");
}
}
- stackTraces.put(new Integer(serialNo),
+ stackTraces.put(serialNo,
new StackTrace(frames));
}
break;
@@ -404,7 +404,7 @@
int threadSeq = in.readInt();
int stackSeq = in.readInt();
bytesLeft -= identifierSize + 8;
- threadObjects.put(new Integer(threadSeq),
+ threadObjects.put(threadSeq,
new ThreadObject(id, stackSeq));
break;
}
@@ -610,7 +610,7 @@
private ThreadObject getThreadObjectFromSequence(int threadSeq)
throws IOException {
- ThreadObject to = threadObjects.get(new Integer(threadSeq));
+ ThreadObject to = threadObjects.get(threadSeq);
if (to == null) {
throw new IOException("Thread " + threadSeq +
" not found for JNI local ref");
@@ -638,7 +638,7 @@
if (stackTraces == null) {
return null;
}
- StackTrace result = stackTraces.get(new Integer(ser));
+ StackTrace result = stackTraces.get(ser);
if (result == null) {
warn("Stack trace not found for serial # " + ser);
}
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/server/ObjectQuery.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/server/ObjectQuery.java Fri Jul 25 09:44:53 2014 +0000
@@ -99,7 +99,7 @@
final JavaField[] fields = obj.getClazz().getFieldsForInstance();
Integer[] hack = new Integer[things.length];
for (int i = 0; i < things.length; i++) {
- hack[i] = new Integer(i);
+ hack[i] = i;
}
ArraySorter.sort(hack, new Comparer() {
public int compare(Object lhs, Object rhs) {
--- a/jdk/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -143,7 +143,7 @@
* Find the locations which match the line number
* passed in.
*/
- List<Location> list = info.lineMapper.get(new Integer(lineNumber));
+ List<Location> list = info.lineMapper.get(lineNumber);
if (list == null) {
list = new ArrayList<Location>(0);
@@ -329,7 +329,7 @@
lineLocations.add(loc);
// Add to the line -> locations map
- Integer key = new Integer(lineNumber);
+ Integer key = lineNumber;
List<Location> mappedLocs = lineMapper.get(key);
if (mappedLocs == null) {
mappedLocs = new ArrayList<Location>(1);
@@ -399,7 +399,7 @@
lineLocations.add(loc);
// Add to the line -> locations map
- Integer key = new Integer(lineNumber);
+ Integer key = lineNumber;
List<Location> mappedLocs = lineMapper.get(key);
if (mappedLocs == null) {
mappedLocs = new ArrayList<Location>(1);
--- a/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -529,7 +529,7 @@
* to filter that ordered collection.
*/
List<Method> list = allMethods();
- list.retainAll(map.values());
+ list.retainAll(new HashSet<Method>(map.values()));
return list;
}
--- a/jdk/src/share/classes/java/awt/Component.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/awt/Component.java Fri Jul 25 09:44:53 2014 +0000
@@ -67,7 +67,6 @@
import sun.awt.ConstrainableGraphics;
import sun.awt.SubRegionShowable;
import sun.awt.SunToolkit;
-import sun.awt.WindowClosingListener;
import sun.awt.CausedFocusEvent;
import sun.awt.EmbeddedFrame;
import sun.awt.dnd.SunDropTargetEvent;
@@ -544,8 +543,6 @@
transient MouseWheelListener mouseWheelListener;
transient InputMethodListener inputMethodListener;
- transient RuntimeException windowClosingException = null;
-
/** Internal, constants for serialization */
final static String actionListenerK = "actionL";
final static String adjustmentListenerK = "adjustmentL";
@@ -4959,16 +4956,6 @@
}
break;
- case WindowEvent.WINDOW_CLOSING:
- if (toolkit instanceof WindowClosingListener) {
- windowClosingException = ((WindowClosingListener)
- toolkit).windowClosingNotify((WindowEvent)e);
- if (checkWindowClosingException()) {
- return;
- }
- }
- break;
-
default:
break;
}
@@ -5024,21 +5011,6 @@
}
/*
- * 8. Special handling for 4061116 : Hook for browser to close modal
- * dialogs.
- */
- if (id == WindowEvent.WINDOW_CLOSING && !e.isConsumed()) {
- if (toolkit instanceof WindowClosingListener) {
- windowClosingException =
- ((WindowClosingListener)toolkit).
- windowClosingDelivered((WindowEvent)e);
- if (checkWindowClosingException()) {
- return;
- }
- }
- }
-
- /*
* 9. Allow the peer to process the event.
* Except KeyEvents, they will be processed by peer after
* all KeyEventPostProcessors
@@ -5145,20 +5117,6 @@
return false;
}
- boolean checkWindowClosingException() {
- if (windowClosingException != null) {
- if (this instanceof Dialog) {
- ((Dialog)this).interruptBlocking();
- } else {
- windowClosingException.fillInStackTrace();
- windowClosingException.printStackTrace();
- windowClosingException = null;
- }
- return true;
- }
- return false;
- }
-
boolean areInputMethodsEnabled() {
// in 1.2, we assume input method support is required for all
// components that handle key events, but components can turn off
--- a/jdk/src/share/classes/java/awt/Container.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/awt/Container.java Fri Jul 25 09:44:53 2014 +0000
@@ -2910,17 +2910,10 @@
}
}
- Runnable pumpEventsForHierarchy = new Runnable() {
- public void run() {
- EventDispatchThread dispatchThread =
- (EventDispatchThread)Thread.currentThread();
- dispatchThread.pumpEventsForHierarchy(
- new Conditional() {
- public boolean evaluate() {
- return ((windowClosingException == null) && (nativeContainer.modalComp != null)) ;
- }
- }, Container.this);
- }
+ Runnable pumpEventsForHierarchy = () -> {
+ EventDispatchThread dispatchThread = (EventDispatchThread)Thread.currentThread();
+ dispatchThread.pumpEventsForHierarchy(() -> nativeContainer.modalComp != null,
+ Container.this);
};
if (EventQueue.isDispatchThread()) {
@@ -2938,8 +2931,7 @@
postEvent(new PeerEvent(this,
pumpEventsForHierarchy,
PeerEvent.PRIORITY_EVENT));
- while ((windowClosingException == null) &&
- (nativeContainer.modalComp != null))
+ while (nativeContainer.modalComp != null)
{
try {
getTreeLock().wait();
@@ -2949,10 +2941,6 @@
}
}
}
- if (windowClosingException != null) {
- windowClosingException.fillInStackTrace();
- throw windowClosingException;
- }
if (predictedFocusOwner != null) {
KeyboardFocusManager.getCurrentKeyboardFocusManager().
dequeueKeyEvents(time, predictedFocusOwner);
--- a/jdk/src/share/classes/java/awt/Dialog.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/awt/Dialog.java Fri Jul 25 09:44:53 2014 +0000
@@ -40,6 +40,7 @@
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
@@ -1044,13 +1045,6 @@
predictedFocusOwner = getMostRecentFocusOwner();
if (conditionalShow(predictedFocusOwner, time)) {
modalFilter = ModalEventFilter.createFilterForDialog(this);
- final Conditional cond = new Conditional() {
- @Override
- public boolean evaluate() {
- return windowClosingException == null;
- }
- };
-
// if this dialog is toolkit-modal, the filter should be added
// to all EDTs (for all AppContexts)
if (modalityType == ModalityType.TOOLKIT_MODAL) {
@@ -1063,10 +1057,7 @@
EventQueue eventQueue = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY);
// it may occur that EDT for appContext hasn't been started yet, so
// we post an empty invocation event to trigger EDT initialization
- Runnable createEDT = new Runnable() {
- public void run() {};
- };
- eventQueue.postEvent(new InvocationEvent(this, createEDT));
+ eventQueue.postEvent(new InvocationEvent(this, () -> {}));
EventDispatchThread edt = eventQueue.getDispatchThread();
edt.addEventFilter(modalFilter);
}
@@ -1075,12 +1066,8 @@
modalityPushed();
try {
final EventQueue eventQueue = AccessController.doPrivileged(
- new PrivilegedAction<EventQueue>() {
- public EventQueue run() {
- return Toolkit.getDefaultToolkit().getSystemEventQueue();
- }
- });
- secondaryLoop = eventQueue.createSecondaryLoop(cond, modalFilter, 0);
+ (PrivilegedAction<EventQueue>) Toolkit.getDefaultToolkit()::getSystemEventQueue);
+ secondaryLoop = eventQueue.createSecondaryLoop(() -> true, modalFilter, 0);
if (!secondaryLoop.enter()) {
secondaryLoop = null;
}
@@ -1102,11 +1089,6 @@
edt.removeEventFilter(modalFilter);
}
}
-
- if (windowClosingException != null) {
- windowClosingException.fillInStackTrace();
- throw windowClosingException;
- }
}
} finally {
if (predictedFocusOwner != null) {
@@ -1134,16 +1116,6 @@
}
}
- void interruptBlocking() {
- if (isModal()) {
- disposeImpl();
- } else if (windowClosingException != null) {
- windowClosingException.fillInStackTrace();
- windowClosingException.printStackTrace();
- windowClosingException = null;
- }
- }
-
private void hideAndDisposePreHandler() {
isInHide = true;
synchronized (getTreeLock()) {
--- a/jdk/src/share/classes/java/awt/SplashScreen.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/awt/SplashScreen.java Fri Jul 25 09:44:53 2014 +0000
@@ -245,7 +245,14 @@
public Rectangle getBounds() throws IllegalStateException {
synchronized (SplashScreen.class) {
checkVisible();
- return _getBounds(splashPtr);
+ float scale = _getScaleFactor(splashPtr);
+ Rectangle bounds = _getBounds(splashPtr);
+ assert scale > 0;
+ if (scale > 0 && scale != 1) {
+ bounds.setSize((int) (bounds.getWidth() / scale),
+ (int) (bounds.getWidth() / scale));
+ }
+ return bounds;
}
}
@@ -287,10 +294,19 @@
public Graphics2D createGraphics() throws IllegalStateException {
synchronized (SplashScreen.class) {
if (image==null) {
- Dimension dim = getSize();
- image = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB);
+ // get unscaled splash image size
+ Dimension dim = _getBounds(splashPtr).getSize();
+ image = new BufferedImage(dim.width, dim.height,
+ BufferedImage.TYPE_INT_ARGB);
}
- return image.createGraphics();
+ float scale = _getScaleFactor(splashPtr);
+ Graphics2D g = image.createGraphics();
+ assert (scale > 0);
+ if (scale <= 0) {
+ scale = 1;
+ }
+ g.scale(scale, scale);
+ return g;
}
}
@@ -401,5 +417,6 @@
private native static String _getImageFileName(long splashPtr);
private native static String _getImageJarName(long SplashPtr);
private native static boolean _setImageData(long SplashPtr, byte[] data);
+ private native static float _getScaleFactor(long SplashPtr);
};
--- a/jdk/src/share/classes/java/beans/BeanDescriptor.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/beans/BeanDescriptor.java Fri Jul 25 09:44:53 2014 +0000
@@ -22,10 +22,10 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package java.beans;
import java.lang.ref.Reference;
+import javax.swing.SwingContainer;
/**
* A BeanDescriptor provides global information about a "bean",
@@ -69,6 +69,23 @@
name = name.substring(name.indexOf('.')+1);
}
setName(name);
+
+ JavaBean annotation = beanClass.getAnnotation(JavaBean.class);
+ if (annotation != null) {
+ setPreferred(true);
+ String description = annotation.description();
+ if (!description.isEmpty()) {
+ setShortDescription(description);
+ }
+ }
+ SwingContainer container = beanClass.getAnnotation(SwingContainer.class);
+ if (container != null) {
+ setValue("isContainer", container.value());
+ String delegate = container.delegate();
+ if (!delegate.isEmpty()) {
+ setValue("containerDelegate", delegate);
+ }
+ }
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/beans/BeanProperty.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 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
+ * 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.beans;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An annotation used to specify some property-related information
+ * for the automatically generated {@link BeanInfo} classes.
+ * This annotation is not used if the annotated class
+ * has a corresponding user-defined {@code BeanInfo} class,
+ * which does not imply the automatic analysis.
+ *
+ * @see BeanInfo#getPropertyDescriptors
+ * @since 1.9
+ *
+ * @author Sergey A. Malenkov
+ */
+@Documented
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface BeanProperty {
+ /**
+ * The value that indicates whether the annotated property can be
+ * a {@link PropertyDescriptor#isBound bound} property or not.
+ * This value applies only to the beans that have the
+ * {@link PropertyChangeListener propertyChange} event set.
+ *
+ * @return {@code true} if the annotated property can be a bound property;
+ * {@code false} otherwise.
+ */
+ boolean bound() default true;
+
+ /**
+ * The value that indicates whether the annotated property is
+ * an {@link PropertyDescriptor#isExpert expert} property or not.
+ *
+ * @return {@code true} if the annotated property is an expert property;
+ * {@code false} otherwise.
+ */
+ boolean expert() default false;
+
+ /**
+ * The value that indicates whether the annotated property is
+ * a {@link PropertyDescriptor#isHidden hidden} property or not.
+ *
+ * @return {@code true} if the annotated property is a hidden property;
+ * {@code false} otherwise.
+ */
+ boolean hidden() default false;
+
+ /**
+ * The value that indicates whether the annotated property is
+ * a {@link PropertyDescriptor#isPreferred preferred} property or not.
+ *
+ * @return {@code true} if the annotated property is a preferred property;
+ * {@code false} otherwise.
+ */
+ boolean preferred() default false;
+
+ /**
+ * The value that indicates whether the annotated property is
+ * a required property or not.
+ *
+ * @return {@code true} if the annotated property is a required property;
+ * {@code false} otherwise.
+ */
+ boolean required() default false;
+
+ /**
+ * The value that indicates whether the corresponding component
+ * is repainted after the annotated property got changed or not.
+ *
+ * @return {@code true} if the corresponding component is repainted;
+ * {@code false} otherwise.
+ */
+ boolean visualUpdate() default false;
+
+ /**
+ * The {@link PropertyDescriptor#getShortDescription short description}
+ * for the {@link BeanInfo#getPropertyDescriptors descriptor}
+ * of the annotated property.
+ *
+ * @return the property description,
+ * or an empty string if the description is not set.
+ */
+ String description() default "";
+
+ /**
+ * The array of names for the public static fields
+ * that contains the valid values of the annotated property.
+ * These names are used to generate the {@code enumerationValues}
+ * {@link java.beans.BeanDescriptor#getValue feature attribute}
+ * that must contain the following items per each property value:
+ * a displayable name for the property value, the actual property value,
+ * and a Java code piece used for the code generator.
+ *
+ * @return the names of the valid values of the annotated property,
+ * or an empty array if the names are not provided.
+ */
+ String[] enumerationValues() default {};
+}
--- a/jdk/src/share/classes/java/beans/EventSetDescriptor.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/beans/EventSetDescriptor.java Fri Jul 25 09:44:53 2014 +0000
@@ -22,13 +22,14 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package java.beans;
import java.lang.ref.Reference;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import com.sun.beans.introspect.EventSetInfo;
+
/**
* An EventSetDescriptor describes a group of events that a given Java
* bean fires.
@@ -255,6 +256,16 @@
setListenerType(listenerType);
}
+ EventSetDescriptor(String base, EventSetInfo info, Method... methods) {
+ setName(Introspector.decapitalize(base));
+ setListenerMethods(methods);
+ setAddListenerMethod(info.getAddMethod());
+ setRemoveListenerMethod(info.getRemoveMethod());
+ setGetListenerMethod(info.getGetMethod());
+ setListenerType(info.getListenerType());
+ setUnicast(info.isUnicast());
+ }
+
/**
* Creates an <TT>EventSetDescriptor</TT> from scratch using
* <TT>java.lang.reflect.MethodDescriptor</TT> and <TT>java.lang.Class</TT>
--- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java Fri Jul 25 09:44:53 2014 +0000
@@ -22,11 +22,13 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package java.beans;
import java.lang.ref.Reference;
import java.lang.reflect.Method;
+import java.util.Map.Entry;
+
+import com.sun.beans.introspect.PropertyInfo;
/**
* An IndexedPropertyDescriptor describes a property that acts like an
@@ -143,27 +145,21 @@
}
/**
- * Creates <code>PropertyDescriptor</code> for the specified bean
- * with the specified name and methods to read/write the property value.
+ * Creates {@code IndexedPropertyDescriptor} from the specified property info.
*
- * @param bean the type of the target bean
- * @param base the base name of the property (the rest of the method name)
- * @param read the method used for reading the property value
- * @param write the method used for writing the property value
- * @param readIndexed the method used for reading an indexed property value
- * @param writeIndexed the method used for writing an indexed property value
- * @exception IntrospectionException if an exception occurs during introspection
+ * @param entry the key-value pair,
+ * where the {@code key} is the base name of the property (the rest of the method name)
+ * and the {@code value} is the automatically generated property info
+ * @param bound the flag indicating whether it is possible to treat this property as a bound property
*
- * @since 1.7
+ * @since 1.9
*/
- IndexedPropertyDescriptor(Class<?> bean, String base, Method read, Method write, Method readIndexed, Method writeIndexed) throws IntrospectionException {
- super(bean, base, read, write);
-
- setIndexedReadMethod0(readIndexed);
- setIndexedWriteMethod0(writeIndexed);
-
- // Type checking
- setIndexedPropertyType(findIndexedPropertyType(readIndexed, writeIndexed));
+ IndexedPropertyDescriptor(Entry<String,PropertyInfo> entry, boolean bound) {
+ super(entry, bound);
+ PropertyInfo info = entry.getValue().getIndexed();
+ setIndexedReadMethod0(info.getReadMethod());
+ setIndexedWriteMethod0(info.getWriteMethod());
+ setIndexedPropertyType(info.getPropertyType());
}
/**
--- a/jdk/src/share/classes/java/beans/Introspector.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/beans/Introspector.java Fri Jul 25 09:44:53 2014 +0000
@@ -22,32 +22,30 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package java.beans;
import com.sun.beans.TypeResolver;
import com.sun.beans.WeakCache;
import com.sun.beans.finder.ClassFinder;
-import com.sun.beans.finder.MethodFinder;
+import com.sun.beans.introspect.ClassInfo;
+import com.sun.beans.introspect.EventSetInfo;
+import com.sun.beans.introspect.PropertyInfo;
import java.awt.Component;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.EventListener;
import java.util.EventObject;
import java.util.List;
import java.util.TreeMap;
-import sun.misc.JavaBeansIntrospectorAccess;
import sun.misc.SharedSecrets;
import sun.reflect.misc.ReflectUtil;
@@ -122,7 +120,6 @@
private BeanInfo additionalBeanInfo[];
private boolean propertyChangeSource = false;
- private static Class<EventListener> eventListenerType = EventListener.class;
// These should be removed.
private String defaultEventName;
@@ -501,78 +498,15 @@
addPropertyDescriptors(explicitProperties);
} else {
-
// Apply some reflection to the current class.
-
- // First get an array of all the public methods at this level
- Method methodList[] = getPublicDeclaredMethods(beanClass);
-
- // Now analyze each method.
- for (int i = 0; i < methodList.length; i++) {
- Method method = methodList[i];
- if (method == null) {
- continue;
- }
- // skip static methods.
- int mods = method.getModifiers();
- if (Modifier.isStatic(mods)) {
- continue;
- }
- String name = method.getName();
- Class<?>[] argTypes = method.getParameterTypes();
- Class<?> resultType = method.getReturnType();
- int argCount = argTypes.length;
- PropertyDescriptor pd = null;
-
- if (name.length() <= 3 && !name.startsWith(IS_PREFIX)) {
- // Optimization. Don't bother with invalid propertyNames.
- continue;
- }
-
- try {
-
- if (argCount == 0) {
- if (name.startsWith(GET_PREFIX)) {
- // Simple getter
- pd = new PropertyDescriptor(this.beanClass, name.substring(3), method, null);
- } else if (resultType == boolean.class && name.startsWith(IS_PREFIX)) {
- // Boolean getter
- pd = new PropertyDescriptor(this.beanClass, name.substring(2), method, null);
- }
- } else if (argCount == 1) {
- if (int.class.equals(argTypes[0]) && name.startsWith(GET_PREFIX)) {
- pd = new IndexedPropertyDescriptor(this.beanClass, name.substring(3), null, null, method, null);
- } else if (void.class.equals(resultType) && name.startsWith(SET_PREFIX)) {
- // Simple setter
- pd = new PropertyDescriptor(this.beanClass, name.substring(3), null, method);
- if (throwsException(method, PropertyVetoException.class)) {
- pd.setConstrained(true);
- }
- }
- } else if (argCount == 2) {
- if (void.class.equals(resultType) && int.class.equals(argTypes[0]) && name.startsWith(SET_PREFIX)) {
- pd = new IndexedPropertyDescriptor(this.beanClass, name.substring(3), null, null, null, method);
- if (throwsException(method, PropertyVetoException.class)) {
- pd.setConstrained(true);
- }
- }
- }
- } catch (IntrospectionException ex) {
- // This happens if a PropertyDescriptor or IndexedPropertyDescriptor
- // constructor fins that the method violates details of the deisgn
- // pattern, e.g. by having an empty name, or a getter returning
- // void , or whatever.
- pd = null;
- }
-
- if (pd != null) {
- // If this class or one of its base classes is a PropertyChange
- // source, then we assume that any properties we discover are "bound".
- if (propertyChangeSource) {
- pd.setBound(true);
- }
- addPropertyDescriptor(pd);
- }
+ for (Map.Entry<String,PropertyInfo> entry : ClassInfo.get(this.beanClass).getProperties().entrySet()) {
+ addPropertyDescriptor(null != entry.getValue().getIndexed()
+ ? new IndexedPropertyDescriptor(entry, this.propertyChangeSource)
+ : new PropertyDescriptor(entry, this.propertyChangeSource));
+ }
+ JavaBean annotation = this.beanClass.getAnnotation(JavaBean.class);
+ if ((annotation != null) && !annotation.defaultProperty().isEmpty()) {
+ this.defaultPropertyName = annotation.defaultProperty();
}
}
processPropertyDescriptors();
@@ -589,7 +523,6 @@
}
}
}
-
return result;
}
@@ -1003,143 +936,24 @@
}
} else {
-
// Apply some reflection to the current class.
-
- // Get an array of all the public beans methods at this level
- Method methodList[] = getPublicDeclaredMethods(beanClass);
-
- // Find all suitable "add", "remove" and "get" Listener methods
- // The name of the listener type is the key for these hashtables
- // i.e, ActionListener
- Map<String, Method> adds = null;
- Map<String, Method> removes = null;
- Map<String, Method> gets = null;
-
- for (int i = 0; i < methodList.length; i++) {
- Method method = methodList[i];
- if (method == null) {
- continue;
- }
- // skip static methods.
- int mods = method.getModifiers();
- if (Modifier.isStatic(mods)) {
- continue;
- }
- String name = method.getName();
- // Optimization avoid getParameterTypes
- if (!name.startsWith(ADD_PREFIX) && !name.startsWith(REMOVE_PREFIX)
- && !name.startsWith(GET_PREFIX)) {
- continue;
- }
-
- if (name.startsWith(ADD_PREFIX)) {
- Class<?> returnType = method.getReturnType();
- if (returnType == void.class) {
- Type[] parameterTypes = method.getGenericParameterTypes();
- if (parameterTypes.length == 1) {
- Class<?> type = TypeResolver.erase(TypeResolver.resolveInClass(beanClass, parameterTypes[0]));
- if (Introspector.isSubclass(type, eventListenerType)) {
- String listenerName = name.substring(3);
- if (listenerName.length() > 0 &&
- type.getName().endsWith(listenerName)) {
- if (adds == null) {
- adds = new HashMap<>();
- }
- adds.put(listenerName, method);
- }
- }
- }
- }
- }
- else if (name.startsWith(REMOVE_PREFIX)) {
- Class<?> returnType = method.getReturnType();
- if (returnType == void.class) {
- Type[] parameterTypes = method.getGenericParameterTypes();
- if (parameterTypes.length == 1) {
- Class<?> type = TypeResolver.erase(TypeResolver.resolveInClass(beanClass, parameterTypes[0]));
- if (Introspector.isSubclass(type, eventListenerType)) {
- String listenerName = name.substring(6);
- if (listenerName.length() > 0 &&
- type.getName().endsWith(listenerName)) {
- if (removes == null) {
- removes = new HashMap<>();
- }
- removes.put(listenerName, method);
- }
- }
- }
+ for (Map.Entry<String,EventSetInfo> entry : ClassInfo.get(this.beanClass).getEventSets().entrySet()) {
+ // generate a list of Method objects for each of the target methods:
+ List<Method> methods = new ArrayList<>();
+ for (Method method : ClassInfo.get(entry.getValue().getListenerType()).getMethods()) {
+ if (isEventHandler(method)) {
+ methods.add(method);
}
}
- else if (name.startsWith(GET_PREFIX)) {
- Class<?>[] parameterTypes = method.getParameterTypes();
- if (parameterTypes.length == 0) {
- Class<?> returnType = FeatureDescriptor.getReturnType(beanClass, method);
- if (returnType.isArray()) {
- Class<?> type = returnType.getComponentType();
- if (Introspector.isSubclass(type, eventListenerType)) {
- String listenerName = name.substring(3, name.length() - 1);
- if (listenerName.length() > 0 &&
- type.getName().endsWith(listenerName)) {
- if (gets == null) {
- gets = new HashMap<>();
- }
- gets.put(listenerName, method);
- }
- }
- }
- }
- }
+ addEvent(new EventSetDescriptor(
+ entry.getKey(),
+ entry.getValue(),
+ methods.toArray(new Method[methods.size()])));
}
-
- if (adds != null && removes != null) {
- // Now look for matching addFooListener+removeFooListener pairs.
- // Bonus if there is a matching getFooListeners method as well.
- Iterator<String> keys = adds.keySet().iterator();
- while (keys.hasNext()) {
- String listenerName = keys.next();
- // Skip any "add" which doesn't have a matching "remove" or
- // a listener name that doesn't end with Listener
- if (removes.get(listenerName) == null || !listenerName.endsWith("Listener")) {
- continue;
- }
- String eventName = decapitalize(listenerName.substring(0, listenerName.length()-8));
- Method addMethod = adds.get(listenerName);
- Method removeMethod = removes.get(listenerName);
- Method getMethod = null;
- if (gets != null) {
- getMethod = gets.get(listenerName);
- }
- Class<?> argType = FeatureDescriptor.getParameterTypes(beanClass, addMethod)[0];
-
- // generate a list of Method objects for each of the target methods:
- Method allMethods[] = getPublicDeclaredMethods(argType);
- List<Method> validMethods = new ArrayList<>(allMethods.length);
- for (int i = 0; i < allMethods.length; i++) {
- if (allMethods[i] == null) {
- continue;
- }
-
- if (isEventHandler(allMethods[i])) {
- validMethods.add(allMethods[i]);
- }
- }
- Method[] methods = validMethods.toArray(new Method[validMethods.size()]);
-
- EventSetDescriptor esd = new EventSetDescriptor(eventName, argType,
- methods, addMethod,
- removeMethod,
- getMethod);
-
- // If the adder method throws the TooManyListenersException then it
- // is a Unicast event source.
- if (throwsException(addMethod,
- java.util.TooManyListenersException.class)) {
- esd.setUnicast(true);
- }
- addEvent(esd);
- }
- } // if (adds != null ...
+ JavaBean annotation = this.beanClass.getAnnotation(JavaBean.class);
+ if ((annotation != null) && !annotation.defaultEventSet().isEmpty()) {
+ this.defaultEventName = annotation.defaultEventSet();
+ }
}
EventSetDescriptor[] result;
if (events.size() == 0) {
@@ -1148,7 +962,6 @@
// Allocate and populate the result array.
result = new EventSetDescriptor[events.size()];
result = events.values().toArray(result);
-
// Set the default index.
if (defaultEventName != null) {
for (int i = 0; i < result.length; i++) {
@@ -1215,20 +1028,9 @@
}
} else {
-
// Apply some reflection to the current class.
-
- // First get an array of all the beans methods at this level
- Method methodList[] = getPublicDeclaredMethods(beanClass);
-
- // Now analyze each method.
- for (int i = 0; i < methodList.length; i++) {
- Method method = methodList[i];
- if (method == null) {
- continue;
- }
- MethodDescriptor md = new MethodDescriptor(method);
- addMethod(md);
+ for (Method method : ClassInfo.get(this.beanClass).getMethods()) {
+ addMethod(new MethodDescriptor(method));
}
}
@@ -1346,44 +1148,6 @@
return isSubclass(TypeResolver.erase(TypeResolver.resolveInClass(beanClass, argTypes[0])), EventObject.class);
}
- /*
- * Internal method to return *public* methods within a class.
- */
- private static Method[] getPublicDeclaredMethods(Class<?> clz) {
- // Looking up Class.getDeclaredMethods is relatively expensive,
- // so we cache the results.
- if (!ReflectUtil.isPackageAccessible(clz)) {
- return new Method[0];
- }
- synchronized (declaredMethodCache) {
- Method[] result = declaredMethodCache.get(clz);
- if (result == null) {
- result = clz.getMethods();
- for (int i = 0; i < result.length; i++) {
- Method method = result[i];
- if (!method.getDeclaringClass().equals(clz)) {
- result[i] = null; // ignore methods declared elsewhere
- }
- else {
- try {
- method = MethodFinder.findAccessibleMethod(method);
- Class<?> type = method.getDeclaringClass();
- result[i] = type.equals(clz) || type.isInterface()
- ? method
- : null; // ignore methods from superclasses
- }
- catch (NoSuchMethodException exception) {
- // commented out because of 6976577
- // result[i] = null; // ignore inaccessible methods
- }
- }
- }
- declaredMethodCache.put(clz, result);
- }
- return result;
- }
- }
-
//======================================================================
// Package private support methods.
//======================================================================
@@ -1396,17 +1160,8 @@
int argCount, Class<?> args[]) {
// For overriden methods we need to find the most derived version.
// So we start with the given class and walk up the superclass chain.
-
- Method method = null;
-
for (Class<?> cl = start; cl != null; cl = cl.getSuperclass()) {
- Method methods[] = getPublicDeclaredMethods(cl);
- for (int i = 0; i < methods.length; i++) {
- method = methods[i];
- if (method == null) {
- continue;
- }
-
+ for (Method method : ClassInfo.get(cl).getMethods()) {
// make sure method signature matches.
if (method.getName().equals(methodName)) {
Type[] params = method.getGenericParameterTypes();
@@ -1430,8 +1185,6 @@
}
}
}
- method = null;
-
// Now check any inherited interfaces. This is necessary both when
// the argument class is itself an interface, and when the argument
// class is an abstract class.
@@ -1440,12 +1193,12 @@
// Note: The original implementation had both methods calling
// the 3 arg method. This is preserved but perhaps it should
// pass the args array instead of null.
- method = internalFindMethod(ifcs[i], methodName, argCount, null);
+ Method method = internalFindMethod(ifcs[i], methodName, argCount, null);
if (method != null) {
- break;
+ return method;
}
}
- return method;
+ return null;
}
/**
@@ -1508,19 +1261,6 @@
}
/**
- * Return true iff the given method throws the given exception.
- */
- private boolean throwsException(Method method, Class<?> exception) {
- Class<?>[] exs = method.getExceptionTypes();
- for (int i = 0; i < exs.length; i++) {
- if (exs[i] == exception) {
- return true;
- }
- }
- return false;
- }
-
- /**
* Try to create an instance of a named class.
* First try the classloader of "sibling", then try the system
* classloader then the class loader of the current Thread.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/beans/JavaBean.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 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
+ * 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.beans;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An annotation used to specify some class-related information
+ * for the automatically generated {@link BeanInfo} classes.
+ * This annotation is not used if the annotated class
+ * has a corresponding user-defined {@code BeanInfo} class,
+ * which does not imply the automatic analysis.
+ *
+ * @see BeanInfo#getBeanDescriptor
+ * @since 1.9
+ *
+ * @author Sergey A. Malenkov
+ */
+@Documented
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface JavaBean {
+ /**
+ * The {@link BeanDescriptor#getShortDescription short description}
+ * for the {@link BeanInfo#getBeanDescriptor bean descriptor}
+ * of the annotated class.
+ *
+ * @return the bean description,
+ * or an empty string if the description is not set.
+ */
+ String description() default "";
+
+ /**
+ * The name of the default property is used to calculate its
+ * {@link BeanInfo#getDefaultPropertyIndex index} in the
+ * {@link BeanInfo#getPropertyDescriptors array} of properties
+ * defined in the annotated class. If the name is not set or
+ * the annotated class does not define a property
+ * with the specified name, the default property index
+ * will be calculated automatically by the
+ * {@link Introspector} depending on its state.
+ *
+ * @return the name of the default property,
+ * or an empty string if the name is not set.
+ */
+ String defaultProperty() default "";
+
+ /**
+ * The name of the default event set is used to calculate its
+ * {@link BeanInfo#getDefaultEventIndex index} in the
+ * {@link BeanInfo#getEventSetDescriptors array} of event sets
+ * defined in the annotated class. If the name is not set or
+ * the annotated class does not define an event set
+ * with the specified name, the default event set index
+ * will be calculated automatically by the
+ * {@link Introspector} depending on its state.
+ *
+ * @return the name of the default event set,
+ * or an empty string if the name is not set.
+ */
+ String defaultEventSet() default "";
+}
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java Fri Jul 25 09:44:53 2014 +0000
@@ -22,12 +22,14 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package java.beans;
import java.lang.ref.Reference;
import java.lang.reflect.Method;
import java.lang.reflect.Constructor;
+import java.util.Map.Entry;
+
+import com.sun.beans.introspect.PropertyInfo;
/**
* A PropertyDescriptor describes one property that a Java Bean
@@ -140,25 +142,47 @@
}
/**
- * Creates <code>PropertyDescriptor</code> for the specified bean
- * with the specified name and methods to read/write the property value.
+ * Creates {@code PropertyDescriptor} from the specified property info.
*
- * @param bean the type of the target bean
- * @param base the base name of the property (the rest of the method name)
- * @param read the method used for reading the property value
- * @param write the method used for writing the property value
- * @exception IntrospectionException if an exception occurs during introspection
+ * @param entry the pair of values,
+ * where the {@code key} is the base name of the property (the rest of the method name)
+ * and the {@code value} is the automatically generated property info
+ * @param bound the flag indicating whether it is possible to treat this property as a bound property
*
- * @since 1.7
+ * @since 1.9
*/
- PropertyDescriptor(Class<?> bean, String base, Method read, Method write) throws IntrospectionException {
- if (bean == null) {
- throw new IntrospectionException("Target Bean class is null");
+ PropertyDescriptor(Entry<String,PropertyInfo> entry, boolean bound) {
+ String base = entry.getKey();
+ PropertyInfo info = entry.getValue();
+ setName(Introspector.decapitalize(base));
+ setReadMethod0(info.getReadMethod());
+ setWriteMethod0(info.getWriteMethod());
+ setPropertyType(info.getPropertyType());
+ setConstrained(info.isConstrained());
+ setBound(bound && info.is(PropertyInfo.Name.bound));
+ if (info.is(PropertyInfo.Name.expert)) {
+ setValue(PropertyInfo.Name.expert.name(), Boolean.TRUE); // compatibility
+ setExpert(true);
}
- setClass0(bean);
- setName(Introspector.decapitalize(base));
- setReadMethod(read);
- setWriteMethod(write);
+ if (info.is(PropertyInfo.Name.hidden)) {
+ setValue(PropertyInfo.Name.hidden.name(), Boolean.TRUE); // compatibility
+ setHidden(true);
+ }
+ if (info.is(PropertyInfo.Name.preferred)) {
+ setPreferred(true);
+ }
+ Object visual = info.get(PropertyInfo.Name.visualUpdate);
+ if (visual != null) {
+ setValue(PropertyInfo.Name.visualUpdate.name(), visual);
+ }
+ Object description = info.get(PropertyInfo.Name.description);
+ if (description != null) {
+ setShortDescription(description.toString());
+ }
+ Object values = info.get(PropertyInfo.Name.enumerationValues);
+ if (values != null) {
+ setValue(PropertyInfo.Name.enumerationValues.name(), values);
+ }
this.baseName = base;
}
@@ -249,13 +273,17 @@
*/
public synchronized void setReadMethod(Method readMethod)
throws IntrospectionException {
+ // The property type is determined by the read method.
+ setPropertyType(findPropertyType(readMethod, this.writeMethodRef.get()));
+ setReadMethod0(readMethod);
+ }
+
+ private void setReadMethod0(Method readMethod) {
this.readMethodRef.set(readMethod);
if (readMethod == null) {
readMethodName = null;
return;
}
- // The property type is determined by the read method.
- setPropertyType(findPropertyType(readMethod, this.writeMethodRef.get()));
setClass0(readMethod.getDeclaringClass());
readMethodName = readMethod.getName();
@@ -320,13 +348,17 @@
*/
public synchronized void setWriteMethod(Method writeMethod)
throws IntrospectionException {
+ // Set the property type - which validates the method
+ setPropertyType(findPropertyType(getReadMethod(), writeMethod));
+ setWriteMethod0(writeMethod);
+ }
+
+ private void setWriteMethod0(Method writeMethod) {
this.writeMethodRef.set(writeMethod);
if (writeMethod == null) {
writeMethodName = null;
return;
}
- // Set the property type - which validates the method
- setPropertyType(findPropertyType(getReadMethod(), writeMethod));
setClass0(writeMethod.getDeclaringClass());
writeMethodName = writeMethod.getName();
--- a/jdk/src/share/classes/java/lang/Class.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/lang/Class.java Fri Jul 25 09:44:53 2014 +0000
@@ -134,10 +134,11 @@
* This constructor is not used and prevents the default constructor being
* generated.
*/
- private Class(ClassLoader loader) {
+ private Class(ClassLoader loader, Class<?> arrayComponentType) {
// Initialize final field for classLoader. The initialization value of non-null
// prevents future JIT optimizations from assuming this final field is null.
classLoader = loader;
+ componentType = arrayComponentType;
}
/**
@@ -917,7 +918,16 @@
* @see java.lang.reflect.Array
* @since 1.1
*/
- public native Class<?> getComponentType();
+ public Class<?> getComponentType() {
+ // Only return for array types. Storage may be reused for Class for instance types.
+ if (isArray()) {
+ return componentType;
+ } else {
+ return null;
+ }
+ }
+
+ private final Class<?> componentType;
/**
--- a/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java Fri Jul 25 09:44:53 2014 +0000
@@ -147,7 +147,7 @@
}
private static char[] lookUpTable(String src, int index, Locale locale, boolean bLowerCasing) {
- HashSet<Entry> set = entryTable.get(new Integer(src.codePointAt(index)));
+ HashSet<Entry> set = entryTable.get(src.codePointAt(index));
char[] ret = null;
if (set != null) {
--- a/jdk/src/share/classes/java/lang/ProcessBuilder.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/lang/ProcessBuilder.java Fri Jul 25 09:44:53 2014 +0000
@@ -957,6 +957,7 @@
* <li>The operating system program file was not found.
* <li>Access to the program file was denied.
* <li>The working directory does not exist.
+ * <li>Invalid character in command argument, such as NUL.
* </ul>
*
* <p>In such cases an exception will be thrown. The exact nature
@@ -1019,6 +1020,12 @@
String dir = directory == null ? null : directory.toString();
+ for (int i = 1; i < cmdarray.length; i++) {
+ if (cmdarray[i].indexOf('\u0000') >= 0) {
+ throw new IOException("invalid null character in command");
+ }
+ }
+
try {
return ProcessImpl.start(cmdarray,
environment,
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java Fri Jul 25 09:44:53 2014 +0000
@@ -1505,6 +1505,10 @@
// that is *not* the bytecode behavior.
mods ^= Modifier.PROTECTED | Modifier.PUBLIC;
}
+ if (Modifier.isProtected(mods) && refKind == REF_newInvokeSpecial) {
+ // cannot "new" a protected ctor in a different package
+ mods ^= Modifier.PROTECTED;
+ }
if (Modifier.isFinal(mods) &&
MethodHandleNatives.refKindIsSetter(refKind))
throw m.makeAccessException("unexpected set of a final field", this);
--- a/jdk/src/share/classes/java/lang/reflect/Proxy.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/lang/reflect/Proxy.java Fri Jul 25 09:44:53 2014 +0000
@@ -362,12 +362,13 @@
Class<?>... interfaces)
throws IllegalArgumentException
{
- SecurityManager sm = System.getSecurityManager();
+ final Class<?>[] intfs = interfaces.clone();
+ final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
- checkProxyAccess(Reflection.getCallerClass(), loader, interfaces);
+ checkProxyAccess(Reflection.getCallerClass(), loader, intfs);
}
- return getProxyClass0(loader, interfaces);
+ return getProxyClass0(loader, intfs);
}
/*
@@ -706,15 +707,16 @@
{
Objects.requireNonNull(h);
+ final Class<?>[] intfs = interfaces.clone();
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
- checkProxyAccess(Reflection.getCallerClass(), loader, interfaces);
+ checkProxyAccess(Reflection.getCallerClass(), loader, intfs);
}
/*
* Look up or generate the designated proxy class.
*/
- Class<?> cl = getProxyClass0(loader, interfaces);
+ Class<?> cl = getProxyClass0(loader, intfs);
/*
* Invoke its constructor with the designated invocation handler.
--- a/jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -322,13 +322,13 @@
switch (optID) {
case SO_TIMEOUT:
- result = new Integer(timeout);
+ result = timeout;
break;
case IP_TOS:
result = socketGetOption(optID);
if ( ((Integer)result).intValue() == -1) {
- result = new Integer(trafficClass);
+ result = trafficClass;
}
break;
--- a/jdk/src/share/classes/java/net/AbstractPlainSocketImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/net/AbstractPlainSocketImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -279,7 +279,7 @@
throw new SocketException("Socket Closed");
}
if (opt == SO_TIMEOUT) {
- return new Integer(timeout);
+ return timeout;
}
int ret = 0;
/*
@@ -299,7 +299,7 @@
return Boolean.valueOf(ret != -1);
case SO_LINGER:
ret = socketGetOption(opt, null);
- return (ret == -1) ? Boolean.FALSE: (Object)(new Integer(ret));
+ return (ret == -1) ? Boolean.FALSE: (Object)(ret);
case SO_REUSEADDR:
ret = socketGetOption(opt, null);
return Boolean.valueOf(ret != -1);
@@ -310,13 +310,13 @@
case SO_SNDBUF:
case SO_RCVBUF:
ret = socketGetOption(opt, null);
- return new Integer(ret);
+ return ret;
case IP_TOS:
ret = socketGetOption(opt, null);
if (ret == -1) { // ipv6 tos
- return new Integer(trafficClass);
+ return trafficClass;
} else {
- return new Integer(ret);
+ return ret;
}
case SO_KEEPALIVE:
ret = socketGetOption(opt, null);
--- a/jdk/src/share/classes/java/net/DatagramSocket.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/net/DatagramSocket.java Fri Jul 25 09:44:53 2014 +0000
@@ -858,7 +858,7 @@
public synchronized void setSoTimeout(int timeout) throws SocketException {
if (isClosed())
throw new SocketException("Socket is closed");
- getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ getImpl().setOption(SocketOptions.SO_TIMEOUT, timeout);
}
/**
@@ -920,7 +920,7 @@
}
if (isClosed())
throw new SocketException("Socket is closed");
- getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size));
+ getImpl().setOption(SocketOptions.SO_SNDBUF, size);
}
/**
@@ -978,7 +978,7 @@
}
if (isClosed())
throw new SocketException("Socket is closed");
- getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+ getImpl().setOption(SocketOptions.SO_RCVBUF, size);
}
/**
@@ -1040,7 +1040,7 @@
throw new SocketException("Socket is closed");
// Integer instead of Boolean for compatibility with older DatagramSocketImpl
if (oldImpl)
- getImpl().setOption(SocketOptions.SO_REUSEADDR, new Integer(on?-1:0));
+ getImpl().setOption(SocketOptions.SO_REUSEADDR, on?-1:0);
else
getImpl().setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(on));
}
@@ -1141,7 +1141,7 @@
if (isClosed())
throw new SocketException("Socket is closed");
- getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc));
+ getImpl().setOption(SocketOptions.IP_TOS, tc);
}
/**
--- a/jdk/src/share/classes/java/net/ServerSocket.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/net/ServerSocket.java Fri Jul 25 09:44:53 2014 +0000
@@ -650,7 +650,7 @@
public synchronized void setSoTimeout(int timeout) throws SocketException {
if (isClosed())
throw new SocketException("Socket is closed");
- getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ getImpl().setOption(SocketOptions.SO_TIMEOUT, timeout);
}
/**
@@ -847,7 +847,7 @@
}
if (isClosed())
throw new SocketException("Socket is closed");
- getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+ getImpl().setOption(SocketOptions.SO_RCVBUF, size);
}
/**
--- a/jdk/src/share/classes/java/net/Socket.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/net/Socket.java Fri Jul 25 09:44:53 2014 +0000
@@ -1024,7 +1024,7 @@
}
if (linger > 65535)
linger = 65535;
- getImpl().setOption(SocketOptions.SO_LINGER, new Integer(linger));
+ getImpl().setOption(SocketOptions.SO_LINGER, linger);
}
}
@@ -1140,7 +1140,7 @@
if (timeout < 0)
throw new IllegalArgumentException("timeout can't be negative");
- getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ getImpl().setOption(SocketOptions.SO_TIMEOUT, timeout);
}
/**
@@ -1196,7 +1196,7 @@
}
if (isClosed())
throw new SocketException("Socket is closed");
- getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size));
+ getImpl().setOption(SocketOptions.SO_SNDBUF, size);
}
/**
@@ -1270,7 +1270,7 @@
}
if (isClosed())
throw new SocketException("Socket is closed");
- getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+ getImpl().setOption(SocketOptions.SO_RCVBUF, size);
}
/**
@@ -1380,7 +1380,7 @@
if (isClosed())
throw new SocketException("Socket is closed");
- getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc));
+ getImpl().setOption(SocketOptions.IP_TOS, tc);
}
/**
--- a/jdk/src/share/classes/java/nio/charset/CoderResult.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/nio/charset/CoderResult.java Fri Jul 25 09:44:53 2014 +0000
@@ -200,7 +200,7 @@
private synchronized CoderResult get(int len) {
if (len <= 0)
throw new IllegalArgumentException("Non-positive length");
- Integer k = new Integer(len);
+ Integer k = len;
WeakReference<CoderResult> w;
CoderResult e = null;
if (cache == null) {
--- a/jdk/src/share/classes/java/security/Provider.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/security/Provider.java Fri Jul 25 09:44:53 2014 +0000
@@ -1376,7 +1376,7 @@
* <p>This class defines the methods {@link #supportsParameter
* supportsParameter()} and {@link #newInstance newInstance()}
* which are used by the Java security framework when it searches for
- * suitable services and instantes them. The valid arguments to those
+ * suitable services and instantiates them. The valid arguments to those
* methods depend on the type of service. For the service types defined
* within Java SE, see the
* <a href="../../../technotes/guides/security/crypto/CryptoSpec.html">
@@ -1566,7 +1566,7 @@
*
* @throws InvalidParameterException if the value of
* constructorParameter is invalid for this type of service.
- * @throws NoSuchAlgorithmException if instantation failed for
+ * @throws NoSuchAlgorithmException if instantiation failed for
* any other reason.
*/
public Object newInstance(Object constructorParameter)
@@ -1594,7 +1594,9 @@
+ " engines");
}
Class<?> clazz = getImplClass();
- return clazz.newInstance();
+ Class<?>[] empty = {};
+ Constructor<?> con = clazz.getConstructor(empty);
+ return con.newInstance();
} else {
Class<?> paramClass = cap.getConstructorParameterClass();
if (constructorParameter != null) {
@@ -1637,13 +1639,18 @@
} else {
clazz = cl.loadClass(className);
}
+ if (!Modifier.isPublic(clazz.getModifiers())) {
+ throw new NoSuchAlgorithmException
+ ("class configured for " + type + " (provider: " +
+ provider.getName() + ") is not public.");
+ }
classRef = new WeakReference<Class<?>>(clazz);
}
return clazz;
} catch (ClassNotFoundException e) {
throw new NoSuchAlgorithmException
- ("class configured for " + type + "(provider: " +
- provider.getName() + ")" + "cannot be found.", e);
+ ("class configured for " + type + " (provider: " +
+ provider.getName() + ") cannot be found.", e);
}
}
@@ -1656,15 +1663,21 @@
throws Exception {
Class<?> clazz = getImplClass();
if (constructorParameter == null) {
- Object o = clazz.newInstance();
- return o;
+ // create instance with public no-arg constructor if it exists
+ try {
+ Class<?>[] empty = {};
+ Constructor<?> con = clazz.getConstructor(empty);
+ return con.newInstance();
+ } catch (NoSuchMethodException e) {
+ throw new NoSuchAlgorithmException("No public no-arg "
+ + "constructor found in class " + className);
+ }
}
Class<?> argClass = constructorParameter.getClass();
Constructor<?>[] cons = clazz.getConstructors();
// find first public constructor that can take the
// argument as parameter
- for (int i = 0; i < cons.length; i++) {
- Constructor<?> con = cons[i];
+ for (Constructor<?> con : cons) {
Class<?>[] paramTypes = con.getParameterTypes();
if (paramTypes.length != 1) {
continue;
@@ -1672,10 +1685,9 @@
if (paramTypes[0].isAssignableFrom(argClass) == false) {
continue;
}
- Object o = con.newInstance(new Object[] {constructorParameter});
- return o;
+ return con.newInstance(constructorParameter);
}
- throw new NoSuchAlgorithmException("No constructor matching "
+ throw new NoSuchAlgorithmException("No public constructor matching "
+ argClass.getName() + " found in class " + className);
}
--- a/jdk/src/share/classes/java/security/SignedObject.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/security/SignedObject.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -211,7 +211,9 @@
* @param verificationKey the public key for verification.
* @param verificationEngine the signature verification engine.
*
- * @exception SignatureException if signature verification failed.
+ * @exception SignatureException if signature verification failed (an
+ * exception prevented the signature verification engine from completing
+ * normally).
* @exception InvalidKeyException if the verification key is invalid.
*
* @return {@code true} if the signature
--- a/jdk/src/share/classes/java/util/Locale.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/Locale.java Fri Jul 25 09:44:53 2014 +0000
@@ -1924,7 +1924,7 @@
// the qualifier; if there are no qualifiers, the third element is
// unused by the format pattern.
Object[] displayNames = {
- new Integer(qualifierNames.length != 0 ? 2 : 1),
+ qualifierNames.length != 0 ? 2 : 1,
mainName,
// We could also just call formatList() and have it handle the empty
// list case, but this is more efficient, and we want it to be
@@ -2078,7 +2078,7 @@
// Rebuild the argument list with the list length as the first element
Object[] args = new Object[stringList.length + 1];
System.arraycopy(stringList, 0, args, 1, stringList.length);
- args[0] = new Integer(stringList.length);
+ args[0] = stringList.length;
// Format it using the pattern in the resource
MessageFormat format = new MessageFormat(listPattern);
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Fri Jul 25 09:44:53 2014 +0000
@@ -334,6 +334,8 @@
if (vclass != fieldClass)
throw new ClassCastException();
+ if (vclass.isPrimitive())
+ throw new IllegalArgumentException("Must be reference type");
if (!Modifier.isVolatile(modifiers))
throw new IllegalArgumentException("Must be volatile type");
--- a/jdk/src/share/classes/java/util/prefs/XmlSupport.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/prefs/XmlSupport.java Fri Jul 25 09:44:53 2014 +0000
@@ -262,7 +262,7 @@
try {
TransformerFactory tf = TransformerFactory.newInstance();
try {
- tf.setAttribute("indent-number", new Integer(2));
+ tf.setAttribute("indent-number", 2);
} catch (IllegalArgumentException iae) {
//Ignore the IAE. Should not fail the writeout even the
//transformer provider does not support "indent-number".
--- a/jdk/src/share/classes/java/util/regex/Pattern.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/regex/Pattern.java Fri Jul 25 09:44:53 2014 +0000
@@ -917,6 +917,13 @@
*/
public static final int UNICODE_CHARACTER_CLASS = 0x100;
+ /**
+ * Contains all possible flags for compile(regex, flags).
+ */
+ private static final int ALL_FLAGS = CASE_INSENSITIVE | MULTILINE |
+ DOTALL | UNICODE_CASE | CANON_EQ | UNIX_LINES | LITERAL |
+ UNICODE_CHARACTER_CLASS | COMMENTS;
+
/* Pattern has only two serialized components: The pattern string
* and the flags, which are all that is needed to recompile the pattern
* when it is deserialized.
@@ -1336,6 +1343,10 @@
* only a Start node and a LastNode node.
*/
private Pattern(String p, int f) {
+ if ((f & ~ALL_FLAGS) != 0) {
+ throw new IllegalArgumentException("Unknown flag 0x"
+ + Integer.toHexString(f));
+ }
pattern = p;
flags = f;
--- a/jdk/src/share/classes/java/util/stream/AbstractPipeline.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/AbstractPipeline.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, 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
@@ -322,6 +322,7 @@
@Override
@SuppressWarnings("unchecked")
public S onClose(Runnable closeHandler) {
+ Objects.requireNonNull(closeHandler);
Runnable existingHandler = sourceStage.sourceCloseAction;
sourceStage.sourceCloseAction =
(existingHandler == null)
@@ -406,7 +407,7 @@
// Clear the short circuit flag for next pipeline stage
// This stage encapsulates short-circuiting, the next
// stage may not have any short-circuit operations, and
- // if so spliterator.forEachRemaining should be be used
+ // if so spliterator.forEachRemaining should be used
// for traversal
thisOpFlags = thisOpFlags & ~StreamOpFlag.IS_SHORT_CIRCUIT;
}
--- a/jdk/src/share/classes/java/util/stream/BaseStream.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/BaseStream.java Fri Jul 25 09:44:53 2014 +0000
@@ -53,7 +53,7 @@
* parallelism, which governs the behavior of all stream types.
*
* @param <T> the type of the stream elements
- * @param <S> the type of of the stream implementing {@code BaseStream}
+ * @param <S> the type of the stream implementing {@code BaseStream}
* @since 1.8
* @see Stream
* @see IntStream
--- a/jdk/src/share/classes/java/util/stream/DoublePipeline.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/DoublePipeline.java Fri Jul 25 09:44:53 2014 +0000
@@ -254,6 +254,7 @@
@Override
public final DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper) {
+ Objects.requireNonNull(mapper);
return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
@Override
@@ -469,6 +470,7 @@
public final <R> R collect(Supplier<R> supplier,
ObjDoubleConsumer<R> accumulator,
BiConsumer<R, R> combiner) {
+ Objects.requireNonNull(combiner);
BinaryOperator<R> operator = (left, right) -> {
combiner.accept(left, right);
return left;
--- a/jdk/src/share/classes/java/util/stream/DoubleStream.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/DoubleStream.java Fri Jul 25 09:44:53 2014 +0000
@@ -768,7 +768,7 @@
* to the element at position {@code n - 1}.
*
* @param seed the initial element
- * @param f a function to be applied to to the previous element to produce
+ * @param f a function to be applied to the previous element to produce
* a new element
* @return a new sequential {@code DoubleStream}
*/
--- a/jdk/src/share/classes/java/util/stream/IntPipeline.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/IntPipeline.java Fri Jul 25 09:44:53 2014 +0000
@@ -290,6 +290,7 @@
@Override
public final IntStream flatMap(IntFunction<? extends IntStream> mapper) {
+ Objects.requireNonNull(mapper);
return new StatelessOp<Integer>(this, StreamShape.INT_VALUE,
StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
@Override
@@ -465,6 +466,7 @@
public final <R> R collect(Supplier<R> supplier,
ObjIntConsumer<R> accumulator,
BiConsumer<R, R> combiner) {
+ Objects.requireNonNull(combiner);
BinaryOperator<R> operator = (left, right) -> {
combiner.accept(left, right);
return left;
--- a/jdk/src/share/classes/java/util/stream/IntStream.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/IntStream.java Fri Jul 25 09:44:53 2014 +0000
@@ -734,7 +734,7 @@
* element at position {@code n - 1}.
*
* @param seed the initial element
- * @param f a function to be applied to to the previous element to produce
+ * @param f a function to be applied to the previous element to produce
* a new element
* @return A new sequential {@code IntStream}
*/
--- a/jdk/src/share/classes/java/util/stream/LongPipeline.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/LongPipeline.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -271,6 +271,7 @@
@Override
public final LongStream flatMap(LongFunction<? extends LongStream> mapper) {
+ Objects.requireNonNull(mapper);
return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
@Override
@@ -447,6 +448,7 @@
public final <R> R collect(Supplier<R> supplier,
ObjLongConsumer<R> accumulator,
BiConsumer<R, R> combiner) {
+ Objects.requireNonNull(combiner);
BinaryOperator<R> operator = (left, right) -> {
combiner.accept(left, right);
return left;
--- a/jdk/src/share/classes/java/util/stream/LongStream.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/LongStream.java Fri Jul 25 09:44:53 2014 +0000
@@ -727,7 +727,7 @@
* element at position {@code n - 1}.
*
* @param seed the initial element
- * @param f a function to be applied to to the previous element to produce
+ * @param f a function to be applied to the previous element to produce
* a new element
* @return a new sequential {@code LongStream}
*/
--- a/jdk/src/share/classes/java/util/stream/PipelineHelper.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/PipelineHelper.java Fri Jul 25 09:44:53 2014 +0000
@@ -74,7 +74,7 @@
/**
* Returns the exact output size of the portion of the output resulting from
* applying the pipeline stages described by this {@code PipelineHelper} to
- * the the portion of the input described by the provided
+ * the portion of the input described by the provided
* {@code Spliterator}, if known. If not known or known infinite, will
* return {@code -1}.
*
--- a/jdk/src/share/classes/java/util/stream/SliceOps.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/SliceOps.java Fri Jul 25 09:44:53 2014 +0000
@@ -693,7 +693,7 @@
* size.
*
* @param target the target size
- * @return return the number of completed elements
+ * @return the number of completed elements
*/
private long completedSize(long target) {
if (completed)
--- a/jdk/src/share/classes/java/util/stream/Stream.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/Stream.java Fri Jul 25 09:44:53 2014 +0000
@@ -1013,7 +1013,7 @@
*
* @param <T> the type of stream elements
* @param seed the initial element
- * @param f a function to be applied to to the previous element to produce
+ * @param f a function to be applied to the previous element to produce
* a new element
* @return a new sequential {@code Stream}
*/
--- a/jdk/src/share/classes/java/util/stream/StreamOpFlag.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/StreamOpFlag.java Fri Jul 25 09:44:53 2014 +0000
@@ -115,7 +115,7 @@
* characteristics that stream has; when describing a stream operation, one need
* describe whether the operation preserves, injects, or clears that
* characteristic. Accordingly, two bits are used for each flag, so as to allow
- * representing not only the presence of of a characteristic, but how an
+ * representing not only the presence of a characteristic, but how an
* operation modifies that characteristic. There are two common forms in which
* flag bits are combined into an {@code int} bit set. <em>Stream flags</em>
* are a unioned bit set constructed by ORing the enum characteristic values of
--- a/jdk/src/share/classes/javax/accessibility/AccessibleBundle.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleBundle.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -49,7 +49,7 @@
*/
public abstract class AccessibleBundle {
- private static Hashtable table = new Hashtable();
+ private static Hashtable<Locale, Hashtable<String, Object>> table = new Hashtable<>();
private final String defaultResourceBundleName
= "com.sun.accessibility.internal.resources.accessibility";
@@ -85,14 +85,12 @@
loadResourceBundle(resourceBundleName, locale);
// returns the localized string
- Object o = table.get(locale);
- if (o != null && o instanceof Hashtable) {
- Hashtable resourceTable = (Hashtable) o;
- o = resourceTable.get(key);
-
- if (o != null && o instanceof String) {
- return (String)o;
- }
+ Hashtable<String, Object> ht = table.get(locale);
+ if (ht != null) {
+ Object o = ht.get(key);
+ if (o != null && o instanceof String) {
+ return (String)o;
+ }
}
return key;
}
@@ -134,13 +132,13 @@
if (! table.contains(locale)) {
try {
- Hashtable resourceTable = new Hashtable();
+ Hashtable<String, Object> resourceTable = new Hashtable<>();
ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName, locale);
- Enumeration iter = bundle.getKeys();
+ Enumeration<String> iter = bundle.getKeys();
while(iter.hasMoreElements()) {
- String key = (String)iter.nextElement();
+ String key = iter.nextElement();
resourceTable.put(key, bundle.getObject(key));
}
--- a/jdk/src/share/classes/javax/accessibility/AccessibleRelationSet.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleRelationSet.java Fri Jul 25 09:44:53 2014 +0000
@@ -71,7 +71,7 @@
*/
public AccessibleRelationSet(AccessibleRelation[] relations) {
if (relations.length != 0) {
- this.relations = new Vector(relations.length);
+ this.relations = new Vector<>(relations.length);
for (int i = 0; i < relations.length; i++) {
add(relations[i]);
}
@@ -90,7 +90,7 @@
*/
public boolean add(AccessibleRelation relation) {
if (relations == null) {
- relations = new Vector();
+ relations = new Vector<>();
}
// Merge the relation targets if the key exists
@@ -125,7 +125,7 @@
public void addAll(AccessibleRelation[] relations) {
if (relations.length != 0) {
if (this.relations == null) {
- this.relations = new Vector(relations.length);
+ this.relations = new Vector<>(relations.length);
}
for (int i = 0; i < relations.length; i++) {
add(relations[i]);
--- a/jdk/src/share/classes/javax/accessibility/AccessibleStateSet.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleStateSet.java Fri Jul 25 09:44:53 2014 +0000
@@ -68,7 +68,7 @@
*/
public AccessibleStateSet(AccessibleState[] states) {
if (states.length != 0) {
- this.states = new Vector(states.length);
+ this.states = new Vector<>(states.length);
for (int i = 0; i < states.length; i++) {
if (!this.states.contains(states[i])) {
this.states.addElement(states[i]);
@@ -92,7 +92,7 @@
// to always use a vector of states. It could be improved by
// caching the states as a bit set.]]]
if (states == null) {
- states = new Vector();
+ states = new Vector<>();
}
if (!states.contains(state)) {
@@ -111,7 +111,7 @@
public void addAll(AccessibleState[] states) {
if (states.length != 0) {
if (this.states == null) {
- this.states = new Vector(states.length);
+ this.states = new Vector<>(states.length);
}
for (int i = 0; i < states.length; i++) {
if (!this.states.contains(states[i])) {
--- a/jdk/src/share/classes/javax/crypto/CryptoPolicyParser.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/crypto/CryptoPolicyParser.java Fri Jul 25 09:44:53 2014 +0000
@@ -256,11 +256,11 @@
while (peek(",")) {
match(",");
if (peek("number")) {
- paramsV.addElement(new Integer(match()));
+ paramsV.addElement(match());
} else {
if (peek("*")) {
match("*");
- paramsV.addElement(new Integer(Integer.MAX_VALUE));
+ paramsV.addElement(Integer.MAX_VALUE);
} else {
throw new ParsingException(st.lineno(),
"Expecting an integer");
--- a/jdk/src/share/classes/javax/management/loading/MLet.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/management/loading/MLet.java Fri Jul 25 09:44:53 2014 +0000
@@ -1313,7 +1313,7 @@
if (type.compareTo("java.lang.Long") == 0)
return Long.valueOf(param);
if (type.compareTo("java.lang.Integer") == 0)
- return new Integer(param);
+ return param;
if (type.compareTo("java.lang.Float") == 0)
return new Float(param);
if (type.compareTo("java.lang.Double") == 0)
--- a/jdk/src/share/classes/javax/management/relation/RelationService.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/management/relation/RelationService.java Fri Jul 25 09:44:53 2014 +0000
@@ -3208,7 +3208,7 @@
// End of check :)
RELATION_LOGGER.exiting(RelationService.class.getName(),
"checkRoleInt");
- return new Integer(0);
+ return 0;
}
}
@@ -3218,7 +3218,7 @@
if (!isWritable) {
RELATION_LOGGER.exiting(RelationService.class.getName(),
"checkRoleInt");
- return new Integer(RoleStatus.ROLE_NOT_WRITABLE);
+ return RoleStatus.ROLE_NOT_WRITABLE;
}
}
@@ -3229,7 +3229,7 @@
if (!chkMinFlag) {
RELATION_LOGGER.exiting(RelationService.class.getName(),
"checkRoleInt");
- return new Integer(RoleStatus.LESS_THAN_MIN_ROLE_DEGREE);
+ return RoleStatus.LESS_THAN_MIN_ROLE_DEGREE;
}
// Checks maximum cardinality
@@ -3237,7 +3237,7 @@
if (!chkMaxFlag) {
RELATION_LOGGER.exiting(RelationService.class.getName(),
"checkRoleInt");
- return new Integer(RoleStatus.MORE_THAN_MAX_ROLE_DEGREE);
+ return RoleStatus.MORE_THAN_MAX_ROLE_DEGREE;
}
// Verifies that each referenced MBean is registered in the MBean
@@ -3254,7 +3254,7 @@
if (currObjName == null) {
RELATION_LOGGER.exiting(RelationService.class.getName(),
"checkRoleInt");
- return new Integer(RoleStatus.REF_MBEAN_NOT_REGISTERED);
+ return RoleStatus.REF_MBEAN_NOT_REGISTERED;
}
// Checks if it is of the correct class
@@ -3265,19 +3265,19 @@
if (!classSts) {
RELATION_LOGGER.exiting(RelationService.class.getName(),
"checkRoleInt");
- return new Integer(RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS);
+ return RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS;
}
} catch (InstanceNotFoundException exc) {
RELATION_LOGGER.exiting(RelationService.class.getName(),
"checkRoleInt");
- return new Integer(RoleStatus.REF_MBEAN_NOT_REGISTERED);
+ return RoleStatus.REF_MBEAN_NOT_REGISTERED;
}
}
RELATION_LOGGER.exiting(RelationService.class.getName(),
"checkRoleInt");
- return new Integer(0);
+ return 0;
}
--- a/jdk/src/share/classes/javax/swing/AbstractButton.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/AbstractButton.java Fri Jul 25 09:44:53 2014 +0000
@@ -1123,7 +1123,7 @@
}
}
- private boolean isListener(Class c, ActionListener a) {
+ private boolean isListener(Class<?> c, ActionListener a) {
boolean isListener = false;
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length-2; i>=0; i-=2) {
--- a/jdk/src/share/classes/javax/swing/ArrayTable.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/ArrayTable.java Fri Jul 25 09:44:53 2014 +0000
@@ -133,7 +133,9 @@
if ((size==ARRAY_BOUNDARY) && isArray()) {
grow();
}
- ((Hashtable<Object,Object>)table).put(key, value);
+ @SuppressWarnings("unchecked")
+ Hashtable<Object,Object> tmp = (Hashtable<Object,Object>)table;
+ tmp.put(key, value);
}
}
}
--- a/jdk/src/share/classes/javax/swing/DebugGraphics.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/DebugGraphics.java Fri Jul 25 09:44:53 2014 +0000
@@ -1463,7 +1463,5 @@
}
return debugGraphicsInfo;
}
- private static final Class debugGraphicsInfoKey = DebugGraphicsInfo.class;
-
-
+ private static final Class<DebugGraphicsInfo> debugGraphicsInfoKey = DebugGraphicsInfo.class;
}
--- a/jdk/src/share/classes/javax/swing/DefaultCellEditor.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/DefaultCellEditor.java Fri Jul 25 09:44:53 2014 +0000
@@ -131,7 +131,7 @@
*
* @param comboBox a <code>JComboBox</code> object
*/
- public DefaultCellEditor(final JComboBox comboBox) {
+ public DefaultCellEditor(final JComboBox<?> comboBox) {
editorComponent = comboBox;
comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
delegate = new EditorDelegate() {
--- a/jdk/src/share/classes/javax/swing/DefaultRowSorter.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/DefaultRowSorter.java Fri Jul 25 09:44:53 2014 +0000
@@ -128,7 +128,7 @@
/**
* Comparators specified by column.
*/
- private Comparator[] comparators;
+ private Comparator<?>[] comparators;
/**
* Whether or not the specified column is sortable, by column.
@@ -143,7 +143,7 @@
/**
* Cached comparators for the current sort
*/
- private Comparator[] sortComparators;
+ private Comparator<?>[] sortComparators;
/**
* Developer supplied Filter.
@@ -695,7 +695,7 @@
*/
private void cacheSortKeys(List<? extends SortKey> keys) {
int keySize = keys.size();
- sortComparators = new Comparator[keySize];
+ sortComparators = new Comparator<?>[keySize];
for (int i = 0; i < keySize; i++) {
sortComparators[i] = getComparator0(keys.get(i).getColumn());
}
@@ -762,7 +762,7 @@
public void setComparator(int column, Comparator<?> comparator) {
checkColumn(column);
if (comparators == null) {
- comparators = new Comparator[getModelWrapper().getColumnCount()];
+ comparators = new Comparator<?>[getModelWrapper().getColumnCount()];
}
comparators[column] = comparator;
}
@@ -788,8 +788,8 @@
// Returns the Comparator to use during sorting. Where as
// getComparator() may return null, this will never return null.
- private Comparator getComparator0(int column) {
- Comparator comparator = getComparator(column);
+ private Comparator<?> getComparator0(int column) {
+ Comparator<?> comparator = getComparator(column);
if (comparator != null) {
return comparator;
}
@@ -967,7 +967,9 @@
} else if (v2 == null) {
result = 1;
} else {
- result = sortComparators[counter].compare(v1, v2);
+ Comparator<Object> c =
+ (Comparator<Object>)sortComparators[counter];
+ result = c.compare(v1, v2);
}
if (sortOrder == SortOrder.DESCENDING) {
result *= -1;
@@ -1366,10 +1368,10 @@
*/
// NOTE: this class is static so that it can be placed in an array
private static class Row implements Comparable<Row> {
- private DefaultRowSorter sorter;
+ private DefaultRowSorter<?, ?> sorter;
int modelIndex;
- public Row(DefaultRowSorter sorter, int index) {
+ public Row(DefaultRowSorter<?, ?> sorter, int index) {
this.sorter = sorter;
modelIndex = index;
}
--- a/jdk/src/share/classes/javax/swing/JComboBox.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JComboBox.java Fri Jul 25 09:44:53 2014 +0000
@@ -1100,7 +1100,7 @@
}
}
- private boolean isListener(Class c, ActionListener a) {
+ private boolean isListener(Class<?> c, ActionListener a) {
boolean isListener = false;
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length-2; i>=0; i-=2) {
@@ -1530,11 +1530,11 @@
* @return an int equal to the selected row, where 0 is the
* first item and -1 is none.
*/
- int selectionForKey(char aKey,ComboBoxModel aModel);
+ int selectionForKey(char aKey,ComboBoxModel<?> aModel);
}
class DefaultKeySelectionManager implements KeySelectionManager, Serializable {
- public int selectionForKey(char aKey,ComboBoxModel aModel) {
+ public int selectionForKey(char aKey,ComboBoxModel<?> aModel) {
int i,c;
int currentSelection = -1;
Object selectedItem = aModel.getSelectedItem();
@@ -1656,7 +1656,7 @@
implements AccessibleAction, AccessibleSelection {
- private JList popupList; // combo box popup list
+ private JList<?> popupList; // combo box popup list
private Accessible previousSelectedAccessible = null;
/**
@@ -1980,7 +1980,7 @@
a instanceof javax.swing.plaf.basic.ComboPopup) {
// get the popup list
- JList list = ((javax.swing.plaf.basic.ComboPopup)a).getList();
+ JList<?> list = ((javax.swing.plaf.basic.ComboPopup)a).getList();
// return the i-th selection in the popup list
AccessibleContext ac = list.getAccessibleContext();
--- a/jdk/src/share/classes/javax/swing/JComponent.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JComponent.java Fri Jul 25 09:44:53 2014 +0000
@@ -2111,6 +2111,7 @@
private void registerWithKeyboardManager(boolean onlyIfNew) {
InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW, false);
KeyStroke[] strokes;
+ @SuppressWarnings("unchecked")
Hashtable<KeyStroke, KeyStroke> registered =
(Hashtable<KeyStroke, KeyStroke>)getClientProperty
(WHEN_IN_FOCUSED_WINDOW_BINDINGS);
@@ -2164,6 +2165,7 @@
* <code>WHEN_IN_FOCUSED_WINDOW</code> <code>KeyStroke</code> bindings.
*/
private void unregisterWithKeyboardManager() {
+ @SuppressWarnings("unchecked")
Hashtable<KeyStroke, KeyStroke> registered =
(Hashtable<KeyStroke, KeyStroke>)getClientProperty
(WHEN_IN_FOCUSED_WINDOW_BINDINGS);
@@ -4126,16 +4128,20 @@
setFlag(AUTOSCROLLS_SET, false);
}
} else if (propertyName == "focusTraversalKeysForward") {
+ @SuppressWarnings("unchecked")
+ Set<AWTKeyStroke> strokeSet = (Set<AWTKeyStroke>) value;
if (!getFlag(FOCUS_TRAVERSAL_KEYS_FORWARD_SET)) {
super.setFocusTraversalKeys(KeyboardFocusManager.
FORWARD_TRAVERSAL_KEYS,
- (Set<AWTKeyStroke>)value);
+ strokeSet);
}
} else if (propertyName == "focusTraversalKeysBackward") {
+ @SuppressWarnings("unchecked")
+ Set<AWTKeyStroke> strokeSet = (Set<AWTKeyStroke>) value;
if (!getFlag(FOCUS_TRAVERSAL_KEYS_BACKWARD_SET)) {
super.setFocusTraversalKeys(KeyboardFocusManager.
BACKWARD_TRAVERSAL_KEYS,
- (Set<AWTKeyStroke>)value);
+ strokeSet);
}
} else {
throw new IllegalArgumentException("property \""+
@@ -4713,6 +4719,7 @@
* @see #getVetoableChangeListeners
* @see #getAncestorListeners
*/
+ @SuppressWarnings("unchecked") // Casts to (T[])
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
T[] result;
if (listenerType == AncestorListener.class) {
--- a/jdk/src/share/classes/javax/swing/JEditorPane.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JEditorPane.java Fri Jul 25 09:44:53 2014 +0000
@@ -1191,7 +1191,7 @@
String classname = getKitTypeRegistry().get(type);
ClassLoader loader = getKitLoaderRegistry().get(type);
try {
- Class c;
+ Class<?> c;
if (loader != null) {
c = loader.loadClass(classname);
} else {
@@ -1265,18 +1265,26 @@
private static Hashtable<String, String> getKitTypeRegistry() {
loadDefaultKitsIfNecessary();
- return (Hashtable)SwingUtilities.appContextGet(kitTypeRegistryKey);
+ @SuppressWarnings("unchecked")
+ Hashtable<String, String> tmp =
+ (Hashtable)SwingUtilities.appContextGet(kitTypeRegistryKey);
+ return tmp;
}
private static Hashtable<String, ClassLoader> getKitLoaderRegistry() {
loadDefaultKitsIfNecessary();
- return (Hashtable)SwingUtilities.appContextGet(kitLoaderRegistryKey);
+ @SuppressWarnings("unchecked")
+ Hashtable<String, ClassLoader> tmp =
+ (Hashtable)SwingUtilities.appContextGet(kitLoaderRegistryKey);
+ return tmp;
}
private static Hashtable<String, EditorKit> getKitRegisty() {
- Hashtable ht = (Hashtable)SwingUtilities.appContextGet(kitRegistryKey);
+ @SuppressWarnings("unchecked")
+ Hashtable<String, EditorKit> ht =
+ (Hashtable)SwingUtilities.appContextGet(kitRegistryKey);
if (ht == null) {
- ht = new Hashtable(3);
+ ht = new Hashtable<>(3);
SwingUtilities.appContextPut(kitRegistryKey, ht);
}
return ht;
@@ -1302,9 +1310,9 @@
"javax.swing.text.rtf.RTFEditorKit");
}
}
- Hashtable ht = new Hashtable();
+ Hashtable<Object, Object> ht = new Hashtable<>();
SwingUtilities.appContextPut(kitTypeRegistryKey, ht);
- ht = new Hashtable();
+ ht = new Hashtable<>();
SwingUtilities.appContextPut(kitLoaderRegistryKey, ht);
for (String key : defaultEditorKitMap.keySet()) {
registerEditorKitForContentType(key,defaultEditorKitMap.get(key));
--- a/jdk/src/share/classes/javax/swing/JLayer.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JLayer.java Fri Jul 25 09:44:53 2014 +0000
@@ -721,7 +721,7 @@
AWTEvent.HIERARCHY_EVENT_MASK |
AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK;
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
@@ -729,7 +729,7 @@
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
- LayerUI ui = l.getUI();
+ LayerUI<?> ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
--- a/jdk/src/share/classes/javax/swing/JOptionPane.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JOptionPane.java Fri Jul 25 09:44:53 2014 +0000
@@ -2387,7 +2387,7 @@
throws IOException, ClassNotFoundException {
s.defaultReadObject();
- Vector values = (Vector)s.readObject();
+ Vector<?> values = (Vector)s.readObject();
int indexCounter = 0;
int maxCounter = values.size();
--- a/jdk/src/share/classes/javax/swing/JSlider.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JSlider.java Fri Jul 25 09:44:53 2014 +0000
@@ -138,7 +138,7 @@
/**
* {@code Dictionary} of what labels to draw at which values
*/
- private Dictionary labelTable;
+ private Dictionary<Integer, JComponent> labelTable;
/**
@@ -773,10 +773,10 @@
}
// Check that there is a label with such image
- Enumeration elements = labelTable.elements();
+ Enumeration<JComponent> elements = labelTable.elements();
while (elements.hasMoreElements()) {
- Component component = (Component) elements.nextElement();
+ JComponent component = elements.nextElement();
if (component instanceof JLabel) {
JLabel label = (JLabel) component;
@@ -797,7 +797,7 @@
* @return the <code>Dictionary</code> containing labels and
* where to draw them
*/
- public Dictionary getLabelTable() {
+ public Dictionary<Integer, JComponent> getLabelTable() {
/*
if ( labelTable == null && getMajorTickSpacing() > 0 ) {
setLabelTable( createStandardLabels( getMajorTickSpacing() ) );
@@ -830,8 +830,8 @@
* attribute: visualUpdate true
* description: Specifies what labels will be drawn for any given value.
*/
- public void setLabelTable( Dictionary labels ) {
- Dictionary oldTable = labelTable;
+ public void setLabelTable( Dictionary<Integer, JComponent> labels ) {
+ Dictionary<Integer, JComponent> oldTable = labelTable;
labelTable = labels;
updateLabelUIs();
firePropertyChange("labelTable", oldTable, labelTable );
@@ -852,25 +852,25 @@
* @see JComponent#updateUI
*/
protected void updateLabelUIs() {
- Dictionary labelTable = getLabelTable();
+ Dictionary<Integer, JComponent> labelTable = getLabelTable();
if (labelTable == null) {
return;
}
- Enumeration labels = labelTable.keys();
+ Enumeration<Integer> labels = labelTable.keys();
while ( labels.hasMoreElements() ) {
- JComponent component = (JComponent) labelTable.get(labels.nextElement());
+ JComponent component = labelTable.get(labels.nextElement());
component.updateUI();
component.setSize(component.getPreferredSize());
}
}
private void updateLabelSizes() {
- Dictionary labelTable = getLabelTable();
+ Dictionary<Integer, JComponent> labelTable = getLabelTable();
if (labelTable != null) {
- Enumeration labels = labelTable.elements();
+ Enumeration<JComponent> labels = labelTable.elements();
while (labels.hasMoreElements()) {
- JComponent component = (JComponent) labels.nextElement();
+ JComponent component = labels.nextElement();
component.setSize(component.getPreferredSize());
}
}
@@ -898,7 +898,7 @@
* @throws IllegalArgumentException if {@code increment} is less than or
* equal to zero
*/
- public Hashtable createStandardLabels( int increment ) {
+ public Hashtable<Integer, JComponent> createStandardLabels( int increment ) {
return createStandardLabels( increment, getMinimum() );
}
@@ -926,7 +926,7 @@
* out of range, or if {@code increment} is less than or equal
* to zero
*/
- public Hashtable createStandardLabels( int increment, int start ) {
+ public Hashtable<Integer, JComponent> createStandardLabels( int increment, int start ) {
if ( start > getMaximum() || start < getMinimum() ) {
throw new IllegalArgumentException( "Slider label start point out of range." );
}
@@ -935,7 +935,7 @@
throw new IllegalArgumentException( "Label incremement must be > 0" );
}
- class SmartHashtable extends Hashtable<Object, Object> implements PropertyChangeListener {
+ class SmartHashtable extends Hashtable<Integer, JComponent> implements PropertyChangeListener {
int increment = 0;
int start = 0;
boolean startAtMin = false;
@@ -982,13 +982,13 @@
if ( e.getPropertyName().equals( "minimum" ) ||
e.getPropertyName().equals( "maximum" ) ) {
- Enumeration keys = getLabelTable().keys();
- Hashtable<Object, Object> hashtable = new Hashtable<Object, Object>();
+ Enumeration<Integer> keys = getLabelTable().keys();
+ Hashtable<Integer, JComponent> hashtable = new Hashtable<>();
// Save the labels that were added by the developer
while ( keys.hasMoreElements() ) {
- Object key = keys.nextElement();
- Object value = labelTable.get(key);
+ Integer key = keys.nextElement();
+ JComponent value = labelTable.get(key);
if ( !(value instanceof LabelUIResource) ) {
hashtable.put( key, value );
}
@@ -1000,7 +1000,7 @@
// Add the saved labels
keys = hashtable.keys();
while ( keys.hasMoreElements() ) {
- Object key = keys.nextElement();
+ Integer key = keys.nextElement();
put( key, hashtable.get( key ) );
}
@@ -1017,7 +1017,7 @@
SmartHashtable table = new SmartHashtable( increment, start );
- Dictionary labelTable = getLabelTable();
+ Dictionary<Integer, JComponent> labelTable = getLabelTable();
if (labelTable != null && (labelTable instanceof PropertyChangeListener)) {
removePropertyChangeListener((PropertyChangeListener) labelTable);
--- a/jdk/src/share/classes/javax/swing/JSpinner.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JSpinner.java Fri Jul 25 09:44:53 2014 +0000
@@ -907,7 +907,7 @@
/**
* This subclass of javax.swing.DateFormatter maps the minimum/maximum
- * properties to te start/end properties of a SpinnerDateModel.
+ * properties to the start/end properties of a SpinnerDateModel.
*/
private static class DateEditorFormatter extends DateFormatter {
private final SpinnerDateModel model;
@@ -917,19 +917,25 @@
this.model = model;
}
- public void setMinimum(Comparable min) {
- model.setStart(min);
+ @Override
+ @SuppressWarnings("unchecked")
+ public void setMinimum(Comparable<?> min) {
+ model.setStart((Comparable<Date>)min);
}
- public Comparable getMinimum() {
+ @Override
+ public Comparable<Date> getMinimum() {
return model.getStart();
}
- public void setMaximum(Comparable max) {
- model.setEnd(max);
+ @Override
+ @SuppressWarnings("unchecked")
+ public void setMaximum(Comparable<?> max) {
+ model.setEnd((Comparable<Date>)max);
}
- public Comparable getMaximum() {
+ @Override
+ public Comparable<Date> getMaximum() {
return model.getEnd();
}
}
@@ -1095,19 +1101,23 @@
setValueClass(model.getValue().getClass());
}
- public void setMinimum(Comparable min) {
+ @Override
+ public void setMinimum(Comparable<?> min) {
model.setMinimum(min);
}
- public Comparable getMinimum() {
+ @Override
+ public Comparable<?> getMinimum() {
return model.getMinimum();
}
- public void setMaximum(Comparable max) {
+ @Override
+ public void setMaximum(Comparable<?> max) {
model.setMaximum(max);
}
- public Comparable getMaximum() {
+ @Override
+ public Comparable<?> getMaximum() {
return model.getMaximum();
}
}
--- a/jdk/src/share/classes/javax/swing/JTable.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JTable.java Fri Jul 25 09:44:53 2014 +0000
@@ -354,19 +354,23 @@
/** Identifies the row of the cell being edited. */
transient protected int editingRow;
- /**
+ /**
* A table of objects that display the contents of a cell,
* indexed by class as declared in <code>getColumnClass</code>
* in the <code>TableModel</code> interface.
*/
- transient protected Hashtable defaultRenderersByColumnClass;
+ transient protected Hashtable<Object, Object> defaultRenderersByColumnClass;
+ // Logicaly, the above is a Hashtable<Class<?>, TableCellRenderer>.
+ // It is declared otherwise to accomodate using UIDefaults.
/**
* A table of objects that display and edit the contents of a cell,
* indexed by class as declared in <code>getColumnClass</code>
* in the <code>TableModel</code> interface.
*/
- transient protected Hashtable defaultEditorsByColumnClass;
+ transient protected Hashtable<Object, Object> defaultEditorsByColumnClass;
+ // Logicaly, the above is a Hashtable<Class<?>, TableCellEditor>.
+ // It is declared otherwise to accomodate using UIDefaults.
/** The foreground color of selected cells. */
protected Color selectionForeground;
@@ -665,7 +669,7 @@
* @param rowData the data for the new table
* @param columnNames names of each column
*/
- public JTable(Vector rowData, Vector columnNames) {
+ public JTable(Vector<Vector<Object>> rowData, Vector<Object> columnNames) {
this(new DefaultTableModel(rowData, columnNames));
}
@@ -1338,7 +1342,7 @@
return (TableCellRenderer)renderer;
}
else {
- Class c = columnClass.getSuperclass();
+ Class<?> c = columnClass.getSuperclass();
if (c == null && columnClass != Object.class) {
c = Object.class;
}
@@ -2621,7 +2625,7 @@
* @since 1.6
*/
public int convertRowIndexToView(int modelRowIndex) {
- RowSorter sorter = getRowSorter();
+ RowSorter<?> sorter = getRowSorter();
if (sorter != null) {
return sorter.convertRowIndexToView(modelRowIndex);
}
@@ -2643,7 +2647,7 @@
* @since 1.6
*/
public int convertRowIndexToModel(int viewRowIndex) {
- RowSorter sorter = getRowSorter();
+ RowSorter<?> sorter = getRowSorter();
if (sorter != null) {
return sorter.convertRowIndexToModel(viewRowIndex);
}
@@ -2661,7 +2665,7 @@
* @see #getColumnCount
*/
public int getRowCount() {
- RowSorter sorter = getRowSorter();
+ RowSorter<?> sorter = getRowSorter();
if (sorter != null) {
return sorter.getViewRowCount();
}
@@ -3631,13 +3635,13 @@
}
// Update the UIs of all the default renderers.
- Enumeration defaultRenderers = defaultRenderersByColumnClass.elements();
+ Enumeration<?> defaultRenderers = defaultRenderersByColumnClass.elements();
while (defaultRenderers.hasMoreElements()) {
SwingUtilities.updateRendererOrEditorUI(defaultRenderers.nextElement());
}
// Update the UIs of all the default editors.
- Enumeration defaultEditors = defaultEditorsByColumnClass.elements();
+ Enumeration<?> defaultEditors = defaultEditorsByColumnClass.elements();
while (defaultEditors.hasMoreElements()) {
SwingUtilities.updateRendererOrEditorUI(defaultEditors.nextElement());
}
@@ -5451,8 +5455,8 @@
*/
static class GenericEditor extends DefaultCellEditor {
- Class[] argTypes = new Class[]{String.class};
- java.lang.reflect.Constructor constructor;
+ Class<?>[] argTypes = new Class<?>[]{String.class};
+ java.lang.reflect.Constructor<?> constructor;
Object value;
public GenericEditor() {
--- a/jdk/src/share/classes/javax/swing/JTextField.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JTextField.java Fri Jul 25 09:44:53 2014 +0000
@@ -587,7 +587,7 @@
}
}
- private boolean isListener(Class c, ActionListener a) {
+ private boolean isListener(Class<?> c, ActionListener a) {
boolean isListener = false;
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length-2; i>=0; i-=2) {
--- a/jdk/src/share/classes/javax/swing/JTree.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/JTree.java Fri Jul 25 09:44:53 2014 +0000
@@ -4032,7 +4032,7 @@
/**
* Subclassed to load the children, if necessary.
*/
- public Enumeration children() {
+ public Enumeration<TreeNode> children() {
if(!loadedChildren)
loadChildren();
return super.children();
--- a/jdk/src/share/classes/javax/swing/KeyboardManager.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/KeyboardManager.java Fri Jul 25 09:44:53 2014 +0000
@@ -68,13 +68,13 @@
/**
* maps top-level containers to a sub-hashtable full of keystrokes
*/
- Hashtable<Container, Hashtable> containerMap = new Hashtable<Container, Hashtable>();
+ Hashtable<Container, Hashtable<Object, Object>> containerMap = new Hashtable<>();
/**
* Maps component/keystroke pairs to a topLevel container
* This is mainly used for fast unregister operations
*/
- Hashtable<ComponentKeyStrokePair, Container> componentKeyStrokeMap = new Hashtable<ComponentKeyStrokePair, Container>();
+ Hashtable<ComponentKeyStrokePair, Container> componentKeyStrokeMap = new Hashtable<>();
public static KeyboardManager getCurrentManager() {
return currentManager;
@@ -95,7 +95,7 @@
if (topContainer == null) {
return;
}
- Hashtable keyMap = containerMap.get(topContainer);
+ Hashtable<Object, Object> keyMap = containerMap.get(topContainer);
if (keyMap == null) { // lazy evaluate one
keyMap = registerNewTopContainer(topContainer);
@@ -105,7 +105,8 @@
if (tmp == null) {
keyMap.put(k,c);
} else if (tmp instanceof Vector) { // if there's a Vector there then add to it.
- Vector v = (Vector)tmp;
+ @SuppressWarnings("unchecked")
+ Vector<Object> v = (Vector)tmp;
if (!v.contains(c)) { // only add if this keystroke isn't registered for this component
v.addElement(c);
}
@@ -114,7 +115,7 @@
// Then add the old compoennt and the new compoent to the vector
// then insert the vector in the table
if (tmp != c) { // this means this is already registered for this component, no need to dup
- Vector<JComponent> v = new Vector<JComponent>();
+ Vector<JComponent> v = new Vector<>();
v.addElement((JComponent) tmp);
v.addElement(c);
keyMap.put(k, v);
@@ -160,7 +161,7 @@
return;
}
- Hashtable keyMap = containerMap.get(topContainer);
+ Hashtable<Object, Object> keyMap = containerMap.get(topContainer);
if (keyMap == null) { // this should never happen, but I'm being safe
Thread.dumpStack();
return;
@@ -176,7 +177,7 @@
keyMap.remove(ks); // remove the KeyStroke from the Map
//System.out.println("removed a stroke" + ks);
} else if (tmp instanceof Vector ) { // this means there is more than one component reg for this key
- Vector v = (Vector)tmp;
+ Vector<?> v = (Vector)tmp;
v.removeElement(c);
if ( v.isEmpty() ) {
keyMap.remove(ks); // remove the KeyStroke from the Map
@@ -227,7 +228,7 @@
ks=KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers(), !pressed);
}
- Hashtable keyMap = containerMap.get(topAncestor);
+ Hashtable<Object, Object> keyMap = containerMap.get(topAncestor);
if (keyMap != null) { // this container isn't registered, so bail
Object tmp = null;
@@ -250,7 +251,7 @@
fireBinding(c, ks, e, pressed);
}
} else if ( tmp instanceof Vector) { //more than one comp registered for this
- Vector v = (Vector)tmp;
+ Vector<?> v = (Vector)tmp;
// There is no well defined order for WHEN_IN_FOCUSED_WINDOW
// bindings, but we give precedence to those bindings just
// added. This is done so that JMenus WHEN_IN_FOCUSED_WINDOW
@@ -279,11 +280,12 @@
// The're handled differently. The key is to let any JMenuBars
// process the event
if ( keyMap != null) {
- Vector v = (Vector)keyMap.get(JMenuBar.class);
+ @SuppressWarnings("unchecked")
+ Vector<JMenuBar> v = (Vector)keyMap.get(JMenuBar.class);
if (v != null) {
- Enumeration iter = v.elements();
+ Enumeration<JMenuBar> iter = v.elements();
while (iter.hasMoreElements()) {
- JMenuBar mb = (JMenuBar)iter.nextElement();
+ JMenuBar mb = iter.nextElement();
if ( mb.isShowing() && mb.isEnabled() ) { // don't want to give these out
boolean extended = (ksE != null) && !ksE.equals(ks);
if (extended) {
@@ -315,17 +317,18 @@
if (top == null) {
return;
}
- Hashtable keyMap = containerMap.get(top);
+ Hashtable<Object, Object> keyMap = containerMap.get(top);
if (keyMap == null) { // lazy evaluate one
keyMap = registerNewTopContainer(top);
}
// use the menubar class as the key
- Vector menuBars = (Vector)keyMap.get(JMenuBar.class);
+ @SuppressWarnings("unchecked")
+ Vector<Object> menuBars = (Vector)keyMap.get(JMenuBar.class);
if (menuBars == null) { // if we don't have a list of menubars,
// then make one.
- menuBars = new Vector();
+ menuBars = new Vector<>();
keyMap.put(JMenuBar.class, menuBars);
}
@@ -340,9 +343,9 @@
if (topContainer == null) {
return;
}
- Hashtable keyMap = containerMap.get(topContainer);
+ Hashtable<Object, Object> keyMap = containerMap.get(topContainer);
if (keyMap!=null) {
- Vector v = (Vector)keyMap.get(JMenuBar.class);
+ Vector<?> v = (Vector)keyMap.get(JMenuBar.class);
if (v != null) {
v.removeElement(mb);
if (v.isEmpty()) {
@@ -355,8 +358,8 @@
}
}
}
- protected Hashtable registerNewTopContainer(Container topContainer) {
- Hashtable keyMap = new Hashtable();
+ protected Hashtable<Object, Object> registerNewTopContainer(Container topContainer) {
+ Hashtable<Object, Object> keyMap = new Hashtable<>();
containerMap.put(topContainer, keyMap);
return keyMap;
}
--- a/jdk/src/share/classes/javax/swing/LayoutFocusTraversalPolicy.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/LayoutFocusTraversalPolicy.java Fri Jul 25 09:44:53 2014 +0000
@@ -98,7 +98,7 @@
if (aContainer == null || aComponent == null) {
throw new IllegalArgumentException("aContainer and aComponent cannot be null");
}
- Comparator comparator = getComparator();
+ Comparator<? super Component> comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
@@ -134,7 +134,7 @@
if (aContainer == null || aComponent == null) {
throw new IllegalArgumentException("aContainer and aComponent cannot be null");
}
- Comparator comparator = getComparator();
+ Comparator<? super Component> comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
@@ -158,7 +158,7 @@
if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null");
}
- Comparator comparator = getComparator();
+ Comparator<? super Component> comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
@@ -182,7 +182,7 @@
if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null");
}
- Comparator comparator = getComparator();
+ Comparator<? super Component> comparator = getComparator();
if (comparator instanceof LayoutComparator) {
((LayoutComparator)comparator).
setComponentOrientation(aContainer.
@@ -233,7 +233,7 @@
// to be focusable by returning true here.
return true;
} else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JComboBox")) {
- JComboBox box = (JComboBox)aComponent;
+ JComboBox<?> box = (JComboBox)aComponent;
return box.getUI().isFocusTraversable(box);
} else if (aComponent instanceof JComponent) {
JComponent jComponent = (JComponent)aComponent;
@@ -256,10 +256,11 @@
out.writeObject(getComparator());
out.writeBoolean(getImplicitDownCycleTraversal());
}
+ @SuppressWarnings("unchecked") // Cast to (Comparator<? super Component>)
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException
{
- setComparator((Comparator)in.readObject());
+ setComparator((Comparator<? super Component>)in.readObject());
setImplicitDownCycleTraversal(in.readBoolean());
}
}
--- a/jdk/src/share/classes/javax/swing/MenuSelectionManager.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/MenuSelectionManager.java Fri Jul 25 09:44:53 2014 +0000
@@ -222,7 +222,6 @@
MenuElement menuElement;
MenuElement subElements[];
MenuElement path[];
- Vector<MenuElement> tmp;
int selectionSize;
p = event.getPoint();
@@ -251,7 +250,8 @@
screenX = p.x;
screenY = p.y;
- tmp = (Vector<MenuElement>)selection.clone();
+ @SuppressWarnings("unchecked")
+ Vector<MenuElement> tmp = (Vector<MenuElement>)selection.clone();
selectionSize = tmp.size();
boolean success = false;
for (i=selectionSize - 1;i >= 0 && success == false; i--) {
@@ -386,7 +386,6 @@
int cWidth,cHeight;
MenuElement menuElement;
MenuElement subElements[];
- Vector<MenuElement> tmp;
int selectionSize;
SwingUtilities.convertPointToScreen(p,source);
@@ -394,7 +393,8 @@
screenX = p.x;
screenY = p.y;
- tmp = (Vector<MenuElement>)selection.clone();
+ @SuppressWarnings("unchecked")
+ Vector<MenuElement> tmp = (Vector<MenuElement>)selection.clone();
selectionSize = tmp.size();
for(i=selectionSize - 1 ; i >= 0 ; i--) {
menuElement = tmp.elementAt(i);
--- a/jdk/src/share/classes/javax/swing/MultiUIDefaults.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/MultiUIDefaults.java Fri Jul 25 09:44:53 2014 +0000
@@ -192,7 +192,7 @@
public synchronized String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
- Enumeration keys = keys();
+ Enumeration<?> keys = keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
sb.append(key + "=" + get(key) + ", ");
--- a/jdk/src/share/classes/javax/swing/PopupFactory.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/PopupFactory.java Fri Jul 25 09:44:53 2014 +0000
@@ -243,7 +243,8 @@
case HEAVY_WEIGHT_POPUP:
Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
- OSInfo.OSType.MACOSX) && (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
+ OSInfo.OSType.MACOSX) && (owner != null) &&
+ (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
((HeavyWeightPopup)popup).setCacheEnabled(false);
}
return popup;
@@ -401,13 +402,14 @@
* <code>Window</code> to a <code>List</code> of
* <code>HeavyWeightPopup</code>s.
*/
+ @SuppressWarnings("unchecked")
private static Map<Window, List<HeavyWeightPopup>> getHeavyWeightPopupCache() {
synchronized (HeavyWeightPopup.class) {
Map<Window, List<HeavyWeightPopup>> cache = (Map<Window, List<HeavyWeightPopup>>)SwingUtilities.appContextGet(
heavyWeightPopupCacheKey);
if (cache == null) {
- cache = new HashMap<Window, List<HeavyWeightPopup>>(2);
+ cache = new HashMap<>(2);
SwingUtilities.appContextPut(heavyWeightPopupCacheKey,
cache);
}
@@ -698,11 +700,12 @@
/**
* Returns the cache to use for heavy weight popups.
*/
+ @SuppressWarnings("unchecked")
private static List<LightWeightPopup> getLightWeightPopupCache() {
List<LightWeightPopup> cache = (List<LightWeightPopup>)SwingUtilities.appContextGet(
lightWeightPopupCacheKey);
if (cache == null) {
- cache = new ArrayList<LightWeightPopup>();
+ cache = new ArrayList<>();
SwingUtilities.appContextPut(lightWeightPopupCacheKey, cache);
}
return cache;
@@ -854,12 +857,13 @@
/**
* Returns the cache to use for medium weight popups.
*/
+ @SuppressWarnings("unchecked")
private static List<MediumWeightPopup> getMediumWeightPopupCache() {
List<MediumWeightPopup> cache = (List<MediumWeightPopup>)SwingUtilities.appContextGet(
mediumWeightPopupCacheKey);
if (cache == null) {
- cache = new ArrayList<MediumWeightPopup>();
+ cache = new ArrayList<>();
SwingUtilities.appContextPut(mediumWeightPopupCacheKey, cache);
}
return cache;
--- a/jdk/src/share/classes/javax/swing/RowFilter.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/RowFilter.java Fri Jul 25 09:44:53 2014 +0000
@@ -175,8 +175,7 @@
*/
public static <M,I> RowFilter<M,I> regexFilter(String regex,
int... indices) {
- return (RowFilter<M,I>)new RegexFilter(Pattern.compile(regex),
- indices);
+ return new RegexFilter<M, I>(Pattern.compile(regex), indices);
}
/**
@@ -205,7 +204,7 @@
*/
public static <M,I> RowFilter<M,I> dateFilter(ComparisonType type,
Date date, int... indices) {
- return (RowFilter<M,I>)new DateFilter(type, date.getTime(), indices);
+ return new DateFilter<M, I>(type, date.getTime(), indices);
}
/**
@@ -231,7 +230,7 @@
*/
public static <M,I> RowFilter<M,I> numberFilter(ComparisonType type,
Number number, int... indices) {
- return (RowFilter<M,I>)new NumberFilter(type, number, indices);
+ return new NumberFilter<M, I>(type, number, indices);
}
/**
@@ -410,7 +409,7 @@
}
- private static abstract class GeneralFilter extends RowFilter<Object,Object> {
+ private static abstract class GeneralFilter<M, I> extends RowFilter<M, I> {
private int[] columns;
GeneralFilter(int[] columns) {
@@ -418,7 +417,8 @@
this.columns = columns;
}
- public boolean include(Entry<? extends Object,? extends Object> value){
+ @Override
+ public boolean include(Entry<? extends M, ? extends I> value){
int count = value.getValueCount();
if (columns.length > 0) {
for (int i = columns.length - 1; i >= 0; i--) {
@@ -429,8 +429,7 @@
}
}
}
- }
- else {
+ } else {
while (--count >= 0) {
if (include(value, count)) {
return true;
@@ -441,11 +440,11 @@
}
protected abstract boolean include(
- Entry<? extends Object,? extends Object> value, int index);
+ Entry<? extends M, ? extends I> value, int index);
}
- private static class RegexFilter extends GeneralFilter {
+ private static class RegexFilter<M, I> extends GeneralFilter<M, I> {
private Matcher matcher;
RegexFilter(Pattern regex, int[] columns) {
@@ -456,15 +455,16 @@
matcher = regex.matcher("");
}
+ @Override
protected boolean include(
- Entry<? extends Object,? extends Object> value, int index) {
+ Entry<? extends M, ? extends I> value, int index) {
matcher.reset(value.getStringValue(index));
return matcher.find();
}
}
- private static class DateFilter extends GeneralFilter {
+ private static class DateFilter<M, I> extends GeneralFilter<M, I> {
private long date;
private ComparisonType type;
@@ -477,8 +477,9 @@
this.date = date;
}
+ @Override
protected boolean include(
- Entry<? extends Object,? extends Object> value, int index) {
+ Entry<? extends M, ? extends I> value, int index) {
Object v = value.getValue(index);
if (v instanceof Date) {
@@ -500,10 +501,7 @@
}
}
-
-
-
- private static class NumberFilter extends GeneralFilter {
+ private static class NumberFilter<M, I> extends GeneralFilter<M, I> {
private boolean isComparable;
private Number number;
private ComparisonType type;
@@ -519,15 +517,16 @@
isComparable = (number instanceof Comparable);
}
+ @Override
@SuppressWarnings("unchecked")
protected boolean include(
- Entry<? extends Object,? extends Object> value, int index) {
+ Entry<? extends M, ? extends I> value, int index) {
Object v = value.getValue(index);
if (v instanceof Number) {
boolean compared = true;
int compareResult;
- Class vClass = v.getClass();
+ Class<?> vClass = v.getClass();
if (number.getClass() == vClass && isComparable) {
compareResult = ((Comparable)number).compareTo(v);
}
--- a/jdk/src/share/classes/javax/swing/ScrollPaneLayout.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/ScrollPaneLayout.java Fri Jul 25 09:44:53 2014 +0000
@@ -823,10 +823,7 @@
Rectangle vsbR = new Rectangle(0, availR.y - vpbInsets.top, 0, 0);
boolean vsbNeeded;
- if (isEmpty) {
- vsbNeeded = false;
- }
- else if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
+ if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
vsbNeeded = true;
}
else if (vsbPolicy == VERTICAL_SCROLLBAR_NEVER) {
@@ -849,10 +846,7 @@
Rectangle hsbR = new Rectangle(availR.x - vpbInsets.left, 0, 0, 0);
boolean hsbNeeded;
- if (isEmpty) {
- hsbNeeded = false;
- }
- else if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
+ if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
hsbNeeded = true;
}
else if (hsbPolicy == HORIZONTAL_SCROLLBAR_NEVER) {
--- a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java Fri Jul 25 09:44:53 2014 +0000
@@ -30,6 +30,11 @@
import java.util.*;
import java.awt.FocusTraversalPolicy;
import sun.util.logging.PlatformLogger;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import sun.security.action.GetPropertyAction;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
/**
* A FocusTraversalPolicy that determines traversal order by sorting the
@@ -89,6 +94,34 @@
final private int FORWARD_TRAVERSAL = 0;
final private int BACKWARD_TRAVERSAL = 1;
+ /*
+ * When true (by default), the legacy merge-sort algo is used to sort an FTP cycle.
+ * When false, the default (tim-sort) algo is used, which may lead to an exception.
+ * See: JDK-8048887
+ */
+ private static final boolean legacySortingFTPEnabled;
+ private static final Method legacyMergeSortMethod;
+
+ static {
+ legacySortingFTPEnabled = "true".equals(AccessController.doPrivileged(
+ new GetPropertyAction("swing.legacySortingFTPEnabled", "true")));
+ legacyMergeSortMethod = legacySortingFTPEnabled ?
+ AccessController.doPrivileged(new PrivilegedAction<Method>() {
+ public Method run() {
+ try {
+ Class c = Class.forName("java.util.Arrays");
+ Method m = c.getDeclaredMethod("legacyMergeSort", new Class[]{Object[].class, Comparator.class});
+ m.setAccessible(true);
+ return m;
+ } catch (ClassNotFoundException | NoSuchMethodException e) {
+ // using default sorting algo
+ return null;
+ }
+ }
+ }) :
+ null;
+ }
+
/**
* Constructs a SortingFocusTraversalPolicy without a Comparator.
* Subclasses must set the Comparator using <code>setComparator</code>
@@ -135,10 +168,32 @@
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
if (focusCycleRoot.isShowing()) {
enumerateCycle(focusCycleRoot, cycle);
- Collections.sort(cycle, comparator);
+ if (!legacySortingFTPEnabled ||
+ !legacySort(cycle, comparator))
+ {
+ Collections.sort(cycle, comparator);
+ }
}
}
+ private boolean legacySort(List<Component> l, Comparator<? super Component> c) {
+ if (legacyMergeSortMethod == null)
+ return false;
+
+ Object[] a = l.toArray();
+ try {
+ legacyMergeSortMethod.invoke(null, a, c);
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ return false;
+ }
+ ListIterator<Component> i = l.listIterator();
+ for (Object e : a) {
+ i.next();
+ i.set((Component)e);
+ }
+ return true;
+ }
+
private void enumerateCycle(Container container, List<Component> cycle) {
if (!(container.isVisible() && container.isDisplayable())) {
return;
--- a/jdk/src/share/classes/javax/swing/SpinnerDateModel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/SpinnerDateModel.java Fri Jul 25 09:44:53 2014 +0000
@@ -89,7 +89,7 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class SpinnerDateModel extends AbstractSpinnerModel implements Serializable
{
- private Comparable start, end;
+ private Comparable<Date> start, end;
private Calendar value;
private int calendarField;
@@ -173,7 +173,7 @@
* @see #setEnd
* @see #setCalendarField
*/
- public SpinnerDateModel(Date value, Comparable start, Comparable end, int calendarField) {
+ public SpinnerDateModel(Date value, Comparable<Date> start, Comparable<Date> end, int calendarField) {
if (value == null) {
throw new IllegalArgumentException("value is null");
}
@@ -241,7 +241,7 @@
* @see #setEnd
* @see #addChangeListener
*/
- public void setStart(Comparable start) {
+ public void setStart(Comparable<Date> start) {
if ((start == null) ? (this.start != null) : !start.equals(this.start)) {
this.start = start;
fireStateChanged();
@@ -255,7 +255,7 @@
* @return the value of the <code>start</code> property
* @see #setStart
*/
- public Comparable getStart() {
+ public Comparable<Date> getStart() {
return start;
}
@@ -282,7 +282,7 @@
* @see #setStart
* @see #addChangeListener
*/
- public void setEnd(Comparable end) {
+ public void setEnd(Comparable<Date> end) {
if ((end == null) ? (this.end != null) : !end.equals(this.end)) {
this.end = end;
fireStateChanged();
@@ -296,7 +296,7 @@
* @return the value of the <code>end</code> property
* @see #setEnd
*/
- public Comparable getEnd() {
+ public Comparable<Date> getEnd() {
return end;
}
--- a/jdk/src/share/classes/javax/swing/SpinnerListModel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/SpinnerListModel.java Fri Jul 25 09:44:53 2014 +0000
@@ -59,7 +59,7 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class SpinnerListModel extends AbstractSpinnerModel implements Serializable
{
- private List list;
+ private List<?> list;
private int index;
--- a/jdk/src/share/classes/javax/swing/SpinnerNumberModel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/SpinnerNumberModel.java Fri Jul 25 09:44:53 2014 +0000
@@ -84,7 +84,16 @@
public class SpinnerNumberModel extends AbstractSpinnerModel implements Serializable
{
private Number stepSize, value;
- private Comparable minimum, maximum;
+ // Both minimum and maximum are logically Comparable<? extends
+ // Number>, but that type is awkward to use since different
+ // instances of Number are not naturally Comparable. For example,
+ // a Double implements Comparable<Double> and an Integer
+ // implements Comparable<Integer>. Neither Integer nor Double will
+ // have a bridge method for Comparable<Number>. However, it safe
+ // to cast Comparable<?> to Comparable<Object> since all
+ // Comparables will have a compare(Object> method, possibly as a
+ // bridge.
+ private Comparable<?> minimum, maximum;
/**
@@ -117,12 +126,16 @@
* <code>null</code> or if the following expression is false:
* <code>minimum <= value <= maximum</code>
*/
- public SpinnerNumberModel(Number value, Comparable minimum, Comparable maximum, Number stepSize) {
+ @SuppressWarnings("unchecked") // Casts to Comparable<Object>
+ public SpinnerNumberModel(Number value,
+ Comparable<?> minimum,
+ Comparable<?> maximum,
+ Number stepSize) {
if ((value == null) || (stepSize == null)) {
throw new IllegalArgumentException("value and stepSize must be non-null");
}
- if (!(((minimum == null) || (minimum.compareTo(value) <= 0)) &&
- ((maximum == null) || (maximum.compareTo(value) >= 0)))) {
+ if (!(((minimum == null) || (((Comparable<Object>)minimum).compareTo(value) <= 0)) &&
+ ((maximum == null) || (((Comparable<Object>)maximum).compareTo(value) >= 0)))) {
throw new IllegalArgumentException("(minimum <= value <= maximum) is false");
}
this.value = value;
@@ -212,7 +225,7 @@
* @see #setMaximum
* @see SpinnerModel#addChangeListener
*/
- public void setMinimum(Comparable minimum) {
+ public void setMinimum(Comparable<?> minimum) {
if ((minimum == null) ? (this.minimum != null) : !minimum.equals(this.minimum)) {
this.minimum = minimum;
fireStateChanged();
@@ -226,7 +239,7 @@
* @return the value of the <code>minimum</code> property
* @see #setMinimum
*/
- public Comparable getMinimum() {
+ public Comparable<?> getMinimum() {
return minimum;
}
@@ -259,7 +272,7 @@
* @see #setMinimum
* @see SpinnerModel#addChangeListener
*/
- public void setMaximum(Comparable maximum) {
+ public void setMaximum(Comparable<?> maximum) {
if ((maximum == null) ? (this.maximum != null) : !maximum.equals(this.maximum)) {
this.maximum = maximum;
fireStateChanged();
@@ -273,7 +286,7 @@
* @return the value of the <code>maximum</code> property
* @see #setMaximum
*/
- public Comparable getMaximum() {
+ public Comparable<?> getMaximum() {
return maximum;
}
@@ -317,7 +330,7 @@
return stepSize;
}
-
+ @SuppressWarnings("unchecked") // Casts to Comparable<Object>
private Number incrValue(int dir)
{
Number newValue;
@@ -329,8 +342,7 @@
else {
newValue = new Float(v);
}
- }
- else {
+ } else {
long v = value.longValue() + (stepSize.longValue() * (long)dir);
if (value instanceof Long) {
@@ -347,10 +359,10 @@
}
}
- if ((maximum != null) && (maximum.compareTo(newValue) < 0)) {
+ if ((maximum != null) && (((Comparable<Object>)maximum).compareTo(newValue) < 0)) {
return null;
}
- if ((minimum != null) && (minimum.compareTo(newValue) > 0)) {
+ if ((minimum != null) && (((Comparable<Object>)minimum).compareTo(newValue) > 0)) {
return null;
}
else {
--- a/jdk/src/share/classes/javax/swing/SpringLayout.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/SpringLayout.java Fri Jul 25 09:44:53 2014 +0000
@@ -495,7 +495,7 @@
};
}
- private boolean defined(List history, String s1, String s2) {
+ private boolean defined(List<?> history, String s1, String s2) {
return history.contains(s1) && history.contains(s2);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/swing/SwingContainer.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 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
+ * 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 javax.swing;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An annotation used to specify some swing-related information
+ * for the automatically generated {@code BeanInfo} classes.
+ * This annotation is not used if the annotated class
+ * has a corresponding user-defined {@code BeanInfo} class,
+ * which does not imply the automatic analysis.
+ * <p>
+ * The {@code isContainer} {@link java.beans.BeanDescriptor#getValue
+ * feature attribute} was introduced primarily for the Swing library.
+ * All Swing components extend the {@link java.awt.Container Container}
+ * class by design, so the builder tool assumes that all Swing components
+ * are containers. The {@link java.beans.BeanInfo BeanInfo} classes
+ * with the {@code isContainer} attribute allow to directly specify
+ * whether a Swing component is a container or not.
+ *
+ * @since 1.9
+ *
+ * @author Sergey A. Malenkov
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface SwingContainer {
+ /**
+ * The value that indicates whether the annotated class can be used
+ * as a container for other Swing components or not.
+ *
+ * @return {@code true} if the annotated class is a Swing container;
+ * {@code false} otherwise.
+ */
+ boolean value() default true;
+
+ /**
+ * The name of the getter method in the annotated class,
+ * which returns the corresponding Swing container,
+ * if it is not recommended to add subcomponents
+ * to the annotated class directly.
+ *
+ * @return the name of the getter method in the annotated class,
+ * which returns the corresponding Swing container,
+ * or an empty string if the method name is not set.
+ */
+ String delegate() default "";
+}
--- a/jdk/src/share/classes/javax/swing/SwingWorker.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/SwingWorker.java Fri Jul 25 09:44:53 2014 +0000
@@ -820,7 +820,9 @@
doSubmit = new DoSubmitAccumulativeRunnable();
appContext.put(DO_SUBMIT_KEY, doSubmit);
}
- return (AccumulativeRunnable<Runnable>) doSubmit;
+ @SuppressWarnings("unchecked")
+ AccumulativeRunnable<Runnable> tmp = (AccumulativeRunnable<Runnable>) doSubmit;
+ return tmp;
}
}
private static class DoSubmitAccumulativeRunnable
--- a/jdk/src/share/classes/javax/swing/UIDefaults.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/UIDefaults.java Fri Jul 25 09:44:53 2014 +0000
@@ -311,10 +311,10 @@
} else {
b = ResourceBundle.getBundle(bundleName, l);
}
- Enumeration keys = b.getKeys();
+ Enumeration<String> keys = b.getKeys();
while (keys.hasMoreElements()) {
- String key = (String)keys.nextElement();
+ String key = keys.nextElement();
if (values.get(key) == null) {
Object value = b.getObject(key);
@@ -682,7 +682,7 @@
if (className != null) {
ReflectUtil.checkPackageAccess(className);
- Class cls = (Class)get(className);
+ Class<?> cls = (Class)get(className);
if (cls == null) {
if (uiClassLoader == null) {
cls = SwingUtilities.loadSystemClass(className);
@@ -695,13 +695,12 @@
put(className, cls);
}
}
- return cls;
+ @SuppressWarnings("unchecked")
+ Class<? extends ComponentUI> tmp = (Class<? extends ComponentUI>)cls;
+ return tmp;
}
}
- catch (ClassNotFoundException e) {
- return null;
- }
- catch (ClassCastException e) {
+ catch (ClassNotFoundException | ClassCastException e) {
return null;
}
return null;
@@ -767,7 +766,7 @@
try {
Method m = (Method)get(uiClass);
if (m == null) {
- m = uiClass.getMethod("createUI", new Class[]{JComponent.class});
+ m = uiClass.getMethod("createUI", new Class<?>[]{JComponent.class});
put(uiClass, m);
}
uiObject = MethodUtil.invoke(m, null, new Object[]{target});
@@ -1106,12 +1105,12 @@
c = Class.forName(className, true, (ClassLoader)cl);
SwingUtilities2.checkAccess(c.getModifiers());
if (methodName != null) {
- Class[] types = getClassArray(args);
+ Class<?>[] types = getClassArray(args);
Method m = c.getMethod(methodName, types);
return MethodUtil.invoke(m, c, args);
} else {
- Class[] types = getClassArray(args);
- Constructor constructor = c.getConstructor(types);
+ Class<?>[] types = getClassArray(args);
+ Constructor<?> constructor = c.getConstructor(types);
SwingUtilities2.checkAccess(constructor.getModifiers());
return constructor.newInstance(args);
}
@@ -1134,10 +1133,10 @@
* and superclasses for subclasses used to add the
* <code>UIResource</code> tag.
*/
- private Class[] getClassArray(Object[] args) {
- Class[] types = null;
+ private Class<?>[] getClassArray(Object[] args) {
+ Class<?>[] types = null;
if (args!=null) {
- types = new Class[args.length];
+ types = new Class<?>[args.length];
for (int i = 0; i< args.length; i++) {
/* PENDING(ges): At present only the primitive types
used are handled correctly; this should eventually
--- a/jdk/src/share/classes/javax/swing/UIManager.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/UIManager.java Fri Jul 25 09:44:53 2014 +0000
@@ -581,7 +581,7 @@
setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
}
else {
- Class lnfClass = SwingUtilities.loadSystemClass(className);
+ Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
setLookAndFeel((LookAndFeel)(lnfClass.newInstance()));
}
}
@@ -1049,7 +1049,7 @@
String defaultName = "javax.swing.plaf.multi.MultiLookAndFeel";
String className = getLAFState().swingProps.getProperty(multiplexingLAFKey, defaultName);
try {
- Class lnfClass = SwingUtilities.loadSystemClass(className);
+ Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
multiLookAndFeel = (LookAndFeel)lnfClass.newInstance();
} catch (Exception exc) {
System.err.println("UIManager: failed loading " + className);
@@ -1339,10 +1339,11 @@
// Try to get default LAF from system property, then from AppContext
// (6653395), then use cross-platform one by default.
String lafName = null;
- HashMap lafData =
+ @SuppressWarnings("unchecked")
+ HashMap<Object, String> lafData =
(HashMap) AppContext.getAppContext().remove("swing.lafdata");
if (lafData != null) {
- lafName = (String) lafData.remove("defaultlaf");
+ lafName = lafData.remove("defaultlaf");
}
if (lafName == null) {
lafName = getCrossPlatformLookAndFeelClassName();
@@ -1382,7 +1383,7 @@
while (p.hasMoreTokens()) {
String className = p.nextToken();
try {
- Class lnfClass = SwingUtilities.loadSystemClass(className);
+ Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
LookAndFeel newLAF = (LookAndFeel)lnfClass.newInstance();
newLAF.initialize();
auxLookAndFeels.addElement(newLAF);
--- a/jdk/src/share/classes/javax/swing/event/EventListenerList.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/event/EventListenerList.java Fri Jul 25 09:44:53 2014 +0000
@@ -141,11 +141,14 @@
public <T extends EventListener> T[] getListeners(Class<T> t) {
Object[] lList = listenerList;
int n = getListenerCount(lList, t);
+ @SuppressWarnings("unchecked")
T[] result = (T[])Array.newInstance(t, n);
int j = 0;
for (int i = lList.length-2; i>=0; i-=2) {
if (lList[i] == t) {
- result[j++] = (T)lList[i+1];
+ @SuppressWarnings("unchecked")
+ T tmp = (T)lList[i+1];
+ result[j++] = tmp;
}
}
return result;
@@ -172,7 +175,7 @@
return getListenerCount(lList, t);
}
- private int getListenerCount(Object[] list, Class t) {
+ private int getListenerCount(Object[] list, Class<?> t) {
int count = 0;
for (int i = 0; i < list.length; i+=2) {
if (t == (Class)list[i])
@@ -288,7 +291,9 @@
EventListener l = (EventListener)s.readObject();
String name = (String) listenerTypeOrNull;
ReflectUtil.checkPackageAccess(name);
- add((Class<EventListener>)Class.forName(name, true, cl), l);
+ @SuppressWarnings("unchecked")
+ Class<EventListener> tmp = (Class<EventListener>)Class.forName(name, true, cl);
+ add(tmp, l);
}
}
--- a/jdk/src/share/classes/javax/swing/event/RowSorterEvent.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/event/RowSorterEvent.java Fri Jul 25 09:44:53 2014 +0000
@@ -71,7 +71,7 @@
* @throws IllegalArgumentException if <code>source</code> is
* <code>null</code>
*/
- public RowSorterEvent(RowSorter source) {
+ public RowSorterEvent(RowSorter<?> source) {
this(source, Type.SORT_ORDER_CHANGED, null);
}
@@ -85,7 +85,7 @@
* @throws IllegalArgumentException if source or <code>type</code> is
* <code>null</code>
*/
- public RowSorterEvent(RowSorter source, Type type,
+ public RowSorterEvent(RowSorter<?> source, Type type,
int[] previousRowIndexToModel) {
super(source);
if (type == null) {
@@ -100,7 +100,8 @@
*
* @return the source of the event as a <code>RowSorter</code>
*/
- public RowSorter getSource() {
+ @Override
+ public RowSorter<?> getSource() {
return (RowSorter)super.getSource();
}
--- a/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java Fri Jul 25 09:44:53 2014 +0000
@@ -739,7 +739,8 @@
* @return the Desktop folder.
*/
public File getHomeDirectory() {
- return getRoots()[0];
+ File[] roots = getRoots();
+ return (roots.length == 0) ? null : roots[0];
}
/**
--- a/jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -38,15 +38,15 @@
/**
* Set the visibility of the popup
*/
- public abstract void setPopupVisible( JComboBox c, boolean v );
+ public abstract void setPopupVisible( JComboBox<?> c, boolean v );
/**
* Determine the visibility of the popup
*/
- public abstract boolean isPopupVisible( JComboBox c );
+ public abstract boolean isPopupVisible( JComboBox<?> c );
/**
* Determine whether or not the combo box itself is traversable
*/
- public abstract boolean isFocusTraversable( JComboBox c );
+ public abstract boolean isFocusTraversable( JComboBox<?> c );
}
--- a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -610,7 +610,8 @@
* baseline
*/
public int getBaseline(JComponent c, int width, int height) {
- JLayer l = (JLayer) c;
+ @SuppressWarnings("unchecked")
+ JLayer<?> l = (JLayer) c;
if (l.getView() != null) {
return l.getView().getBaseline(width, height);
}
@@ -627,7 +628,8 @@
* size changes
*/
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c) {
- JLayer l = (JLayer) c;
+ @SuppressWarnings("unchecked")
+ JLayer<?> l = (JLayer) c;
if (l.getView() != null) {
return l.getView().getBaselineResizeBehavior();
}
@@ -659,7 +661,8 @@
* @return preferred size for the passed {@code JLayer}
*/
public Dimension getPreferredSize(JComponent c) {
- JLayer l = (JLayer) c;
+ @SuppressWarnings("unchecked")
+ JLayer<?> l = (JLayer) c;
Component view = l.getView();
if (view != null) {
return view.getPreferredSize();
@@ -676,7 +679,8 @@
* @return minimal size for the passed {@code JLayer}
*/
public Dimension getMinimumSize(JComponent c) {
- JLayer l = (JLayer) c;
+ @SuppressWarnings("unchecked")
+ JLayer<?> l = (JLayer) c;
Component view = l.getView();
if (view != null) {
return view.getMinimumSize();
@@ -693,7 +697,8 @@
* @return maximum size for the passed {@code JLayer}
*/
public Dimension getMaximumSize(JComponent c) {
- JLayer l = (JLayer) c;
+ @SuppressWarnings("unchecked")
+ JLayer<?> l = (JLayer) c;
Component view = l.getView();
if (view != null) {
return view.getMaximumSize();
--- a/jdk/src/share/classes/javax/swing/plaf/ListUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/ListUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -50,7 +50,7 @@
* @return the cell index closest to the given location, or {@code -1}
* @throws NullPointerException if {@code location} is null
*/
- public abstract int locationToIndex(JList list, Point location);
+ public abstract int locationToIndex(JList<?> list, Point location);
/**
@@ -62,7 +62,7 @@
* @param index the cell index
* @return the origin of the cell, or {@code null}
*/
- public abstract Point indexToLocation(JList list, int index);
+ public abstract Point indexToLocation(JList<?> list, int index);
/**
@@ -80,5 +80,5 @@
* @param index2 the second index in the range
* @return the bounding rectangle for the range of cells, or {@code null}
*/
- public abstract Rectangle getCellBounds(JList list, int index1, int index2);
+ public abstract Rectangle getCellBounds(JList<?> list, int index1, int index2);
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java Fri Jul 25 09:44:53 2014 +0000
@@ -100,7 +100,7 @@
// Must take the value from the editor and get the value and cast it to the new type.
Class<?> cls = oldValue.getClass();
try {
- Method method = MethodUtil.getMethod(cls, "valueOf", new Class[]{String.class});
+ Method method = MethodUtil.getMethod(cls, "valueOf", new Class<?>[]{String.class});
newValue = MethodUtil.invoke(method, oldValue, new Object[] { editor.getText()});
} catch (Exception ex) {
// Fail silently and return the newValue (a String object)
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,7 +49,7 @@
*/
@SuppressWarnings("serial") // Same-version serialization only
public class BasicComboBoxRenderer extends JLabel
-implements ListCellRenderer, Serializable {
+implements ListCellRenderer<Object>, Serializable {
/**
* An empty <code>Border</code>. This field might not be used. To change the
@@ -88,8 +88,8 @@
return size;
}
- public Component getListCellRendererComponent(
- JList list,
+ @Override
+ public Component getListCellRendererComponent(JList<?> list,
Object value,
int index,
boolean isSelected,
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -61,7 +61,7 @@
* @author Mark Davidson
*/
public class BasicComboBoxUI extends ComboBoxUI {
- protected JComboBox comboBox;
+ protected JComboBox<Object> comboBox;
/**
* This protected field is implementation specific. Do not access directly
* or override.
@@ -74,7 +74,7 @@
private static final String IS_TABLE_CELL_EDITOR = "JComboBox.isTableCellEditor";
// This list is for drawing the current item in the combo box.
- protected JList listBox;
+ protected JList<Object> listBox;
// Used to render the currently selected item in the combo box.
// It doesn't have anything to do with the popup's rendering.
@@ -203,8 +203,9 @@
protected Insets padding;
// Used for calculating the default size.
- private static ListCellRenderer getDefaultListCellRenderer() {
- ListCellRenderer renderer = (ListCellRenderer)AppContext.
+ private static ListCellRenderer<Object> getDefaultListCellRenderer() {
+ @SuppressWarnings("unchecked")
+ ListCellRenderer<Object> renderer = (ListCellRenderer)AppContext.
getAppContext().get(COMBO_UI_LIST_CELL_RENDERER_KEY);
if (renderer == null) {
@@ -245,7 +246,9 @@
public void installUI( JComponent c ) {
isMinimumSizeDirty = true;
- comboBox = (JComboBox)c;
+ @SuppressWarnings("unchecked")
+ JComboBox<Object> tmp = (JComboBox)c;
+ comboBox = tmp;
installDefaults();
popup = createPopup();
listBox = popup.getList();
@@ -508,7 +511,7 @@
* @return a <code>ListCellRender</code> used for the combo box
* @see javax.swing.JComboBox#setRenderer
*/
- protected ListCellRenderer createRenderer() {
+ protected ListCellRenderer<Object> createRenderer() {
return new BasicComboBoxRenderer.UIResource();
}
@@ -865,14 +868,14 @@
/**
* Tells if the popup is visible or not.
*/
- public boolean isPopupVisible( JComboBox c ) {
+ public boolean isPopupVisible( JComboBox<?> c ) {
return popup.isVisible();
}
/**
* Hides the popup.
*/
- public void setPopupVisible( JComboBox c, boolean v ) {
+ public void setPopupVisible( JComboBox<?> c, boolean v ) {
if ( v ) {
popup.show();
} else {
@@ -884,7 +887,7 @@
* Determines if the JComboBox is focus traversable. If the JComboBox is editable
* this returns false, otherwise it returns true.
*/
- public boolean isFocusTraversable( JComboBox c ) {
+ public boolean isFocusTraversable( JComboBox<?> c ) {
return !comboBox.isEditable();
}
@@ -956,7 +959,7 @@
Insets insets = c.getInsets();
height = height - insets.top - insets.bottom;
if (!comboBox.isEditable()) {
- ListCellRenderer renderer = comboBox.getRenderer();
+ ListCellRenderer<Object> renderer = comboBox.getRenderer();
if (renderer == null) {
renderer = new DefaultListCellRenderer();
}
@@ -1013,7 +1016,7 @@
return editor.getBaselineResizeBehavior();
}
else if (sameBaseline) {
- ListCellRenderer renderer = comboBox.getRenderer();
+ ListCellRenderer<Object> renderer = comboBox.getRenderer();
if (renderer == null) {
renderer = new DefaultListCellRenderer();
}
@@ -1205,7 +1208,7 @@
* Paints the currently selected item.
*/
public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) {
- ListCellRenderer renderer = comboBox.getRenderer();
+ ListCellRenderer<Object> renderer = comboBox.getRenderer();
Component c;
if ( hasFocus && !isPopupVisible(comboBox) ) {
@@ -1322,7 +1325,7 @@
}
Dimension result = new Dimension();
- ListCellRenderer renderer = comboBox.getRenderer();
+ ListCellRenderer<Object> renderer = comboBox.getRenderer();
if (renderer == null) {
renderer = new DefaultListCellRenderer();
}
@@ -1338,7 +1341,7 @@
} else {
// Calculate the dimension by iterating over all the elements in the combo
// box list.
- ComboBoxModel model = comboBox.getModel();
+ ComboBoxModel<Object> model = comboBox.getModel();
int modelSize = model.getSize();
int baseline = -1;
Dimension d;
@@ -1484,7 +1487,8 @@
public void actionPerformed( ActionEvent e ) {
String key = getName();
- JComboBox comboBox = (JComboBox)e.getSource();
+ @SuppressWarnings("unchecked")
+ JComboBox<Object> comboBox = (JComboBox)e.getSource();
BasicComboBoxUI ui = (BasicComboBoxUI)BasicLookAndFeel.getUIOfType(
comboBox.getUI(), BasicComboBoxUI.class);
if (key == HIDE) {
@@ -1625,7 +1629,7 @@
}
}
- private int getNextIndex(JComboBox comboBox, String key) {
+ private int getNextIndex(JComboBox<?> comboBox, String key) {
int listHeight = comboBox.getMaximumRowCount();
int selectedIndex = comboBox.getSelectedIndex();
@@ -1685,10 +1689,13 @@
comboBox.revalidate();
}
} else {
- JComboBox comboBox = (JComboBox)e.getSource();
+ @SuppressWarnings("unchecked")
+ JComboBox<?> comboBox = (JComboBox)e.getSource();
if ( propertyName == "model" ) {
- ComboBoxModel newModel = (ComboBoxModel)e.getNewValue();
- ComboBoxModel oldModel = (ComboBoxModel)e.getOldValue();
+ @SuppressWarnings("unchecked")
+ ComboBoxModel<?> newModel = (ComboBoxModel)e.getNewValue();
+ @SuppressWarnings("unchecked")
+ ComboBoxModel<?> oldModel = (ComboBoxModel)e.getOldValue();
if ( oldModel != null && listDataListener != null ) {
oldModel.removeListDataListener( listDataListener );
@@ -1897,7 +1904,8 @@
}
public void layoutContainer(Container parent) {
- JComboBox cb = (JComboBox)parent;
+ @SuppressWarnings("unchecked")
+ JComboBox<?> cb = (JComboBox)parent;
int width = cb.getWidth();
int height = cb.getHeight();
@@ -1959,7 +1967,7 @@
private String prefix = "";
private String typedString = "";
- public int selectionForKey(char aKey,ComboBoxModel aModel) {
+ public int selectionForKey(char aKey,ComboBoxModel<?> aModel) {
if (lastTime == 0L) {
prefix = "";
typedString = "";
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java Fri Jul 25 09:44:53 2014 +0000
@@ -71,11 +71,11 @@
public void removeListDataListener(ListDataListener l) {}
};
- static final ListModel EmptyListModel = new EmptyListModelClass();
+ static final ListModel<Object> EmptyListModel = new EmptyListModelClass();
private static Border LIST_BORDER = new LineBorder(Color.BLACK, 1);
- protected JComboBox comboBox;
+ protected JComboBox<Object> comboBox;
/**
* This protected field is implementation specific. Do not access directly
* or override. Use the accessor methods instead.
@@ -83,7 +83,7 @@
* @see #getList
* @see #createList
*/
- protected JList list;
+ protected JList<Object> list;
/**
* This protected field is implementation specific. Do not access directly
* or override. Use the create method instead
@@ -229,7 +229,7 @@
/**
* Implementation of ComboPopup.getList().
*/
- public JList getList() {
+ public JList<Object> getList() {
return list;
}
@@ -303,7 +303,7 @@
* @param model The combo box model to install listeners
* @see #installComboBoxModelListeners
*/
- protected void uninstallComboBoxModelListeners( ComboBoxModel model ) {
+ protected void uninstallComboBoxModelListeners( ComboBoxModel<?> model ) {
if (model != null && listDataListener != null) {
model.removeListDataListener(listDataListener);
}
@@ -319,7 +319,7 @@
//===================================================================
// begin Initialization routines
//
- public BasicComboPopup( JComboBox combo ) {
+ public BasicComboPopup( JComboBox<Object> combo ) {
super();
setName("ComboPopup.popup");
comboBox = combo;
@@ -481,8 +481,8 @@
*
* @return a <code>JList</code> used to display the combo box items
*/
- protected JList createList() {
- return new JList( comboBox.getModel() ) {
+ protected JList<Object> createList() {
+ return new JList<Object>( comboBox.getModel() ) {
public void processMouseEvent(MouseEvent e) {
if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) {
// Fix for 4234053. Filter out the Control Key from the list.
@@ -610,7 +610,7 @@
* @param model The combo box model to install listeners
* @see #uninstallComboBoxModelListeners
*/
- protected void installComboBoxModelListeners( ComboBoxModel model ) {
+ protected void installComboBoxModelListeners( ComboBoxModel<?> model ) {
if (model != null && (listDataListener = createListDataListener()) != null) {
model.addListDataListener(listDataListener);
}
@@ -928,12 +928,15 @@
// PropertyChangeListener
//
public void propertyChange(PropertyChangeEvent e) {
- JComboBox comboBox = (JComboBox)e.getSource();
+ @SuppressWarnings("unchecked")
+ JComboBox<Object> comboBox = (JComboBox)e.getSource();
String propertyName = e.getPropertyName();
if ( propertyName == "model" ) {
- ComboBoxModel oldModel = (ComboBoxModel)e.getOldValue();
- ComboBoxModel newModel = (ComboBoxModel)e.getNewValue();
+ @SuppressWarnings("unchecked")
+ ComboBoxModel<Object> oldModel = (ComboBoxModel)e.getOldValue();
+ @SuppressWarnings("unchecked")
+ ComboBoxModel<Object> newModel = (ComboBoxModel)e.getNewValue();
uninstallComboBoxModelListeners(oldModel);
installComboBoxModelListeners(newModel);
@@ -955,7 +958,7 @@
ComponentOrientation o =(ComponentOrientation)e.getNewValue();
- JList list = getList();
+ JList<?> list = getList();
if (list!=null && list.getComponentOrientation()!=o) {
list.setComponentOrientation(o);
}
@@ -978,7 +981,8 @@
//
public void itemStateChanged( ItemEvent e ) {
if (e.getStateChange() == ItemEvent.SELECTED) {
- JComboBox comboBox = (JComboBox)e.getSource();
+ @SuppressWarnings("unchecked")
+ JComboBox<Object> comboBox = (JComboBox)e.getSource();
setListSelection(comboBox.getSelectedIndex());
}
}
@@ -1172,7 +1176,7 @@
// Set the cached value of the minimum row count
int minRowCount = Math.min( maxRowCount, comboBox.getItemCount() );
int height = 0;
- ListCellRenderer renderer = list.getCellRenderer();
+ ListCellRenderer<Object> renderer = list.getCellRenderer();
Object value = null;
for ( int i = 0; i < minRowCount; ++i ) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java Fri Jul 25 09:44:53 2014 +0000
@@ -98,7 +98,7 @@
if (directories != null) {
return directories;
}
- Vector fls = getFiles();
+ Vector<File> fls = getFiles();
return directories;
}
}
@@ -317,7 +317,7 @@
if (isInterrupted()) {
return null;
}
- return new DoChangeContents(null, 0, new Vector(fileCache.subList(start, end)), start, fid);
+ return new DoChangeContents(null, 0, new Vector<>(fileCache.subList(start, end)), start, fid);
}
}
if (!fileCache.equals(newFileCache)) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -436,7 +436,7 @@
}
protected MouseListener createDoubleClickListener(JFileChooser fc,
- JList list) {
+ JList<?> list) {
return new Handler(list);
}
@@ -445,12 +445,12 @@
}
private class Handler implements MouseListener, ListSelectionListener {
- JList list;
+ JList<?> list;
Handler() {
}
- Handler(JList list) {
+ Handler(JList<?> list) {
this.list = list;
}
@@ -506,7 +506,8 @@
if(!evt.getValueIsAdjusting()) {
JFileChooser chooser = getFileChooser();
FileSystemView fsv = chooser.getFileSystemView();
- JList list = (JList)evt.getSource();
+ @SuppressWarnings("unchecked")
+ JList<?> list = (JList)evt.getSource();
int fsm = chooser.getFileSelectionMode();
boolean useSetDirectory = usesSingleFilePane &&
@@ -570,7 +571,7 @@
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
Handler handler;
- public DoubleClickListener(JList list) {
+ public DoubleClickListener(JList<?> list) {
handler = new Handler(list);
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -59,7 +59,7 @@
private static final StringBuilder BASELINE_COMPONENT_KEY =
new StringBuilder("List.baselineComponent");
- protected JList list = null;
+ protected JList<Object> list = null;
protected CellRendererPane rendererPane;
// Listeners that this UI attaches to the JList
@@ -196,8 +196,8 @@
Graphics g,
int row,
Rectangle rowBounds,
- ListCellRenderer cellRenderer,
- ListModel dataModel,
+ ListCellRenderer<Object> cellRenderer,
+ ListModel<Object> dataModel,
ListSelectionModel selModel,
int leadIndex)
{
@@ -263,8 +263,8 @@
}
maybeUpdateLayoutState();
- ListCellRenderer renderer = list.getCellRenderer();
- ListModel dataModel = list.getModel();
+ ListCellRenderer<Object> renderer = list.getCellRenderer();
+ ListModel<Object> dataModel = list.getModel();
ListSelectionModel selModel = list.getSelectionModel();
int size;
@@ -478,7 +478,8 @@
Component renderer = (Component)lafDefaults.get(
BASELINE_COMPONENT_KEY);
if (renderer == null) {
- ListCellRenderer lcr = (ListCellRenderer)UIManager.get(
+ @SuppressWarnings("unchecked")
+ ListCellRenderer<Object> lcr = (ListCellRenderer)UIManager.get(
"List.cellRenderer");
// fix for 6711072 some LAFs like Nimbus do not provide this
@@ -715,7 +716,7 @@
list.addPropertyChangeListener(propertyChangeListener);
list.addKeyListener(getHandler());
- ListModel model = list.getModel();
+ ListModel<Object> model = list.getModel();
if (model != null) {
model.addListDataListener(listDataListener);
}
@@ -744,7 +745,7 @@
list.removePropertyChangeListener(propertyChangeListener);
list.removeKeyListener(getHandler());
- ListModel model = list.getModel();
+ ListModel<Object> model = list.getModel();
if (model != null) {
model.removeListDataListener(listDataListener);
}
@@ -785,7 +786,9 @@
LookAndFeel.installProperty(list, "opaque", Boolean.TRUE);
if (list.getCellRenderer() == null) {
- list.setCellRenderer((ListCellRenderer)(UIManager.get("List.cellRenderer")));
+ @SuppressWarnings("unchecked")
+ ListCellRenderer<Object> tmp = (ListCellRenderer)(UIManager.get("List.cellRenderer"));
+ list.setCellRenderer(tmp);
}
Color sbg = list.getSelectionBackground();
@@ -866,7 +869,9 @@
*/
public void installUI(JComponent c)
{
- list = (JList)c;
+ @SuppressWarnings("unchecked")
+ JList<Object> tmp = (JList)c;
+ list = tmp;
layoutOrientation = list.getLayoutOrientation();
@@ -925,7 +930,7 @@
* {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
*/
- public int locationToIndex(JList list, Point location) {
+ public int locationToIndex(JList<?> list, Point location) {
maybeUpdateLayoutState();
return convertLocationToModel(location.x, location.y);
}
@@ -934,7 +939,7 @@
/**
* {@inheritDoc}
*/
- public Point indexToLocation(JList list, int index) {
+ public Point indexToLocation(JList<?> list, int index) {
maybeUpdateLayoutState();
Rectangle rect = getCellBounds(list, index, index);
@@ -948,7 +953,7 @@
/**
* {@inheritDoc}
*/
- public Rectangle getCellBounds(JList list, int index1, int index2) {
+ public Rectangle getCellBounds(JList<?> list, int index1, int index2) {
maybeUpdateLayoutState();
int minIndex = Math.min(index1, index2);
@@ -992,7 +997,7 @@
* Gets the bounds of the specified model index, returning the resulting
* bounds, or null if <code>index</code> is not valid.
*/
- private Rectangle getCellBounds(JList list, int index) {
+ private Rectangle getCellBounds(JList<?> list, int index) {
maybeUpdateLayoutState();
int row = convertModelToRow(index);
@@ -1351,9 +1356,9 @@
if ((fixedCellWidth == -1) || (fixedCellHeight == -1)) {
- ListModel dataModel = list.getModel();
+ ListModel<Object> dataModel = list.getModel();
int dataModelSize = dataModel.getSize();
- ListCellRenderer renderer = list.getCellRenderer();
+ ListCellRenderer<Object> renderer = list.getCellRenderer();
if (renderer != null) {
for(int index = 0; index < dataModelSize; index++) {
@@ -1838,7 +1843,8 @@
}
public void actionPerformed(ActionEvent e) {
String name = getName();
- JList list = (JList)e.getSource();
+ @SuppressWarnings("unchecked")
+ JList<Object> list = (JList)e.getSource();
BasicListUI ui = (BasicListUI)BasicLookAndFeel.getUIOfType(
list.getUI(), BasicListUI.class);
@@ -1997,11 +2003,11 @@
return true;
}
- private void clearSelection(JList list) {
+ private void clearSelection(JList<?> list) {
list.clearSelection();
}
- private void selectAll(JList list) {
+ private void selectAll(JList<?> list) {
int size = list.getModel().getSize();
if (size > 0) {
ListSelectionModel lsm = list.getSelectionModel();
@@ -2030,7 +2036,7 @@
}
}
- private int getNextPageIndex(JList list, int direction) {
+ private int getNextPageIndex(JList<?> list, int direction) {
if (list.getModel().getSize() == 0) {
return -1;
}
@@ -2155,7 +2161,7 @@
return index;
}
- private void changeSelection(JList list, int type,
+ private void changeSelection(JList<?> list, int type,
int index, int direction) {
if (index >= 0 && index < list.getModel().getSize()) {
ListSelectionModel lsm = list.getSelectionModel();
@@ -2198,7 +2204,7 @@
* index. When scroll up makes selected index the first visible index.
* Adjust visible rectangle respect to list's component orientation.
*/
- private void adjustScrollPositionIfNecessary(JList list, int index,
+ private void adjustScrollPositionIfNecessary(JList<?> list, int index,
int direction) {
if (direction == 0) {
return;
@@ -2286,7 +2292,7 @@
}
}
- private int getNextColumnIndex(JList list, BasicListUI ui,
+ private int getNextColumnIndex(JList<?> list, BasicListUI ui,
int amount) {
if (list.getLayoutOrientation() != JList.VERTICAL) {
int index = adjustIndex(list.getLeadSelectionIndex(), list);
@@ -2319,7 +2325,7 @@
return -1;
}
- private int getNextIndex(JList list, BasicListUI ui, int amount) {
+ private int getNextIndex(JList<?> list, BasicListUI ui, int amount) {
int index = adjustIndex(list.getLeadSelectionIndex(), list);
int size = list.getModel().getSize();
@@ -2371,8 +2377,8 @@
* of the same letters followed by first typed another letter.
*/
public void keyTyped(KeyEvent e) {
- JList src = (JList)e.getSource();
- ListModel model = src.getModel();
+ JList<?> src = (JList)e.getSource();
+ ListModel<?> model = src.getModel();
if (model.getSize() == 0 || e.isAltDown() ||
BasicGraphicsUtils.isMenuShortcutKeyDown(e) ||
@@ -2468,8 +2474,10 @@
* listDataListener from the old model and add it to the new one.
*/
if (propertyName == "model") {
- ListModel oldModel = (ListModel)e.getOldValue();
- ListModel newModel = (ListModel)e.getNewValue();
+ @SuppressWarnings("unchecked")
+ ListModel<?> oldModel = (ListModel)e.getOldValue();
+ @SuppressWarnings("unchecked")
+ ListModel<?> newModel = (ListModel)e.getNewValue();
if (oldModel != null) {
oldModel.removeListDataListener(listDataListener);
}
@@ -2828,7 +2836,7 @@
}
}
- private static int adjustIndex(int index, JList list) {
+ private static int adjustIndex(int index, JList<?> list) {
return index < list.getModel().getSize() ? index : -1;
}
@@ -2848,7 +2856,7 @@
*/
protected Transferable createTransferable(JComponent c) {
if (c instanceof JList) {
- JList list = (JList) c;
+ JList<?> list = (JList) c;
Object[] values = list.getSelectedValues();
if (values == null || values.length == 0) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Fri Jul 25 09:44:53 2014 +0000
@@ -1861,7 +1861,7 @@
* Returns the ui that is of type <code>klass</code>, or null if
* one can not be found.
*/
- static Object getUIOfType(ComponentUI ui, Class klass) {
+ static Object getUIOfType(ComponentUI ui, Class<?> klass) {
if (klass.isInstance(ui)) {
return ui;
}
@@ -2256,4 +2256,4 @@
}
}
}
-}
\ No newline at end of file
+}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -609,7 +609,7 @@
MenuElement path[] = e.getPath();
if (key == Character.toLowerCase(e.getKeyChar())) {
JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu();
- ArrayList newList = new ArrayList(Arrays.asList(path));
+ ArrayList<MenuElement> newList = new ArrayList<>(Arrays.asList(path));
newList.add(popupMenu);
MenuElement subs[] = popupMenu.getSubElements();
MenuElement sub =
@@ -619,7 +619,7 @@
}
MenuSelectionManager manager = e.getMenuSelectionManager();
MenuElement newPath[] = new MenuElement[0];;
- newPath = (MenuElement[]) newList.toArray(newPath);
+ newPath = newList.toArray(newPath);
manager.setSelectedPath(newPath);
e.consume();
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -450,7 +450,7 @@
if (sValues != null) {
if (sValues.length < 20) {
- JComboBox cBox = new JComboBox();
+ JComboBox<Object> cBox = new JComboBox<>();
cBox.setName("OptionPane.comboBox");
for(int counter = 0, maxCounter = sValues.length;
@@ -464,7 +464,7 @@
toAdd = cBox;
} else {
- JList list = new JList(sValues);
+ JList<Object> list = new JList<>(sValues);
JScrollPane sp = new JScrollPane(list);
sp.setName("OptionPane.scrollPane");
@@ -1232,7 +1232,7 @@
public void mousePressed(MouseEvent e) {
if (e.getClickCount() == 2) {
- JList list = (JList)e.getSource();
+ JList<?> list = (JList)e.getSource();
int index = list.locationToIndex(e.getPoint());
optionPane.setInputValue(list.getModel().getElementAt(index));
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1265,7 +1265,7 @@
JViewport viewport = scrollpane.getViewport();
Component view = viewport.getView();
if (view instanceof JList) {
- JList list = (JList)view;
+ JList<?> list = (JList)view;
if (DefaultLookup.getBoolean(list, list.getUI(),
"List.lockToPositionOnScroll", false)) {
int adjustedValue = value;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -397,13 +397,13 @@
protected boolean labelsHaveSameBaselines() {
if (!checkedLabelBaselines) {
checkedLabelBaselines = true;
- Dictionary dictionary = slider.getLabelTable();
+ Dictionary<?, JComponent> dictionary = slider.getLabelTable();
if (dictionary != null) {
sameLabelBaselines = true;
- Enumeration elements = dictionary.elements();
+ Enumeration<JComponent> elements = dictionary.elements();
int baseline = -1;
while (elements.hasMoreElements()) {
- JComponent label = (JComponent) elements.nextElement();
+ JComponent label = elements.nextElement();
Dimension pref = label.getPreferredSize();
int labelBaseline = label.getBaseline(pref.width,
pref.height);
@@ -753,12 +753,12 @@
}
protected int getWidthOfWidestLabel() {
- Dictionary dictionary = slider.getLabelTable();
+ Dictionary<?, JComponent> dictionary = slider.getLabelTable();
int widest = 0;
if ( dictionary != null ) {
- Enumeration keys = dictionary.keys();
+ Enumeration<?> keys = dictionary.keys();
while ( keys.hasMoreElements() ) {
- JComponent label = (JComponent) dictionary.get(keys.nextElement());
+ JComponent label = dictionary.get(keys.nextElement());
widest = Math.max( label.getPreferredSize().width, widest );
}
}
@@ -766,12 +766,12 @@
}
protected int getHeightOfTallestLabel() {
- Dictionary dictionary = slider.getLabelTable();
+ Dictionary<?, JComponent> dictionary = slider.getLabelTable();
int tallest = 0;
if ( dictionary != null ) {
- Enumeration keys = dictionary.keys();
+ Enumeration<?> keys = dictionary.keys();
while ( keys.hasMoreElements() ) {
- JComponent label = (JComponent) dictionary.get(keys.nextElement());
+ JComponent label = dictionary.get(keys.nextElement());
tallest = Math.max( label.getPreferredSize().height, tallest );
}
}
@@ -842,18 +842,18 @@
* @since 1.6
*/
protected Integer getHighestValue() {
- Dictionary dictionary = slider.getLabelTable();
+ Dictionary<Integer, ?> dictionary = slider.getLabelTable();
if (dictionary == null) {
return null;
}
- Enumeration keys = dictionary.keys();
+ Enumeration<Integer> keys = dictionary.keys();
Integer max = null;
while (keys.hasMoreElements()) {
- Integer i = (Integer) keys.nextElement();
+ Integer i = keys.nextElement();
if (max == null || i > max) {
max = i;
@@ -871,18 +871,18 @@
* @since 1.6
*/
protected Integer getLowestValue() {
- Dictionary dictionary = slider.getLabelTable();
+ Dictionary<Integer, JComponent> dictionary = slider.getLabelTable();
if (dictionary == null) {
return null;
}
- Enumeration keys = dictionary.keys();
+ Enumeration<Integer> keys = dictionary.keys();
Integer min = null;
while (keys.hasMoreElements()) {
- Integer i = (Integer) keys.nextElement();
+ Integer i = keys.nextElement();
if (min == null || i < min) {
min = i;
@@ -1121,17 +1121,17 @@
public void paintLabels( Graphics g ) {
Rectangle labelBounds = labelRect;
- Dictionary dictionary = slider.getLabelTable();
+ Dictionary<Integer, JComponent> dictionary = slider.getLabelTable();
if ( dictionary != null ) {
- Enumeration keys = dictionary.keys();
+ Enumeration<Integer> keys = dictionary.keys();
int minValue = slider.getMinimum();
int maxValue = slider.getMaximum();
boolean enabled = slider.isEnabled();
while ( keys.hasMoreElements() ) {
- Integer key = (Integer)keys.nextElement();
+ Integer key = keys.nextElement();
int value = key.intValue();
if (value >= minValue && value <= maxValue) {
- JComponent label = (JComponent) dictionary.get(key);
+ JComponent label = dictionary.get(key);
label.setEnabled(enabled);
if (label instanceof JLabel) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -707,7 +707,7 @@
iterator.first();
do {
- Map attrs = iterator.getAttributes();
+ Map<?, ?> attrs = iterator.getAttributes();
if (attrs != null && attrs.containsKey(field)){
int start = iterator.getRunStart(field);
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -103,7 +103,7 @@
if (e.getClickCount() % 2 == 1 &&
SwingUtilities.isLeftMouseButton(e)) {
JTable table = header.getTable();
- RowSorter sorter;
+ RowSorter<?> sorter;
if (table != null && (sorter = table.getRowSorter()) != null) {
int columnIndex = header.columnAtPoint(e.getPoint());
if (columnIndex != -1) {
@@ -772,9 +772,9 @@
*/
public Dimension getMinimumSize(JComponent c) {
long width = 0;
- Enumeration enumeration = header.getColumnModel().getColumns();
+ Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
- TableColumn aColumn = (TableColumn)enumeration.nextElement();
+ TableColumn aColumn = enumeration.nextElement();
width = width + aColumn.getMinWidth();
}
return createHeaderSize(width);
@@ -788,9 +788,9 @@
*/
public Dimension getPreferredSize(JComponent c) {
long width = 0;
- Enumeration enumeration = header.getColumnModel().getColumns();
+ Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
- TableColumn aColumn = (TableColumn)enumeration.nextElement();
+ TableColumn aColumn = enumeration.nextElement();
width = width + aColumn.getPreferredWidth();
}
return createHeaderSize(width);
@@ -802,9 +802,9 @@
*/
public Dimension getMaximumSize(JComponent c) {
long width = 0;
- Enumeration enumeration = header.getColumnModel().getColumns();
+ Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
- TableColumn aColumn = (TableColumn)enumeration.nextElement();
+ TableColumn aColumn = enumeration.nextElement();
width = width + aColumn.getMaxWidth();
}
return createHeaderSize(width);
@@ -875,7 +875,7 @@
String name = getName();
if (TOGGLE_SORT_ORDER == name) {
JTable table = th.getTable();
- RowSorter sorter = table == null ? null : table.getRowSorter();
+ RowSorter<?> sorter = table == null ? null : table.getRowSorter();
if (sorter != null) {
int columnIndex = ui.getSelectedColumnIndex();
columnIndex = table.convertColumnIndexToModel(
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1710,9 +1710,9 @@
*/
public Dimension getMinimumSize(JComponent c) {
long width = 0;
- Enumeration enumeration = table.getColumnModel().getColumns();
+ Enumeration<TableColumn> enumeration = table.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
- TableColumn aColumn = (TableColumn)enumeration.nextElement();
+ TableColumn aColumn = enumeration.nextElement();
width = width + aColumn.getMinWidth();
}
return createTableSize(width);
@@ -1725,9 +1725,9 @@
*/
public Dimension getPreferredSize(JComponent c) {
long width = 0;
- Enumeration enumeration = table.getColumnModel().getColumns();
+ Enumeration<TableColumn> enumeration = table.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
- TableColumn aColumn = (TableColumn)enumeration.nextElement();
+ TableColumn aColumn = enumeration.nextElement();
width = width + aColumn.getPreferredWidth();
}
return createTableSize(width);
@@ -1740,9 +1740,9 @@
*/
public Dimension getMaximumSize(JComponent c) {
long width = 0;
- Enumeration enumeration = table.getColumnModel().getColumns();
+ Enumeration<TableColumn> enumeration = table.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
- TableColumn aColumn = (TableColumn)enumeration.nextElement();
+ TableColumn aColumn = enumeration.nextElement();
width = width + aColumn.getMaxWidth();
}
return createTableSize(width);
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1148,7 +1148,7 @@
Insets insets = tree.getInsets();
TreePath initialPath = getClosestPathForLocation
(tree, 0, paintBounds.y);
- Enumeration paintingEnumerator = treeState.getVisiblePathsFrom
+ Enumeration<?> paintingEnumerator = treeState.getVisiblePathsFrom
(initialPath);
int row = treeState.getRowForPath(initialPath);
int endY = paintBounds.y + paintBounds.height;
@@ -1694,7 +1694,7 @@
if(treeState != null) {
treeState.setExpandedState(path, true);
- Enumeration descendants = tree.getExpandedDescendants(path);
+ Enumeration<?> descendants = tree.getExpandedDescendants(path);
if(descendants != null) {
while(descendants.hasMoreElements()) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java Fri Jul 25 09:44:53 2014 +0000
@@ -70,7 +70,7 @@
* This method is highly implementation specific and should not be used
* for general list manipulation.
*/
- public JList getList();
+ public JList<Object> getList();
/**
* Returns a mouse listener that will be added to the combo box or null.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/LazyActionMap.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/LazyActionMap.java Fri Jul 25 09:44:53 2014 +0000
@@ -56,7 +56,7 @@
* @param defaultsKey Key to use to defaults table to check for
* existing map and what resulting Map will be registered on.
*/
- static void installLazyActionMap(JComponent c, Class loaderClass,
+ static void installLazyActionMap(JComponent c, Class<?> loaderClass,
String defaultsKey) {
ActionMap map = (ActionMap)UIManager.get(defaultsKey);
if (map == null) {
@@ -79,7 +79,7 @@
* @param defaultsKey Key to use to defaults table to check for
* existing map and what resulting Map will be registered on.
*/
- static ActionMap getActionMap(Class loaderClass,
+ static ActionMap getActionMap(Class<?> loaderClass,
String defaultsKey) {
ActionMap map = (ActionMap)UIManager.get(defaultsKey);
if (map == null) {
@@ -90,7 +90,7 @@
}
- private LazyActionMap(Class loader) {
+ private LazyActionMap(Class<?> loader) {
_loader = loader;
}
@@ -146,7 +146,7 @@
Class<?> klass = (Class<?>)loader;
try {
Method method = klass.getDeclaredMethod("loadActionMap",
- new Class[] { LazyActionMap.class });
+ new Class<?>[] { LazyActionMap.class });
method.invoke(klass, new Object[] { this });
} catch (NoSuchMethodException nsme) {
assert false : "LazyActionMap unable to load actions " +
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalBumps.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalBumps.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -67,6 +67,7 @@
private static BumpBuffer createBuffer(GraphicsConfiguration gc,
Color topColor, Color shadowColor, Color backColor) {
AppContext context = AppContext.getAppContext();
+ @SuppressWarnings("unchecked")
List<BumpBuffer> buffers = (List<BumpBuffer>) context.get(METAL_BUMPS);
if (buffers == null) {
buffers = new ArrayList<BumpBuffer>();
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java Fri Jul 25 09:44:53 2014 +0000
@@ -54,12 +54,12 @@
/**
* The instance of {@code JComboBox}.
*/
- protected JComboBox comboBox;
+ protected JComboBox<Object> comboBox;
/**
* The instance of {@code JList}.
*/
- protected JList listBox;
+ protected JList<Object> listBox;
/**
* The instance of {@code CellRendererPane}.
@@ -81,14 +81,14 @@
*
* @return the {@code JComboBox}
*/
- public final JComboBox getComboBox() { return comboBox;}
+ public final JComboBox<Object> getComboBox() { return comboBox;}
/**
* Sets the {@code JComboBox}.
*
* @param cb the {@code JComboBox}
*/
- public final void setComboBox( JComboBox cb ) { comboBox = cb;}
+ public final void setComboBox( JComboBox<Object> cb ) { comboBox = cb;}
/**
* Returns the icon of the {@code JComboBox}.
@@ -136,8 +136,8 @@
* @param pane an instance of {@code CellRendererPane}
* @param list an instance of {@code JList}
*/
- public MetalComboBoxButton( JComboBox cb, Icon i,
- CellRendererPane pane, JList list ) {
+ public MetalComboBoxButton( JComboBox<Object> cb, Icon i,
+ CellRendererPane pane, JList<Object> list ) {
this();
comboBox = cb;
comboIcon = i;
@@ -155,8 +155,8 @@
* @param pane an instance of {@code CellRendererPane}
* @param list an instance of {@code JList}
*/
- public MetalComboBoxButton( JComboBox cb, Icon i, boolean onlyIcon,
- CellRendererPane pane, JList list ) {
+ public MetalComboBoxButton( JComboBox<Object> cb, Icon i, boolean onlyIcon,
+ CellRendererPane pane, JList<Object> list ) {
this( cb, i, pane, list );
iconOnly = onlyIcon;
}
@@ -238,7 +238,7 @@
// Let the renderer paint
if ( ! iconOnly && comboBox != null ) {
- ListCellRenderer renderer = comboBox.getRenderer();
+ ListCellRenderer<Object> renderer = comboBox.getRenderer();
Component c;
boolean renderPressed = getModel().isPressed();
c = renderer.getListCellRendererComponent(listBox,
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -391,7 +391,7 @@
*
* @param cBox an instance of {@code JComboBox}
*/
- public MetalComboPopup( JComboBox cBox) {
+ public MetalComboPopup( JComboBox<Object> cBox) {
super( cBox );
}
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -58,7 +58,7 @@
// made most things in this class private.
private JLabel lookInLabel;
- private JComboBox directoryComboBox;
+ private JComboBox<Object> directoryComboBox;
private DirectoryComboBoxModel directoryComboBoxModel;
private Action directoryComboBoxAction = new DirectoryComboBoxAction();
@@ -76,7 +76,7 @@
private JPanel buttonPanel;
private JPanel bottomPanel;
- private JComboBox filterComboBox;
+ private JComboBox<?> filterComboBox;
private static final Dimension hstrut5 = new Dimension(5, 1);
private static final Dimension hstrut11 = new Dimension(11, 1);
@@ -204,7 +204,7 @@
return MetalFileChooserUI.this.getNewFolderAction();
}
- public MouseListener createDoubleClickListener(JList list) {
+ public MouseListener createDoubleClickListener(JList<?> list) {
return MetalFileChooserUI.this.createDoubleClickListener(getFileChooser(),
list);
}
@@ -243,7 +243,7 @@
// CurrentDir ComboBox
@SuppressWarnings("serial") // anonymous class
- JComboBox tmp1 = new JComboBox() {
+ JComboBox<Object> tmp1 = new JComboBox<Object>() {
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
// Must be small enough to not affect total width.
@@ -426,7 +426,7 @@
filterComboBoxModel = createFilterComboBoxModel();
fc.addPropertyChangeListener(filterComboBoxModel);
- filterComboBox = new JComboBox(filterComboBoxModel);
+ filterComboBox = new JComboBox<>(filterComboBoxModel);
filterComboBox.putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY,
filesOfTypeLabelText);
filesOfTypeLabel.setLabelFor(filterComboBox);
@@ -578,7 +578,7 @@
*
* @param list an instance of {@code JList}
*/
- public SingleClickListener(JList list) {
+ public SingleClickListener(JList<?> list) {
}
}
@@ -927,7 +927,7 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
class DirectoryComboBoxRenderer extends DefaultListCellRenderer {
IndentIcon ii = new IndentIcon();
- public Component getListCellRendererComponent(JList list, Object value,
+ public Component getListCellRendererComponent(JList<?> list, Object value,
int index, boolean isSelected,
boolean cellHasFocus) {
@@ -1131,7 +1131,7 @@
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class FilterComboBoxRenderer extends DefaultListCellRenderer {
- public Component getListCellRendererComponent(JList list,
+ public Component getListCellRendererComponent(JList<?> list,
Object value, int index, boolean isSelected,
boolean cellHasFocus) {
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -117,7 +117,7 @@
* that shares the JRootPane ancestor of <code>from</code>.
*/
synchronized static Object findRegisteredComponentOfType(JComponent from,
- Class target) {
+ Class<?> target) {
JRootPane rp = SwingUtilities.getRootPane(from);
if (rp != null) {
for (int counter = components.size() - 1; counter >= 0; counter--){
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalUtils.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalUtils.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -210,7 +210,8 @@
*/
static boolean drawGradient(Component c, Graphics g, String key,
int x, int y, int w, int h, boolean vertical) {
- java.util.List gradient = (java.util.List)UIManager.get(key);
+ @SuppressWarnings("unchecked")
+ java.util.List<?> gradient = (java.util.List)UIManager.get(key);
if (gradient == null || !(g instanceof Graphics2D)) {
return false;
}
@@ -251,7 +252,7 @@
}
public void paint(Component c, Graphics2D g,
- java.util.List gradient, int x, int y, int w,
+ java.util.List<?> gradient, int x, int y, int w,
int h, boolean isVertical) {
int imageWidth;
int imageHeight;
@@ -274,7 +275,8 @@
protected void paintToImage(Component c, Image image, Graphics g,
int w, int h, Object[] args) {
Graphics2D g2 = (Graphics2D)g;
- java.util.List gradient = (java.util.List)args[0];
+ @SuppressWarnings("unchecked")
+ java.util.List<?> gradient = (java.util.List)args[0];
boolean isVertical = ((Boolean)args[1]).booleanValue();
// Render to the VolatileImage
if (isVertical) {
--- a/jdk/src/share/classes/javax/swing/plaf/metal/OceanTheme.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/OceanTheme.java Fri Jul 25 09:44:53 2014 +0000
@@ -133,7 +133,7 @@
UIDefaults.LazyValue focusBorder = t ->
new BorderUIResource.LineBorderUIResource(getPrimary1());
// .30 0 DDE8F3 white secondary2
- java.util.List buttonGradient = Arrays.asList(
+ java.util.List<?> buttonGradient = Arrays.asList(
new Object[] {new Float(.3f), new Float(0f),
new ColorUIResource(0xDDE8F3), getWhite(), getSecondary2() });
@@ -149,7 +149,7 @@
Color c8ddf2 = new ColorUIResource(0xC8DDF2);
Object directoryIcon = getIconResource("icons/ocean/directory.gif");
Object fileIcon = getIconResource("icons/ocean/file.gif");
- java.util.List sliderGradient = Arrays.asList(new Object[] {
+ java.util.List<?> sliderGradient = Arrays.asList(new Object[] {
new Float(.3f), new Float(.2f),
c8ddf2, getWhite(), new ColorUIResource(SECONDARY2) });
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiButtonUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiButtonUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiButtonUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiButtonUI) mui).uis,
- a);
+ MultiButtonUI mui = new MultiButtonUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis,a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiColorChooserUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiColorChooserUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiColorChooserUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiColorChooserUI) mui).uis,
- a);
+ MultiColorChooserUI mui = new MultiColorChooserUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiComboBoxUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiComboBoxUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -48,7 +48,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -75,7 +75,7 @@
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
- public boolean isFocusTraversable(JComboBox a) {
+ public boolean isFocusTraversable(JComboBox<?> a) {
boolean returnValue =
((ComboBoxUI) (uis.elementAt(0))).isFocusTraversable(a);
for (int i = 1; i < uis.size(); i++) {
@@ -87,7 +87,7 @@
/**
* Invokes the <code>setPopupVisible</code> method on each UI handled by this object.
*/
- public void setPopupVisible(JComboBox a, boolean b) {
+ public void setPopupVisible(JComboBox<?> a, boolean b) {
for (int i = 0; i < uis.size(); i++) {
((ComboBoxUI) (uis.elementAt(i))).setPopupVisible(a,b);
}
@@ -99,7 +99,7 @@
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
- public boolean isPopupVisible(JComboBox a) {
+ public boolean isPopupVisible(JComboBox<?> a) {
boolean returnValue =
((ComboBoxUI) (uis.elementAt(0))).isPopupVisible(a);
for (int i = 1; i < uis.size(); i++) {
@@ -120,9 +120,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -132,7 +132,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -145,10 +145,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiComboBoxUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiComboBoxUI) mui).uis,
- a);
+ MultiComboBoxUI mui = new MultiComboBoxUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -156,7 +154,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -165,7 +163,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -174,7 +172,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -186,9 +184,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -201,9 +199,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -216,9 +214,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -231,9 +229,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -246,9 +244,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopIconUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopIconUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiDesktopIconUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiDesktopIconUI) mui).uis,
- a);
+ MultiDesktopIconUI mui = new MultiDesktopIconUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopPaneUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiDesktopPaneUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiDesktopPaneUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiDesktopPaneUI) mui).uis,
- a);
+ MultiDesktopPaneUI mui = new MultiDesktopPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiFileChooserUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiFileChooserUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -52,7 +52,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -163,9 +163,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -175,7 +175,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -188,10 +188,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiFileChooserUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiFileChooserUI) mui).uis,
- a);
+ MultiFileChooserUI mui = new MultiFileChooserUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -199,7 +197,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -208,7 +206,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -217,7 +215,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -229,9 +227,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -244,9 +242,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -259,9 +257,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -274,9 +272,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -289,9 +287,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiInternalFrameUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiInternalFrameUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiInternalFrameUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiInternalFrameUI) mui).uis,
- a);
+ MultiInternalFrameUI mui = new MultiInternalFrameUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiLabelUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiLabelUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiLabelUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiLabelUI) mui).uis,
- a);
+ MultiLabelUI mui = new MultiLabelUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiListUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiListUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -50,7 +50,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -77,7 +77,7 @@
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
- public int locationToIndex(JList a, Point b) {
+ public int locationToIndex(JList<?> a, Point b) {
int returnValue =
((ListUI) (uis.elementAt(0))).locationToIndex(a,b);
for (int i = 1; i < uis.size(); i++) {
@@ -92,7 +92,7 @@
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
- public Point indexToLocation(JList a, int b) {
+ public Point indexToLocation(JList<?> a, int b) {
Point returnValue =
((ListUI) (uis.elementAt(0))).indexToLocation(a,b);
for (int i = 1; i < uis.size(); i++) {
@@ -107,7 +107,7 @@
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
- public Rectangle getCellBounds(JList a, int b, int c) {
+ public Rectangle getCellBounds(JList<?> a, int b, int c) {
Rectangle returnValue =
((ListUI) (uis.elementAt(0))).getCellBounds(a,b,c);
for (int i = 1; i < uis.size(); i++) {
@@ -128,9 +128,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -140,7 +140,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -153,10 +153,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiListUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiListUI) mui).uis,
- a);
+ MultiListUI mui = new MultiListUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -164,7 +162,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -173,7 +171,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -182,7 +180,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -194,9 +192,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -209,9 +207,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -224,9 +222,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -239,9 +237,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -254,9 +252,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiLookAndFeel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiLookAndFeel.java Fri Jul 25 09:44:53 2014 +0000
@@ -221,7 +221,7 @@
* @see MultiButtonUI#createUI
*/
public static ComponentUI createUIs(ComponentUI mui,
- Vector uis,
+ Vector<ComponentUI> uis,
JComponent target) {
ComponentUI ui;
@@ -248,7 +248,7 @@
// get a UI from just the default look and feel.
//
if (uis.size() == 1) {
- return (ComponentUI) uis.elementAt(0);
+ return uis.elementAt(0);
} else {
return mui;
}
@@ -269,7 +269,7 @@
* @return an array equivalent to the passed-in vector
*
*/
- protected static ComponentUI[] uisToArray(Vector uis) {
+ protected static ComponentUI[] uisToArray(Vector<? extends ComponentUI> uis) {
if (uis == null) {
return new ComponentUI[0];
} else {
@@ -277,7 +277,7 @@
if (count > 0) {
ComponentUI[] u = new ComponentUI[count];
for (int i = 0; i < count; i++) {
- u[i] = (ComponentUI)uis.elementAt(i);
+ u[i] = uis.elementAt(i);
}
return u;
} else {
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuBarUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuBarUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiMenuBarUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiMenuBarUI) mui).uis,
- a);
+ MultiMenuBarUI mui = new MultiMenuBarUI();
+ return MultiLookAndFeel.createUIs(mui,mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuItemUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiMenuItemUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -48,7 +48,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -85,9 +85,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -97,7 +97,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -110,10 +110,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiMenuItemUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiMenuItemUI) mui).uis,
- a);
+ MultiMenuItemUI mui = new MultiMenuItemUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -121,7 +119,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -130,7 +128,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -139,7 +137,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -151,9 +149,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -166,9 +164,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -181,9 +179,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -196,9 +194,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -211,9 +209,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiOptionPaneUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiOptionPaneUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -48,7 +48,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -105,9 +105,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -117,7 +117,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -130,10 +130,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiOptionPaneUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiOptionPaneUI) mui).uis,
- a);
+ MultiOptionPaneUI mui = new MultiOptionPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -141,7 +139,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -150,7 +148,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -159,7 +157,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -171,9 +169,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -186,9 +184,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -201,9 +199,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -216,9 +214,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -231,9 +229,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiPanelUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiPanelUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiPanelUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiPanelUI) mui).uis,
- a);
+ MultiPanelUI mui = new MultiPanelUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiPopupMenuUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiPopupMenuUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -50,7 +50,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -115,9 +115,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -127,7 +127,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -140,10 +140,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiPopupMenuUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiPopupMenuUI) mui).uis,
- a);
+ MultiPopupMenuUI mui = new MultiPopupMenuUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -151,7 +149,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -160,7 +158,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -169,7 +167,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -181,9 +179,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -196,9 +194,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -211,9 +209,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -226,9 +224,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -241,9 +239,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiProgressBarUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiProgressBarUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiProgressBarUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiProgressBarUI) mui).uis,
- a);
+ MultiProgressBarUI mui = new MultiProgressBarUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiRootPaneUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiRootPaneUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -48,7 +48,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -81,9 +81,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -93,7 +93,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -106,10 +106,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiRootPaneUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiRootPaneUI) mui).uis,
- a);
+ MultiRootPaneUI mui = new MultiRootPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -117,7 +115,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -126,7 +124,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -135,7 +133,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -147,9 +145,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -162,9 +160,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -177,9 +175,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -192,9 +190,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -207,9 +205,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollBarUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollBarUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiScrollBarUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiScrollBarUI) mui).uis,
- a);
+ MultiScrollBarUI mui = new MultiScrollBarUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollPaneUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiScrollPaneUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiScrollPaneUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiScrollPaneUI) mui).uis,
- a);
+ MultiScrollPaneUI mui = new MultiScrollPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSeparatorUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSeparatorUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiSeparatorUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiSeparatorUI) mui).uis,
- a);
+ MultiSeparatorUI mui = new MultiSeparatorUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSliderUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSliderUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiSliderUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiSliderUI) mui).uis,
- a);
+ MultiSliderUI mui = new MultiSliderUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSpinnerUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSpinnerUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -48,7 +48,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -81,9 +81,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -93,7 +93,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -106,10 +106,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiSpinnerUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiSpinnerUI) mui).uis,
- a);
+ MultiSpinnerUI mui = new MultiSpinnerUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -117,7 +115,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -126,7 +124,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -135,7 +133,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -147,9 +145,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -162,9 +160,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -177,9 +175,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -192,9 +190,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -207,9 +205,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiSplitPaneUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiSplitPaneUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -48,7 +48,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -153,9 +153,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -165,7 +165,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -178,10 +178,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiSplitPaneUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiSplitPaneUI) mui).uis,
- a);
+ MultiSplitPaneUI mui = new MultiSplitPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -189,7 +187,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -198,7 +196,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -207,7 +205,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -219,9 +217,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -234,9 +232,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -249,9 +247,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -264,9 +262,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -279,9 +277,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTabbedPaneUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTabbedPaneUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,7 +49,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -127,9 +127,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -139,7 +139,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -152,10 +152,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiTabbedPaneUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiTabbedPaneUI) mui).uis,
- a);
+ MultiTabbedPaneUI mui = new MultiTabbedPaneUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -163,7 +161,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -172,7 +170,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -181,7 +179,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -193,9 +191,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -208,9 +206,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -223,9 +221,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -238,9 +236,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -253,9 +251,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableHeaderUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableHeaderUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiTableHeaderUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiTableHeaderUI) mui).uis,
- a);
+ MultiTableHeaderUI mui = new MultiTableHeaderUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTableUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiTableUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiTableUI) mui).uis,
- a);
+ MultiTableUI mui = new MultiTableUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTextUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTextUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -55,7 +55,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -230,9 +230,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -242,7 +242,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -255,10 +255,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiTextUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiTextUI) mui).uis,
- a);
+ MultiTextUI mui = new MultiTextUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -266,7 +264,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -275,7 +273,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -284,7 +282,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -296,9 +294,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -311,9 +309,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -326,9 +324,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -341,9 +339,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -356,9 +354,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolBarUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolBarUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiToolBarUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiToolBarUI) mui).uis,
- a);
+ MultiToolBarUI mui = new MultiToolBarUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolTipUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiToolTipUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiToolTipUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiToolTipUI) mui).uis,
- a);
+ MultiToolTipUI mui = new MultiToolTipUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiTreeUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiTreeUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -50,7 +50,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -221,9 +221,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -233,7 +233,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -246,10 +246,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiTreeUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiTreeUI) mui).uis,
- a);
+ MultiTreeUI mui = new MultiTreeUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -257,7 +255,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -266,7 +264,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -275,7 +273,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -287,9 +285,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -302,9 +300,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -317,9 +315,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -332,9 +330,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -347,9 +345,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/multi/MultiViewportUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/MultiViewportUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -47,7 +47,7 @@
* the <code>getUIs</code> method. The first element is guaranteed to be the real UI
* obtained from the default look and feel.
*/
- protected Vector uis = new Vector();
+ protected Vector<ComponentUI> uis = new Vector<>();
////////////////////
// Common UI methods
@@ -80,9 +80,9 @@
*/
public boolean contains(JComponent a, int b, int c) {
boolean returnValue =
- ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
+ uis.elementAt(0).contains(a,b,c);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
+ uis.elementAt(i).contains(a,b,c);
}
return returnValue;
}
@@ -92,7 +92,7 @@
*/
public void update(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).update(a,b);
+ uis.elementAt(i).update(a,b);
}
}
@@ -105,10 +105,8 @@
* @return the UI delegate created
*/
public static ComponentUI createUI(JComponent a) {
- ComponentUI mui = new MultiViewportUI();
- return MultiLookAndFeel.createUIs(mui,
- ((MultiViewportUI) mui).uis,
- a);
+ MultiViewportUI mui = new MultiViewportUI();
+ return MultiLookAndFeel.createUIs(mui, mui.uis, a);
}
/**
@@ -116,7 +114,7 @@
*/
public void installUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).installUI(a);
+ uis.elementAt(i).installUI(a);
}
}
@@ -125,7 +123,7 @@
*/
public void uninstallUI(JComponent a) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
+ uis.elementAt(i).uninstallUI(a);
}
}
@@ -134,7 +132,7 @@
*/
public void paint(Graphics a, JComponent b) {
for (int i = 0; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).paint(a,b);
+ uis.elementAt(i).paint(a,b);
}
}
@@ -146,9 +144,9 @@
*/
public Dimension getPreferredSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
+ uis.elementAt(0).getPreferredSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
+ uis.elementAt(i).getPreferredSize(a);
}
return returnValue;
}
@@ -161,9 +159,9 @@
*/
public Dimension getMinimumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
+ uis.elementAt(0).getMinimumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
+ uis.elementAt(i).getMinimumSize(a);
}
return returnValue;
}
@@ -176,9 +174,9 @@
*/
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
- ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
+ uis.elementAt(0).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
+ uis.elementAt(i).getMaximumSize(a);
}
return returnValue;
}
@@ -191,9 +189,9 @@
*/
public int getAccessibleChildrenCount(JComponent a) {
int returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
+ uis.elementAt(0).getAccessibleChildrenCount(a);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
+ uis.elementAt(i).getAccessibleChildrenCount(a);
}
return returnValue;
}
@@ -206,9 +204,9 @@
*/
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
- ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
+ uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
- ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
+ uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
}
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusIcon.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -50,15 +50,20 @@
this.key = key;
}
+ @SuppressWarnings("unchecked")
+ private static Painter<JComponent> paintFilter(@SuppressWarnings("rawtypes") Painter painter) {
+ return (Painter<JComponent>) painter;
+ }
+
@Override
public void paintIcon(SynthContext context, Graphics g, int x, int y,
int w, int h) {
- Painter painter = null;
+ Painter<JComponent> painter = null;
if (context != null) {
- painter = (Painter)context.getStyle().get(context, key);
+ painter = paintFilter((Painter)context.getStyle().get(context, key));
}
if (painter == null){
- painter = (Painter) UIManager.get(prefix + "[Enabled]." + key);
+ painter = paintFilter((Painter)UIManager.get(prefix + "[Enabled]." + key));
}
if (painter != null && context != null) {
@@ -140,7 +145,8 @@
*/
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
- Painter painter = (Painter)UIManager.get(prefix + "[Enabled]." + key);
+ Painter<JComponent> painter =
+ paintFilter((Painter)UIManager.get(prefix + "[Enabled]." + key));
if (painter != null){
JComponent jc = (c instanceof JComponent) ? (JComponent)c : null;
Graphics2D gfx = (Graphics2D)g;
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -283,12 +283,12 @@
//list may contain only "standard" states (those defined by Synth),
//or it may contain custom states, or it may contain only "standard"
//states but list them in a non-standard order.
- List<State> states = new ArrayList<State>();
+ List<State<?>> states = new ArrayList<>();
//a map of state name to code
- Map<String,Integer> stateCodes = new HashMap<String,Integer>();
+ Map<String,Integer> stateCodes = new HashMap<>();
//This is a list of runtime "state" context objects. These contain
//the values associated with each state.
- List<RuntimeState> runtimeStates = new ArrayList<RuntimeState>();
+ List<RuntimeState> runtimeStates = new ArrayList<>();
//determine whether there are any custom states, or custom state
//order. If so, then read all those custom states and define the
@@ -304,7 +304,7 @@
//this is a non-standard state name, so look for the
//custom state associated with it
String stateName = prefix + "." + s[i];
- State customState = (State)defaults.get(stateName);
+ State<?> customState = (State)defaults.get(stateName);
if (customState != null) {
states.add(customState);
}
@@ -317,12 +317,12 @@
//to be non-null. Otherwise, leave it null (meaning, use the
//standard synth states).
if (states.size() > 0) {
- values.stateTypes = states.toArray(new State[states.size()]);
+ values.stateTypes = states.toArray(new State<?>[states.size()]);
}
//assign codes for each of the state types
int code = 1;
- for (State state : states) {
+ for (State<?> state : states) {
stateCodes.put(state.getName(), code);
code <<= 1;
}
@@ -463,12 +463,14 @@
values.states = runtimeStates.toArray(new RuntimeState[runtimeStates.size()]);
}
- private Painter getPainter(Map<String, Object> defaults, String key) {
+ private Painter<Object> getPainter(Map<String, Object> defaults, String key) {
Object p = defaults.get(key);
if (p instanceof UIDefaults.LazyValue) {
p = ((UIDefaults.LazyValue)p).createValue(UIManager.getDefaults());
}
- return (p instanceof Painter ? (Painter)p : null);
+ @SuppressWarnings("unchecked")
+ Painter<Object> tmp = (p instanceof Painter ? (Painter)p : null);
+ return tmp;
}
/**
@@ -689,6 +691,12 @@
return obj == NULL ? null : obj;
}
+ @SuppressWarnings("unchecked")
+ private static Painter<Object> paintFilter(@SuppressWarnings("rawtypes") Painter painter) {
+ return (Painter<Object>) painter;
+ }
+
+
/**
* Gets the appropriate background Painter, if there is one, for the state
* specified in the given SynthContext. This method does appropriate
@@ -698,14 +706,14 @@
* @return The background painter associated for the given state, or null if
* none could be found.
*/
- public Painter getBackgroundPainter(SynthContext ctx) {
+ public Painter<Object> getBackgroundPainter(SynthContext ctx) {
Values v = getValues(ctx);
int xstate = getExtendedState(ctx, v);
- Painter p = null;
+ Painter<Object> p = null;
// check the cache
tmpKey.init("backgroundPainter$$instance", xstate);
- p = (Painter)v.cache.get(tmpKey);
+ p = paintFilter((Painter)v.cache.get(tmpKey));
if (p != null) return p;
// not in cache, so lookup and store in cache
@@ -713,11 +721,11 @@
int[] lastIndex = new int[] {-1};
while ((s = getNextState(v.states, lastIndex, xstate)) != null) {
if (s.backgroundPainter != null) {
- p = s.backgroundPainter;
+ p = paintFilter(s.backgroundPainter);
break;
}
}
- if (p == null) p = (Painter)get(ctx, "backgroundPainter");
+ if (p == null) p = paintFilter((Painter)get(ctx, "backgroundPainter"));
if (p != null) {
v.cache.put(new CacheKey("backgroundPainter$$instance", xstate), p);
}
@@ -733,14 +741,14 @@
* @return The foreground painter associated for the given state, or null if
* none could be found.
*/
- public Painter getForegroundPainter(SynthContext ctx) {
+ public Painter<Object> getForegroundPainter(SynthContext ctx) {
Values v = getValues(ctx);
int xstate = getExtendedState(ctx, v);
- Painter p = null;
+ Painter<Object> p = null;
// check the cache
tmpKey.init("foregroundPainter$$instance", xstate);
- p = (Painter)v.cache.get(tmpKey);
+ p = paintFilter((Painter)v.cache.get(tmpKey));
if (p != null) return p;
// not in cache, so lookup and store in cache
@@ -748,11 +756,11 @@
int[] lastIndex = new int[] {-1};
while ((s = getNextState(v.states, lastIndex, xstate)) != null) {
if (s.foregroundPainter != null) {
- p = s.foregroundPainter;
+ p = paintFilter(s.foregroundPainter);
break;
}
}
- if (p == null) p = (Painter)get(ctx, "foregroundPainter");
+ if (p == null) p = paintFilter((Painter)get(ctx, "foregroundPainter"));
if (p != null) {
v.cache.put(new CacheKey("foregroundPainter$$instance", xstate), p);
}
@@ -768,14 +776,14 @@
* @return The border painter associated for the given state, or null if
* none could be found.
*/
- public Painter getBorderPainter(SynthContext ctx) {
+ public Painter<Object> getBorderPainter(SynthContext ctx) {
Values v = getValues(ctx);
int xstate = getExtendedState(ctx, v);
- Painter p = null;
+ Painter<Object> p = null;
// check the cache
tmpKey.init("borderPainter$$instance", xstate);
- p = (Painter)v.cache.get(tmpKey);
+ p = paintFilter((Painter)v.cache.get(tmpKey));
if (p != null) return p;
// not in cache, so lookup and store in cache
@@ -783,11 +791,11 @@
int[] lastIndex = new int[] {-1};
while ((s = getNextState(v.states, lastIndex, xstate)) != null) {
if (s.borderPainter != null) {
- p = s.borderPainter;
+ p = paintFilter(s.borderPainter);
break;
}
}
- if (p == null) p = (Painter)get(ctx, "borderPainter");
+ if (p == null) p = paintFilter((Painter)get(ctx, "borderPainter"));
if (p != null) {
v.cache.put(new CacheKey("borderPainter$$instance", xstate), p);
}
@@ -851,6 +859,7 @@
* @param v
* @return
*/
+ @SuppressWarnings({"unchecked", "rawtypes"})
private int getExtendedState(SynthContext ctx, Values v) {
JComponent c = ctx.getComponent();
int xstate = 0;
@@ -871,7 +880,7 @@
}
} else {
// custom states
- for (State s : v.stateTypes) {
+ for (State<?> s : v.stateTypes) {
if (contains(states, s.getName())) {
xstate |= mask;
}
@@ -1018,9 +1027,9 @@
*/
private final class RuntimeState implements Cloneable {
int state;
- Painter backgroundPainter;
- Painter foregroundPainter;
- Painter borderPainter;
+ Painter<Object> backgroundPainter;
+ Painter<Object> foregroundPainter;
+ Painter<Object> borderPainter;
String stateName;
UIDefaults defaults = new UIDefaults(10, .7f);
@@ -1055,7 +1064,7 @@
* The list of State types. A State represents a type of state, such
* as Enabled, Default, WindowFocused, etc. These can be custom states.
*/
- State[] stateTypes = null;
+ State<?>[] stateTypes = null;
/**
* The list of actual runtime state representations. These can represent things such
* as Enabled + Focused. Thus, they differ from States in that they contain
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/State.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/State.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -72,13 +72,13 @@
*/
public abstract class State<T extends JComponent>{
static final Map<String, StandardState> standardStates = new HashMap<String, StandardState>(7);
- static final State Enabled = new StandardState(SynthConstants.ENABLED);
- static final State MouseOver = new StandardState(SynthConstants.MOUSE_OVER);
- static final State Pressed = new StandardState(SynthConstants.PRESSED);
- static final State Disabled = new StandardState(SynthConstants.DISABLED);
- static final State Focused = new StandardState(SynthConstants.FOCUSED);
- static final State Selected = new StandardState(SynthConstants.SELECTED);
- static final State Default = new StandardState(SynthConstants.DEFAULT);
+ static final State<JComponent> Enabled = new StandardState(SynthConstants.ENABLED);
+ static final State<JComponent> MouseOver = new StandardState(SynthConstants.MOUSE_OVER);
+ static final State<JComponent> Pressed = new StandardState(SynthConstants.PRESSED);
+ static final State<JComponent> Disabled = new StandardState(SynthConstants.DISABLED);
+ static final State<JComponent> Focused = new StandardState(SynthConstants.FOCUSED);
+ static final State<JComponent> Selected = new StandardState(SynthConstants.SELECTED);
+ static final State<JComponent> Default = new StandardState(SynthConstants.DEFAULT);
private String name;
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/SynthPainterImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/SynthPainterImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -49,7 +49,7 @@
* position and size. Handles if g is a non 2D Graphics by painting via a
* BufferedImage.
*/
- private void paint(Painter p, SynthContext ctx, Graphics g, int x, int y,
+ private void paint(Painter<Object> p, SynthContext ctx, Graphics g, int x, int y,
int w, int h, AffineTransform transform) {
if (p != null) {
if (g instanceof Graphics2D){
@@ -96,7 +96,8 @@
Component c = ctx.getComponent();
Color bg = (c != null) ? c.getBackground() : null;
if (bg == null || bg.getAlpha() > 0){
- Painter backgroundPainter = style.getBackgroundPainter(ctx);
+
+ Painter<Object> backgroundPainter = style.getBackgroundPainter(ctx);
if (backgroundPainter != null) {
paint(backgroundPainter, ctx, g, x, y, w, h,transform);
}
@@ -105,7 +106,7 @@
private void paintForeground(SynthContext ctx, Graphics g, int x, int y,
int w, int h, AffineTransform transform) {
- Painter foregroundPainter = style.getForegroundPainter(ctx);
+ Painter<Object> foregroundPainter = style.getForegroundPainter(ctx);
if (foregroundPainter != null) {
paint(foregroundPainter, ctx, g, x, y, w, h,transform);
}
@@ -113,7 +114,7 @@
private void paintBorder(SynthContext ctx, Graphics g, int x, int y, int w,
int h, AffineTransform transform) {
- Painter borderPainter = style.getBorderPainter(ctx);
+ Painter<Object> borderPainter = style.getBorderPainter(ctx);
if (borderPainter != null) {
paint(borderPainter, ctx, g, x, y, w, h,transform);
}
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/TableScrollPaneCorner.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/TableScrollPaneCorner.java Fri Jul 25 09:44:53 2014 +0000
@@ -48,7 +48,8 @@
* Paint the component using the Nimbus Table Header Background Painter
*/
@Override protected void paintComponent(Graphics g) {
- Painter painter = (Painter) UIManager.get(
+ @SuppressWarnings("unchecked")
+ Painter<JComponent> painter = (Painter) UIManager.get(
"TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter");
if (painter != null){
if (g instanceof Graphics2D){
--- a/jdk/src/share/classes/javax/swing/plaf/synth/DefaultSynthStyleFactory.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/DefaultSynthStyleFactory.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -58,12 +58,12 @@
/**
* Used during lookup.
*/
- private BakedArrayList _tmpList;
+ private BakedArrayList<SynthStyle> _tmpList;
/**
* Maps from a List (BakedArrayList to be precise) to the merged style.
*/
- private Map<BakedArrayList, SynthStyle> _resolvedStyles;
+ private Map<BakedArrayList<SynthStyle>, SynthStyle> _resolvedStyles;
/**
* Used if there are no styles matching a widget.
@@ -72,9 +72,9 @@
DefaultSynthStyleFactory() {
- _tmpList = new BakedArrayList(5);
- _styles = new ArrayList<StyleAssociation>();
- _resolvedStyles = new HashMap<BakedArrayList, SynthStyle>();
+ _tmpList = new BakedArrayList<SynthStyle>(5);
+ _styles = new ArrayList<>();
+ _resolvedStyles = new HashMap<>();
}
public synchronized void addStyle(DefaultSynthStyle style,
@@ -100,7 +100,7 @@
* @param id ID of the Component
*/
public synchronized SynthStyle getStyle(JComponent c, Region id) {
- BakedArrayList matches = _tmpList;
+ BakedArrayList<SynthStyle> matches = _tmpList;
matches.clear();
getMatchingStyles(matches, c, id);
@@ -138,7 +138,7 @@
* Fetches any styles that match the passed into arguments into
* <code>matches</code>.
*/
- private void getMatchingStyles(List matches, JComponent c,
+ private void getMatchingStyles(List<SynthStyle> matches, JComponent c,
Region id) {
String idName = id.getLowerCaseName();
String cName = c.getName();
@@ -166,8 +166,8 @@
/**
* Caches the specified style.
*/
- private void cacheStyle(List styles, SynthStyle style) {
- BakedArrayList cachedStyles = new BakedArrayList(styles);
+ private void cacheStyle(List<SynthStyle> styles, SynthStyle style) {
+ BakedArrayList<SynthStyle> cachedStyles = new BakedArrayList<>(styles);
_resolvedStyles.put(cachedStyles, style);
}
@@ -175,7 +175,7 @@
/**
* Returns the cached style from the passed in arguments.
*/
- private SynthStyle getCachedStyle(List styles) {
+ private SynthStyle getCachedStyle(List<SynthStyle> styles) { // ??
if (styles.size() == 0) {
return null;
}
@@ -187,7 +187,7 @@
* is reverse sorted, that is the most recently added style found to
* match will be first.
*/
- private SynthStyle mergeStyles(List styles) {
+ private SynthStyle mergeStyles(List<SynthStyle> styles) {
int size = styles.size();
if (size == 0) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/ImagePainter.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/ImagePainter.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -60,6 +60,7 @@
// we use a AppContext specific Paint9Painter. It's backed via
// a WeakRef so that it can go away if the look and feel changes.
synchronized(CACHE_KEY) {
+ @SuppressWarnings("unchecked")
WeakReference<Paint9Painter> cacheRef =
(WeakReference<Paint9Painter>)AppContext.getAppContext().
get(CACHE_KEY);
--- a/jdk/src/share/classes/javax/swing/plaf/synth/Region.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/Region.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -427,6 +427,7 @@
private static Map<String, Region> getUItoRegionMap() {
AppContext context = AppContext.getAppContext();
+ @SuppressWarnings("unchecked")
Map<String, Region> map = (Map<String, Region>) context.get(UI_TO_REGION_MAP_KEY);
if (map == null) {
map = new HashMap<String, Region>();
@@ -482,6 +483,7 @@
private static Map<Region, String> getLowerCaseNameMap() {
AppContext context = AppContext.getAppContext();
+ @SuppressWarnings("unchecked")
Map<Region, String> map = (Map<Region, String>) context.get(LOWER_CASE_NAME_MAP_KEY);
if (map == null) {
map = new HashMap<Region, String>();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -120,7 +120,7 @@
updateStyle(comboBox);
}
- private void updateStyle(JComboBox comboBox) {
+ private void updateStyle(JComboBox<?> comboBox) {
SynthStyle oldStyle = style;
SynthContext context = getContext(comboBox, ENABLED);
@@ -220,7 +220,7 @@
// instead of doing anything special
if (!(c instanceof JComboBox)) return SynthLookAndFeel.getComponentState(c);
- JComboBox box = (JComboBox)c;
+ JComboBox<?> box = (JComboBox)c;
if (shouldActLikeButton()) {
int state = ENABLED;
if ((!c.isEnabled())) {
@@ -263,7 +263,7 @@
* {@inheritDoc}
*/
@Override
- protected ListCellRenderer createRenderer() {
+ protected ListCellRenderer<Object> createRenderer() {
return new SynthComboBoxRenderer();
}
@@ -372,7 +372,7 @@
*/
@Override
public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) {
- ListCellRenderer renderer = comboBox.getRenderer();
+ ListCellRenderer<Object> renderer = comboBox.getRenderer();
Component c;
c = renderer.getListCellRendererComponent(
@@ -710,11 +710,11 @@
*/
private static class EditorFocusHandler implements FocusListener,
PropertyChangeListener {
- private JComboBox comboBox;
+ private JComboBox<?> comboBox;
private ComboBoxEditor editor = null;
private Component editorComponent = null;
- private EditorFocusHandler(JComboBox comboBox) {
+ private EditorFocusHandler(JComboBox<?> comboBox) {
this.comboBox = comboBox;
editor = comboBox.getEditor();
if (editor != null){
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboPopup.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboPopup.java Fri Jul 25 09:44:53 2014 +0000
@@ -38,7 +38,7 @@
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
class SynthComboPopup extends BasicComboPopup {
- public SynthComboPopup( JComboBox combo ) {
+ public SynthComboPopup( JComboBox<Object> combo ) {
super(combo);
}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -207,7 +207,7 @@
}
}
- @Override public Component getListCellRendererComponent(JList list, Object value,
+ @Override public Component getListCellRendererComponent(JList<?> list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
if (!useListColors && (isSelected || cellHasFocus)) {
SynthLookAndFeel.setSelectedUI((SynthLabelUI)SynthLookAndFeel.
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java Fri Jul 25 09:44:53 2014 +0000
@@ -382,7 +382,7 @@
* Returns the ui that is of type <code>klass</code>, or null if
* one can not be found.
*/
- static Object getUIOfType(ComponentUI ui, Class klass) {
+ static Object getUIOfType(ComponentUI ui, Class<?> klass) {
if (klass.isInstance(ui)) {
return ui;
}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java Fri Jul 25 09:44:53 2014 +0000
@@ -322,7 +322,7 @@
* If <code>value</code> is an instance of <code>type</code> it is
* returned, otherwise a SAXException is thrown.
*/
- private Object checkCast(Object value, Class type) throws SAXException {
+ private Object checkCast(Object value, Class<?> type) throws SAXException {
if (!type.isInstance(value)) {
throw new SAXException("Expected type " + type + " got " +
value.getClass());
@@ -334,7 +334,7 @@
* Returns an object created with id=key. If the object is not of
* type type, this will throw an exception.
*/
- private Object lookup(String key, Class type) throws SAXException {
+ private Object lookup(String key, Class<?> type) throws SAXException {
Object value;
if (_handler != null) {
if (_handler.hasVariable(key)) {
@@ -641,7 +641,7 @@
while (tokenizer.hasMoreTokens()) {
String typeName = tokenizer.nextToken();
int classIndex = typeName.lastIndexOf('.');
- Class typeClass;
+ Class<?> typeClass;
if (classIndex == -1) {
typeClass = ColorType.class;
@@ -783,13 +783,13 @@
}
else if (_stateInfo != null) {
if (_stateInfo.getData() == null) {
- _stateInfo.setData(new HashMap());
+ _stateInfo.setData(new HashMap<>());
}
_stateInfo.getData().put(key, value);
}
else if (_style != null) {
if (_style.getData() == null) {
- _style.setData(new HashMap());
+ _style.setData(new HashMap<>());
}
_style.getData().put(key, value);
}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -269,7 +269,7 @@
centerY += valueHeight + 2;
centerY += trackHeight + trackInsets.top + trackInsets.bottom;
centerY += tickHeight + 2;
- JComponent label = (JComponent) slider.getLabelTable().elements().nextElement();
+ JComponent label = slider.getLabelTable().elements().nextElement();
Dimension pref = label.getPreferredSize();
return centerY + label.getBaseline(pref.width, pref.height);
}
@@ -291,7 +291,7 @@
int trackHeight = contentHeight - valueHeight;
int yPosition = yPositionForValue(value.intValue(), trackY,
trackHeight);
- JComponent label = (JComponent) slider.getLabelTable().get(value);
+ JComponent label = slider.getLabelTable().get(value);
Dimension pref = label.getPreferredSize();
return yPosition - pref.height / 2 +
label.getBaseline(pref.width, pref.height);
@@ -392,7 +392,7 @@
trackRect.x = insetCache.left;
trackRect.width = contentRect.width;
- Dictionary dictionary = slider.getLabelTable();
+ Dictionary<Integer, JComponent> dictionary = slider.getLabelTable();
if (dictionary != null) {
int minValue = slider.getMinimum();
int maxValue = slider.getMaximum();
@@ -402,9 +402,9 @@
// slider range.
int firstLblIdx = Integer.MAX_VALUE;
int lastLblIdx = Integer.MIN_VALUE;
- for (Enumeration keys = dictionary.keys();
+ for (Enumeration<Integer> keys = dictionary.keys();
keys.hasMoreElements(); ) {
- int keyInt = ((Integer)keys.nextElement()).intValue();
+ int keyInt = keys.nextElement().intValue();
if (keyInt >= minValue && keyInt < firstLblIdx) {
firstLblIdx = keyInt;
}
@@ -517,7 +517,7 @@
private int getPadForLabel(int i) {
int pad = 0;
- JComponent c = (JComponent) slider.getLabelTable().get(i);
+ JComponent c = slider.getLabelTable().get(i);
if (c != null) {
int centerX = xPositionForValue(i);
int cHalfWidth = c.getPreferredSize().width / 2;
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -240,7 +240,7 @@
//stuff a variable into the client property of this renderer indicating the sort order,
//so that different rendering can be done for the header based on sorted state.
- RowSorter rs = table == null ? null : table.getRowSorter();
+ RowSorter<?> rs = table == null ? null : table.getRowSorter();
java.util.List<? extends RowSorter.SortKey> sortKeys = rs == null ? null : rs.getSortKeys();
if (sortKeys != null && sortKeys.size() > 0 && sortKeys.get(0).getColumn() ==
table.convertColumnIndexToModel(column)) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -120,7 +120,7 @@
updateStyle(table);
}
- private TableCellRenderer installRendererIfPossible(Class objectClass,
+ private TableCellRenderer installRendererIfPossible(Class<?> objectClass,
TableCellRenderer renderer) {
TableCellRenderer currentRenderer = table.getDefaultRenderer(
objectClass);
@@ -792,7 +792,7 @@
return this;
}
- private void configureValue(Object value, Class columnClass) {
+ private void configureValue(Object value, Class<?> columnClass) {
if (columnClass == Object.class || columnClass == null) {
setHorizontalAlignment(JLabel.LEADING);
} else if (columnClass == Float.class || columnClass == Double.class) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java Fri Jul 25 09:44:53 2014 +0000
@@ -312,7 +312,7 @@
Insets insets = tree.getInsets();
TreePath initialPath = getClosestPathForLocation(tree, 0,
paintBounds.y);
- Enumeration paintingEnumerator = treeState.getVisiblePathsFrom
+ Enumeration<?> paintingEnumerator = treeState.getVisiblePathsFrom
(initialPath);
int row = treeState.getRowForPath(initialPath);
int endY = paintBounds.y + paintBounds.height;
--- a/jdk/src/share/classes/javax/swing/table/DefaultTableColumnModel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/table/DefaultTableColumnModel.java Fri Jul 25 09:44:53 2014 +0000
@@ -269,12 +269,12 @@
throw new IllegalArgumentException("Identifier is null");
}
- Enumeration enumeration = getColumns();
+ Enumeration<TableColumn> enumeration = getColumns();
TableColumn aColumn;
int index = 0;
while (enumeration.hasMoreElements()) {
- aColumn = (TableColumn)enumeration.nextElement();
+ aColumn = enumeration.nextElement();
// Compare them this way in case the column's identifier is null.
if (identifier.equals(aColumn.getIdentifier()))
return index;
@@ -728,10 +728,10 @@
* <code>totalColumnWidth</code> property.
*/
protected void recalcWidthCache() {
- Enumeration enumeration = getColumns();
+ Enumeration<TableColumn> enumeration = getColumns();
totalColumnWidth = 0;
while (enumeration.hasMoreElements()) {
- totalColumnWidth += ((TableColumn)enumeration.nextElement()).getWidth();
+ totalColumnWidth += enumeration.nextElement().getWidth();
}
}
--- a/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/table/DefaultTableModel.java Fri Jul 25 09:44:53 2014 +0000
@@ -70,10 +70,10 @@
* The <code>Vector</code> of <code>Vectors</code> of
* <code>Object</code> values.
*/
- protected Vector dataVector;
+ protected Vector<Vector<Object>> dataVector;
/** The <code>Vector</code> of column identifiers. */
- protected Vector columnIdentifiers;
+ protected Vector<Object> columnIdentifiers;
//
// Constructors
@@ -87,8 +87,8 @@
this(0, 0);
}
- private static Vector newVector(int size) {
- Vector v = new Vector(size);
+ private static <E> Vector<E> newVector(int size) {
+ Vector<E> v = new Vector<>(size);
v.setSize(size);
return v;
}
@@ -121,7 +121,7 @@
* @see #setDataVector
* @see #setValueAt
*/
- public DefaultTableModel(Vector columnNames, int rowCount) {
+ public DefaultTableModel(Vector<Object> columnNames, int rowCount) {
setDataVector(newVector(rowCount), columnNames);
}
@@ -156,7 +156,7 @@
* @see #getDataVector
* @see #setDataVector
*/
- public DefaultTableModel(Vector data, Vector columnNames) {
+ public DefaultTableModel(Vector<Vector<Object>> data, Vector<Object> columnNames) {
setDataVector(data, columnNames);
}
@@ -191,12 +191,12 @@
* @see #newRowsAdded
* @see #setDataVector
*/
- public Vector getDataVector() {
+ public Vector<Vector<Object>> getDataVector() {
return dataVector;
}
- private static Vector nonNullVector(Vector v) {
- return (v != null) ? v : new Vector();
+ private static <E> Vector<E> nonNullVector(Vector<E> v) {
+ return (v != null) ? v : new Vector<>();
}
/**
@@ -219,7 +219,8 @@
* @param columnIdentifiers the names of the columns
* @see #getDataVector
*/
- public void setDataVector(Vector dataVector, Vector columnIdentifiers) {
+ public void setDataVector(Vector<Vector<Object>> dataVector,
+ Vector<Object> columnIdentifiers) {
this.dataVector = nonNullVector(dataVector);
this.columnIdentifiers = nonNullVector(columnIdentifiers);
justifyRows(0, getRowCount());
@@ -264,7 +265,7 @@
for (int i = from; i < to; i++) {
if (dataVector.elementAt(i) == null) {
- dataVector.setElementAt(new Vector(), i);
+ dataVector.setElementAt(new Vector<>(), i);
}
((Vector)dataVector.elementAt(i)).setSize(getColumnCount());
}
@@ -349,7 +350,7 @@
*
* @param rowData optional data of the row being added
*/
- public void addRow(Vector rowData) {
+ public void addRow(Vector<Object> rowData) {
insertRow(getRowCount(), rowData);
}
@@ -373,7 +374,7 @@
* @param rowData optional data of the row being added
* @exception ArrayIndexOutOfBoundsException if the row was invalid
*/
- public void insertRow(int row, Vector rowData) {
+ public void insertRow(int row, Vector<Object> rowData) {
dataVector.insertElementAt(rowData, row);
justifyRows(row, row+1);
fireTableRowsInserted(row, row);
@@ -396,13 +397,13 @@
return (j == 0) ? i : gcd(j, i%j);
}
- private static void rotate(Vector v, int a, int b, int shift) {
+ private static <E> void rotate(Vector<E> v, int a, int b, int shift) {
int size = b - a;
int r = size - shift;
int g = gcd(size, r);
for(int i = 0; i < g; i++) {
int to = i;
- Object tmp = v.elementAt(a + to);
+ E tmp = v.elementAt(a + to);
for(int from = (to + r) % size; from != i; from = (to + r) % size) {
v.setElementAt(v.elementAt(a + from), a + to);
to = from;
@@ -483,7 +484,7 @@
* to zero columns
* @see #setNumRows
*/
- public void setColumnIdentifiers(Vector columnIdentifiers) {
+ public void setColumnIdentifiers(Vector<Object> columnIdentifiers) {
setDataVector(dataVector, columnIdentifiers);
}
@@ -533,7 +534,7 @@
* @param columnName the identifier of the column being added
*/
public void addColumn(Object columnName) {
- addColumn(columnName, (Vector)null);
+ addColumn(columnName, (Vector<Object>)null);
}
/**
@@ -549,7 +550,7 @@
* @param columnName the identifier of the column being added
* @param columnData optional data of the column being added
*/
- public void addColumn(Object columnName, Vector columnData) {
+ public void addColumn(Object columnName, Vector<Object> columnData) {
columnIdentifiers.addElement(columnName);
if (columnData != null) {
int columnSize = columnData.size();
@@ -559,7 +560,7 @@
justifyRows(0, getRowCount());
int newColumn = getColumnCount() - 1;
for(int i = 0; i < columnSize; i++) {
- Vector row = (Vector)dataVector.elementAt(i);
+ Vector<Object> row = dataVector.elementAt(i);
row.setElementAt(columnData.elementAt(i), newColumn);
}
}
@@ -651,7 +652,7 @@
* column was given
*/
public Object getValueAt(int row, int column) {
- Vector rowVector = (Vector)dataVector.elementAt(row);
+ Vector<Object> rowVector = dataVector.elementAt(row);
return rowVector.elementAt(column);
}
@@ -667,7 +668,7 @@
* column was given
*/
public void setValueAt(Object aValue, int row, int column) {
- Vector rowVector = (Vector)dataVector.elementAt(row);
+ Vector<Object> rowVector = dataVector.elementAt(row);
rowVector.setElementAt(aValue, column);
fireTableCellUpdated(row, column);
}
@@ -682,11 +683,11 @@
* @return the new vector; if <code>anArray</code> is <code>null</code>,
* returns <code>null</code>
*/
- protected static Vector convertToVector(Object[] anArray) {
+ protected static Vector<Object> convertToVector(Object[] anArray) {
if (anArray == null) {
return null;
}
- Vector<Object> v = new Vector<Object>(anArray.length);
+ Vector<Object> v = new Vector<>(anArray.length);
for (Object o : anArray) {
v.addElement(o);
}
@@ -699,11 +700,11 @@
* @return the new vector of vectors; if <code>anArray</code> is
* <code>null</code>, returns <code>null</code>
*/
- protected static Vector convertToVector(Object[][] anArray) {
+ protected static Vector<Vector<Object>> convertToVector(Object[][] anArray) {
if (anArray == null) {
return null;
}
- Vector<Vector> v = new Vector<Vector>(anArray.length);
+ Vector<Vector<Object>> v = new Vector<>(anArray.length);
for (Object[] o : anArray) {
v.addElement(convertToVector(o));
}
--- a/jdk/src/share/classes/javax/swing/table/TableRowSorter.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/table/TableRowSorter.java Fri Jul 25 09:44:53 2014 +0000
@@ -131,7 +131,7 @@
/**
* Comparator that uses compareTo on the contents.
*/
- private static final Comparator COMPARABLE_COMPARATOR =
+ private static final Comparator<?> COMPARABLE_COMPARATOR =
new ComparableComparator();
/**
@@ -214,11 +214,11 @@
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
public Comparator<?> getComparator(int column) {
- Comparator comparator = super.getComparator(column);
+ Comparator<?> comparator = super.getComparator(column);
if (comparator != null) {
return comparator;
}
- Class columnClass = getModel().getColumnClass(column);
+ Class<?> columnClass = getModel().getColumnClass(column);
if (columnClass == String.class) {
return Collator.getInstance();
}
@@ -234,11 +234,11 @@
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
protected boolean useToString(int column) {
- Comparator comparator = super.getComparator(column);
+ Comparator<?> comparator = super.getComparator(column);
if (comparator != null) {
return false;
}
- Class columnClass = getModel().getColumnClass(column);
+ Class<?> columnClass = getModel().getColumnClass(column);
if (columnClass == String.class) {
return false;
}
@@ -299,7 +299,7 @@
}
- private static class ComparableComparator implements Comparator {
+ private static class ComparableComparator implements Comparator<Object> {
@SuppressWarnings("unchecked")
public int compare(Object o1, Object o2) {
return ((Comparable)o1).compareTo(o2);
--- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java Fri Jul 25 09:44:53 2014 +0000
@@ -2193,7 +2193,7 @@
* <code>Enumeration</code>.
* @return the children of the receiver as an <code>Enumeration</code>
*/
- public abstract Enumeration<?> children();
+ public abstract Enumeration<TreeNode> children();
// --- serialization ---------------------------------------------
@@ -2456,11 +2456,11 @@
* <code>Enumeration</code>.
* @return the children of the receiver
*/
- public Enumeration<AbstractElement> children() {
+ public Enumeration<TreeNode> children() {
if(nchildren == 0)
return null;
- Vector<AbstractElement> tempVector = new Vector<AbstractElement>(nchildren);
+ Vector<TreeNode> tempVector = new Vector<>(nchildren);
for(int counter = 0; counter < nchildren; counter++)
tempVector.addElement(children[counter]);
@@ -2610,7 +2610,8 @@
* <code>Enumeration</code>.
* @return the children of the receiver
*/
- public Enumeration<?> children() {
+ @Override
+ public Enumeration<TreeNode> children() {
return null;
}
--- a/jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java Fri Jul 25 09:44:53 2014 +0000
@@ -228,10 +228,10 @@
endY = bounds.height + bounds.y;
}
- Enumeration paths = getVisiblePathsFrom(firstPath);
+ Enumeration<TreePath> paths = getVisiblePathsFrom(firstPath);
if(paths != null && paths.hasMoreElements()) {
- Rectangle pBounds = getBounds((TreePath)paths.nextElement(),
+ Rectangle pBounds = getBounds(paths.nextElement(),
null);
int width;
@@ -244,7 +244,7 @@
else
width = 0;
while (pBounds != null && paths.hasMoreElements()) {
- pBounds = getBounds((TreePath)paths.nextElement(),
+ pBounds = getBounds(paths.nextElement(),
pBounds);
if (pBounds != null && pBounds.y < endY) {
width = Math.max(width, pBounds.x + pBounds.width);
--- a/jdk/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java Fri Jul 25 09:44:53 2014 +0000
@@ -102,7 +102,7 @@
protected MutableTreeNode parent;
/** array of children, may be null if this node has no children */
- protected Vector children;
+ protected Vector<TreeNode> children;
/** optional user object */
transient protected Object userObject;
@@ -187,7 +187,7 @@
}
newChild.setParent(this);
if (children == null) {
- children = new Vector();
+ children = new Vector<>();
}
children.insertElementAt(newChild, childIndex);
}
@@ -243,7 +243,7 @@
if (children == null) {
throw new ArrayIndexOutOfBoundsException("node has no children");
}
- return (TreeNode)children.elementAt(index);
+ return children.elementAt(index);
}
/**
@@ -290,7 +290,7 @@
*
* @return an Enumeration of this node's children
*/
- public Enumeration children() {
+ public Enumeration<TreeNode> children() {
if (children == null) {
return EMPTY_ENUMERATION;
} else {
@@ -557,7 +557,7 @@
*/
public int getDepth() {
Object last = null;
- Enumeration enum_ = breadthFirstEnumeration();
+ Enumeration<TreeNode> enum_ = breadthFirstEnumeration();
while (enum_.hasMoreElements()) {
last = enum_.nextElement();
@@ -765,7 +765,7 @@
* @see #postorderEnumeration
* @return an enumeration for traversing the tree in preorder
*/
- public Enumeration preorderEnumeration() {
+ public Enumeration<TreeNode> preorderEnumeration() {
return new PreorderEnumeration(this);
}
@@ -782,7 +782,7 @@
* @see #preorderEnumeration
* @return an enumeration for traversing the tree in postorder
*/
- public Enumeration postorderEnumeration() {
+ public Enumeration<TreeNode> postorderEnumeration() {
return new PostorderEnumeration(this);
}
@@ -797,7 +797,7 @@
* @see #depthFirstEnumeration
* @return an enumeration for traversing the tree in breadth-first order
*/
- public Enumeration breadthFirstEnumeration() {
+ public Enumeration<TreeNode> breadthFirstEnumeration() {
return new BreadthFirstEnumeration(this);
}
@@ -814,7 +814,7 @@
* @see #postorderEnumeration
* @return an enumeration for traversing the tree in depth-first order
*/
- public Enumeration depthFirstEnumeration() {
+ public Enumeration<TreeNode> depthFirstEnumeration() {
return postorderEnumeration();
}
@@ -839,7 +839,7 @@
* @return an enumeration for following the path from an ancestor of
* this node to this one
*/
- public Enumeration pathFromAncestorEnumeration(TreeNode ancestor) {
+ public Enumeration<TreeNode> pathFromAncestorEnumeration(TreeNode ancestor) {
return new PathBetweenNodesEnumeration(ancestor, this);
}
@@ -1218,10 +1218,10 @@
int count = 0;
TreeNode node;
- Enumeration enum_ = breadthFirstEnumeration(); // order matters not
+ Enumeration<TreeNode> enum_ = breadthFirstEnumeration(); // order matters not
while (enum_.hasMoreElements()) {
- node = (TreeNode)enum_.nextElement();
+ node = enum_.nextElement();
if (node.isLeaf()) {
count++;
}
@@ -1308,7 +1308,7 @@
}
private final class PreorderEnumeration implements Enumeration<TreeNode> {
- private final Stack<Enumeration> stack = new Stack<Enumeration>();
+ private final Stack<Enumeration<TreeNode>> stack = new Stack<>();
public PreorderEnumeration(TreeNode rootNode) {
super();
@@ -1322,9 +1322,10 @@
}
public TreeNode nextElement() {
- Enumeration enumer = stack.peek();
- TreeNode node = (TreeNode)enumer.nextElement();
- Enumeration children = node.children();
+ Enumeration<TreeNode> enumer = stack.peek();
+ TreeNode node = enumer.nextElement();
+ @SuppressWarnings("unchecked")
+ Enumeration<TreeNode> children = node.children();
if (!enumer.hasMoreElements()) {
stack.pop();
@@ -1392,9 +1393,9 @@
}
public TreeNode nextElement() {
- Enumeration enumer = (Enumeration)queue.firstObject();
+ Enumeration<?> enumer = (Enumeration)queue.firstObject();
TreeNode node = (TreeNode)enumer.nextElement();
- Enumeration children = node.children();
+ Enumeration<?> children = node.children();
if (!enumer.hasMoreElements()) {
queue.dequeue();
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellEditor.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellEditor.java Fri Jul 25 09:44:53 2014 +0000
@@ -573,7 +573,7 @@
throws IOException, ClassNotFoundException {
s.defaultReadObject();
- Vector values = (Vector)s.readObject();
+ Vector<?> values = (Vector)s.readObject();
int indexCounter = 0;
int maxCounter = values.size();
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java Fri Jul 25 09:44:53 2014 +0000
@@ -693,7 +693,7 @@
throws IOException, ClassNotFoundException {
s.defaultReadObject();
- Vector values = (Vector)s.readObject();
+ Vector<?> values = (Vector)s.readObject();
int indexCounter = 0;
int maxCounter = values.size();
--- a/jdk/src/share/classes/javax/swing/tree/TreeNode.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/tree/TreeNode.java Fri Jul 25 09:44:53 2014 +0000
@@ -99,5 +99,5 @@
*
* @return the children of the receiver as an {@code Enumeration}
*/
- Enumeration children();
+ Enumeration<TreeNode> children();
}
--- a/jdk/src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java Fri Jul 25 09:44:53 2014 +0000
@@ -742,7 +742,7 @@
if(!root.isExpanded())
root.expand();
else {
- Enumeration cursor = root.children();
+ Enumeration<?> cursor = root.children();
while(cursor.hasMoreElements()) {
visibleNodes.addElement(cursor.nextElement());
}
@@ -1099,7 +1099,8 @@
* If the receiver is not currently expanded, this will return an
* empty enumeration.
*/
- public Enumeration children() {
+ @Override
+ public Enumeration<TreeNode> children() {
if (!this.isExpanded()) {
return DefaultMutableTreeNode.EMPTY_ENUMERATION;
} else {
@@ -1405,7 +1406,7 @@
* <code>createIfNeeded</code> is true, the children are first
* loaded.
*/
- protected Enumeration getLoadedChildren(boolean createIfNeeded) {
+ protected Enumeration<TreeNode> getLoadedChildren(boolean createIfNeeded) {
if(!createIfNeeded || hasBeenExpanded)
return super.children();
@@ -1499,7 +1500,7 @@
}
int i = originalRow;
- Enumeration cursor = preorderEnumeration();
+ Enumeration<TreeNode> cursor = preorderEnumeration();
cursor.nextElement(); // don't add me, I'm already in
int newYOrigin;
@@ -1513,7 +1514,7 @@
TreeStateNode aNode;
if(!isFixed) {
while (cursor.hasMoreElements()) {
- aNode = (TreeStateNode)cursor.nextElement();
+ aNode = (TreeStateNode) cursor.nextElement();
if(!updateNodeSizes && !aNode.hasValidSize())
aNode.updatePreferredSize(i + 1);
aNode.setYOrigin(newYOrigin);
@@ -1523,7 +1524,7 @@
}
else {
while (cursor.hasMoreElements()) {
- aNode = (TreeStateNode)cursor.nextElement();
+ aNode = (TreeStateNode) cursor.nextElement();
visibleNodes.insertElementAt(aNode, ++i);
}
}
@@ -1559,7 +1560,7 @@
*/
protected void collapse(boolean adjustTree) {
if (isExpanded()) {
- Enumeration cursor = preorderEnumeration();
+ Enumeration<TreeNode> cursor = preorderEnumeration();
cursor.nextElement(); // don't remove me, I'm still visible
int rowsDeleted = 0;
boolean isFixed = isFixedRowHeight();
--- a/jdk/src/share/classes/javax/swing/undo/CompoundEdit.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/undo/CompoundEdit.java Fri Jul 25 09:44:53 2014 +0000
@@ -72,9 +72,9 @@
*/
public void redo() throws CannotRedoException {
super.redo();
- Enumeration cursor = edits.elements();
+ Enumeration<UndoableEdit> cursor = edits.elements();
while (cursor.hasMoreElements()) {
- ((UndoableEdit)cursor.nextElement()).redo();
+ cursor.nextElement().redo();
}
}
@@ -198,9 +198,9 @@
* Returns false if they all return false.
*/
public boolean isSignificant() {
- Enumeration cursor = edits.elements();
+ Enumeration<UndoableEdit> cursor = edits.elements();
while (cursor.hasMoreElements()) {
- if (((UndoableEdit)cursor.nextElement()).isSignificant()) {
+ if (cursor.nextElement().isSignificant()) {
return true;
}
}
--- a/jdk/src/share/classes/javax/swing/undo/StateEdit.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/undo/StateEdit.java Fri Jul 25 09:44:53 2014 +0000
@@ -170,8 +170,8 @@
* Remove redundant key/values in state hashtables.
*/
protected void removeRedundantState() {
- Vector<Object> uselessKeys = new Vector<Object>();
- Enumeration myKeys = preState.keys();
+ Vector<Object> uselessKeys = new Vector<>();
+ Enumeration<Object> myKeys = preState.keys();
// Locate redundant state
while (myKeys.hasMoreElements()) {
--- a/jdk/src/share/classes/javax/swing/undo/UndoableEditSupport.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/undo/UndoableEditSupport.java Fri Jul 25 09:44:53 2014 +0000
@@ -101,10 +101,11 @@
*/
protected void _postEdit(UndoableEdit e) {
UndoableEditEvent ev = new UndoableEditEvent(realSource, e);
- Enumeration cursor = ((Vector)listeners.clone()).elements();
+ @SuppressWarnings("unchecked")
+ Enumeration<UndoableEditListener> cursor =
+ ((Vector<UndoableEditListener>)listeners.clone()).elements();
while (cursor.hasMoreElements()) {
- ((UndoableEditListener)cursor.nextElement()).
- undoableEditHappened(ev);
+ cursor.nextElement().undoableEditHappened(ev);
}
}
--- a/jdk/src/share/classes/sun/awt/AppContext.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/AppContext.java Fri Jul 25 09:44:53 2014 +0000
@@ -331,6 +331,20 @@
while (context == null) {
threadGroup = threadGroup.getParent();
if (threadGroup == null) {
+ // We've got up to the root thread group and did not find an AppContext
+ // Try to get it from the security manager
+ SecurityManager securityManager = System.getSecurityManager();
+ if (securityManager != null) {
+ ThreadGroup smThreadGroup = securityManager.getThreadGroup();
+ if (smThreadGroup != null) {
+ /*
+ * If we get this far then it's likely that
+ * the ThreadGroup does not actually belong
+ * to the applet, so do not cache it.
+ */
+ return threadGroup2appContext.get(smThreadGroup);
+ }
+ }
return null;
}
context = threadGroup2appContext.get(threadGroup);
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java Fri Jul 25 09:44:53 2014 +0000
@@ -59,8 +59,7 @@
import java.security.AccessController;
public abstract class SunToolkit extends Toolkit
- implements WindowClosingSupport, WindowClosingListener,
- ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider {
+ implements ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider {
// 8014718: logging has been removed from SunToolkit
@@ -1201,42 +1200,6 @@
return getStartupLocale();
}
- // Support for window closing event notifications
- private transient WindowClosingListener windowClosingListener = null;
- /**
- * @see sun.awt.WindowClosingSupport#getWindowClosingListener
- */
- public WindowClosingListener getWindowClosingListener() {
- return windowClosingListener;
- }
- /**
- * @see sun.awt.WindowClosingSupport#setWindowClosingListener
- */
- public void setWindowClosingListener(WindowClosingListener wcl) {
- windowClosingListener = wcl;
- }
-
- /**
- * @see sun.awt.WindowClosingListener#windowClosingNotify
- */
- public RuntimeException windowClosingNotify(WindowEvent event) {
- if (windowClosingListener != null) {
- return windowClosingListener.windowClosingNotify(event);
- } else {
- return null;
- }
- }
- /**
- * @see sun.awt.WindowClosingListener#windowClosingDelivered
- */
- public RuntimeException windowClosingDelivered(WindowEvent event) {
- if (windowClosingListener != null) {
- return windowClosingListener.windowClosingDelivered(event);
- } else {
- return null;
- }
- }
-
private static DefaultMouseInfoPeer mPeer = null;
protected synchronized MouseInfoPeer getMouseInfoPeer() {
--- a/jdk/src/share/classes/sun/awt/WindowClosingListener.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1999, 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.awt;
-
-import java.awt.event.WindowEvent;
-
-/**
- * Interface for listening to WINDOW_CLOSING events before and
- * after they are posted to the queue.
- */
-public interface WindowClosingListener {
- /**
- * Called before a WINDOW_CLOSING event gets posted to the queue.
- * @param event The WINDOW_CLOSING event that will be posted.
- * @return A RuntimeException if the result of this function
- * call needs to interrupt a blocking thread. The exception
- * returned will be thrown from that thread. This function
- * should return null otherwise.
- */
- RuntimeException windowClosingNotify(WindowEvent event);
- /**
- * Called after a WINDOW_CLOSING event gets posted to the queue.
- * @param event The WINDOW_CLOSING event that has been posted.
- * @return A RuntimeException if the result of this function
- * call needs to interrupt a blocking thread. The exception
- * returned will be thrown from that thread. This function
- * should return null otherwise.
- */
- RuntimeException windowClosingDelivered(WindowEvent event);
-}
--- a/jdk/src/share/classes/sun/awt/WindowClosingSupport.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 1999, 2007, 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.awt;
-
-/**
- * Interface for identifying and casting toolkits that support
- * WindowClosingListeners.
- */
-public interface WindowClosingSupport {
- WindowClosingListener getWindowClosingListener();
- void setWindowClosingListener(WindowClosingListener wcl);
-}
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java Fri Jul 25 09:44:53 2014 +0000
@@ -175,7 +175,7 @@
});
impl = (PerfDataBufferImpl)cons.newInstance(new Object[] {
- bb, new Integer(lvmid)
+ bb, lvmid
});
} catch (ClassNotFoundException e) {
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/PerfIntegerMonitor.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/PerfIntegerMonitor.java Fri Jul 25 09:44:53 2014 +0000
@@ -67,7 +67,7 @@
* return type is guaranteed to be of type Integer.
*/
public Object getValue() {
- return new Integer(ib.get(0));
+ return ib.get(0);
}
/**
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalVmManager.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalVmManager.java Fri Jul 25 09:44:53 2014 +0000
@@ -156,8 +156,8 @@
if (files != null) {
for (int j = 0; j < files.length; j++) {
if (files[j].isFile() && files[j].canRead()) {
- jvmSet.add(new Integer(
- PerfDataFile.getLocalVmId(files[j])));
+ jvmSet.add(
+ PerfDataFile.getLocalVmId(files[j]));
}
}
}
@@ -175,8 +175,8 @@
if (files != null) {
for (int j = 0; j < files.length; j++) {
if (files[j].isFile() && files[j].canRead()) {
- jvmSet.add(new Integer(
- PerfDataFile.getLocalVmId(files[j])));
+ jvmSet.add(
+ PerfDataFile.getLocalVmId(files[j]));
}
}
}
@@ -187,8 +187,8 @@
if (files != null) {
for (int j = 0; j < files.length; j++) {
if (files[j].isFile() && files[j].canRead()) {
- jvmSet.add(new Integer(
- PerfDataFile.getLocalVmId(files[j])));
+ jvmSet.add(
+ PerfDataFile.getLocalVmId(files[j]));
}
}
}
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteVmManager.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteVmManager.java Fri Jul 25 09:44:53 2014 +0000
@@ -106,7 +106,7 @@
Set<Integer> activeSet = new HashSet<Integer>(active.length);
for (int i = 0; i < active.length; i++) {
- activeSet.add(new Integer(active[i]));
+ activeSet.add(active[i]);
}
return activeSet;
--- a/jdk/src/share/classes/sun/management/LockInfoCompositeData.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/LockInfoCompositeData.java Fri Jul 25 09:44:53 2014 +0000
@@ -61,7 +61,7 @@
// lockInfoItemNames!
final Object[] lockInfoItemValues = {
new String(lock.getClassName()),
- new Integer(lock.getIdentityHashCode()),
+ lock.getIdentityHashCode(),
};
try {
--- a/jdk/src/share/classes/sun/management/MonitorInfoCompositeData.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/MonitorInfoCompositeData.java Fri Jul 25 09:44:53 2014 +0000
@@ -69,7 +69,7 @@
toCompositeData(ste)
: null);
} else if (item.equals(LOCKED_STACK_DEPTH)) {
- values[i] = new Integer(lock.getLockedStackDepth());
+ values[i] = lock.getLockedStackDepth();
} else {
values[i] = li.get(item);
}
--- a/jdk/src/share/classes/sun/management/StackTraceElementCompositeData.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/StackTraceElementCompositeData.java Fri Jul 25 09:44:53 2014 +0000
@@ -67,7 +67,7 @@
ste.getClassName(),
ste.getMethodName(),
ste.getFileName(),
- new Integer(ste.getLineNumber()),
+ ste.getLineNumber(),
ste.isNativeMethod(),
};
try {
--- a/jdk/src/share/classes/sun/management/jdp/JdpController.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/jdp/JdpController.java Fri Jul 25 09:44:53 2014 +0000
@@ -204,7 +204,7 @@
packet.setRmiHostname(rmiHostname);
// Set broadcast interval
- packet.setBroadcastInterval(new Integer(pause).toString());
+ packet.setBroadcastInterval(Integer.toString(pause));
// Set process id
Integer pid = getProcessId();
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemGCEntryImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemGCEntryImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -85,7 +85,7 @@
* Getter for the "JvmMemManagerIndex" variable.
*/
public Integer getJvmMemManagerIndex() throws SnmpStatusException {
- return new Integer(JvmMemManagerIndex);
+ return JvmMemManagerIndex;
}
}
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemManagerEntryImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemManagerEntryImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -79,7 +79,7 @@
* Getter for the "JvmMemManagerIndex" variable.
*/
public Integer getJvmMemManagerIndex() throws SnmpStatusException {
- return new Integer(JvmMemManagerIndex);
+ return JvmMemManagerIndex;
}
/**
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemMgrPoolRelEntryImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemMgrPoolRelEntryImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -92,14 +92,14 @@
* Getter for the "JvmMemManagerIndex" variable.
*/
public Integer getJvmMemManagerIndex() throws SnmpStatusException {
- return new Integer(JvmMemManagerIndex);
+ return JvmMemManagerIndex;
}
/**
* Getter for the "JvmMemPoolIndex" variable.
*/
public Integer getJvmMemPoolIndex() throws SnmpStatusException {
- return new Integer(JvmMemPoolIndex);
+ return JvmMemPoolIndex;
}
}
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemPoolEntryImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemPoolEntryImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -430,7 +430,7 @@
* Getter for the "JvmMemPoolIndex" variable.
*/
public Integer getJvmMemPoolIndex() throws SnmpStatusException {
- return new Integer(jvmMemPoolIndex);
+ return jvmMemPoolIndex;
}
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmOSImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmOSImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -82,7 +82,7 @@
* Getter for the "JvmRTProcessorCount" variable.
*/
public Integer getJvmOSProcessorCount() throws SnmpStatusException {
- return new Integer(getOSMBean().getAvailableProcessors());
+ return getOSMBean().getAvailableProcessors();
}
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTBootClassPathEntryImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTBootClassPathEntryImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -72,7 +72,7 @@
* Getter for the "JvmRTBootClassPathIndex" variable.
*/
public Integer getJvmRTBootClassPathIndex() throws SnmpStatusException {
- return new Integer(index);
+ return index;
}
}
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTClassPathEntryImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTClassPathEntryImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -71,7 +71,7 @@
* Getter for the "JvmRTClassPathIndex" variable.
*/
public Integer getJvmRTClassPathIndex() throws SnmpStatusException {
- return new Integer(index);
+ return index;
}
}
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTInputArgsEntryImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTInputArgsEntryImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -71,7 +71,7 @@
* Getter for the "JvmRTInputArgsIndex" variable.
*/
public Integer getJvmRTInputArgsIndex() throws SnmpStatusException {
- return new Integer(index);
+ return index;
}
}
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTLibraryPathEntryImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTLibraryPathEntryImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -71,7 +71,7 @@
* Getter for the "JvmRTLibraryPathIndex" variable.
*/
public Integer getJvmRTLibraryPathIndex() throws SnmpStatusException {
- return new Integer(index);
+ return index;
}
}
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRuntimeImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRuntimeImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -241,7 +241,7 @@
final String[] args = getInputArguments(JvmContextFactory.
getUserData());
- return new Integer(args.length);
+ return args.length;
}
/**
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmClassesVerboseLevel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmClassesVerboseLevel.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,10 +49,10 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(2), "verbose");
- intTable.put(new Integer(1), "silent");
- stringTable.put("verbose", new Integer(2));
- stringTable.put("silent", new Integer(1));
+ intTable.put(2, "verbose");
+ intTable.put(1, "silent");
+ stringTable.put("verbose", 2);
+ stringTable.put("silent", 1);
}
public EnumJvmClassesVerboseLevel(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmJITCompilerTimeMonitoring.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmJITCompilerTimeMonitoring.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,10 +49,10 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(2), "supported");
- intTable.put(new Integer(1), "unsupported");
- stringTable.put("supported", new Integer(2));
- stringTable.put("unsupported", new Integer(1));
+ intTable.put(2, "supported");
+ intTable.put(1, "unsupported");
+ stringTable.put("supported", 2);
+ stringTable.put("unsupported", 1);
}
public EnumJvmJITCompilerTimeMonitoring(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemManagerState.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemManagerState.java Fri Jul 25 09:44:53 2014 +0000
@@ -50,10 +50,10 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(2), "valid");
- intTable.put(new Integer(1), "invalid");
- stringTable.put("valid", new Integer(2));
- stringTable.put("invalid", new Integer(1));
+ intTable.put(2, "valid");
+ intTable.put(1, "invalid");
+ stringTable.put("valid", 2);
+ stringTable.put("invalid", 1);
}
public EnumJvmMemManagerState(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolCollectThreshdSupport.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolCollectThreshdSupport.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,10 +49,10 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(2), "supported");
- intTable.put(new Integer(1), "unsupported");
- stringTable.put("supported", new Integer(2));
- stringTable.put("unsupported", new Integer(1));
+ intTable.put(2, "supported");
+ intTable.put(1, "unsupported");
+ stringTable.put("supported", 2);
+ stringTable.put("unsupported", 1);
}
public EnumJvmMemPoolCollectThreshdSupport(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolState.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolState.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,10 +49,10 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(2), "valid");
- intTable.put(new Integer(1), "invalid");
- stringTable.put("valid", new Integer(2));
- stringTable.put("invalid", new Integer(1));
+ intTable.put(2, "valid");
+ intTable.put(1, "invalid");
+ stringTable.put("valid", 2);
+ stringTable.put("invalid", 1);
}
public EnumJvmMemPoolState(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolThreshdSupport.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolThreshdSupport.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,10 +49,10 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(2), "supported");
- intTable.put(new Integer(1), "unsupported");
- stringTable.put("supported", new Integer(2));
- stringTable.put("unsupported", new Integer(1));
+ intTable.put(2, "supported");
+ intTable.put(1, "unsupported");
+ stringTable.put("supported", 2);
+ stringTable.put("unsupported", 1);
}
public EnumJvmMemPoolThreshdSupport(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolType.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolType.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,10 +49,10 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(2), "heap");
- intTable.put(new Integer(1), "nonheap");
- stringTable.put("heap", new Integer(2));
- stringTable.put("nonheap", new Integer(1));
+ intTable.put(2, "heap");
+ intTable.put(1, "nonheap");
+ stringTable.put("heap", 2);
+ stringTable.put("nonheap", 1);
}
public EnumJvmMemPoolType(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemoryGCCall.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemoryGCCall.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,16 +49,16 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(2), "supported");
- intTable.put(new Integer(5), "failed");
- intTable.put(new Integer(4), "started");
- intTable.put(new Integer(1), "unsupported");
- intTable.put(new Integer(3), "start");
- stringTable.put("supported", new Integer(2));
- stringTable.put("failed", new Integer(5));
- stringTable.put("started", new Integer(4));
- stringTable.put("unsupported", new Integer(1));
- stringTable.put("start", new Integer(3));
+ intTable.put(2, "supported");
+ intTable.put(5, "failed");
+ intTable.put(4, "started");
+ intTable.put(1, "unsupported");
+ intTable.put(3, "start");
+ stringTable.put("supported", 2);
+ stringTable.put("failed", 5);
+ stringTable.put("started", 4);
+ stringTable.put("unsupported", 1);
+ stringTable.put("start", 3);
}
public EnumJvmMemoryGCCall(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemoryGCVerboseLevel.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemoryGCVerboseLevel.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,10 +49,10 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(2), "verbose");
- intTable.put(new Integer(1), "silent");
- stringTable.put("verbose", new Integer(2));
- stringTable.put("silent", new Integer(1));
+ intTable.put(2, "verbose");
+ intTable.put(1, "silent");
+ stringTable.put("verbose", 2);
+ stringTable.put("silent", 1);
}
public EnumJvmMemoryGCVerboseLevel(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmRTBootClassPathSupport.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmRTBootClassPathSupport.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,10 +49,10 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(2), "supported");
- intTable.put(new Integer(1), "unsupported");
- stringTable.put("supported", new Integer(2));
- stringTable.put("unsupported", new Integer(1));
+ intTable.put(2, "supported");
+ intTable.put(1, "unsupported");
+ stringTable.put("supported", 2);
+ stringTable.put("unsupported", 1);
}
public EnumJvmRTBootClassPathSupport(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmThreadContentionMonitoring.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmThreadContentionMonitoring.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,12 +49,12 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(3), "enabled");
- intTable.put(new Integer(4), "disabled");
- intTable.put(new Integer(1), "unsupported");
- stringTable.put("enabled", new Integer(3));
- stringTable.put("disabled", new Integer(4));
- stringTable.put("unsupported", new Integer(1));
+ intTable.put(3, "enabled");
+ intTable.put(4, "disabled");
+ intTable.put(1, "unsupported");
+ stringTable.put("enabled", 3);
+ stringTable.put("disabled", 4);
+ stringTable.put("unsupported", 1);
}
public EnumJvmThreadContentionMonitoring(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmThreadCpuTimeMonitoring.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmThreadCpuTimeMonitoring.java Fri Jul 25 09:44:53 2014 +0000
@@ -49,12 +49,12 @@
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
- intTable.put(new Integer(3), "enabled");
- intTable.put(new Integer(4), "disabled");
- intTable.put(new Integer(1), "unsupported");
- stringTable.put("enabled", new Integer(3));
- stringTable.put("disabled", new Integer(4));
- stringTable.put("unsupported", new Integer(1));
+ intTable.put(3, "enabled");
+ intTable.put(4, "disabled");
+ intTable.put(1, "unsupported");
+ stringTable.put("enabled", 3);
+ stringTable.put("disabled", 4);
+ stringTable.put("unsupported", 1);
}
public EnumJvmThreadCpuTimeMonitoring(int valueIndex) throws IllegalArgumentException {
--- a/jdk/src/share/classes/sun/misc/ProxyGenerator.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/misc/ProxyGenerator.java Fri Jul 25 09:44:53 2014 +0000
@@ -1743,7 +1743,7 @@
* Get or assign the index for a CONSTANT_Integer entry.
*/
public short getInteger(int i) {
- return getValue(new Integer(i));
+ return getValue(i);
}
/**
--- a/jdk/src/share/classes/sun/net/NetProperties.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/net/NetProperties.java Fri Jul 25 09:44:53 2014 +0000
@@ -123,7 +123,7 @@
} catch (NumberFormatException ex) {
}
}
- return new Integer(defval);
+ return defval;
}
/**
--- a/jdk/src/share/classes/sun/nio/ch/Util.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/nio/ch/Util.java Fri Jul 25 09:44:53 2014 +0000
@@ -328,7 +328,7 @@
initDBBConstructor();
try {
dbb = (MappedByteBuffer)directByteBufferConstructor.newInstance(
- new Object[] { new Integer(size),
+ new Object[] { size,
addr,
fd,
unmapper });
@@ -373,7 +373,7 @@
initDBBRConstructor();
try {
dbb = (MappedByteBuffer)directByteBufferRConstructor.newInstance(
- new Object[] { new Integer(size),
+ new Object[] { size,
addr,
fd,
unmapper });
--- a/jdk/src/share/classes/sun/print/PathGraphics.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/print/PathGraphics.java Fri Jul 25 09:44:53 2014 +0000
@@ -43,6 +43,7 @@
import java.awt.Polygon;
import java.awt.Shape;
+import java.awt.geom.Path2D;
import java.text.AttributedCharacterIterator;
import java.awt.font.FontRenderContext;
@@ -457,23 +458,18 @@
*/
public void drawPolyline(int xPoints[], int yPoints[],
int nPoints) {
- float fromX;
- float fromY;
- float toX;
- float toY;
- if (nPoints > 0) {
- fromX = xPoints[0];
- fromY = yPoints[0];
+ if (nPoints == 2) {
+ draw(new Line2D.Float(xPoints[0], yPoints[0],
+ xPoints[1], yPoints[1]));
+ } else if (nPoints > 2) {
+ Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD, nPoints);
+ path.moveTo(xPoints[0], yPoints[0]);
for(int i = 1; i < nPoints; i++) {
- toX = xPoints[i];
- toY = yPoints[i];
- draw(new Line2D.Float(fromX, fromY, toX, toY));
- fromX = toX;
- fromY = toY;
+ path.lineTo(xPoints[i], yPoints[i]);
}
+ draw(path);
}
-
}
--- a/jdk/src/share/classes/sun/rmi/rmic/RMIGenerator.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/rmi/rmic/RMIGenerator.java Fri Jul 25 09:44:53 2014 +0000
@@ -63,9 +63,9 @@
private static final Hashtable<String, Integer> versionOptions = new Hashtable<>();
static {
- versionOptions.put("-v1.1", new Integer(STUB_VERSION_1_1));
- versionOptions.put("-vcompat", new Integer(STUB_VERSION_FAT));
- versionOptions.put("-v1.2", new Integer(STUB_VERSION_1_2));
+ versionOptions.put("-v1.1", STUB_VERSION_1_1);
+ versionOptions.put("-vcompat", STUB_VERSION_FAT);
+ versionOptions.put("-v1.2", STUB_VERSION_1_2);
}
/**
--- a/jdk/src/share/classes/sun/security/action/GetIntegerAction.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/action/GetIntegerAction.java Fri Jul 25 09:44:53 2014 +0000
@@ -107,7 +107,7 @@
public Integer run() {
Integer value = Integer.getInteger(theProp);
if ((value == null) && defaultSet)
- return new Integer(defaultVal);
+ return defaultVal;
return value;
}
}
--- a/jdk/src/share/classes/sun/security/ec/ECKeyPairGenerator.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/ec/ECKeyPairGenerator.java Fri Jul 25 09:44:53 2014 +0000
@@ -125,19 +125,18 @@
try {
- long[] handles = generateECKeyPair(keySize, encodedParams, seed);
+ Object[] keyBytes = generateECKeyPair(keySize, encodedParams, seed);
// The 'params' object supplied above is equivalent to the native
// one so there is no need to fetch it.
-
- // handles[0] points to the native private key
- BigInteger s = new BigInteger(1, getEncodedBytes(handles[0]));
+ // keyBytes[0] is the encoding of the native private key
+ BigInteger s = new BigInteger(1, (byte[])keyBytes[0]);
PrivateKey privateKey =
new ECPrivateKeyImpl(s, (ECParameterSpec)params);
- // handles[1] points to the native public key
- ECPoint w = ECUtil.decodePoint(getEncodedBytes(handles[1]),
+ // keyBytes[1] is the encoding of the native public key
+ ECPoint w = ECUtil.decodePoint((byte[])keyBytes[1],
((ECParameterSpec)params).getCurve());
PublicKey publicKey =
new ECPublicKeyImpl(w, (ECParameterSpec)params);
@@ -162,14 +161,9 @@
}
/*
- * Generates the keypair and returns a 2-element array of handles.
- * The first handle points to the private key, the second to the public key.
+ * Generates the keypair and returns a 2-element array of encoding bytes.
+ * The first one is for the private key, the second for the public key.
*/
- private static native long[] generateECKeyPair(int keySize,
+ private static native Object[] generateECKeyPair(int keySize,
byte[] encodedParams, byte[] seed) throws GeneralSecurityException;
-
- /*
- * Extracts the encoded key data using the supplied handle.
- */
- private static native byte[] getEncodedBytes(long handle);
}
--- a/jdk/src/share/classes/sun/security/jgss/krb5/ServiceCreds.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/ServiceCreds.java Fri Jul 25 09:44:53 2014 +0000
@@ -231,7 +231,7 @@
for (int i=0; i<ekeys.length; i++) {
ekeys[i] = new EncryptionKey(
kkeys[i].getEncoded(), kkeys[i].getKeyType(),
- new Integer(kkeys[i].getVersionNumber()));
+ kkeys[i].getVersionNumber());
}
return ekeys;
}
--- a/jdk/src/share/classes/sun/security/krb5/EncryptedData.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/EncryptedData.java Fri Jul 25 09:44:53 2014 +0000
@@ -87,7 +87,7 @@
EncryptedData new_encryptedData = new EncryptedData();
new_encryptedData.eType = eType;
if (kvno != null) {
- new_encryptedData.kvno = new Integer(kvno.intValue());
+ new_encryptedData.kvno = kvno.intValue();
}
if (cipher != null) {
new_encryptedData.cipher = new byte[cipher.length];
@@ -241,7 +241,7 @@
if ((encoding.getData().peekByte() & 0x1F) == 1) {
der = encoding.getData().getDerValue();
int i = (der.getData().getBigInteger()).intValue();
- kvno = new Integer(i);
+ kvno = i;
} else {
kvno = null;
}
--- a/jdk/src/share/classes/sun/security/krb5/KrbApRep.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/KrbApRep.java Fri Jul 25 09:44:53 2014 +0000
@@ -180,7 +180,7 @@
Integer seqno = null;
if (seqNumber != null)
- seqno = new Integer(seqNumber.current());
+ seqno = seqNumber.current();
encPart = new EncAPRepPart(ctime,
cusec,
--- a/jdk/src/share/classes/sun/security/krb5/KrbApReq.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/KrbApReq.java Fri Jul 25 09:44:53 2014 +0000
@@ -485,7 +485,7 @@
Integer seqno = null;
if (seqNumber != null)
- seqno = new Integer(seqNumber.current());
+ seqno = seqNumber.current();
authenticator =
new Authenticator(cname,
--- a/jdk/src/share/classes/sun/security/krb5/KrbPriv.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/KrbPriv.java Fri Jul 25 09:44:53 2014 +0000
@@ -114,10 +114,10 @@
Integer seqno = null;
if (timestamp != null)
- usec = new Integer(timestamp.getMicroSeconds());
+ usec = timestamp.getMicroSeconds();
if (seqNumber != null) {
- seqno = new Integer(seqNumber.current());
+ seqno = seqNumber.current();
seqNumber.step();
}
--- a/jdk/src/share/classes/sun/security/krb5/KrbSafe.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/KrbSafe.java Fri Jul 25 09:44:53 2014 +0000
@@ -115,10 +115,10 @@
Integer seqno = null;
if (timestamp != null)
- usec = new Integer(timestamp.getMicroSeconds());
+ usec = timestamp.getMicroSeconds();
if (seqNumber != null) {
- seqno = new Integer(seqNumber.current());
+ seqno = seqNumber.current();
seqNumber.step();
}
--- a/jdk/src/share/classes/sun/security/krb5/internal/Authenticator.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/Authenticator.java Fri Jul 25 09:44:53 2014 +0000
@@ -149,7 +149,7 @@
if ((der.getData().peekByte() & 0x1F) == 0x07) {
subDer = der.getData().getDerValue();
if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x07) {
- seqNumber = new Integer(subDer.getData().getBigInteger().intValue());
+ seqNumber = subDer.getData().getBigInteger().intValue();
}
}
} else {
--- a/jdk/src/share/classes/sun/security/krb5/internal/EncAPRepPart.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/EncAPRepPart.java Fri Jul 25 09:44:53 2014 +0000
@@ -117,7 +117,7 @@
if ((subDer.getTag() & 0x1F) != 0x03) {
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
- seqNumber = new Integer(subDer.getData().getBigInteger().intValue());
+ seqNumber = subDer.getData().getBigInteger().intValue();
} else {
seqNumber = null;
}
--- a/jdk/src/share/classes/sun/security/krb5/internal/EncKrbCredPart.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/EncKrbCredPart.java Fri Jul 25 09:44:53 2014 +0000
@@ -140,7 +140,7 @@
if (der.getData().available() > 0) {
if (((byte) (der.getData().peekByte()) & (byte) 0x1F) == (byte) 0x01) {
subDer = der.getData().getDerValue();
- nonce = new Integer(subDer.getData().getBigInteger().intValue());
+ nonce = subDer.getData().getBigInteger().intValue();
}
}
if (der.getData().available() > 0) {
@@ -149,7 +149,7 @@
if (der.getData().available() > 0) {
if (((byte) (der.getData().peekByte()) & (byte) 0x1F) == (byte) 0x03) {
subDer = der.getData().getDerValue();
- usec = new Integer(subDer.getData().getBigInteger().intValue());
+ usec = subDer.getData().getBigInteger().intValue();
}
}
if (der.getData().available() > 0) {
--- a/jdk/src/share/classes/sun/security/krb5/internal/EncKrbPrivPart.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/EncKrbPrivPart.java Fri Jul 25 09:44:53 2014 +0000
@@ -115,13 +115,13 @@
timestamp = KerberosTime.parse(der.getData(), (byte) 0x01, true);
if ((der.getData().peekByte() & 0x1F) == 0x02) {
subDer = der.getData().getDerValue();
- usec = new Integer(subDer.getData().getBigInteger().intValue());
+ usec = subDer.getData().getBigInteger().intValue();
} else {
usec = null;
}
if ((der.getData().peekByte() & 0x1F) == 0x03) {
subDer = der.getData().getDerValue();
- seqNumber = new Integer(subDer.getData().getBigInteger().intValue());
+ seqNumber = subDer.getData().getBigInteger().intValue();
} else {
seqNumber = null;
}
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java Fri Jul 25 09:44:53 2014 +0000
@@ -335,13 +335,13 @@
cTime = KerberosTime.parse(der.getData(), (byte)0x02, true);
if ((der.getData().peekByte() & 0x1F) == 0x03) {
subDer = der.getData().getDerValue();
- cuSec = new Integer(subDer.getData().getBigInteger().intValue());
+ cuSec = subDer.getData().getBigInteger().intValue();
}
else cuSec = null;
sTime = KerberosTime.parse(der.getData(), (byte)0x04, false);
subDer = der.getData().getDerValue();
if ((subDer.getTag() & (byte)0x1F) == (byte)0x05) {
- suSec = new Integer (subDer.getData().getBigInteger().intValue());
+ suSec = subDer.getData().getBigInteger().intValue();
}
else throw new Asn1Exception(Krb5.ASN1_BAD_ID);
subDer = der.getData().getDerValue();
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBSafeBody.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBSafeBody.java Fri Jul 25 09:44:53 2014 +0000
@@ -104,11 +104,11 @@
timestamp = KerberosTime.parse(encoding.getData(), (byte)0x01, true);
if ((encoding.getData().peekByte() & 0x1F) == 0x02) {
der = encoding.getData().getDerValue();
- usec = new Integer(der.getData().getBigInteger().intValue());
+ usec = der.getData().getBigInteger().intValue();
}
if ((encoding.getData().peekByte() & 0x1F) == 0x03) {
der = encoding.getData().getDerValue();
- seqNumber = new Integer(der.getData().getBigInteger().intValue());
+ seqNumber = der.getData().getBigInteger().intValue();
}
sAddress = HostAddress.parse(encoding.getData(), (byte)0x04, false);
if (encoding.getData().available() > 0)
--- a/jdk/src/share/classes/sun/security/krb5/internal/PAEncTSEnc.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/PAEncTSEnc.java Fri Jul 25 09:44:53 2014 +0000
@@ -67,7 +67,7 @@
public PAEncTSEnc() {
KerberosTime now = KerberosTime.now();
pATimeStamp = now;
- pAUSec = new Integer(now.getMicroSeconds());
+ pAUSec = now.getMicroSeconds();
}
/**
@@ -85,7 +85,7 @@
if (encoding.getData().available() > 0) {
der = encoding.getData().getDerValue();
if ((der.getTag() & 0x1F) == 0x01) {
- pAUSec = new Integer(der.getData().getBigInteger().intValue());
+ pAUSec = der.getData().getBigInteger().intValue();
}
else throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
--- a/jdk/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java Fri Jul 25 09:44:53 2014 +0000
@@ -94,8 +94,8 @@
taglen = read(2);
switch (tag) {
case FCC_TAG_DELTATIME:
- time_offset = new Integer(read(4));
- usec_offset = new Integer(read(4));
+ time_offset = read(4);
+ usec_offset = read(4);
break;
default:
}
@@ -186,7 +186,7 @@
read(2); /* keytype recorded twice in fvno 3 */
keyLen = read(4);
byte[] bytes = IOUtils.readFully(this, keyLen, true);
- return new EncryptionKey(bytes, keyType, new Integer(version));
+ return new EncryptionKey(bytes, keyType, version);
}
long[] readTimes() throws IOException {
--- a/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java Fri Jul 25 09:44:53 2014 +0000
@@ -297,7 +297,7 @@
if (EType.isSupported(entry.keyType)) {
key = new EncryptionKey(entry.keyblock,
entry.keyType,
- new Integer(entry.keyVersion));
+ entry.keyVersion);
keys.add(key);
if (DEBUG) {
System.out.println("Added key: " + entry.keyType +
--- a/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java Fri Jul 25 09:44:53 2014 +0000
@@ -68,7 +68,7 @@
public EncryptionKey getKey() {
EncryptionKey key = new EncryptionKey(keyblock,
keyType,
- new Integer(keyVersion));
+ keyVersion);
return key;
}
--- a/jdk/src/share/classes/sun/security/provider/ConfigFile.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/provider/ConfigFile.java Fri Jul 25 09:44:53 2014 +0000
@@ -531,7 +531,7 @@
} else {
throw ioException(
"Configuration.Error.Line.line.expected.expect.found.value.",
- new Integer(linenum), expect, st.sval);
+ linenum, expect, st.sval);
}
break;
@@ -541,7 +541,7 @@
} else {
throw ioException(
"Configuration.Error.Line.line.expected.expect.",
- new Integer(linenum), expect, st.sval);
+ linenum, expect, st.sval);
}
break;
@@ -551,7 +551,7 @@
} else {
throw ioException(
"Configuration.Error.Line.line.expected.expect.",
- new Integer(linenum), expect, st.sval);
+ linenum, expect, st.sval);
}
break;
@@ -561,7 +561,7 @@
} else {
throw ioException(
"Configuration.Error.Line.line.expected.expect.",
- new Integer(linenum), expect, st.sval);
+ linenum, expect, st.sval);
}
break;
@@ -571,14 +571,14 @@
} else {
throw ioException(
"Configuration.Error.Line.line.expected.expect.",
- new Integer(linenum), expect, st.sval);
+ linenum, expect, st.sval);
}
break;
default:
throw ioException(
"Configuration.Error.Line.line.expected.expect.found.value.",
- new Integer(linenum), expect, st.sval);
+ linenum, expect, st.sval);
}
return value;
}
@@ -655,7 +655,7 @@
if (s == null || s.length() == 0) {
throw ioException(
"Configuration.Error.Line.line.system.property.value.expanded.to.empty.value",
- new Integer(linenum), value);
+ linenum, value);
}
return s;
}
--- a/jdk/src/share/classes/sun/security/provider/PolicyParser.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/provider/PolicyParser.java Fri Jul 25 09:44:53 2014 +0000
@@ -1405,7 +1405,7 @@
super("line " + line + ": " + msg);
MessageFormat form = new MessageFormat
(ResourcesMgr.getString("line.number.msg"));
- Object[] source = {new Integer(line), msg};
+ Object[] source = {line, msg};
i18nMessage = form.format(source);
}
@@ -1414,7 +1414,7 @@
"], found [" + actual + "]");
MessageFormat form = new MessageFormat(ResourcesMgr.getString
("line.number.expected.expect.found.actual."));
- Object[] source = {new Integer(line), expect, actual};
+ Object[] source = {line, expect, actual};
i18nMessage = form.format(source);
}
--- a/jdk/src/share/classes/sun/security/rsa/RSACore.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/rsa/RSACore.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -50,6 +50,15 @@
*/
public final class RSACore {
+ // globally enable/disable use of blinding
+ private final static boolean ENABLE_BLINDING = true;
+
+ // cache for blinding parameters. Map<BigInteger, BlindingParameters>
+ // use a weak hashmap so that cached values are automatically cleared
+ // when the modulus is GC'ed
+ private final static Map<BigInteger, BlindingParameters>
+ blindingCache = new WeakHashMap<>();
+
private RSACore() {
// empty
}
@@ -100,12 +109,12 @@
if (key instanceof RSAPrivateCrtKey) {
return crtCrypt(msg, (RSAPrivateCrtKey)key);
} else {
- return crypt(msg, key.getModulus(), key.getPrivateExponent());
+ return priCrypt(msg, key.getModulus(), key.getPrivateExponent());
}
}
/**
- * RSA public key ops and non-CRT private key ops. Simple modPow().
+ * RSA public key ops. Simple modPow().
*/
private static byte[] crypt(byte[] msg, BigInteger n, BigInteger exp)
throws BadPaddingException {
@@ -115,22 +124,29 @@
}
/**
+ * RSA non-CRT private key operations.
+ */
+ private static byte[] priCrypt(byte[] msg, BigInteger n, BigInteger exp)
+ throws BadPaddingException {
+
+ BigInteger c = parseMsg(msg, n);
+ BlindingRandomPair brp = null;
+ BigInteger m;
+ if (ENABLE_BLINDING) {
+ brp = getBlindingRandomPair(null, exp, n);
+ c = c.multiply(brp.u).mod(n);
+ m = c.modPow(exp, n);
+ m = m.multiply(brp.v).mod(n);
+ } else {
+ m = c.modPow(exp, n);
+ }
+
+ return toByteArray(m, getByteLength(n));
+ }
+
+ /**
* RSA private key operations with CRT. Algorithm and variable naming
* are taken from PKCS#1 v2.1, section 5.1.2.
- *
- * The only difference is the addition of blinding to twart timing attacks.
- * This is described in the RSA Bulletin#2 (Jan 96) among other places.
- * This means instead of implementing RSA as
- * m = c ^ d mod n (or RSA in CRT variant)
- * we do
- * r = random(0, n-1)
- * c' = c * r^e mod n
- * m' = c' ^ d mod n (or RSA in CRT variant)
- * m = m' * r^-1 mod n (where r^-1 is the modular inverse of r mod n)
- * This works because r^(e*d) * r^-1 = r * r^-1 = 1 (all mod n)
- *
- * We do not generate new blinding parameters for each operation but reuse
- * them BLINDING_MAX_REUSE times (see definition below).
*/
private static byte[] crtCrypt(byte[] msg, RSAPrivateCrtKey key)
throws BadPaddingException {
@@ -141,13 +157,13 @@
BigInteger dP = key.getPrimeExponentP();
BigInteger dQ = key.getPrimeExponentQ();
BigInteger qInv = key.getCrtCoefficient();
+ BigInteger e = key.getPublicExponent();
+ BigInteger d = key.getPrivateExponent();
- BlindingParameters params;
+ BlindingRandomPair brp;
if (ENABLE_BLINDING) {
- params = getBlindingParameters(key);
- c = c.multiply(params.re).mod(n);
- } else {
- params = null;
+ brp = getBlindingRandomPair(e, d, n);
+ c = c.multiply(brp.u).mod(n);
}
// m1 = c ^ dP mod p
@@ -165,8 +181,8 @@
// m = m2 + q * h
BigInteger m = h.multiply(q).add(m2);
- if (params != null) {
- m = m.multiply(params.rInv).mod(n);
+ if (ENABLE_BLINDING) {
+ m = m.multiply(brp.v).mod(n);
}
return toByteArray(m, getByteLength(n));
@@ -208,82 +224,217 @@
return t;
}
- // globally enable/disable use of blinding
- private final static boolean ENABLE_BLINDING = true;
+ /**
+ * Parameters (u,v) for RSA Blinding. This is described in the RSA
+ * Bulletin#2 (Jan 96) and other places:
+ *
+ * ftp://ftp.rsa.com/pub/pdfs/bull-2.pdf
+ *
+ * The standard RSA Blinding decryption requires the public key exponent
+ * (e) and modulus (n), and converts ciphertext (c) to plaintext (p).
+ *
+ * Before the modular exponentiation operation, the input message should
+ * be multiplied by (u (mod n)), and afterward the result is corrected
+ * by multiplying with (v (mod n)). The system should reject messages
+ * equal to (0 (mod n)). That is:
+ *
+ * 1. Generate r between 0 and n-1, relatively prime to n.
+ * 2. Compute x = (c*u) mod n
+ * 3. Compute y = (x^d) mod n
+ * 4. Compute p = (y*v) mod n
+ *
+ * The Java APIs allows for either standard RSAPrivateKey or
+ * RSAPrivateCrtKey RSA keys.
+ *
+ * If the public exponent is available to us (e.g. RSAPrivateCrtKey),
+ * choose a random r, then let (u, v):
+ *
+ * u = r ^ e mod n
+ * v = r ^ (-1) mod n
+ *
+ * The proof follows:
+ *
+ * p = (((c * u) ^ d mod n) * v) mod n
+ * = ((c ^ d) * (u ^ d) * v) mod n
+ * = ((c ^ d) * (r ^ e) ^ d) * (r ^ (-1))) mod n
+ * = ((c ^ d) * (r ^ (e * d)) * (r ^ (-1))) mod n
+ * = ((c ^ d) * (r ^ 1) * (r ^ (-1))) mod n (see below)
+ * = (c ^ d) mod n
+ *
+ * because in RSA cryptosystem, d is the multiplicative inverse of e:
+ *
+ * (r^(e * d)) mod n
+ * = (r ^ 1) mod n
+ * = r mod n
+ *
+ * However, if the public exponent is not available (e.g. RSAPrivateKey),
+ * we mitigate the timing issue by using a similar random number blinding
+ * approach using the private key:
+ *
+ * u = r
+ * v = ((r ^ (-1)) ^ d) mod n
+ *
+ * This returns the same plaintext because:
+ *
+ * p = (((c * u) ^ d mod n) * v) mod n
+ * = ((c ^ d) * (u ^ d) * v) mod n
+ * = ((c ^ d) * (u ^ d) * ((u ^ (-1)) ^d)) mod n
+ * = (c ^ d) mod n
+ *
+ * Computing inverses mod n and random number generation is slow, so
+ * it is often not practical to generate a new random (u, v) pair for
+ * each new exponentiation. The calculation of parameters might even be
+ * subject to timing attacks. However, (u, v) pairs should not be
+ * reused since they themselves might be compromised by timing attacks,
+ * leaving the private exponent vulnerable. An efficient solution to
+ * this problem is update u and v before each modular exponentiation
+ * step by computing:
+ *
+ * u = u ^ 2
+ * v = v ^ 2
+ *
+ * The total performance cost is small.
+ */
+ private final static class BlindingRandomPair {
+ final BigInteger u;
+ final BigInteger v;
- // maximum number of times that we will use a set of blinding parameters
- // value suggested by Paul Kocher (quoted by NSS)
- private final static int BLINDING_MAX_REUSE = 50;
-
- // cache for blinding parameters. Map<BigInteger, BlindingParameters>
- // use a weak hashmap so that cached values are automatically cleared
- // when the modulus is GC'ed
- private final static Map<BigInteger, BlindingParameters> blindingCache =
- new WeakHashMap<>();
+ BlindingRandomPair(BigInteger u, BigInteger v) {
+ this.u = u;
+ this.v = v;
+ }
+ }
/**
* Set of blinding parameters for a given RSA key.
*
* The RSA modulus is usually unique, so we index by modulus in
- * blindingCache. However, to protect against the unlikely case of two
- * keys sharing the same modulus, we also store the public exponent.
- * This means we cannot cache blinding parameters for multiple keys that
- * share the same modulus, but since sharing moduli is fundamentally broken
- * an insecure, this does not matter.
+ * {@code blindingCache}. However, to protect against the unlikely
+ * case of two keys sharing the same modulus, we also store the public
+ * or the private exponent. This means we cannot cache blinding
+ * parameters for multiple keys that share the same modulus, but
+ * since sharing moduli is fundamentally broken and insecure, this
+ * does not matter.
*/
- private static final class BlindingParameters {
- // e (RSA public exponent)
- final BigInteger e;
- // r ^ e mod n
- final BigInteger re;
- // inverse of r mod n
- final BigInteger rInv;
- // how many more times this parameter object can be used
- private volatile int remainingUses;
- BlindingParameters(BigInteger e, BigInteger re, BigInteger rInv) {
+ private final static class BlindingParameters {
+ private final static BigInteger BIG_TWO = BigInteger.valueOf(2L);
+
+ // RSA public exponent
+ private final BigInteger e;
+
+ // hash code of RSA private exponent
+ private final BigInteger d;
+
+ // r ^ e mod n (CRT), or r mod n (Non-CRT)
+ private BigInteger u;
+
+ // r ^ (-1) mod n (CRT) , or ((r ^ (-1)) ^ d) mod n (Non-CRT)
+ private BigInteger v;
+
+ // e: the public exponent
+ // d: the private exponent
+ // n: the modulus
+ BlindingParameters(BigInteger e, BigInteger d, BigInteger n) {
+ this.u = null;
+ this.v = null;
this.e = e;
- this.re = re;
- this.rInv = rInv;
- // initialize remaining uses, subtract current use now
- remainingUses = BLINDING_MAX_REUSE - 1;
+ this.d = d;
+
+ int len = n.bitLength();
+ SecureRandom random = JCAUtil.getSecureRandom();
+ u = new BigInteger(len, random).mod(n);
+ // Although the possibility is very much limited that u is zero
+ // or is not relatively prime to n, we still want to be careful
+ // about the special value.
+ //
+ // Secure random generation is expensive, try to use BigInteger.ONE
+ // this time if this new generated random number is zero or is not
+ // relatively prime to n. Next time, new generated secure random
+ // number will be used instead.
+ if (u.equals(BigInteger.ZERO)) {
+ u = BigInteger.ONE; // use 1 this time
+ }
+
+ try {
+ // The call to BigInteger.modInverse() checks that u is
+ // relatively prime to n. Otherwise, ArithmeticException is
+ // thrown.
+ v = u.modInverse(n);
+ } catch (ArithmeticException ae) {
+ // if u is not relatively prime to n, use 1 this time
+ u = BigInteger.ONE;
+ v = BigInteger.ONE;
+ }
+
+ if (e != null) {
+ u = u.modPow(e, n); // e: the public exponent
+ // u: random ^ e
+ // v: random ^ (-1)
+ } else {
+ v = v.modPow(d, n); // d: the private exponent
+ // u: random
+ // v: random ^ (-d)
+ }
}
- boolean valid(BigInteger e) {
- int k = remainingUses--;
- return (k > 0) && this.e.equals(e);
+
+ // return null if need to reset the parameters
+ BlindingRandomPair getBlindingRandomPair(
+ BigInteger e, BigInteger d, BigInteger n) {
+
+ if ((this.e != null && this.e.equals(e)) ||
+ (this.d != null && this.d.equals(d))) {
+
+ BlindingRandomPair brp = null;
+ synchronized (this) {
+ if (!u.equals(BigInteger.ZERO) &&
+ !v.equals(BigInteger.ZERO)) {
+
+ brp = new BlindingRandomPair(u, v);
+ if (u.compareTo(BigInteger.ONE) <= 0 ||
+ v.compareTo(BigInteger.ONE) <= 0) {
+
+ // need to reset the random pair next time
+ u = BigInteger.ZERO;
+ v = BigInteger.ZERO;
+ } else {
+ u = u.modPow(BIG_TWO, n);
+ v = v.modPow(BIG_TWO, n);
+ }
+ } // Otherwise, need to reset the random pair.
+ }
+ return brp;
+ }
+
+ return null;
}
}
- /**
- * Return valid RSA blinding parameters for the given private key.
- * Use cached parameters if available. If not, generate new parameters
- * and cache.
- */
- private static BlindingParameters getBlindingParameters
- (RSAPrivateCrtKey key) {
- BigInteger modulus = key.getModulus();
- BigInteger e = key.getPublicExponent();
- BlindingParameters params;
- // we release the lock between get() and put()
- // that means threads might concurrently generate new blinding
- // parameters for the same modulus. this is only a slight waste
- // of cycles and seems preferable in terms of scalability
- // to locking out all threads while generating new parameters
+ private static BlindingRandomPair getBlindingRandomPair(
+ BigInteger e, BigInteger d, BigInteger n) {
+
+ BlindingParameters bps = null;
synchronized (blindingCache) {
- params = blindingCache.get(modulus);
+ bps = blindingCache.get(n);
}
- if ((params != null) && params.valid(e)) {
- return params;
+
+ if (bps == null) {
+ bps = new BlindingParameters(e, d, n);
+ synchronized (blindingCache) {
+ blindingCache.putIfAbsent(n, bps);
+ }
}
- int len = modulus.bitLength();
- SecureRandom random = JCAUtil.getSecureRandom();
- BigInteger r = new BigInteger(len, random).mod(modulus);
- BigInteger re = r.modPow(e, modulus);
- BigInteger rInv = r.modInverse(modulus);
- params = new BlindingParameters(e, re, rInv);
- synchronized (blindingCache) {
- blindingCache.put(modulus, params);
+
+ BlindingRandomPair brp = bps.getBlindingRandomPair(e, d, n);
+ if (brp == null) {
+ // need to reset the blinding parameters
+ bps = new BlindingParameters(e, d, n);
+ synchronized (blindingCache) {
+ blindingCache.replace(n, bps);
+ }
+ brp = bps.getBlindingRandomPair(e, d, n);
}
- return params;
+
+ return brp;
}
}
--- a/jdk/src/share/classes/sun/security/tools/keytool/Main.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/tools/keytool/Main.java Fri Jul 25 09:44:53 2014 +0000
@@ -1577,7 +1577,7 @@
if (verbose) {
MessageFormat form = new MessageFormat(rb.getString
("Generated.keysize.bit.keyAlgName.secret.key"));
- Object[] source = {new Integer(keysize),
+ Object[] source = {keysize,
secKey.getAlgorithm()};
System.err.println(form.format(source));
}
@@ -1672,7 +1672,7 @@
if (verbose) {
MessageFormat form = new MessageFormat(rb.getString
("Generating.keysize.bit.keyAlgName.key.pair.and.self.signed.certificate.sigAlgName.with.a.validity.of.validality.days.for"));
- Object[] source = {new Integer(keysize),
+ Object[] source = {keysize,
privKey.getAlgorithm(),
chain[0].getSigAlgName(),
validity,
@@ -1833,7 +1833,7 @@
for (int i = 0; i < chain.length; i ++) {
MessageFormat form = new MessageFormat
(rb.getString("Certificate.i.1."));
- Object[] source = {new Integer((i + 1))};
+ Object[] source = {(i + 1)};
out.println(form.format(source));
if (verbose && (chain[i] instanceof X509Certificate)) {
printX509Cert((X509Certificate)(chain[i]), out);
@@ -2108,7 +2108,7 @@
("Your.keystore.contains.keyStore.size.entry")) :
new MessageFormat(rb.getString
("Your.keystore.contains.keyStore.size.entries"));
- Object[] source = {new Integer(keyStore.size())};
+ Object[] source = {keyStore.size()};
out.println(form.format(source));
out.println();
@@ -2380,7 +2380,7 @@
if (certs.length > 1) {
MessageFormat form = new MessageFormat
(rb.getString("Certificate.i.1."));
- Object[] source = {new Integer(i + 1)};
+ Object[] source = {i + 1};
out.println(form.format(source));
}
if (rfc)
--- a/jdk/src/share/classes/sun/security/util/DerIndefLenConverter.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/util/DerIndefLenConverter.java Fri Jul 25 09:44:53 2014 +0000
@@ -150,7 +150,7 @@
return curLen;
int lenByte = data[dataPos++] & 0xff;
if (isIndefinite(lenByte)) {
- ndefsList.add(new Integer(dataPos));
+ ndefsList.add(dataPos);
unresolved++;
return curLen;
}
--- a/jdk/src/share/classes/sun/security/util/KeyUtil.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/util/KeyUtil.java Fri Jul 25 09:44:53 2014 +0000
@@ -272,7 +272,16 @@
"Diffie-Hellman public key is too large");
}
- // Don't bother to check against the y^q mod p if safe primes are used.
+ // y^q mod p == 1?
+ // Unable to perform this check as q is unknown in this circumstance.
+
+ // p is expected to be prime. However, it is too expensive to check
+ // that p is prime. Instead, in order to mitigate the impact of
+ // non-prime values, we check that y is not a factor of p.
+ BigInteger r = p.remainder(y);
+ if (r.equals(BigInteger.ZERO)) {
+ throw new InvalidKeyException("Invalid Diffie-Hellman parameters");
+ }
}
/**
--- a/jdk/src/share/classes/sun/security/x509/CRLReasonCodeExtension.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/x509/CRLReasonCodeExtension.java Fri Jul 25 09:44:53 2014 +0000
@@ -125,7 +125,7 @@
*/
public Integer get(String name) throws IOException {
if (name.equalsIgnoreCase(REASON)) {
- return new Integer(reasonCode);
+ return reasonCode;
} else {
throw new IOException
("Name not supported by CRLReasonCodeExtension");
--- a/jdk/src/share/classes/sun/security/x509/CertificateVersion.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/x509/CertificateVersion.java Fri Jul 25 09:44:53 2014 +0000
@@ -193,7 +193,7 @@
*/
public Integer get(String name) throws IOException {
if (name.equalsIgnoreCase(VERSION)) {
- return(new Integer(getVersion()));
+ return(getVersion());
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet: CertificateVersion.");
--- a/jdk/src/share/classes/sun/security/x509/InhibitAnyPolicyExtension.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/x509/InhibitAnyPolicyExtension.java Fri Jul 25 09:44:53 2014 +0000
@@ -217,7 +217,7 @@
*/
public Integer get(String name) throws IOException {
if (name.equalsIgnoreCase(SKIP_CERTS))
- return (new Integer(skipCerts));
+ return (skipCerts);
else
throw new IOException("Attribute name not recognized by " +
"CertAttrSet:InhibitAnyPolicy.");
--- a/jdk/src/share/classes/sun/security/x509/PolicyConstraintsExtension.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/security/x509/PolicyConstraintsExtension.java Fri Jul 25 09:44:53 2014 +0000
@@ -233,9 +233,9 @@
*/
public Integer get(String name) throws IOException {
if (name.equalsIgnoreCase(REQUIRE)) {
- return new Integer(require);
+ return require;
} else if (name.equalsIgnoreCase(INHIBIT)) {
- return new Integer(inhibit);
+ return inhibit;
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet:PolicyConstraints.");
--- a/jdk/src/share/classes/sun/swing/BakedArrayList.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/swing/BakedArrayList.java Fri Jul 25 09:44:53 2014 +0000
@@ -44,7 +44,7 @@
* @author Scott Violet
*/
@SuppressWarnings("serial") // JDK-implementation class
-public class BakedArrayList extends ArrayList<Object> {
+public class BakedArrayList<E> extends ArrayList<E> {
/**
* The cached hashCode.
*/
@@ -54,7 +54,7 @@
super(size);
}
- public BakedArrayList(java.util.List<?> data) {
+ public BakedArrayList(java.util.List<? extends E> data) {
this(data.size());
for (int counter = 0, max = data.size(); counter < max; counter++){
add(data.get(counter));
@@ -78,7 +78,8 @@
}
public boolean equals(Object o) {
- BakedArrayList list = (BakedArrayList)o;
+ @SuppressWarnings("unchecked")
+ BakedArrayList<E> list = (BakedArrayList)o;
int size = size();
if (list.size() != size) {
--- a/jdk/src/share/classes/sun/text/normalizer/UnicodeSet.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/text/normalizer/UnicodeSet.java Fri Jul 25 09:44:53 2014 +0000
@@ -367,6 +367,7 @@
* copied to this object
* @stable ICU 2.0
*/
+ @SuppressWarnings("unchecked") // Casting result of clone of a collection
public UnicodeSet set(UnicodeSet other) {
list = other.list.clone();
len = other.len;
--- a/jdk/src/share/classes/sun/tools/asm/Assembler.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/asm/Assembler.java Fri Jul 25 09:44:53 2014 +0000
@@ -558,7 +558,7 @@
case opc_tableswitch: {
SwitchData sw = (SwitchData)inst.value;
for (int i = sw.minValue; i <= sw.maxValue; i++) {
- TableLot.addElement(new Cover(CT_CASE, sw.whereCase(new Integer(i)), inst.pc));
+ TableLot.addElement(new Cover(CT_CASE, sw.whereCase(i), inst.pc));
count++;
}
if (!sw.getDefault()) {
--- a/jdk/src/share/classes/sun/tools/asm/Instruction.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/asm/Instruction.java Fri Jul 25 09:44:53 2014 +0000
@@ -142,7 +142,7 @@
// Don't keep the LocalVariable info around, unless we
// are actually going to generate a local variable table.
if ((value instanceof LocalVariable) && !env.debug_vars()) {
- value = new Integer(((LocalVariable)value).slot);
+ value = ((LocalVariable)value).slot;
}
break;
--- a/jdk/src/share/classes/sun/tools/java/BinaryConstantPool.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/java/BinaryConstantPool.java Fri Jul 25 09:44:53 2014 +0000
@@ -60,7 +60,7 @@
break;
case CONSTANT_INTEGER:
- cpool[i] = new Integer(in.readInt());
+ cpool[i] = in.readInt();
break;
case CONSTANT_FLOAT:
cpool[i] = new Float(in.readFloat());
@@ -76,7 +76,7 @@
case CONSTANT_STRING:
// JVM 4.4.3 CONSTANT_String_info.string_index
// or JVM 4.4.1 CONSTANT_Class_info.name_index
- cpool[i] = new Integer(in.readUnsignedShort());
+ cpool[i] =in.readUnsignedShort();
break;
case CONSTANT_FIELD:
@@ -84,7 +84,7 @@
case CONSTANT_INTERFACEMETHOD:
case CONSTANT_NAMEANDTYPE:
// JVM 4.4.2 CONSTANT_*ref_info.class_index & name_and_type_index
- cpool[i] = new Integer((in.readUnsignedShort() << 16) | in.readUnsignedShort());
+ cpool[i] = (in.readUnsignedShort() << 16) | in.readUnsignedShort();
break;
case CONSTANT_METHODHANDLE:
@@ -260,7 +260,7 @@
Integer result = (Integer)indexHashAscii.get(string);
if (result == null) {
if (MoreStuff == null) MoreStuff = new Vector();
- result = new Integer(cpool.length + MoreStuff.size());
+ result = cpool.length + MoreStuff.size();
MoreStuff.addElement(string);
indexHashAscii.put(string, result);
}
@@ -277,10 +277,10 @@
indexHashAscii = new Hashtable();
for (int i = 1; i < cpool.length; i++) {
if (types[i] == CONSTANT_UTF8) {
- indexHashAscii.put(cpool[i], new Integer(i));
+ indexHashAscii.put(cpool[i], i);
} else {
try {
- indexHashObject.put(getConstant(i, env), new Integer(i));
+ indexHashObject.put(getConstant(i, env), i);
} catch (ClassFormatError e) { }
}
}
--- a/jdk/src/share/classes/sun/tools/java/Identifier.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/java/Identifier.java Fri Jul 25 09:44:53 2014 +0000
@@ -106,7 +106,7 @@
* Set the type of the identifier.
*/
void setType(int t) {
- value = new Integer(t);
+ value = t;
//System.out.println("type(" + this + ")=" + t);
}
--- a/jdk/src/share/classes/sun/tools/javac/BatchEnvironment.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/javac/BatchEnvironment.java Fri Jul 25 09:44:53 2014 +0000
@@ -1172,7 +1172,7 @@
if (!hitErrorLimit) {
hitErrorLimit = true;
output(errorString("too.many.errors",
- new Integer(errorLimit),null,null));
+ errorLimit,null,null));
}
return;
}
--- a/jdk/src/share/classes/sun/tools/javac/Main.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/javac/Main.java Fri Jul 25 09:44:53 2014 +0000
@@ -669,18 +669,18 @@
if (env.deprecation()) {
if (ndepfiles > 1) {
env.error(0, "warn.note.deprecations",
- new Integer(ndepfiles), new Integer(ndeps));
+ ndepfiles, ndeps);
} else {
env.error(0, "warn.note.1deprecation",
- file1, new Integer(ndeps));
+ file1, ndeps);
}
} else {
if (ndepfiles > 1) {
env.error(0, "warn.note.deprecations.silent",
- new Integer(ndepfiles), new Integer(ndeps));
+ ndepfiles, ndeps);
} else {
env.error(0, "warn.note.1deprecation.silent",
- file1, new Integer(ndeps));
+ file1, ndeps);
}
}
}
--- a/jdk/src/share/classes/sun/tools/javac/SourceMember.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/javac/SourceMember.java Fri Jul 25 09:44:53 2014 +0000
@@ -885,7 +885,7 @@
// instance initializers. Code for these is generated
// in the makeVarInits() method of the class
// MethodExpression.
- asm.add(getWhere(), opc_aload, new Integer(0));
+ asm.add(getWhere(), opc_aload, 0);
e.codeValue(env, ctx, asm);
asm.add(getWhere(), opc_putfield, this);
}
--- a/jdk/src/share/classes/sun/tools/jconsole/inspector/TableSorter.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/TableSorter.java Fri Jul 25 09:44:53 2014 +0000
@@ -217,17 +217,17 @@
}
}
- private Vector<?> getRow(int row) {
- return (Vector) dataVector.elementAt(row);
+ private Vector<Object> getRow(int row) {
+ return dataVector.elementAt(row);
}
@SuppressWarnings("unchecked")
- private void setRow(Vector<?> data, int row) {
+ private void setRow(Vector<Object> data, int row) {
dataVector.setElementAt(data,row);
}
private void swap(int i, int j, int column) {
- Vector<?> data = getRow(i);
+ Vector<Object> data = getRow(i);
setRow(getRow(j),i);
setRow(data,j);
--- a/jdk/src/share/classes/sun/tools/jstat/Jstat.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/jstat/Jstat.java Fri Jul 25 09:44:53 2014 +0000
@@ -158,7 +158,7 @@
// handle target termination events for targets other than ourself
HostListener terminator = new HostListener() {
public void vmStatusChanged(VmStatusChangeEvent ev) {
- Integer lvmid = new Integer(vmId.getLocalVmId());
+ Integer lvmid = vmId.getLocalVmId();
if (ev.getTerminated().contains(lvmid)) {
logger.stopLogging();
} else if (!ev.getActive().contains(lvmid)) {
--- a/jdk/src/share/classes/sun/tools/jstatd/RemoteHostImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/jstatd/RemoteHostImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -62,7 +62,7 @@
public RemoteVm attachVm(int lvmid, String mode)
throws RemoteException, MonitorException {
- Integer v = new Integer(lvmid);
+ Integer v = lvmid;
RemoteVm stub = null;
StringBuilder sb = new StringBuilder();
--- a/jdk/src/share/classes/sun/tools/tree/ArrayExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/ArrayExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -92,16 +92,16 @@
*/
public void codeValue(Environment env, Context ctx, Assembler asm) {
int t = 0;
- asm.add(where, opc_ldc, new Integer(args.length));
+ asm.add(where, opc_ldc, args.length);
switch (type.getElementType().getTypeCode()) {
- case TC_BOOLEAN: asm.add(where, opc_newarray, new Integer(T_BOOLEAN)); break;
- case TC_BYTE: asm.add(where, opc_newarray, new Integer(T_BYTE)); break;
- case TC_SHORT: asm.add(where, opc_newarray, new Integer(T_SHORT)); break;
- case TC_CHAR: asm.add(where, opc_newarray, new Integer(T_CHAR)); break;
- case TC_INT: asm.add(where, opc_newarray, new Integer(T_INT)); break;
- case TC_LONG: asm.add(where, opc_newarray, new Integer(T_LONG)); break;
- case TC_FLOAT: asm.add(where, opc_newarray, new Integer(T_FLOAT)); break;
- case TC_DOUBLE: asm.add(where, opc_newarray, new Integer(T_DOUBLE)); break;
+ case TC_BOOLEAN: asm.add(where, opc_newarray, T_BOOLEAN); break;
+ case TC_BYTE: asm.add(where, opc_newarray, T_BYTE); break;
+ case TC_SHORT: asm.add(where, opc_newarray, T_SHORT); break;
+ case TC_CHAR: asm.add(where, opc_newarray, T_CHAR); break;
+ case TC_INT: asm.add(where, opc_newarray, T_INT); break;
+ case TC_LONG: asm.add(where, opc_newarray, T_LONG); break;
+ case TC_FLOAT: asm.add(where, opc_newarray, T_FLOAT); break;
+ case TC_DOUBLE: asm.add(where, opc_newarray, T_DOUBLE); break;
case TC_ARRAY:
asm.add(where, opc_anewarray, type.getElementType());
@@ -122,7 +122,7 @@
if (args[i].equalsDefault()) continue;
asm.add(where, opc_dup);
- asm.add(where, opc_ldc, new Integer(i));
+ asm.add(where, opc_ldc, i);
args[i].codeValue(env, ctx, asm);
switch (type.getElementType().getTypeCode()) {
case TC_BOOLEAN:
--- a/jdk/src/share/classes/sun/tools/tree/BinaryExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/BinaryExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -212,10 +212,10 @@
Label l2 = new Label();
codeBranch(env, ctx, asm, l1, true);
- asm.add(true, where, opc_ldc, new Integer(0));
+ asm.add(true, where, opc_ldc, 0);
asm.add(true, where, opc_goto, l2);
asm.add(l1);
- asm.add(true, where, opc_ldc, new Integer(1));
+ asm.add(true, where, opc_ldc, 1);
asm.add(l2);
} else {
left.codeValue(env, ctx, asm);
--- a/jdk/src/share/classes/sun/tools/tree/BitNotExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/BitNotExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -80,7 +80,7 @@
public void codeValue(Environment env, Context ctx, Assembler asm) {
right.codeValue(env, ctx, asm);
if (type.isType(TC_INT)) {
- asm.add(where, opc_ldc, new Integer(-1));
+ asm.add(where, opc_ldc, -1);
asm.add(where, opc_ixor);
} else {
asm.add(where, opc_ldc2_w, -1L);
--- a/jdk/src/share/classes/sun/tools/tree/BooleanExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/BooleanExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -52,7 +52,7 @@
* Get the value
*/
public Object getValue() {
- return new Integer(value ? 1 : 0);
+ return value ? 1 : 0;
}
/**
@@ -106,7 +106,7 @@
}
}
public void codeValue(Environment env, Context ctx, Assembler asm) {
- asm.add(where, opc_ldc, new Integer(value ? 1 : 0));
+ asm.add(where, opc_ldc, value ? 1 : 0);
}
/**
--- a/jdk/src/share/classes/sun/tools/tree/Expression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/Expression.java Fri Jul 25 09:44:53 2014 +0000
@@ -432,10 +432,10 @@
Label l2 = new Label();
codeBranch(env, ctx, asm, l1, true);
- asm.add(true, where, opc_ldc, new Integer(0));
+ asm.add(true, where, opc_ldc, 0);
asm.add(true, where, opc_goto, l2);
asm.add(l1);
- asm.add(true, where, opc_ldc, new Integer(1));
+ asm.add(true, where, opc_ldc, 1);
asm.add(l2);
} else {
throw new CompilerError("codeValue");
--- a/jdk/src/share/classes/sun/tools/tree/FinallyStatement.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/FinallyStatement.java Fri Jul 25 09:44:53 2014 +0000
@@ -287,8 +287,8 @@
// allocate space for the exception and return address
f1 = new LocalMember(where, thisClass, 0, Type.tObject, null);
f2 = new LocalMember(where, thisClass, 0, Type.tInt, null);
- num1 = new Integer(ctx.declare(env, f1));
- num2 = new Integer(ctx.declare(env, f2));
+ num1 = ctx.declare(env, f1);
+ num2 = ctx.declare(env, f2);
}
TryData td = new TryData();
--- a/jdk/src/share/classes/sun/tools/tree/IdentifierExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/IdentifierExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -452,7 +452,7 @@
}
void codeLoad(Environment env, Context ctx, Assembler asm) {
asm.add(where, opc_iload + type.getTypeCodeOffset(),
- new Integer(((LocalMember)field).number));
+ ((LocalMember)field).number);
}
void codeStore(Environment env, Context ctx, Assembler asm) {
LocalMember local = (LocalMember)field;
@@ -474,4 +474,4 @@
implementation.print(out);
}
}
-}
+}
\ No newline at end of file
--- a/jdk/src/share/classes/sun/tools/tree/IncDecExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/IncDecExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -112,22 +112,22 @@
private void codeIncDecOp(Assembler asm, boolean inc) {
switch (type.getTypeCode()) {
case TC_BYTE:
- asm.add(where, opc_ldc, new Integer(1));
+ asm.add(where, opc_ldc, 1);
asm.add(where, inc ? opc_iadd : opc_isub);
asm.add(where, opc_i2b);
break;
case TC_SHORT:
- asm.add(where, opc_ldc, new Integer(1));
+ asm.add(where, opc_ldc, 1);
asm.add(where, inc ? opc_iadd : opc_isub);
asm.add(where, opc_i2s);
break;
case TC_CHAR:
- asm.add(where, opc_ldc, new Integer(1));
+ asm.add(where, opc_ldc, 1);
asm.add(where, inc ? opc_iadd : opc_isub);
asm.add(where, opc_i2c);
break;
case TC_INT:
- asm.add(where, opc_ldc, new Integer(1));
+ asm.add(where, opc_ldc, 1);
asm.add(where, inc ? opc_iadd : opc_isub);
break;
case TC_LONG:
--- a/jdk/src/share/classes/sun/tools/tree/InlineNewInstanceExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/InlineNewInstanceExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -93,11 +93,11 @@
LocalMember v = (LocalMember)field.getArguments().elementAt(0);
CodeContext newctx = new CodeContext(ctx, this);
newctx.declare(env, v);
- asm.add(where, opc_astore, new Integer(v.number));
+ asm.add(where, opc_astore, v.number);
body.code(env, newctx, asm);
asm.add(newctx.breakLabel);
if (forValue) {
- asm.add(where, opc_aload, new Integer(v.number));
+ asm.add(where, opc_aload, v.number);
}
}
}
--- a/jdk/src/share/classes/sun/tools/tree/IntegerExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/IntegerExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -70,7 +70,7 @@
* Get the value
*/
public Object getValue() {
- return new Integer(value);
+ return value;
}
/**
@@ -91,6 +91,6 @@
* Code
*/
public void codeValue(Environment env, Context ctx, Assembler asm) {
- asm.add(where, opc_ldc, new Integer(value));
+ asm.add(where, opc_ldc, value);
}
}
--- a/jdk/src/share/classes/sun/tools/tree/MethodExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/MethodExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -857,7 +857,7 @@
right.code(env, ctx, asm);
}
} else if (right == null) {
- asm.add(where, opc_aload, new Integer(0));
+ asm.add(where, opc_aload, 0);
} else if (right.op == SUPER) {
// 'super.<method>(...)', 'super(...)', or '<expr>.super(...)'
/*****
--- a/jdk/src/share/classes/sun/tools/tree/NewArrayExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/NewArrayExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -133,21 +133,21 @@
switch (type.getElementType().getTypeCode()) {
case TC_BOOLEAN:
- asm.add(where, opc_newarray, new Integer(T_BOOLEAN)); break;
+ asm.add(where, opc_newarray, T_BOOLEAN); break;
case TC_BYTE:
- asm.add(where, opc_newarray, new Integer(T_BYTE)); break;
+ asm.add(where, opc_newarray, T_BYTE); break;
case TC_SHORT:
- asm.add(where, opc_newarray, new Integer(T_SHORT)); break;
+ asm.add(where, opc_newarray, T_SHORT); break;
case TC_CHAR:
- asm.add(where, opc_newarray, new Integer(T_CHAR)); break;
+ asm.add(where, opc_newarray, T_CHAR); break;
case TC_INT:
- asm.add(where, opc_newarray, new Integer(T_INT)); break;
+ asm.add(where, opc_newarray, T_INT); break;
case TC_LONG:
- asm.add(where, opc_newarray, new Integer(T_LONG)); break;
+ asm.add(where, opc_newarray, T_LONG); break;
case TC_FLOAT:
- asm.add(where, opc_newarray, new Integer(T_FLOAT)); break;
+ asm.add(where, opc_newarray, T_FLOAT); break;
case TC_DOUBLE:
- asm.add(where, opc_newarray, new Integer(T_DOUBLE)); break;
+ asm.add(where, opc_newarray, T_DOUBLE); break;
case TC_ARRAY:
asm.add(where, opc_anewarray, type.getElementType()); break;
case TC_CLASS:
--- a/jdk/src/share/classes/sun/tools/tree/NotExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/NotExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -139,7 +139,7 @@
*/
public void codeValue(Environment env, Context ctx, Assembler asm) {
right.codeValue(env, ctx, asm);
- asm.add(where, opc_ldc, new Integer(1));
+ asm.add(where, opc_ldc, 1);
asm.add(where, opc_ixor);
}
--- a/jdk/src/share/classes/sun/tools/tree/Statement.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/Statement.java Fri Jul 25 09:44:53 2014 +0000
@@ -249,7 +249,7 @@
// Save the return value in the register which should have
// been reserved.
LocalMember lf = ctx.getLocalField(idFinallyReturnValue);
- num = new Integer(lf.number);
+ num = lf.number;
asm.add(where, opc_istore + save.getTypeCodeOffset(), num);
} else {
// Pop the return value.
--- a/jdk/src/share/classes/sun/tools/tree/SynchronizedStatement.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/SynchronizedStatement.java Fri Jul 25 09:44:53 2014 +0000
@@ -125,8 +125,8 @@
LocalMember f1 = new LocalMember(where, clazz, 0, Type.tObject, null);
LocalMember f2 = new LocalMember(where, clazz, 0, Type.tInt, null);
- Integer num1 = new Integer(ctx.declare(env, f1));
- Integer num2 = new Integer(ctx.declare(env, f2));
+ Integer num1 = ctx.declare(env, f1);
+ Integer num2 = ctx.declare(env, f2);
Label endLabel = new Label();
--- a/jdk/src/share/classes/sun/tools/tree/ThisExpression.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/tools/tree/ThisExpression.java Fri Jul 25 09:44:53 2014 +0000
@@ -169,7 +169,7 @@
* Code
*/
public void codeValue(Environment env, Context ctx, Assembler asm) {
- asm.add(where, opc_aload, new Integer(field.number));
+ asm.add(where, opc_aload, field.number);
}
/**
--- a/jdk/src/share/classes/sun/util/locale/provider/DictionaryBasedBreakIterator.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/classes/sun/util/locale/provider/DictionaryBasedBreakIterator.java Fri Jul 25 09:44:53 2014 +0000
@@ -461,10 +461,10 @@
if ((currentBreakPositions.size() == 0 ||
currentBreakPositions.peek().intValue() != text.getIndex())
&& text.getIndex() != startPos) {
- currentBreakPositions.push(new Integer(text.getIndex()));
+ currentBreakPositions.push(text.getIndex());
}
getNext();
- currentBreakPositions.push(new Integer(text.getIndex()));
+ currentBreakPositions.push(text.getIndex());
}
}
--- a/jdk/src/share/javavm/export/jvm.h Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/javavm/export/jvm.h Fri Jul 25 09:44:53 2014 +0000
@@ -444,9 +444,6 @@
JNIEXPORT jboolean JNICALL
JVM_IsPrimitiveClass(JNIEnv *env, jclass cls);
-JNIEXPORT jclass JNICALL
-JVM_GetComponentType(JNIEnv *env, jclass cls);
-
JNIEXPORT jint JNICALL
JVM_GetClassModifiers(JNIEnv *env, jclass cls);
--- a/jdk/src/share/lib/security/java.security-linux Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/lib/security/java.security-linux Fri Jul 25 09:44:53 2014 +0000
@@ -209,8 +209,8 @@
org.jcp.xml.dsig.internal.,\
jdk.internal.,\
jdk.nashorn.internal.,\
- jdk.nashorn.tools.
-
+ jdk.nashorn.tools.,\
+ com.sun.activation.registries.
#
# List of comma-separated packages that start with or equal this string
@@ -255,8 +255,8 @@
org.jcp.xml.dsig.internal.,\
jdk.internal.,\
jdk.nashorn.internal.,\
- jdk.nashorn.tools.
-
+ jdk.nashorn.tools.,\
+ com.sun.activation.registries.
#
# Determines whether this properties file can be appended to
--- a/jdk/src/share/lib/security/java.security-macosx Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/lib/security/java.security-macosx Fri Jul 25 09:44:53 2014 +0000
@@ -211,6 +211,7 @@
jdk.internal.,\
jdk.nashorn.internal.,\
jdk.nashorn.tools.,\
+ com.sun.activation.registries.,\
apple.
#
@@ -257,6 +258,7 @@
jdk.internal.,\
jdk.nashorn.internal.,\
jdk.nashorn.tools.,\
+ com.sun.activation.registries.,\
apple.
#
--- a/jdk/src/share/lib/security/java.security-solaris Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/lib/security/java.security-solaris Fri Jul 25 09:44:53 2014 +0000
@@ -211,7 +211,8 @@
org.jcp.xml.dsig.internal.,\
jdk.internal.,\
jdk.nashorn.internal.,\
- jdk.nashorn.tools.
+ jdk.nashorn.tools.,\
+ com.sun.activation.registries.
#
# List of comma-separated packages that start with or equal this string
@@ -256,7 +257,8 @@
org.jcp.xml.dsig.internal.,\
jdk.internal.,\
jdk.nashorn.internal.,\
- jdk.nashorn.tools.
+ jdk.nashorn.tools.,\
+ com.sun.activation.registries.
#
# Determines whether this properties file can be appended to
--- a/jdk/src/share/lib/security/java.security-windows Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/lib/security/java.security-windows Fri Jul 25 09:44:53 2014 +0000
@@ -211,6 +211,7 @@
jdk.internal.,\
jdk.nashorn.internal.,\
jdk.nashorn.tools.,\
+ com.sun.activation.registries.,\
com.sun.java.accessibility.
#
@@ -257,6 +258,7 @@
jdk.internal.,\
jdk.nashorn.internal.,\
jdk.nashorn.tools.,\
+ com.sun.activation.registries.,\
com.sun.java.accessibility.
#
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -79,6 +79,7 @@
#define ERROR_RESOURCE "Cannot extract resource file"
#define ERROR_OVERFLOW "Internal buffer overflow"
#define ERROR_INTERNAL "Internal error"
+#define ERROR_INIT "cannot init class members"
#define LOGFILE_STDOUT "-"
#define LOGFILE_STDERR ""
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -56,6 +56,45 @@
#define THROW_IOE(x) JNU_ThrowIOException(env,x)
+#define CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(CERVTI_exception, CERVTI_message) \
+ do { \
+ if ((env)->ExceptionOccurred()) { \
+ THROW_IOE(CERVTI_message); \
+ return; \
+ } \
+ if ((CERVTI_exception) == NULL) { \
+ THROW_IOE(CERVTI_message); \
+ return; \
+ } \
+ } while (JNI_FALSE)
+
+
+#define CHECK_EXCEPTION_RETURN_VALUE(CERL_exception, CERL_return_value) \
+ do { \
+ if ((env)->ExceptionOccurred()) { \
+ return CERL_return_value; \
+ } \
+ if ((CERL_exception) == NULL) { \
+ return CERL_return_value; \
+ } \
+ } while (JNI_FALSE)
+
+
+// If these useful macros aren't defined in jni_util.h then define them here
+#ifndef CHECK_NULL_RETURN
+#define CHECK_NULL_RETURN(x, y) \
+ do { \
+ if ((x) == NULL) return (y); \
+ } while (JNI_FALSE)
+#endif
+
+#ifndef CHECK_EXCEPTION_RETURN
+#define CHECK_EXCEPTION_RETURN(env, y) \
+ do { \
+ if ((*env)->ExceptionCheck(env)) return (y); \
+ } while (JNI_FALSE)
+#endif
+
static jlong read_input_via_jni(unpacker* self,
void* buf, jlong minlen, jlong maxlen);
@@ -92,9 +131,11 @@
vm->GetEnv(&envRaw, JNI_VERSION_1_1);
JNIEnv* env = (JNIEnv*) envRaw;
//fprintf(stderr, "get_unpacker() env=%p\n", env);
- if (env == null)
- return null;
+ CHECK_NULL_RETURN(env, NULL);
jobject pObj = env->CallStaticObjectMethod(NIclazz, currentInstMID);
+ // We should check upon the known non-null variable because here we want to check
+ // only for pending exceptions. If pObj is null we'll deal with it later.
+ CHECK_EXCEPTION_RETURN_VALUE(env, NULL);
//fprintf(stderr, "get_unpacker0() pObj=%p\n", pObj);
if (pObj != null) {
// Got pObj and env; now do it the easy way.
@@ -137,20 +178,20 @@
while( dbg != null) { sleep(10); }
#endif
NIclazz = (jclass) env->NewGlobalRef(clazz);
+
unpackerPtrFID = env->GetFieldID(clazz, "unpackerPtr", "J");
+ CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(unpackerPtrFID, ERROR_INIT);
+
currentInstMID = env->GetStaticMethodID(clazz, "currentInstance",
"()Ljava/lang/Object;");
+ CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(currentInstMID, ERROR_INIT);
+
readInputMID = env->GetMethodID(clazz, "readInputFn",
"(Ljava/nio/ByteBuffer;J)J");
- getUnpackerPtrMID = env->GetMethodID(clazz, "getUnpackerPtr", "()J");
+ CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(readInputMID, ERROR_INIT);
- if (unpackerPtrFID == null ||
- currentInstMID == null ||
- readInputMID == null ||
- NIclazz == null ||
- getUnpackerPtrMID == null) {
- THROW_IOE("cannot init class members");
- }
+ getUnpackerPtrMID = env->GetMethodID(clazz, "getUnpackerPtr", "()J");
+ CHECK_EXCEPTION_RETURN_VOID_THROW_IOE(getUnpackerPtrMID, ERROR_INIT);
}
JNIEXPORT jlong JNICALL
@@ -160,9 +201,7 @@
// valid object pointers and env is intact, if not now is good time to bail.
unpacker* uPtr = get_unpacker();
//fprintf(stderr, "start(%p) uPtr=%p initializing\n", pObj, uPtr);
- if (uPtr == null) {
- return -1;
- }
+ CHECK_EXCEPTION_RETURN_VALUE(uPtr, -1);
// redirect our io to the default log file or whatever.
uPtr->redirect_stdio();
@@ -200,6 +239,7 @@
jobjectArray pParts) {
unpacker* uPtr = get_unpacker(env, pObj);
+ CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
unpacker::file* filep = uPtr->get_next_file();
if (uPtr->aborting()) {
@@ -207,32 +247,38 @@
return false;
}
- if (filep == null) {
- return false; // end of the sequence
- }
+ CHECK_NULL_RETURN(filep, false);
assert(filep == &uPtr->cur_file);
int pidx = 0, iidx = 0;
jintArray pIntParts = (jintArray) env->GetObjectArrayElement(pParts, pidx++);
+ CHECK_EXCEPTION_RETURN_VALUE(pIntParts, false);
jint* intParts = env->GetIntArrayElements(pIntParts, null);
intParts[iidx++] = (jint)( (julong)filep->size >> 32 );
intParts[iidx++] = (jint)( (julong)filep->size >> 0 );
intParts[iidx++] = filep->modtime;
intParts[iidx++] = filep->deflate_hint() ? 1 : 0;
env->ReleaseIntArrayElements(pIntParts, intParts, JNI_COMMIT);
-
- env->SetObjectArrayElement(pParts, pidx++, env->NewStringUTF(filep->name));
-
+ jstring filename = env->NewStringUTF(filep->name);
+ CHECK_EXCEPTION_RETURN_VALUE(filename, false);
+ env->SetObjectArrayElement(pParts, pidx++, filename);
+ CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
jobject pDataBuf = null;
- if (filep->data[0].len > 0)
+ if (filep->data[0].len > 0) {
pDataBuf = env->NewDirectByteBuffer(filep->data[0].ptr,
filep->data[0].len);
+ CHECK_EXCEPTION_RETURN_VALUE(pDataBuf, false);
+ }
env->SetObjectArrayElement(pParts, pidx++, pDataBuf);
+ CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
pDataBuf = null;
- if (filep->data[1].len > 0)
+ if (filep->data[1].len > 0) {
pDataBuf = env->NewDirectByteBuffer(filep->data[1].ptr,
filep->data[1].len);
+ CHECK_EXCEPTION_RETURN_VALUE(pDataBuf, false);
+ }
env->SetObjectArrayElement(pParts, pidx++, pDataBuf);
+ CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
return true;
}
@@ -241,6 +287,7 @@
JNIEXPORT jobject JNICALL
Java_com_sun_java_util_jar_pack_NativeUnpack_getUnusedInput(JNIEnv *env, jobject pObj) {
unpacker* uPtr = get_unpacker(env, pObj);
+ CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
unpacker::file* filep = &uPtr->cur_file;
if (uPtr->aborting()) {
@@ -263,7 +310,7 @@
JNIEXPORT jlong JNICALL
Java_com_sun_java_util_jar_pack_NativeUnpack_finish(JNIEnv *env, jobject pObj) {
unpacker* uPtr = get_unpacker(env, pObj, false);
- if (uPtr == null) return 0;
+ CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
size_t consumed = uPtr->input_consumed();
free_unpacker(env, pObj, uPtr);
return consumed;
@@ -274,7 +321,9 @@
jstring pProp, jstring pValue) {
unpacker* uPtr = get_unpacker(env, pObj);
const char* prop = env->GetStringUTFChars(pProp, JNI_FALSE);
+ CHECK_EXCEPTION_RETURN_VALUE(prop, false);
const char* value = env->GetStringUTFChars(pValue, JNI_FALSE);
+ CHECK_EXCEPTION_RETURN_VALUE(value, false);
jboolean retval = uPtr->set_option(prop, value);
env->ReleaseStringUTFChars(pProp, prop);
env->ReleaseStringUTFChars(pValue, value);
@@ -286,9 +335,11 @@
jstring pProp) {
unpacker* uPtr = get_unpacker(env, pObj);
+ CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
const char* prop = env->GetStringUTFChars(pProp, JNI_FALSE);
+ CHECK_EXCEPTION_RETURN_VALUE(prop, NULL);
const char* value = uPtr->get_option(prop);
+ CHECK_EXCEPTION_RETURN_VALUE(value, NULL);
env->ReleaseStringUTFChars(pProp, prop);
- if (value == null) return null;
return env->NewStringUTF(value);
}
--- a/jdk/src/share/native/java/lang/Class.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/native/java/lang/Class.c Fri Jul 25 09:44:53 2014 +0000
@@ -60,7 +60,6 @@
{"setSigners", "([" OBJ ")V", (void *)&JVM_SetClassSigners},
{"isArray", "()Z", (void *)&JVM_IsArrayClass},
{"isPrimitive", "()Z", (void *)&JVM_IsPrimitiveClass},
- {"getComponentType", "()" CLS, (void *)&JVM_GetComponentType},
{"getModifiers", "()I", (void *)&JVM_GetClassModifiers},
{"getDeclaredFields0","(Z)[" FLD, (void *)&JVM_GetClassDeclaredFields},
{"getDeclaredMethods0","(Z)[" MHD, (void *)&JVM_GetClassDeclaredMethods},
--- a/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c Fri Jul 25 09:44:53 2014 +0000
@@ -373,14 +373,14 @@
/* Parse the source image */
- if ((status = awt_parseImage(env, jsrc, &srcImageP, FALSE)) <= 0) {
+ if (awt_parseImage(env, jsrc, &srcImageP, FALSE) <= 0) {
/* Can't handle any custom images */
free(dkern);
return 0;
}
/* Parse the destination image */
- if ((status = awt_parseImage(env, jdst, &dstImageP, FALSE)) <= 0) {
+ if (awt_parseImage(env, jdst, &dstImageP, FALSE) <= 0) {
/* Can't handle any custom images */
awt_freeParsedImage(srcImageP, TRUE);
free(dkern);
@@ -627,7 +627,7 @@
}
/* Parse the source raster */
- if ((status = awt_parseRaster(env, jsrc, srcRasterP)) <= 0) {
+ if (awt_parseRaster(env, jsrc, srcRasterP) <= 0) {
/* Can't handle any custom rasters */
free(srcRasterP);
free(dstRasterP);
@@ -636,7 +636,7 @@
}
/* Parse the destination raster */
- if ((status = awt_parseRaster(env, jdst, dstRasterP)) <= 0) {
+ if (awt_parseRaster(env, jdst, dstRasterP) <= 0) {
/* Can't handle any custom images */
awt_freeParsedRaster(srcRasterP, TRUE);
free(dstRasterP);
@@ -839,13 +839,13 @@
(*env)->ReleasePrimitiveArrayCritical(env, jmatrix, matrix, JNI_ABORT);
/* Parse the source image */
- if ((status = awt_parseImage(env, jsrc, &srcImageP, FALSE)) <= 0) {
+ if (awt_parseImage(env, jsrc, &srcImageP, FALSE) <= 0) {
/* Can't handle any custom images */
return 0;
}
/* Parse the destination image */
- if ((status = awt_parseImage(env, jdst, &dstImageP, FALSE)) <= 0) {
+ if (awt_parseImage(env, jdst, &dstImageP, FALSE) <= 0) {
/* Can't handle any custom images */
awt_freeParsedImage(srcImageP, TRUE);
return 0;
@@ -1059,7 +1059,7 @@
(*env)->ReleasePrimitiveArrayCritical(env, jmatrix, matrix, JNI_ABORT);
/* Parse the source raster */
- if ((status = awt_parseRaster(env, jsrc, srcRasterP)) <= 0) {
+ if (awt_parseRaster(env, jsrc, srcRasterP) <= 0) {
/* Can't handle any custom rasters */
free(srcRasterP);
free(dstRasterP);
@@ -1067,7 +1067,7 @@
}
/* Parse the destination raster */
- if ((status = awt_parseRaster(env, jdst, dstRasterP)) <= 0) {
+ if (awt_parseRaster(env, jdst, dstRasterP) <= 0) {
/* Can't handle any custom images */
awt_freeParsedRaster(srcRasterP, TRUE);
free(dstRasterP);
@@ -1306,13 +1306,13 @@
if (s_timeIt) (*start_timer)(3600);
/* Parse the source image */
- if ((status = awt_parseImage(env, jsrc, &srcImageP, FALSE)) <= 0) {
+ if (awt_parseImage(env, jsrc, &srcImageP, FALSE) <= 0) {
/* Can't handle any custom images */
return 0;
}
/* Parse the destination image */
- if ((status = awt_parseImage(env, jdst, &dstImageP, FALSE)) <= 0) {
+ if (awt_parseImage(env, jdst, &dstImageP, FALSE) <= 0) {
/* Can't handle any custom images */
awt_freeParsedImage(srcImageP, TRUE);
return 0;
@@ -1554,14 +1554,14 @@
}
/* Parse the source raster - reject custom images */
- if ((status = awt_parseRaster(env, jsrc, srcRasterP)) <= 0) {
+ if (awt_parseRaster(env, jsrc, srcRasterP) <= 0) {
free(srcRasterP);
free(dstRasterP);
return 0;
}
/* Parse the destination image - reject custom images */
- if ((status = awt_parseRaster(env, jdst, dstRasterP)) <= 0) {
+ if (awt_parseRaster(env, jdst, dstRasterP) <= 0) {
awt_freeParsedRaster(srcRasterP, TRUE);
free(dstRasterP);
return 0;
--- a/jdk/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c Fri Jul 25 09:44:53 2014 +0000
@@ -220,3 +220,18 @@
(*env)->ReleaseByteArrayElements(env, data, pBytes, JNI_ABORT);
return rc ? JNI_TRUE : JNI_FALSE;
}
+
+/*
+ * Class: java_awt_SplashScreen
+ * Method: _getScaleFactor
+ * Signature: (J)F
+ */
+JNIEXPORT jfloat JNICALL Java_java_awt_SplashScreen__1getScaleFactor
+(JNIEnv *env, jclass thisClass, jlong jsplash)
+{
+ Splash *splash = (Splash *) jlong_to_ptr(jsplash);
+ if (!splash) {
+ return 1;
+ }
+ return splash->scaleFactor;
+}
\ No newline at end of file
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_impl.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_impl.c Fri Jul 25 09:44:53 2014 +0000
@@ -59,6 +59,7 @@
memset(splash, 0, sizeof(Splash));
splash->currentFrame = -1;
+ splash->scaleFactor = 1;
initFormat(&splash->imageFormat, QUAD_RED_MASK, QUAD_GREEN_MASK,
QUAD_BLUE_MASK, QUAD_ALPHA_MASK);
SplashInitPlatform(splash);
@@ -101,6 +102,13 @@
SplashSetFileJarName(NULL, NULL);
}
+SPLASHEXPORT void
+SplashSetScaleFactor(float scaleFactor)
+{
+ Splash *splash = SplashGetInstance();
+ splash->scaleFactor = scaleFactor;
+}
+
void
SplashDone(Splash * splash)
{
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_impl.h Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_impl.h Fri Jul 25 09:44:53 2014 +0000
@@ -35,6 +35,9 @@
SPLASHEXPORT void SplashInit(void);
SPLASHEXPORT void SplashClose(void);
+SPLASHEXPORT void SplashSetScaleFactor(float);
+SPLASHEXPORT char* SplashGetScaledImageName(const char*, const char*, float*);
+
SPLASHEXPORT void
SplashSetFileJarName(const char* fileName, const char* jarName);
@@ -79,6 +82,7 @@
int fileNameLen;
char* jarName; /* stored in 16-bit unicode (jchars) */
int jarNameLen;
+ float scaleFactor;
#if defined(WITH_WIN32)
BOOL isLayered;
HWND hWnd;
@@ -115,6 +119,8 @@
unsigned SplashTime();
char* SplashConvertStringAlloc(const char* in, int *size);
+char* SplashGetScaledImageName(const char* jarName,
+ const char* fileName, float *scaleFactor);
void SplashLock(Splash * splash);
void SplashUnlock(Splash * splash);
@@ -138,6 +144,7 @@
void SplashUpdateScreenData(Splash * splash);
void SplashCleanup(Splash * splash);
+void SplashSetScaleFactor(float scaleFactor);
typedef struct SplashStream {
--- a/jdk/src/share/native/sun/font/DrawGlyphList.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/native/sun/font/DrawGlyphList.c Fri Jul 25 09:44:53 2014 +0000
@@ -52,7 +52,8 @@
GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist) {
- int g, bytesNeeded;
+ int g;
+ size_t bytesNeeded;
jlong *imagePtrs;
jfloat* positions = NULL;
GlyphInfo *ginfo;
@@ -71,6 +72,9 @@
bytesNeeded = sizeof(GlyphBlitVector)+sizeof(ImageRef)*len;
gbv = (GlyphBlitVector*)malloc(bytesNeeded);
+ if (gbv == NULL) {
+ return NULL;
+ }
gbv->numGlyphs = len;
gbv->glyphs = (ImageRef*)((unsigned char*)gbv+sizeof(GlyphBlitVector));
@@ -479,7 +483,8 @@
*/
GlyphBlitVector* setupLCDBlitVector(JNIEnv *env, jobject glyphlist) {
- int g, bytesNeeded;
+ int g;
+ size_t bytesNeeded;
jlong *imagePtrs;
jfloat* positions = NULL;
GlyphInfo *ginfo;
@@ -500,6 +505,9 @@
bytesNeeded = sizeof(GlyphBlitVector)+sizeof(ImageRef)*len;
gbv = (GlyphBlitVector*)malloc(bytesNeeded);
+ if (gbv == NULL) {
+ return NULL;
+ }
gbv->numGlyphs = len;
gbv->glyphs = (ImageRef*)((unsigned char*)gbv+sizeof(GlyphBlitVector));
--- a/jdk/src/share/native/sun/font/freetypeScaler.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/native/sun/font/freetypeScaler.c Fri Jul 25 09:44:53 2014 +0000
@@ -177,18 +177,10 @@
if (numBytes > FILEDATACACHESIZE) {
bBuffer = (*env)->NewDirectByteBuffer(env, destBuffer, numBytes);
if (bBuffer != NULL) {
- /* Loop until the read succeeds (or EOF).
- * This should improve robustness in the event of a problem in
- * the I/O system. If we find that we ever end up spinning here
- * we are going to have to do some serious work to recover.
- * Just returning without reading the data will cause a crash.
- */
- while (bread == 0) {
- bread = (*env)->CallIntMethod(env,
- scalerInfo->font2D,
- sunFontIDs.ttReadBlockMID,
- bBuffer, offset, numBytes);
- }
+ bread = (*env)->CallIntMethod(env,
+ scalerInfo->font2D,
+ sunFontIDs.ttReadBlockMID,
+ bBuffer, offset, numBytes);
return bread;
} else {
/* We probably hit bug bug 4845371. For reasons that
@@ -224,19 +216,10 @@
(offset + FILEDATACACHESIZE > scalerInfo->fileSize) ?
scalerInfo->fileSize - offset : FILEDATACACHESIZE;
bBuffer = scalerInfo->directBuffer;
- /* Loop until all the read succeeds (or EOF).
- * This should improve robustness in the event of a problem in
- * the I/O system. If we find that we ever end up spinning here
- * we are going to have to do some serious work to recover.
- * Just returning without reading the data will cause a crash.
- */
- while (bread == 0) {
- bread = (*env)->CallIntMethod(env, scalerInfo->font2D,
- sunFontIDs.ttReadBlockMID,
- bBuffer, offset,
- scalerInfo->fontDataLength);
- }
-
+ bread = (*env)->CallIntMethod(env, scalerInfo->font2D,
+ sunFontIDs.ttReadBlockMID,
+ bBuffer, offset,
+ scalerInfo->fontDataLength);
memcpy(destBuffer, scalerInfo->fontData, numBytes);
return numBytes;
}
--- a/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/share/native/sun/security/ec/ECC_JNI.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -66,22 +66,39 @@
free(ecparams);
}
+jbyteArray getEncodedBytes(JNIEnv *env, SECItem *hSECItem)
+{
+ SECItem *s = (SECItem *)hSECItem;
+
+ jbyteArray jEncodedBytes = env->NewByteArray(s->len);
+ if (jEncodedBytes == NULL) {
+ return NULL;
+ }
+ // Copy bytes from a native SECItem buffer to Java byte array
+ env->SetByteArrayRegion(jEncodedBytes, 0, s->len, (jbyte *)s->data);
+ if (env->ExceptionCheck()) { // should never happen
+ return NULL;
+ }
+ return jEncodedBytes;
+}
+
/*
* Class: sun_security_ec_ECKeyPairGenerator
* Method: generateECKeyPair
- * Signature: (I[B[B)[J
+ * Signature: (I[B[B)[[B
*/
-JNIEXPORT jlongArray
+JNIEXPORT jobjectArray
JNICALL Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair
(JNIEnv *env, jclass clazz, jint keySize, jbyteArray encodedParams, jbyteArray seed)
{
- ECPrivateKey *privKey = NULL; /* contains both public and private values */
+ ECPrivateKey *privKey = NULL; // contains both public and private values
ECParams *ecparams = NULL;
SECKEYECParams params_item;
jint jSeedLength;
jbyte* pSeedBuffer = NULL;
- jlongArray result = NULL;
- jlong* resultElements = NULL;
+ jobjectArray result = NULL;
+ jclass baCls = NULL;
+ jbyteArray jba;
// Initialize the ECParams struct
params_item.len = env->GetArrayLength(encodedParams);
@@ -111,71 +128,62 @@
}
jboolean isCopy;
- result = env->NewLongArray(2);
+ baCls = env->FindClass("[B");
+ if (baCls == NULL) {
+ goto cleanup;
+ }
+ result = env->NewObjectArray(2, baCls, NULL);
if (result == NULL) {
goto cleanup;
}
+ jba = getEncodedBytes(env, &(privKey->privateValue));
+ if (jba == NULL) {
+ result = NULL;
+ goto cleanup;
+ }
+ env->SetObjectArrayElement(result, 0, jba); // big integer
+ if (env->ExceptionCheck()) { // should never happen
+ result = NULL;
+ goto cleanup;
+ }
- resultElements = env->GetLongArrayElements(result, &isCopy);
- if (resultElements == NULL) {
+ jba = getEncodedBytes(env, &(privKey->publicValue));
+ if (jba == NULL) {
+ result = NULL;
goto cleanup;
}
-
- resultElements[0] = (jlong) &(privKey->privateValue); // private big integer
- resultElements[1] = (jlong) &(privKey->publicValue); // encoded ec point
-
- // If the array is a copy then we must write back our changes
- if (isCopy == JNI_TRUE) {
- env->ReleaseLongArrayElements(result, resultElements, 0);
+ env->SetObjectArrayElement(result, 1, jba); // encoded ec point
+ if (env->ExceptionCheck()) { // should never happen
+ result = NULL;
+ goto cleanup;
}
cleanup:
{
- if (params_item.data)
+ if (params_item.data) {
env->ReleaseByteArrayElements(encodedParams,
(jbyte *) params_item.data, JNI_ABORT);
-
- if (ecparams)
+ }
+ if (ecparams) {
FreeECParams(ecparams, true);
-
+ }
if (privKey) {
FreeECParams(&privKey->ecParams, false);
SECITEM_FreeItem(&privKey->version, B_FALSE);
- // Don't free privKey->privateValue and privKey->publicValue
+ SECITEM_FreeItem(&privKey->privateValue, B_FALSE);
+ SECITEM_FreeItem(&privKey->publicValue, B_FALSE);
+ free(privKey);
}
- if (pSeedBuffer)
+ if (pSeedBuffer) {
delete [] pSeedBuffer;
+ }
}
return result;
}
/*
- * Class: sun_security_ec_ECKeyPairGenerator
- * Method: getEncodedBytes
- * Signature: (J)[B
- */
-JNIEXPORT jbyteArray
-JNICALL Java_sun_security_ec_ECKeyPairGenerator_getEncodedBytes
- (JNIEnv *env, jclass clazz, jlong hSECItem)
-{
- SECItem *s = (SECItem *)hSECItem;
- jbyteArray jEncodedBytes = env->NewByteArray(s->len);
- if (jEncodedBytes == NULL) {
- return NULL;
- }
-
- // Copy bytes from a native SECItem buffer to Java byte array
- env->SetByteArrayRegion(jEncodedBytes, 0, s->len, (jbyte *)s->data);
-
- // Use B_FALSE to free only the SECItem->data
- SECITEM_FreeItem(s, B_FALSE);
-
- return jEncodedBytes;
-}
-
-/*
* Class: sun_security_ec_ECDSASignature
* Method: signDigest
* Signature: ([B[B[B[B)[B
@@ -258,21 +266,26 @@
cleanup:
{
- if (params_item.data)
+ if (params_item.data) {
env->ReleaseByteArrayElements(encodedParams,
(jbyte *) params_item.data, JNI_ABORT);
-
- if (pDigestBuffer)
+ }
+ if (privKey.privateValue.data) {
+ env->ReleaseByteArrayElements(privateKey,
+ (jbyte *) privKey.privateValue.data, JNI_ABORT);
+ }
+ if (pDigestBuffer) {
delete [] pDigestBuffer;
-
- if (pSignedDigestBuffer)
+ }
+ if (pSignedDigestBuffer) {
delete [] pSignedDigestBuffer;
-
- if (pSeedBuffer)
+ }
+ if (pSeedBuffer) {
delete [] pSeedBuffer;
-
- if (ecparams)
+ }
+ if (ecparams) {
FreeECParams(ecparams, true);
+ }
}
return jSignedDigest;
--- a/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java Fri Jul 25 09:44:53 2014 +0000
@@ -45,6 +45,10 @@
return false;
}
+ public static boolean isXPStyleEnabled() {
+ return false;
+ }
+
public static void paintBackground(int[] buffer, String widget,
int part, int state, int x, int y, int w, int h, int stride) {
}
--- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java Fri Jul 25 09:44:53 2014 +0000
@@ -170,7 +170,7 @@
@Override
protected void initReorderMap() {
- reorderMap = new HashMap();
+ reorderMap = new HashMap<>();
}
@Override
--- a/jdk/src/solaris/classes/sun/font/XMap.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/solaris/classes/sun/font/XMap.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -37,7 +37,7 @@
class XMap {
- private static HashMap xMappers = new HashMap();
+ private static HashMap<String, XMap> xMappers = new HashMap<>();
/* ConvertedGlyphs has unicode code points as indexes and values
* are platform-encoded multi-bytes chars packed into java chars.
@@ -49,7 +49,7 @@
char[] convertedGlyphs;
static synchronized XMap getXMapper(String encoding) {
- XMap mapper = (XMap)xMappers.get(encoding);
+ XMap mapper = xMappers.get(encoding);
if (mapper == null) {
mapper = getXMapperInternal(encoding);
xMappers.put(encoding, mapper);
--- a/jdk/src/solaris/classes/sun/font/XRGlyphCache.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/solaris/classes/sun/font/XRGlyphCache.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -190,20 +190,23 @@
for (XRGlyphCacheEntry cacheEntry : glyphList) {
if (cacheEntry.isGrayscale(containsLCDGlyphs)) {
if (grayGlyphs == null) {
- grayGlyphs = new ArrayList<XRGlyphCacheEntry>(glyphList.size());
+ grayGlyphs = new ArrayList<>(glyphList.size());
}
cacheEntry.setGlyphSet(grayGlyphSet);
grayGlyphs.add(cacheEntry);
} else {
if (lcdGlyphs == null) {
- lcdGlyphs = new ArrayList<XRGlyphCacheEntry>(glyphList.size());
+ lcdGlyphs = new ArrayList<>(glyphList.size());
}
cacheEntry.setGlyphSet(lcdGlyphSet);
lcdGlyphs.add(cacheEntry);
}
}
-
- return new List[] { grayGlyphs, lcdGlyphs };
+ // Arrays and generics don't play well together
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ List<XRGlyphCacheEntry>[] tmp =
+ (List<XRGlyphCacheEntry>[]) (new List[] { grayGlyphs, lcdGlyphs });
+ return tmp;
}
/**
--- a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java Fri Jul 25 09:44:53 2014 +0000
@@ -140,6 +140,9 @@
return cupsCustomMediaSNames;
}
+ public int getDefaultMediaIndex() {
+ return ((pageSizes.length >1) ? (int)(pageSizes[pageSizes.length -1]) : 0);
+ }
/**
* Returns array of MediaPrintableArea derived from PPD.
@@ -201,8 +204,15 @@
// add this new custom msn to MediaSize array
if ((width > 0.0) && (length > 0.0)) {
+ try {
new MediaSize(width, length,
Size2DSyntax.INCH, msn);
+ } catch (IllegalArgumentException e) {
+ /* PDF printer in Linux for Ledger paper causes
+ "IllegalArgumentException: X dimension > Y dimension".
+ We rotate based on IPP spec. */
+ new MediaSize(length, width, Size2DSyntax.INCH, msn);
+ }
}
}
--- a/jdk/src/solaris/classes/sun/print/IPPPrintService.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/solaris/classes/sun/print/IPPPrintService.java Fri Jul 25 09:44:53 2014 +0000
@@ -413,6 +413,7 @@
mediaSizeNames = cps.getMediaSizeNames();
mediaTrays = cps.getMediaTrays();
customMediaSizeNames = cps.getCustomMediaSizeNames();
+ defaultMediaIndex = cps.getDefaultMediaIndex();
urlConnection.disconnect();
init = true;
return;
@@ -1427,7 +1428,9 @@
return JobSheets.STANDARD;
}
} else if (category == Media.class) {
- defaultMediaIndex = 0;
+ if (defaultMediaIndex == -1) {
+ defaultMediaIndex = 0;
+ }
if (mediaSizeNames.length == 0) {
String defaultCountry = Locale.getDefault().getCountry();
if (defaultCountry != null &&
@@ -1443,17 +1446,7 @@
if (attribClass != null) {
String name = attribClass.getStringValue();
if (isCupsPrinter) {
- for (int i=0; i< customMediaSizeNames.length; i++) {
- //REMIND: get default from PPD. In native _getMedia,
- // move default (ppd_option_t->defchoice) to index 0.
- // In the meantime, use indexOf because PPD name
- // may be different from the IPP attribute name.
- if (customMediaSizeNames[i].toString().indexOf(name)
- != -1) {
- defaultMediaIndex = i;
- return mediaSizeNames[defaultMediaIndex];
- }
- }
+ return mediaSizeNames[defaultMediaIndex];
} else {
for (int i=0; i< mediaSizeNames.length; i++) {
if (mediaSizeNames[i].toString().indexOf(name) != -1) {
--- a/jdk/src/solaris/native/sun/awt/CUPSfuncs.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/solaris/native/sun/awt/CUPSfuncs.c Fri Jul 25 09:44:53 2014 +0000
@@ -349,7 +349,8 @@
// create array of dimensions - (num_choices * 6)
//to cover length & height
DPRINTF( "CUPSfuncs::option->num_choices %d\n", option->num_choices)
- sizeArray = (*env)->NewFloatArray(env, option->num_choices*6);
+ // +1 is for storing the default media index
+ sizeArray = (*env)->NewFloatArray(env, option->num_choices*6+1);
if (sizeArray == NULL) {
unlink(filename);
j2d_ppdClose(ppd);
@@ -369,6 +370,10 @@
}
for (i = 0; i<option->num_choices; i++) {
choice = (option->choices)+i;
+ // get the index of the default page
+ if (!strcmp(choice->choice, option->defchoice)) {
+ dims[option->num_choices*6] = (float)i;
+ }
size = j2d_ppdPageSize(ppd, choice->choice);
if (size != NULL) {
// paper width and height
--- a/jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c Fri Jul 25 09:44:53 2014 +0000
@@ -794,3 +794,11 @@
SplashReconfigure(Splash * splash) {
sendctl(splash, SPLASHCTL_RECONFIGURE);
}
+
+SPLASHEXPORT char*
+SplashGetScaledImageName(const char* jarName, const char* fileName,
+ float *scaleFactor)
+{
+ *scaleFactor = 1;
+ return NULL;
+}
--- a/jdk/src/windows/bin/java_md.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/bin/java_md.c Fri Jul 25 09:44:53 2014 +0000
@@ -1306,6 +1306,14 @@
/* save path length */
jrePathLen = JLI_StrLen(libraryPath);
+ if (jrePathLen + JLI_StrLen("\\bin\\verify.dll") >= MAXPATHLEN) {
+ /* jre path is too long, the library path will not fit there;
+ * report and abort preloading
+ */
+ JLI_ReportErrorMessage(JRE_ERROR11);
+ break;
+ }
+
/* load msvcrt 1st */
LoadMSVCRT();
--- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java Fri Jul 25 09:44:53 2014 +0000
@@ -583,11 +583,18 @@
// Needs to be accessible to Win32ShellFolderManager2
static String getFileSystemPath(final int csidl) throws IOException, InterruptedException {
- return invoke(new Callable<String>() {
+ String path = invoke(new Callable<String>() {
public String call() throws IOException {
return getFileSystemPath0(csidl);
}
}, IOException.class);
+ if (path != null) {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkRead(path);
+ }
+ }
+ return path;
}
// NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
--- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Fri Jul 25 09:44:53 2014 +0000
@@ -136,6 +136,8 @@
if (desktop == null) {
try {
desktop = new Win32ShellFolder2(DESKTOP);
+ } catch (SecurityException e) {
+ // Ignore error
} catch (IOException e) {
// Ignore error
} catch (InterruptedException e) {
@@ -149,6 +151,8 @@
if (drives == null) {
try {
drives = new Win32ShellFolder2(DRIVES);
+ } catch (SecurityException e) {
+ // Ignore error
} catch (IOException e) {
// Ignore error
} catch (InterruptedException e) {
@@ -165,6 +169,8 @@
if (path != null) {
recent = createShellFolder(getDesktop(), new File(path));
}
+ } catch (SecurityException e) {
+ // Ignore error
} catch (InterruptedException e) {
// Ignore error
} catch (IOException e) {
@@ -178,6 +184,8 @@
if (network == null) {
try {
network = new Win32ShellFolder2(NETWORK);
+ } catch (SecurityException e) {
+ // Ignore error
} catch (IOException e) {
// Ignore error
} catch (InterruptedException e) {
@@ -201,6 +209,8 @@
personal.setIsPersonal();
}
}
+ } catch (SecurityException e) {
+ // Ignore error
} catch (InterruptedException e) {
// Ignore error
} catch (IOException e) {
--- a/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java Fri Jul 25 09:44:53 2014 +0000
@@ -60,22 +60,22 @@
new ReentrantReadWriteLock();
private static final Lock readLock = readWriteLock.readLock();
private static final Lock writeLock = readWriteLock.writeLock();
+ private static volatile boolean valid = false;
+
+ static volatile boolean xpStyleEnabled;
static void flush() {
- writeLock.lock();
- try {
- // Close old themes.
- for (Long value : widgetToTheme.values()) {
- closeTheme(value.longValue());
- }
- widgetToTheme.clear();
- } finally {
- writeLock.unlock();
- }
+ // Could be called on Toolkit thread, so do not try to acquire locks
+ // to avoid deadlock with theme initialization
+ valid = false;
}
public static native boolean isThemed();
+ public static boolean isXPStyleEnabled() {
+ return xpStyleEnabled;
+ }
+
// this should be called only with writeLock held
private static Long getThemeImpl(String widget) {
Long theme = widgetToTheme.get(widget);
@@ -98,6 +98,24 @@
// returns theme value
// this method should be invoked with readLock locked
private static Long getTheme(String widget) {
+ if (!valid) {
+ readLock.unlock();
+ writeLock.lock();
+ try {
+ if (!valid) {
+ // Close old themes.
+ for (Long value : widgetToTheme.values()) {
+ closeTheme(value);
+ }
+ widgetToTheme.clear();
+ valid = true;
+ }
+ } finally {
+ readLock.lock();
+ writeLock.unlock();
+ }
+ }
+
// mostly copied from the javadoc for ReentrantReadWriteLock
Long theme = widgetToTheme.get(widget);
if (theme == null) {
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java Fri Jul 25 09:44:53 2014 +0000
@@ -36,8 +36,10 @@
import java.beans.PropertyChangeListener;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import sun.awt.AppContext;
import sun.awt.AWTAutoShutdown;
import sun.awt.AWTPermissions;
+import sun.awt.AppContext;
import sun.awt.LightweightFrame;
import sun.awt.SunToolkit;
import sun.awt.util.ThreadGroupUtils;
@@ -72,6 +74,9 @@
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WToolkit");
+ // Desktop property which specifies whether XP visual styles are in effect
+ public static final String XPSTYLE_THEME_ACTIVE = "win.xpstyle.themeActive";
+
static GraphicsConfiguration config;
// System clipboard.
@@ -895,7 +900,7 @@
private synchronized void lazilyInitWProps() {
if (wprops == null) {
wprops = new WDesktopProperties(this);
- updateProperties();
+ updateProperties(wprops.getProperties());
}
}
@@ -930,21 +935,36 @@
* Windows doesn't always send WM_SETTINGCHANGE when it should.
*/
private void windowsSettingChange() {
- EventQueue.invokeLater(new Runnable() {
- @Override
- public void run() {
- updateProperties();
- }
- });
- }
-
- private synchronized void updateProperties() {
- if (null == wprops) {
- // wprops has not been initialized, so we have nothing to update
+ // JDK-8039383: Have to update the value of XPSTYLE_THEME_ACTIVE property
+ // as soon as possible to prevent NPE and other errors because theme data
+ // has become unavailable.
+ final Map<String, Object> props = getWProps();
+ if (props == null) {
+ // props has not been initialized, so we have nothing to update
return;
}
- Map<String, Object> props = wprops.getProperties();
+ updateXPStyleEnabled(props.get(XPSTYLE_THEME_ACTIVE));
+
+ if (AppContext.getAppContext() == null) {
+ // We cannot post the update to any EventQueue. Listeners will
+ // be called on EDTs by DesktopPropertyChangeSupport
+ updateProperties(props);
+ } else {
+ // Cannot update on Toolkit thread.
+ // DesktopPropertyChangeSupport will call listeners on Toolkit
+ // thread if it has AppContext (standalone mode)
+ EventQueue.invokeLater(() -> updateProperties(props));
+ }
+ }
+
+ private synchronized void updateProperties(final Map<String, Object> props) {
+ if (null == props) {
+ return;
+ }
+
+ updateXPStyleEnabled(props.get(XPSTYLE_THEME_ACTIVE));
+
for (String propName : props.keySet()) {
Object val = props.get(propName);
if (log.isLoggable(PlatformLogger.Level.FINER)) {
@@ -954,6 +974,14 @@
}
}
+ private synchronized Map<String, Object> getWProps() {
+ return (wprops != null) ? wprops.getProperties() : null;
+ }
+
+ private void updateXPStyleEnabled(final Object dskProp) {
+ ThemeReader.xpStyleEnabled = Boolean.TRUE.equals(dskProp);
+ }
+
@Override
public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
if (name == null) {
--- a/jdk/src/windows/classes/sun/awt/windows/WingDings.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WingDings.java Fri Jul 25 09:44:53 2014 +0000
@@ -29,7 +29,7 @@
import java.nio.CharBuffer;
import java.nio.charset.*;
-final class WingDings extends Charset {
+public final class WingDings extends Charset {
public WingDings () {
super("WingDings", null);
}
--- a/jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c Fri Jul 25 09:44:53 2014 +0000
@@ -467,7 +467,7 @@
*/
JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketSetIntOption
(JNIEnv *env, jclass clazz, jint fd , jint cmd, jint value) {
- int level, opt;
+ int level = 0, opt = 0;
if (NET_MapSocketOption(cmd, &level, &opt) < 0) {
JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
@@ -487,7 +487,7 @@
*/
JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketGetIntOption
(JNIEnv *env, jclass clazz, jint fd, jint cmd) {
- int level, opt, result=0;
+ int level = 0, opt = 0, result=0;
int result_len = sizeof(result);
if (NET_MapSocketOption(cmd, &level, &opt) < 0) {
--- a/jdk/src/windows/native/java/net/DualStackPlainSocketImpl.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/native/java/net/DualStackPlainSocketImpl.c Fri Jul 25 09:44:53 2014 +0000
@@ -367,8 +367,8 @@
JNIEXPORT void JNICALL Java_java_net_DualStackPlainSocketImpl_setIntOption
(JNIEnv *env, jclass clazz, jint fd, jint cmd, jint value) {
- int level, opt;
- struct linger linger;
+ int level = 0, opt = 0;
+ struct linger linger = {0, 0};
char *parg;
int arglen;
@@ -407,9 +407,9 @@
JNIEXPORT jint JNICALL Java_java_net_DualStackPlainSocketImpl_getIntOption
(JNIEnv *env, jclass clazz, jint fd, jint cmd) {
- int level, opt;
+ int level = 0, opt = 0;
int result=0;
- struct linger linger;
+ struct linger linger = {0, 0};
char *arg;
int arglen;
--- a/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c Fri Jul 25 09:44:53 2014 +0000
@@ -335,6 +335,8 @@
SOCKETADDRESS rmtaddr;
int addrlen = sizeof(rmtaddr);
+ memset((char *)&rmtaddr, 0, sizeof(rmtaddr));
+
/*
* A no-op if this OS doesn't support it.
*/
@@ -431,9 +433,11 @@
int ipv6_supported = ipv6_available();
SOCKETADDRESS lcladdr;
- int lcladdrlen;
+ int lcladdrlen = sizeof(lcladdr);
int address;
+ memset((char *)&lcladdr, 0, sizeof(lcladdr));
+
family = getInetAddress_family(env, addressObj);
if (family == IPv6 && !ipv6_supported) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
@@ -614,7 +618,7 @@
}
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
- memset(&addr, 0, len);
+ memset((char *)&addr, 0, len);
connect(fd, (struct sockaddr *)&addr, len);
/*
@@ -622,7 +626,7 @@
* to disable ICMP port unreachable handling here.
*/
if (xp_or_later) {
- DWORD x1, x2; /* ignored result codes */
+ DWORD x1 = 0, x2 = 0; /* ignored result codes */
int t = FALSE;
WSAIoctl(fd,SIO_UDP_CONNRESET,&t,sizeof(t),&x1,sizeof(x1),&x2,0,0);
}
@@ -652,8 +656,9 @@
SOCKETADDRESS rmtaddr;
SOCKETADDRESS *addrp = &rmtaddr;
- int addrlen;
+ int addrlen = 0;
+ memset((char *)&rmtaddr, 0, sizeof(rmtaddr));
if (IS_NULL(packet)) {
JNU_ThrowNullPointerException(env, "null packet");
@@ -1412,7 +1417,7 @@
} else if (n < 0) {
NET_ThrowCurrent(env, "Datagram receive failed");
} else {
- int port;
+ int port = 0;
jobject packetAddress;
/*
@@ -1791,11 +1796,11 @@
jint opt,jobject value) {
int fd=-1, fd1=-1;
- int levelv4, levelv6, optnamev4, optnamev6, optlen;
+ int levelv4 = 0, levelv6 = 0, optnamev4 = 0, optnamev6 = 0, optlen = 0;
union {
int i;
char c;
- } optval;
+ } optval = { 0 };
int ipv6_supported = ipv6_available();
fd = getFD(env, this);
@@ -2162,7 +2167,7 @@
int level, optname, optlen;
union {
int i;
- } optval;
+ } optval = {0};
int ipv6_supported = ipv6_available();
fd = getFD(env, this);
@@ -2413,12 +2418,15 @@
struct ipv6_mreq mname6;
struct in_addr in;
- DWORD ifindex;
+ DWORD ifindex = 0;
int len, family;
int ipv6_supported = ipv6_available();
int cmd ;
+ memset((char *)&in, 0, sizeof(in));
+ memset((char *)&name, 0, sizeof(name));
+
if (IS_NULL(fdObj) && IS_NULL(fd1Obj)) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
"Socket closed");
--- a/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c Fri Jul 25 09:44:53 2014 +0000
@@ -207,6 +207,7 @@
/* The result of the connection */
int connect_res;
+ memset((char *)&him, 0, sizeof(him));
if (!IS_NULL(fdObj)) {
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
@@ -399,7 +400,7 @@
/* fdObj is the FileDescriptor field on this */
jobject fdObj, fd1Obj;
/* fd is an int field on fdObj */
- int fd, fd1, len;
+ int fd, fd1, len = 0;
int ipv6_supported = ipv6_available();
/* family is an int field of iaObj */
@@ -837,12 +838,13 @@
jint cmd, jboolean on,
jobject value) {
int fd, fd1;
- int level, optname, optlen;
+ int level = 0, optname = 0, optlen = 0;
union {
int i;
struct linger ling;
} optval;
+ memset((char *)&optval, 0, sizeof(optval));
/*
* Get SOCKET and check that it hasn't been closed
*/
@@ -1003,17 +1005,17 @@
jint opt, jobject iaContainerObj) {
int fd, fd1;
- int level, optname, optlen;
+ int level = 0, optname = 0, optlen = 0;
union {
int i;
struct linger ling;
} optval;
-
/*
* Get SOCKET and check it hasn't been closed
*/
fd = getFD(env, this);
fd1 = getFD1(env, this);
+ memset((char *)&optval, 0, sizeof(optval));
if (fd < 0 && fd1 < 0) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
@@ -1037,6 +1039,7 @@
jfieldID iaFieldID;
len = sizeof(him);
+ memset((char *)&him, 0, len);
if (fd == -1) {
/* must be an IPV6 only socket. Case where both sockets are != -1
--- a/jdk/src/windows/native/java/net/net_util_md.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/native/java/net/net_util_md.c Fri Jul 25 09:44:53 2014 +0000
@@ -386,8 +386,8 @@
NET_SetSockOpt(int s, int level, int optname, const void *optval,
int optlen)
{
- int rv;
- int parg;
+ int rv = 0;
+ int parg = 0;
int plen = sizeof(parg);
if (level == IPPROTO_IP && optname == IP_TOS) {
@@ -478,7 +478,7 @@
* Sets SO_ECLUSIVEADDRUSE if SO_REUSEADDR is not already set.
*/
void setExclusiveBind(int fd) {
- int parg;
+ int parg = 0;
int plen = sizeof(parg);
int rv = 0;
rv = NET_GetSockOpt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&parg, &plen);
@@ -499,7 +499,7 @@
JNIEXPORT int JNICALL
NET_Bind(int s, struct sockaddr *him, int len)
{
- int rv;
+ int rv = 0;
rv = bind(s, him, len);
if (rv == SOCKET_ERROR) {
@@ -529,8 +529,8 @@
JNIEXPORT int JNICALL
NET_SocketClose(int fd) {
- struct linger l;
- int ret;
+ struct linger l = {0, 0};
+ int ret = 0;
int len = sizeof (l);
if (getsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&l, &len) == 0) {
if (l.l_onoff == 0) {
--- a/jdk/src/windows/native/sun/awt/splashscreen/splashscreen_sys.c Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/native/sun/awt/splashscreen/splashscreen_sys.c Fri Jul 25 09:44:53 2014 +0000
@@ -563,3 +563,11 @@
{
PostMessage(splash->hWnd, WM_SPLASHRECONFIGURE, 0, 0);
}
+
+SPLASHEXPORT char*
+SplashGetScaledImageName(const char* jarName, const char* fileName,
+ float *scaleFactor)
+{
+ *scaleFactor = 1;
+ return NULL;
+}
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp Fri Jul 25 09:44:53 2014 +0000
@@ -492,7 +492,12 @@
* member is referred in the GetClassName method of AwtLabel class.
* So m_peerObject member must be set here.
*/
- m_peerObject = env->NewGlobalRef(peer);
+ if (m_peerObject == NULL) {
+ m_peerObject = env->NewGlobalRef(peer);
+ } else {
+ assert(env->IsSameObject(m_peerObject, peer));
+ }
+
RegisterClass();
jobject target = env->GetObjectField(peer, AwtObject::targetID);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/SortingFPT/JDK8048887.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 8048887
+ @summary Tests SortingFTP for an exception caused by the tim-sort algo.
+ @author anton.tarasov: area=awt.focus
+ @run main JDK8040632
+*/
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import java.awt.Dimension;
+import java.awt.Color;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class JDK8048887 {
+
+ static volatile boolean passed = true;
+
+ public static void main(String[] args) {
+ JDK8048887 app = new JDK8048887();
+ app.start();
+ }
+
+ public void start() {
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ SwingUtilities.invokeLater(() -> {
+ // Catch the original exception which sounds like:
+ // java.lang.IllegalArgumentException: Comparison method violates its general contract!
+ Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+ public void uncaughtException(Thread t, Throwable e) {
+ e.printStackTrace();
+ if (e instanceof IllegalArgumentException) {
+ passed = false;
+ latch.countDown();
+ }
+ }
+ });
+
+ TestDialog d = new TestDialog();
+ // It's expected that the dialog is focused on start.
+ // The listener is called after the FTP completes processing and the bug is reproduced or not.
+ d.addWindowFocusListener(new WindowAdapter() {
+ public void windowGainedFocus(WindowEvent e) {
+ latch.countDown();
+ }
+ });
+ d.setVisible(true);
+ });
+
+ try {
+ latch.await(5, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ if (passed)
+ System.out.println("Test passed.");
+ else
+ throw new RuntimeException("Test failed!");
+ }
+}
+
+class TestDialog extends JFrame {
+
+ // The layout of the components reproduces the transitivity issue
+ // with SortingFocusTraversalPolicy relying on the tim-sort algo.
+
+ private static int[] Xs = new int[] {71, 23, 62, 4, 79, 39, 34, 9, 84, 58, 30, 34, 38, 15, 69, 10, 44, 95, 70, 54,
+ 44, 62, 77, 64, 70, 83, 31, 48, 96, 54, 40, 3, 60, 58, 3, 20, 94, 54, 26, 19, 48, 47, 12, 70, 86, 43, 71, 97, 19,
+ 69, 90, 22, 43, 76, 10, 60, 29, 49, 9, 9, 15, 73, 85, 80, 81, 35, 87, 43, 17, 57, 38, 44, 29, 86, 96, 15, 57, 26,
+ 27, 78, 26, 87, 43, 6, 4, 16, 57, 99, 32, 86, 96, 5, 50, 69, 12, 4, 36, 84, 71, 60, 22, 46, 11, 44, 87, 3, 23, 14,
+ 43, 25, 32, 44, 11, 18, 77, 2, 51, 87, 88, 53, 69, 37, 14, 10, 25, 73, 39, 33, 91, 51, 96, 9, 74, 66, 70, 42, 72,
+ 7, 82, 40, 91, 33, 83, 54, 33, 50, 83, 1, 81, 32, 66, 11, 75, 56, 53, 45, 1, 69, 46, 31, 79, 58, 12, 20, 92, 49,
+ 50, 90, 33, 8, 43, 93, 72, 78, 9, 56, 84, 60, 30, 39, 33, 88, 84, 56, 49, 47, 4, 90, 57, 6, 23, 96, 37, 88, 22, 79,
+ 35, 80, 45, 55};
+
+ public TestDialog() {
+ JPanel panel = new JPanel(new GridBagLayout());
+ GridBagConstraints gbc = new GridBagConstraints();
+ for (int i=0; i < Xs.length; i++) {
+ gbc.gridx = Xs[i];
+ gbc.gridy = 100 - gbc.gridx;
+ panel.add(new MyComponent(), gbc);
+ }
+ getRootPane().getContentPane().add(panel);
+ pack();
+ }
+
+ public static class MyComponent extends JPanel {
+ private final static Dimension SIZE = new Dimension(1,1);
+
+ public MyComponent() {
+ setBackground(Color.BLACK);
+ setOpaque(true);
+ }
+
+ @Override
+ public Dimension getPreferredSize() {
+ return SIZE;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/DisposeParentGC/DisposeParentGC.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.lang.ref.PhantomReference;
+import java.lang.ref.ReferenceQueue;
+import java.util.ArrayList;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary Display a dialog with a parent, the dialog contains all awt components
+ * added to it & each components are setted with different cursors types.
+ * Dispose the parent & collect GC. Garbage collection should happen
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main/othervm -Xmx20m DisposeParentGC
+ */
+
+public class DisposeParentGC {
+ Frame parentFrame;
+ ExtendedRobot robot;
+
+ ArrayList<PhantomReference<Dialog>> refs = new ArrayList<PhantomReference<Dialog>>();
+ ReferenceQueue<Dialog> que = new ReferenceQueue<>();
+
+ public static void main(String []args) throws Exception {
+ new DisposeParentGC().doTest();
+ }
+
+ DisposeParentGC() throws Exception {
+ robot = new ExtendedRobot();
+ EventQueue.invokeAndWait(this::initGui);
+ }
+
+ void initGui(){
+ parentFrame = new Frame("Parent Frame");
+ parentFrame.setLayout(new FlowLayout());
+
+ for (int i = 1; i <= 3; i++)
+ createDialog(i);
+
+ parentFrame.setLocation(250, 20);
+ parentFrame.pack();
+ parentFrame.setVisible(true);
+ }
+
+ public void doTest() throws Exception{
+ robot.waitForIdle();
+
+ parentFrame.dispose();
+ robot.waitForIdle();
+
+ Vector garbage = new Vector();
+ while (true) {
+ try {
+ garbage.add(new byte[1000]);
+ } catch (OutOfMemoryError er) {
+ break;
+ }
+ }
+ garbage = null;
+
+ int count = 1;
+ for (; count <= 3; count++)
+ if(que.remove(5000) == null)
+ break;
+
+ if (count < 3)
+ throw new RuntimeException("Count = "+count+". GC didn't collect the objects after the parent is disposed!");
+ }
+
+ public void createDialog(int number) {
+ Dialog child = new Dialog(parentFrame);
+ child.setTitle("Dialog " + number);
+ child.setLayout(new FlowLayout());
+ child.setLocation(20, 140 * number);
+
+ Button button = new Button("Press Me") ;
+ TextArea textArea = new TextArea(5,5);
+ TextField textField = new TextField(10);
+ Choice choice = new Choice();
+ choice.add("One");
+ choice.add("Two");
+ choice.add("Three");
+ choice.add("Four");
+ choice.add("Five");
+ List list = new List();
+ list.add("One");
+ list.add("Two");
+ list.add("Three");
+ list.add("Four");
+ list.add("Five");
+ Checkbox checkBox = new Checkbox("Hai");
+ Scrollbar scrollBar = new Scrollbar(Scrollbar.VERTICAL,0,1,0,200);
+ CheckboxGroup checkboxGroup = new CheckboxGroup();
+ Checkbox radioButton = new Checkbox("Hello" ,true, checkboxGroup);
+ Canvas canvas = new Canvas();
+ Label label = new Label("I am label!");
+ Cursor customCursor = null;
+
+ child.setLayout(new FlowLayout());
+ canvas.setSize(100,100);
+ canvas.setBackground(Color.red);
+
+ button.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ label.setCursor(new Cursor(Cursor.TEXT_CURSOR));
+ choice.setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ list.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ checkBox.setCursor(new Cursor(Cursor.MOVE_CURSOR));
+ radioButton.setCursor(new Cursor(Cursor.SE_RESIZE_CURSOR));
+ scrollBar.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));
+ canvas.setCursor(new Cursor(Cursor.W_RESIZE_CURSOR));
+ textField.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+
+ /* create a custom cursor */
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ Dimension d = toolkit.getBestCursorSize(32,32);
+ int color = toolkit.getMaximumCursorColors();
+
+ if(!d.equals(new Dimension(0,0)) && color != 0 )
+ customCursor = toolkit.createCustomCursor(new BufferedImage( 16, 16, BufferedImage.TYPE_INT_RGB ), new Point(10, 10), "custom cursor.");
+ else
+ System.err.println("Platform doesn't support to create a custom cursor.");
+
+ textArea.setCursor(customCursor);
+ child.add(label);
+ child.add(button);
+ child.add(choice);
+ child.add(list);
+ child.add(checkBox);
+ child.add(radioButton);
+ child.add(scrollBar);
+ child.add(canvas);
+ child.add(textArea);
+ child.add(textField);
+ child.add(button);
+ child.revalidate();
+
+ child.pack();
+ child.setVisible(true);
+ refs.add(new PhantomReference<Dialog>(child, que));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/FramesGC/FramesGC.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.lang.ref.PhantomReference;
+import java.lang.ref.ReferenceQueue;
+import java.util.ArrayList;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary Verify that disposed frames are collected with GC
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main/othervm -Xmx20m FramesGC
+ */
+
+
+public class FramesGC {
+
+ ExtendedRobot robot;
+ ArrayList<PhantomReference<Frame>> refs = new ArrayList<PhantomReference<Frame>>();
+ ReferenceQueue<Frame> que = new ReferenceQueue<Frame>();
+
+ public static void main(String []args) throws Exception {
+ new FramesGC().doTest();
+ }
+
+ FramesGC() throws Exception{
+ robot = new ExtendedRobot();
+ }
+
+ void doTest() throws Exception {
+ for( int i = 1; i <= 3; i++) {
+ final int j = i;
+ EventQueue.invokeAndWait(() -> {
+ createFrame(j);
+ });
+ }
+ robot.waitForIdle();
+
+ for (Frame f : Frame.getFrames())
+ f.dispose();
+
+ robot.waitForIdle();
+
+ Vector garbage = new Vector();
+ while (true) {
+ try {
+ garbage.add(new byte[1000]);
+ } catch (OutOfMemoryError er) {
+ break;
+ }
+ }
+ garbage = null;
+
+ int count = 1;
+ for(; count <= 3; count++)
+ if(que.remove(5000) == null)
+ break;
+
+ System.out.println("Total no of instances eligible for GC = " + count);
+ if(count < 3)
+ throw new RuntimeException("Count = "+count+". Test failed!");
+
+ }
+
+ void createFrame(int i){
+ Frame frame = new Frame("Frame " + i);
+
+ Button button=new Button("Press Me");
+ TextArea textArea=new TextArea(5,5);
+ TextField textField=new TextField(10);
+ Choice choice=new Choice();
+ choice.add("One");
+ choice.add("Two");
+ choice.add("Three");
+ choice.add("Four");
+ choice.add("Five");
+ List list = new List();
+ list.add("One");
+ list.add("Two");
+ list.add("Three");
+ list.add("Four");
+ list.add("Five");
+ Checkbox checkBox= new Checkbox("Hai");
+ Scrollbar scrollBar=new Scrollbar(Scrollbar.VERTICAL,0,1,0,200);
+ CheckboxGroup checkboxGroup=new CheckboxGroup();
+ Checkbox radioButton=new Checkbox("Hello" ,true, checkboxGroup);
+ Canvas canvas=new Canvas();
+ canvas.setSize(100, 100);
+ canvas.setBackground(java.awt.Color.red);
+ Label label=new Label("I am label.!");
+ Cursor customCursor=null;
+
+ frame.setLayout(new java.awt.FlowLayout());
+
+ button.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ label.setCursor(new Cursor(Cursor.TEXT_CURSOR));
+ choice.setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ list.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ checkBox.setCursor(new Cursor(Cursor.MOVE_CURSOR));
+ radioButton.setCursor(new Cursor(Cursor.SE_RESIZE_CURSOR));
+ scrollBar.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));
+ canvas.setCursor(new Cursor(Cursor.W_RESIZE_CURSOR));
+ textField.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+
+ /* create a custom cursor */
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ Dimension d = toolkit.getBestCursorSize(32,32);
+ int color = toolkit.getMaximumCursorColors();
+
+ if(!d.equals(new Dimension(0,0)) && color != 0 )
+ customCursor = toolkit.createCustomCursor(new BufferedImage( 16, 16, BufferedImage.TYPE_INT_RGB ), new Point(10, 10), "custom cursor.");
+ else
+ System.err.println("Platform doesn't support to create a custom cursor.");
+
+ textArea.setCursor(customCursor);
+ frame.add(label);
+ frame.add(button);
+ frame.add(choice);
+ frame.add(list);
+ frame.add(checkBox);
+ frame.add(radioButton);
+ frame.add(scrollBar);
+ frame.add(canvas);
+ frame.add(textArea);
+ frame.add(textField);
+ frame.add(button);
+
+ frame.setLocation(20, 140 * i);
+ frame.pack();
+ frame.setVisible(true);
+ refs.add(new PhantomReference<Frame>(frame, que));
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Graphics2D/DrawString/DrawStringCrash.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8043508
+ * @summary Drawing a very long string crashes VM
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+
+public class DrawStringCrash {
+
+ public static void main(String[] args) {
+ StringBuffer sb = new StringBuffer();
+ String s = "abcdefghijklmnopqrstuzwxyz";
+ for (int x = 0; x < 100000 ; x++) {
+ sb.append(s);
+ }
+ // Now have a string which uses approx 5Mb memory
+ // Loop again drawing doubling each time until
+ // we reach 8 billion chars or get OOME which means we can't
+ // go any further.
+ // Often there is no crash because Java OOM happens
+ // long before native heap runs out.
+ long maxLen = 8L * 1024 * 1024 * 1024;
+ int len = sb.length();
+
+ BufferedImage bi =
+ new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
+ Graphics2D g2d = bi.createGraphics();
+ while (len < maxLen) {
+ try {
+ g2d.drawString(s, 20, 20);
+ } catch (OutOfMemoryError e) {
+ return;
+ }
+ sb.append(sb);
+ len *= 2;
+ }
+ return;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/ListGarbageCollectionTest/AwtListGarbageCollectionTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8040076
+ * @summary AwtList not garbage collected
+ * @run main/othervm -Xmx100m AwtListGarbageCollectionTest
+ */
+
+import java.awt.*;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.lang.ref.WeakReference;
+
+public class AwtListGarbageCollectionTest {
+ public static void main(String[] args) {
+ Frame frame = new Frame("List leak test");
+ try {
+ test(frame);
+ } finally {
+ frame.dispose();
+ }
+ }
+
+ private static void test(Frame frame) {
+ WeakReference<List> weakListRef = null;
+ try {
+ frame.setSize(300, 200);
+ frame.setVisible(true);
+
+ List strongListRef = new List();
+ frame.add(strongListRef);
+ strongListRef.setMultipleMode(true);
+ frame.remove(strongListRef);
+ weakListRef = new WeakReference<List>(strongListRef);
+ strongListRef = null;
+
+ //make out of memory to force gc
+ String veryLongString = new String(new char[100]);
+ while (true) {
+ veryLongString += veryLongString;
+ }
+ } catch (OutOfMemoryError e) {
+ if (weakListRef == null) {
+ throw new RuntimeException("Weak list ref wasn't created");
+ } else if (weakListRef.get() != null) {
+ throw new RuntimeException("List wasn't garbage collected");
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Dialog;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Panel;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.SplashScreen;
+import java.awt.Window;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import javax.imageio.ImageIO;
+import sun.java2d.SunGraphics2D;
+
+/**
+ * @test
+ * @bug 8043869
+ * @author Alexander Scherbatiy
+ * @summary [macosx] java -splash does not honor 2x hi dpi notation for retina
+ * support
+ * @run main MultiResolutionSplashTest GENERATE_IMAGES
+ * @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0
+ * @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1
+ * @run main/othervm -splash:splash3. MultiResolutionSplashTest TEST_SPLASH 2
+ */
+public class MultiResolutionSplashTest {
+
+ private static final int IMAGE_WIDTH = 300;
+ private static final int IMAGE_HEIGHT = 200;
+
+ private static final ImageInfo[] tests = {
+ new ImageInfo("splash1.png", "splash1@2x.png", Color.BLUE, Color.GREEN),
+ new ImageInfo("splash2", "splash2@2x", Color.WHITE, Color.BLACK),
+ new ImageInfo("splash3.", "splash3@2x.", Color.YELLOW, Color.RED)
+ };
+
+ public static void main(String[] args) throws Exception {
+
+ String test = args[0];
+
+ switch (test) {
+ case "GENERATE_IMAGES":
+ generateImages();
+ break;
+ case "TEST_SPLASH":
+ int index = Integer.parseInt(args[1]);
+ testSplash(tests[index]);
+ break;
+ default:
+ throw new RuntimeException("Unknown test: " + test);
+ }
+ }
+
+ static void testSplash(ImageInfo test) throws Exception {
+ SplashScreen splashScreen = SplashScreen.getSplashScreen();
+
+ if (splashScreen == null) {
+ throw new RuntimeException("Splash screen is not shown!");
+ }
+
+ Graphics2D g = splashScreen.createGraphics();
+ Rectangle splashBounds = splashScreen.getBounds();
+ int screenX = (int) splashBounds.getCenterX();
+ int screenY = (int) splashBounds.getCenterY();
+
+ Robot robot = new Robot();
+ Color splashScreenColor = robot.getPixelColor(screenX, screenY);
+
+ float scaleFactor = getScaleFactor();
+ Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;
+
+ if (!testColor.equals(splashScreenColor)) {
+ throw new RuntimeException(
+ "Image with wrong resolution is used for splash screen!");
+ }
+ }
+
+ static float getScaleFactor() {
+
+ final Dialog dialog = new Dialog((Window) null);
+ dialog.setSize(100, 100);
+ dialog.setModal(true);
+ final float[] scaleFactors = new float[1];
+ Panel panel = new Panel() {
+
+ @Override
+ public void paint(Graphics g) {
+ float scaleFactor = 1;
+ if (g instanceof SunGraphics2D) {
+ scaleFactor = ((SunGraphics2D) g).surfaceData.getDefaultScale();
+ }
+ scaleFactors[0] = scaleFactor;
+ dialog.setVisible(false);
+ }
+ };
+
+ dialog.add(panel);
+ dialog.setVisible(true);
+ dialog.dispose();
+
+ return scaleFactors[0];
+ }
+
+ static void generateImages() throws Exception {
+ for (ImageInfo test : tests) {
+ generateImage(test.name1x, test.color1x, 1);
+ generateImage(test.name2x, test.color2x, 2);
+ }
+ }
+
+ static void generateImage(String name, Color color, int scale) throws Exception {
+ File file = new File(name);
+ if (file.exists()) {
+ return;
+ }
+ BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT,
+ BufferedImage.TYPE_INT_RGB);
+ Graphics g = image.getGraphics();
+ g.setColor(color);
+ g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT);
+ ImageIO.write(image, "png", file);
+ }
+
+ static class ImageInfo {
+
+ final String name1x;
+ final String name2x;
+ final Color color1x;
+ final Color color2x;
+
+ public ImageInfo(String name1x, String name2x, Color color1x, Color color2x) {
+ this.name1x = name1x;
+ this.name2x = name2x;
+ this.color1x = color1x;
+ this.color2x = color2x;
+ }
+ }
+}
--- a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/FocusAWTTest.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/FocusAWTTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -35,6 +35,19 @@
* @bug 8013450
* @summary Check if the window events (Focus and Activation) are triggered correctly
* when clicked on visible and clipped areas.
+ *
+ * Test Description: Check if PERPIXEL_TRANSPARENT Translucency type is supported
+ * by the current platform. Proceed if it is supported. Apply different
+ * types of shapes on a Window. Make it appear with a known background.
+ * Check if mouse events which result in window-activated events are
+ * triggered only within the window's shape and not outside. Repeat this
+ * for Window, Dialog and Frame.
+ * Expected Result: If PERPIXEL_TRANSPARENT Translucency type is supported, window should
+ * gain focus and should trigger activated events only when it is clicked on the
+ * visible areas. Events should be delivered to the background window if clicked
+ * on the clipped areas.
+ *
+ * @author mrkam
* @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
* @library ../../../../lib/testlibrary
* @build Common ExtendedRobot
@@ -149,6 +162,7 @@
window.setVisible(true);
}
+ @Override
public void doTest() throws Exception {
super.doTest();
final Point wls = new Point();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/SetShape.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.geom.*;
+
+/*
+ * @test
+ * @summary Check if a window set with shape appears in the expected shape
+ *
+ * Test Description: Check if PERPIXEL_TRANSPARENT Translucency type is supported
+ * by the current platform. Proceed if it is supported. Apply different
+ * types of shapes on a Window. Make it appear with a known background. Use
+ * get pixel color to check whether it appears as expected. Repeat this for
+ * Window, Dialog and Frame.
+ * Expected Result: If PERPIXEL_TRANSPARENT Translucency type is supported, the
+ * window should appear with the expected shape.
+ *
+ * @author mrkam
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main SetShape
+ */
+
+public class SetShape extends Common {
+
+ static int[][] pointsToCheck;
+ static Shape shape;
+
+ public static void main(String[] args) throws Exception {
+ if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT)) {
+ for (int i = 0; i < 6; i++) {
+ System.out.println("Checking shape "+i);
+ Area area;
+ GeneralPath path;
+ switch (i) {
+ case 0:
+ path = new GeneralPath();
+ path.moveTo(0, 40);
+ path.lineTo(40, 0);
+ path.lineTo(110, 0);
+ path.lineTo(150, 40);
+ path.lineTo(150, 110);
+ path.lineTo(110, 150);
+ path.lineTo(40, 150);
+ path.lineTo(0, 110);
+ path.closePath();
+ shape = path;
+ pointsToCheck = new int[][]{
+ // inside shape
+ {230, 240}, {286, 332}, {314, 267}, {220, 327}, {223, 246},
+ {229, 274}, {335, 257}, {231, 278}, {317, 299}, {266, 236},
+ // outside shape
+ {340, 353}, {373, 320}, {330, 220}, {384, 300}, {349, 406},
+ {213, 355}, {361, 260}, {399, 251}, {201, 374}, {199, 257}
+ };
+ break;
+ case 1:
+ area = new Area();
+ area.add(new Area(new Rectangle2D.Float(50, 0, 100, 150)));
+ area.add(new Area(new Rectangle2D.Float(0, 50, 200, 50)));
+ area.add(new Area(new Ellipse2D.Float(0, 0, 100, 100)));
+ area.add(new Area(new Ellipse2D.Float(0, 50, 100, 100)));
+ area.add(new Area(new Ellipse2D.Float(100, 0, 100, 100)));
+ area.add(new Area(new Ellipse2D.Float(100, 50, 100, 100)));
+ shape = area;
+ pointsToCheck = new int[][]{
+ // inside shape
+ {306, 314}, {296, 266}, {276, 335}, {380, 253}, {224, 333},
+ {396, 305}, {365, 278}, {214, 331}, {289, 349}, {367, 345},
+ // outside shape
+ {365, 424}, {391, 391}, {346, 413}, {261, 398}, {348, 399},
+ {282, 400}, {386, 215}, {399, 369}, {213, 401}, {387, 215}
+ };
+ break;
+ case 2:
+ path = new GeneralPath();
+ path.moveTo(100, 0);
+ double angle = -Math.PI / 2;
+ double angle_step = Math.PI * 2 / 8;
+ for (int c = 0; c < 8; c++, angle += angle_step) {
+ path.lineTo(100 + 100 * Math.cos(angle), 100 + 100 * Math.sin(angle));
+ path.lineTo(100 + 40 * Math.cos(angle + angle_step / 2), 100 + 40 * Math.sin(angle + angle_step / 2));
+ }
+ path.closePath();
+ shape = path;
+ pointsToCheck = new int[][]{
+ // inside shape
+ {246, 257}, {300, 314}, {255, 347}, {291, 364}, {287, 320},
+ {319, 276}, {269, 345}, {325, 291}, {289, 271}, {273, 339},
+ // outside shape
+ {373, 267}, {269, 229}, {390, 326}, {204, 216}, {379, 408},
+ {375, 330}, {296, 213}, {367, 340}, {376, 409}, {378, 308}
+ };
+ break;
+ case 3:
+ area = new Area();
+ area.add(new Area(new Rectangle2D.Float(-15, 85, 230, 30)));
+ area.transform(AffineTransform.getRotateInstance(-Math.PI / 4, 100, 100));
+ shape = area;
+ pointsToCheck = new int[][]{
+ // inside shape
+ {240, 366}, {254, 338}, {342, 244}, {264, 344}, {343, 240},
+ {292, 303}, {225, 374}, {263, 348}, {329, 290}, {278, 327},
+ // outside shape
+ {353, 289}, {334, 377}, {391, 354}, {266, 358}, {280, 364},
+ {232, 225}, {327, 309}, {375, 208}, {397, 292}, {204, 335}
+ };
+ break;
+ case 4:
+ area = new Area();
+ area.add(new Area(new Arc2D.Float(0, -100, 400, 400, 155, 50, Arc2D.PIE)));
+ area.subtract(new Area(new Ellipse2D.Float(70, 115, 20, 20)));
+ area.subtract(new Area(new Ellipse2D.Float(30, 90, 18, 18)));
+ area.subtract(new Area(new Ellipse2D.Float(17, 50, 30, 30)));
+ area.subtract(new Area(new Ellipse2D.Float(26, 124, 26, 26)));
+ area.subtract(new Area(new Ellipse2D.Float(100, 85, 25, 25)));
+ area.subtract(new Area(new Ellipse2D.Float(135, 100, 14, 14)));
+ shape = area;
+ pointsToCheck = new int[][]{
+ // inside shape
+ {225, 286}, {296, 276}, {318, 269}, {211, 357}, {295, 327},
+ {207, 300}, {322, 265}, {319, 262}, {259, 294}, {261, 250},
+ // outside shape
+ {322, 303}, {330, 367}, {302, 395}, {227, 251}, {263, 382},
+ {228, 383}, {280, 366}, {294, 248}, {316, 349}, {313, 294}
+ };
+ break;
+ case 5:
+ area = new Area();
+ area.add(new Area(new Rectangle2D.Float(0, 0, 90, 90)));
+ area.add(new Area(new Rectangle2D.Float(100, 0, 100, 200)));
+ area.add(new Area(new Ellipse2D.Float(0, 100, 100, 100)));
+ shape = area;
+ pointsToCheck = new int[][]{
+ // inside shape
+ {275, 345}, {358, 327}, {373, 374}, {273, 331}, {251, 234},
+ {285, 356}, {360, 287}, {319, 343}, {232, 210}, {323, 323},
+ // outside shape
+ {219, 291}, {270, 302}, {296, 383}, {298, 203}, {228, 293},
+ {276, 300}, {292, 294}, {293, 216}, {298, 331}, {228, 295}
+ };
+ break;
+ default:
+ break;
+ }
+
+ for (Class<Window> windowClass : WINDOWS_TO_TEST) {
+ new SetShape(windowClass).doTest();
+ }
+ }
+ }
+ }
+
+ public SetShape(Class windowClass) throws Exception {
+ super(windowClass);
+ }
+
+ @Override
+ public void initGUI() {
+ if (windowClass.equals(Frame.class)) {
+ window = new Frame();
+ ((Frame) window).setUndecorated(true);
+ } else if (windowClass.equals(Dialog.class)) {
+ window = new Dialog(background);
+ ((Dialog) window).setUndecorated(true);
+ } else {
+ window = new Window(background);
+ }
+ window.setBackground(FG_COLOR);
+ window.addComponentListener(new ComponentAdapter() {
+ @Override
+ public void componentResized(ComponentEvent e) {
+ window.setShape(shape);
+ }
+ });
+ window.setSize(200, 200);
+ window.setLocation(2*dl, 2*dl);
+ window.setVisible(true);
+
+ System.out.println("Checking " + window.getClass().getName() + "...");
+ }
+
+ @Override
+ public void doTest() throws Exception {
+ robot.waitForIdle();
+
+ final int COUNT_TARGET = 10;
+ for(int i = 0; i < COUNT_TARGET * 2; i++) {
+ int x = pointsToCheck[i][0];
+ int y = pointsToCheck[i][1];
+ boolean inside = i < COUNT_TARGET;
+ Color c = robot.getPixelColor(x, y);
+ System.out.println("checking " + x + ", " + y + ", color = " + c);
+ boolean matchToForeground = FG_COLOR.equals(c);
+
+ if (!inside && matchToForeground || inside && !matchToForeground) {
+ System.err.println("Checking for transparency failed: point: " +
+ x + ", " + y +
+ ", color = " + c + (inside ? " is not of " : " is of un") +
+ "expected foreground color " + FG_COLOR);
+ final Frame[] f = new Frame[1];
+ EventQueue.invokeAndWait(() -> {
+ f[0] = new Frame();
+ f[0].setUndecorated(true);
+ f[0].setBackground(Color.YELLOW);
+ f[0].setPreferredSize(new Dimension(2, 2));
+ f[0].pack();
+ f[0].setVisible(true);
+ });
+ robot.delay(1000);
+ EventQueue.invokeAndWait(() -> {
+ f[0].setLocation(x, y);
+ });
+ robot.delay(1000);
+ }
+ }
+ EventQueue.invokeAndWait(window::dispose);
+ EventQueue.invokeAndWait(background::dispose);
+
+ robot.waitForIdle();
+ }
+
+ @Override
+ public void applyShape() { window.setShape(shape); }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/SetShapeAndClick.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.geom.Area;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Rectangle2D;
+
+/*
+ * @test
+ * @summary Check if a window set with shape clips the contents
+ *
+ * Test Description: Check if PERPIXEL_TRANSPARENT Translucency type is supported
+ * by the current platform. Proceed if it is supported. Apply different types
+ * of shapes on a Window which contains some awt components. Shape should be
+ * applied in such a way that some components are partially clipped off. Check
+ * if the components appear only partially and events work correctly for those
+ * components - i.e. events occur only on the areas which appear and do not
+ * occur on the clipped off areas. Events should be checked by clicking on the
+ * visible and clipped regions. Repeat this for Window, Dialog and Frame.
+ * Expected Result: If PERPIXEL_TRANSPARENT Translucency type is supported, clicking
+ * on clipped region should deliver the event to the background (it should be
+ * another Window behind the test window)
+ *
+ * @author mrkam
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main SetShapeAndClick
+ */
+
+public class SetShapeAndClick extends Common {
+
+ Component south, center, north;
+ volatile int clicked;
+
+ public static void main(String[] args) throws Exception {
+ if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+ for (Class<Window> windowClass: WINDOWS_TO_TEST)
+ new SetShapeAndClick(windowClass).doTest();
+ }
+
+ public SetShapeAndClick(Class windowClass) throws Exception {
+ super(windowClass);
+ }
+
+ @Override
+ public void initBackgroundFrame() {
+ super.initBackgroundFrame();
+ background.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ clicked |= 1 << 0;
+ }
+ });
+ }
+
+ @Override
+ public void initGUI() {
+ if (windowClass.equals(Frame.class)) {
+ window = new Frame();
+ ((Frame) window).setUndecorated(true);
+ } else if (windowClass.equals(Dialog.class)) {
+ window = new Dialog(background);
+ ((Dialog) window).setUndecorated(true);
+ } else {
+ window = new Window(background);
+ }
+
+ window.setLocation(2 * dl, 2 * dl);
+ window.setPreferredSize(new Dimension(200, 200));
+ window.setLayout(new BorderLayout());
+
+ window.addComponentListener(new ComponentAdapter() {
+ public void componentResized(ComponentEvent e) {
+ applyShape();
+ }
+ });
+
+ south = new Label("South");
+ south.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ clicked |= 1 << 3;
+ }
+ });
+ window.add(south, BorderLayout.SOUTH);
+
+ center = new List(5);
+ center.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ clicked |= 1 << 2;
+ }
+ });
+ window.add(center, BorderLayout.CENTER);
+
+ north = new TextField("North");
+ north.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ clicked |= 1 << 1;
+ }
+ });
+ window.add(north, BorderLayout.NORTH);
+
+ window.pack();
+ window.setVisible(true);
+ window.toFront();
+
+ System.out.println("Checking " + window.getClass().getName() + "...");
+ }
+
+ @Override
+ public void doTest() throws Exception {
+
+ robot.waitForIdle();
+
+ Point wls = window.getLocationOnScreen();
+ Point ls;
+ int y;
+ ls = north.getLocationOnScreen();
+ checkClick(ls.x + north.getWidth() / 3, ls.y + north.getHeight() / 2, 1);
+
+ ls = center.getLocationOnScreen();
+ checkClick(ls.x + center.getWidth() * 3 / 4, ls.y + center.getHeight() * 3 / 4, 2);
+
+ ls = south.getLocationOnScreen();
+ checkClick(ls.x + south.getWidth() * 2 / 3, ls.y + south.getHeight() / 2, 3);
+
+ ls = center.getLocationOnScreen();
+ checkClick(ls.x + center.getWidth() / 4, ls.y + center.getHeight() / 4, 2);
+
+ ls = north.getLocationOnScreen();
+ y = ls.y + north.getHeight() / 2;
+ checkClick(wls.x + 200 - (y - wls.y), y, 0);
+
+ EventQueue.invokeAndWait(window::toFront);
+ robot.waitForIdle();
+
+ ls = center.getLocationOnScreen();
+ y = ls.y + center.getHeight() / 2;
+ checkClick(wls.x + 200 - (y - wls.y), y, 0);
+
+ EventQueue.invokeAndWait(window::toFront);
+ robot.waitForIdle();
+
+ ls = south.getLocationOnScreen();
+ y = ls.y + south.getHeight() / 2;
+ checkClick(wls.x + 200 - (y - wls.y), y, 0);
+
+ EventQueue.invokeAndWait(window::dispose);
+ EventQueue.invokeAndWait(background::dispose);
+
+ robot.waitForIdle();
+ }
+
+ @Override
+ public void applyShape() {
+ Area shape = new Area(new Rectangle2D.Float(0, 0, 200, 200));
+ GeneralPath gp;
+ gp = new GeneralPath();
+ gp.moveTo(190, 0);
+ gp.lineTo(200, 0);
+ gp.lineTo(200, 10);
+ gp.lineTo(10, 200);
+ gp.lineTo(0, 200);
+ gp.lineTo(0, 190);
+ gp.closePath();
+ shape.subtract(new Area(gp));
+
+ window.setShape(shape);
+ }
+
+ void checkClick(int x, int y, int flag) throws Exception {
+
+ System.out.println("Trying to click point " + x + ", " + y + ", looking for " + flag + " flag to trigger.");
+
+ clicked = 0;
+ robot.mouseMove(x, y);
+ robot.click();
+
+ for (int i = 0; i < 100; i++)
+ if ((clicked & (1 << flag)) == 0)
+ robot.delay(50);
+ else
+ break;
+
+ if ((clicked & (1 << flag)) == 0)
+ throw new RuntimeException("FAIL: Flag " + flag + " is not triggered for point " + x + ", " + y + "!");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/SetShapeDynamicallyAndClick.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.geom.Area;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Rectangle2D;
+
+/*
+ * @test
+ * @summary Check if dynamically setting a shape works
+ *
+ * Test Description: Check if PERPIXEL_TRANSPARENT Translucency type is supported
+ * by the current platform. Proceed if it is supported. Show a window which
+ * contains some components and apply a shape for the Window when the window
+ * is visible. Shape should be applied in such a way that some components
+ * are partially clipped off. Check if the components appear only partially
+ * and events work correctly for those components - ie, events occur only on
+ * the areas which appear and do not occur on the clipped off areas. Events
+ * should be checked by clicking on the visible and clipped regions. Repeat
+ * this for Window, Dialog and Frame.
+ * Expected Result: If PERPIXEL_TRANSPARENT translucency type is supported,
+ * clicking on clipped region should deliver the event to the background (it
+ * should be another Window behind the test window)
+ *
+ * @author mrkam
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main SetShapeDynamicallyAndClick
+ */
+
+public class SetShapeDynamicallyAndClick extends Common {
+
+ Component south, center, north;
+ volatile int clicked;
+
+ public static void main(String[] args) throws Exception {
+ if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+ for (Class<Window> windowClass: WINDOWS_TO_TEST)
+ new SetShapeDynamicallyAndClick(windowClass).doTest();
+ }
+
+ public SetShapeDynamicallyAndClick(Class windowClass) throws Exception {
+ super(windowClass);
+ }
+
+ @Override
+ public void initBackgroundFrame() {
+ super.initBackgroundFrame();
+ background.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ clicked |= 1 << 0;
+ }
+ });
+ }
+
+ @Override
+ public void initGUI() {
+ if (windowClass.equals(Frame.class)) {
+ window = new Frame();
+ ((Frame) window).setUndecorated(true);
+ } else if (windowClass.equals(Dialog.class)) {
+ window = new Dialog(background);
+ ((Dialog) window).setUndecorated(true);
+ } else {
+ window = new Window(background);
+ }
+
+ window.setLocation(2 * dl, 2 * dl);
+ window.setPreferredSize(new Dimension(200, 200));
+ window.setLayout(new BorderLayout());
+
+ south = new Label("South");
+ south.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ clicked |= 1 << 3;
+ }
+ });
+ window.add(south, BorderLayout.SOUTH);
+
+ center = new List(5);
+ center.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ clicked |= 1 << 2;
+ }
+ });
+ window.add(center, BorderLayout.CENTER);
+
+ north = new TextField("North");
+ north.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ clicked |= 1 << 1;
+ }
+ });
+ window.add(north, BorderLayout.NORTH);
+
+ window.pack();
+ window.setVisible(true);
+ window.toFront();
+
+ System.out.println("Checking " + window.getClass().getName() + "...");
+ }
+
+ @Override
+ public void doTest() throws Exception {
+
+ robot.waitForIdle();
+
+ Point wls = window.getLocationOnScreen();
+ Point ls;
+ int y;
+
+ EventQueue.invokeAndWait(this::applyShape);
+
+ robot.waitForIdle();
+
+ ls = north.getLocationOnScreen();
+ checkClick(ls.x + north.getWidth() / 3, ls.y + north.getHeight() / 2, 1);
+
+ ls = center.getLocationOnScreen();
+ checkClick(ls.x + center.getWidth() * 3 / 4, ls.y + center.getHeight() * 3 / 4, 2);
+
+ ls = south.getLocationOnScreen();
+ checkClick(ls.x + south.getWidth() * 2 / 3, ls.y + south.getHeight() / 2, 3);
+
+ ls = center.getLocationOnScreen();
+ checkClick(ls.x + center.getWidth() / 4, ls.y + center.getHeight() / 4, 2);
+
+ ls = north.getLocationOnScreen();
+ y = ls.y + north.getHeight() / 2;
+ checkClick(wls.x + 200 - (y - wls.y), y, 0);
+
+ EventQueue.invokeAndWait(window::toFront);
+ robot.waitForIdle();
+
+ ls = center.getLocationOnScreen();
+ y = ls.y + center.getHeight() / 2;
+ checkClick(wls.x + 200 - (y - wls.y), y, 0);
+
+ EventQueue.invokeAndWait(window::toFront);
+ robot.waitForIdle();
+
+ ls = south.getLocationOnScreen();
+ y = ls.y + south.getHeight() / 2;
+ checkClick(wls.x + 200 - (y - wls.y), y, 0);
+
+ EventQueue.invokeAndWait(window::dispose);
+ EventQueue.invokeAndWait(background::dispose);
+
+ robot.waitForIdle();
+ }
+
+ @Override
+ public void applyShape() {
+ Area shape = new Area(new Rectangle2D.Float(0, 0, 200, 200));
+ GeneralPath gp;
+ gp = new GeneralPath();
+ gp.moveTo(190, 0);
+ gp.lineTo(200, 0);
+ gp.lineTo(200, 10);
+ gp.lineTo(10, 200);
+ gp.lineTo(0, 200);
+ gp.lineTo(0, 190);
+ gp.closePath();
+ shape.subtract(new Area(gp));
+
+ window.setShape(shape);
+ }
+
+ void checkClick(int x, int y, int flag) throws Exception {
+
+ System.out.println("Trying to click point " + x + ", " + y + ", looking for " + flag + " flag to trigger.");
+
+ clicked = 0;
+ robot.mouseMove(x, y);
+ robot.click();
+
+ for (int i = 0; i < 100; i++)
+ if ((clicked & (1 << flag)) == 0)
+ robot.delay(50);
+ else
+ break;
+
+ if ((clicked & (1 << flag)) == 0)
+ throw new RuntimeException("FAIL: Flag " + flag + " is not triggered for point " + x + ", " + y + "!");
+ }
+}
--- a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Shaped.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Shaped.java Fri Jul 25 09:44:53 2014 +0000
@@ -26,8 +26,22 @@
/*
* @test
- * @summary Check if dynamically shaped window is moved and resized
- * by robot correctly
+ * @summary Check if dynamically shaped window is dragged and resized
+ * by mouse correctly
+ *
+ * Test Description: Check if specified translucency types PERPIXEL_TRANSPARENT
+ * is supported on the current platform. Proceed if it is supported.
+ * Create a window apply shape in componentResized listener. The shape
+ * should match the window size. Drag and resize the window using AWT Robot
+ * and verify that shape is correctly applied both with pixels checking and
+ * clicks. Make the window appear on top of a known background. Repeat this
+ * for Window, Dialog, Frame,
+ * Expected Result: If PERPIXEL_TRANSPARENT translucency type is supported,
+ * the window should appear with the expected shape. Clicks should come
+ * to visible parts of shaped window only and to background for clipped
+ * parts.
+ *
+ * @author mrkam
* @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
* @library ../../../../lib/testlibrary
* @build Common ExtendedRobot
@@ -45,8 +59,11 @@
public Shaped(Class windowClass) throws Exception{
super(windowClass);
}
+
+ @Override
public void applyShape(){ applyDynamicShape(); }
+ @Override
public void doTest() throws Exception{
super.doTest();
--- a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedByAPI.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedByAPI.java Fri Jul 25 09:44:53 2014 +0000
@@ -26,8 +26,21 @@
/*
* @test
- * @summary Check if dynamically shaped window is moved and resized
- * using API correctly
+ * @summary Check if dynamically shaped window is moved and resized by
+ * API correctly.
+ *
+ * Test Description: Check if PERPIXEL_TRANSPARENT translucency type is
+ * supported on the current platform. Proceed if it is supported. Create
+ * a window and apply shape in componentResized listener. The shape should
+ * match the window size. Drag and resize the window using API and verify
+ * that shape is correctly applied both with pixels checking and clicks.
+ * Make the window appear on top of a known background. Repeat this for
+ * Window, Dialog, Frame.
+ * Expected Result: If PERPIXEL_TRANSPARENT translucency type is supported, the
+ * window should appear with the expected shape. Clicks should come to visible
+ * parts of shaped window only and to background for clipped parts.
+ *
+ * @author mrkam
* @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
* @library ../../../../lib/testlibrary
* @run main ShapedByAPI
@@ -44,8 +57,11 @@
public ShapedByAPI(Class windowClass) throws Exception{
super(windowClass);
}
+
+ @Override
public void applyShape(){ applyDynamicShape(); }
+ @Override
public void doTest() throws Exception{
super.doTest();
--- a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedTranslucent.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedTranslucent.java Fri Jul 25 09:44:53 2014 +0000
@@ -27,6 +27,20 @@
* @test
* @summary Check if a translucent shaped window is dragged and
* resized correctly.
+ *
+ * Test Description: Check if TRANSLUCENT and PERPIXEL_TRANSPARENT translucency
+ * types are supported on the current platform. Proceed if it is supported.
+ * Create and apply opacity of 0.3 and apply shape in componentResized
+ * listener. Drag and resize the window using AWT Robot and verify that
+ * shape and translucency are correctly applied both with pixels checking
+ * and clicks. Make the window appear on top of a known background. Repeat
+ * this for Window, Dialog, Frame.
+ * Expected Result: If TRANSLUCENT and PERPIXEL_TRANSPARENT translucency types are
+ * supported, the window should appear with the expected shape and translucency.
+ * Clicks should come to visible parts of shaped window only and to background
+ * for clipped parts.
+ *
+ * @author mrkam
* @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
* @library ../../../../lib/testlibrary
* @build Common ExtendedRobot
@@ -46,8 +60,10 @@
super(windowClass, 0.3f);
}
+ @Override
public void applyShape(){ applyDynamicShape(); }
+ @Override
public void doTest() throws Exception{
super.doTest();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/ShapedTranslucentWindowClick.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.geom.Area;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Rectangle2D;
+import java.util.BitSet;
+
+/*
+ * @test
+ * @summary Check if a translucent shaped window trigger events correctly.
+ *
+ * Test Description: Check if TRANSLUCENT and PERPIXEL_TRANSPARENT traslucency
+ * types are supported on the current platform. Proceed if both are
+ * supported. Create a window with some components in it and a shape
+ * applied. Apply the shape such that some components are partially
+ * clipped. Set an opacity value less than 1. Check if the components
+ * behave correctly on mouse and key events. Do this test for awt Window.
+ * Expected Result: Mouse and key events must work correctly. Only that portion
+ * of a component within the shape should trigger events. Key events
+ * should be tested for focus events and TextField/TextArea.
+ *
+ * @author mrkam
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main ShapedTranslucentWindowClick
+ */
+
+public class ShapedTranslucentWindowClick extends Common {
+
+ Component south, center, north;
+
+ volatile BitSet backgroundFlags = new BitSet(11);
+ volatile BitSet southFlags = new BitSet(11);
+ volatile BitSet centerFlags = new BitSet(11);
+ volatile BitSet northFlags = new BitSet(11);
+ static BitSet reference = BitSet.valueOf(new long[] {2047}); // 111 1111 1111
+
+ public static void main(String[] ignored) throws Exception{
+ if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT) &&
+ checkTranslucencyMode(GraphicsDevice.WindowTranslucency.TRANSLUCENT))
+ new ShapedTranslucentWindowClick(Window.class).doTest();
+ }
+
+ public ShapedTranslucentWindowClick(Class windowClass) throws Exception {
+ super(windowClass);
+ addListeners(south, southFlags);
+ addListeners(center, centerFlags);
+ addListeners(north, northFlags);
+ addListeners(background, backgroundFlags);
+ }
+
+ @Override
+ public void initGUI() {
+
+ window = new Window(background);
+ south = new Button("South Button");
+ center = new TextArea("Center Text Area");
+ north = new TextField("North Text Field");
+
+ window.setLocation(250, 250);
+ window.setPreferredSize(new Dimension(200, 200));
+ window.setOpacity(0.7f);
+ applyShape();
+ window.setLayout(new BorderLayout());
+
+ window.add(south, BorderLayout.SOUTH);
+ window.add(center, BorderLayout.CENTER);
+ window.add(north, BorderLayout.NORTH);
+
+ window.pack();
+ window.setVisible(true);
+ window.toFront();
+
+ System.out.println("Checking " + window.getClass().getName() + "...");
+ }
+
+ @Override
+ public void doTest() throws Exception {
+
+ robot.waitForIdle();
+ robot.mouseMove(background.getLocationOnScreen().x+50, background.getLocationOnScreen().y+50);
+ robot.waitForIdle();
+ robot.click();
+
+ Point wls = window.getLocationOnScreen();
+ Point ls;
+ int y;
+
+ robot.waitForIdle();
+
+ ls = north.getLocationOnScreen();
+ checkClickAndType(ls.x + north.getWidth() / 3, ls.y + north.getHeight() / 2, northFlags);
+
+ ls = center.getLocationOnScreen();
+ checkClickAndType(ls.x + center.getWidth() / 4, ls.y + center.getHeight() / 4, centerFlags);
+
+ ls = center.getLocationOnScreen();
+ checkClickAndType(ls.x + center.getWidth() * 3 / 4, ls.y + center.getHeight() * 3 / 4, centerFlags);
+
+ ls = south.getLocationOnScreen();
+ checkClickAndType(ls.x + south.getWidth() * 2 / 3, ls.y + south.getHeight() / 2, southFlags);
+
+ ls = north.getLocationOnScreen();
+ y = ls.y + north.getHeight() / 2;
+ checkClickAndType(wls.x + 200 - (y - wls.y), y, backgroundFlags);
+
+ EventQueue.invokeAndWait(window::toFront);
+ robot.waitForIdle();
+
+ ls = center.getLocationOnScreen();
+ y = ls.y + center.getHeight() / 2;
+ checkClickAndType(wls.x + 200 - (y - wls.y), y, backgroundFlags);
+
+ EventQueue.invokeAndWait(window::toFront);
+ robot.waitForIdle();
+
+ ls = south.getLocationOnScreen();
+ y = ls.y + south.getHeight() / 2;
+ checkClickAndType(wls.x + 200 - (y - wls.y), y, backgroundFlags);
+
+ EventQueue.invokeAndWait(window::dispose);
+ EventQueue.invokeAndWait(background::dispose);
+
+ robot.waitForIdle();
+ }
+
+ @Override
+ public void applyShape() {
+ Area shape = new Area(new Rectangle2D.Float(0, 0, 200, 200));
+ GeneralPath gp;
+ gp = new GeneralPath();
+ gp.moveTo(190, 0);
+ gp.lineTo(200, 0);
+ gp.lineTo(200, 10);
+ gp.lineTo(10, 200);
+ gp.lineTo(0, 200);
+ gp.lineTo(0, 190);
+ gp.closePath();
+ shape.subtract(new Area(gp));
+
+ window.setShape(shape);
+ }
+
+ void checkClickAndType(int x, int y, BitSet bits){
+ bits.clear(0, 10);
+
+ robot.mouseMove(x, y);
+ robot.click();
+ robot.dragAndDrop(MouseInfo.getPointerInfo().getLocation(), new Point(x+5, y));
+ robot.mouseWheel(1);
+ robot.waitForIdle();
+
+ robot.type('a');
+
+ robot.mouseMove(350, 50);
+ robot.waitForIdle();
+
+ //robot.delay(20*1000);
+ if (!bits.equals(reference)){
+ for( int i = 0; i < 11; i++)
+ System.err.print(( bits.get(i) ? 1 : 0 ) + ", ");
+ System.err.println();
+ throw new RuntimeException("Bit mask is not fully set: "+bits);
+ }
+ }
+
+ static void addListeners(Component component, BitSet bits) {
+ component.addMouseListener(new MouseListener() {
+ public void mouseClicked(MouseEvent e) { bits.set(0);}
+ public void mousePressed(MouseEvent e) { bits.set(1); }
+ public void mouseReleased(MouseEvent e) { bits.set(2); }
+ public void mouseEntered(MouseEvent e) { bits.set(3); }
+ public void mouseExited(MouseEvent e) { bits.set(4); }
+ });
+ component.addMouseMotionListener(new MouseMotionListener() {
+ public void mouseDragged(MouseEvent e) { bits.set(5); }
+ public void mouseMoved(MouseEvent e) { bits.set(6); }
+ });
+ component.addMouseWheelListener((e) -> bits.set(7));
+ component.addKeyListener(new KeyListener() {
+ public void keyTyped(KeyEvent e) { bits.set(8); }
+ public void keyPressed(KeyEvent e) { bits.set(9); }
+ public void keyReleased(KeyEvent e) { bits.set(10); }
+ });
+ };
+}
--- a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/StaticallyShaped.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/StaticallyShaped.java Fri Jul 25 09:44:53 2014 +0000
@@ -26,8 +26,21 @@
/*
* @test
- * @summary Check if statically shaped window is dragged and resized
- * correctly.
+ * @summary Check if statically shaped window is dragged and resized correctly.
+ *
+ * Test Description: Check if PERPIXEL_TRANSPARENT translucency type is supported
+ * on the current platform. Proceed if it is supported. Create a window
+ * and apply some shape at window creation. The shape should be bigger than
+ * window. Drag and resize the window using AWT Robot and verify that shape
+ * is correctly applied both with pixels checking and clicks. Make the
+ * window appear on top of a known background. Repeat this for Window, Dialog,
+ * Frame.
+ * Expected Result: If specified translucency type PERPIXEL_TRANSPARENT is supported,
+ * the window should appear with the expected shape clipped to the window
+ * size. Clicks should come to visible parts of shaped window only and to
+ * background for clipped parts.
+ *
+ * @author mrkam
* @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
* @library ../../../../lib/testlibrary
* @build Common ExtendedRobot
@@ -44,8 +57,11 @@
}
public StaticallyShaped(Class windowClass) throws Exception{ super(windowClass); }
+
+ @Override
public void applyShape(){ applyStaticShape(); }
+ @Override
public void doTest() throws Exception{
super.doTest();
--- a/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Translucent.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/Translucent.java Fri Jul 25 09:44:53 2014 +0000
@@ -26,7 +26,19 @@
/*
* @test
* @summary Check if translucent window is dragged and resized
- correctly.
+ * correctly.
+ *
+ * Test Description: Check if TRANSLUCENT translucency type is supported
+ * on the current platform. Proceed if they are supported. Create
+ * a window and apply opacity of 0.3. Drag and resize the window
+ * using AWT Robot and verify that translucency is not affected.
+ * Make the window appear on top of a known background. Repeat this
+ * for Window, Dialog, Frame.
+ * Expected Result: If TRANSLUCENT translucency type is supported, the
+ * window should show the background. Dragging and resizing
+ * shouldn't affect the translucency.
+ *
+ * @author mrkam
* @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
* @library ../../../../lib/testlibrary
* @build Common ExtendedRobot
@@ -35,8 +47,7 @@
public class Translucent extends Common {
public static void main(String[] args) throws Exception {
- if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.TRANSLUCENT) &&
- checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+ if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.TRANSLUCENT))
for (Class<Window> windowClass: WINDOWS_TO_TEST){
new Translucent(windowClass).doTest();
}
@@ -46,8 +57,10 @@
super(windowClass, 0.3f);
}
+ @Override
public void applyShape(){ }
+ @Override
public void doTest() throws Exception{
super.doTest();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/TranslucentChoice.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+/*
+ * @test
+ * @summary Check if a Choice present in a window set with opacity less than 1.0
+ * shows a translucent drop down
+ *
+ * Test Description: Check if TRANSLUCENT Translucency type is supported on the
+ * current platform. Proceed if supported. Show a window which contains an
+ * awt Choice and set with opacity less than 1.0. Another Window having a
+ * canvas component drawn with an image can be used as the background for
+ * the test window. Click on the ComboBox to show the drop down. Check if
+ * the drop down appears translucent. Repeat this for Window, Dialog and
+ * Frame.
+ * Expected Result: If TRANSLUCENT Translucency type is supported, the drop down
+ * should appear translucent.
+ *
+ * @author mrkam
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main TranslucentChoice
+ */
+
+public class TranslucentChoice extends Common {
+
+ Choice south;
+ Component center;
+ Component north;
+ volatile int clicked;
+
+ public static void main(String[] ignored) throws Exception {
+ if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.TRANSLUCENT))
+ for (Class<Window> windowClass: WINDOWS_TO_TEST){
+ new TranslucentChoice(windowClass).doTest();
+ }
+ }
+
+ public TranslucentChoice(Class windowClass) throws Exception {
+ super(windowClass);
+ }
+
+ @Override
+ public void initBackgroundFrame() {
+ super.initBackgroundFrame();
+ background.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ clicked |= 1 << 0;
+ }
+ });
+ }
+
+ @Override
+ public void initGUI() {
+ if (windowClass.equals(Frame.class)) {
+ window = new Frame();
+ ((Frame) window).setUndecorated(true);
+ } else if (windowClass.equals(Dialog.class)) {
+ window = new Dialog(background);
+ ((Dialog) window).setUndecorated(true);
+ } else {
+ window = new Window(background);
+ }
+
+ window.setBackground(FG_COLOR);
+ north = new Button("north");
+ window.add(north, BorderLayout.NORTH);
+
+ center = new List(5);
+ window.add(center, BorderLayout.CENTER);
+
+ Choice choice = new Choice();
+ for(int i = 0; i < 20; i++) {
+ choice.add("item " + i);
+ }
+ south = choice;
+
+ south.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ clicked |= 1 << 1;
+ }
+ });
+
+ window.add(south, BorderLayout.SOUTH);
+ window.setAlwaysOnTop(true);
+ window.setOpacity(0.3f);
+ window.setLocation(2 * dl, 2 * dl);
+ window.setSize(255, 255);
+ window.pack();
+ window.setVisible(true);
+
+ System.out.println("Checking " + window.getClass().getName() + "...");
+ }
+
+ @Override
+ public void doTest() throws Exception {
+
+ Point ls = window.getLocationOnScreen();
+ clicked = 0;
+ checkClick(ls.x + window.getWidth() / 2, ls.y - 5, 0);
+
+ robot.waitForIdle(2000);
+
+ ls = south.getLocationOnScreen();
+
+ Point p1 = new Point((int) (ls.x + south.getWidth() * 0.75), ls.y + south.getHeight() * 3);
+ Point p2 = new Point((int) (ls.x + south.getWidth() * 0.75), ls.y - south.getHeight() * 2);
+ Color c1 = robot.getPixelColor(p1.x, p1.y);
+ Color c2 = robot.getPixelColor(p2.x, p2.y);
+
+ checkClick(ls.x + south.getWidth() / 2, ls.y + south.getHeight() / 2, 1);
+
+ robot.waitForIdle(2000);
+
+ Color c1b = robot.getPixelColor(p1.x, p1.y);
+ Color c2b = robot.getPixelColor(p2.x, p2.y);
+
+ if (!aproximatelyEquals(c1, c1b) && !aproximatelyEquals(south.getBackground(), c1b))
+ throw new RuntimeException("Check for opaque drop down failed. Before click: " + c1 + ", after click: " + c1b + ", expected is " + south.getBackground());
+
+ if (!aproximatelyEquals(c2,c2b) && !aproximatelyEquals(south.getBackground(), c2b))
+ throw new RuntimeException("Check for opaque drop down failed. Before click: " + c2 + ", after click: " + c2b + ", expected is " + south.getBackground());
+
+ EventQueue.invokeAndWait(() -> {
+ background.dispose();
+ window.dispose();
+ });
+
+ robot.waitForIdle();
+ }
+
+ boolean aproximatelyEquals(Color c1, Color c2) {
+ return ((Math.abs(c1.getRed()-c2.getRed())/256.0 +
+ Math.abs(c1.getGreen()-c2.getGreen())/256.0 +
+ Math.abs(c1.getBlue()-c2.getBlue())/256.0)) / 3 < 0.02;
+ }
+
+ @Override
+ public void applyShape() { }
+
+
+ void checkClick(int x, int y, int flag) throws Exception {
+
+ System.out.println("Trying to click point " + x + ", " + y + ", looking for " + flag + " flag to trigger.");
+
+ clicked = 0;
+ robot.mouseMove(x, y);
+ robot.click();
+
+ for (int i = 0; i < 100; i++)
+ if ((clicked & (1 << flag)) == 0)
+ robot.delay(50);
+ else
+ break;
+
+ if ((clicked & (1 << flag)) == 0)
+ throw new RuntimeException("FAIL: Flag " + flag + " is not triggered for point " + x + ", " + y + "!");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/ShapedAndTranslucentWindows/TranslucentWindowClick.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+/*
+ * @test
+ * @summary Check if components present in a window set with opacity less than 1.0
+ * triggers events correctly
+ *
+ * Test Description: Check if TRANSLUCENT Translucency type is supported on the
+ * current platform. Proceed if supported. Show a window which contains some
+ * components and set with opacity less than 1.0. Another Window having a
+ * canvas component drawn with an image can be used as the background for the
+ * test window. Click on the components present in the window and check if
+ * events trigger correctly.
+ * Expected Result: The components should trigger events correctly
+ *
+ * @author mrkam
+ * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
+ * @library ../../../../lib/testlibrary
+ * @build Common ExtendedRobot
+ * @run main TranslucentWindowClick
+ */
+public class TranslucentWindowClick extends Common {
+
+ private Component south;
+ private Component center;
+ private Component north;
+
+ volatile int clicked;
+
+ public static void main(String[] args) throws Exception{
+ if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.TRANSLUCENT))
+ new TranslucentWindowClick(Window.class).doTest();
+ }
+
+ public TranslucentWindowClick(Class windowClass) throws Exception {
+ super(windowClass);
+ }
+
+ @Override
+ public void initGUI() {
+ if (windowClass.equals(Frame.class)) {
+ window = new Frame();
+ ((Frame) window).setUndecorated(true);
+ } else if (windowClass.equals(Dialog.class)) {
+ window = new Dialog(background);
+ ((Dialog) window).setUndecorated(true);
+ } else {
+ window = new Window(background);
+ }
+
+ window.setPreferredSize(new Dimension(200, 200));
+ window.setLocation(2 * dl, 2 * dl);
+ window.setLayout(new BorderLayout());
+ window.setBackground(FG_COLOR);
+
+ south = new Button("South");
+ south.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) { clicked |= 1 << 2; }
+ });
+ window.add(south, BorderLayout.SOUTH);
+
+ center = new List(5);
+ center.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) { clicked |= 1 << 1; }
+ });
+ window.add(center, BorderLayout.CENTER);
+
+ north = new TextField("North");
+ north.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) { clicked |= 1 << 0; }
+ });
+ window.add(north, BorderLayout.NORTH);
+ window.setOpacity(0.2f);
+ window.pack();
+ window.setVisible(true);
+
+ System.out.println("Checking " + window.getClass().getName() + "...");
+ }
+
+ @Override
+ public void doTest() throws Exception {
+ Point ls;
+ robot.waitForIdle();
+
+ ls = north.getLocationOnScreen();
+ checkClick(ls.x + north.getWidth() / 3, ls.y + north.getHeight() / 2, 0);
+
+ ls = center.getLocationOnScreen();
+ checkClick(ls.x + center.getWidth() / 4, ls.y + center.getHeight() / 4, 1);
+
+ ls = center.getLocationOnScreen();
+ checkClick(ls.x + center.getWidth() * 3 / 4, ls.y + center.getHeight() * 3 / 4, 1);
+
+ ls = south.getLocationOnScreen();
+ checkClick(ls.x + south.getWidth() * 2 / 3, ls.y + south.getHeight() / 2, 2);
+
+ EventQueue.invokeAndWait(() -> {
+ background.dispose();
+ window.dispose();
+ });
+
+ robot.waitForIdle();
+ }
+
+ @Override
+ public void applyShape() { }
+
+ void checkClick(int x, int y, int flag) throws Exception {
+
+ System.out.println("Trying to click point " + x + ", " + y + ", looking for " + flag + " flag to trigger.");
+
+ clicked = 0;
+ robot.mouseMove(x, y);
+ robot.click();
+
+ for (int i = 0; i < 100; i++)
+ if ((clicked & (1 << flag)) == 0)
+ robot.delay(50);
+ else
+ break;
+
+ if ((clicked & (1 << flag)) == 0)
+ throw new RuntimeException("FAIL: Flag " + flag + " is not triggered for point " + x + ", " + y + "!");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/Clipboard/BasicClipboardTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2002, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.*;
+
+/*
+ * @test
+ * @summary To test the basic Clipboard functions
+ * @author Kanishk Jethi (kanishk.jethi@sun.com) area=Clipboard
+ * @run main BasicClipboardTest
+ */
+
+public class BasicClipboardTest implements ClipboardOwner {
+
+ StringSelection strSelect = new StringSelection("Transferable String Selection");
+ StringSelection strCheck;
+ String clipName = "Test Clipboard";
+ Clipboard clip = new Clipboard(clipName);
+ DataFlavor dataFlavor, testDataFlavor ;
+ DataFlavor dataFlavorArray[];
+ Object testObject;
+ String strTest = null;
+
+ public static void main (String[] args) throws Exception {
+ new BasicClipboardTest().doTest();
+ }
+
+ public void doTest() throws Exception {
+ dataFlavor = new DataFlavor(DataFlavor.javaRemoteObjectMimeType, null, this.getClass().getClassLoader());
+ // test for null return of selectBestTextFlavor if input is null or
+ // of zero length
+ testDataFlavor = DataFlavor.selectBestTextFlavor(dataFlavorArray);
+ if (testDataFlavor != null)
+ throw new RuntimeException("\n***Error in selectBestTextFlavor");
+
+ dataFlavorArray = new DataFlavor[0];
+
+ testDataFlavor = DataFlavor.selectBestTextFlavor(dataFlavorArray);
+ if (testDataFlavor != null)
+ throw new RuntimeException("\n***Error in selectBestTextFlavor");
+
+ // test for null return when there are no text flavors in array
+ dataFlavorArray = new DataFlavor[1];
+ dataFlavorArray[0] = new DataFlavor(DataFlavor.javaSerializedObjectMimeType + ";class=java.io.Serializable");
+
+ testDataFlavor = DataFlavor.selectBestTextFlavor(dataFlavorArray);
+ if (testDataFlavor != null)
+ throw new RuntimeException("\n***Error in selectBestTextFlavor");
+
+ if (clip.getName() != clipName)
+ throw new RuntimeException("\n*** Error in Clipboard.getName()");
+
+ // set the owner of the clipboard to null to check branch coverage
+ // of the setContents method
+ clip.setContents(null, null);
+
+ //set the owner of the clipboard to something valid to check branch
+ //coverage of the setContents method
+ clip.setContents(null, new BasicClipboardTest());
+
+ //set the owner of the clipboard to this to check branch coverage
+ // of the setContents method
+ clip.setContents(null, this);
+
+ //set the contents of the clipboard
+ clip.setContents(strSelect, this);
+
+ //get the contents of the clipboard
+ strCheck = (StringSelection)clip.getContents(this);
+ if (!strCheck.equals(strSelect))
+ throw new RuntimeException("\n***The contents of the clipboard are "
+ + "not the same as those that were set");
+
+ //Check if getReaderForText throws IAE when the Transferable has
+ //null TransferData
+ dataFlavor = DataFlavor.stringFlavor;
+ strSelect = new StringSelection(null);
+ try {
+ testObject = dataFlavor.getReaderForText(strSelect);
+ throw new RuntimeException("\n***Error in getReaderForText. An IAE should have been thrown");
+ } catch (IllegalArgumentException iae) {
+ // do nothing as this is expected
+ }
+
+ //Check getParameter
+ dataFlavor.setHumanPresentableName("String Flavor");
+ if (!(dataFlavor.getParameter("humanPresentableName")).equals("String Flavor"))
+ throw new RuntimeException("\n***Error in getParameter");
+
+ //Check equals
+ try {
+ if (dataFlavor.isMimeTypeEqual(strTest))
+ throw new RuntimeException("\n***Error in DataFlavor.equals(String s)");
+ } catch (NullPointerException e) {
+ //do nothing as it is expected
+ }
+
+ if (!(dataFlavor.isMimeTypeEqual(dataFlavor.getMimeType())))
+ throw new RuntimeException("\n***Error in DataFlavor.equals(String s)");
+
+ //Check isMimeTypeSerializedObject
+ if (!dataFlavorArray[0].isMimeTypeSerializedObject())
+ throw new RuntimeException("\n***Error in isMimeTypeSerializedObject()");
+ System.out.println(dataFlavorArray[0].getDefaultRepresentationClass());
+ System.out.println(dataFlavorArray[0].getDefaultRepresentationClassAsString());
+ //Check isFlavorRemoteObjectType
+ if (dataFlavor.isFlavorRemoteObjectType())
+ System.out.println("The DataFlavor is a remote object type");
+
+ //Check clone()
+ testDataFlavor = (DataFlavor)dataFlavor.clone();
+ }
+
+ public void lostOwnership (Clipboard clipboard, Transferable contents) { }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/Clipboard/GetContentsInterruptedTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.ClipboardOwner;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+/*
+ * @test
+ * @bug 4532299 4648733
+ * @summary Tests that getting clipboard contents on the interrupted thread will
+ * not cause deadlock.Also check that lostOwnership event occurs while
+ * cross-JVM interaction
+ * @author Kanishk Jethi
+ * @run main GetContentsInterruptedTest
+ */
+
+public class GetContentsInterruptedTest implements ClipboardOwner {
+
+ final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ final Transferable transferable = new StringSelection("TEXT");
+ private final Object o = new Object();
+
+ public static void main(String args[]) throws Exception {
+ if (System.getProperty("os.name").startsWith("Mac")) {
+ System.out.println("This tests should not be run on OS X. " +
+ "See CR 7124344 for more info");
+ } else {
+ boolean subTestFlag = false;
+ for (String arg : args) {
+ if (arg.indexOf("SubTest") != -1)
+ subTestFlag = true;
+ }
+
+ if (!subTestFlag) {
+ new GetContentsInterruptedTest().performTest();
+ } else {
+ new GetContentsInterruptedTest().execute();
+ }
+ }
+ }
+
+ private void performTest() throws Exception {
+ int retCode;
+ String javaPath = System.getProperty("java.home", "");
+ String javaClasspath = System.getProperty("java.class.path", ".");
+ String command = javaPath + File.separator + "bin" +
+ File.separator + "java -classpath " + javaClasspath +
+ " GetContentsInterruptedTest SubTest";
+ System.out.println(command);
+ boolean processExit = false;
+
+ clipboard.setContents(transferable, this);
+ Process process = Runtime.getRuntime().exec(command);
+ synchronized (o) {
+ o.wait(10000);
+ }
+
+ try {
+ retCode = process.exitValue();
+ processExit = true;
+ }catch (IllegalThreadStateException e){
+ throw new RuntimeException(e);
+ }
+ System.out.println("[RESULT] : " +
+ "The sub process has cleanly exited : PASS");
+
+ System.out.println("[RESULT] : Child returned: " + retCode );
+
+ InputStream errorStream = process.getErrorStream();
+ System.out.println("========= Child process stderr ========");
+ dumpStream(errorStream);
+ System.out.println("=======================================");
+
+ InputStream processInputStream = process.getInputStream();
+ System.out.println("========= Child process output ========");
+ dumpStream(processInputStream);
+ System.out.println("=======================================");
+
+ if (!processExit) {
+ process.destroy();
+ throw new RuntimeException("[RESULT] : " +
+ "The sub process has not exited : FAIL");
+ }
+ }
+
+ /*
+ * execute is run through another instance of this class.
+ * it acquires the systemClipboard through another JVM.
+ */
+ public void execute() {
+ System.out.println("Hello world");
+ final ClipboardOwner clipboardOwner = new ClipboardOwner() {
+ public void lostOwnership(Clipboard clipboard, Transferable contents) {
+ System.exit(0);
+ }
+ };
+ clipboard.setContents(transferable, clipboardOwner);
+ synchronized (o) {
+ try {
+ o.wait();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+ }
+
+ public void dumpStream(InputStream in) throws IOException {
+ String tempString;
+ int count = in.available();
+ while (count > 0) {
+ byte[] b = new byte[count];
+ in.read(b);
+ tempString = new String(b);
+ if (tempString.indexOf("Exception") != -1 )
+ throw new RuntimeException("[RESULT] :" +
+ " Exception in child process : FAIL");
+ System.out.println(tempString);
+ count = in.available();
+ }
+ }
+
+ public void lostOwnership(Clipboard clip, Transferable contents) {
+ new Thread(() -> {
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ clipboard.getContents(null);
+ Thread.currentThread().interrupt();
+ clipboard.getContents(null);
+ clipboard.setContents(transferable, null);
+ }).start();
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/ImageTransfer/ImageTransferTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 1999, 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
+ * 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.
+ */
+
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary To check Whether java.awt.Image can be transferred through the
+ * system clipboard
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @author dmitriy.ermashov@oracle.com
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main ImageTransferTest
+ */
+
+public class ImageTransferTest {
+
+ TestFrame frame1, frame2;
+ Image image1, image2;
+ DataFlavor imageFlavor;
+
+ public static void main(String[] args) throws Exception {
+ new ImageTransferTest().doTest();
+ }
+
+ class TestFrame extends Frame {
+ boolean show;
+ Image img;
+ public TestFrame(boolean show, Image img){
+ this.show = show;
+ this.img = img;
+ }
+
+ public void paint( Graphics g ){
+ if (show)
+ g.drawImage( this.img, 30, 30, this );
+ }
+ }
+
+ class TransferableObject implements Transferable, ClipboardOwner {
+
+ Object data;
+ DataFlavor[] dfs;
+
+ public TransferableObject(Object data) throws Exception {
+ Vector v = new Vector();
+ imageFlavor = new DataFlavor("image/x-java-Image;class=java.awt.Image");
+ imageFlavor.setHumanPresentableName("Java Image Flavor Object");
+
+ if( data instanceof java.awt.Image )
+ v.addElement(imageFlavor);
+
+ dfs = new DataFlavor[v.size()];
+ v.copyInto(dfs);
+
+ for (int j = 0; j < dfs.length; j++)
+ System.out.println(" in constructor flavor : " + dfs[j]);
+
+ this.data = data;
+ }
+
+ public Object getTransferData(DataFlavor flavor)
+ throws UnsupportedFlavorException,IOException {
+
+ System.out.println(" **************");
+ System.out.println(" The flavor passed to retrive the data :-" + flavor);
+ System.out.println(" The flavors supported");
+ for (int j = 0; j < dfs.length; j++)
+ System.out.println(" jitu flavor : " + dfs[j]);
+
+ System.out.println(" **************");
+
+ if(!isDataFlavorSupported(flavor))
+ throw new UnsupportedFlavorException(flavor);
+
+ if(imageFlavor.equals(flavor)){
+ if( data instanceof java.awt.Image )
+ return data;
+ }
+ return null;
+
+ }
+
+ public DataFlavor[] getTransferDataFlavors() { return dfs; }
+
+ public boolean isDataFlavorSupported(DataFlavor flavor) {
+ for (int i = 0 ; i < dfs.length; i++)
+ if (dfs[i].match(flavor)) return true;
+ return false;
+ }
+
+ public void lostOwnership(Clipboard clip,Transferable contents) {
+ System.out.println(" LostOwnership is invoked");
+ }
+ }
+
+ ImageTransferTest() throws Exception {
+ BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
+ Graphics g = img.createGraphics();
+ g.setColor(Color.WHITE);
+ g.fillRect(0, 0, 100, 100);
+ g.setColor(Color.RED);
+ g.fillRect(20, 20, 60, 60);
+ g.dispose();
+
+ image1 = img;
+ frame1 = new TestFrame(true, image1);
+ frame2 = new TestFrame(false, null);
+
+ System.out.println("Inside contrucor...");
+
+ imageFlavor = new DataFlavor("image/x-java-Image;class=java.awt.Image");
+ imageFlavor.setHumanPresentableName("Java Image Flavor Object");
+
+ frame1.setBounds(10,350,200,200);
+ frame2.setBounds(250,350,200,200);
+ frame1.setVisible(true);
+ frame2.setVisible(true);
+ frame1.repaint();
+ }
+
+ public void compareImages() {
+ if (image2 == image1)
+ System.out.println("Pasted Image is same as that one copied !");
+ else
+ if (image2 != image1)
+ throw new RuntimeException("Image retreived from the Clipboard is not the same " +
+ "image that was set to the Clipboard");
+ }
+
+
+ public void doTest() throws Exception {
+ ExtendedRobot robot = new ExtendedRobot();
+ robot.waitForIdle(2000);
+ TransferableObject imagedata = new TransferableObject(image1);
+
+ Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
+ System.out.println("copying image...");
+ if (imagedata != null) {
+ clip.setContents(imagedata, imagedata);
+ } else {
+ System.out.println("Transferable object is null");
+ }
+
+ Transferable content = clip.getContents(this);
+ if (content != null && (content.isDataFlavorSupported(imageFlavor))) {
+ System.out.println("jitu after paste" + content);
+ image2 = (Image) content.getTransferData(imageFlavor);
+ } else {
+ System.out.println("Contents of the clipboard is null");
+ }
+
+ frame2.img = image2;
+ frame2.show = true;
+ frame2.repaint();
+
+ robot.waitForIdle(2000);
+
+ compareImages();
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/Independence/IndependenceAWTTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 1999, 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
+ * 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.
+ */
+
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.event.*;
+import java.util.Properties;
+
+/*
+ * @test
+ * @summary To make sure that System & Primary clipboards should behave independently
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @author dmitriy.ermashov@oracle.com
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main IndependenceAWTTest
+ */
+
+public class IndependenceAWTTest {
+
+ Frame frame;
+ Panel panel;
+ TextField tf1, tf2, tf3;
+ Clipboard sClip, pClip;
+
+ public static void main (String[] args) throws Exception {
+ new IndependenceAWTTest().doTest();
+ }
+
+ public IndependenceAWTTest() {
+
+ frame = new Frame();
+ frame.setSize(200, 200);
+
+ // This textfield will be used to update the contents of clipboards
+ tf1 = new TextField();
+ tf1.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent fe) {
+ tf1.setText("Clipboards_Independance_Testing");
+ }
+ });
+
+ // TextFields to get the contents of clipboard
+ tf2 = new TextField();
+ tf3 = new TextField();
+
+ panel = new Panel();
+ panel.setLayout(new BorderLayout());
+
+ panel.add(tf2, BorderLayout.NORTH);
+ panel.add(tf3, BorderLayout.SOUTH);
+
+ frame.add(tf1, BorderLayout.NORTH);
+ frame.add(panel, BorderLayout.CENTER);
+
+ frame.setVisible(true);
+ tf1.requestFocus();
+ }
+
+ public void checkSecurity() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null) {
+ System.out.println("security manager is not there");
+ getPrimaryClipboard();
+ } else {
+ sm.checkPermission(new AWTPermission("accessClipboard"));
+ getPrimaryClipboard();
+ }
+ }
+
+ // Get System Selection i.e. Primary Clipboard
+ private void getPrimaryClipboard() {
+ Properties ps = System.getProperties();
+ String operSys = ps.getProperty("os.name");
+ try {
+ pClip = Toolkit.getDefaultToolkit().getSystemSelection();
+ if (pClip == null)
+ if ((operSys.substring(0,3)).equalsIgnoreCase("Win") || operSys.toLowerCase().contains("os x"))
+ System.out.println(operSys + "Operating system does not support system selection ");
+ else
+ throw new RuntimeException("Method getSystemSelection() is returning null on X11 platform");
+ } catch(HeadlessException e) {
+ System.out.println("Headless exception thrown " + e);
+ }
+ }
+
+ // Method to get the contents of both of the clipboards
+ public void getClipboardsContent() throws Exception {
+ sClip = Toolkit.getDefaultToolkit().getSystemClipboard();
+ Transferable tp;
+ Transferable ts;
+
+ StringSelection content = new StringSelection(tf1.getText());
+ sClip.setContents(content,content);
+
+ tp = pClip.getContents(this);
+ ts = sClip.getContents(this);
+
+ // Paste the contents of System clipboard on textfield tf2 while the paste the contents of
+ // of primary clipboard on textfiled tf3
+ if ((ts != null) && (ts.isDataFlavorSupported(DataFlavor.stringFlavor))) {
+ tf2.setBackground(Color.white);
+ tf2.setForeground(Color.black);
+ tf2.setText((String) ts.getTransferData(DataFlavor.stringFlavor));
+ }
+
+ if ((tp != null) && (tp.isDataFlavorSupported(DataFlavor.stringFlavor))) {
+ tf3.setBackground(Color.white);
+ tf3.setForeground(Color.black);
+ tf3.setText((String) tp.getTransferData(DataFlavor.stringFlavor));
+ }
+ }
+
+ // Method to compare the Contents return by system & primary clipboard
+ public void compareText (boolean mustEqual) {
+ if ((tf2.getText()).equals(tf3.getText())) {
+ if (mustEqual)
+ System.out.println("Selected text & clipboard contents are same\n");
+ else
+ throw new RuntimeException("Selected text & clipboard contents are same\n");
+ } else {
+ if (mustEqual)
+ throw new RuntimeException("Selected text & clipboard contents differs\n");
+ else
+ System.out.println("Selected text & clipboard contents differs\n");
+ }
+ }
+
+ public void doTest() throws Exception {
+ checkSecurity();
+ ExtendedRobot robot = new ExtendedRobot();
+ robot.waitForIdle(1000);
+ frame.setLocation(100, 100);
+ robot.waitForIdle(1000);
+
+ if (pClip != null) {
+ Point ttf1Center = tf1.getLocationOnScreen();
+ ttf1Center.translate(tf1.getWidth()/2, tf1.getHeight()/2);
+
+ robot.glide(new Point(0, 0), ttf1Center);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(2000);
+
+ getClipboardsContent();
+ compareText(true);
+
+ //Change the text selection to update the contents of primary clipboard
+ robot.mouseMove(ttf1Center);
+ robot.mousePress(MouseEvent.BUTTON1_MASK);
+ robot.delay(200);
+ robot.mouseMove(ttf1Center.x + 15, ttf1Center.y);
+ robot.mouseRelease(MouseEvent.BUTTON1_MASK);
+ robot.waitForIdle(2000);
+
+ getClipboardsContent();
+ compareText(false);
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/Independence/IndependenceSwingTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 1999, 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
+ * 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.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.util.Properties;
+
+/*
+ * @test
+ * @summary To make sure that System & Primary clipboards should behave independently
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @author dmitriy.ermashov@oracle.com
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main IndependenceSwingTest
+ */
+
+public class IndependenceSwingTest {
+
+ JFrame frame;
+ JPanel panel;
+ JTextField tf1, tf2, tf3;
+ Clipboard sClip, pClip;
+
+ public static void main (String[] args) throws Exception {
+ new IndependenceSwingTest().doTest();
+ }
+
+ public IndependenceSwingTest() {
+
+ frame = new JFrame();
+ frame.setSize(200, 200);
+
+ // This textfield will be used to update the contents of clipboards
+ tf1 = new JTextField();
+ tf1.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent fe) {
+ tf1.setText("Clipboards_Independance_Testing");
+ }
+ });
+
+ // TextFields to get the contents of clipboard
+ tf2 = new JTextField();
+ tf3 = new JTextField();
+
+ panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+
+ panel.add(tf2, BorderLayout.NORTH);
+ panel.add(tf3, BorderLayout.SOUTH);
+
+ frame.add(tf1, BorderLayout.NORTH);
+ frame.add(panel, BorderLayout.CENTER);
+
+ frame.setVisible(true);
+ tf1.requestFocus();
+ }
+
+ public void checkSecurity() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null) {
+ System.out.println("security manager is not there");
+ getPrimaryClipboard();
+ } else {
+ sm.checkPermission(new AWTPermission("accessClipboard"));
+ getPrimaryClipboard();
+ }
+ }
+
+ // Get System Selection i.e. Primary Clipboard
+ private void getPrimaryClipboard() {
+ Properties ps = System.getProperties();
+ String operSys = ps.getProperty("os.name");
+ try {
+ pClip = Toolkit.getDefaultToolkit().getSystemSelection();
+ if (pClip == null)
+ if ((operSys.substring(0,3)).equalsIgnoreCase("Win") || operSys.toLowerCase().contains("os x"))
+ System.out.println(operSys + "Operating system does not support system selection ");
+ else
+ throw new RuntimeException("Method getSystemSelection() is returning null on X11 platform");
+ } catch(HeadlessException e) {
+ System.out.println("Headless exception thrown " + e);
+ }
+ }
+
+ // Method to get the contents of both of the clipboards
+ public void getClipboardsContent() throws Exception {
+ sClip = Toolkit.getDefaultToolkit().getSystemClipboard();
+ Transferable tp;
+ Transferable ts;
+
+ StringSelection content = new StringSelection(tf1.getText());
+ sClip.setContents(content,content);
+
+ tp = pClip.getContents(this);
+ ts = sClip.getContents(this);
+
+ // Paste the contents of System clipboard on textfield tf2 while the paste the contents of
+ // of primary clipboard on textfiled tf3
+ if ((ts != null) && (ts.isDataFlavorSupported(DataFlavor.stringFlavor))) {
+ tf2.setBackground(Color.white);
+ tf2.setForeground(Color.black);
+ tf2.setText((String) ts.getTransferData(DataFlavor.stringFlavor));
+ }
+
+ if ((tp != null) && (tp.isDataFlavorSupported(DataFlavor.stringFlavor))) {
+ tf3.setBackground(Color.white);
+ tf3.setForeground(Color.black);
+ tf3.setText((String) tp.getTransferData(DataFlavor.stringFlavor));
+ }
+ }
+
+ // Method to compare the Contents return by system & primary clipboard
+ public void compareText (boolean mustEqual) {
+ if ((tf2.getText()).equals(tf3.getText())) {
+ if (mustEqual)
+ System.out.println("Selected text & clipboard contents are same\n");
+ else
+ throw new RuntimeException("Selected text & clipboard contents are same\n");
+ } else {
+ if (mustEqual)
+ throw new RuntimeException("Selected text & clipboard contents differs\n");
+ else
+ System.out.println("Selected text & clipboard contents differs\n");
+ }
+ }
+
+ public void doTest() throws Exception {
+ checkSecurity();
+ ExtendedRobot robot = new ExtendedRobot();
+ robot.waitForIdle(1000);
+ frame.setLocation(100, 100);
+ robot.waitForIdle(1000);
+
+ if (pClip != null) {
+ Point ttf1Center = tf1.getLocationOnScreen();
+ ttf1Center.translate(tf1.getWidth()/2, tf1.getHeight()/2);
+
+ robot.glide(new Point(0, 0), ttf1Center);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(2000);
+
+ getClipboardsContent();
+ compareText(true);
+
+ //Change the text selection to update the contents of primary clipboard
+ robot.mouseMove(ttf1Center);
+ robot.mousePress(MouseEvent.BUTTON1_MASK);
+ robot.delay(200);
+ robot.mouseMove(ttf1Center.x + 15, ttf1Center.y);
+ robot.mouseRelease(MouseEvent.BUTTON1_MASK);
+ robot.waitForIdle(2000);
+
+ getClipboardsContent();
+ compareText(false);
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/AddFlavorForNativeTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap method
+ * addFlavorForUnencodedNative(String nat, DataFlavor flav)
+ * with valid natives and DataFlavors. Specifically test for
+ * adding new mappings, one-way and two-way, and to update
+ * existing mappings.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main AddFlavorForNativeTest
+ */
+
+public class AddFlavorForNativeTest {
+
+ SystemFlavorMap flavorMap;
+ Vector comp1, comp2, comp3;
+ Hashtable hash;
+ int hashSize;
+
+ String test_native;
+ String[] test_natives_set;
+ DataFlavor test_flavor1, test_flavor2, test_flavor3, test_flavor4;
+ DataFlavor[] test_flavors_set1, test_flavors_set2;
+
+ public static void main(String[] args) throws Exception {
+ new AddFlavorForNativeTest().doTest();
+ }
+
+ public void doTest() throws Exception {
+ // Initialize DataFlavors and arrays used for test data
+ initMappings();
+
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ // Get all the native strings and preferred DataFlavor mappings
+ hash = new Hashtable(flavorMap.getFlavorsForNatives(null));
+ hashSize = hash.size();
+
+ // Setup One-way Mappings
+ System.out.println("One-way Mappings Test");
+ flavorMap.addFlavorForUnencodedNative(test_native, test_flavor1);
+ flavorMap.addFlavorForUnencodedNative(test_native, test_flavor2);
+
+ // Confirm mapping with getFlavorsForNative
+ comp1 = new Vector(Arrays.asList(test_flavors_set1));
+ comp2 = new Vector(flavorMap.getFlavorsForNative(test_native));
+
+ if ( !comp1.equals(comp2)) {
+ throw new RuntimeException("\n*** After setting up one-way mapping" +
+ "\nwith addFlavorForUnencodedNative(String nat, DataFlavor flav)" +
+ "\nthe mappings returned from getFlavorsForNative() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("One-way: Test Passes");
+
+ // Setup Two-way Mapping
+ System.out.println("Two-way Mappings Test");
+ flavorMap.addUnencodedNativeForFlavor(test_flavor1, test_native);
+ flavorMap.addUnencodedNativeForFlavor(test_flavor2, test_native);
+
+ // Confirm mapping with getNativesForFlavor
+ comp1 = new Vector(Arrays.asList(test_natives_set));
+ comp2 = new Vector(flavorMap.getNativesForFlavor(test_flavor1));
+ comp3 = new Vector(flavorMap.getNativesForFlavor(test_flavor2));
+
+ if ( !(comp1.equals(comp2)) || !(comp1.equals(comp3))) {
+ throw new RuntimeException("\n*** After setting up two-way mapping" +
+ "\nwith addUnencodedNativeForFlavor(DataFlavor flav, String nat)" +
+ "\nthe mappings returned from getNativesForFlavor() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("Two-way (String native): Test Passes");
+
+ // Check first native mapping
+ comp1 = new Vector(Arrays.asList(test_flavors_set1));
+ comp2 = new Vector(flavorMap.getFlavorsForNative(test_native));
+
+ if ( !comp1.equals(comp2)) {
+ throw new RuntimeException("\n*** After setting up two-way mapping" +
+ "\nwith addFlavorForUnencodedNative(String nat, DataFlavor flav)" +
+ "\nthe mappings returned from getFlavorsForNative() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("Two-way (DataFlavor): Test Passes");
+
+ // Modify an existing mapping test
+ System.out.println("Modify Existing Mappings Test");
+ flavorMap.addFlavorForUnencodedNative(test_native, test_flavor3);
+ flavorMap.addFlavorForUnencodedNative(test_native, test_flavor4);
+
+ // Confirm mapping with getFlavorsForNative
+ comp1 = new Vector(Arrays.asList(test_flavors_set2));
+ comp2 = new Vector(flavorMap.getFlavorsForNative(test_native));
+
+ if ( !comp1.equals(comp2)) {
+ throw new RuntimeException("\n*** After modifying an existing mapping" +
+ "\nwith addFlavorForUnencodedNative(String nat, DataFlavor flav)" +
+ "\nthe mappings returned from getFlavorsForNative() do not match" +
+ "\nupdated mappings.");
+ } else
+ System.out.println("Modify Existing Mappings: Test Passes");
+ }
+
+ public void initMappings() throws Exception {
+ //create String natives
+ test_native = "TEST1";
+
+ test_flavor1 = new DataFlavor(Class.forName("java.awt.Label"), "test1");
+ test_flavor2 = new DataFlavor(Class.forName("java.awt.Button"), "test2");
+ test_flavor3 = new DataFlavor(Class.forName("java.awt.Checkbox"), "test3");
+ test_flavor4 = new DataFlavor(Class.forName("java.awt.List"), "test4");
+
+ //create and initialize DataFlavor arrays
+ test_flavors_set1 = new DataFlavor[] {test_flavor1, test_flavor2};
+ test_flavors_set2 = new DataFlavor[] {test_flavor1, test_flavor2, test_flavor3, test_flavor4};
+
+ //create and initialize String native arrays
+ test_natives_set = new String[] {test_native};
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/AddFlavorTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import sun.awt.datatransfer.DataTransferer;
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.*;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap method:
+ * addFlavorForUnencodedNative(String nat, DataFlavor flav)
+ * with valid natives and DataFlavors. This stress test will
+ * define numerous mappings of valid String natives and
+ * DataFlavors. The mappings will be verified by examining
+ * that all entries are present, and order is maintained.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @author dmitriy.ermashov@oracle.com
+ * @run main AddFlavorTest
+ */
+
+public class AddFlavorTest {
+
+ SystemFlavorMap flavorMap;
+ Hashtable<String, List<DataFlavor>> hashVerify;
+
+ public static void main (String[] args) throws Exception {
+ new AddFlavorTest().doTest();
+ }
+
+ void doTest() throws Exception {
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ // Test addFlavorForUnencodedNative(String nat, DataFlavor flav);
+ //
+ // Enumerate through all the system defined String natives,
+ // and for each String native, define it again to the SystemFlavorMap
+ // with a slightly modified String native (name).
+ //
+ // As a list of DataFlavors will be returned for each String native,
+ // the method addFlavorForUnencodedNative will be called for each
+ // DataFlavor in the list.
+ hashVerify = new Hashtable();
+
+ for (String key : flavorMap.getFlavorsForNatives(null).keySet()) {
+ Set<DataFlavor> flavorsSet = new HashSet<>(flavorMap.getFlavorsForNative(key));
+ // construct a unique String native
+ key = key.concat("TEST");
+
+ for (DataFlavor element : flavorsSet)
+ flavorMap.addFlavorForUnencodedNative(key, element);
+
+ // This part is valid only for X-based graphical systems
+ if (!System.getProperty("os.name").startsWith("Win") && !System.getProperty("os.name").startsWith("Mac") ) {
+ if (key.contains("/")) {
+ Set<DataFlavor> fls = DataTransferer.getInstance().getPlatformMappingsForNative(key);
+ flavorsSet.addAll(fls);
+ if (!fls.isEmpty() && key.startsWith("text/"))
+ flavorsSet.addAll(convertMimeTypeToDataFlavors(key));
+ }
+ }
+ hashVerify.put(key, new Vector(flavorsSet));
+ }
+
+ // Assertions: After establishing "new" mappings, verify that the defined
+ // DataFlavors can be retrieved and that the List is preserved.
+ verifyNewMappings();
+ }
+
+ // Verify getFlavorsForNative(String nat) is returning the correct list
+ // of DataFlavors (for the new mappings).
+ void verifyNewMappings() {
+ // Enumerate through all natives
+ System.out.println("*** native size = " + hashVerify.size());
+ for (Enumeration e = hashVerify.keys() ; e.hasMoreElements() ;) {
+ String key = (String)e.nextElement();
+ compareFlavors(hashVerify.get(key), flavorMap.getFlavorsForNative(key), key);
+ compareFlavors(flavorMap.getFlavorsForNative(key), hashVerify.get(key), key);
+ }
+ }
+
+ void compareFlavors(List<DataFlavor> flavors1, List<DataFlavor> flavors2, String key){
+ DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator();
+ for (DataFlavor flavor1 : flavors1) {
+ boolean result = false;
+ for (DataFlavor flavor2 : flavors2) {
+ if (comparator.compare(flavor1, flavor2) == 0)
+ result = true;
+ }
+ if (!result)
+ throw new RuntimeException("\n*** Error in verifyNewMappings()" +
+ "\nmethod1: addFlavorForUnencodedNative(String nat, DataFlavor flav)" +
+ "\nmethod2: List getFlavorsForNative(String nat)" +
+ "\nString native: " + key +
+ "\nAfter adding several mappings with addFlavorForUnencodedNative," +
+ "\nthe returned list did not match the mappings that were added." +
+ "\nEither the mapping was not included in the list, or the order was incorect.");
+ }
+
+ }
+
+ Set<DataFlavor> convertMimeTypeToDataFlavors(String baseType) throws Exception {
+ Set<DataFlavor> result = new LinkedHashSet<>();
+
+ for (String charset : DataTransferer.standardEncodings()) {
+ for (String txtClass : new String[]{"java.io.InputStream", "java.nio.ByteBuffer", "\"[B\""}) {
+ String mimeType = baseType + ";charset=" + charset + ";class=" + txtClass;
+
+ if ("text/html".equals(baseType)) {
+ for (String documentType : new String[]{"all", "selection", "fragment"})
+ result.add(new DataFlavor(mimeType + ";document=" + documentType));
+ } else {
+ DataFlavor df = new DataFlavor(mimeType);
+ if (df.equals(DataFlavor.plainTextFlavor))
+ df = DataFlavor.plainTextFlavor;
+ result.add(df);
+ }
+ }
+ }
+ return result;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/AddNativeForFlavorTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap method
+ * addUnencodedNativeForFlavor(DataFlavor flav, String nat)
+ * with valid natives and DataFlavors. Specifically test for
+ * adding new mappings, one-way and two-way, and to update
+ * existing mappings.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main AddNativeForFlavorTest
+ */
+
+public class AddNativeForFlavorTest {
+
+ SystemFlavorMap flavorMap;
+ Vector comp1, comp2, comp3;
+ Hashtable hash;
+ int hashSize;
+
+ String test_native1, test_native2, test_native3, test_native4;
+ String[] test_natives_set1, test_natives_set2;
+ DataFlavor test_flav;
+ DataFlavor[] test_flavors_set;
+
+ public static void main(String[] args) throws Exception {
+ new AddNativeForFlavorTest().doTest();
+ }
+
+ public void doTest() throws Exception {
+ // Initialize DataFlavors and arrays used for test data
+ initMappings();
+
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ // Get all the native strings and preferred DataFlavor mappings
+ hash = new Hashtable(flavorMap.getFlavorsForNatives(null));
+ hashSize = hash.size();
+
+ // Setup One-way Mappings
+ System.out.println("One-way Mappings Test");
+ flavorMap.addUnencodedNativeForFlavor(test_flav, test_native1);
+ flavorMap.addUnencodedNativeForFlavor(test_flav, test_native2);
+
+ // Confirm mapping with getNativesForFlavor
+ comp1 = new Vector(Arrays.asList(test_natives_set1));
+ comp2 = new Vector(flavorMap.getNativesForFlavor(test_flav));
+
+ if ( !comp1.equals(comp2)) {
+ throw new RuntimeException("\n*** After setting up one-way mapping" +
+ "\nwith addUnencodedNativeForFlavor(DataFlavor flav, String nat)" +
+ "\nthe mappings returned from getNativesForFlavor() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("One-way: Test Passes");
+
+ // Setup Two-way Mapping
+ System.out.println("Two-way Mappings Test");
+ flavorMap.addFlavorForUnencodedNative(test_native1, test_flav);
+ flavorMap.addFlavorForUnencodedNative(test_native2, test_flav);
+
+ // Confirm mapping with getFlavorsForNative
+ comp1 = new Vector(Arrays.asList(test_flavors_set));
+ comp2 = new Vector(flavorMap.getFlavorsForNative(test_native1));
+ comp3 = new Vector(flavorMap.getFlavorsForNative(test_native2));
+
+ if ( !(comp1.equals(comp2)) || !(comp1.equals(comp3))) {
+ throw new RuntimeException("\n*** After setting up two-way mapping" +
+ "\nwith addFlavorForUnencodedNative(String nat, DataFlavor flav)" +
+ "\nthe mappings returned from getFlavorsForNative() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("Two-way (DataFlavor): Test Passes");
+
+ // Check first native mapping
+ comp1 = new Vector(Arrays.asList(test_natives_set1));
+ comp2 = new Vector(flavorMap.getNativesForFlavor(test_flav));
+
+ if ( !comp1.equals(comp2)) {
+ throw new RuntimeException("\n*** After setting up two-way mapping" +
+ "\nwith addUnencodedNativeForFlavor(DataFlavor flav, String nat)" +
+ "\nthe mappings returned from getNativesForFlavor() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("Two-way (String native): Test Passes");
+
+ // Modify an existing mapping test
+ System.out.println("Modify Existing Mappings Test");
+ flavorMap.addUnencodedNativeForFlavor(test_flav, test_native3);
+ flavorMap.addUnencodedNativeForFlavor(test_flav, test_native4);
+
+ // Confirm mapping with getNativesForFlavor
+ comp1 = new Vector(Arrays.asList(test_natives_set2));
+ comp2 = new Vector(flavorMap.getNativesForFlavor(test_flav));
+
+ if ( !comp1.equals(comp2)) {
+ throw new RuntimeException("\n*** After modifying an existing mapping" +
+ "\nwith addUnencodedNativeForFlavor(DataFlavor flav, String nat)" +
+ "\nthe mappings returned from getNativesForFlavor() do not match" +
+ "\nupdated mappings.");
+ }
+ else
+ System.out.println("Modify Existing Mappings: Test Passes");
+
+ }
+
+ public void initMappings() throws Exception {
+ //create String natives
+ test_native1 = "TEST1";
+ test_native2 = "TEST2";
+ test_native3 = "TEST3";
+ test_native4 = "TEST4";
+
+ test_flav = new DataFlavor(Class.forName("java.awt.Label"), "test1");
+
+ //create and initialize DataFlavor arrays
+ test_flavors_set = new DataFlavor[] {test_flav};
+
+ //create and initialize String native arrays
+ test_natives_set1 = new String[] {test_native1, test_native2};
+ test_natives_set2 = new String[] {test_native1, test_native2, test_native3, test_native4};
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/AddNativeTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.*;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap method:
+ * addUnencodedNativeForFlavor(DataFlavor flav, String nat)
+ * with valid natives and DataFlavors. This stress test will
+ * define numerous mappings of valid String natives and
+ * DataFlavors. The mappings will be verified by examining
+ * that all entries are present.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main AddNativeTest
+ */
+
+public class AddNativeTest {
+
+ SystemFlavorMap flavorMap;
+ Hashtable hashVerify;
+
+ Map mapFlavors;
+ Map mapNatives;
+
+ Hashtable hashFlavors;
+ Hashtable hashNatives;
+
+ public static void main(String[] args) {
+ new AddNativeTest().doTest();
+ }
+
+ public void doTest() {
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ // Get SystemFlavorMap Maps of String Natives and DataFlavors
+ mapFlavors = flavorMap.getNativesForFlavors(null);
+ mapNatives = flavorMap.getFlavorsForNatives(null);
+
+ hashFlavors = new Hashtable(mapFlavors);
+ hashNatives = new Hashtable(mapNatives);
+
+ // Test addUnencodedNativeForFlavor(DataFlavor flav, String nat);
+ //
+ // Enumerate through all the system defined DataFlavors,
+ // and for each DataFlavor, define it again to the SystemFlavorMap
+ // with a slightly modified Mime Type.
+ //
+ // As a list of String natives will be returned for each DataFlavor,
+ // the method addUnencodedNativeForFlavor will be called for each
+ // String native in the list.
+ //
+ // For verification, a seperate Hashtable (Map) will be maintained with changes.
+ DataFlavor key;
+ hashVerify = new Hashtable();
+
+ for (Enumeration e = hashFlavors.keys() ; e.hasMoreElements() ;) {
+ key = (DataFlavor)e.nextElement();
+
+ java.util.List listNatives = flavorMap.getNativesForFlavor(key);
+ Vector vectorNatives = new Vector(listNatives);
+
+ // Construct a new DataFlavor from an existing DataFlavor's MimeType
+ // Example:
+ // Original MimeType: "text/plain; class=java.io.Reader; charset=Unicode"
+ // Modified MimeType: "text/plain-TEST; class=java.io.Reader; charset=Unicode"
+
+ StringBuffer mimeType = new StringBuffer(key.getMimeType());
+ mimeType.insert(mimeType.indexOf(";"),"-TEST");
+
+ DataFlavor testFlavor = new DataFlavor(mimeType.toString(), "Test DataFlavor");
+
+ for (ListIterator i = vectorNatives.listIterator() ; i.hasNext() ;) {
+ String element = (String)i.next();
+ flavorMap.addUnencodedNativeForFlavor(testFlavor, element);
+ }
+
+ //Added following 4 lines - Aruna Samji - 07/22/2003
+ Vector existingNatives = new Vector(flavorMap.getNativesForFlavor(testFlavor));
+ existingNatives.addAll(vectorNatives);
+ vectorNatives = existingNatives;
+ hashVerify.put(testFlavor, vectorNatives);
+ }
+
+ // Assertions: After establishing "new" mappings, verify that the defined
+ // DataFlavors can be retrieved.
+ verifyNewMappings();
+ }
+
+ // Verify getFlavorsForNative(String nat) is returning the correct list
+ // of DataFlavors (for the new mappings).
+ public boolean verifyNewMappings() {
+ boolean result = true;
+
+ // Enumerate through all DataFlavors
+ for (Enumeration e = hashVerify.keys() ; e.hasMoreElements() ;) {
+ DataFlavor key = (DataFlavor)e.nextElement();
+
+ java.util.List listNatives = flavorMap.getNativesForFlavor(key);
+ Vector vectorNatives = new Vector(listNatives);
+
+ // Compare the list of Natives
+ //Next line changed by Kanishk to comply with bug 4696522
+ //if ( !vectorNatives.equals((Vector)hashVerify.get(key))) {
+ if ( !(vectorNatives.containsAll((Vector)hashVerify.get(key)) && ((Vector)hashVerify.get(key)).containsAll(vectorNatives))) {
+ throw new RuntimeException("\n*** Error in verifyNewMappings()" +
+ "\nmethod1: addUnencodedNativeForFlavor(DataFlavor flav, String nat)" +
+ "\nmethod2: List getNativesForFlavor(DataFlavor flav)" +
+ "\nDataFlavor: " + key.getMimeType() +
+ "\nAfter adding several mappings with addUnencodedNativeForFlavor," +
+ "\nthe returned list did not match the mappings that were added." +
+ "\nThe mapping was not included in the list.");
+ }
+ }
+ System.out.println("*** DataFlavor size = " + hashVerify.size());
+ System.out.println("*** verifyNewMappings result: " + result + "\n");
+ return result;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/GetFlavorsForNewNativeTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap method
+ * getFlavorsForNative(String nat)
+ * with unknown String natives. Specifically test for
+ * unknown Unencoded String native in which an empty list is
+ * returned, and with unknown Encoded String native where
+ * two-way mapping should be established.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main GetFlavorsForNewNativeTest
+ */
+
+public class GetFlavorsForNewNativeTest {
+
+ SystemFlavorMap flavorMap;
+ Vector comp1, comp2, comp3, comp4;
+ Hashtable hash;
+ int hashSize;
+
+ String test_native1, test_encoded;
+ DataFlavor test_flavor1, test_flavor2;
+ String[] test_natives_set;
+ DataFlavor[] test_flavors_set;
+
+ public static void main (String[] args) throws Exception {
+ new GetFlavorsForNewNativeTest().doTest();
+ }
+
+ public void doTest() throws Exception {
+ // Initialize DataFlavors and arrays used for test data
+ initMappings();
+
+ flavorMap = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
+
+ // Get all the native strings and preferred DataFlavor mappings
+ hash = new Hashtable(flavorMap.getFlavorsForNatives(null));
+ hashSize = hash.size();
+
+ // GetFlavorsForNative using Unencoded Native
+ //
+ // If a new Unencoded native is specified as a parameter, the String
+ // native should be ignored and no mapping established.
+ System.out.println("GetFlavorsForNative using Unencoded Native Test");
+
+ comp1 = new Vector(flavorMap.getFlavorsForNative(test_native1));
+
+ if (comp1.size() != 0) {
+ throw new RuntimeException("\n*** After passing a new Unencoded native" +
+ "\nwith getFlavorsForNative(String nat)" +
+ "\nthe String native should be ignored and no mapping established.");
+ } else
+ System.out.println("GetFlavorsForNative using Unencoded Native Test: Test Passes");
+
+
+ // GetFlavorsForNative using Encoded Native (verify 2-way mapping)
+ //
+ // If a new Encoded native is specified, the method should establish a mapping
+ // in both directions between specified native and DataFlavor whose MIME type
+ // is a decoded version of the native.
+ System.out.println("GetFlavorsForNative using Encoded Native Test");
+
+ comp1 = new Vector(Arrays.asList(test_flavors_set));
+ comp2 = new Vector(flavorMap.getFlavorsForNative(test_encoded));
+
+ comp3 = new Vector(Arrays.asList(test_natives_set));
+ comp4 = new Vector(flavorMap.getNativesForFlavor(test_flavor2));
+
+ if (!comp1.equals(comp2) || !comp3.equals(comp4)) {
+ throw new RuntimeException("\n*** After passing a new Encoded native" +
+ "\nwith getFlavorsForNative(String nat)" +
+ "\nthe mapping in both directions was not established.");
+ } else
+ System.out.println("GetFlavorsForNative using Encoded Native: Test Passes");
+ }
+
+ public void initMappings() throws Exception {
+ //initialize mapping variables used in this test
+ //create an Unencoded String native
+ test_native1 = "TEST1";
+
+ //create a DataFlavor from Button class
+ test_flavor1 = new DataFlavor(Class.forName("java.awt.Button"), "Button");
+
+ //create an Encoded String native using Button class MIME Type
+ String buttonMIME = test_flavor1.getMimeType();
+ test_encoded = SystemFlavorMap.encodeJavaMIMEType(buttonMIME);
+
+ //create a DataFlavor from the Encoded String native
+ test_flavor2 = SystemFlavorMap.decodeDataFlavor(test_encoded);
+
+ //create and initialize DataFlavor arrays
+ test_flavors_set = new DataFlavor[] {test_flavor2};
+
+ //create and initialize String native arrays
+ test_natives_set = new String[] {test_encoded};
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/GetNativesForNewFlavorTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap method
+ * getNativesForFlavor(DataFlavor flav)
+ * with unknown DataFlavor. Specifically test for
+ * passing an unknown DataFlavor where two-way mapping
+ * should be established.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main GetNativesForNewFlavorTest
+ */
+
+public class GetNativesForNewFlavorTest {
+
+ SystemFlavorMap flavorMap;
+ Vector comp1, comp2, comp3, comp4;
+ Hashtable hash;
+ int hashSize;
+
+ String test_encoded;
+ DataFlavor test_flavor1, test_flavor2;
+ String[] test_natives_set;
+ DataFlavor[] test_flavors_set;
+
+ public static void main (String[] args) throws Exception {
+ new GetNativesForNewFlavorTest().doTest();
+ }
+
+ public void doTest() throws Exception {
+ // Initialize DataFlavors and arrays used for test data
+ initMappings();
+
+ boolean passed = true;
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ // Get all the native strings and preferred DataFlavor mappings
+ hash = new Hashtable(flavorMap.getFlavorsForNatives(null));
+ hashSize = hash.size();
+
+ // GetNativesForFlavor using unknown DataFlavor (verify 2-way mapping)
+ //
+ // If a new DataFlavor is specified, the method should establish a mapping
+ // in both directions between specified DataFlavor and an encoded
+ // version of its MIME type as its native.
+ System.out.println("GetNativesForFlavor using new DataFlavor");
+
+ comp1 = new Vector(Arrays.asList(test_natives_set));
+ comp2 = new Vector(flavorMap.getNativesForFlavor(test_flavor1));
+
+ comp3 = new Vector(Arrays.asList(test_flavors_set));
+ comp4 = new Vector(flavorMap.getFlavorsForNative(test_encoded));
+
+ if ( !comp1.equals(comp2) || !comp3.equals(comp4) ) {
+ throw new RuntimeException("\n*** After passing a new DataFlavor" +
+ "\nwith getNativesForFlavor(DataFlavor flav)" +
+ "\nthe mapping in both directions was not established.");
+ }
+ else
+ System.out.println("GetNativesForFlavor using new DataFlavor: Test Passes");
+ }
+
+ public void initMappings() throws Exception {
+ //initialize mapping variables used in this test
+ //create a DataFlavor from Button class
+ test_flavor1 = new DataFlavor(Class.forName("java.awt.Button"), "Button");
+
+ //create an Encoded String native using Button class MIME Type
+ String buttonMIME = test_flavor1.getMimeType();
+ test_encoded = SystemFlavorMap.encodeJavaMIMEType(buttonMIME);
+
+ //create a DataFlavor from the Encoded String native
+ test_flavor2 = SystemFlavorMap.decodeDataFlavor(test_encoded);
+
+ //create and initialize DataFlavor arrays
+ test_flavors_set = new DataFlavor[] {test_flavor1};
+
+ //create and initialize String native arrays
+ test_natives_set = new String[] {test_encoded};
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/InvalidMapArgumentsTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+
+/*
+ * @test
+ * @summary To check for error handling with new Clipboard/SystemFlavorMap
+ * methods, and insure that the appropriate exceptions are being thrown.
+ * Specifically check for null variables in the methods:
+ * - addFlavorForUnencodedNative(String nat, DataFlavor flav)
+ * - addUnencodedNativeForFlavor(DataFlavor flav, String nat)
+ * - setNativesForFlavor(DataFlavor flav, String[] natives)
+ * - setFlavorsForNative(String nat, DataFlavor[] flavors)
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main InvalidMapArgumentsTest
+ */
+
+public class InvalidMapArgumentsTest {
+
+ SystemFlavorMap flavorMap;
+ String test_nat;
+ String[] test_natives;
+ DataFlavor test_flav;
+ DataFlavor[] test_flavors;
+
+ public static void main (String[] args){
+ new InvalidMapArgumentsTest().doTest();
+ }
+
+ public void doTest (){
+ //Get things going. Request focus, set size, et cetera
+ initMappings();
+
+ // Test for combinations of null values for
+ // addFlavorForUnencodedNative(String nat, DataFlavor flav)
+ addFlavorForUnencodedNativeTest(null, null, "both String nat and DataFlavor flav set to null. ");
+ addFlavorForUnencodedNativeTest(null, test_flav, "String nat set to null. ");
+ addFlavorForUnencodedNativeTest(test_nat, null, "DataFlavor flav set to null. ");
+
+
+ // Test for combinations of null values for
+ // addUnencodedNativeForFlavor(DataFlavor flav, String nat)
+ addUnencodedNativeForFlavorTest(null, null, "both DataFlavor flav and String nat set to null. ");
+ addUnencodedNativeForFlavorTest(null, test_nat, "DataFlavor flav set to null. ");
+ addUnencodedNativeForFlavorTest(test_flav, null, "String nat set to null. ");
+
+
+ // Test for combinations of null values for
+ // setNativesForFlavor(DataFlavor flav, String[] natives)
+ setNativesForFlavorTest(null, null, "both DataFlavor flav and String[] natives set to null. ");
+ setNativesForFlavorTest(null, test_natives, "DataFlavor flav set to null. ");
+ setNativesForFlavorTest(test_flav, null, "String[] natives set to null. ");
+
+
+ // Test for combinations of null values for
+ // setFlavorsForNative(String nat, DataFlavor[] flavors)
+ setFlavorsForNativeTest(null, null, "both String nat and DataFlavor[] flavors set to null. ");
+ setFlavorsForNativeTest(null, test_flavors, "String nat set to null. ");
+ setFlavorsForNativeTest(test_nat, null, "DataFlavor[] flavors set to null. ");
+ }
+
+ public void initMappings() {
+ //initialize mapping variables used in this test
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ //create a DataFlavor with valid parameters (mimeType, humanPresentableName)
+ test_flav = new DataFlavor("text/plain; charset=ascii","ASCII Flavor");
+
+ //create a String native
+ test_nat = "TEXT_TEST";
+
+ //create a DataFlavor array
+ test_flavors = new DataFlavor[] {test_flav};
+
+ //create a String native array
+ test_natives = new String[] {test_nat};
+ }
+
+ public void setNativesForFlavorTest(DataFlavor flav, String[] natives, String errmsg) {
+ try{
+ flavorMap.setNativesForFlavor(flav, natives);
+ throw new RuntimeException("NullPointerException is not thrown for method "+
+ "setNativesForFlavor with "+errmsg);
+ } catch (NullPointerException e) {
+ }
+ }
+
+ public void setFlavorsForNativeTest(String nat, DataFlavor[] flavors, String errmsg) {
+ try{
+ flavorMap.setFlavorsForNative(nat, flavors);
+ throw new RuntimeException("NullPointerException is not thrown for method "+
+ "setFlavorsForNative with "+errmsg);
+ } catch (NullPointerException e) {
+ }
+ }
+
+ public void addFlavorForUnencodedNativeTest(String nat, DataFlavor flav, String errmsg) {
+ try{
+ flavorMap.addFlavorForUnencodedNative(nat, flav);
+ throw new RuntimeException("NullPointerException is not thrown for method "+
+ "addFlavorForUnencodedNative with "+errmsg);
+ } catch (NullPointerException e) {
+ }
+ }
+
+ public void addUnencodedNativeForFlavorTest(DataFlavor flav, String nat, String errmsg) {
+ try{
+ flavorMap.addUnencodedNativeForFlavor(flav, nat);
+ throw new RuntimeException("NullPointerException is not thrown for method "+
+ "addUnencodedNativeForFlavor with "+errmsg);
+ } catch (NullPointerException e) {
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/ManyFlavorMapTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.*;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap methods
+ * List getFlavorsForNative(String nat)
+ * List getNativesForFlavor(DataFlavor flav)
+ * with valid natives and DataFlavors, including null.
+ * This test will verify that the returned mappings
+ * include all entries and that the correct order is
+ * maintained.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main ManyFlavorMapTest
+ */
+
+public class ManyFlavorMapTest {
+
+ SystemFlavorMap flavorMap;
+
+ Map mapFlavors;
+ Map mapNatives;
+
+ Hashtable hashFlavors;
+ Hashtable hashNatives;
+
+ public static void main (String[] args) {
+ new ManyFlavorMapTest().doTest();
+ }
+
+ public void doTest() {
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ // Get SystemFlavorMap Maps of String Natives and DataFlavors
+ mapFlavors = flavorMap.getNativesForFlavors(null);
+ mapNatives = flavorMap.getFlavorsForNatives(null);
+
+ hashFlavors = new Hashtable(mapFlavors);
+ hashNatives = new Hashtable(mapNatives);
+
+ // Assertion: Verify getNativesForFlavors(null) is returning the full list
+ // of String Native entries
+ List listNatives = flavorMap.getNativesForFlavor(null);
+ verifyListAllNativeEntries(listNatives);
+
+ // Assertion: Verify getFlavorsForNatives(null) is returning the full list
+ // of DataFlavor entries
+ List listFlavors = flavorMap.getFlavorsForNative(null);
+ verifyListAllDataFlavorEntries(listFlavors);
+
+ // Assertion: Verify getNativesForFlavor(DataFlavor flav) is returning the list
+ // of Native Strings (for all supported DataFlavors)
+ //
+ // Verify that the first list item is the most preferred Native
+ verifyListNativeEntries();
+
+ // Assertion: Verify getFlavorsForNative(String nat) is returning the list
+ // of DataFlavors(for all supported natives)
+ //
+ // Verify that the first list item is the most preferred DataFlavor
+ verifyListDataFlavorEntries();
+ }
+
+ // Verify getFlavorsForNative(String nat) is returning the list
+ // of DataFlavors(for all supported natives)
+ public void verifyListDataFlavorEntries() {
+ // Enumerate through all natives
+ for (Enumeration e = hashNatives.keys() ; e.hasMoreElements() ;) {
+ String key = (String)e.nextElement();
+
+ // SystemFlavorMap preferred value
+ DataFlavor value = (DataFlavor)hashNatives.get(key);
+
+ java.util.List listFlavors = flavorMap.getFlavorsForNative(key);
+ Vector vectorFlavors = new Vector(listFlavors);
+
+ // First element should be preferred value
+ DataFlavor prefFlavor = (DataFlavor)vectorFlavors.firstElement();
+ if ( value != prefFlavor ) {
+ throw new RuntimeException("\n*** Error in verifyListDataFlavorEntries()" +
+ "\nAPI Test: List getFlavorsForNative(String nat)" +
+ "\native: " + key +
+ "\nSystemFlavorMap preferred native: " + value.getMimeType() +
+ "\nList first entry: " + prefFlavor.getMimeType() +
+ "\nTest failed because List first entry does not match preferred");
+ }
+ }
+ System.out.println("*** native size = " + hashNatives.size());
+ }
+
+ // Verify getNativesForFlavor(DataFlavor flav) is returning the list
+ // of Native Strings (for all supported DataFlavors)
+ public void verifyListNativeEntries() {
+ // Enumerate through all DataFlavors
+ for (Enumeration e = hashFlavors.keys() ; e.hasMoreElements() ;) {
+ DataFlavor key = (DataFlavor)e.nextElement();
+
+ // SystemFlavorMap preferred value
+ String value = (String)hashFlavors.get(key);
+
+ java.util.List listNatives = flavorMap.getNativesForFlavor(key);
+ Vector vectorNatives = new Vector(listNatives);
+
+ // First element should be preferred value
+ String prefNative = (String)vectorNatives.firstElement();
+ if ( value != prefNative ) {
+ throw new RuntimeException("\n*** Error in verifyListNativeEntries()" +
+ "\nAPI Test: List getNativesForFlavor(DataFlavor flav)" +
+ "\nDataFlavor: " + key.getMimeType() +
+ "\nSystemFlavorMap preferred native: " + value +
+ "\nList first entry: " + prefNative +
+ "\nTest failed because List first entry does not match preferred");
+ }
+ }
+ System.out.println("*** DataFlavor size = " + hashFlavors.size());
+ }
+
+ // Compare List of Natives with list from SystemFlavorMap
+ //
+ // Verification will be done by comparing the two results as sets
+ public void verifyListAllNativeEntries(java.util.List listNatives) {
+
+ HashSet hashSetMap = new HashSet(mapNatives.keySet());
+ HashSet hashSetList = new HashSet(listNatives);
+
+ System.out.println("*** hashSetMap size = " + hashSetMap.size());
+ System.out.println("*** hashSetList size = " + hashSetList.size());
+
+ if (!hashSetMap.equals(hashSetList)) {
+ throw new RuntimeException("\n*** Error in verifyListAllNativeEntries()" +
+ "\nAPI Test: List getNativesForFlavor(null)" +
+ "\nTest failed because the returned List does not exactly" +
+ "\nmatch objects returned from SystemFlavorMap.");
+ }
+ }
+
+ // Compare List of DataFlavors with list from SystemFlavorMap
+ //
+ // Verification will be done by comparing the two results as sets
+ public void verifyListAllDataFlavorEntries(java.util.List listFlavors) {
+
+ HashSet hashSetMap = new HashSet(mapFlavors.keySet());
+ HashSet hashSetList = new HashSet(listFlavors);
+
+ System.out.println("*** hashSetMap size = " + hashSetMap.size());
+ System.out.println("*** hashSetList size = " + hashSetList.size());
+
+ if (!hashSetMap.equals(hashSetList)) {
+ throw new RuntimeException("\n*** Error in verifyListAllDataFlavorEntries()" +
+ "\nAPI Test: List getFlavorsForNative(null)" +
+ "\nTest failed because the returned List does not exactly" +
+ "\nmatch objects returned from SystemFlavorMap.");
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/SetDataFlavorsTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 1999, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap method:
+ * setNativesForFlavor(DataFlavor flav, String[] natives)
+ * with valid natives and DataFlavors. This stress test will
+ * define numerous mappings of valid String natives and
+ * DataFlavors. The mappings will be verified by examining
+ * that all entries are present, and order is maintained.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main SetDataFlavorsTest
+ */
+
+public class SetDataFlavorsTest {
+
+ SystemFlavorMap flavorMap;
+ Hashtable hashVerify;
+
+ Map mapFlavors;
+ Map mapNatives;
+
+ Hashtable hashFlavors;
+ Hashtable hashNatives;
+
+ public static void main (String[] args) {
+ new SetDataFlavorsTest().doTest();
+ }
+
+ public void doTest() {
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ // Get SystemFlavorMap Maps of String Natives and DataFlavors
+ mapFlavors = flavorMap.getNativesForFlavors(null);
+ mapNatives = flavorMap.getFlavorsForNatives(null);
+
+ hashFlavors = new Hashtable(mapFlavors);
+ hashNatives = new Hashtable(mapNatives);
+
+
+ // Test setNativesForFlavor(DataFlavors flav, String[] natives);
+ //
+ // Enumerate through all the system defined DataFlavors,
+ // and for each DataFlavor, define it again to the SystemFlavorMap
+ // with a slightly modified MimeType.
+ //
+ // For verification, a seperate Hashtable will be maintained of the additions.
+ DataFlavor key;
+ hashVerify = new Hashtable();
+
+ for (Enumeration e = hashFlavors.keys() ; e.hasMoreElements() ;) {
+ key = (DataFlavor)e.nextElement();
+
+ java.util.List listNatives = flavorMap.getNativesForFlavor(key);
+ Vector vectorNatives = new Vector(listNatives);
+ String[] arrayNatives = (String[])vectorNatives.toArray(new String[0]);
+
+ // Construct a new DataFlavor from an existing DataFlavor's MimeType
+ // Example:
+ // Original MimeType: "text/plain; class=java.io.Reader; charset=Unicode"
+ // Modified MimeType: "text/plain-TEST; class=java.io.Reader; charset=Unicode"
+
+ StringBuffer mimeType = new StringBuffer(key.getMimeType());
+ mimeType.insert(mimeType.indexOf(";"),"-TEST");
+
+ DataFlavor testFlav = new DataFlavor(mimeType.toString(), "Test DataFlavor");
+
+ // define the new String native entry
+ flavorMap.setNativesForFlavor(testFlav, arrayNatives);
+ // keep track of this new native entry
+ hashVerify.put(testFlav, vectorNatives);
+ }
+
+ // After establishing "new" mappings, verify that the defined
+ // Natives can be retrieved and that the List (order) is preserved.
+ verifyNewMappings();
+ }
+
+ // Verify getNativesForFlavor(DataFlavor flav) is returning the correct list
+ // of Natives (for the new mappings).
+ public void verifyNewMappings() {
+ // Enumerate through all DataFlavors
+ for (Enumeration e = hashVerify.keys() ; e.hasMoreElements() ;) {
+ DataFlavor key = (DataFlavor)e.nextElement();
+
+ java.util.List listNatives = flavorMap.getNativesForFlavor(key);
+ Vector vectorFlavors = new Vector(listNatives);
+
+ // Compare the list of Natives
+ if ( !vectorFlavors.equals(hashVerify.get(key))) {
+ throw new RuntimeException("\n*** Error in verifyNewMappings()" +
+ "\nmethod1: setNativesForFlavor(DataFlavor flav, String[] natives)" +
+ "\nmethod2: List getNativesForFlavor(DataFlavor flav)" +
+ "\nDataFlavor: " + key.getMimeType() +
+ "\nThe Returned List did not match the original set of Natives.");
+ }
+ }
+ System.out.println("*** DataFlavor size = " + hashVerify.size());
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/SetFlavorsForNativeTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap method
+ * setFlavorsForNative(String nat, DataFlavor[] flavors)
+ * with valid natives and DataFlavors. Specifically test for
+ * adding new mappings, one-way and two-way, and to update
+ * existing mappings.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main SetFlavorsForNativeTest
+ */
+
+public class SetFlavorsForNativeTest {
+
+ SystemFlavorMap flavorMap;
+ Vector comp1, comp2, comp3;
+ Hashtable hash;
+ int hashSize;
+
+ String test_native1, test_native2, test_native3, test_native4;
+ String[] test_natives_set1, test_natives_set2;
+ DataFlavor test_flavor1, test_flavor2, test_flavor3, test_flavor4;
+ DataFlavor[] test_flavors_set1, test_flavors_set2;
+
+ public static void main (String[] args) throws Exception {
+ new SetFlavorsForNativeTest().doTest();
+ }
+
+ public void doTest() throws Exception {
+ // Initialize DataFlavors and arrays used for test data
+ initMappings();
+
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ // Get all the native strings and preferred DataFlavor mappings
+ hash = new Hashtable(flavorMap.getFlavorsForNatives(null));
+ hashSize = hash.size();
+
+ // Setup One-way Mappings
+ System.out.println("One-way Mappings Test");
+ flavorMap.setFlavorsForNative(test_native1, test_flavors_set1);
+ flavorMap.setFlavorsForNative(test_native2, test_flavors_set1);
+
+ // Confirm mapping with getFlavorsForNative
+ comp1 = new Vector(Arrays.asList(test_flavors_set1));
+ comp2 = new Vector(flavorMap.getFlavorsForNative(test_native1));
+ comp3 = new Vector(flavorMap.getFlavorsForNative(test_native2));
+
+ if ( !(comp1.equals(comp2)) || !(comp1.equals(comp3))) {
+ throw new RuntimeException("\n*** After setting up one-way mapping" +
+ "\nwith setFlavorsForNative(String nat, DataFlavors[] flavors)" +
+ "\nthe mappings returned from getFlavorsForNative() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("One-way: Test Passes");
+
+ // Setup Two-way Mapping
+ System.out.println("Two-way Mappings Test");
+ flavorMap.setNativesForFlavor(test_flavor1, test_natives_set1);
+ flavorMap.setNativesForFlavor(test_flavor2, test_natives_set1);
+
+ // Confirm mapping with getNativesForFlavor
+ comp1 = new Vector(Arrays.asList(test_natives_set1));
+ comp2 = new Vector(flavorMap.getNativesForFlavor(test_flavor1));
+ comp3 = new Vector(flavorMap.getNativesForFlavor(test_flavor2));
+
+ if ( !(comp1.equals(comp2)) || !(comp1.equals(comp3))) {
+ throw new RuntimeException("\n*** After setting up two-way mapping" +
+ "\nwith setNativesForFlavor(DataFlavor flav, String[] natives)" +
+ "\nthe mappings returned from getNativesForFlavor() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("Two-way (DataFlavor): Test Passes");
+
+ // Check first native mapping
+ comp1 = new Vector(Arrays.asList(test_flavors_set1));
+ comp2 = new Vector(flavorMap.getFlavorsForNative(test_native1));
+ comp3 = new Vector(flavorMap.getFlavorsForNative(test_native2));
+
+ if ( !(comp1.equals(comp2)) || !(comp1.equals(comp3))) {
+ throw new RuntimeException("\n*** After setting up two-way mapping" +
+ "\nwith setFlavorsForNative(String nat, DataFlavors[] flavors)" +
+ "\nthe mappings returned from getFlavorsForNative() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("Two-way (String native): Test Passes");
+
+ //
+ // Modify an existing mapping test
+ System.out.println("Modify Existing Mappings Test");
+ flavorMap.setFlavorsForNative(test_native1, test_flavors_set2);
+ flavorMap.setFlavorsForNative(test_native2, test_flavors_set2);
+
+ // Confirm mapping with getFlavorsForNative
+ comp1 = new Vector(Arrays.asList(test_flavors_set2));
+ comp2 = new Vector(flavorMap.getFlavorsForNative(test_native1));
+ comp3 = new Vector(flavorMap.getFlavorsForNative(test_native2));
+
+ if ( !(comp1.equals(comp2)) || !(comp1.equals(comp3))) {
+ throw new RuntimeException("\n*** After modifying an existing mapping" +
+ "\nwith setFlavorsForNative(String nat, DataFlavors[] flavors)" +
+ "\nthe mappings returned from getFlavorsForNative() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("Modify Existing Mappings: Test Passes");
+
+ }
+
+ // Initialize mapping variables used in this test
+ public void initMappings() throws Exception {
+ //create String natives
+ test_native1 = "TEST1";
+ test_native2 = "TEST2";
+ test_native3 = "TEST3";
+ test_native4 = "TEST4";
+
+ test_flavor1 = new DataFlavor(Class.forName("java.awt.Label"), "test1");
+ test_flavor2 = new DataFlavor(Class.forName("java.awt.Button"), "test2");
+ test_flavor3 = new DataFlavor(Class.forName("java.awt.Checkbox"), "test3");
+ test_flavor4 = new DataFlavor(Class.forName("java.awt.List"), "test4");
+
+ //create and initialize DataFlavor arrays
+ test_flavors_set1 = new DataFlavor[] {test_flavor1, test_flavor2};
+ test_flavors_set2 = new DataFlavor[] {test_flavor3, test_flavor4};
+
+ //create and initialize String native arrays
+ test_natives_set1 = new String[] {test_native1, test_native2};
+ test_natives_set2 = new String[] {test_native3, test_native4};
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/SetNativesForFlavor.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap method
+ * setNativesForFlavor(DataFlavor flav, String[] natives)
+ * with valid natives and DataFlavors. Specifically test for
+ * adding new mappings, one-way and two-way, and to update
+ * existing mappings.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main SetNativesForFlavorTest
+ */
+
+public class SetNativesForFlavor {
+
+ SystemFlavorMap flavorMap;
+ Vector comp1, comp2, comp3;
+ Hashtable hash;
+ int hashSize;
+
+ String test_native1, test_native2, test_native3, test_native4;
+ String[] test_natives_set1, test_natives_set2;
+ DataFlavor test_flavor1, test_flavor2, test_flavor3, test_flavor4;
+ DataFlavor[] test_flavors_set1, test_flavors_set2;
+
+ public static void main (String[] args) throws Exception {
+ new SetNativesForFlavor().doTest();
+ }
+
+ public void doTest() throws Exception {
+ // Initialize DataFlavors and arrays used for test data
+ initMappings();
+
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ // Get all the native strings and preferred DataFlavor mappings
+ hash = new Hashtable(flavorMap.getFlavorsForNatives(null));
+ hashSize = hash.size();
+
+ // Setup One-way Mappings
+ System.out.println("One-way Mappings Test");
+ flavorMap.setNativesForFlavor(test_flavor1, test_natives_set1);
+ flavorMap.setNativesForFlavor(test_flavor2, test_natives_set1);
+
+ // Confirm mapping with getNativesForFlavor
+ comp1 = new Vector(Arrays.asList(test_natives_set1));
+ comp2 = new Vector(flavorMap.getNativesForFlavor(test_flavor1));
+ comp3 = new Vector(flavorMap.getNativesForFlavor(test_flavor2));
+
+ if ( !(comp1.equals(comp2)) || !(comp1.equals(comp3))) {
+ throw new RuntimeException("\n*** After setting up one-way mapping" +
+ "\nwith setNativesForFlavor(DataFlavor flav, String[] natives)" +
+ "\nthe mappings returned from getNativesForFlavor() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("One-way: Test Passes");
+
+ // Setup Two-way Mapping
+ System.out.println("Two-way Mappings Test");
+ flavorMap.setFlavorsForNative(test_native1, test_flavors_set1);
+ flavorMap.setFlavorsForNative(test_native2, test_flavors_set1);
+
+ // Confirm mapping with getFlavorsForNative
+ comp1 = new Vector(Arrays.asList(test_flavors_set1));
+ comp2 = new Vector(flavorMap.getFlavorsForNative(test_native1));
+ comp3 = new Vector(flavorMap.getFlavorsForNative(test_native2));
+
+ if ( !(comp1.equals(comp2)) || !(comp1.equals(comp3))) {
+ throw new RuntimeException("\n*** After setting up two-way mapping" +
+ "\nwith setFlavorsForNative(string nat, DataFlavor[] flavors)" +
+ "\nthe mappings returned from getFlavorsForNative() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("Two-way (DataFlavor): Test Passes");
+
+ // Check first native mapping
+ comp1 = new Vector(Arrays.asList(test_natives_set1));
+ comp2 = new Vector(flavorMap.getNativesForFlavor(test_flavor1));
+ comp3 = new Vector(flavorMap.getNativesForFlavor(test_flavor2));
+
+ if ( !(comp1.equals(comp2)) || !(comp1.equals(comp3))) {
+ throw new RuntimeException("\n*** After setting up two-way mapping" +
+ "\nwith setNativesForFlavor(DataFlavor flav, String[] natives)" +
+ "\nthe mappings returned from getNativesForFlavor() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("Two-way (String native): Test Passes");
+
+ // Modify an existing mapping test
+ System.out.println("Modify Existing Mappings Test");
+ flavorMap.setNativesForFlavor(test_flavor1, test_natives_set2);
+ flavorMap.setNativesForFlavor(test_flavor2, test_natives_set2);
+
+ // Confirm mapping with getNativesForFlavor
+ comp1 = new Vector(Arrays.asList(test_natives_set2));
+ comp2 = new Vector(flavorMap.getNativesForFlavor(test_flavor1));
+ comp3 = new Vector(flavorMap.getNativesForFlavor(test_flavor2));
+
+ if ( !(comp1.equals(comp2)) || !(comp1.equals(comp3))) {
+ throw new RuntimeException("\n*** After modifying an existing mapping" +
+ "\nwith setNativesForFlavor(DataFlavor flav, String[] natives)" +
+ "\nthe mappings returned from getNativesForFlavor() do not match" +
+ "\noriginal mappings.");
+ }
+ else
+ System.out.println("Modify Existing Mappings: Test Passes");
+
+ }
+
+ // Initialize mapping variables used in this test
+ public void initMappings() throws Exception {
+ //create String natives
+ test_native1 = "TEST1";
+ test_native2 = "TEST2";
+ test_native3 = "TEST3";
+ test_native4 = "TEST4";
+
+ test_flavor1 = new DataFlavor(Class.forName("java.awt.Label"), "test1");
+ test_flavor2 = new DataFlavor(Class.forName("java.awt.Button"), "test2");
+ test_flavor3 = new DataFlavor(Class.forName("java.awt.Checkbox"), "test3");
+ test_flavor4 = new DataFlavor(Class.forName("java.awt.List"), "test4");
+
+ //create and initialize DataFlavor arrays
+ test_flavors_set1 = new DataFlavor[] {test_flavor1, test_flavor2};
+ test_flavors_set2 = new DataFlavor[] {test_flavor3, test_flavor4};
+
+ //create and initialize String native arrays
+ test_natives_set1 = new String[] {test_native1, test_native2};
+ test_natives_set2 = new String[] {test_native3, test_native4};
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemFlavorMap/SetNativesTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2001, 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
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Vector;
+
+/*
+ * @test
+ * @summary To test SystemFlavorMap method:
+ * setFlavorsForNative(String nat, DataFlavors[] flavors)
+ * with valid natives and DataFlavors. This stress test will
+ * define numerous mappings of valid String natives and
+ * DataFlavors. The mappings will be verified by examining
+ * that all entries are present, and order is maintained.
+ * @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard
+ * @run main SetNativesTest
+ */
+
+public class SetNativesTest {
+
+ SystemFlavorMap flavorMap;
+ Hashtable hashVerify;
+
+ Map mapFlavors;
+ Map mapNatives;
+
+ Hashtable hashFlavors;
+ Hashtable hashNatives;
+
+ public static void main (String[] args){
+ new SetNativesTest().doTest();
+ }
+
+ public void doTest() {
+ flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+ // Get SystemFlavorMap Maps of String Natives and DataFlavors
+ mapFlavors = flavorMap.getNativesForFlavors(null);
+ mapNatives = flavorMap.getFlavorsForNatives(null);
+
+ hashFlavors = new Hashtable(mapFlavors);
+ hashNatives = new Hashtable(mapNatives);
+
+
+ // Test setFlavorsForNative(String nat, DataFlavors[] flavors);
+ //
+ // Enumerate through all the system defined String natives,
+ // and for each String native, define it again to the SystemFlavorMap
+ // with a slightly modified String native (name).
+ //
+ // For verification, a seperate Hashtable will be maintained of the additions.
+ String key;
+ hashVerify = new Hashtable();
+
+ for (Enumeration e = hashNatives.keys() ; e.hasMoreElements() ;) {
+ key = (String)e.nextElement();
+
+ java.util.List listFlavors = flavorMap.getFlavorsForNative(key);
+ Vector vectorFlavors = new Vector(listFlavors);
+ DataFlavor[] arrayFlavors = (DataFlavor[])vectorFlavors.toArray(new DataFlavor[0]);
+
+ key = key.concat("TEST"); // construct a unique String native
+ // define the new String native entry
+ flavorMap.setFlavorsForNative(key, arrayFlavors);
+ // keep track of this new native entry
+ hashVerify.put(key, vectorFlavors);
+ }
+
+ // After establishing "new" mappings, verify that the defined
+ // DataFlavors can be retrieved and that the List (order) is preserved.
+ verifyNewMappings();
+ }
+
+ // Verify getFlavorsForNative(String nat) is returning the correct list
+ // of DataFlavors (for the new mappings).
+ public void verifyNewMappings() {
+ // Enumerate through all natives
+ for (Enumeration e = hashVerify.keys() ; e.hasMoreElements() ;) {
+ String key = (String)e.nextElement();
+
+ java.util.List listFlavors = flavorMap.getFlavorsForNative(key);
+ Vector vectorFlavors = new Vector(listFlavors);
+
+ // Compare the list of DataFlavors
+ if ( !vectorFlavors.equals((Vector)hashVerify.get(key))) {
+ throw new RuntimeException("\n*** Error in verifyNewMappings()" +
+ "\nmethod1: setFlavorsForNative(String nat, DataFlavors[] flavors)" +
+ "\nmethod2: List getFlavorsForNative(String nat)" +
+ "\nString native: " + key +
+ "\nThe Returned List did not match the original set of DataFlavors.");
+ }
+ }
+ System.out.println("*** native size = " + hashVerify.size());
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemSelection/SystemSelectionAWTTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 1999, 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
+ * 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.
+ */
+
+import java.awt.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.InputEvent;
+import java.util.Properties;
+
+/*
+ * @test
+ * @summary To check the functionality of newly added API getSystemSelection & make sure
+ * that it's mapped to primary clipboard
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main SystemSelectionAWTTest
+ */
+
+public class SystemSelectionAWTTest {
+
+ Frame frame;
+ TextField tf1, tf2;
+ Clipboard clip;
+ Transferable t;
+
+ public static void main(String[] args) throws Exception {
+ new SystemSelectionAWTTest().doTest();
+ }
+
+ SystemSelectionAWTTest() {
+ frame = new Frame();
+ frame.setSize(200, 200);
+
+ tf1 = new TextField();
+ tf1.addFocusListener( new FocusAdapter() {
+ public void focusGained(FocusEvent fe) {
+ fe.getSource();
+ }
+ });
+
+ tf2 = new TextField();
+
+ frame.add(tf2, BorderLayout.NORTH);
+ frame.add(tf1, BorderLayout.CENTER);
+
+ frame.setVisible(true);
+ frame.toFront();
+ tf1.requestFocus();
+ tf1.setText("Selection Testing");
+ }
+
+ // Check whether Security manager is there
+ public void checkSecurity() {
+ SecurityManager sm = System.getSecurityManager();
+
+ if (sm == null) {
+ System.out.println("security manager is not there");
+ getPrimaryClipboard();
+ } else {
+ try {
+ sm.checkPermission(new AWTPermission("accessClipboard"));
+ getPrimaryClipboard();
+ } catch(SecurityException e) {
+ clip = null;
+ System.out.println("Access to System selection is not allowed");
+ }
+ }
+ }
+
+ // Get the contents from the clipboard
+ void getClipboardContent() throws Exception {
+ t = clip.getContents(this);
+ if ( (t != null) && (t.isDataFlavorSupported(DataFlavor.stringFlavor) )) {
+ tf2.setBackground(Color.red);
+ tf2.setForeground(Color.black);
+ tf2.setText((String) t.getTransferData(DataFlavor.stringFlavor));
+ }
+ }
+
+ // Get System Selection i.e. Primary Clipboard
+ private void getPrimaryClipboard() {
+ Properties ps = System.getProperties();
+ String operSys = ps.getProperty("os.name");
+ clip = Toolkit.getDefaultToolkit().getSystemSelection();
+ if (clip == null) {
+ if ((operSys.substring(0,3)).equalsIgnoreCase("Win") ||
+ (operSys.substring(0,3)).equalsIgnoreCase("Mac"))
+ System.out.println(operSys + " operating system does not support system selection ");
+ else
+ throw new RuntimeException("Method getSystemSelection() is returning null on X11 platform");
+ }
+ }
+
+ // Compare the selected text with one pasted from the clipboard
+ public void compareText() {
+ if ((tf2.getText()).equals(tf1.getSelectedText()) &&
+ System.getProperties().getProperty("os.name").substring(0,3) != "Win") {
+ System.out.println("Selected text & clipboard contents are same\n");
+ } else {
+ throw new RuntimeException("Selected text & clipboard contents differs\n");
+ }
+ }
+
+ public void doTest() throws Exception {
+ ExtendedRobot robot = new ExtendedRobot();
+
+ frame.setLocation(100, 100);
+ robot.waitForIdle(2000);
+
+ Point tf1Location = tf1.getLocationOnScreen();
+ Dimension tf1Size = tf1.getSize();
+ checkSecurity();
+
+ if (clip != null) {
+ robot.mouseMove(tf1Location.x + 5, tf1Location.y + tf1Size.height / 2);
+ robot.waitForIdle(2000);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(2000);
+
+ getClipboardContent();
+ compareText();
+
+ robot.mouseMove(tf1Location.x + tf1Size.width / 2, tf1Location.y + tf1Size.height / 2);
+ robot.waitForIdle(2000);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(2000);
+
+ getClipboardContent();
+ compareText();
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/SystemSelection/SystemSelectionSwingTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 1999, 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
+ * 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.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.InputEvent;
+import java.util.Properties;
+
+/*
+ * @test
+ * @summary To check the functionality of newly added API getSystemSelection & make sure
+ * that it's mapped to primary clipboard
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main SystemSelectionSwingTest
+ */
+
+public class SystemSelectionSwingTest {
+
+ JFrame jframe;
+ JTextField jtf1, jtf2;
+ Clipboard clip;
+ Transferable t;
+
+ public static void main(String[] args) throws Exception {
+ new SystemSelectionSwingTest().doTest();
+ }
+
+ SystemSelectionSwingTest() {
+ jframe = new JFrame();
+ jframe.setSize(200, 200);
+
+ jtf1 = new JTextField();
+ jtf1.addFocusListener( new FocusAdapter() {
+ public void focusGained(FocusEvent fe) {
+ fe.getSource();
+ }
+ });
+
+ jtf2 = new JTextField();
+
+ jframe.add(jtf2, BorderLayout.NORTH);
+ jframe.add(jtf1, BorderLayout.CENTER);
+
+ jframe.setVisible(true);
+ jframe.toFront();
+ jtf1.requestFocus();
+ jtf1.setText("Selection Testing");
+ }
+
+ // Check whether Security manager is there
+ public void checkSecurity() {
+ SecurityManager sm = System.getSecurityManager();
+
+ if (sm == null) {
+ System.out.println("security manager is not there");
+ getPrimaryClipboard();
+ } else {
+ try {
+ sm.checkPermission(new AWTPermission("accessClipboard"));
+ getPrimaryClipboard();
+ } catch(SecurityException e) {
+ clip = null;
+ System.out.println("Access to System selection is not allowed");
+ }
+ }
+ }
+
+ // Get the contents from the clipboard
+ void getClipboardContent() throws Exception {
+ t = clip.getContents(this);
+ if ( (t != null) && (t.isDataFlavorSupported(DataFlavor.stringFlavor) )) {
+ jtf2.setBackground(Color.red);
+ jtf2.setForeground(Color.black);
+ jtf2.setText((String) t.getTransferData(DataFlavor.stringFlavor));
+ }
+ }
+
+
+ // Get System Selection i.e. Primary Clipboard
+ private void getPrimaryClipboard() {
+ Properties ps = System.getProperties();
+ String operSys = ps.getProperty("os.name");
+ clip = Toolkit.getDefaultToolkit().getSystemSelection();
+ if (clip == null) {
+ if ((operSys.substring(0,3)).equalsIgnoreCase("Win") ||
+ (operSys.substring(0,3)).equalsIgnoreCase("Mac"))
+ System.out.println(operSys + " operating system does not support system selection ");
+ else
+ throw new RuntimeException("Method getSystemSelection() is returning null on X11 platform");
+ }
+ }
+
+ // Compare the selected text with one pasted from the clipboard
+ public void compareText() {
+ if ((jtf2.getText()).equals(jtf1.getSelectedText()) &&
+ System.getProperties().getProperty("os.name").substring(0,3) != "Win") {
+ System.out.println("Selected text & clipboard contents are same\n");
+ } else {
+ throw new RuntimeException("Selected text & clipboard contents differs\n");
+ }
+ }
+
+ public void doTest() throws Exception {
+ ExtendedRobot robot = new ExtendedRobot();
+
+ jframe.setLocation(100, 100);
+ robot.waitForIdle(2000);
+
+ Point tf1Location = jtf1.getLocationOnScreen();
+ Dimension tf1Size = jtf1.getSize();
+ checkSecurity();
+
+ if (clip != null) {
+ robot.mouseMove(tf1Location.x + 5, tf1Location.y + tf1Size.height / 2);
+ robot.waitForIdle(2000);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(2000);
+
+ getClipboardContent();
+ compareText();
+
+ robot.mouseMove(tf1Location.x + tf1Size.width / 2, tf1Location.y + tf1Size.height / 2);
+ robot.waitForIdle(2000);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(20);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle(2000);
+
+ getClipboardContent();
+ compareText();
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PrinterJob/PolylinePrintingTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @bug 8041902
+ * @summary Test printing of wide poly lines.
+ * @run main/manual=yesno PolylinePrintingTest
+ */
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.TextArea;
+import java.awt.BasicStroke;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.geom.Path2D;
+import java.awt.print.PageFormat;
+import java.awt.print.Paper;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+
+public class PolylinePrintingTest implements Printable {
+
+ public int print(Graphics graphics, PageFormat pageFormat,
+ int pageIndex) throws PrinterException {
+
+ if (pageIndex > 0) {
+ return NO_SUCH_PAGE;
+ }
+
+ Graphics2D g2d = (Graphics2D) graphics;
+ g2d.setStroke(new BasicStroke(25,
+ BasicStroke.CAP_ROUND,
+ BasicStroke.JOIN_MITER,
+ 10.0F, null, 1.0F));
+
+ int[] x2Points = {100, 250, 400};
+ int[] y2Points = {100, 400, 100};
+ drawPolylineGOOD(g2d, x2Points, y2Points);
+ drawPolylineBAD(g2d, x2Points, y2Points);
+
+ return PAGE_EXISTS;
+ }
+
+ private void drawPolylineGOOD(Graphics2D g2d,
+ int[] x2Points, int[] y2Points) {
+
+ Path2D polyline =
+ new Path2D.Float(Path2D.WIND_EVEN_ODD, x2Points.length);
+
+ polyline.moveTo(x2Points[0], y2Points[0]);
+
+ for (int index = 1; index < x2Points.length; index++) {
+ polyline.lineTo(x2Points[index], y2Points[index]);
+ }
+ g2d.draw(polyline);
+ }
+
+ private void drawPolylineBAD(Graphics2D g, int[] xp, int[] yp) {
+ int offset = 200;
+ g.translate(0, offset);
+ g.drawPolyline(xp, yp, xp.length);
+ }
+
+ public PolylinePrintingTest() throws PrinterException {
+ PrinterJob job = PrinterJob.getPrinterJob();
+ PageFormat pf = job.defaultPage();
+ Paper p = pf.getPaper();
+ p.setImageableArea(0,0,p.getWidth(), p.getHeight());
+ pf.setPaper(p);
+ job.setPrintable(this, pf);
+ if (job.printDialog()) {
+ job.print();
+ }
+ }
+
+ public static void main(String[] args) throws PrinterException {
+ String[] instructions = {
+ "You must have a printer available to perform this test.",
+ "OK the print dialog, and collect the printed page.",
+ "Passing test : Output should show two identical chevrons.",
+ "Failing test : The line joins will appear different."
+ };
+ Sysout.createDialog();
+ Sysout.printInstructions(instructions);
+ new PolylinePrintingTest();
+ }
+}
+
+class Sysout {
+ private static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog {
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ show();
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ }
+
+}// TestDialog class
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/4058433/TestBeanProperty.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.beans.BeanProperty;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.beans.PropertyDescriptor;
+import java.util.Arrays;
+/*
+ * @test
+ * @bug 4058433
+ * @summary Tests the BeanProperty annotation
+ * @author Sergey Malenkov
+ * @library ..
+ */
+public class TestBeanProperty {
+ public static void main(String[] args) throws Exception {
+ Class<?>[] types = {B.class, BL.class, BLF.class, E.class, H.class, P.class, VU.class, D.class, EV.class, EVL.class, EVX.class};
+ for (Class<?> type : types) {
+ PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(type, "value");
+ if (((B.class == type) || (BLF.class == type)) && pd.isBound()) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("not bound");
+ }
+ if ((BL.class == type) == !pd.isBound()) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("bound");
+ }
+ if ((E.class == type) == !pd.isExpert()) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("expert");
+ }
+ if ((H.class == type) == !pd.isHidden()) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("hidden");
+ }
+ if ((P.class == type) == !pd.isPreferred()) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("preferred");
+ }
+ if ((R.class == type) == !Boolean.TRUE.equals(pd.getValue("required"))) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("required");
+ }
+ if ((VU.class == type) == !Boolean.TRUE.equals(pd.getValue("visualUpdate"))) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("visualUpdate");
+ }
+ if ((EV.class == type) == !isEV(pd, "LEFT", 2, "javax.swing.SwingConstants.LEFT", "RIGHT", 4, "javax.swing.SwingConstants.RIGHT")) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("enumerationValues from another package");
+ }
+ if ((EVL.class == type) == !isEV(pd, "ZERO", 0, "ZERO", "ONE", 1, "ONE")) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("enumerationValues from another package");
+ }
+ if ((EVX.class == type) == !isEV(pd, "ZERO", 0, "X.ZERO", "ONE", 1, "X.ONE")) {
+ BeanUtils.reportPropertyDescriptor(pd);
+ throw new Error("enumerationValues from another package");
+ }
+ }
+ }
+
+ private static boolean isEV(PropertyDescriptor pd, Object... expected) {
+ Object value = pd.getValue("enumerationValues");
+ return value instanceof Object[] && Arrays.equals((Object[]) value, expected);
+ }
+
+ public static class B {
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ public static class BL {
+ private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ this.pcs.addPropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ this.pcs.removePropertyChangeListener(listener);
+ }
+ }
+
+ public static class BLF {
+ private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ @BeanProperty(bound = false)
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ this.pcs.addPropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ this.pcs.removePropertyChangeListener(listener);
+ }
+ }
+
+ public static class E {
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ @BeanProperty(expert = true)
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ public static class H {
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ @BeanProperty(hidden = true)
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ public static class P {
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ @BeanProperty(preferred = true)
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ public static class R {
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ @BeanProperty(required = true)
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ public static class VU {
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ @BeanProperty(visualUpdate = true)
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ public static class D {
+ private int value;
+
+ @BeanProperty(description = "getter")
+ public int getValue() {
+ return this.value;
+ }
+
+ @BeanProperty(description = "setter")
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ public static class EV {
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ @BeanProperty(enumerationValues = {
+ "javax.swing.SwingConstants.LEFT",
+ "javax.swing.SwingConstants.RIGHT"})
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ public static class EVL {
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ @BeanProperty(enumerationValues = {"ZERO", "ONE"})
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ public static int ZERO = 0;
+ public static int ONE = 1;
+ }
+
+ public static class EVX {
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ @BeanProperty(enumerationValues = {
+ "X.ZERO",
+ "X.ONE"})
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ public static interface X {
+ int ZERO = 0;
+ int ONE = 1;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/4058433/TestJavaBean.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.event.ActionListener;
+import java.beans.BeanDescriptor;
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.JavaBean;
+/*
+ * @test
+ * @bug 4058433
+ * @summary Tests the JavaBean annotation
+ * @author Sergey Malenkov
+ */
+public class TestJavaBean {
+ public static void main(String[] args) throws Exception {
+ test(X.class);
+ test(D.class);
+ test(DP.class);
+ test(DES.class);
+ }
+
+ private static void test(Class<?> type) throws Exception {
+ System.out.println(type);
+ BeanInfo info = Introspector.getBeanInfo(type);
+ BeanDescriptor bd = info.getBeanDescriptor();
+
+ String description = bd.getShortDescription();
+ System.out.println("description = " + description);
+
+ int dp = info.getDefaultPropertyIndex();
+ System.out.println("property index = " + dp);
+ if (0 <= dp) {
+ String name = info.getPropertyDescriptors()[dp].getName();
+ System.out.println("property name = " + name);
+ }
+ int des = info.getDefaultEventIndex();
+ System.out.println("event set index = " + des);
+ if (0 <= des) {
+ String name = info.getPropertyDescriptors()[des].getName();
+ System.out.println("event set name = " + name);
+ }
+
+ if ((D.class == type) == bd.getName().equals(description)) {
+ throw new Error("unexpected description of the bean");
+ }
+ if ((DP.class == type) == (dp < 0)) {
+ throw new Error("unexpected index of the default property");
+ }
+ if ((DES.class == type) == (des < 0)) {
+ throw new Error("unexpected index of the default event set");
+ }
+ }
+
+ public static class X {
+ }
+
+ @JavaBean(description = "description")
+ public static class D {
+ }
+
+ @JavaBean(defaultProperty = "value")
+ public static class DP {
+ private int value;
+
+ public int getValue() {
+ return this.value;
+ }
+
+ public void setValue(int value) {
+ this.value = value;
+ }
+ }
+
+ @JavaBean(defaultEventSet = "action")
+ public static class DES {
+ public void addActionListener(ActionListener listener) {
+ }
+
+ public void removeActionListener(ActionListener listener) {
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/4058433/TestSwingContainer.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.beans.BeanDescriptor;
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.util.Objects;
+import javax.swing.SwingContainer;
+/*
+ * @test
+ * @bug 4058433
+ * @summary Tests the SwingContainer annotation
+ * @author Sergey Malenkov
+ */
+public class TestSwingContainer {
+ public static void main(String[] args) throws Exception {
+ test(X.class, null, null);
+ test(T.class, true, null);
+ test(D.class, true, "method");
+ test(F.class, false, null);
+ test(A.class, false, "method");
+ }
+
+ private static void test(Class<?> type, Object iC, Object cD) throws Exception {
+ System.out.println(type);
+ BeanInfo info = Introspector.getBeanInfo(type);
+ BeanDescriptor bd = info.getBeanDescriptor();
+ test(bd, "isContainer", iC);
+ test(bd, "containerDelegate", cD);
+ }
+
+ private static void test(BeanDescriptor bd, String name, Object expected) {
+ Object value = bd.getValue(name);
+ System.out.println(name + " = " + value);
+ if (!Objects.equals(value, expected)) {
+ throw new Error(name + ": expected = " + expected + "; actual = " + value);
+ }
+ }
+
+ public static class X {
+ }
+
+ @SwingContainer()
+ public static class T {
+ }
+
+ @SwingContainer(delegate = "method")
+ public static class D {
+ }
+
+ @SwingContainer(false)
+ public static class F {
+ }
+
+ @SwingContainer(value = false, delegate = "method")
+ public static class A {
+ }
+}
--- a/jdk/test/java/beans/Introspector/7084904/Test7084904.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/beans/Introspector/7084904/Test7084904.java Fri Jul 25 09:44:53 2014 +0000
@@ -27,6 +27,7 @@
* @bug 7084904
* @summary Compares reflection and bean introspection
* @author Sergey Malenkov
+ * @library ..
*/
public class Test7084904 {
public static void main(String[] args) throws Exception {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Performance/Test4058433.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Image;
+import java.beans.BeanDescriptor;
+import java.beans.BeanInfo;
+import java.beans.EventSetDescriptor;
+import java.beans.FeatureDescriptor;
+import java.beans.IndexedPropertyDescriptor;
+import java.beans.Introspector;
+import java.beans.MethodDescriptor;
+import java.beans.ParameterDescriptor;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/*
+ * @test
+ * @bug 4058433
+ * @summary Generates BeanInfo for public classes in AWT, Accessibility, and Swing
+ * @author Sergey Malenkov
+ * @run main/manual Test4058433
+ */
+
+public class Test4058433 implements Comparator<Object> {
+ @Override
+ public int compare(Object one, Object two) {
+ if (one instanceof Method && two instanceof Method) {
+ Method oneMethod = (Method) one;
+ Method twoMethod = (Method) two;
+ int result = oneMethod.getName().compareTo(twoMethod.getName());
+ if (result != 0) {
+ return result;
+ }
+ }
+ if (one instanceof FeatureDescriptor && two instanceof FeatureDescriptor) {
+ FeatureDescriptor oneFD = (FeatureDescriptor) one;
+ FeatureDescriptor twoFD = (FeatureDescriptor) two;
+ int result = oneFD.getName().compareTo(twoFD.getName());
+ if (result != 0) {
+ return result;
+ }
+ }
+ return one.toString().compareTo(two.toString());
+ }
+
+ public static void main(String[] args) throws Exception {
+ String resource = ClassLoader.getSystemResource("java/lang/Object.class").toString();
+
+ Pattern pattern = Pattern.compile("jar:file:(.*)!.*");
+ Matcher matcher = pattern.matcher(resource);
+ matcher.matches();
+ resource = matcher.group(1);
+
+ TreeSet<Class<?>> types = new TreeSet<>(new Test4058433());
+ try (JarFile jarFile = new JarFile(resource.replaceAll("%20", " "))) {
+ Enumeration<JarEntry> entries = jarFile.entries();
+ while (entries.hasMoreElements()) {
+ String name = entries.nextElement().getName();
+ if (name.startsWith("java/awt/") || name.startsWith("javax/accessibility/") || name.startsWith("javax/swing/")) {
+ if (name.endsWith(".class")) {
+ name = name.substring(0, name.indexOf(".")).replace('/', '.');
+ Class<?> type = Class.forName(name);
+ if (!type.isInterface() && !type.isEnum() && !type.isAnnotation() && !type.isAnonymousClass()) {
+ if (null == type.getDeclaringClass()) {
+ types.add(type);
+ }
+ }
+ }
+ }
+ }
+ }
+ System.out.println("found " + types.size() + " classes");
+ long time = -System.currentTimeMillis();
+ for (Class<?> type : types) {
+ System.out.println("========================================");
+ BeanInfo info = Introspector.getBeanInfo(type);
+
+ BeanDescriptor bd = info.getBeanDescriptor();
+ System.out.println(bd.getBeanClass());
+ print("customizer", bd.getCustomizerClass());
+ print(bd);
+ print("mono 16x16", info.getIcon(BeanInfo.ICON_MONO_16x16));
+ print("mono 32x32", info.getIcon(BeanInfo.ICON_MONO_32x32));
+ print("color 16x16", info.getIcon(BeanInfo.ICON_COLOR_16x16));
+ print("color 32x32", info.getIcon(BeanInfo.ICON_COLOR_32x32));
+
+ PropertyDescriptor[] pds = info.getPropertyDescriptors();
+ PropertyDescriptor dpd = getDefault(pds, info.getDefaultPropertyIndex());
+ System.out.println(pds.length + " property descriptors");
+ Arrays.sort(pds, new Test4058433());
+ for (PropertyDescriptor pd : pds) {
+ print(pd);
+ if (dpd == pd) {
+ System.out.println("default property");
+ }
+ print("bound", pd.isBound());
+ print("constrained", pd.isConstrained());
+ print("property editor", pd.getPropertyEditorClass());
+ print("property type", pd.getPropertyType());
+ print("read method", pd.getReadMethod());
+ print("write method", pd.getWriteMethod());
+ if (pd instanceof IndexedPropertyDescriptor) {
+ IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
+ print("indexed property type", ipd.getIndexedPropertyType());
+ print("indexed read method", ipd.getIndexedReadMethod());
+ print("indexed write method", ipd.getIndexedWriteMethod());
+ }
+ }
+ EventSetDescriptor[] esds = info.getEventSetDescriptors();
+ EventSetDescriptor desd = getDefault(esds, info.getDefaultEventIndex());
+ System.out.println(esds.length + " event set descriptors");
+ Arrays.sort(esds, new Test4058433());
+ for (EventSetDescriptor esd : esds) {
+ print(esd);
+ if (desd == esd) {
+ System.out.println("default event set");
+ }
+ print("in default", esd.isInDefaultEventSet());
+ print("unicast", esd.isUnicast());
+ print("listener type", esd.getListenerType());
+ print("get listener method", esd.getGetListenerMethod());
+ print("add listener method", esd.getAddListenerMethod());
+ print("remove listener method", esd.getRemoveListenerMethod());
+ Method[] methods = esd.getListenerMethods();
+ Arrays.sort(methods, new Test4058433());
+ for (Method method : methods) {
+ print("listener method", method);
+ }
+ print(esd.getListenerMethodDescriptors());
+ }
+ print(info.getMethodDescriptors());
+ }
+ time += System.currentTimeMillis();
+ System.out.println("DONE IN " + time + " MS");
+ }
+
+ private static <T> T getDefault(T[] array, int index) {
+ return (index == -1) ? null : array[index];
+ }
+
+ private static void print(MethodDescriptor[] mds) {
+ System.out.println(mds.length + " method descriptors");
+ Arrays.sort(mds, new Test4058433());
+ for (MethodDescriptor md : mds) {
+ print(md);
+ print("method", md.getMethod());
+ ParameterDescriptor[] pds = md.getParameterDescriptors();
+ if (pds != null) {
+ System.out.println(pds.length + " parameter descriptors");
+ for (ParameterDescriptor pd : pds) {
+ print(pd);
+ }
+ }
+ }
+ }
+
+ private static void print(FeatureDescriptor descriptor) {
+ String name = descriptor.getName();
+ String display = descriptor.getDisplayName();
+ String description = descriptor.getShortDescription();
+ System.out.println("name: " + name);
+ if (!Objects.equals(name, display)) {
+ System.out.println("display name: " + display);
+ }
+ if (!Objects.equals(display, description)) {
+ System.out.println("description: " + description.trim());
+ }
+ print("expert", descriptor.isExpert());
+ print("hidden", descriptor.isHidden());
+ print("preferred", descriptor.isPreferred());
+ TreeMap<String,Object> map = new TreeMap<>();
+ Enumeration<String> enumeration = descriptor.attributeNames();
+ while (enumeration.hasMoreElements()) {
+ String id = enumeration.nextElement();
+ Object value = descriptor.getValue(id);
+ if (value.getClass().isArray()) {
+ TreeSet<String> set = new TreeSet<>();
+ int index = 0;
+ int length = Array.getLength(value);
+ while (index < length) {
+ set.add(Array.get(value, index++) + ", " +
+ Array.get(value, index++) + ", " +
+ Array.get(value, index++));
+ }
+ value = set.toString();
+ }
+ map.put(id, value);
+ }
+ for (Entry<String,Object> entry : map.entrySet()) {
+ System.out.println(entry.getKey() + ": " + entry.getValue());
+ }
+ }
+
+ private static void print(String id, boolean flag) {
+ if (flag) {
+ System.out.println(id + " is set");
+ }
+ }
+
+ private static void print(String id, Class<?> type) {
+ if (type != null) {
+ System.out.println(id + ": " + type.getName());
+ }
+ }
+
+ private static void print(String id, Method method) {
+ if (method != null) {
+ System.out.println(id + ": " + method);
+ }
+ }
+
+ private static void print(String name, Image image) {
+ if (image != null) {
+ System.out.println(name + " icon is exist");
+ }
+ }
+}
--- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6741606 7146431 8000450 8019830 8022945
+ * @bug 6741606 7146431 8000450 8019830 8022945 8027144 8041633
* @summary Make sure all restricted packages listed in the package.access
* property in the java.security file are blocked
* @run main/othervm CheckPackageAccess
@@ -83,7 +83,8 @@
"org.jcp.xml.dsig.internal.",
"jdk.internal.",
"jdk.nashorn.internal.",
- "jdk.nashorn.tools."
+ "jdk.nashorn.tools.",
+ "com.sun.activation.registries."
};
public static void main(String[] args) throws Exception {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineMethodDelInvoke.sh Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,98 @@
+#
+# Copyright (c) 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# @test
+# @bug 8042796
+# @summary jvmtiRedefineClasses.cpp: guarantee(false) failed: OLD and/or OBSOLETE method(s) found
+# @author Daniel D. Daugherty
+# @author Serguei Spitsyn
+#
+# @run shell MakeJAR3.sh RedefineMethodDelInvokeAgent 'Can-Redefine-Classes: true'
+# @run build RedefineMethodDelInvokeApp
+# @run shell RedefineMethodDelInvoke.sh
+#
+
+if [ "${TESTJAVA}" = "" ]
+then
+ echo "TESTJAVA not set. Test cannot execute. Failed."
+ exit 1
+fi
+
+if [ "${COMPILEJAVA}" = "" ]
+then
+ COMPILEJAVA="${TESTJAVA}"
+fi
+echo "COMPILEJAVA=${COMPILEJAVA}"
+
+if [ "${TESTSRC}" = "" ]
+then
+ echo "TESTSRC not set. Test cannot execute. Failed."
+ exit 1
+fi
+
+if [ "${TESTCLASSES}" = "" ]
+then
+ echo "TESTCLASSES not set. Test cannot execute. Failed."
+ exit 1
+fi
+
+JAVAC="${COMPILEJAVA}"/bin/javac
+JAVA="${TESTJAVA}"/bin/java
+
+cp "${TESTSRC}"/RedefineMethodDelInvokeTarget_1.java \
+ RedefineMethodDelInvokeTarget.java
+"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . RedefineMethodDelInvokeTarget.java
+mv RedefineMethodDelInvokeTarget.java RedefineMethodDelInvokeTarget_1.java
+mv RedefineMethodDelInvokeTarget.class RedefineMethodDelInvokeTarget_1.class
+
+cp "${TESTSRC}"/RedefineMethodDelInvokeTarget_2.java \
+ RedefineMethodDelInvokeTarget.java
+"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . RedefineMethodDelInvokeTarget.java
+mv RedefineMethodDelInvokeTarget.java RedefineMethodDelInvokeTarget_2.java
+mv RedefineMethodDelInvokeTarget.class RedefineMethodDelInvokeTarget_2.class
+
+"${JAVA}" ${TESTVMOPTS} -javaagent:RedefineMethodDelInvokeAgent.jar \
+ -classpath "${TESTCLASSES}" RedefineMethodDelInvokeApp > output.log 2>&1
+
+result=$?
+if [ "$result" = 0 ]; then
+ echo "The test returned expected exit code: $result"
+else
+ echo "FAIL: the test returned unexpected exit code: $result"
+ exit $result
+fi
+
+cat output.log
+
+MESG="Exception"
+grep "$MESG" output.log
+result=$?
+if [ "$result" = 0 ]; then
+ echo "FAIL: found '$MESG' in the test output"
+ result=1
+else
+ echo "PASS: did NOT find '$MESG' in the test output"
+ result=0
+fi
+
+exit $result
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineMethodDelInvokeAgent.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.instrument.Instrumentation;
+
+public class RedefineMethodDelInvokeAgent {
+ private static Instrumentation instrumentation;
+
+ private RedefineMethodDelInvokeAgent() {
+ }
+
+ public static void premain(String agentArgs, Instrumentation inst) {
+ System.out.println("Hello from RedefineMethodDelInvokeAgent!");
+ System.out.println("isRedefineClassesSupported()=" +
+ inst.isRedefineClassesSupported());
+
+ instrumentation = inst;
+ }
+
+ public static Instrumentation getInstrumentation() {
+ return instrumentation;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineMethodDelInvokeApp.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.lang.instrument.*;
+
+public class RedefineMethodDelInvokeApp {
+ public static void main(String args[]) {
+ System.out.println("Hello from RedefineMethodDelInvokeApp!");
+
+ try {
+ new RedefineMethodDelInvokeApp().doTest();
+ } catch (Exception ex) {
+ System.out.println("Exception has been caught");
+ ex.printStackTrace();
+ System.exit(1);
+ }
+ System.exit(0);
+ }
+
+ private void doTest() throws Exception {
+ RedefineMethodDelInvokeTarget target =
+ new RedefineMethodDelInvokeTarget();
+
+ System.out.println("RedefineMethodDelInvokeApp: invoking myMethod0(), myMethod1(), myMethod2()");
+ target.test();
+
+ // delete myMethod2()
+ do_redefine(1);
+
+ System.out.println("RedefineMethodDelInvokeApp: invoking myMethod0(), myMethod1()");
+ target.test();
+
+ // delete myMethod1()
+ do_redefine(2);
+
+ System.out.println("RedefineMethodDelInvokeApp: invoking myMethod0()");
+ target.test();
+ }
+
+ private static void do_redefine(int counter) throws Exception {
+ File f = new File("RedefineMethodDelInvokeTarget_" + counter +
+ ".class");
+ System.out.println("Reading test class from " + f);
+ InputStream redefineStream = new FileInputStream(f);
+
+ byte[] redefineBuffer = NamedBuffer.loadBufferFromStream(redefineStream);
+
+ ClassDefinition redefineParamBlock = new ClassDefinition(
+ RedefineMethodDelInvokeTarget.class, redefineBuffer);
+
+ RedefineMethodDelInvokeAgent.getInstrumentation().redefineClasses(
+ new ClassDefinition[] {redefineParamBlock});
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineMethodDelInvokeTarget.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class RedefineMethodDelInvokeTarget {
+ public void test() {
+ myMethod0();
+ }
+
+ public static void myMethod0() {
+ System.out.println("Target 0: myMethod0: Calling myMethod1()");
+ myMethod1();
+ }
+
+ private static void myMethod1() {
+ System.out.println("Target 0: myMethod1: Calling myMethod2()");
+ myMethod2();
+ }
+
+ private static void myMethod2() {
+ System.out.println("Target 0: myMethod2");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineMethodDelInvokeTarget_1.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class RedefineMethodDelInvokeTarget {
+ public void test() {
+ myMethod0();
+ }
+
+ public static void myMethod0() {
+ System.out.println("Target 1: myMethod0: Calling myMethod1()");
+ myMethod1();
+ }
+
+ private static void myMethod1() {
+ System.out.println("Target 1: myMethod1");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineMethodDelInvokeTarget_2.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class RedefineMethodDelInvokeTarget {
+ public void test() {
+ myMethod0();
+ }
+
+ public static void myMethod0() {
+ System.out.println("Target 2: myMethod0");
+ }
+}
--- a/jdk/test/java/util/regex/RegExTest.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/util/regex/RegExTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -32,7 +32,7 @@
* 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
* 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
- * 8027645 8035076 8039124
+ * 8027645 8035076 8039124 8035975
*/
import java.util.regex.*;
@@ -150,6 +150,7 @@
groupCurlyNotFoundSuppTest();
groupCurlyBackoffTest();
patternAsPredicate();
+ invalidFlags();
if (failure) {
throw new
@@ -4457,4 +4458,30 @@
}
report("Pattern.asPredicate");
}
+
+ // This test is for 8035975
+ private static void invalidFlags() throws Exception {
+ for (int flag = 1; flag != 0; flag <<= 1) {
+ switch (flag) {
+ case Pattern.CASE_INSENSITIVE:
+ case Pattern.MULTILINE:
+ case Pattern.DOTALL:
+ case Pattern.UNICODE_CASE:
+ case Pattern.CANON_EQ:
+ case Pattern.UNIX_LINES:
+ case Pattern.LITERAL:
+ case Pattern.UNICODE_CHARACTER_CLASS:
+ case Pattern.COMMENTS:
+ // valid flag, continue
+ break;
+ default:
+ try {
+ Pattern.compile(".", flag);
+ failCount++;
+ } catch (IllegalArgumentException expected) {
+ }
+ }
+ }
+ report("Invalid compile flags");
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/stream/bootlib/java/util/stream/ThowableHelper.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.stream;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+public final class ThowableHelper {
+
+ public static void checkException(Class<? extends Exception> ce, Runnable r) {
+ Exception caught = null;
+ try {
+ r.run();
+ } catch (Exception e) {
+ caught = e;
+ }
+
+ assertNotNull(caught);
+ assertTrue(ce.isInstance(caught));
+ }
+
+ public static void checkNPE(Runnable r) {
+ checkException(NullPointerException.class, r);
+ }
+
+ public static void checkISE(Runnable r) {
+ checkException(IllegalStateException.class, r);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/CollectAndSummaryStatisticsTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,153 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary primtive stream collection with summary statistics
+ * @bug 8044047
+ */
+
+package org.openjdk.tests.java.util.stream;
+
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.DoubleSummaryStatistics;
+import java.util.IntSummaryStatistics;
+import java.util.List;
+import java.util.LongSummaryStatistics;
+import java.util.stream.Collectors;
+import java.util.stream.DoubleStream;
+import java.util.stream.IntStream;
+import java.util.stream.LongStream;
+import java.util.stream.OpTestCase;
+
+import static java.util.stream.LambdaTestHelpers.countTo;
+import static java.util.stream.ThowableHelper.checkNPE;
+
+@Test
+public class CollectAndSummaryStatisticsTest extends OpTestCase {
+
+ public void testIntCollectNull() {
+ checkNPE(() -> IntStream.of(1).collect(null,
+ IntSummaryStatistics::accept,
+ IntSummaryStatistics::combine));
+ checkNPE(() -> IntStream.of(1).collect(IntSummaryStatistics::new,
+ null,
+ IntSummaryStatistics::combine));
+ checkNPE(() -> IntStream.of(1).collect(IntSummaryStatistics::new,
+ IntSummaryStatistics::accept,
+ null));
+ }
+
+ public void testLongCollectNull() {
+ checkNPE(() -> LongStream.of(1).collect(null,
+ LongSummaryStatistics::accept,
+ LongSummaryStatistics::combine));
+ checkNPE(() -> LongStream.of(1).collect(LongSummaryStatistics::new,
+ null,
+ LongSummaryStatistics::combine));
+ checkNPE(() -> LongStream.of(1).collect(LongSummaryStatistics::new,
+ LongSummaryStatistics::accept,
+ null));
+ }
+
+ public void testDoubleCollectNull() {
+ checkNPE(() -> DoubleStream.of(1).collect(null,
+ DoubleSummaryStatistics::accept,
+ DoubleSummaryStatistics::combine));
+ checkNPE(() -> DoubleStream.of(1).collect(DoubleSummaryStatistics::new,
+ null,
+ DoubleSummaryStatistics::combine));
+ checkNPE(() -> DoubleStream.of(1).collect(DoubleSummaryStatistics::new,
+ DoubleSummaryStatistics::accept,
+ null));
+ }
+
+ public void testIntStatistics() {
+ List<IntSummaryStatistics> instances = new ArrayList<>();
+ instances.add(countTo(1000).stream().collect(Collectors.summarizingInt(i -> i)));
+ instances.add(countTo(1000).stream().mapToInt(i -> i).summaryStatistics());
+ instances.add(countTo(1000).stream().mapToInt(i -> i).collect(IntSummaryStatistics::new,
+ IntSummaryStatistics::accept,
+ IntSummaryStatistics::combine));
+ instances.add(countTo(1000).parallelStream().collect(Collectors.summarizingInt(i -> i)));
+ instances.add(countTo(1000).parallelStream().mapToInt(i -> i).summaryStatistics());
+ instances.add(countTo(1000).parallelStream().mapToInt(i -> i).collect(IntSummaryStatistics::new,
+ IntSummaryStatistics::accept,
+ IntSummaryStatistics::combine));
+
+ for (IntSummaryStatistics stats : instances) {
+ assertEquals(stats.getCount(), 1000);
+ assertEquals(stats.getSum(), countTo(1000).stream().mapToInt(i -> i).sum());
+ assertEquals(stats.getAverage(), (double) stats.getSum() / stats.getCount());
+ assertEquals(stats.getMax(), 1000);
+ assertEquals(stats.getMin(), 1);
+ }
+ }
+
+
+ public void testLongStatistics() {
+ List<LongSummaryStatistics> instances = new ArrayList<>();
+ instances.add(countTo(1000).stream().collect(Collectors.summarizingLong(i -> i)));
+ instances.add(countTo(1000).stream().mapToLong(i -> i).summaryStatistics());
+ instances.add(countTo(1000).stream().mapToLong(i -> i).collect(LongSummaryStatistics::new,
+ LongSummaryStatistics::accept,
+ LongSummaryStatistics::combine));
+ instances.add(countTo(1000).parallelStream().collect(Collectors.summarizingLong(i -> i)));
+ instances.add(countTo(1000).parallelStream().mapToLong(i -> i).summaryStatistics());
+ instances.add(countTo(1000).parallelStream().mapToLong(i -> i).collect(LongSummaryStatistics::new,
+ LongSummaryStatistics::accept,
+ LongSummaryStatistics::combine));
+
+ for (LongSummaryStatistics stats : instances) {
+ assertEquals(stats.getCount(), 1000);
+ assertEquals(stats.getSum(), (long) countTo(1000).stream().mapToInt(i -> i).sum());
+ assertEquals(stats.getAverage(), (double) stats.getSum() / stats.getCount());
+ assertEquals(stats.getMax(), 1000L);
+ assertEquals(stats.getMin(), 1L);
+ }
+ }
+
+ public void testDoubleStatistics() {
+ List<DoubleSummaryStatistics> instances = new ArrayList<>();
+ instances.add(countTo(1000).stream().collect(Collectors.summarizingDouble(i -> i)));
+ instances.add(countTo(1000).stream().mapToDouble(i -> i).summaryStatistics());
+ instances.add(countTo(1000).stream().mapToDouble(i -> i).collect(DoubleSummaryStatistics::new,
+ DoubleSummaryStatistics::accept,
+ DoubleSummaryStatistics::combine));
+ instances.add(countTo(1000).parallelStream().collect(Collectors.summarizingDouble(i -> i)));
+ instances.add(countTo(1000).parallelStream().mapToDouble(i -> i).summaryStatistics());
+ instances.add(countTo(1000).parallelStream().mapToDouble(i -> i).collect(DoubleSummaryStatistics::new,
+ DoubleSummaryStatistics::accept,
+ DoubleSummaryStatistics::combine));
+
+ for (DoubleSummaryStatistics stats : instances) {
+ assertEquals(stats.getCount(), 1000);
+ assertEquals(stats.getSum(), (double) countTo(1000).stream().mapToInt(i -> i).sum());
+ assertEquals(stats.getAverage(), stats.getSum() / stats.getCount());
+ assertEquals(stats.getMax(), 1000.0);
+ assertEquals(stats.getMin(), 1.0);
+ }
+ }
+}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ExplodeOpTest.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.tests.java.util.stream;
-
-import org.testng.annotations.Test;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.function.Function;
-import java.util.stream.*;
-
-import static java.util.stream.LambdaTestHelpers.*;
-
-/**
- * ExplodeOpTest
- *
- * @author Brian Goetz
- */
-@Test
-public class ExplodeOpTest extends OpTestCase {
-
- static final Function<Integer, Stream<Integer>> integerRangeMapper
- = e -> IntStream.range(0, e).boxed();
-
- public void testFlatMap() {
- String[] stringsArray = {"hello", "there", "", "yada"};
- Stream<String> strings = Arrays.asList(stringsArray).stream();
- assertConcat(strings.flatMap(flattenChars).iterator(), "hellothereyada");
-
- assertCountSum(countTo(10).stream().flatMap(mfId), 10, 55);
- assertCountSum(countTo(10).stream().flatMap(mfNull), 0, 0);
- assertCountSum(countTo(3).stream().flatMap(mfLt), 6, 4);
-
- exerciseOps(TestData.Factory.ofArray("stringsArray", stringsArray), s -> s.flatMap(flattenChars));
- exerciseOps(TestData.Factory.ofArray("LONG_STRING", new String[] {LONG_STRING}), s -> s.flatMap(flattenChars));
- }
-
- @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
- public void testOps(String name, TestData.OfRef<Integer> data) {
- Collection<Integer> result = exerciseOps(data, s -> s.flatMap(mfId));
- assertEquals(data.size(), result.size());
-
- result = exerciseOps(data, s -> s.flatMap(mfNull));
- assertEquals(0, result.size());
-
- result = exerciseOps(data, s-> s.flatMap(e -> Stream.empty()));
- assertEquals(0, result.size());
-
- exerciseOps(data, s -> s.flatMap(mfLt));
- exerciseOps(data, s -> s.flatMap(integerRangeMapper));
- exerciseOps(data, s -> s.flatMap((Integer e) -> IntStream.range(0, e).boxed().limit(10)));
- }
-
- //
-
- @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
- public void testIntOps(String name, TestData.OfInt data) {
- Collection<Integer> result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToInt(j -> j)));
- assertEquals(data.size(), result.size());
- assertContents(data, result);
-
- result = exerciseOps(data, s -> s.flatMap(i -> IntStream.empty()));
- assertEquals(0, result.size());
-
- exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e)));
- exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e).limit(10)));
- }
-
- //
-
- @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
- public void testLongOps(String name, TestData.OfLong data) {
- Collection<Long> result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToLong(j -> j)));
- assertEquals(data.size(), result.size());
- assertContents(data, result);
-
- result = exerciseOps(data, s -> LongStream.empty());
- assertEquals(0, result.size());
-
- exerciseOps(data, s -> s.flatMap(e -> LongStream.range(0, e)));
- exerciseOps(data, s -> s.flatMap(e -> LongStream.range(0, e).limit(10)));
- }
-
- //
-
- @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
- public void testDoubleOps(String name, TestData.OfDouble data) {
- Collection<Double> result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToDouble(j -> j)));
- assertEquals(data.size(), result.size());
- assertContents(data, result);
-
- result = exerciseOps(data, s -> DoubleStream.empty());
- assertEquals(0, result.size());
-
- exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, (int) e).asDoubleStream()));
- exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, (int) e).limit(10).asDoubleStream()));
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/FlatMapOpTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,129 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary flat-map operations
+ * @bug 8044047
+ */
+
+package org.openjdk.tests.java.util.stream;
+
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.function.Function;
+import java.util.stream.*;
+
+import static java.util.stream.LambdaTestHelpers.*;
+import static java.util.stream.ThowableHelper.checkNPE;
+
+@Test
+public class FlatMapOpTest extends OpTestCase {
+
+ public void testNullMapper() {
+ checkNPE(() -> Stream.of(1).flatMap(null));
+ checkNPE(() -> IntStream.of(1).flatMap(null));
+ checkNPE(() -> LongStream.of(1).flatMap(null));
+ checkNPE(() -> DoubleStream.of(1).flatMap(null));
+ }
+
+ static final Function<Integer, Stream<Integer>> integerRangeMapper
+ = e -> IntStream.range(0, e).boxed();
+
+ public void testFlatMap() {
+ String[] stringsArray = {"hello", "there", "", "yada"};
+ Stream<String> strings = Arrays.asList(stringsArray).stream();
+ assertConcat(strings.flatMap(flattenChars).iterator(), "hellothereyada");
+
+ assertCountSum(countTo(10).stream().flatMap(mfId), 10, 55);
+ assertCountSum(countTo(10).stream().flatMap(mfNull), 0, 0);
+ assertCountSum(countTo(3).stream().flatMap(mfLt), 6, 4);
+
+ exerciseOps(TestData.Factory.ofArray("stringsArray", stringsArray), s -> s.flatMap(flattenChars));
+ exerciseOps(TestData.Factory.ofArray("LONG_STRING", new String[] {LONG_STRING}), s -> s.flatMap(flattenChars));
+ }
+
+ @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+ public void testOps(String name, TestData.OfRef<Integer> data) {
+ Collection<Integer> result = exerciseOps(data, s -> s.flatMap(mfId));
+ assertEquals(data.size(), result.size());
+
+ result = exerciseOps(data, s -> s.flatMap(mfNull));
+ assertEquals(0, result.size());
+
+ result = exerciseOps(data, s-> s.flatMap(e -> Stream.empty()));
+ assertEquals(0, result.size());
+
+ exerciseOps(data, s -> s.flatMap(mfLt));
+ exerciseOps(data, s -> s.flatMap(integerRangeMapper));
+ exerciseOps(data, s -> s.flatMap((Integer e) -> IntStream.range(0, e).boxed().limit(10)));
+ }
+
+ //
+
+ @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
+ public void testIntOps(String name, TestData.OfInt data) {
+ Collection<Integer> result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToInt(j -> j)));
+ assertEquals(data.size(), result.size());
+ assertContents(data, result);
+
+ result = exerciseOps(data, s -> s.flatMap(i -> IntStream.empty()));
+ assertEquals(0, result.size());
+
+ exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e)));
+ exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e).limit(10)));
+ }
+
+ //
+
+ @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
+ public void testLongOps(String name, TestData.OfLong data) {
+ Collection<Long> result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToLong(j -> j)));
+ assertEquals(data.size(), result.size());
+ assertContents(data, result);
+
+ result = exerciseOps(data, s -> LongStream.empty());
+ assertEquals(0, result.size());
+
+ exerciseOps(data, s -> s.flatMap(e -> LongStream.range(0, e)));
+ exerciseOps(data, s -> s.flatMap(e -> LongStream.range(0, e).limit(10)));
+ }
+
+ //
+
+ @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
+ public void testDoubleOps(String name, TestData.OfDouble data) {
+ Collection<Double> result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToDouble(j -> j)));
+ assertEquals(data.size(), result.size());
+ assertContents(data, result);
+
+ result = exerciseOps(data, s -> DoubleStream.empty());
+ assertEquals(0, result.size());
+
+ exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, (int) e).asDoubleStream()));
+ exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, (int) e).limit(10).asDoubleStream()));
+ }
+}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamBuilderTest.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamBuilderTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -38,6 +38,7 @@
import java.util.stream.TestData;
import static java.util.stream.Collectors.toList;
+import static java.util.stream.ThowableHelper.checkISE;
@Test
public class StreamBuilderTest extends OpTestCase {
@@ -52,23 +53,6 @@
return sizes.stream().map(i -> new Object[] { i }).toArray(Object[][]::new);
}
- private void checkException(Class<? extends Exception> ce, Runnable r) {
- Exception caught = null;
- try {
- r.run();
- } catch (Exception e) {
- caught = e;
- }
-
- assertNotNull(caught);
- assertTrue(ce.isInstance(caught));
- }
-
- private void checkISE(Runnable r) {
- checkException(IllegalStateException.class, r);
- }
-
- //
@Test
public void testSingleton() {
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamCloseTest.java Thu Jul 24 09:15:38 2014 +0200
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamCloseTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 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
@@ -20,6 +20,13 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
+/*
+ * @test
+ * @summary close handlers and closing streams
+ * @bug 8044047
+ */
+
package org.openjdk.tests.java.util.stream;
import java.util.Arrays;
@@ -29,14 +36,14 @@
import org.testng.annotations.Test;
import static java.util.stream.LambdaTestHelpers.countTo;
+import static java.util.stream.ThowableHelper.checkNPE;
-/**
- * StreamCloseTest
- *
- * @author Brian Goetz
- */
@Test(groups = { "serialization-hostile" })
public class StreamCloseTest extends OpTestCase {
+ public void testNullCloseHandler() {
+ checkNPE(() -> Stream.of(1).onClose(null));
+ }
+
public void testEmptyCloseHandler() {
try (Stream<Integer> ints = countTo(100).stream()) {
ints.forEach(i -> {});
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SummaryStatisticsTest.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.tests.java.util.stream;
-
-import java.util.ArrayList;
-import java.util.DoubleSummaryStatistics;
-import java.util.IntSummaryStatistics;
-import java.util.List;
-import java.util.LongSummaryStatistics;
-import java.util.stream.Collectors;
-import java.util.stream.OpTestCase;
-
-import org.testng.annotations.Test;
-
-import static java.util.stream.LambdaTestHelpers.countTo;
-
-/**
- * TestSummaryStatistics
- *
- * @author Brian Goetz
- */
-@Test
-public class SummaryStatisticsTest extends OpTestCase {
- public void testIntStatistics() {
- List<IntSummaryStatistics> instances = new ArrayList<>();
- instances.add(countTo(1000).stream().collect(Collectors.summarizingInt(i -> i)));
- instances.add(countTo(1000).stream().mapToInt(i -> i).summaryStatistics());
- instances.add(countTo(1000).parallelStream().collect(Collectors.summarizingInt(i -> i)));
- instances.add(countTo(1000).parallelStream().mapToInt(i -> i).summaryStatistics());
-
- for (IntSummaryStatistics stats : instances) {
- assertEquals(stats.getCount(), 1000);
- assertEquals(stats.getSum(), countTo(1000).stream().mapToInt(i -> i).sum());
- assertEquals(stats.getMax(), 1000);
- assertEquals(stats.getMin(), 1);
- }
- }
-
- public void testLongStatistics() {
- List<LongSummaryStatistics> instances = new ArrayList<>();
- instances.add(countTo(1000).stream().collect(Collectors.summarizingLong(i -> i)));
- instances.add(countTo(1000).stream().mapToLong(i -> i).summaryStatistics());
- instances.add(countTo(1000).parallelStream().collect(Collectors.summarizingLong(i -> i)));
- instances.add(countTo(1000).parallelStream().mapToLong(i -> i).summaryStatistics());
-
- for (LongSummaryStatistics stats : instances) {
- assertEquals(stats.getCount(), 1000);
- assertEquals(stats.getSum(), (long) countTo(1000).stream().mapToInt(i -> i).sum());
- assertEquals(stats.getMax(), 1000L);
- assertEquals(stats.getMin(), 1L);
- }
- }
-
- public void testDoubleStatistics() {
- List<DoubleSummaryStatistics> instances = new ArrayList<>();
- instances.add(countTo(1000).stream().collect(Collectors.summarizingDouble(i -> i)));
- instances.add(countTo(1000).stream().mapToDouble(i -> i).summaryStatistics());
- instances.add(countTo(1000).parallelStream().collect(Collectors.summarizingDouble(i -> i)));
- instances.add(countTo(1000).parallelStream().mapToDouble(i -> i).summaryStatistics());
-
- for (DoubleSummaryStatistics stats : instances) {
- assertEquals(stats.getCount(), 1000);
- assertEquals(stats.getSum(), (double) countTo(1000).stream().mapToInt(i -> i).sum());
- assertEquals(stats.getMax(), 1000.0);
- assertEquals(stats.getMin(), 1.0);
- }
- }
-}
--- a/jdk/test/javax/management/remote/mandatory/util/CacheMapTest.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 7654321
- * @summary Tests the CacheMap class.
- * @author Eamonn McManus
- * @run clean CacheMapTest
- * @run build CacheMapTest
- * @run main CacheMapTest
- */
-
-import java.util.Iterator;
-import java.util.Map;
-
-import com.sun.jmx.remote.util.CacheMap;
-
-public class CacheMapTest {
- public static void main(String[] args) {
- try {
- boolean ok = test(5) && test(100);
- if (ok) {
- System.out.println("Test completed");
- return;
- } else {
- System.out.println("Test failed!");
- System.exit(1);
- }
- } catch (Exception e) {
- System.err.println("Unexpected exception: " + e);
- e.printStackTrace();
- System.exit(1);
- }
- }
-
- private static boolean test(int cacheSize) throws Exception {
- System.out.println("CacheMap test with cache size " + cacheSize);
- CacheMap map = new CacheMap(cacheSize);
- int size = 0;
- int maxIterations = cacheSize * 10;
- while (map.size() == size && size < maxIterations) {
- Integer key = new Integer(size);
- Object x = map.put(key, "x");
- if (x != null) {
- System.out.println("Map already had entry " + key + "!");
- return false;
- }
- x = map.get(key);
- if (!"x".equals(x)) {
- System.out.println("Got back surprising value: " + x);
- return false;
- }
- size++;
- }
- System.out.println("Map size is " + map.size() + " after inserting " +
- size + " elements");
- do {
- System.gc();
- Thread.sleep(1);
- System.out.println("Map size is " + map.size() + " after GC");
- } while (map.size() > cacheSize);
- if (map.size() < cacheSize) {
- System.out.println("Map shrank to less than cache size: " +
- map.size() + " (surprising but not wrong)");
- } else
- System.out.println("Map shrank to cache size as expected");
- int lowest = size - cacheSize;
- // lowest value that can still be in cache if LRU is respected
- for (Iterator it = map.entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Map.Entry) it.next();
- Integer x = (Integer) entry.getKey();
- int xx = x.intValue();
- if (xx < lowest || xx >= size) {
- System.out.println("Old value remained (" + x + "), " +
- "expected none earlier than " + lowest);
- return false;
- }
- Object xxx = entry.getValue();
- if (!"x".equals(xxx)) {
- System.out.println("Got back surprising value: " + xxx);
- return false;
- }
- }
- if (map.size() > 0)
- System.out.println("Remaining elements are the most recent ones");
- System.out.println("Test passed");
- return true;
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/8046391/bug8046391.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8046391
+ * @summary JFileChooser hangs if displayed in Windows L&F
+ * @author Alexey Ivanov
+ * @run main/othervm/timeout=10 bug8046391
+*/
+
+import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
+import sun.awt.OSInfo;
+import sun.awt.OSInfo.OSType;
+
+import javax.swing.JFileChooser;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+public class bug8046391 {
+
+ public static void main(String[] args) throws Exception {
+ OSType type = OSInfo.getOSType();
+ if (type != OSType.WINDOWS) {
+ System.out.println("This test is for Windows only... skipping!");
+ return;
+ }
+
+ SwingUtilities.invokeAndWait(() -> {
+ try {
+ UIManager.setLookAndFeel(new WindowsLookAndFeel());
+ } catch (UnsupportedLookAndFeelException e) {
+ e.printStackTrace();
+ }
+ System.out.println("Creating JFileChooser...");
+ JFileChooser fileChooser = new JFileChooser();
+ System.out.println("Test passed: chooser = " + fileChooser);
+ });
+ // Test fails if creating JFileChooser hangs
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JScrollPane/bug8044371.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8044371
+ * @summary setOneTouchExpandable functionality of JSplitPane will reduce vertical Scrollbar
+ * @author Anton Nashatyrev
+ * @library ..
+ */
+
+
+import javax.swing.*;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import java.awt.*;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+
+public class bug8044371 implements AdjustmentListener {
+ JSplitPane sptPane;
+ int lastAdjust = 0;
+ int initialAdjust = 0;
+
+ public static void main(String[] args) throws Throwable {
+ UIManager.setLookAndFeel(MetalLookAndFeel.class.getName());
+ SwingTest.start(bug8044371.class);
+ }
+
+ public bug8044371(JFrame frame) {
+ JPanel p = new JPanel();
+ final JScrollPane jScrollPane = new JScrollPane(new JPanel()
+ {{setPreferredSize(new Dimension(1500,1500));}},
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ jScrollPane.getViewport().scrollRectToVisible(new Rectangle(1500, 1500, 0, 0));
+ jScrollPane.getVerticalScrollBar().addAdjustmentListener(this);
+
+ sptPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jScrollPane, p);
+ sptPane.setDividerLocation(90);
+ sptPane.setOneTouchExpandable(true);
+ frame.getContentPane().add(sptPane);
+ }
+
+ public void adjustmentValueChanged(AdjustmentEvent e) {
+ System.out.println( "adjustmentValueChanged: " + e.getValue());
+ lastAdjust = e.getValue();
+ }
+
+ public void step1() {
+ if (lastAdjust == 0) {
+ throw new RuntimeException("Adjustment == 0");
+ }
+ initialAdjust = lastAdjust;
+ sptPane.setDividerLocation(0);
+ }
+
+ public void step2() {
+ if (lastAdjust < initialAdjust) {
+ throw new RuntimeException("Failed: Adjustment decreased: " + lastAdjust);
+ }
+ sptPane.setDividerLocation(90);
+ }
+ public void step3() {
+ if (lastAdjust < initialAdjust) {
+ throw new RuntimeException("Failed: Adjustment decreased: " + lastAdjust);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/PopupFactory/8048506/bug8048506.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8048506
+ * @summary Tests that popup with null-owner does not throw NPE
+ * @author Dmitry Markov
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+
+public class bug8048506 {
+
+ public static void main(String[] args) throws Exception {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+ System.out.println("The test passed");
+ }
+
+ private static void createAndShowGUI() {
+ JFrame frame = new JFrame("bug8048506");
+ frame.setSize(400, 400);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setVisible(true);
+
+ PopupFactory factory = PopupFactory.getSharedInstance();
+
+ // Create and show popup with owner
+ Popup popup1 = factory.getPopup(frame, new JLabel("Popup with owner"), 100, 100);
+ popup1.show();
+
+ //Create and show popup without owner
+ Popup popup2 = factory.getPopup(null, new JLabel("Popup without owner"), 200, 200);
+ popup2.show();
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/validation/8049514/FeaturePropagationTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/**
+ * @test
+ * @bug 8049514
+ * @summary verifies that feature set on the factory is propagated properly
+ * to the validator
+ * @run main/othervm FeaturePropagationTest
+ */
+
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStreamReader;
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.*;
+
+/**
+ * JDK-8049514
+ *
+ * FEATURE_SECURE_PROCESSING can not be turned off on a validator through
+ * SchemaFactory
+ */
+public class FeaturePropagationTest {
+
+ static String xsd = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n"
+ + " xmlns:test='jaxp13_test'\n"
+ + " targetNamespace='jaxp13_test'\n"
+ + " elementFormDefault='qualified'>\n"
+ + " <element name='test' type='string'/>\n"
+ + "</schema>\n";
+
+ public static void main(String[] args) throws Exception {
+ InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(xsd.getBytes()));
+ StreamSource xsdSource = new StreamSource(reader);
+
+ SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+ Schema schema = null;
+ schema = schemaFactory.newSchema(xsdSource);
+
+ Validator validator = schema.newValidator();
+
+ if (validator.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+ throw new RuntimeException("Feature set on the factory is not inherited!");
+ }
+
+ }
+}
--- a/langtools/.hgtags Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/.hgtags Fri Jul 25 09:44:53 2014 +0000
@@ -265,3 +265,4 @@
31acbc476a5251824f919df0b82bca9cbb19cf7c jdk9-b20
fa0d1059a26f82f95620b7dc8bbfbe302bce8883 jdk9-b21
aca19c52b24627a6b085cfeb433051a3e420cd81 jdk9-b22
+0402a91cd14b530b6e98452341ff853717948239 jdk9-b23
--- a/langtools/make/build.xml Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/make/build.xml Fri Jul 25 09:44:53 2014 +0000
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 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
@@ -457,6 +457,46 @@
</javac>
</target>
+ <!-- Generate API docs for "important" test classes that are used by
+ multiple tests.
+ -->
+ <target name="test-framework-docs" depends="build-all-classes">
+ <javadoc executable="${target.java.home}/bin/javadoc"
+ destdir="${build.dir}/testframeworkdocs">
+ <!-- disable doclint for now; it might be good to enable -Xdoclint:missing -->
+ <arg value="-Xdoclint:none"/>
+ <!-- source files to be documented -->
+ <sourcefiles>
+ <fileset dir="${test.dir}">
+ <include name="**/ToolBox.java"/>
+ <include name="**/*Tester.java"/>
+ <include name="**/*TestBase.java"/>
+ <include name="**/*Testing*.java"/>
+ </fileset>
+ </sourcefiles>
+ <!-- source path used for documentation -->
+ <sourcepath>
+ <pathelement path="${test.dir}/lib"/>
+ <pathelement path="${test.dir}/lib/combo"/>
+ <pathelement path="${test.dir}/tools/javac/lib"/>
+ <pathelement path="${test.dir}/tools/javac/classfiles/attributes/LocalVariableTable"/>
+ </sourcepath>
+ <!-- exclude the following "packages" found by <javadoc>
+ on the sourcepath -->
+ <excludepackage name="combo.tools.javac.combo"/>
+ <excludepackage name="tools.javac.combo"/>
+ <!-- library classes used for documentation -->
+ <classpath>
+ <pathelement path="${jtreg.home}/lib/testng.jar"/>
+ </classpath>
+ <!-- platform classes used for documentation -->
+ <bootclasspath>
+ <pathelement path="${build.dir}/classes"/>
+ <pathelement path="${target.java.home}/jre/lib/rt.jar"/>
+ </bootclasspath>
+ </javadoc>
+ </target>
+
<!--
**** Debugging/diagnostic targets.
-->
@@ -761,7 +801,7 @@
<copy todir=".idea" >
<fileset dir="make/intellij" includes="**"/>
</copy>
- <replace file=".idea/ant.xml" token="@@@" value="${jtreg.home}"/>
+ <replace file=".idea/ant.xml" token="@@@" value="${jtreg.home}"/>
</target>
<!--
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Jul 25 09:44:53 2014 +0000
@@ -1072,7 +1072,7 @@
boolean testFirst) {
Env<GenContext> loopEnv = env.dup(loop, new GenContext());
int startpc = code.entryPoint();
- if (testFirst) {
+ if (testFirst) { //while or for loop
CondItem c;
if (cond != null) {
code.statBegin(cond.pos);
@@ -1118,6 +1118,9 @@
code.resolve(c.falseJumps);
}
code.resolve(loopEnv.info.exit);
+ if (loopEnv.info.exit != null) {
+ loopEnv.info.exit.state.defined.excludeFrom(code.nextreg);
+ }
}
private enum LoopLocalVarRangeEndingPoint {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java Fri Jul 25 09:44:53 2014 +0000
@@ -213,7 +213,7 @@
reader.putChar(true);
}
skipIllegalUnderscores();
- if ('0' <= reader.ch && reader.ch <= '9') {
+ if (reader.digit(pos, 10) >= 0) {
scanDigits(pos, 10);
if (!hexFloatsWork)
lexError(pos, "unsupported.cross.fp.lit");
@@ -239,7 +239,7 @@
*/
private void scanFraction(int pos) {
skipIllegalUnderscores();
- if ('0' <= reader.ch && reader.ch <= '9') {
+ if (reader.digit(pos, 10) >= 0) {
scanDigits(pos, 10);
}
int sp1 = reader.sp;
@@ -250,7 +250,7 @@
reader.putChar(true);
}
skipIllegalUnderscores();
- if ('0' <= reader.ch && reader.ch <= '9') {
+ if (reader.digit(pos, 10) >= 0) {
scanDigits(pos, 10);
return;
}
@@ -384,11 +384,11 @@
reader.scanChar();
continue;
} else {
- high = reader.scanSurrogates();
- if (high != 0) {
- reader.putChar(high);
- isJavaIdentifierPart = Character.isJavaIdentifierPart(
- Character.toCodePoint(high, reader.ch));
+ int codePoint = reader.peekSurrogates();
+ if (codePoint >= 0) {
+ if (isJavaIdentifierPart = Character.isJavaIdentifierPart(codePoint)) {
+ reader.putChar(true);
+ }
} else {
isJavaIdentifierPart = Character.isJavaIdentifierPart(reader.ch);
}
@@ -530,7 +530,7 @@
break loop;
case '.':
reader.scanChar();
- if ('0' <= reader.ch && reader.ch <= '9') {
+ if (reader.digit(pos, 10) >= 0) {
reader.putChar('.');
scanFractionAndSuffix(pos);
} else if (reader.ch == '.') {
@@ -613,11 +613,11 @@
reader.scanChar();
if (reader.ch == '\'') {
lexError(pos, "empty.char.lit");
+ reader.scanChar();
} else {
if (reader.ch == CR || reader.ch == LF)
lexError(pos, "illegal.line.end.in.char.lit");
scanLitChar(pos);
- char ch2 = reader.ch;
if (reader.ch == '\'') {
reader.scanChar();
tk = TokenKind.CHARLITERAL;
@@ -642,29 +642,39 @@
scanOperator();
} else {
boolean isJavaIdentifierStart;
+ int codePoint = -1;
if (reader.ch < '\u0080') {
// all ASCII range chars already handled, above
isJavaIdentifierStart = false;
} else {
- char high = reader.scanSurrogates();
- if (high != 0) {
- reader.putChar(high);
-
- isJavaIdentifierStart = Character.isJavaIdentifierStart(
- Character.toCodePoint(high, reader.ch));
+ codePoint = reader.peekSurrogates();
+ if (codePoint >= 0) {
+ if (isJavaIdentifierStart = Character.isJavaIdentifierStart(codePoint)) {
+ reader.putChar(true);
+ }
} else {
isJavaIdentifierStart = Character.isJavaIdentifierStart(reader.ch);
}
}
if (isJavaIdentifierStart) {
scanIdent();
+ } else if (reader.digit(pos, 10) >= 0) {
+ scanNumber(pos, 10);
} else if (reader.bp == reader.buflen || reader.ch == EOI && reader.bp + 1 == reader.buflen) { // JLS 3.5
tk = TokenKind.EOF;
pos = reader.buflen;
} else {
- String arg = (32 < reader.ch && reader.ch < 127) ?
- String.format("%s", reader.ch) :
- String.format("\\u%04x", (int)reader.ch);
+ String arg;
+
+ if (codePoint >= 0) {
+ char high = reader.ch;
+ reader.scanChar();
+ arg = String.format("\\u%04x\\u%04x", (int) high, (int)reader.ch);
+ } else {
+ arg = (32 < reader.ch && reader.ch < 127) ?
+ String.format("%s", reader.ch) :
+ String.format("\\u%04x", (int)reader.ch);
+ }
lexError(pos, "illegal.char", arg);
reader.scanChar();
}
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/UnicodeReader.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/UnicodeReader.java Fri Jul 25 09:44:53 2014 +0000
@@ -197,24 +197,28 @@
}
/** Scan surrogate pairs. If 'ch' is a high surrogate and
- * the next character is a low surrogate, then put the low
- * surrogate in 'ch', and return the high surrogate.
- * otherwise, just return 0.
+ * the next character is a low surrogate, returns the code point
+ * constructed from these surrogates. Otherwise, returns -1.
+ * This method will not consume any of the characters.
*/
- protected char scanSurrogates() {
+ protected int peekSurrogates() {
if (surrogatesSupported && Character.isHighSurrogate(ch)) {
char high = ch;
+ int prevBP = bp;
scanChar();
- if (Character.isLowSurrogate(ch)) {
- return high;
- }
+ char low = ch;
ch = high;
+ bp = prevBP;
+
+ if (Character.isLowSurrogate(low)) {
+ return Character.toCodePoint(high, low);
+ }
}
- return 0;
+ return -1;
}
/** Convert an ASCII digit from its base (8, 10, or 16)
@@ -222,9 +226,14 @@
*/
protected int digit(int pos, int base) {
char c = ch;
- int result = Character.digit(c, base);
+ if ('0' <= c && c <= '9')
+ return Character.digit(c, base); //a fast common case
+ int codePoint = peekSurrogates();
+ int result = codePoint >= 0 ? Character.digit(codePoint, base) : Character.digit(c, base);
if (result >= 0 && c > 0x7f) {
log.error(pos + 1, "illegal.nonascii.digit");
+ if (codePoint >= 0)
+ scanChar();
ch = "0123456789abcdef".charAt(result);
}
return result;
--- a/langtools/src/share/classes/com/sun/tools/sjavac/comp/JavacServiceImpl.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/comp/JavacServiceImpl.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 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
+ * 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 com.sun.tools.sjavac.comp;
import java.io.File;
--- a/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilationResult.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilationResult.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 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
+ * 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 com.sun.tools.sjavac.server;
import java.net.URI;
--- a/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacService.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacService.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 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
+ * 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 com.sun.tools.sjavac.server;
import java.io.File;
--- a/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServiceClient.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServiceClient.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 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
+ * 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 com.sun.tools.sjavac.server;
import java.io.BufferedReader;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8050386/WrongStackframeGenerationTest1.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8050386
+ * @summary Verification error due to a bad stackmap frame generated by javac
+ */
+
+public class WrongStackframeGenerationTest1 {
+ public static void main(String[] args) {}
+
+ static void foo(){
+ while (true) {
+ int i = 0;
+ break;
+ }
+ switch (1) {
+ case 1:
+ int j = 0;
+ case 2:
+ bar();
+ }
+ }
+
+ static void bar() {}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8050386/WrongStackframeGenerationTest2.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8050386
+ * @summary Verification error due to a bad stackmap frame generated by javac
+ */
+
+public class WrongStackframeGenerationTest2 {
+ public static void main(String[] args) {}
+
+ static void foo() {
+ int len;
+ for (;;) {
+ try {
+ len = 1;
+ break;
+ } catch (Exception e) {
+ }
+ }
+
+ try {
+ if (len == -1) {
+ len = 0;
+ }
+ } finally {
+ }
+ }
+}
--- a/langtools/test/tools/javac/diags/examples/EmptyCharLiteral.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/javac/diags/examples/EmptyCharLiteral.java Fri Jul 25 09:44:53 2014 +0000
@@ -22,7 +22,6 @@
*/
// key: compiler.err.empty.char.lit
-// key: compiler.err.unclosed.char.lit
class X {
char c = '';
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/expression/_super/NonDirectSuper/Base.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package base;
+
+public class Base extends PackagePrivate { }
+
+class PackagePrivate {
+ protected int refTobaseBase() {
+ return 0;
+ }
+ protected int refTotestOtherPackageTest() {
+ return 0;
+ }
+ protected int refTotestTarget11() {
+ return 0;
+ }
+ protected int refTotestCurPackagePrivateExt11() {
+ return 0;
+ }
+ protected int refTobaseBase;
+ protected int refTotestOtherPackageTest;
+ protected int refTotestTarget11;
+ protected int refTotestCurPackagePrivateExt11;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2013, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8027789
+ * @summary check that the direct superclass is used as the site when calling
+ * a superclass' method
+ * @compile Base.java NonDirectSuper.java
+ * @run main test.NonDirectSuper
+ */
+
+package test;
+
+import java.io.File;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool.CPRefInfo;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.classfile.Opcode;
+
+public class NonDirectSuper {
+ public static void main(String... args) {
+ new NonDirectSuper().run();
+ }
+
+ void run() {
+ String workDir = System.getProperty("test.classes");
+ File testPackage = new File(workDir, "test");
+
+ for (File clazz : testPackage.listFiles()) {
+ if ("NonDirectSuper.class".equals(clazz.getName())) continue;
+ verifyInvokeSpecialRefToObject(clazz);
+ }
+ }
+
+ void verifyInvokeSpecialRefToObject(File clazz) {
+ try {
+ final ClassFile cf = ClassFile.read(clazz);
+ for (Method m : cf.methods) {
+ Code_attribute codeAttr = (Code_attribute)m.attributes.get(Attribute.Code);
+ for (Instruction instr : codeAttr.getInstructions()) {
+ if (instr.getOpcode() == Opcode.INVOKESPECIAL ||
+ instr.getOpcode() == Opcode.INVOKEVIRTUAL) {
+ int pc_index = instr.getShort(1);
+ CPRefInfo ref = (CPRefInfo)cf.constant_pool.get(pc_index);
+ String className = ref.getClassName();
+ String methodName = ref.getNameAndTypeInfo().getName();
+ if (methodName.equals("toString")) {
+ if (!className.equals("java/lang/Object"))
+ throw new IllegalStateException("Must directly refer to j.l.Object");
+ } else if (methodName.startsWith("refTo")) {
+ String expectedClass = methodName.substring("refTo".length());
+ if (!className.replace("/", "").equals(expectedClass)) {
+ throw new IllegalStateException("Unexpected reference to: " +
+ className + ", should be " + expectedClass);
+ }
+ }
+ }
+ if (instr.getOpcode() == Opcode.GETFIELD ||
+ instr.getOpcode() == Opcode.PUTFIELD) {
+ int pc_index = instr.getShort(1);
+ CPRefInfo ref = (CPRefInfo)cf.constant_pool.get(pc_index);
+ String className = ref.getClassName();
+ String fieldName = ref.getNameAndTypeInfo().getName();
+ if (fieldName.startsWith("refTo")) {
+ String expectedClass = fieldName.substring("refTo".length());
+ if (!className.replace("/", "").equals(expectedClass)) {
+ throw new IllegalStateException("Unexpected reference to: " +
+ className + ", should be " + expectedClass);
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new Error("error reading " + clazz +": " + e);
+ }
+ }
+}
+
+class OtherPackageTest extends base.Base {
+ void run() {
+ new Runnable() {
+ public void run() {
+ OtherPackageTest.super.refTobaseBase();
+ OtherPackageTest.super.refTobaseBase = OtherPackageTest.super.refTobaseBase + 1;
+ OtherPackageTest.super.toString();
+ refTotestOtherPackageTest();
+ refTotestOtherPackageTest = refTotestOtherPackageTest + 1;
+ OtherPackageTest.this.refTotestOtherPackageTest();
+ OtherPackageTest.this.refTotestOtherPackageTest =
+ OtherPackageTest.this.refTotestOtherPackageTest + 1;
+ }
+ }.run();
+ super.refTobaseBase();
+ super.refTobaseBase = super.refTobaseBase + 1;
+ super.toString();
+ OtherPackageTest.super.refTobaseBase();
+ OtherPackageTest.super.refTobaseBase = OtherPackageTest.super.refTobaseBase + 1;
+ OtherPackageTest.super.toString();
+ refTotestOtherPackageTest();
+ refTotestOtherPackageTest = refTotestOtherPackageTest + 1;
+ }
+
+ static class InnerBase {
+ private void refTotestOtherPackageTest$InnerBase() { }
+ }
+ static class InnerTest extends InnerBase {
+ void run() {
+ new Runnable() {
+ public void run() {
+ InnerTest.super.refTotestOtherPackageTest$InnerBase();
+ }
+ }.run();
+ super.refTotestOtherPackageTest$InnerBase();
+ InnerTest.super.refTotestOtherPackageTest$InnerBase();
+ }
+ }
+}
+
+class CurPackagePrivateBase {
+ void refTotestCurPackagePrivateExt() { }
+ void refTotestCurPackagePrivateTest() { }
+ int refTotestCurPackagePrivateExt;
+ int refTotestCurPackagePrivateTest;
+}
+
+class CurPackagePrivateExt extends CurPackagePrivateBase {
+}
+
+class CurPackagePrivateTest extends CurPackagePrivateExt {
+ void run() {
+ new Runnable() {
+ public void run() {
+ CurPackagePrivateTest.super.refTotestCurPackagePrivateExt();
+ CurPackagePrivateTest.super.refTotestCurPackagePrivateExt =
+ CurPackagePrivateTest.super.refTotestCurPackagePrivateExt + 1;
+ CurPackagePrivateTest.this.refTotestCurPackagePrivateTest();
+ CurPackagePrivateTest.this.refTotestCurPackagePrivateTest =
+ CurPackagePrivateTest.this.refTotestCurPackagePrivateTest + 1;
+ refTotestCurPackagePrivateTest();
+ refTotestCurPackagePrivateTest = refTotestCurPackagePrivateTest + 1;
+ }
+ }.run();
+ super.refTotestCurPackagePrivateExt();
+ super.refTotestCurPackagePrivateExt = super.refTotestCurPackagePrivateExt + 1;
+ CurPackagePrivateTest.super.refTotestCurPackagePrivateExt();
+ CurPackagePrivateTest.super.refTotestCurPackagePrivateExt =
+ CurPackagePrivateTest.super.refTotestCurPackagePrivateExt + 1;
+ refTotestCurPackagePrivateTest();
+ refTotestCurPackagePrivateTest = refTotestCurPackagePrivateTest + 1;
+ }
+}
--- a/langtools/test/tools/javac/unicode/NonasciiDigit.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/javac/unicode/NonasciiDigit.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 4707960 6183529
+ * @bug 4707960 6183529 8046620
* @summary javac accepts unicode digits - sometimes crashing
* @author gafter
*
@@ -8,7 +8,16 @@
*/
public class NonasciiDigit {
public static void main(String[] args) {
+ // error: only ASCII allowed in constants
+ int i1 = \uff11;
+ int i2 = 1\uff11;
+ int i3 = \ud835\udfff;
// error: floating literals use ascii only
- float f = 0.\uff11;
+ double d1 = \uff11.0;
+ double d2 = 0.\uff11;
+ double d3 = 0x0P\uff11;
+ double d4 = 0E\uff11;
+ double d5 = .\uff11;
+ double d6 = \ud835\udfff.0;
}
}
--- a/langtools/test/tools/javac/unicode/NonasciiDigit.out Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/javac/unicode/NonasciiDigit.out Fri Jul 25 09:44:53 2014 +0000
@@ -1,2 +1,10 @@
-NonasciiDigit.java:12:26: compiler.err.illegal.char: \uff11
-1 error
+NonasciiDigit.java:12:24: compiler.err.illegal.nonascii.digit
+NonasciiDigit.java:13:19: compiler.err.illegal.nonascii.digit
+NonasciiDigit.java:14:24: compiler.err.illegal.nonascii.digit
+NonasciiDigit.java:16:27: compiler.err.illegal.nonascii.digit
+NonasciiDigit.java:17:22: compiler.err.illegal.nonascii.digit
+NonasciiDigit.java:18:22: compiler.err.illegal.nonascii.digit
+NonasciiDigit.java:19:22: compiler.err.illegal.nonascii.digit
+NonasciiDigit.java:20:22: compiler.err.illegal.nonascii.digit
+NonasciiDigit.java:21:27: compiler.err.illegal.nonascii.digit
+9 errors
--- a/langtools/test/tools/javac/unicode/NonasciiDigit2.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 4707960 6183529
- * @summary javac accepts unicode digits - sometimes crashing
- * @author gafter
- *
- * @compile/fail/ref=NonasciiDigit2.out -XDrawDiagnostics NonasciiDigit2.java
- */
-public class NonasciiDigit2 {
- public static void main(String[] args) {
- // error: only ASCII allowed in constants
- int i = 1\uff11;
- }
-}
--- a/langtools/test/tools/javac/unicode/NonasciiDigit2.out Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-NonasciiDigit2.java:12:18: compiler.err.illegal.nonascii.digit
-1 error
--- a/langtools/test/tools/javac/unicode/SupplementaryJavaID2.out Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID2.out Fri Jul 25 09:44:53 2014 +0000
@@ -1,3 +1,4 @@
SupplementaryJavaID2.java:12:14: compiler.err.illegal.char: \ud801
+SupplementaryJavaID2.java:12:20: compiler.err.illegal.char: \ud801
SupplementaryJavaID2.java:12:24: compiler.err.expected: token.identifier
-2 errors
+3 errors
--- a/langtools/test/tools/javac/unicode/SupplementaryJavaID3.out Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID3.out Fri Jul 25 09:44:53 2014 +0000
@@ -1,2 +1,3 @@
+SupplementaryJavaID3.java:12:17: compiler.err.illegal.char: \ud801
SupplementaryJavaID3.java:12:23: compiler.err.illegal.char: \ud801
-1 error
+2 errors
--- a/langtools/test/tools/javac/unicode/SupplementaryJavaID4.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID4.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,35 +1,12 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4914724
+ * @test /nodynamiccopyright/
+ * @bug 4914724 8048803
* @summary Ensure that a supplementary character that cannot be the start of a Java
* identifier causes a compilation failure, if it is used as the start of an
* identifier
* @author Naoto Sato
*
- * @compile/fail SupplementaryJavaID4.java
+ * @compile/fail/ref=SupplementaryJavaID4.out -XDrawDiagnostics SupplementaryJavaID4.java
*/
public class SupplementaryJavaID4 {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID4.out Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,2 @@
+SupplementaryJavaID4.java:14:14: compiler.err.illegal.char: \ud834\udd7b
+1 error
--- a/langtools/test/tools/javac/unicode/SupplementaryJavaID5.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID5.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,35 +1,12 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4914724
+ * @test /nodynamiccopyright/
+ * @bug 4914724 8048803
* @summary Ensure that a supplementary character that cannot be the part of a Java
* identifier causes a compilation failure, if it is used as the part of an
* identifier
* @author Naoto Sato
*
- * @compile/fail SupplementaryJavaID5.java
+ * @compile/fail/ref=SupplementaryJavaID5.out -XDrawDiagnostics SupplementaryJavaID5.java
*/
public class SupplementaryJavaID5 {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID5.out Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,2 @@
+SupplementaryJavaID5.java:14:17: compiler.err.illegal.char: \ud834\udd00
+1 error
--- a/langtools/test/tools/javac/unicode/TripleQuote.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/javac/unicode/TripleQuote.java Fri Jul 25 09:44:53 2014 +0000
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 1265387
+ * @bug 1265387 8048805
* @summary ''' and '\u0027' are not legal char literals.
* @author turnidge
*
--- a/langtools/test/tools/javac/unicode/TripleQuote.out Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/javac/unicode/TripleQuote.out Fri Jul 25 09:44:53 2014 +0000
@@ -1,7 +1,5 @@
TripleQuote.java:12:14: compiler.err.empty.char.lit
-TripleQuote.java:12:20: compiler.err.empty.char.lit
TripleQuote.java:12:21: compiler.err.unclosed.char.lit
TripleQuote.java:13:14: compiler.err.empty.char.lit
-TripleQuote.java:13:15: compiler.err.empty.char.lit
TripleQuote.java:13:16: compiler.err.unclosed.char.lit
-6 errors
+4 errors
--- a/langtools/test/tools/sjavac/ExclPattern.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/sjavac/ExclPattern.java Fri Jul 25 09:44:53 2014 +0000
@@ -23,6 +23,16 @@
* questions.
*/
+
+/*
+ * @test
+ * @bug 8037085
+ * @summary Ensures that sjavac can handle various exclusion patterns.
+ *
+ * @build Wrapper
+ * @run main Wrapper ExclPattern
+ */
+
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.Charset;
--- a/langtools/test/tools/sjavac/ExclPatternWrapper.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8037085
- * @summary Ensures that sjavac can handle various exclusion patterns.
- * @run main ExclPatternWrapper
- */
-public class ExclPatternWrapper {
- public static void main(String... args) throws Exception {
- SJavacTestUtil.runSjavacTest("ExclPattern", args);
- }
-}
--- a/langtools/test/tools/sjavac/IgnoreSymbolFile.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/sjavac/IgnoreSymbolFile.java Fri Jul 25 09:44:53 2014 +0000
@@ -27,6 +27,9 @@
* @test
* @bug 8047183
* @summary JDK build fails with sjavac enabled
+ *
+ * @build Wrapper
+ * @run main Wrapper IgnoreSymbolFile
*/
import java.io.File;
@@ -38,12 +41,8 @@
public class IgnoreSymbolFile {
public static void main(String... args) throws Exception {
- if (sjavacAvailable()) {
- IgnoreSymbolFile test = new IgnoreSymbolFile();
- test.run();
- } else {
- System.err.println("sjavac not available; test skipped");
- }
+ IgnoreSymbolFile test = new IgnoreSymbolFile();
+ test.run();
}
void run() throws Exception {
@@ -96,13 +95,4 @@
}
int errors;
-
- static boolean sjavacAvailable() {
- try {
- Class.forName("com.sun.tools.sjavac.Main");
- return true;
- } catch (ClassNotFoundException e) {
- return false;
- }
- }
}
--- a/langtools/test/tools/sjavac/JavacOptionPrep.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/sjavac/JavacOptionPrep.java Fri Jul 25 09:44:53 2014 +0000
@@ -23,6 +23,15 @@
* questions.
*/
+/*
+ * @test
+ * @bug 8035063
+ * @summary Tests the preparation of javac-arguments.
+ *
+ * @build Wrapper
+ * @run main Wrapper JavacOptionPrep
+ */
+
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
--- a/langtools/test/tools/sjavac/JavacOptionPrepWrapper.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8035063
- * @summary Tests the preparation of javac-arguments.
- * @run main JavacOptionPrepWrapper
- */
-public class JavacOptionPrepWrapper {
- public static void main(String... args) throws Exception {
- SJavacTestUtil.runSjavacTest("JavacOptionPrep", args);
- }
-}
--- a/langtools/test/tools/sjavac/OptionDecoding.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/sjavac/OptionDecoding.java Fri Jul 25 09:44:53 2014 +0000
@@ -23,6 +23,15 @@
* questions.
*/
+/*
+ * @test
+ * @bug 8035063
+ * @summary Tests decoding of String[] into Options.
+ *
+ * @build Wrapper
+ * @run main Wrapper OptionDecoding
+ */
+
import static util.OptionTestUtil.assertEquals;
import static util.OptionTestUtil.checkFilesFound;
--- a/langtools/test/tools/sjavac/OptionDecodingWrapper.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8035063
- * @summary Tests decoding of String[] into Options.
- * @run main OptionDecodingWrapper
- */
-public class OptionDecodingWrapper {
- public static void main(String... args) throws Exception {
- SJavacTestUtil.runSjavacTest("OptionDecoding", args);
- }
-}
--- a/langtools/test/tools/sjavac/SJavac.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/sjavac/SJavac.java Fri Jul 25 09:44:53 2014 +0000
@@ -21,6 +21,16 @@
* questions.
*/
+
+/*
+ * @test
+ * @summary Test all aspects of sjavac.
+ * @bug 8004658 8042441 8042699
+ *
+ * @build Wrapper
+ * @run main Wrapper SJavac
+ */
+
import java.util.*;
import java.io.*;
import java.nio.file.*;
@@ -29,8 +39,7 @@
import com.sun.tools.sjavac.Main;
-public
-class SJavac {
+public class SJavac {
public static void main(String... args) throws Exception {
try {
--- a/langtools/test/tools/sjavac/SJavacTestUtil.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 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
- * 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.
- */
-
-import java.io.File;
-import java.lang.reflect.Method;
-
-
-public class SJavacTestUtil {
-
- public static void runSjavacTest(String testClassName, String[] args)
- throws Exception {
-
- if (!isSJavacOnClassPath()) {
- System.out.println("sjavac not available: pass by default");
- return;
- }
-
- File srcDir = new File(System.getProperty("test.src"));
- File clsDir = new File(System.getProperty("test.classes"));
-
- File src = new File(srcDir, testClassName + ".java");
- File cls = new File(clsDir, testClassName + ".class");
-
- if (cls.lastModified() < src.lastModified()) {
- System.err.println("Recompiling test class...");
- String[] javacArgs = { "-d", clsDir.getPath(), src.getPath() };
- int rc = com.sun.tools.javac.Main.compile(javacArgs);
- if (rc != 0)
- throw new Exception("compilation failed");
- }
-
- Class<?> sjavac = Class.forName(testClassName);
- Method main = sjavac.getMethod("main", String[].class);
- main.invoke(null, new Object[] { args });
-
- }
-
- private static boolean isSJavacOnClassPath() {
- String cls = "com/sun/tools/sjavac/Main.class";
- return SJavacTestUtil.class.getClassLoader().getResource(cls) != null;
- }
-}
--- a/langtools/test/tools/sjavac/SJavacWrapper.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary Test all aspects of sjavac.
- *
- * @bug 8004658
- * @bug 8042441
- * @bug 8042699
- * @summary Add internal smart javac wrapper to solve JEP 139
- *
- * @run main SJavacWrapper
- */
-
-public class SJavacWrapper {
- public static void main(String... args) throws Exception {
- SJavacTestUtil.runSjavacTest("SJavac", args);
- }
-}
--- a/langtools/test/tools/sjavac/Serialization.java Thu Jul 24 09:15:38 2014 +0200
+++ b/langtools/test/tools/sjavac/Serialization.java Fri Jul 25 09:44:53 2014 +0000
@@ -21,6 +21,18 @@
* questions.
*/
+/*
+ * @test
+ * @bug 8035063
+ *
+ * @summary Tests serialization of options. The options needs to be serialized
+ * and saved in the state file since the files need to be recompiled
+ * if new options are provided.
+ *
+ * @build Wrapper
+ * @run main Wrapper Serialization
+ */
+
import static util.OptionTestUtil.assertEquals;
import java.io.IOException;
--- a/langtools/test/tools/sjavac/SerializationWrapper.java Thu Jul 24 09:15:38 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8035063
- *
- * @summary Tests serialization of options. The options needs to be serialized
- * and saved in the state file since the files need to be recompiled
- * if new options are provided.
- *
- * @run main SerializationWrapper
- */
-public class SerializationWrapper {
- public static void main(String... args) throws Exception {
- SJavacTestUtil.runSjavacTest("Serialization", args);
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/Wrapper.java Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 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
+ * 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.
+ */
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
+
+public class Wrapper {
+ public static void main(String... args) throws Exception {
+ if (!isSJavacOnClassPath()) {
+ System.out.println("sjavac not available: pass by default");
+ return;
+ }
+
+ String testClassName = args[0];
+ String[] testArgs = Arrays.copyOfRange(args, 1, args.length);
+
+ File srcDir = new File(System.getProperty("test.src"));
+ File clsDir = new File(System.getProperty("test.classes"));
+
+ File src = new File(srcDir, testClassName + ".java");
+ File cls = new File(clsDir, testClassName + ".class");
+
+ if (cls.lastModified() < src.lastModified()) {
+ System.err.println("Recompiling test class...");
+ String[] javacArgs = { "-d", clsDir.getPath(), src.getPath() };
+ int rc = com.sun.tools.javac.Main.compile(javacArgs);
+ if (rc != 0)
+ throw new Exception("compilation failed");
+ }
+
+ Class<?> sjavac = Class.forName(testClassName);
+ Method main = sjavac.getMethod("main", String[].class);
+ main.invoke(null, new Object[] { testArgs });
+ }
+
+ private static boolean isSJavacOnClassPath() {
+ String cls = "com/sun/tools/sjavac/Main.class";
+ return Wrapper.class.getClassLoader().getResource(cls) != null;
+ }
+}
--- a/nashorn/.hgtags Thu Jul 24 09:15:38 2014 +0200
+++ b/nashorn/.hgtags Fri Jul 25 09:44:53 2014 +0000
@@ -256,3 +256,4 @@
d703c59c556f9fcd9604272806ef7acf55c92363 jdk9-b20
174cf53bce4e93a3d5d880ed7915ce8d0f08bc5e jdk9-b21
a9d39bcfeb1bb3f7de929c56a2ecbea10a554ca1 jdk9-b22
+aa3fda2d2967847dbd264aa962d624c07fc6c29f jdk9-b23
--- a/nashorn/make/build.xml Thu Jul 24 09:15:38 2014 +0200
+++ b/nashorn/make/build.xml Fri Jul 25 09:44:53 2014 +0000
@@ -392,6 +392,7 @@
verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
<jvmarg line="${ext.class.path}"/>
<jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
+ <sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/>
<propertyset>
<propertyref prefix="nashorn."/>
</propertyset>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/javafoovars.js Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,103 @@
+#// Usage: jjs javafoovars.js -- <directory>
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This example demonstrates Java subclassing by Java.extend
+// and javac Compiler and Tree API. This example counts number
+// of variables called "foo" in the given java source files!
+if (arguments.length == 0) {
+ print("Usage: jjs javafoovars.js -- <directory>");
+ exit(1);
+}
+
+// Java types used
+var File = Java.type("java.io.File");
+var Files = Java.type("java.nio.file.Files");
+var FileVisitOption = Java.type("java.nio.file.FileVisitOption");
+var StringArray = Java.type("java.lang.String[]");
+var ToolProvider = Java.type("javax.tools.ToolProvider");
+var Tree = Java.type("com.sun.source.tree.Tree");
+var TreeScanner = Java.type("com.sun.source.util.TreeScanner");
+var VariableTree = Java.type("com.sun.source.tree.VariableTree");
+
+// count "foo"-s in the given .java files
+function countFoo() {
+ // get the system compiler tool
+ var compiler = ToolProvider.systemJavaCompiler;
+ // get standard file manager
+ var fileMgr = compiler.getStandardFileManager(null, null, null);
+ // Using Java.to convert script array (arguments) to a Java String[]
+ var compUnits = fileMgr.getJavaFileObjects(
+ Java.to(arguments, StringArray));
+ // create a new compilation task
+ var task = compiler.getTask(null, fileMgr, null, null, null, compUnits);
+ // subclass SimpleTreeVisitor - to count variables called "foo"
+ var FooCounterVisitor = Java.extend(TreeScanner);
+ var fooCount = 0;
+
+ var visitor = new FooCounterVisitor() {
+ visitVariable: function (node, p) {
+ if (node.name.toString() == "foo") {
+ fooCount++;
+ }
+ }
+ }
+
+ for each (var cu in task.parse()) {
+ cu.accept(visitor, null);
+ }
+ return fooCount;
+}
+
+// for each ".java" file in directory (recursively) count "foo".
+function main(dir) {
+ var totalCount = 0;
+ Files.walk(dir.toPath(), FileVisitOption.FOLLOW_LINKS).
+ forEach(function(p) {
+ var name = p.toFile().absolutePath;
+ if (name.endsWith(".java")) {
+ var count = 0;
+ try {
+ count = countFoo(p.toFile().getAbsolutePath());
+ } catch (e) {
+ print(e);
+ }
+ if (count != 0) {
+ print(name + ": " + count);
+ }
+ totalCount += count;
+ }
+ });
+ print("Total foo count: " + totalCount);
+}
+
+main(new File(arguments[0]));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/jsobj_example.js Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Flexible script object using AbstractJSObject subclass
+
+var AbstractJSObject = Java.type("jdk.nashorn.api.scripting.AbstractJSObject");
+
+// JSObject example that uses a map for properties and
+// falls back to with methods on a java object (for missing
+// properties
+
+function makeJSObj(map, fallback) {
+ return new AbstractJSObject() {
+ getMember: function(name) {
+ if (map.containsKey(name)) {
+ return map.get(name);
+ }
+
+ var val = fallback[name];
+ if (typeof val == 'function') {
+ return function() {
+ var a = arguments;
+ switch (a.length) {
+ case 0: return fallback[name]();
+ case 1: return fallback[name](a[0]);
+ case 2: return fallback[name](a[0], a[1]);
+ case 3: return fallback[name](a[0], a[1], a[2]);
+ case 4: return fallback[name](a[0], a[1], a[2], a[3]);
+ }
+ }
+ }
+ }
+ }
+}
+
+var m = new java.util.HashMap();
+m.put("foo", 42);
+m.put("bar", 'hello');
+
+var obj = makeJSObj(m, new java.io.File("."));
+
+print(obj.foo);
+print(obj.bar);
+print(obj.getAbsolutePath());
+print(obj.isDirectory());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/ziplist.js Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+if (arguments.length == 0) {
+ print("Usage: jjs ziplist <zip-file>");
+ exit(1);
+}
+
+// list the content details of a .zip or .jar file
+var file = arguments[0];
+
+// java classes used
+var Attributes = Java.type("java.util.jar.Attributes");
+var FileTime = Java.type("java.nio.file.attribute.FileTime");
+var JarFile = Java.type("java.util.jar.JarFile");
+var ZipEntry = Java.type("java.util.zip.ZipEntry");
+var ZipFile = Java.type("java.util.zip.ZipFile");
+
+var zf = file.endsWith(".jar")? new JarFile(file) : new ZipFile(file);
+
+var entries = zf.entries();
+// make overall output a valid JSON
+var zfObj = {
+ name: zf.name,
+ comment: zf.comment,
+ size: zf.size(),
+ entries: []
+};
+
+while (entries.hasMoreElements()) {
+ zfObj.entries.push(entries.nextElement());
+}
+
+print(JSON.stringify(zfObj, function (key, value) {
+ if (value instanceof ZipEntry) {
+ return Object.bindProperties({}, value);
+ } else if (value instanceof FileTime) {
+ return value.toString();
+ } else if (value instanceof Attributes) {
+ var attrs = {};
+ var itr = value.entrySet().iterator();
+ while (itr.hasNext()) {
+ var n = itr.next();
+ attrs[n.key] = String(n.value);
+ }
+ return attrs;
+ }
+
+ return value;
+}, ' '));
+
+zf.close();
--- a/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java Thu Jul 24 09:15:38 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java Fri Jul 25 09:44:53 2014 +0000
@@ -36,9 +36,9 @@
import java.security.AccessController;
import java.security.MessageDigest;
import java.security.PrivilegedAction;
-import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Base64;
+import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import jdk.nashorn.internal.codegen.types.Type;
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java Thu Jul 24 09:15:38 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java Fri Jul 25 09:44:53 2014 +0000
@@ -1763,6 +1763,8 @@
final int NOT_ENUMERABLE_NOT_CONFIG = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE;
scontextProperty = addOwnProperty("context", NOT_ENUMERABLE_NOT_CONFIG, null);
addOwnProperty("engine", NOT_ENUMERABLE_NOT_CONFIG, engine);
+ // default file name
+ addOwnProperty(ScriptEngine.FILENAME, Attribute.NOT_ENUMERABLE, null);
// __noSuchProperty__ hook for ScriptContext search of missing variables
final ScriptFunction noSuchProp = ScriptFunctionImpl.makeStrictFunction(NO_SUCH_PROPERTY_NAME, NO_SUCH_PROPERTY);
addOwnProperty(NO_SUCH_PROPERTY_NAME, Attribute.NOT_ENUMERABLE, noSuchProp);
--- a/nashorn/test/script/basic/JDK-8015969.js Thu Jul 24 09:15:38 2014 +0200
+++ b/nashorn/test/script/basic/JDK-8015969.js Fri Jul 25 09:44:53 2014 +0000
@@ -37,24 +37,6 @@
'use strict';
try {
- context = 444;
- print("FAILED!! context write should have thrown error");
-} catch (e) {
- if (! (e instanceof TypeError)) {
- print("TypeError expected but got " + e);
- }
-}
-
-try {
- engine = "hello";
- print("FAILED!! engine write should have thrown error");
-} catch (e) {
- if (! (e instanceof TypeError)) {
- print("TypeError expected but got " + e);
- }
-}
-
-try {
delete context;
print("FAILED!! context delete should have thrown error");
} catch (e) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8050432.js Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8050432: javax.script.filename variable should not be enumerable with nashorn engine's ENGINE_SCOPE bindings
+ *
+ * @test
+ * @run
+ */
+
+var ScriptEngine = javax.script.ScriptEngine;
+var m = new javax.script.ScriptEngineManager();
+var engine = m.getEngineByName("nashorn");
+
+engine.put(ScriptEngine.FILENAME, "foo");
+var desc = engine.eval("Object.getOwnPropertyDescriptor(this, '"
+ + ScriptEngine.FILENAME + "')");
+if (desc.enumerable) {
+ fail(ScriptEngine.FILENAME + " is enumerable");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/JDK-8050964.js Fri Jul 25 09:44:53 2014 +0000
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
+ *
+ * Make sure that nashorn.jar has only 'compact1' dependency.
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+// assume that this script is run with "nashorn.jar" System
+// property set to relative path of nashorn.jar from the current
+// directory of test execution.
+
+if (typeof fail != 'function') {
+ fail = print;
+}
+
+var System = java.lang.System;
+var File = java.io.File;
+var nashornJar = new File(System.getProperty("nashorn.jar"));
+if (! nashornJar.isAbsolute()) {
+ nashornJar = new File(".", nashornJar);
+}
+
+// run jdep on nashorn.jar - only summary but print profile info
+`jdeps -s -P ${nashornJar.absolutePath}`
+
+// check for "(compact1)" in output from jdep tool
+if (! /(compact1)/.test($OUT)) {
+ fail("non-compact1 dependency: " + $OUT);
+}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Thu Jul 24 09:15:38 2014 +0200
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Fri Jul 25 09:44:53 2014 +0000
@@ -607,6 +607,20 @@
assertEquals(res, "hello");
}
+ // @bug 8050432:javax.script.filename variable should not be enumerable
+ // with nashorn engine's ENGINE_SCOPE bindings
+ @Test
+ public void enumerableGlobalsTest() throws ScriptException {
+ final ScriptEngineManager m = new ScriptEngineManager();
+ final ScriptEngine e = m.getEngineByName("nashorn");
+
+ e.put(ScriptEngine.FILENAME, "test");
+ Object enumerable = e.eval(
+ "Object.getOwnPropertyDescriptor(this, " +
+ " 'javax.script.filename').enumerable");
+ assertEquals(enumerable, Boolean.FALSE);
+ }
+
private static void checkProperty(final ScriptEngine e, final String name)
throws ScriptException {
final String value = System.getProperty(name);
--- a/test/Makefile Thu Jul 24 09:15:38 2014 +0200
+++ b/test/Makefile Fri Jul 25 09:44:53 2014 +0000
@@ -66,6 +66,32 @@
hotspot_%:
@$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@)
+#
+# jtreg_tests
+#
+# Invocation:
+#
+# make jtreg_tests TESTDIRS=<test-dirs>
+#
+# where <test-dirs> is something like '../<component>/test/runtime',
+# <component> in turn being one of the top level directories (for
+# example 'hotspot').
+#
+# The below will strip the path prefix and delegate to the
+# corresponding ../<component>/test/Makefile.
+
+ifneq ($(TESTDIRS),)
+# Extract the component from ../<component>/...
+COMPONENT=$(word 2,$(subst /, ,$(TESTDIRS)))
+
+# Strip off the ../<component>/test prefix and pass the rest as TESTDIRS
+# to the delegate Makefile
+TESTDIRS_TESTS=$(patsubst ../$(COMPONENT)/test/%,%,$(TESTDIRS))
+endif
+
+jtreg_tests:
+ @$(NO_STOPPING)$(call SUBDIR_TEST, $(TOPDIR)/$(COMPONENT), TESTDIRS=$(TESTDIRS_TESTS) $@)
+
################################################################
# Phony targets (e.g. these are not filenames)