From 4fd64312c80ce0509fc606783c46da4b2869ab3d Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Tue, 10 Apr 2012 09:31:04 -0700 Subject: [PATCH 01/73] 7159772: instanceKlass::all_fields_count() returns incorrect total field count Fix instanceKlass::all_fields_count() bug. Reviewed-by: kvn, never --- hotspot/src/share/vm/oops/instanceKlass.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index 9cbfa0fbfb6..656e74226f2 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -337,7 +337,7 @@ class instanceKlass: public Klass { int java_fields_count() const { return (int)_java_fields_count; } // Number of fields including any injected fields - int all_fields_count() const { return _fields->length() / sizeof(FieldInfo::field_slots); } + int all_fields_count() const { return _fields->length() / FieldInfo::field_slots; } typeArrayOop fields() const { return _fields; } From d16ab3b53e3910497ee448c6fb083f4ddb25e2e0 Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Wed, 11 Apr 2012 19:15:46 -0700 Subject: [PATCH 02/73] 7160539: JDeveloper crashes on 64-bit Windows X64 C1 needs to zero upper 32bits when doing l2i conversion Reviewed-by: never, kvn --- hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp index b0062406da1..a7cc42e4912 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @@ -1462,7 +1462,11 @@ void LIR_Assembler::emit_opConvert(LIR_OpConvert* op) { break; case Bytecodes::_l2i: +#ifdef _LP64 + __ movl(dest->as_register(), src->as_register_lo()); +#else move_regs(src->as_register_lo(), dest->as_register()); +#endif break; case Bytecodes::_i2b: From 2ded12cdfd5b8f64834eed63957db145cbea24e2 Mon Sep 17 00:00:00 2001 From: Nils Eliasson Date: Tue, 17 Apr 2012 11:04:22 -0700 Subject: [PATCH 03/73] 7162094: LateInlineCallGenerator::do_late_inline crashed on uninitialized _call_node Reviewed-by: never, twisti --- hotspot/src/share/vm/opto/callGenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/opto/callGenerator.cpp b/hotspot/src/share/vm/opto/callGenerator.cpp index 6455c812567..26153217d07 100644 --- a/hotspot/src/share/vm/opto/callGenerator.cpp +++ b/hotspot/src/share/vm/opto/callGenerator.cpp @@ -137,6 +137,7 @@ JVMState* DirectCallGenerator::generate(JVMState* jvms) { } CallStaticJavaNode *call = new (kit.C, tf()->domain()->cnt()) CallStaticJavaNode(tf(), target, method(), kit.bci()); + _call_node = call; // Save the call node in case we need it later if (!is_static) { // Make an explicit receiver null_check as part of this call. // Since we share a map with the caller, his JVMS gets adjusted. @@ -155,7 +156,6 @@ JVMState* DirectCallGenerator::generate(JVMState* jvms) { kit.set_edges_for_java_call(call, false, _separate_io_proj); Node* ret = kit.set_results_for_java_call(call, _separate_io_proj); kit.push_node(method()->return_type()->basic_type(), ret); - _call_node = call; // Save the call node in case we need it later return kit.transfer_exceptions_into_jvms(); } From a02fad04b2ffa2670064655f973d2bb8bd0f4c96 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Wed, 18 Apr 2012 16:08:34 -0700 Subject: [PATCH 04/73] 7161796: PhaseStringOpts::fetch_static_field tries to fetch field from the Klass instead of the mirror Reviewed-by: twisti --- hotspot/src/share/vm/opto/stringopts.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp index f3220f2cceb..496e7a883d1 100644 --- a/hotspot/src/share/vm/opto/stringopts.cpp +++ b/hotspot/src/share/vm/opto/stringopts.cpp @@ -897,8 +897,8 @@ bool StringConcat::validate_control_flow() { } Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) { - const TypeKlassPtr* klass_type = TypeKlassPtr::make(field->holder()); - Node* klass_node = __ makecon(klass_type); + const TypeInstPtr* mirror_type = TypeInstPtr::make(field->holder()->java_mirror()); + Node* klass_node = __ makecon(mirror_type); BasicType bt = field->layout_type(); ciType* field_klass = field->type(); @@ -913,6 +913,7 @@ Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) { // and may yield a vacuous result if the field is of interface type. type = TypeOopPtr::make_from_constant(con, true)->isa_oopptr(); assert(type != NULL, "field singleton type must be consistent"); + return __ makecon(type); } else { type = TypeOopPtr::make_from_klass(field_klass->as_klass()); } @@ -922,7 +923,7 @@ Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) { return kit.make_load(NULL, kit.basic_plus_adr(klass_node, field->offset_in_bytes()), type, T_OBJECT, - C->get_alias_index(klass_type->add_offset(field->offset_in_bytes()))); + C->get_alias_index(mirror_type->add_offset(field->offset_in_bytes()))); } Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) { From 83ff79ed0126ae9352bd3f4e6ee0102c2df3b024 Mon Sep 17 00:00:00 2001 From: Nils Eliasson Date: Tue, 24 Apr 2012 12:15:32 -0700 Subject: [PATCH 05/73] 7157695: Add windows implementation of socket interface Reviewed-by: kvn, dholmes, twisti --- hotspot/src/os/windows/vm/jvm_windows.h | 2 +- hotspot/src/os/windows/vm/os_windows.cpp | 67 +++++++++++------------- 2 files changed, 31 insertions(+), 38 deletions(-) diff --git a/hotspot/src/os/windows/vm/jvm_windows.h b/hotspot/src/os/windows/vm/jvm_windows.h index a45f86c2e77..91039821558 100644 --- a/hotspot/src/os/windows/vm/jvm_windows.h +++ b/hotspot/src/os/windows/vm/jvm_windows.h @@ -59,7 +59,7 @@ typedef struct _MODULEINFO { #include -typedef unsigned int socklen_t; +typedef int socklen_t; // #include "jni.h" diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index de38c6c12da..c607905e836 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -4820,99 +4820,92 @@ struct hostent* os::get_host_by_name(char* name) { return (struct hostent*)os::WinSock2Dll::gethostbyname(name); } - int os::socket_close(int fd) { - ShouldNotReachHere(); - return 0; + return ::closesocket(fd); } int os::socket_available(int fd, jint *pbytes) { - ShouldNotReachHere(); - return 0; + int ret = ::ioctlsocket(fd, FIONREAD, (u_long*)pbytes); + return (ret < 0) ? 0 : 1; } int os::socket(int domain, int type, int protocol) { - ShouldNotReachHere(); - return 0; + return ::socket(domain, type, protocol); } int os::listen(int fd, int count) { - ShouldNotReachHere(); - return 0; + return ::listen(fd, count); } int os::connect(int fd, struct sockaddr* him, socklen_t len) { - ShouldNotReachHere(); - return 0; + return ::connect(fd, him, len); } int os::accept(int fd, struct sockaddr* him, socklen_t* len) { - ShouldNotReachHere(); - return 0; + return ::accept(fd, him, len); } int os::sendto(int fd, char* buf, size_t len, uint flags, struct sockaddr* to, socklen_t tolen) { - ShouldNotReachHere(); - return 0; + + return ::sendto(fd, buf, (int)len, flags, to, tolen); } int os::recvfrom(int fd, char *buf, size_t nBytes, uint flags, sockaddr* from, socklen_t* fromlen) { - ShouldNotReachHere(); - return 0; + + return ::recvfrom(fd, buf, (int)nBytes, flags, from, fromlen); } int os::recv(int fd, char* buf, size_t nBytes, uint flags) { - ShouldNotReachHere(); - return 0; + return ::recv(fd, buf, (int)nBytes, flags); } int os::send(int fd, char* buf, size_t nBytes, uint flags) { - ShouldNotReachHere(); - return 0; + return ::send(fd, buf, (int)nBytes, flags); } int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { - ShouldNotReachHere(); - return 0; + return ::send(fd, buf, (int)nBytes, flags); } int os::timeout(int fd, long timeout) { - ShouldNotReachHere(); - return 0; + fd_set tbl; + struct timeval t; + + t.tv_sec = timeout / 1000; + t.tv_usec = (timeout % 1000) * 1000; + + tbl.fd_count = 1; + tbl.fd_array[0] = fd; + + return ::select(1, &tbl, 0, 0, &t); } int os::get_host_name(char* name, int namelen) { - ShouldNotReachHere(); - return 0; + return ::gethostname(name, namelen); } int os::socket_shutdown(int fd, int howto) { - ShouldNotReachHere(); - return 0; + return ::shutdown(fd, howto); } int os::bind(int fd, struct sockaddr* him, socklen_t len) { - ShouldNotReachHere(); - return 0; + return ::bind(fd, him, len); } int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) { - ShouldNotReachHere(); - return 0; + return ::getsockname(fd, him, len); } int os::get_sock_opt(int fd, int level, int optname, char* optval, socklen_t* optlen) { - ShouldNotReachHere(); - return 0; + return ::getsockopt(fd, level, optname, optval, optlen); } int os::set_sock_opt(int fd, int level, int optname, const char* optval, socklen_t optlen) { - ShouldNotReachHere(); - return 0; + return ::setsockopt(fd, level, optname, optval, optlen); } From 2fa131f8db4cdde46ea2c7839259d5ea1380aab0 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Wed, 2 May 2012 13:21:36 -0400 Subject: [PATCH 06/73] 7158552: The instanceKlsss::_host_klass is only needed for anonymous class for JSR 292 support Change the _host_klass to be conditionally created embedded instanceKlass field. Reviewed-by: jrose, coleenp, dholmes --- .../share/vm/classfile/classFileParser.cpp | 3 +- hotspot/src/share/vm/memory/oopFactory.cpp | 5 +- hotspot/src/share/vm/memory/oopFactory.hpp | 3 +- hotspot/src/share/vm/oops/instanceKlass.cpp | 2 +- hotspot/src/share/vm/oops/instanceKlass.hpp | 112 ++++++++++++++---- .../src/share/vm/oops/instanceKlassKlass.cpp | 55 ++++++--- .../src/share/vm/oops/instanceKlassKlass.hpp | 1 + 7 files changed, 132 insertions(+), 49 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index c7ea5b580aa..f24610c060c 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -3355,7 +3355,8 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name, static_field_size, total_oop_map_count, access_flags, - rt, CHECK_(nullHandle)); + rt, host_klass, + CHECK_(nullHandle)); instanceKlassHandle this_klass (THREAD, ik); assert(this_klass->static_field_size() == static_field_size, "sanity"); diff --git a/hotspot/src/share/vm/memory/oopFactory.cpp b/hotspot/src/share/vm/memory/oopFactory.cpp index fcac438bbe3..0dd620650e1 100644 --- a/hotspot/src/share/vm/memory/oopFactory.cpp +++ b/hotspot/src/share/vm/memory/oopFactory.cpp @@ -128,11 +128,12 @@ klassOop oopFactory::new_instanceKlass(Symbol* name, int vtable_len, int itable_ int static_field_size, unsigned int nonstatic_oop_map_count, AccessFlags access_flags, - ReferenceType rt, TRAPS) { + ReferenceType rt, + KlassHandle host_klass, TRAPS) { instanceKlassKlass* ikk = instanceKlassKlass::cast(Universe::instanceKlassKlassObj()); return ikk->allocate_instance_klass(name, vtable_len, itable_len, static_field_size, nonstatic_oop_map_count, - access_flags, rt, CHECK_NULL); + access_flags, rt, host_klass, CHECK_NULL); } diff --git a/hotspot/src/share/vm/memory/oopFactory.hpp b/hotspot/src/share/vm/memory/oopFactory.hpp index 61faf8e3db7..38de1a4f2c2 100644 --- a/hotspot/src/share/vm/memory/oopFactory.hpp +++ b/hotspot/src/share/vm/memory/oopFactory.hpp @@ -78,7 +78,8 @@ class oopFactory: AllStatic { int static_field_size, unsigned int nonstatic_oop_map_count, AccessFlags access_flags, - ReferenceType rt, TRAPS); + ReferenceType rt, + KlassHandle host_klass, TRAPS); // Methods private: diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index aa5f7765a79..794a7e2809f 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -1862,7 +1862,7 @@ void instanceKlass::follow_weak_klass_links( if (impl != NULL) { if (!is_alive->do_object_b(impl)) { // remove this guy - *start_of_implementor() = NULL; + *adr_implementor() = NULL; } } } else { diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index 31266375115..9a872878f51 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -78,6 +78,7 @@ // The embedded nonstatic oop-map blocks are short pairs (offset, length) // indicating where oops are located in instances of this klass. // [EMBEDDED implementor of the interface] only exist for interface +// [EMBEDDED host klass ] only exist for an anonymous class (JSR 292 enabled) // forward declaration for class -- see below for definition @@ -176,10 +177,6 @@ class instanceKlass: public Klass { oop _class_loader; // Protection domain. oop _protection_domain; - // Host class, which grants its access privileges to this class also. - // This is only non-null for an anonymous class (JSR 292 enabled). - // The host class is either named, or a previously loaded anonymous class. - klassOop _host_klass; // Class signers. objArrayOop _signers; // The InnerClasses attribute and EnclosingMethod attribute. The @@ -234,9 +231,13 @@ class instanceKlass: public Klass { int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks bool _is_marked_dependent; // used for marking during flushing and deoptimization - bool _rewritten; // methods rewritten. - bool _has_nonstatic_fields; // for sizing with UseCompressedOops - bool _should_verify_class; // allow caching of preverification + enum { + _misc_rewritten = 1 << 0, // methods rewritten. + _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops + _misc_should_verify_class = 1 << 2, // allow caching of preverification + _misc_is_anonymous = 1 << 3 // has embedded _inner_classes field + }; + u2 _misc_flags; u2 _minor_version; // minor version number of class file u2 _major_version; // major version number of class file Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization) @@ -276,13 +277,29 @@ class instanceKlass: public Klass { // NULL: no implementor. // A klassOop that's not itself: one implementor. // Itsef: more than one implementors. + // embedded host klass follows here + // The embedded host klass only exists in an anonymous class for + // dynamic language support (JSR 292 enabled). The host class grants + // its access privileges to this class also. The host class is either + // named, or a previously loaded anonymous class. A non-anonymous class + // or an anonymous class loaded through normal classloading does not + // have this embedded field. + // friend class instanceKlassKlass; friend class SystemDictionary; public: - bool has_nonstatic_fields() const { return _has_nonstatic_fields; } - void set_has_nonstatic_fields(bool b) { _has_nonstatic_fields = b; } + bool has_nonstatic_fields() const { + return (_misc_flags & _misc_has_nonstatic_fields) != 0; + } + void set_has_nonstatic_fields(bool b) { + if (b) { + _misc_flags |= _misc_has_nonstatic_fields; + } else { + _misc_flags &= ~_misc_has_nonstatic_fields; + } + } // field sizes int nonstatic_field_size() const { return _nonstatic_field_size; } @@ -396,11 +413,19 @@ class instanceKlass: public Klass { bool is_in_error_state() const { return _init_state == initialization_error; } bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; } ClassState init_state() { return (ClassState)_init_state; } - bool is_rewritten() const { return _rewritten; } + bool is_rewritten() const { return (_misc_flags & _misc_rewritten) != 0; } // defineClass specified verification - bool should_verify_class() const { return _should_verify_class; } - void set_should_verify_class(bool value) { _should_verify_class = value; } + bool should_verify_class() const { + return (_misc_flags & _misc_should_verify_class) != 0; + } + void set_should_verify_class(bool value) { + if (value) { + _misc_flags |= _misc_should_verify_class; + } else { + _misc_flags &= ~_misc_should_verify_class; + } + } // marking bool is_marked_dependent() const { return _is_marked_dependent; } @@ -469,9 +494,30 @@ class instanceKlass: public Klass { void set_protection_domain(oop pd) { oop_store((oop*) &_protection_domain, pd); } // host class - oop host_klass() const { return _host_klass; } - void set_host_klass(oop host) { oop_store((oop*) &_host_klass, host); } - bool is_anonymous() const { return _host_klass != NULL; } + oop host_klass() const { + oop* hk = adr_host_klass(); + if (hk == NULL) { + return NULL; + } else { + return *hk; + } + } + void set_host_klass(oop host) { + assert(is_anonymous(), "not anonymous"); + oop* addr = adr_host_klass(); + assert(addr != NULL, "no reversed space"); + oop_store(addr, host); + } + bool is_anonymous() const { + return (_misc_flags & _misc_is_anonymous) != 0; + } + void set_is_anonymous(bool value) { + if (value) { + _misc_flags |= _misc_is_anonymous; + } else { + _misc_flags &= ~_misc_is_anonymous; + } + } // signers objArrayOop signers() const { return _signers; } @@ -651,7 +697,7 @@ class instanceKlass: public Klass { // Access to the implementor of an interface. klassOop implementor() const { - klassOop* k = start_of_implementor(); + klassOop* k = (klassOop*)adr_implementor(); if (k == NULL) { return NULL; } else { @@ -661,7 +707,7 @@ class instanceKlass: public Klass { void set_implementor(klassOop k) { assert(is_interface(), "not interface"); - oop* addr = (oop*)start_of_implementor(); + oop* addr = adr_implementor(); oop_store_without_check(addr, k); } @@ -717,9 +763,11 @@ class instanceKlass: public Klass { { return object_size(align_object_offset(vtable_length()) + align_object_offset(itable_length()) + - (is_interface() ? - (align_object_offset(nonstatic_oop_map_size()) + (int)sizeof(klassOop)/HeapWordSize) : - nonstatic_oop_map_size())); + ((is_interface() || is_anonymous()) ? + align_object_offset(nonstatic_oop_map_size()) : + nonstatic_oop_map_size()) + + (is_interface() ? (int)sizeof(klassOop)/HeapWordSize : 0) + + (is_anonymous() ? (int)sizeof(klassOop)/HeapWordSize : 0)); } static int vtable_start_offset() { return header_size(); } static int vtable_length_offset() { return oopDesc::header_size() + offset_of(instanceKlass, _vtable_len) / HeapWordSize; } @@ -737,15 +785,29 @@ class instanceKlass: public Klass { return (OopMapBlock*)(start_of_itable() + align_object_offset(itable_length())); } - klassOop* start_of_implementor() const { + oop* adr_implementor() const { if (is_interface()) { - return (klassOop*)(start_of_nonstatic_oop_maps() + - nonstatic_oop_map_count()); + return (oop*)(start_of_nonstatic_oop_maps() + + nonstatic_oop_map_count()); } else { return NULL; } }; + oop* adr_host_klass() const { + if (is_anonymous()) { + oop* adr_impl = adr_implementor(); + if (adr_impl != NULL) { + return adr_impl + 1; + } else { + return (oop*)(start_of_nonstatic_oop_maps() + + nonstatic_oop_map_count()); + } + } else { + return NULL; + } + } + // Allocation profiling support juint alloc_size() const { return _alloc_count * size_helper(); } void set_alloc_size(juint n) {} @@ -819,7 +881,7 @@ private: #else void set_init_state(ClassState state) { _init_state = (u1)state; } #endif - void set_rewritten() { _rewritten = true; } + void set_rewritten() { _misc_flags |= _misc_rewritten; } void set_init_thread(Thread *thread) { _init_thread = thread; } u2 idnum_allocated_count() const { return _idnum_allocated_count; } @@ -852,10 +914,8 @@ private: oop* adr_constants() const { return (oop*)&this->_constants;} oop* adr_class_loader() const { return (oop*)&this->_class_loader;} oop* adr_protection_domain() const { return (oop*)&this->_protection_domain;} - oop* adr_host_klass() const { return (oop*)&this->_host_klass;} oop* adr_signers() const { return (oop*)&this->_signers;} oop* adr_inner_classes() const { return (oop*)&this->_inner_classes;} - oop* adr_implementor() const { return (oop*)start_of_implementor(); } oop* adr_methods_jmethod_ids() const { return (oop*)&this->_methods_jmethod_ids;} oop* adr_methods_cached_itable_indices() const { return (oop*)&this->_methods_cached_itable_indices;} oop* adr_class_annotations() const { return (oop*)&this->_class_annotations;} diff --git a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp index 808b6e56999..12ea2234451 100644 --- a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp @@ -103,7 +103,9 @@ void instanceKlassKlass::oop_follow_contents(oop obj) { MarkSweep::mark_and_push(ik->adr_class_loader()); MarkSweep::mark_and_push(ik->adr_inner_classes()); MarkSweep::mark_and_push(ik->adr_protection_domain()); - MarkSweep::mark_and_push(ik->adr_host_klass()); + if (ik->adr_host_klass() != NULL) { + MarkSweep::mark_and_push(ik->adr_host_klass()); + } MarkSweep::mark_and_push(ik->adr_signers()); MarkSweep::mark_and_push(ik->adr_class_annotations()); MarkSweep::mark_and_push(ik->adr_fields_annotations()); @@ -139,7 +141,9 @@ void instanceKlassKlass::oop_follow_contents(ParCompactionManager* cm, PSParallelCompact::mark_and_push(cm, ik->adr_class_loader()); PSParallelCompact::mark_and_push(cm, ik->adr_inner_classes()); PSParallelCompact::mark_and_push(cm, ik->adr_protection_domain()); - PSParallelCompact::mark_and_push(cm, ik->adr_host_klass()); + if (ik->adr_host_klass() != NULL) { + PSParallelCompact::mark_and_push(cm, ik->adr_host_klass()); + } PSParallelCompact::mark_and_push(cm, ik->adr_signers()); PSParallelCompact::mark_and_push(cm, ik->adr_class_annotations()); PSParallelCompact::mark_and_push(cm, ik->adr_fields_annotations()); @@ -177,10 +181,12 @@ int instanceKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) { blk->do_oop(ik->adr_constants()); blk->do_oop(ik->adr_class_loader()); blk->do_oop(ik->adr_protection_domain()); - blk->do_oop(ik->adr_host_klass()); + if (ik->adr_host_klass() != NULL) { + blk->do_oop(ik->adr_host_klass()); + } blk->do_oop(ik->adr_signers()); blk->do_oop(ik->adr_inner_classes()); - if (ik->is_interface()) { + if (ik->adr_implementor() != NULL) { blk->do_oop(ik->adr_implementor()); } blk->do_oop(ik->adr_class_annotations()); @@ -227,15 +233,13 @@ int instanceKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, adr = ik->adr_protection_domain(); if (mr.contains(adr)) blk->do_oop(adr); adr = ik->adr_host_klass(); - if (mr.contains(adr)) blk->do_oop(adr); + if (adr != NULL && mr.contains(adr)) blk->do_oop(adr); adr = ik->adr_signers(); if (mr.contains(adr)) blk->do_oop(adr); adr = ik->adr_inner_classes(); if (mr.contains(adr)) blk->do_oop(adr); - if (ik->is_interface()) { - adr = ik->adr_implementor(); - if (mr.contains(adr)) blk->do_oop(adr); - } + adr = ik->adr_implementor(); + if (adr != NULL && mr.contains(adr)) blk->do_oop(adr); adr = ik->adr_class_annotations(); if (mr.contains(adr)) blk->do_oop(adr); adr = ik->adr_fields_annotations(); @@ -270,10 +274,12 @@ int instanceKlassKlass::oop_adjust_pointers(oop obj) { MarkSweep::adjust_pointer(ik->adr_constants()); MarkSweep::adjust_pointer(ik->adr_class_loader()); MarkSweep::adjust_pointer(ik->adr_protection_domain()); - MarkSweep::adjust_pointer(ik->adr_host_klass()); + if (ik->adr_host_klass() != NULL) { + MarkSweep::adjust_pointer(ik->adr_host_klass()); + } MarkSweep::adjust_pointer(ik->adr_signers()); MarkSweep::adjust_pointer(ik->adr_inner_classes()); - if (ik->is_interface()) { + if (ik->adr_implementor() != NULL) { MarkSweep::adjust_pointer(ik->adr_implementor()); } MarkSweep::adjust_pointer(ik->adr_class_annotations()); @@ -302,7 +308,7 @@ void instanceKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { } oop* hk_addr = ik->adr_host_klass(); - if (PSScavenge::should_scavenge(hk_addr)) { + if (hk_addr != NULL && PSScavenge::should_scavenge(hk_addr)) { pm->claim_or_forward_depth(hk_addr); } @@ -328,9 +334,13 @@ int instanceKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) { PSParallelCompact::adjust_pointer(cur_oop); } - if (ik->is_interface()) { + // embedded oops + if (ik->adr_implementor() != NULL) { PSParallelCompact::adjust_pointer(ik->adr_implementor()); } + if (ik->adr_host_klass() != NULL) { + PSParallelCompact::adjust_pointer(ik->adr_host_klass()); + } OopClosure* closure = PSParallelCompact::adjust_root_pointer_closure(); iterate_c_heap_oops(ik, closure); @@ -346,16 +356,23 @@ instanceKlassKlass::allocate_instance_klass(Symbol* name, int vtable_len, int it int static_field_size, unsigned nonstatic_oop_map_count, AccessFlags access_flags, - ReferenceType rt, TRAPS) { + ReferenceType rt, + KlassHandle host_klass, TRAPS) { const int nonstatic_oop_map_size = instanceKlass::nonstatic_oop_map_size(nonstatic_oop_map_count); int size = align_object_offset(vtable_len) + align_object_offset(itable_len); - if (access_flags.is_interface()) { - size += align_object_offset(nonstatic_oop_map_size) + (int)sizeof(klassOop)/HeapWordSize; + if (access_flags.is_interface() || !host_klass.is_null()) { + size += align_object_offset(nonstatic_oop_map_size); } else { size += nonstatic_oop_map_size; } + if (access_flags.is_interface()) { + size += (int)sizeof(klassOop)/HeapWordSize; + } + if (!host_klass.is_null()) { + size += (int)sizeof(klassOop)/HeapWordSize; + } size = instanceKlass::object_size(size); // Allocation @@ -389,6 +406,7 @@ instanceKlassKlass::allocate_instance_klass(Symbol* name, int vtable_len, int it ik->set_static_field_size(static_field_size); ik->set_nonstatic_oop_map_size(nonstatic_oop_map_size); ik->set_access_flags(access_flags); + ik->set_is_anonymous(!host_klass.is_null()); assert(k()->size() == size, "wrong size for object"); ik->set_array_klasses(NULL); @@ -401,7 +419,6 @@ instanceKlassKlass::allocate_instance_klass(Symbol* name, int vtable_len, int it ik->set_constants(NULL); ik->set_class_loader(NULL); ik->set_protection_domain(NULL); - ik->set_host_klass(NULL); ik->set_signers(NULL); ik->set_source_file_name(NULL); ik->set_source_debug_extension(NULL); @@ -503,7 +520,9 @@ void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) { st->print(BULLET"constants: "); ik->constants()->print_value_on(st); st->cr(); st->print(BULLET"class loader: "); ik->class_loader()->print_value_on(st); st->cr(); st->print(BULLET"protection domain: "); ik->protection_domain()->print_value_on(st); st->cr(); - st->print(BULLET"host class: "); ik->host_klass()->print_value_on(st); st->cr(); + if (ik->host_klass() != NULL) { + st->print(BULLET"host class: "); ik->host_klass()->print_value_on(st); st->cr(); + } st->print(BULLET"signers: "); ik->signers()->print_value_on(st); st->cr(); if (ik->source_file_name() != NULL) { st->print(BULLET"source file: "); diff --git a/hotspot/src/share/vm/oops/instanceKlassKlass.hpp b/hotspot/src/share/vm/oops/instanceKlassKlass.hpp index ced9451da58..e360d134dbe 100644 --- a/hotspot/src/share/vm/oops/instanceKlassKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlassKlass.hpp @@ -48,6 +48,7 @@ class instanceKlassKlass : public klassKlass { unsigned int nonstatic_oop_map_count, AccessFlags access_flags, ReferenceType rt, + KlassHandle host_klass, TRAPS); // Casting from klassOop From 0705c620501d77c799d85433fdfd46719fa96f63 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Thu, 3 May 2012 18:29:00 +0400 Subject: [PATCH 07/73] 7160623: [macosx] Editable TextArea/TextField are blocking GUI applications from exit Reviewed-by: anthony, art --- .../macosx/classes/sun/lwawt/LWComponentPeer.java | 2 +- .../classes/sun/lwawt/LWTextComponentPeer.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java index a7b15e07c96..0b8b290f082 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -372,7 +372,7 @@ public abstract class LWComponentPeer } @Override - public void dispose() { + public final void dispose() { if (disposed.compareAndSet(false, true)) { disposeImpl(); } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java index 5884b119261..01de62b6c96 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java @@ -81,6 +81,18 @@ abstract class LWTextComponentPeer Date: Thu, 3 May 2012 19:22:38 +0400 Subject: [PATCH 08/73] 7124376: [macosx] Modal dialog lost focus Reviewed-by: anthony --- .../classes/sun/lwawt/LWWindowPeer.java | 2 + .../classes/sun/lwawt/PlatformWindow.java | 2 + .../lwawt/macosx/CPlatformEmbeddedFrame.java | 3 + .../sun/lwawt/macosx/CPlatformWindow.java | 10 +++ jdk/src/macosx/native/sun/awt/AWTView.m | 19 ++-- jdk/src/macosx/native/sun/awt/AWTWindow.h | 2 + jdk/src/macosx/native/sun/awt/AWTWindow.m | 86 +++++++++++++------ 7 files changed, 94 insertions(+), 30 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index 9e3796c7083..82d97c01aaa 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -409,6 +409,8 @@ public class LWWindowPeer synchronized (getPeerTreeLock()) { this.blocker = blocked ? (LWWindowPeer)blocker.getPeer() : null; } + + platformWindow.setModalBlocked(blocked); } @Override diff --git a/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java index 0d2a8083752..378dcab0329 100644 --- a/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java @@ -108,6 +108,8 @@ public interface PlatformWindow { public void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction); + public void setModalBlocked(boolean blocked); + public void toFront(); public void toBack(); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java index c355445ac83..cf9c455aba8 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java @@ -205,4 +205,7 @@ public class CPlatformEmbeddedFrame implements PlatformWindow { @Override public void setWindowState(int windowState) {} + + @Override + public void setModalBlocked(boolean blocked) {} } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 9f8c8f545d0..bfaab65d196 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -61,6 +61,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo private static native void nativeSetNSWindowMinimizedIcon(long nsWindowPtr, long nsImage); private static native void nativeSetNSWindowRepresentedFilename(long nsWindowPtr, String representedFilename); private static native void nativeSetNSWindowSecurityWarningPositioning(long nsWindowPtr, double x, double y, float biasX, float biasY); + private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled); private static native void nativeSynthesizeMouseEnteredExitedEvents(long nsWindowPtr); private static native int nativeGetScreenNSWindowIsOn_AppKitThread(long nsWindowPtr); @@ -800,6 +801,15 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo // value when the native notification comes to us } + @Override + public void setModalBlocked(boolean blocked) { + if (target.getModalExclusionType() == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) { + return; + } + + nativeSetEnabled(getNSWindowPtr(), !blocked); + } + // ---------------------------------------------------------------------- // UTILITY METHODS // ---------------------------------------------------------------------- diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index 896d05c4c72..4f3bae7933a 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -81,7 +81,7 @@ AWT_ASSERT_APPKIT_THREAD; fEnablePressAndHold = shouldUsePressAndHold(); fInPressAndHold = NO; fPAHNeedsToSelect = NO; - + mouseIsOver = NO; if (windowLayer != nil) { @@ -302,16 +302,25 @@ AWT_ASSERT_APPKIT_THREAD; */ -(void) deliverJavaMouseEvent: (NSEvent *) event { - - NSEventType type = [event type]; - + BOOL isEnabled = YES; + NSWindow* window = [self window]; + if ([window isKindOfClass: [AWTWindow class]]) { + isEnabled = [(AWTWindow*)window isEnabled]; + } + + if (!isEnabled) { + return; + } + + NSEventType type = [event type]; + // check synthesized mouse entered/exited events if ((type == NSMouseEntered && mouseIsOver) || (type == NSMouseExited && !mouseIsOver)) { return; }else if ((type == NSMouseEntered && !mouseIsOver) || (type == NSMouseExited && mouseIsOver)) { mouseIsOver = !mouseIsOver; } - + [AWTToolkit eventCountPlusPlus]; JNIEnv *env = [ThreadUtilities getJNIEnv]; diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.h b/jdk/src/macosx/native/sun/awt/AWTWindow.h index 58280927fbf..39863eef09e 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.h +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h @@ -42,6 +42,7 @@ NSSize javaMinSize; NSSize javaMaxSize; jint styleBits; + BOOL isEnabled; } @property (nonatomic, retain) JNFWeakJObjectWrapper *javaPlatformWindow; @@ -49,6 +50,7 @@ @property (nonatomic) NSSize javaMinSize; @property (nonatomic) NSSize javaMaxSize; @property (nonatomic) jint styleBits; +@property (nonatomic) BOOL isEnabled; - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow styleBits:(jint)styleBits diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m index 7add839f8e6..3fcf9f0cd65 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m @@ -58,6 +58,7 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow"); @synthesize javaMinSize; @synthesize javaMaxSize; @synthesize styleBits; +@synthesize isEnabled; - (void) updateMinMaxSize:(BOOL)resizable { if (resizable) { @@ -157,6 +158,7 @@ AWT_ASSERT_APPKIT_THREAD; if (self == nil) return nil; // no hope + self.isEnabled = YES; self.javaPlatformWindow = platformWindow; self.styleBits = bits; [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)]; @@ -170,22 +172,22 @@ AWT_ASSERT_APPKIT_THREAD; return self; } -// checks that this window is under the mouse cursor and this point is not overlapped by others windows +// checks that this window is under the mouse cursor and this point is not overlapped by others windows - (BOOL) isTopmostWindowUnderMouse { - - int currentWinID = [self windowNumber]; - - NSRect screenRect = [[NSScreen mainScreen] frame]; + + int currentWinID = [self windowNumber]; + + NSRect screenRect = [[NSScreen mainScreen] frame]; NSPoint nsMouseLocation = [NSEvent mouseLocation]; - CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y); - + CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y); + NSMutableArray *windows = (NSMutableArray *)CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID); - - + + for (NSDictionary *window in windows) { int layer = [[window objectForKey:(id)kCGWindowLayer] intValue]; if (layer == 0) { - int winID = [[window objectForKey:(id)kCGWindowNumber] intValue]; + int winID = [[window objectForKey:(id)kCGWindowNumber] intValue]; CGRect rect; CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect); if (CGRectContainsPoint(rect, cgMouseLocation)) { @@ -199,23 +201,23 @@ AWT_ASSERT_APPKIT_THREAD; } - (void) synthesizeMouseEnteredExitedEvents { - + int eventType = 0; BOOL isUnderMouse = [self isTopmostWindowUnderMouse]; BOOL mouseIsOver = [[self contentView] mouseIsOver]; - + if (isUnderMouse && !mouseIsOver) { eventType = NSMouseEntered; } else if (!isUnderMouse && mouseIsOver) { - eventType = NSMouseExited; + eventType = NSMouseExited; } else { return; } - - NSPoint screenLocation = [NSEvent mouseLocation]; - NSPoint windowLocation = [self convertScreenToBase: screenLocation]; + + NSPoint screenLocation = [NSEvent mouseLocation]; + NSPoint windowLocation = [self convertScreenToBase: screenLocation]; int modifierFlags = (eventType == NSMouseEntered) ? NSMouseEnteredMask : NSMouseExitedMask; - + NSEvent *mouseEvent = [NSEvent enterExitEventWithType: eventType location: windowLocation modifierFlags: modifierFlags @@ -226,7 +228,7 @@ AWT_ASSERT_APPKIT_THREAD; trackingNumber: 0 userData: nil ]; - + [[self contentView] deliverJavaMouseEvent: mouseEvent]; } @@ -239,16 +241,15 @@ AWT_ASSERT_APPKIT_THREAD; [super dealloc]; } - // NSWindow overrides - (BOOL) canBecomeKeyWindow { AWT_ASSERT_APPKIT_THREAD; - return IS(self.styleBits, SHOULD_BECOME_KEY); + return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_KEY); } - (BOOL) canBecomeMainWindow { AWT_ASSERT_APPKIT_THREAD; - return IS(self.styleBits, SHOULD_BECOME_MAIN); + return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_MAIN); } - (BOOL) worksWhenModal { @@ -562,6 +563,27 @@ AWT_ASSERT_APPKIT_THREAD; size->height = MAX(size->height, minHeight); } +- (void) setEnabled: (BOOL)flag { + self.isEnabled = flag; + + if (IS(self.styleBits, CLOSEABLE)) { + [[self standardWindowButton:NSWindowCloseButton] setEnabled: flag]; + } + + if (IS(self.styleBits, MINIMIZABLE)) { + [[self standardWindowButton:NSWindowMiniaturizeButton] setEnabled: flag]; + } + + if (IS(self.styleBits, ZOOMABLE)) { + [[self standardWindowButton:NSWindowZoomButton] setEnabled: flag]; + } + + if (IS(self.styleBits, RESIZABLE)) { + [self updateMinMaxSize:flag]; + [self setShowsResizeIndicator:flag]; + } +} + @end // AWTWindow @@ -729,7 +751,7 @@ AWT_ASSERT_NOT_APPKIT_THREAD; // ensure we repaint the whole window after the resize operation // (this will also re-enable screen updates, which were disabled above) // TODO: send PaintEvent - + [window synthesizeMouseEnteredExitedEvents]; }]; @@ -969,14 +991,14 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMou { JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - + AWTWindow *window = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - + [window synthesizeMouseEnteredExitedEvents]; }]; - + JNF_COCOA_EXIT(env); } @@ -1056,3 +1078,17 @@ JNF_COCOA_EXIT(env); return underMouse; } + +JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetEnabled +(JNIEnv *env, jclass clazz, jlong windowPtr, jboolean isEnabled) +{ +JNF_COCOA_ENTER(env); + + AWTWindow *window = OBJC(windowPtr); + [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ + [window setEnabled: isEnabled]; + }]; + +JNF_COCOA_EXIT(env); +} + From e3ab8ba856ce51b61f34e8cd8d892061a8d2f2c3 Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Thu, 3 May 2012 21:54:29 +0400 Subject: [PATCH 09/73] 7148289: [macosx] Deadlock in sun.lwawt.macosx.CWrapper$NSScreen.visibleFrame Reviewed-by: leonidr --- .../macosx/CToolkitThreadBlockedHandler.java | 7 ++-- .../classes/sun/lwawt/macosx/LWCToolkit.java | 4 +++ jdk/src/macosx/native/sun/awt/LWCToolkit.m | 34 +++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CToolkitThreadBlockedHandler.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CToolkitThreadBlockedHandler.java index 2d36a914122..95d15a8feaa 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CToolkitThreadBlockedHandler.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CToolkitThreadBlockedHandler.java @@ -27,9 +27,9 @@ package sun.lwawt.macosx; import sun.awt.datatransfer.ToolkitThreadBlockedHandler; -// TODO:BG this class is really a NOOP right now, but should be filled in if needed. - final class CToolkitThreadBlockedHandler implements ToolkitThreadBlockedHandler { + private final LWCToolkit toolkit = (LWCToolkit)java.awt.Toolkit.getDefaultToolkit(); + public void lock() { } @@ -41,9 +41,10 @@ final class CToolkitThreadBlockedHandler implements ToolkitThreadBlockedHandler } public void enter() { + toolkit.startNativeNestedEventLoop(); } public void exit() { + toolkit.stopNativeNestedEventLoop(); } - } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index 05c4ceeaec8..fa13d0ef675 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -63,6 +63,10 @@ public class LWCToolkit extends LWToolkit { private static native void initIDs(); + static native void startNativeNestedEventLoop(); + + static native void stopNativeNestedEventLoop(); + private static CInputMethodDescriptor sInputMethodDescriptor; static { diff --git a/jdk/src/macosx/native/sun/awt/LWCToolkit.m b/jdk/src/macosx/native/sun/awt/LWCToolkit.m index 8a95cd38d3d..173154a151c 100644 --- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m +++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m @@ -42,6 +42,7 @@ jint* gButtonDownMasks; @implementation AWTToolkit static long eventCount; +static bool shouldKeepRunningNestedLoop = NO; + (long) getEventCount{ return eventCount; @@ -456,3 +457,36 @@ Java_sun_font_FontManager_populateFontFileNameMap { } + +/* + * Class: sun_lwawt_macosx_LWCToolkit + * Method: startNativeNestedEventLoop + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_startNativeNestedEventLoop +(JNIEnv *env, jclass cls) +{ + if(!shouldKeepRunningNestedLoop) { + NSRunLoop *theRL = [NSRunLoop currentRunLoop]; + NSApplication * app = [NSApplication sharedApplication]; + shouldKeepRunningNestedLoop = YES; + while (shouldKeepRunningNestedLoop && [theRL runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]) + { + NSEvent * event = [app nextEventMatchingMask: 0xFFFFFFFF untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; + if (event != nil) { + [app sendEvent: event]; + } + } + } +} + +/* + * Class: sun_lwawt_macosx_LWCToolkit + * Method: stopNativeNestedEventLoop + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_stopNativeNestedEventLoop +(JNIEnv *env, jclass cls) +{ + shouldKeepRunningNestedLoop = NO; +} From 045ba7db6b247b4e9e639709851a3ca121c294a9 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Fri, 4 May 2012 13:15:49 +0400 Subject: [PATCH 10/73] 7024963: Notepad demo: remove non-translatable resources from Notepad.properties file Reviewed-by: rupashka --- jdk/src/share/demo/jfc/Notepad/Notepad.java | 250 ++++++------------ .../jfc/Notepad/resources/Notepad.properties | 30 --- .../jfc/Notepad/resources/system.properties | 12 + 3 files changed, 92 insertions(+), 200 deletions(-) create mode 100644 jdk/src/share/demo/jfc/Notepad/resources/system.properties diff --git a/jdk/src/share/demo/jfc/Notepad/Notepad.java b/jdk/src/share/demo/jfc/Notepad/Notepad.java index c80966920fb..d023dee7990 100644 --- a/jdk/src/share/demo/jfc/Notepad/Notepad.java +++ b/jdk/src/share/demo/jfc/Notepad/Notepad.java @@ -39,71 +39,18 @@ -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.FileDialog; -import java.awt.Font; -import java.awt.Frame; -import java.awt.Graphics; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Reader; -import java.io.Writer; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.StringTokenizer; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.JToolBar; -import javax.swing.JViewport; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.io.*; +import java.net.*; +import java.util.*; +import java.util.logging.*; +import javax.swing.*; +import javax.swing.undo.*; +import javax.swing.text.*; +import javax.swing.event.*; import javax.swing.UIManager.LookAndFeelInfo; -import javax.swing.event.UndoableEditEvent; -import javax.swing.event.UndoableEditListener; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import javax.swing.text.JTextComponent; -import javax.swing.text.PlainDocument; -import javax.swing.text.Segment; -import javax.swing.text.TextAction; -import javax.swing.undo.CannotRedoException; -import javax.swing.undo.CannotUndoException; -import javax.swing.undo.UndoManager; /** @@ -115,16 +62,27 @@ import javax.swing.undo.UndoManager; @SuppressWarnings("serial") class Notepad extends JPanel { + private static Properties properties; private static ResourceBundle resources; private final static String EXIT_AFTER_PAINT = "-exit"; private static boolean exitAfterFirstPaint; + private static final String[] MENUBAR_KEYS = {"file", "edit", "debug"}; + private static final String[] TOOLBAR_KEYS = {"new", "open", "save", "-", "cut", "copy", "paste"}; + private static final String[] FILE_KEYS = {"new", "open", "save", "-", "exit"}; + private static final String[] EDIT_KEYS = {"cut", "copy", "paste", "-", "undo", "redo"}; + private static final String[] DEBUG_KEYS = {"dump", "showElementTree"}; + static { try { + properties = new Properties(); + properties.load(Notepad.class.getResourceAsStream( + "resources/system.properties")); resources = ResourceBundle.getBundle("resources.Notepad", Locale.getDefault()); - } catch (MissingResourceException mre) { - System.err.println("resources/Notepad.properties not found"); + } catch (MissingResourceException | IOException e) { + System.err.println("resources/Notepad.properties " + + "or resources/system.properties not found"); System.exit(1); } } @@ -163,26 +121,22 @@ class Notepad extends JPanel { // install the command table commands = new HashMap(); Action[] actions = getActions(); - for (int i = 0; i < actions.length; i++) { - Action a = actions[i]; - //commands.put(a.getText(Action.NAME), a); + for (Action a : actions) { commands.put(a.getValue(Action.NAME), a); } JScrollPane scroller = new JScrollPane(); JViewport port = scroller.getViewport(); port.add(editor); - try { - String vpFlag = resources.getString("ViewportBackingStore"); + + String vpFlag = getProperty("ViewportBackingStore"); + if (vpFlag != null) { Boolean bs = Boolean.valueOf(vpFlag); - port.setScrollMode(bs.booleanValue() + port.setScrollMode(bs ? JViewport.BACKINGSTORE_SCROLL_MODE : JViewport.BLIT_SCROLL_MODE); - } catch (MissingResourceException ignored) { - // just use the viewport default } - menuItems = new HashMap(); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add("North", createToolbar()); @@ -191,31 +145,26 @@ class Notepad extends JPanel { add("South", createStatusbar()); } - public static void main(String[] args) { - try { - if (args.length > 0 && args[0].equals(EXIT_AFTER_PAINT)) { - exitAfterFirstPaint = true; - } - SwingUtilities.invokeAndWait(new Runnable() { - - public void run() { - JFrame frame = new JFrame(); - frame.setTitle(resources.getString("Title")); - frame.setBackground(Color.lightGray); - frame.getContentPane().setLayout(new BorderLayout()); - Notepad notepad = new Notepad(); - frame.getContentPane().add("Center", notepad); - frame.setJMenuBar(notepad.createMenubar()); - frame.addWindowListener(new AppCloser()); - frame.pack(); - frame.setSize(500, 600); - frame.setVisible(true); - } - }); - } catch (Throwable t) { - Logger.getLogger(Notepad.class.getName()).log(Level.SEVERE, - "uncaught exception", t); + public static void main(String[] args) throws Exception { + if (args.length > 0 && args[0].equals(EXIT_AFTER_PAINT)) { + exitAfterFirstPaint = true; } + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + JFrame frame = new JFrame(); + frame.setTitle(resources.getString("Title")); + frame.setBackground(Color.lightGray); + frame.getContentPane().setLayout(new BorderLayout()); + Notepad notepad = new Notepad(); + frame.getContentPane().add("Center", notepad); + frame.setJMenuBar(notepad.createMenubar()); + frame.addWindowListener(new AppCloser()); + frame.pack(); + frame.setSize(500, 600); + frame.setVisible(true); + } + }); } /** @@ -274,9 +223,7 @@ class Notepad extends JPanel { /** * This is the hook through which all menu items are - * created. It registers the result with the menuitem - * hashtable so that it can be fetched with getMenuItem(). - * @see #getMenuItem + * created. */ protected JMenuItem createMenuItem(String cmd) { JMenuItem mi = new JMenuItem(getResourceString(cmd + labelSuffix)); @@ -285,7 +232,7 @@ class Notepad extends JPanel { mi.setHorizontalTextPosition(JButton.RIGHT); mi.setIcon(new ImageIcon(url)); } - String astr = getResourceString(cmd + actionSuffix); + String astr = getProperty(cmd + actionSuffix); if (astr == null) { astr = cmd; } @@ -298,25 +245,17 @@ class Notepad extends JPanel { } else { mi.setEnabled(false); } - menuItems.put(cmd, mi); return mi; } - /** - * Fetch the menu item that was created for the given - * command. - * @param cmd Name of the action. - * @returns item created for the given command or null - * if one wasn't created. - */ - protected JMenuItem getMenuItem(String cmd) { - return menuItems.get(cmd); - } - protected Action getAction(String cmd) { return commands.get(cmd); } + protected String getProperty(String key) { + return properties.getProperty(key); + } + protected String getResourceString(String nm) { String str; try { @@ -330,20 +269,11 @@ class Notepad extends JPanel { protected URL getResource(String key) { String name = getResourceString(key); if (name != null) { - URL url = this.getClass().getResource(name); - return url; + return this.getClass().getResource(name); } return null; } - protected Container getToolbar() { - return toolbar; - } - - protected JMenuBar getMenubar() { - return menubar; - } - /** * Create a status bar */ @@ -368,12 +298,11 @@ class Notepad extends JPanel { */ private Component createToolbar() { toolbar = new JToolBar(); - String[] toolKeys = tokenize(getResourceString("toolbar")); - for (int i = 0; i < toolKeys.length; i++) { - if (toolKeys[i].equals("-")) { + for (String toolKey: TOOLBAR_KEYS) { + if (toolKey.equals("-")) { toolbar.add(Box.createHorizontalStrut(5)); } else { - toolbar.add(createTool(toolKeys[i])); + toolbar.add(createTool(toolKey)); } } toolbar.add(Box.createHorizontalGlue()); @@ -408,7 +337,7 @@ class Notepad extends JPanel { b.setRequestFocusEnabled(false); b.setMargin(new Insets(1, 1, 1, 1)); - String astr = getResourceString(key + actionSuffix); + String astr = getProperty(key + actionSuffix); if (astr == null) { astr = key; } @@ -428,44 +357,18 @@ class Notepad extends JPanel { return b; } - /** - * Take the given string and chop it up into a series - * of strings on whitespace boundaries. This is useful - * for trying to get an array of strings out of the - * resource file. - */ - protected String[] tokenize(String input) { - List v = new ArrayList(); - StringTokenizer t = new StringTokenizer(input); - String cmd[]; - - while (t.hasMoreTokens()) { - v.add(t.nextToken()); - } - cmd = new String[v.size()]; - for (int i = 0; i < cmd.length; i++) { - cmd[i] = v.get(i); - } - - return cmd; - } - /** * Create the menubar for the app. By default this pulls the * definition of the menu from the associated resource file. */ protected JMenuBar createMenubar() { - JMenuItem mi; JMenuBar mb = new JMenuBar(); - - String[] menuKeys = tokenize(getResourceString("menubar")); - for (int i = 0; i < menuKeys.length; i++) { - JMenu m = createMenu(menuKeys[i]); + for(String menuKey: MENUBAR_KEYS){ + JMenu m = createMenu(menuKey); if (m != null) { mb.add(m); } } - this.menubar = mb; return mb; } @@ -474,19 +377,32 @@ class Notepad extends JPanel { * definition of the menu from the associated resource file. */ protected JMenu createMenu(String key) { - String[] itemKeys = tokenize(getResourceString(key)); - JMenu menu = new JMenu(getResourceString(key + "Label")); - for (int i = 0; i < itemKeys.length; i++) { - if (itemKeys[i].equals("-")) { + JMenu menu = new JMenu(getResourceString(key + labelSuffix)); + for (String itemKey: getItemKeys(key)) { + if (itemKey.equals("-")) { menu.addSeparator(); } else { - JMenuItem mi = createMenuItem(itemKeys[i]); + JMenuItem mi = createMenuItem(itemKey); menu.add(mi); } } return menu; } + // get keys for menus + private String[] getItemKeys(String key) { + switch (key) { + case "file": + return FILE_KEYS; + case "edit": + return EDIT_KEYS; + case "debug": + return DEBUG_KEYS; + default: + return null; + } + } + // Yarked from JMenu, ideally this would be public. protected PropertyChangeListener createActionChangeListener(JMenuItem b) { return new ActionChangedListener(b); @@ -516,13 +432,11 @@ class Notepad extends JPanel { } private JTextComponent editor; private Map commands; - private Map menuItems; - private JMenuBar menubar; private JToolBar toolbar; private JComponent status; private JFrame elementTreeFrame; protected ElementTreePanel elementTreePanel; - protected FileDialog fileDialog; + /** * Listener for the edits on the current document. */ @@ -773,10 +687,6 @@ class Notepad extends JPanel { super(showElementTreeAction); } - ShowElementTreeAction(String nm) { - super(nm); - } - public void actionPerformed(ActionEvent e) { if (elementTreeFrame == null) { // Create a frame containing an instance of diff --git a/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties b/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties index ef61d6fd3c4..d43e350942c 100644 --- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties +++ b/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties @@ -3,16 +3,6 @@ Title=Notepad ElementTreeFrameTitle=Elements -# The following string should NOT be translated: ViewportBackingStore -ViewportBackingStore=false - -# menubar definition -# -# Each of the strings that follow form a key to be -# used to the actual menu definition. - -# The following string should NOT be translated: menubar -menubar=file edit debug # file Menu definition # @@ -24,8 +14,6 @@ menubar=file edit debug # save -> Notepad.saveAction # exit -> Notepad.exitAction -# The following string should NOT be translated: file -file=new open save - exit fileLabel=File openLabel=Open openImage=resources/open.gif @@ -42,38 +30,22 @@ exitLabel=Exit # copy -> JTextComponent.copyAction # paste -> JTextComponent.pasteAction -# The following string should NOT be translated: edit -edit=cut copy paste - undo redo editLabel=Edit cutLabel=Cut -# The following string should NOT be translated: cutAction -cutAction=cut-to-clipboard cutImage=resources/cut.gif copyLabel=Copy -# The following string should NOT be translated: copyAction -copyAction=copy-to-clipboard copyImage=resources/copy.gif pasteLabel=Paste -# The following string should NOT be translated: pasteAction -pasteAction=paste-from-clipboard pasteImage=resources/paste.gif undoLabel=Undo -# The following string should NOT be translated: undoAction -undoAction=Undo redoLabel=Redo -# The following string should NOT be translated: redoAction -redoAction=Redo # # debug Menu definition # -# The following string should NOT be translated: debug -debug=dump showElementTree debugLabel=Debug dumpLabel=Dump model to System.err -# The following string should NOT be translated: dumpAction -dumpAction=dump-model showElementTreeLabel=Show Elements # toolbar definition @@ -83,8 +55,6 @@ showElementTreeLabel=Show Elements # are of course sharable, and in this case are shared # with the menu items. -# The following string should NOT be translated: toolbar -toolbar=new open save - cut copy paste newTooltip=Create a new file openTooltip=Open a file saveTooltip=Save to a file diff --git a/jdk/src/share/demo/jfc/Notepad/resources/system.properties b/jdk/src/share/demo/jfc/Notepad/resources/system.properties new file mode 100644 index 00000000000..a6f8786d099 --- /dev/null +++ b/jdk/src/share/demo/jfc/Notepad/resources/system.properties @@ -0,0 +1,12 @@ +# +# Non-translatable properties for Notepad example + +ViewportBackingStore=false + +cutAction=cut-to-clipboard +copyAction=copy-to-clipboard +pasteAction=paste-from-clipboard +undoAction=Undo +redoAction=Redo +dumpAction=dump-model + From b963b0bcc405ec5ed27a99a454249535ce3421d0 Mon Sep 17 00:00:00 2001 From: Oleg Pekhovskiy Date: Fri, 4 May 2012 18:42:08 +0400 Subject: [PATCH 11/73] 7146237: closed/java/awt/Focus/SetFocusTraversalKeysTest/SetFocusTraversalTest.html failed since 1.8.0b19 Reviewed-by: art, anthony --- jdk/src/share/classes/java/awt/Component.java | 6 +- jdk/src/share/classes/java/awt/Container.java | 6 +- .../java/awt/KeyboardFocusManager.java | 89 +++++++++---------- .../share/classes/javax/swing/JComponent.java | 6 +- 4 files changed, 53 insertions(+), 54 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index 63fe2a80be9..00d363c1162 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -7169,6 +7169,9 @@ public abstract class Component implements ImageObserver, MenuContainer, * Set from its parent. If all ancestors of this Component have null * specified for the Set, then the current KeyboardFocusManager's default * Set is used. + *

+ * This method may throw a {@code ClassCastException} if any {@code Object} + * in {@code keystrokes} is not an {@code AWTKeyStroke}. * * @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or @@ -7182,8 +7185,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or if keystrokes - * contains null, or if any Object in keystrokes is not an - * AWTKeyStroke, or if any keystroke represents a KEY_TYPED event, + * contains null, or if any keystroke represents a KEY_TYPED event, * or if any keystroke already maps to another focus traversal * operation for this Component * @since 1.4 diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java index 03b0f7faa04..99cbdaff124 100644 --- a/jdk/src/share/classes/java/awt/Container.java +++ b/jdk/src/share/classes/java/awt/Container.java @@ -3093,6 +3093,9 @@ public class Container extends Component { * Set from its parent. If all ancestors of this Container have null * specified for the Set, then the current KeyboardFocusManager's default * Set is used. + *

+ * This method may throw a {@code ClassCastException} if any {@code Object} + * in {@code keystrokes} is not an {@code AWTKeyStroke}. * * @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, @@ -3109,8 +3112,7 @@ public class Container extends Component { * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or * KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, or if keystrokes - * contains null, or if any Object in keystrokes is not an - * AWTKeyStroke, or if any keystroke represents a KEY_TYPED event, + * contains null, or if any keystroke represents a KEY_TYPED event, * or if any keystroke already maps to another focus traversal * operation for this Container * @since 1.4 diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java index 3ccf5b70d36..7b8b9f41e25 100644 --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java @@ -991,12 +991,12 @@ public abstract class KeyboardFocusManager /** * Sets the default focus traversal keys for a given traversal operation. - * This traversal key Set will be in effect on all - * Windows that have no such Set of - * their own explicitly defined. This Set will also be - * inherited, recursively, by any child Component of - * those Windows that has - * no such Set of its own explicitly defined. + * This traversal key {@code Set} will be in effect on all + * {@code Window}s that have no such {@code Set} of + * their own explicitly defined. This {@code Set} will also be + * inherited, recursively, by any child {@code Component} of + * those {@code Windows} that has + * no such {@code Set} of its own explicitly defined. *

* The default values for the default focus traversal keys are * implementation-dependent. Sun recommends that all implementations for a @@ -1011,66 +1011,67 @@ public abstract class KeyboardFocusManager * Default * * - * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS + * {@code KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS} * Normal forward keyboard traversal - * TAB on KEY_PRESSED, - * CTRL-TAB on KEY_PRESSED + * {@code TAB} on {@code KEY_PRESSED}, + * {@code CTRL-TAB} on {@code KEY_PRESSED} * * - * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS + * {@code KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS} * Normal reverse keyboard traversal - * SHIFT-TAB on KEY_PRESSED, - * CTRL-SHIFT-TAB on KEY_PRESSED + * {@code SHIFT-TAB} on {@code KEY_PRESSED}, + * {@code CTRL-SHIFT-TAB} on {@code KEY_PRESSED} * * - * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS + * {@code KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS} * Go up one focus traversal cycle * none * * - * KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS + * {@code KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS} * Go down one focus traversal cycle * none * * * - * To disable a traversal key, use an empty Set; - * Collections.EMPTY_SET is recommended. + * To disable a traversal key, use an empty {@code Set}; + * {@code Collections.EMPTY_SET} is recommended. *

- * Using the AWTKeyStroke API, client code can + * Using the {@code AWTKeyStroke} API, client code can * specify on which of two - * specific KeyEvents, KEY_PRESSED or - * KEY_RELEASED, the focus traversal operation will - * occur. Regardless of which KeyEvent is specified, - * however, all KeyEvents related to the focus - * traversal key, including the associated KEY_TYPED + * specific {@code KeyEvent}s, {@code KEY_PRESSED} or + * {@code KEY_RELEASED}, the focus traversal operation will + * occur. Regardless of which {@code KeyEvent} is specified, + * however, all {@code KeyEvent}s related to the focus + * traversal key, including the associated {@code KEY_TYPED} * event, will be consumed, and will not be dispatched - * to any Component. It is a runtime error to - * specify a KEY_TYPED event as + * to any {@code Component}. It is a runtime error to + * specify a {@code KEY_TYPED} event as * mapping to a focus traversal operation, or to map the same event to * multiple default focus traversal operations. + *

+ * This method may throw a {@code ClassCastException} if any {@code Object} + * in {@code keystrokes} is not an {@code AWTKeyStroke}. * * @param id one of - * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, - * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, - * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or - * KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS - * @param keystrokes the Set of AWTKeyStrokes for the + * {@code KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS}, + * {@code KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}, + * {@code KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}, or + * {@code KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS} + * @param keystrokes the Set of {@code AWTKeyStroke}s for the * specified operation * @see #getDefaultFocusTraversalKeys * @see Component#setFocusTraversalKeys * @see Component#getFocusTraversalKeys * @throws IllegalArgumentException if id is not one of - * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, - * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, - * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or - * KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, - * or if keystrokes is null, - * or if keystrokes contains null, - * or if any Object in - * keystrokes is not an AWTKeyStroke, + * {@code KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS}, + * {@code KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}, + * {@code KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}, or + * {@code KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS}, + * or if keystrokes is {@code null}, + * or if keystrokes contains {@code null}, * or if any keystroke - * represents a KEY_TYPED event, + * represents a {@code KEY_TYPED} event, * or if any keystroke already maps * to another default focus traversal operation * @beaninfo @@ -1090,20 +1091,12 @@ public abstract class KeyboardFocusManager Set oldKeys; synchronized (this) { - for (Iterator iter = keystrokes.iterator(); iter.hasNext(); ) { - Object obj = iter.next(); + for (AWTKeyStroke keystroke : keystrokes) { - if (obj == null) { + if (keystroke == null) { throw new IllegalArgumentException("cannot set null focus traversal key"); } - // Fix for 6195831: - //According to javadoc this method should throw IAE instead of ClassCastException - if (!(obj instanceof AWTKeyStroke)) { - throw new IllegalArgumentException("object is expected to be AWTKeyStroke"); - } - AWTKeyStroke keystroke = (AWTKeyStroke)obj; - if (keystroke.getKeyChar() != KeyEvent.CHAR_UNDEFINED) { throw new IllegalArgumentException("focus traversal keys cannot map to KEY_TYPED events"); } diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java index 78bc5c4f648..83f88bfbfdc 100644 --- a/jdk/src/share/classes/javax/swing/JComponent.java +++ b/jdk/src/share/classes/javax/swing/JComponent.java @@ -4148,6 +4148,9 @@ public abstract class JComponent extends Container implements Serializable, * Refer to * {@link java.awt.Component#setFocusTraversalKeys} * for a complete description of this method. + *

+ * This method may throw a {@code ClassCastException} if any {@code Object} + * in {@code keystrokes} is not an {@code AWTKeyStroke}. * * @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or @@ -4160,8 +4163,7 @@ public abstract class JComponent extends Container implements Serializable, * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or if keystrokes - * contains null, or if any Object in keystrokes is not an - * AWTKeyStroke, or if any keystroke represents a KEY_TYPED event, + * contains null, or if any keystroke represents a KEY_TYPED event, * or if any keystroke already maps to another focus traversal * operation for this Component * @since 1.5 From 324e987e82197c1043b57846e0a7c4f122e1a82d Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Fri, 4 May 2012 07:55:51 -0700 Subject: [PATCH 12/73] 7166010: (javac) JavacMessager incorrectly restores log source file Reviewed-by: jjg --- .../tools/javac/processing/JavacMessager.java | 6 +- .../processing/messager/MessagerDiags.java | 131 ++++++++++++++++++ 2 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 langtools/test/tools/javac/processing/messager/MessagerDiags.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java index eeeb0953609..bc6acc1a096 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -99,6 +99,7 @@ public class JavacMessager implements Messager { if (treeTop != null) { newSource = treeTop.snd.sourcefile; if (newSource != null) { + // save the old version and reinstate it later oldSource = log.useSource(newSource); pos = treeTop.fst.pos(); } @@ -131,7 +132,8 @@ public class JavacMessager implements Messager { break; } } finally { - if (oldSource != null) + // reinstate the saved version, only if it was saved earlier + if (newSource != null) log.useSource(oldSource); } } diff --git a/langtools/test/tools/javac/processing/messager/MessagerDiags.java b/langtools/test/tools/javac/processing/messager/MessagerDiags.java new file mode 100644 index 00000000000..6f333a36090 --- /dev/null +++ b/langtools/test/tools/javac/processing/messager/MessagerDiags.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7166010 + * @summary warnings printed by annotation processors uses incorrect source + */ +import com.sun.source.util.JavacTask; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.Messager; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; +import javax.annotation.processing.SupportedSourceVersion; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Element; +import javax.lang.model.element.TypeElement; +import javax.tools.Diagnostic; +import javax.tools.DiagnosticCollector; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.ToolProvider; + +import static javax.tools.Diagnostic.Kind.*; +import static javax.tools.JavaFileObject.Kind.*; + +@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedAnnotationTypes("*") +public class MessagerDiags extends AbstractProcessor { + static final String CNAME = "Test"; + static final String TEST_JAVA = CNAME + ".java"; + static final String TEST_JAVA_URI_NAME = "myfo:/" + TEST_JAVA; + static final String WRN_NO_SOURCE = "warning without source"; + static final String WRN_WITH_SOURCE = "warning with source"; + static final String NONE = ""; + static final String[] EXPECTED = { NONE + ":-1--1:" + WRN_NO_SOURCE, + TEST_JAVA + ":0-13:" + WRN_WITH_SOURCE, + NONE + ":-1--1:" + WRN_NO_SOURCE + }; + + @Override + public boolean process(Set annotations, + RoundEnvironment roundEnv) { + Messager messager = processingEnv.getMessager(); + for (Element e : roundEnv.getRootElements()) { + messager.printMessage(WARNING, WRN_NO_SOURCE); + messager.printMessage(WARNING, WRN_WITH_SOURCE, e); + messager.printMessage(WARNING, WRN_NO_SOURCE); + } + return false; + } + + public static void main(String... args) throws IOException { + final String bootPath = System.getProperty("sun.boot.class.path"); + final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); + assert tool != null; + + DiagnosticCollector dc = new DiagnosticCollector<>(); + List options = new LinkedList<>(); + options.addAll(Arrays.asList("-bootclasspath", bootPath, + "-source", "1.6", "-classpath", + System.getProperty("java.class.path"))); + options.addAll(Arrays.asList("-processor", + MessagerDiags.class.getName())); + JavacTask ct = (JavacTask)tool.getTask(null, null, dc, options, null, + Arrays.asList(new MyFileObject("class " + CNAME + " {}"))); + ct.analyze(); + + List obtainedErrors = new ArrayList<>(); + + for (Diagnostic d : dc.getDiagnostics()) { + String dSource; + if (d.getSource() != null) { + dSource = d.getSource().toUri().getPath(); + dSource = dSource.substring(dSource.lastIndexOf('/') + 1); + } else { + dSource = NONE; + } + obtainedErrors.add(dSource + ":" + d.getStartPosition() + "-" + + d.getEndPosition() + ":" + d.getMessage(null)); + } + List expectedErrors = Arrays.asList(EXPECTED); + if (!expectedErrors.equals(obtainedErrors)) { + System.err.println("Expected: " + expectedErrors); + System.err.println("Obtained: " + obtainedErrors); + throw new AssertionError("Messages don't match"); + } + } + + static class MyFileObject extends SimpleJavaFileObject { + private String text; + public MyFileObject(String text) { + super(URI.create(TEST_JAVA_URI_NAME), SOURCE); + this.text = text; + } + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return text; + } + } +} From bf549e93b93b1c0e0af3cf9e6517c7eb0b89aabb Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 4 May 2012 21:25:08 +0400 Subject: [PATCH 13/73] 7147055: [macosx] Cursors are changing over a blocked window; also blinking Reviewed-by: art, kizune --- jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java b/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java index 1c34353c7b9..de1b537856a 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java @@ -88,20 +88,20 @@ public abstract class LWCursorManager { } else { cursor = (c != null) ? c.getCursor() : null; } - // TODO: default cursor for modal blocked windows setCursor(cursor); } /** * Returns the first visible, enabled and showing component under cursor. + * Returns null for modal blocked windows. * * @param cursorPos Current cursor position. - * @return Component + * @return Component or null. */ private static final Component findComponent(final Point cursorPos) { final LWComponentPeer peer = LWWindowPeer.getPeerUnderCursor(); Component c = null; - if (peer != null) { + if (peer != null && peer.getWindowPeerOrSelf().getBlocker() == null) { c = peer.getTarget(); if (c instanceof Container) { final Point p = peer.getLocationOnScreen(); From ffd4d391444edc83cb317cbcf925ef4d97d6469d Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 4 May 2012 15:26:05 -0700 Subject: [PATCH 14/73] 7166615: new hotspot build - hs24-b10 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index 3f3c7dc92ca..dba5ab40734 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2011 HS_MAJOR_VER=24 HS_MINOR_VER=0 -HS_BUILD_NUMBER=09 +HS_BUILD_NUMBER=10 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 From 904f53db88d82b19fcc5eef5b671c11d5cc23b4f Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Mon, 7 May 2012 12:37:46 -0700 Subject: [PATCH 15/73] 7160610: Unknown Native Code compilation issue When constructing input vector use type of vector's operation which use it since element's sizes should match. Reviewed-by: never, twisti --- hotspot/src/share/vm/opto/superword.cpp | 18 ++--- .../test/compiler/7160610/Test7160610.java | 71 +++++++++++++++++++ 2 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 hotspot/test/compiler/7160610/Test7160610.java diff --git a/hotspot/src/share/vm/opto/superword.cpp b/hotspot/src/share/vm/opto/superword.cpp index d1d1e1cb91c..28c4cfe4153 100644 --- a/hotspot/src/share/vm/opto/superword.cpp +++ b/hotspot/src/share/vm/opto/superword.cpp @@ -1221,12 +1221,11 @@ Node* SuperWord::vector_opd(Node_List* p, int opd_idx) { return opd; // input is matching vector } assert(!opd->is_VectorStore(), "such vector is not expected here"); - // Convert scalar input to vector. Use p0's type because it's container - // maybe smaller than the operand's container. - const Type* opd_t = velt_type(!in_bb(opd) ? p0 : opd); - const Type* p0_t = velt_type(p0); - if (p0_t->higher_equal(opd_t)) opd_t = p0_t; - VectorNode* vn = VectorNode::scalar2vector(_phase->C, opd, vlen, opd_t); + // Convert scalar input to vector with the same number of elements as + // p0's vector. Use p0's type because size of operand's container in + // vector should match p0's size regardless operand's size. + const Type* p0_t = velt_type(p0); + VectorNode* vn = VectorNode::scalar2vector(_phase->C, opd, vlen, p0_t); _phase->_igvn.register_new_node_with_optimizer(vn); _phase->set_ctrl(vn, _phase->get_ctrl(opd)); @@ -1234,14 +1233,15 @@ Node* SuperWord::vector_opd(Node_List* p, int opd_idx) { } // Insert pack operation - const Type* opd_t = velt_type(!in_bb(opd) ? p0 : opd); - PackNode* pk = PackNode::make(_phase->C, opd, opd_t); + const Type* p0_t = velt_type(p0); + PackNode* pk = PackNode::make(_phase->C, opd, p0_t); + DEBUG_ONLY( const BasicType opd_bt = opd->bottom_type()->basic_type(); ) for (uint i = 1; i < vlen; i++) { Node* pi = p->at(i); Node* in = pi->in(opd_idx); assert(my_pack(in) == NULL, "Should already have been unpacked"); - assert(opd_t == velt_type(!in_bb(in) ? pi : in), "all same type"); + assert(opd_bt == in->bottom_type()->basic_type(), "all same type"); pk->add_opd(in); } _phase->_igvn.register_new_node_with_optimizer(pk); diff --git a/hotspot/test/compiler/7160610/Test7160610.java b/hotspot/test/compiler/7160610/Test7160610.java new file mode 100644 index 00000000000..62b2e6e14b9 --- /dev/null +++ b/hotspot/test/compiler/7160610/Test7160610.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 7160610 + * @summary Unknown Native Code compilation issue. + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill Test7160610 + */ + +public class Test7160610 { + private static final byte[] BYTE_ARRAY = new byte[7]; + private static int[] anIntArray1190 = new int[32768]; + private static int[] anIntArray1191 = new int[32768]; + + public static void main(String arg[]) { + int i = 256; + for(int j = BYTE_ARRAY[2]; j < anIntArray1190.length; j++) { + anIntArray1190[j] = BYTE_ARRAY[2]; + } + + for(int k = BYTE_ARRAY[2]; (k ^ BYTE_ARRAY[1]) > -5001; k++) { + int i1 = (int)(Math.random() * 128D * (double)i); + anIntArray1190[i1] = (int)(Math.random() * 256D); + } + + for(int l = BYTE_ARRAY[2]; (l ^ BYTE_ARRAY[1]) > -21; l++) { + for(int j1 = BYTE_ARRAY[0]; j1 < i + -BYTE_ARRAY[0]; j1++) { + for(int k1 = BYTE_ARRAY[0]; (k1 ^ BYTE_ARRAY[1]) > -128; k1++) { + int l1 = k1 - -(j1 << 0x26cb6487); + anIntArray1191[l1] = (anIntArray1190[l1 + -BYTE_ARRAY[0]] - -anIntArray1190[l1 - -BYTE_ARRAY[0]] - -anIntArray1190[-128 + l1] - -anIntArray1190[128 + l1]) / BYTE_ARRAY[6]; + } + } + int ai[] = anIntArray1190; + anIntArray1190 = anIntArray1191; + anIntArray1191 = ai; + } + } + + static { + BYTE_ARRAY[6] = 4; + BYTE_ARRAY[5] = 5; + BYTE_ARRAY[4] = 3; + BYTE_ARRAY[3] = 2; + BYTE_ARRAY[2] = 0; + BYTE_ARRAY[1] = -1; + BYTE_ARRAY[0] = 1; + } +} From 7ecd34e3687777821ed0712c19fee3017f6f1ef8 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Tue, 8 May 2012 15:47:04 -0700 Subject: [PATCH 16/73] 7167266: missing copyright notes in 3rd party code Add missing copyright notes to the regression test file. Reviewed-by: twisti, johnc --- hotspot/test/compiler/7070134/Stemmer.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hotspot/test/compiler/7070134/Stemmer.java b/hotspot/test/compiler/7070134/Stemmer.java index c7edb750643..49484f94f2b 100644 --- a/hotspot/test/compiler/7070134/Stemmer.java +++ b/hotspot/test/compiler/7070134/Stemmer.java @@ -13,7 +13,18 @@ Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14, no. 3, pp 130-137, - See also http://www.tartarus.org/~martin/PorterStemmer + http://www.tartarus.org/~martin/PorterStemmer + + The software is completely free for any purpose, unless notes at the head + of the program text indicates otherwise (which is rare). In any case, + the notes about licensing are never more restrictive than the BSD License. + + In every case where the software is not written by me (Martin Porter), + this licensing arrangement has been endorsed by the contributor, and it is + therefore unnecessary to ask the contributor again to confirm it. + + I have not asked any contributors (or their employers, if they have them) + for proofs that they have the right to distribute their software in this way. History: From efb4e7d77daba10bca70f69a3cac17b2cd6cc2b9 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Thu, 10 May 2012 11:27:10 +0200 Subject: [PATCH 17/73] 7167437: Can't build on linux without precompiled headers Reviewed-by: brutisso, mgerdin --- hotspot/src/share/vm/memory/space.hpp | 11 +++++++++-- hotspot/src/share/vm/memory/space.inline.hpp | 13 ------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp index 33b56cf0651..f81c293a4bf 100644 --- a/hotspot/src/share/vm/memory/space.hpp +++ b/hotspot/src/share/vm/memory/space.hpp @@ -880,10 +880,17 @@ class ContiguousSpace: public CompactibleSpace { void object_iterate_mem(MemRegion mr, UpwardsObjectClosure* cl); // iterates on objects up to the safe limit HeapWord* object_iterate_careful(ObjectClosureCareful* cl); - inline HeapWord* concurrent_iteration_safe_limit(); + HeapWord* concurrent_iteration_safe_limit() { + assert(_concurrent_iteration_safe_limit <= top(), + "_concurrent_iteration_safe_limit update missed"); + return _concurrent_iteration_safe_limit; + } // changes the safe limit, all objects from bottom() to the new // limit should be properly initialized - inline void set_concurrent_iteration_safe_limit(HeapWord* new_limit); + void set_concurrent_iteration_safe_limit(HeapWord* new_limit) { + assert(new_limit <= top(), "uninitialized objects in the safe range"); + _concurrent_iteration_safe_limit = new_limit; + } #ifndef SERIALGC // In support of parallel oop_iterate. diff --git a/hotspot/src/share/vm/memory/space.inline.hpp b/hotspot/src/share/vm/memory/space.inline.hpp index 7d62476a69a..07e6127230c 100644 --- a/hotspot/src/share/vm/memory/space.inline.hpp +++ b/hotspot/src/share/vm/memory/space.inline.hpp @@ -67,17 +67,4 @@ OffsetTableContigSpace::block_start_const(const void* p) const { return _offsets.block_start(p); } -inline HeapWord* ContiguousSpace::concurrent_iteration_safe_limit() -{ - assert(_concurrent_iteration_safe_limit <= top(), - "_concurrent_iteration_safe_limit update missed"); - return _concurrent_iteration_safe_limit; -} - -inline void ContiguousSpace::set_concurrent_iteration_safe_limit(HeapWord* new_limit) -{ - assert(new_limit <= top(), "uninitialized objects in the safe range"); - _concurrent_iteration_safe_limit = new_limit; -} - #endif // SHARE_VM_MEMORY_SPACE_INLINE_HPP From 831d61ffeec7508e99e67c7b2d6309e3d8c532e0 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Thu, 10 May 2012 14:16:34 +0200 Subject: [PATCH 18/73] 7167069: 6 VM flags crash the VM when queried via jinfo Added missing double format to Flag::print_as_flag() Reviewed-by: dholmes, stefank, coleenp --- hotspot/src/share/vm/runtime/globals.cpp | 2 + hotspot/test/runtime/7167069/PrintAsFlag.java | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 hotspot/test/runtime/7167069/PrintAsFlag.java diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp index 02d10573368..474090a2a4b 100644 --- a/hotspot/src/share/vm/runtime/globals.cpp +++ b/hotspot/src/share/vm/runtime/globals.cpp @@ -148,6 +148,8 @@ void Flag::print_as_flag(outputStream* st) { st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx()); } else if (is_uint64_t()) { st->print("-XX:%s=" UINT64_FORMAT, name, get_uint64_t()); + } else if (is_double()) { + st->print("-XX:%s=%f", name, get_double()); } else if (is_ccstr()) { st->print("-XX:%s=", name); const char* cp = get_ccstr(); diff --git a/hotspot/test/runtime/7167069/PrintAsFlag.java b/hotspot/test/runtime/7167069/PrintAsFlag.java new file mode 100644 index 00000000000..bf8747ec59d --- /dev/null +++ b/hotspot/test/runtime/7167069/PrintAsFlag.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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. + * + */ + +/* + * Note that in the run command below the only important flag is PrintCommandLineFlags. + * The others are just flags of all types; bool, intx, uintx, uint64_t, double and ccstr. + * + * @test PrintAsFlag + * @summary verify that Flag::print_as_flag() works correctly. This is used by "jinfo -flag" and -XX:+PrintCommandLineFlags. + * @run main/othervm -XX:+PrintCommandLineFlags -XX:-ShowMessageBoxOnError -XX:BiasedLockingStartupDelay=4000 -XX:ParallelGCThreads=4 -XX:MaxRAM=1G -XX:CMSSmallCoalSurplusPercent=1.05 -XX:ErrorFile="file" PrintAsFlag + */ + +public class PrintAsFlag { + public static void main(String... args) { + System.out.printf("Done"); + } +} From 5c5ce877e8cff2b83d772b6de8d1a130daf74eeb Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Thu, 10 May 2012 08:26:26 -0700 Subject: [PATCH 19/73] 7167593: Changed get_source.sh to allow for getting full oracle jdk repo forest Reviewed-by: erikj, asaha, chegar, sla, dholmes, mbykov, coleenp --- get_source.sh | 4 +-- make/scripts/hgforest.sh | 66 +++++++++++++++++++++++++++++++--------- 2 files changed, 53 insertions(+), 17 deletions(-) diff --git a/get_source.sh b/get_source.sh index bc609b3ee8d..24dca4aed48 100644 --- a/get_source.sh +++ b/get_source.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ # # Get clones of all nested repositories -sh ./make/scripts/hgforest.sh clone +sh ./make/scripts/hgforest.sh clone $* # Update all existing repositories to the latest sources sh ./make/scripts/hgforest.sh pull -u diff --git a/make/scripts/hgforest.sh b/make/scripts/hgforest.sh index 7834826d8eb..bca070be79f 100644 --- a/make/scripts/hgforest.sh +++ b/make/scripts/hgforest.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,8 @@ # # Shell script for a fast parallel forest command +command="$1" +pull_extra_base="$2" tmp=/tmp/forest.$$ rm -f -r ${tmp} @@ -35,40 +37,58 @@ trap 'rm -f -r ${tmp}' EXIT # Only look in specific locations for possible forests (avoids long searches) pull_default="" -if [ "$1" = "clone" -o "$1" = "fclone" ] ; then +repos="" +repos_extra="" +if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then subrepos="corba jaxp jaxws langtools jdk hotspot" if [ -f .hg/hgrc ] ; then pull_default=`hg paths default` + if [ "${pull_default}" = "" ] ; then + echo "ERROR: Need initial clone with 'hg paths default' defined" + exit 1 + fi fi if [ "${pull_default}" = "" ] ; then - echo "ERROR: Need initial clone with 'hg paths default' defined" + echo "ERROR: Need initial repository to use this script" exit 1 fi - repos="" for i in ${subrepos} ; do if [ ! -f ${i}/.hg/hgrc ] ; then repos="${repos} ${i}" fi done + if [ "${pull_extra_base}" != "" ] ; then + subrepos_extra="jdk/src/closed jdk/make/closed jdk/test/closed hotspot/src/closed hotspot/test/closed deploy install sponsors pubs" + pull_default_base=`echo ${pull_default} | sed -e 's@\(^.*://[^/]*\)/.*@\1@'` + pull_extra=`echo ${pull_default} | sed -e "s@${pull_default_base}@${pull_extra_base}@"` + for i in ${subrepos_extra} ; do + if [ ! -f ${i}/.hg/hgrc ] ; then + repos_extra="${repos_extra} ${i}" + fi + done + fi at_a_time=2 + # Any repos to deal with? + if [ "${repos}" = "" -a "${repos_extra}" = "" ] ; then + echo "No repositories to clone." + exit + fi else hgdirs=`ls -d ./.hg ./*/.hg ./*/*/.hg ./*/*/*/.hg ./*/*/*/*/.hg 2>/dev/null` # Derive repository names from the .hg directory locations - repos="" for i in ${hgdirs} ; do repos="${repos} `echo ${i} | sed -e 's@/.hg$@@'`" done at_a_time=8 + # Any repos to deal with? + if [ "${repos}" = "" ] ; then + echo "No repositories to process." + exit + fi fi -# Any repos to deal with? -if [ "${repos}" = "" ] ; then - echo "No repositories to process." - exit -fi - -# Echo out what repositories we will process -echo "# Repos: ${repos}" +# Echo out what repositories we will clone +echo "# Repos: ${repos} ${repos_extra}" # Run the supplied command on all repos in parallel, save output until end n=0 @@ -77,8 +97,8 @@ for i in ${repos} ; do n=`expr ${n} '+' 1` ( ( - if [ "$1" = "clone" -o "$1" = "fclone" ] ; then - cline="hg $* ${pull_default}/${i} ${i}" + if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then + cline="hg clone ${pull_default}/${i} ${i}" echo "# ${cline}" ( eval "${cline}" ) else @@ -92,6 +112,22 @@ for i in ${repos} ; do sleep 5 fi done +if [ "${repos_extra}" != "" ] ; then + for i in ${repos_extra} ; do + echo "Starting on ${i}" + n=`expr ${n} '+' 1` + ( + ( + cline="hg clone ${pull_extra}/${i} ${i}" + echo "# ${cline}" + ( eval "${cline}" ) + echo "# exit code $?" + ) > ${tmp}/repo.${n} 2>&1 ; cat ${tmp}/repo.${n} ) & + if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then + sleep 5 + fi + done +fi # Wait for all hg commands to complete wait From 9668994591df862ad66caebcea334c8e71029e4c Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Thu, 10 May 2012 20:05:12 +0400 Subject: [PATCH 20/73] 7080109: Dialog.show() lacks doPrivileged() to access system event queue Reviewed-by: art, anthony --- jdk/src/share/classes/java/awt/Dialog.java | 9 ++- .../ModalDialogPermission.java | 60 +++++++++++++++++++ .../Dialog/ModalDialogPermission/java.policy | 3 + 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 jdk/test/java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java create mode 100644 jdk/test/java/awt/Dialog/ModalDialogPermission/java.policy diff --git a/jdk/src/share/classes/java/awt/Dialog.java b/jdk/src/share/classes/java/awt/Dialog.java index a388c70e7f5..3faa9280abe 100644 --- a/jdk/src/share/classes/java/awt/Dialog.java +++ b/jdk/src/share/classes/java/awt/Dialog.java @@ -1037,7 +1037,7 @@ public class Dialog extends Window { predictedFocusOwner = getMostRecentFocusOwner(); if (conditionalShow(predictedFocusOwner, time)) { modalFilter = ModalEventFilter.createFilterForDialog(this); - Conditional cond = new Conditional() { + final Conditional cond = new Conditional() { @Override public boolean evaluate() { return windowClosingException == null; @@ -1067,7 +1067,12 @@ public class Dialog extends Window { modalityPushed(); try { - EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue(); + final EventQueue eventQueue = AccessController.doPrivileged( + new PrivilegedAction() { + public EventQueue run() { + return Toolkit.getDefaultToolkit().getSystemEventQueue(); + } + }); secondaryLoop = eventQueue.createSecondaryLoop(cond, modalFilter, 0); if (!secondaryLoop.enter()) { secondaryLoop = null; diff --git a/jdk/test/java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java b/jdk/test/java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java new file mode 100644 index 00000000000..5c6cfe2d40e --- /dev/null +++ b/jdk/test/java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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.Dialog; +import java.awt.Frame; +import java.util.Timer; +import java.util.TimerTask; + +/* + @test + @bug 7080109 + @summary Dialog.show() lacks doPrivileged() to access system event queue. + @author sergey.bylokhov@oracle.com: area=awt.dialog + @run main/othervm/policy=java.policy -Djava.security.manager ModalDialogPermission +*/ +public final class ModalDialogPermission { + + public static void main(final String[] args) { + Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + @Override + public void uncaughtException(final Thread t, final Throwable e) { + throw new RuntimeException(e); + } + }); + final Frame frame = new Frame(); + final Dialog dialog = new Dialog(frame, "ModalDialog", true); + final Timer t = new Timer(); + t.schedule(new TimerTask() { + + @Override + public void run() { + dialog.setVisible(false); + dialog.dispose(); + } + }, 3000L); + dialog.show(); + frame.dispose(); + t.cancel(); + } +} diff --git a/jdk/test/java/awt/Dialog/ModalDialogPermission/java.policy b/jdk/test/java/awt/Dialog/ModalDialogPermission/java.policy new file mode 100644 index 00000000000..d0a94d14263 --- /dev/null +++ b/jdk/test/java/awt/Dialog/ModalDialogPermission/java.policy @@ -0,0 +1,3 @@ +grant { + permission java.lang.RuntimePermission "setDefaultUncaughtExceptionHandler"; +}; From 927c948fb5ac9399ef016afcd18c0601ec3888cc Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 10 May 2012 10:24:54 -0700 Subject: [PATCH 21/73] Added tag jdk8-b38 for changeset ab7f1daeaf13 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 0494bf52131..7c912d85790 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -159,3 +159,4 @@ cc771d92284f71765eca14d6d08703c4af254c04 jdk8-b21 5285317ebb4e8e4f6d8d52b5616fa801e2ea844d jdk8-b35 6a6ba0a07f33d37a2f97b1107e60c6a9a69ec84d jdk8-b36 b2972095a4b1e2a97409b7c3df61f3b263a5ce14 jdk8-b37 +d939bd0ab13c16647ffa38cc4b64fb31b7d44e10 jdk8-b38 From 5784582da12caec804bd5d06447cc89efc93aea2 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 10 May 2012 10:24:56 -0700 Subject: [PATCH 22/73] Added tag jdk8-b38 for changeset 748373b1eae7 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 77f6215faa8..ec31f642407 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -159,3 +159,4 @@ e24c5cc8b0f7cc48374eef0f995838fb4823e0eb jdk8-b34 e3d735914edd0a621b16bb85417423f8e6af5d51 jdk8-b35 a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36 83fac66442cf680bb59ec9e3a71cc4729322b595 jdk8-b37 +b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38 From d75e89764eba632ef3229cf6ba8f04a72c9e5604 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 10 May 2012 10:25:00 -0700 Subject: [PATCH 23/73] Added tag jdk8-b38 for changeset dd5e885125b4 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 8022f29a6bb..f2e72fc0a5b 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -244,3 +244,4 @@ dff6e3459210f8dd0430b9b03ccc99280560da30 hs24-b08 50b4400ca1ecb2ac2fde35f5e53ec8f04b86be7f jdk8-b36 bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37 7d5ec8bf38d1b12e0e09ec381f10976b8beede3b hs24-b09 +637c3f5f068f88fb9ec9c5867341cf59fd5ebedc jdk8-b38 From 74f10135f50472e7e82294bdab147200ea0bc660 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 10 May 2012 10:25:08 -0700 Subject: [PATCH 24/73] Added tag jdk8-b38 for changeset 426adeeabf00 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 60e82724512..c8892c35ae6 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -159,3 +159,4 @@ f3244c1f04864d35c41fa8d13669faf4f65b81e2 jdk8-b28 e187f3ede64965dc2979df9a211107cd3d38eacb jdk8-b35 cfd288fe1d3e2b700838342e70d71d44ac991af5 jdk8-b36 90204bfab4e2bed402badcc997cbf8446ab5669f jdk8-b37 +5bbe0cb6f2f2d7ce292da77bf4fa9d618d770a78 jdk8-b38 From f592cd9eb6698037647c519fd03723acf797eb8c Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 10 May 2012 10:25:09 -0700 Subject: [PATCH 25/73] Added tag jdk8-b38 for changeset b03bb9688c69 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 30267c2eada..6513a494ea2 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -159,3 +159,4 @@ f1d020a49c8c33667fb10c8caa255206a78a3675 jdk8-b34 e8afc16522e190cb93c66bcb15d6fba0fe9e6833 jdk8-b35 89b36c658e39f0a2957be55453a3a3befd9c8a6b jdk8-b36 b05a948db1b6c933c980f24e4dc8fd897b7cf4ef jdk8-b37 +ac1ba3b56775e3cdcd91b7a48793b59f6a3c18b5 jdk8-b38 From f36f12f54e3a4bb84b9f50abfdf1085e9a6054bc Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 10 May 2012 10:25:25 -0700 Subject: [PATCH 26/73] Added tag jdk8-b38 for changeset 8bf61a6c4a22 --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 82ba71bc3fc..e3d8e553653 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -159,3 +159,4 @@ be069d72dde2bfe6f996c46325a320961ca854c2 jdk8-b32 defd666a786334465496c8901fa302b779c7e045 jdk8-b35 94bbaa67686f44a124cd16fd9f1e8a6a3f684d2d jdk8-b36 5891b38985e8b2502296fc29e726b527d03116d2 jdk8-b37 +1f224f160aa852c9541380735a27a3439dfb7217 jdk8-b38 From 9feb7f3e15b66062df366c4c99059924e67ed902 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Thu, 10 May 2012 12:32:58 -0700 Subject: [PATCH 27/73] 7159445: (javac) emits inaccurate diagnostics for enhanced for-loops Reviewed-by: jjg --- .../sun/tools/javac/parser/JavacParser.java | 9 ++++-- .../tools/javac/resources/compiler.properties | 4 +++ .../examples/ForeachBadInitialization.java | 31 +++++++++++++++++++ .../tools/javac/parser/JavacParserTest.java | 9 ++++-- 4 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 langtools/test/tools/javac/diags/examples/ForeachBadInitialization.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java index 9e74b71c61c..dfde7b19bd3 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -2206,10 +2206,15 @@ public class JavacParser implements Parser { } else { JCExpression t = term(EXPR | TYPE); if ((lastmode & TYPE) != 0 && - (token.kind == IDENTIFIER || token.kind == ASSERT || token.kind == ENUM)) + (token.kind == IDENTIFIER || token.kind == ASSERT || + token.kind == ENUM)) { return variableDeclarators(modifiersOpt(), t, stats).toList(); - else + } else if ((lastmode & TYPE) != 0 && token.kind == COLON) { + error(pos, "bad.initializer", "for-loop"); + return List.of((JCStatement)F.at(pos).VarDef(null, null, t, null)); + } else { return moreStatementExpressions(pos, t, stats).toList(); + } } } diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties index 96e9e3f41ce..5ccfb341cf0 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -137,6 +137,10 @@ compiler.err.array.req.but.found=\ compiler.err.attribute.value.must.be.constant=\ attribute value must be constant +# 0: statement type +compiler.err.bad.initializer=\ + bad initializer for {0} + compiler.err.break.outside.switch.loop=\ break outside switch or loop diff --git a/langtools/test/tools/javac/diags/examples/ForeachBadInitialization.java b/langtools/test/tools/javac/diags/examples/ForeachBadInitialization.java new file mode 100644 index 00000000000..5a90de10933 --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/ForeachBadInitialization.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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. + */ + +// key: compiler.err.bad.initializer +import java.util.List; +class ForeachBadInitialization { + void m() { + List s = null; + for (a : s) {} + } +} diff --git a/langtools/test/tools/javac/parser/JavacParserTest.java b/langtools/test/tools/javac/parser/JavacParserTest.java index c297556fa78..e5a3e350350 100644 --- a/langtools/test/tools/javac/parser/JavacParserTest.java +++ b/langtools/test/tools/javac/parser/JavacParserTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7073631 + * @bug 7073631 7159445 * @summary tests error and diagnostics positions * @author Jan Lahoda */ @@ -875,6 +875,7 @@ public class JavacParserTest extends TestCase { testMissingClassError(); testSwitchError(); testMethodError(); + testErrorRecoveryForEnhancedForLoop142381(); } public static void main(String... args) throws IOException { @@ -892,8 +893,10 @@ abstract class TestCase { } } - void assertFalse(String message, boolean empty) { - throw new UnsupportedOperationException("Not yet implemented"); + void assertFalse(String message, boolean bvalue) { + if (bvalue == true) { + fail(message); + } } void assertEquals(String message, int i, long l) { From 50d1683efd10a5bcc0f80296d7562a42d9cda2f0 Mon Sep 17 00:00:00 2001 From: Anthony Petrov Date: Fri, 11 May 2012 16:11:17 +0400 Subject: [PATCH 28/73] 7166437: [macosx] Support for Window.Type.UTILITY on the Mac Apply the native UTILITY style for UTILITY Java windows Reviewed-by: art --- jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index bfaab65d196..efad23e636e 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -312,6 +312,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo styleBits = SET(styleBits, NONACTIVATING, true); } + if (Window.Type.UTILITY.equals(target.getType())) { + styleBits = SET(styleBits, UTILITY, true); + } + if (target instanceof javax.swing.RootPaneContainer) { javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane(); Object prop = null; From 817ad87a289c96534f65df9aa548d86de402754b Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Fri, 11 May 2012 20:06:00 +0530 Subject: [PATCH 29/73] 7166990: java/compiler Inherited interfaces using generics sometimes looses the generic type Reviewed-by: mcimadamore --- .../com/sun/tools/javac/comp/Lower.java | 5 +++ .../javac/TryWithResources/T7164542.java | 44 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 langtools/test/tools/javac/TryWithResources/T7164542.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java index 5acdc2640bc..07e0c7184cb 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java @@ -1606,6 +1606,11 @@ public class Lower extends TreeTranslator { } private JCStatement makeResourceCloseInvocation(JCExpression resource) { + // convert to AutoCloseable if needed + if (types.asSuper(resource.type, syms.autoCloseableType.tsym) == null) { + resource = (JCExpression) convert(resource, syms.autoCloseableType); + } + // create resource.close() method invocation JCExpression resourceClose = makeCall(resource, names.close, diff --git a/langtools/test/tools/javac/TryWithResources/T7164542.java b/langtools/test/tools/javac/TryWithResources/T7164542.java new file mode 100644 index 00000000000..9e3f2c16731 --- /dev/null +++ b/langtools/test/tools/javac/TryWithResources/T7164542.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 7164542 + * @summary try-with-resources: problem with intersection types + * @compile T7164542.java + */ + +public class T7164542 { + public static + void copy(S s, T t, int size) throws Exception { + /* + * compiler used to fail here with: + * symbol: method close() + * location: interface Readable + * Fatal Error: Unable to find method close + */ + try (S src = s; T trg = t) { + } + } +} From 101d88a6550f25f42e4f7b96307da9f29106db34 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 11 May 2012 08:21:30 -0700 Subject: [PATCH 30/73] 7168208: Change use of @ in one sed command involving paths to different character Reviewed-by: ohair --- jdk/make/common/Release.gmk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/make/common/Release.gmk b/jdk/make/common/Release.gmk index d8ec1b713d7..6143e261774 100644 --- a/jdk/make/common/Release.gmk +++ b/jdk/make/common/Release.gmk @@ -1311,8 +1311,8 @@ $(TEMP_PREV_JDK_COMPARISON): install-previous-jdk $(DIRDIFF_JARFILE) @$(java-vm-cleanup) # Clean up names in the messages printed out -CAT_FILTER = $(SED) -e "s@$(JDK_IMAGE_DIR)@JDK_IMAGE@g" \ - -e "s@$(JRE_IMAGE_DIR)@JRE_IMAGE@g" +CAT_FILTER = $(SED) -e "s|$(JDK_IMAGE_DIR)|JDK_IMAGE|g" \ + -e "s|$(JRE_IMAGE_DIR)|JRE_IMAGE|g" # Report on the jre image comparison compare-image-jre: $(TEMP_PREV_JRE_COMPARISON) From 9d4ac4c18868a705329ceca03a00c930a7053d95 Mon Sep 17 00:00:00 2001 From: Anthony Petrov Date: Fri, 11 May 2012 20:37:07 +0400 Subject: [PATCH 31/73] 7149062: [macosx] dock menu don't show available frames Inherit from either NSWindow for normal windows or NSPanel for utility windows Reviewed-by: skovatch, swingler --- jdk/src/macosx/native/sun/awt/AWTView.m | 4 +- jdk/src/macosx/native/sun/awt/AWTWindow.h | 27 ++- jdk/src/macosx/native/sun/awt/AWTWindow.m | 240 ++++++++++++++-------- 3 files changed, 186 insertions(+), 85 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index 4f3bae7933a..f737c4e8b87 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -304,8 +304,8 @@ AWT_ASSERT_APPKIT_THREAD; -(void) deliverJavaMouseEvent: (NSEvent *) event { BOOL isEnabled = YES; NSWindow* window = [self window]; - if ([window isKindOfClass: [AWTWindow class]]) { - isEnabled = [(AWTWindow*)window isEnabled]; + if ([window isKindOfClass: [AWTWindow_Panel class]] || [window isKindOfClass: [AWTWindow_Normal class]]) { + isEnabled = [(AWTWindow*)[window delegate] isEnabled]; } if (!isEnabled) { diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.h b/jdk/src/macosx/native/sun/awt/AWTWindow.h index 39863eef09e..b350913196d 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.h +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h @@ -35,7 +35,7 @@ @class AWTView; -@interface AWTWindow : NSPanel { +@interface AWTWindow : NSObject { @private JNFWeakJObjectWrapper *javaPlatformWindow; CMenuBar *javaMenuBar; @@ -45,6 +45,9 @@ BOOL isEnabled; } +// An instance of either AWTWindow_Normal or AWTWindow_Panel +@property (nonatomic, retain) NSWindow *nsWindow; + @property (nonatomic, retain) JNFWeakJObjectWrapper *javaPlatformWindow; @property (nonatomic, retain) CMenuBar *javaMenuBar; @property (nonatomic) NSSize javaMinSize; @@ -57,8 +60,28 @@ frameRect:(NSRect)frameRect contentView:(NSView *)contentView; -- (void) adjustGrowBoxWindow; - (BOOL) isTopmostWindowUnderMouse; + +// NSWindow overrides delegate methods +- (BOOL) canBecomeKeyWindow; +- (BOOL) canBecomeMainWindow; +- (BOOL) worksWhenModal; +- (void)sendEvent:(NSEvent *)event; + +@end + +@interface AWTWindow_Normal : NSWindow +- (id) initWithDelegate:(AWTWindow *)delegate + frameRect:(NSRect)rect + styleMask:(NSUInteger)styleMask + contentView:(NSView *)view; +@end + +@interface AWTWindow_Panel : NSPanel +- (id) initWithDelegate:(AWTWindow *)delegate + frameRect:(NSRect)rect + styleMask:(NSUInteger)styleMask + contentView:(NSView *)view; @end #endif _AWTWINDOW_H diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m index 3fcf9f0cd65..5f570a752cc 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m @@ -51,8 +51,61 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow"); +// -------------------------------------------------------------- +// NSWindow/NSPanel descendants implementation +#define AWT_NS_WINDOW_IMPLEMENTATION \ +- (id) initWithDelegate:(AWTWindow *)delegate \ + frameRect:(NSRect)contectRect \ + styleMask:(NSUInteger)styleMask \ + contentView:(NSView *)view \ +{ \ + self = [super initWithContentRect:contectRect \ + styleMask:styleMask \ + backing:NSBackingStoreBuffered \ + defer:NO]; \ + \ + if (self == nil) return nil; \ + \ + [self setDelegate:delegate]; \ + [self setContentView:view]; \ + [self setInitialFirstResponder:view]; \ + [self setReleasedWhenClosed:NO]; \ + [self setPreservesContentDuringLiveResize:YES]; \ + \ + return self; \ +} \ + \ +/* NSWindow overrides */ \ +- (BOOL) canBecomeKeyWindow { \ + return [(AWTWindow*)[self delegate] canBecomeKeyWindow]; \ +} \ + \ +- (BOOL) canBecomeMainWindow { \ + return [(AWTWindow*)[self delegate] canBecomeMainWindow]; \ +} \ + \ +- (BOOL) worksWhenModal { \ + return [(AWTWindow*)[self delegate] worksWhenModal]; \ +} \ + \ +- (void)sendEvent:(NSEvent *)event { \ + [(AWTWindow*)[self delegate] sendEvent:event]; \ + [super sendEvent:event]; \ +} + +@implementation AWTWindow_Normal +AWT_NS_WINDOW_IMPLEMENTATION +@end +@implementation AWTWindow_Panel +AWT_NS_WINDOW_IMPLEMENTATION +@end +// END of NSWindow/NSPanel descendants implementation +// -------------------------------------------------------------- + + @implementation AWTWindow +@synthesize nsWindow; @synthesize javaPlatformWindow; @synthesize javaMenuBar; @synthesize javaMinSize; @@ -62,12 +115,12 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow"); - (void) updateMinMaxSize:(BOOL)resizable { if (resizable) { - [self setMinSize:self.javaMinSize]; - [self setMaxSize:self.javaMaxSize]; + [self.nsWindow setMinSize:self.javaMinSize]; + [self.nsWindow setMaxSize:self.javaMaxSize]; } else { - NSRect currentFrame = [self frame]; - [self setMinSize:currentFrame.size]; - [self setMaxSize:currentFrame.size]; + NSRect currentFrame = [self.nsWindow frame]; + [self.nsWindow setMinSize:currentFrame.size]; + [self.nsWindow setMaxSize:currentFrame.size]; } } @@ -98,38 +151,38 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow"); if (IS(mask, RESIZABLE)) { BOOL resizable = IS(bits, RESIZABLE); [self updateMinMaxSize:resizable]; - [self setShowsResizeIndicator:resizable]; + [self.nsWindow setShowsResizeIndicator:resizable]; } if (IS(mask, HAS_SHADOW)) { - [self setHasShadow:IS(bits, HAS_SHADOW)]; + [self.nsWindow setHasShadow:IS(bits, HAS_SHADOW)]; } if (IS(mask, ZOOMABLE)) { - [[self standardWindowButton:NSWindowZoomButton] setEnabled:IS(bits, ZOOMABLE)]; + [[self.nsWindow standardWindowButton:NSWindowZoomButton] setEnabled:IS(bits, ZOOMABLE)]; } if (IS(mask, ALWAYS_ON_TOP)) { - [self setLevel:IS(bits, ALWAYS_ON_TOP) ? NSFloatingWindowLevel : NSNormalWindowLevel]; + [self.nsWindow setLevel:IS(bits, ALWAYS_ON_TOP) ? NSFloatingWindowLevel : NSNormalWindowLevel]; } if (IS(mask, HIDES_ON_DEACTIVATE)) { - [self setHidesOnDeactivate:IS(bits, HIDES_ON_DEACTIVATE)]; + [self.nsWindow setHidesOnDeactivate:IS(bits, HIDES_ON_DEACTIVATE)]; } if (IS(mask, DRAGGABLE_BACKGROUND)) { - [self setMovableByWindowBackground:IS(bits, DRAGGABLE_BACKGROUND)]; + [self.nsWindow setMovableByWindowBackground:IS(bits, DRAGGABLE_BACKGROUND)]; } if (IS(mask, DOCUMENT_MODIFIED)) { - [self setDocumentEdited:IS(bits, DOCUMENT_MODIFIED)]; + [self.nsWindow setDocumentEdited:IS(bits, DOCUMENT_MODIFIED)]; } - if ([self respondsToSelector:@selector(toggleFullScreen:)]) { + if ([self.nsWindow respondsToSelector:@selector(toggleFullScreen:)]) { if (IS(mask, FULLSCREENABLE)) { - [self setCollectionBehavior:(1 << 7) /*NSWindowCollectionBehaviorFullScreenPrimary*/]; + [self.nsWindow setCollectionBehavior:(1 << 7) /*NSWindowCollectionBehaviorFullScreenPrimary*/]; } else { - [self setCollectionBehavior:NSWindowCollectionBehaviorDefault]; + [self.nsWindow setCollectionBehavior:NSWindowCollectionBehaviorDefault]; } } @@ -151,31 +204,43 @@ AWT_ASSERT_APPKIT_THREAD; contentRect.size.height = 1.0; } - self = [super initWithContentRect:contentRect - styleMask:styleMask - backing:NSBackingStoreBuffered - defer:NO]; + self = [super init]; if (self == nil) return nil; // no hope + if (IS(bits, UTILITY) || + IS(bits, NONACTIVATING) || + IS(bits, HUD) || + IS(bits, HIDES_ON_DEACTIVATE)) + { + self.nsWindow = [[AWTWindow_Panel alloc] initWithDelegate:self + frameRect:contentRect + styleMask:styleMask + contentView:view]; + } + else + { + // These windows will appear in the window list in the dock icon menu + self.nsWindow = [[AWTWindow_Normal alloc] initWithDelegate:self + frameRect:contentRect + styleMask:styleMask + contentView:view]; + } + + if (self.nsWindow == nil) return nil; // no hope either + self.isEnabled = YES; self.javaPlatformWindow = platformWindow; self.styleBits = bits; [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)]; - [self setDelegate:self]; - [self setContentView:view]; - [self setInitialFirstResponder:view]; - [self setReleasedWhenClosed:NO]; - [self setPreservesContentDuringLiveResize:YES]; - return self; } // checks that this window is under the mouse cursor and this point is not overlapped by others windows - (BOOL) isTopmostWindowUnderMouse { - int currentWinID = [self windowNumber]; + int currentWinID = [self.nsWindow windowNumber]; NSRect screenRect = [[NSScreen mainScreen] frame]; NSPoint nsMouseLocation = [NSEvent mouseLocation]; @@ -204,7 +269,7 @@ AWT_ASSERT_APPKIT_THREAD; int eventType = 0; BOOL isUnderMouse = [self isTopmostWindowUnderMouse]; - BOOL mouseIsOver = [[self contentView] mouseIsOver]; + BOOL mouseIsOver = [[self.nsWindow contentView] mouseIsOver]; if (isUnderMouse && !mouseIsOver) { eventType = NSMouseEntered; @@ -215,21 +280,21 @@ AWT_ASSERT_APPKIT_THREAD; } NSPoint screenLocation = [NSEvent mouseLocation]; - NSPoint windowLocation = [self convertScreenToBase: screenLocation]; + NSPoint windowLocation = [self.nsWindow convertScreenToBase: screenLocation]; int modifierFlags = (eventType == NSMouseEntered) ? NSMouseEnteredMask : NSMouseExitedMask; NSEvent *mouseEvent = [NSEvent enterExitEventWithType: eventType location: windowLocation modifierFlags: modifierFlags timestamp: 0 - windowNumber: [self windowNumber] + windowNumber: [self.nsWindow windowNumber] context: nil eventNumber: 0 trackingNumber: 0 userData: nil ]; - [[self contentView] deliverJavaMouseEvent: mouseEvent]; + [[self.nsWindow contentView] deliverJavaMouseEvent: mouseEvent]; } - (void) dealloc { @@ -238,6 +303,8 @@ AWT_ASSERT_APPKIT_THREAD; JNIEnv *env = [ThreadUtilities getJNIEnv]; [self.javaPlatformWindow setJObject:nil withEnv:env]; + self.nsWindow = nil; + [super dealloc]; } @@ -271,7 +338,7 @@ AWT_ASSERT_APPKIT_THREAD; if (awtWindow != NULL) { // translate the point into Java coordinates NSPoint loc = [event locationInWindow]; - loc.y = [self frame].size.height - loc.y; + loc.y = [self.nsWindow frame].size.height - loc.y; // send up to the GestureHandler to recursively dispatch on the AWT event thread static JNF_CLASS_CACHE(jc_GestureHandler, "com/apple/eawt/event/GestureHandler"); @@ -334,7 +401,7 @@ AWT_ASSERT_APPKIT_THREAD; // TODO: create generic AWT assert } - NSRect frame = ConvertNSScreenRect(env, [self frame]); + NSRect frame = ConvertNSScreenRect(env, [self.nsWindow frame]); static JNF_MEMBER_CACHE(jm_deliverMoveResizeEvent, jc_CPlatformWindow, "deliverMoveResizeEvent", "(IIII)V"); JNFCallVoidMethod(env, platformWindow, jm_deliverMoveResizeEvent, @@ -524,8 +591,8 @@ AWT_ASSERT_APPKIT_THREAD; if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) { NSPoint p = [NSEvent mouseLocation]; - NSRect frame = [self frame]; - NSRect contentRect = [self contentRectForFrameRect:frame]; + NSRect frame = [self.nsWindow frame]; + NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame]; // Check if the click happened in the non-client area (title bar) if (p.y >= (frame.origin.y + contentRect.size.height)) { @@ -536,15 +603,14 @@ AWT_ASSERT_APPKIT_THREAD; JNFCallVoidMethod(env, platformWindow, jm_deliverNCMouseDown); } } - [super sendEvent:event]; } - (void)constrainSize:(NSSize*)size { float minWidth = 0.f, minHeight = 0.f; if (IS(self.styleBits, DECORATED)) { - NSRect frame = [self frame]; - NSRect contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[self styleMask]]; + NSRect frame = [self.nsWindow frame]; + NSRect contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[self.nsWindow styleMask]]; float top = frame.size.height - contentRect.size.height; float left = contentRect.origin.x - frame.origin.x; @@ -567,20 +633,20 @@ AWT_ASSERT_APPKIT_THREAD; self.isEnabled = flag; if (IS(self.styleBits, CLOSEABLE)) { - [[self standardWindowButton:NSWindowCloseButton] setEnabled: flag]; + [[self.nsWindow standardWindowButton:NSWindowCloseButton] setEnabled: flag]; } if (IS(self.styleBits, MINIMIZABLE)) { - [[self standardWindowButton:NSWindowMiniaturizeButton] setEnabled: flag]; + [[self.nsWindow standardWindowButton:NSWindowMiniaturizeButton] setEnabled: flag]; } if (IS(self.styleBits, ZOOMABLE)) { - [[self standardWindowButton:NSWindowZoomButton] setEnabled: flag]; + [[self.nsWindow standardWindowButton:NSWindowZoomButton] setEnabled: flag]; } if (IS(self.styleBits, RESIZABLE)) { [self updateMinMaxSize:flag]; - [self setShowsResizeIndicator:flag]; + [self.nsWindow setShowsResizeIndicator:flag]; } } @@ -618,7 +684,7 @@ AWT_ASSERT_NOT_APPKIT_THREAD; JNF_COCOA_EXIT(env); - return ptr_to_jlong(window); + return ptr_to_jlong(window ? window.nsWindow : nil); } /* @@ -632,17 +698,19 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowSt JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; + AWTWindow *window = (AWTWindow*)[nsWindow delegate]; + // scans the bit field, and only updates the values requested by the mask // (this implicity handles the _CALLBACK_PROP_BITMASK case, since those are passive reads) jint newBits = window.styleBits & ~mask | bits & mask; // resets the NSWindow's style mask if the mask intersects any of those bits if (mask & MASK(_STYLE_PROP_BITMASK)) { - [window setStyleMask:[AWTWindow styleMaskForStyleBits:newBits]]; + [nsWindow setStyleMask:[AWTWindow styleMaskForStyleBits:newBits]]; } // calls methods on NSWindow to change other properties, based on the mask @@ -667,12 +735,14 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowMe JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); CMenuBar *menuBar = OBJC(menuBarPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - if ([window isKeyWindow]) [window.javaMenuBar deactivate]; + AWTWindow *window = (AWTWindow*)[nsWindow delegate]; + + if ([nsWindow isKeyWindow]) [window.javaMenuBar deactivate]; window.javaMenuBar = menuBar; // if ([self isKeyWindow]) { @@ -696,15 +766,15 @@ JNIEXPORT jobject JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeGetNSWindo JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); __block NSRect contentRect = NSZeroRect; __block NSRect frame = NSZeroRect; [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - frame = [window frame]; - contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[window styleMask]]; + frame = [nsWindow frame]; + contentRect = [NSWindow contentRectForFrameRect:frame styleMask:[nsWindow styleMask]]; }]; jint top = (jint)(frame.size.height - contentRect.size.height); @@ -734,19 +804,21 @@ AWT_ASSERT_NOT_APPKIT_THREAD; NSRect jrect = NSMakeRect(originX, originY, width, height); // TODO: not sure we need displayIfNeeded message in our view - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; + AWTWindow *window = (AWTWindow*)[nsWindow delegate]; + NSRect rect = ConvertNSScreenRect(NULL, jrect); [window constrainSize:&rect.size]; - [window setFrame:rect display:YES]; + [nsWindow setFrame:rect display:YES]; // only start tracking events if pointer is above the toplevel // TODO: should post an Entered event if YES. NSPoint mLocation = [NSEvent mouseLocation]; - [window setAcceptsMouseMovedEvents:NSPointInRect(mLocation, rect)]; + [nsWindow setAcceptsMouseMovedEvents:NSPointInRect(mLocation, rect)]; // ensure we repaint the whole window after the resize operation // (this will also re-enable screen updates, which were disabled above) @@ -774,10 +846,12 @@ AWT_ASSERT_NOT_APPKIT_THREAD; if (maxW < 1) maxW = 1; if (maxH < 1) maxH = 1; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; + AWTWindow *window = (AWTWindow*)[nsWindow delegate]; + NSSize min = { minW, minH }; NSSize max = { maxW, maxH }; @@ -803,11 +877,11 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativePushNSWindowT JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - [window orderBack:nil]; + [nsWindow orderBack:nil]; }]; JNF_COCOA_EXIT(env); @@ -824,14 +898,14 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativePushNSWindowT JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - if (![window isKeyWindow]) { - [window makeKeyAndOrderFront:window]; + if (![nsWindow isKeyWindow]) { + [nsWindow makeKeyAndOrderFront:nsWindow]; } else { - [window orderFront:window]; + [nsWindow orderFront:nsWindow]; } }]; @@ -849,8 +923,8 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowTi JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); - [window performSelectorOnMainThread:@selector(setTitle:) + NSWindow *nsWindow = OBJC(windowPtr); + [nsWindow performSelectorOnMainThread:@selector(setTitle:) withObject:JNFJavaToNSString(env, jtitle) waitUntilDone:NO]; @@ -868,11 +942,11 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowAl JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - [window setAlphaValue:alpha]; + [nsWindow setAlphaValue:alpha]; }]; JNF_COCOA_EXIT(env); @@ -889,11 +963,11 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeRevalidateNSW JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - [window invalidateShadow]; + [nsWindow invalidateShadow]; }]; JNF_COCOA_EXIT(env); @@ -912,8 +986,8 @@ JNIEXPORT jint JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeScreenOn_1App JNF_COCOA_ENTER(env); AWT_ASSERT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); - NSDictionary *props = [[window screen] deviceDescription]; + NSWindow *nsWindow = OBJC(windowPtr); + NSDictionary *props = [[nsWindow screen] deviceDescription]; ret = [[props objectForKey:@"NSScreenNumber"] intValue]; JNF_COCOA_EXIT(env); @@ -932,12 +1006,12 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowMi JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); NSImage *image = OBJC(nsImagePtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - [window setMiniwindowImage:image]; + [nsWindow setMiniwindowImage:image]; }]; JNF_COCOA_EXIT(env); @@ -954,12 +1028,12 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowRe JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); NSURL *url = (filename == NULL) ? nil : [NSURL fileURLWithPath:JNFNormalizedNSStringForPath(env, filename)]; [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; - [window setRepresentedURL:url]; + [nsWindow setRepresentedURL:url]; }]; JNF_COCOA_EXIT(env); @@ -992,10 +1066,12 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMou JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ AWT_ASSERT_APPKIT_THREAD; + AWTWindow *window = (AWTWindow*)[nsWindow delegate]; + [window synthesizeMouseEnteredExitedEvents]; }]; @@ -1015,8 +1091,8 @@ JNIEXPORT jint JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeGetScreenNSWi JNF_COCOA_ENTER(env); AWT_ASSERT_APPKIT_THREAD; - AWTWindow *window = OBJC(windowPtr); - NSScreen* screen = [window screen]; + NSWindow *nsWindow = OBJC(windowPtr); + NSScreen* screen = [nsWindow screen]; //+++gdb NOTE: This is using a linear search of the screens. If it should // prove to be a bottleneck, this can definitely be improved. However, @@ -1047,12 +1123,12 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow__1toggleFullScreenM { JNF_COCOA_ENTER(env); - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); SEL toggleFullScreenSelector = @selector(toggleFullScreen:); - if (![window respondsToSelector:toggleFullScreenSelector]) return; + if (![nsWindow respondsToSelector:toggleFullScreenSelector]) return; [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ - [window performSelector:toggleFullScreenSelector withObject:nil]; + [nsWindow performSelector:toggleFullScreenSelector withObject:nil]; }]; JNF_COCOA_EXIT(env); @@ -1066,12 +1142,12 @@ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CMouseInfoPeer_nativeIsWindowUn JNF_COCOA_ENTER(env); AWT_ASSERT_NOT_APPKIT_THREAD; - AWTWindow *aWindow = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() { AWT_ASSERT_APPKIT_THREAD; - NSPoint pt = [aWindow mouseLocationOutsideOfEventStream]; - underMouse = [[aWindow contentView] hitTest:pt] != nil; + NSPoint pt = [nsWindow mouseLocationOutsideOfEventStream]; + underMouse = [[nsWindow contentView] hitTest:pt] != nil; }]; JNF_COCOA_EXIT(env); @@ -1084,8 +1160,10 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetEnabled { JNF_COCOA_ENTER(env); - AWTWindow *window = OBJC(windowPtr); + NSWindow *nsWindow = OBJC(windowPtr); [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ + AWTWindow *window = (AWTWindow*)[nsWindow delegate]; + [window setEnabled: isEnabled]; }]; From bfa3402f161938cbd8e481510f79b785af0c9099 Mon Sep 17 00:00:00 2001 From: Gary Collins Date: Fri, 11 May 2012 11:30:03 -0700 Subject: [PATCH 32/73] 7167625: Adjustments for SE-Embedded build process Simple change to the SE-Embedded build rules that should not affect any other OpenJDK users. Reviewed-by: kvn, dholmes --- hotspot/make/linux/makefiles/vm.make | 8 ++++++-- hotspot/src/share/vm/runtime/arguments.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make index a9517a4809b..6e9794ba710 100644 --- a/hotspot/make/linux/makefiles/vm.make +++ b/hotspot/make/linux/makefiles/vm.make @@ -102,9 +102,11 @@ CXXFLAGS = \ # a time and date. vm_version.o: CXXFLAGS += ${JRE_VERSION} -ifndef JAVASE_EMBEDDED +ifndef JAVASE_EMBEDDED +ifneq (${ARCH},arm) CFLAGS += -DINCLUDE_TRACE endif +endif # CFLAGS_WARN holds compiler options to suppress/enable warnings. CFLAGS += $(CFLAGS_WARN/BYFILE) @@ -153,11 +155,13 @@ SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm -ifndef JAVASE_EMBEDDED +ifndef JAVASE_EMBEDDED +ifneq (${ARCH},arm) SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \ find $(HS_ALT_SRC)/share/vm/jfr -type d; \ fi) endif +endif CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path)) CORE_PATHS+=$(GENERATED)/jvmtifiles diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 8deacc6f564..5b257b39e29 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -3039,7 +3039,7 @@ jint Arguments::parse(const JavaVMInitArgs* args) { return result; } -#ifdef JAVASE_EMBEDDED +#if (defined JAVASE_EMBEDDED || defined ARM) UNSUPPORTED_OPTION(UseG1GC, "G1 GC"); #endif From 757948e54b645a7bfd60c6d7df0f9df05b71f682 Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 11 May 2012 14:47:25 -0700 Subject: [PATCH 33/73] Added tag hs24-b10 for changeset fcb3aef57178 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index f2e72fc0a5b..ae16a349a6a 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -245,3 +245,4 @@ dff6e3459210f8dd0430b9b03ccc99280560da30 hs24-b08 bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37 7d5ec8bf38d1b12e0e09ec381f10976b8beede3b hs24-b09 637c3f5f068f88fb9ec9c5867341cf59fd5ebedc jdk8-b38 +73147e6c48813b5fee904aa33f79a77103250ff4 hs24-b10 From 17b26a6a0c693e6fcd0d70ad96070812a69818b2 Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 11 May 2012 14:54:35 -0700 Subject: [PATCH 34/73] 7168247: new hotspot build - hs24-b11 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index dba5ab40734..6922036c071 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -31,11 +31,11 @@ # # Don't put quotes (fail windows build). -HOTSPOT_VM_COPYRIGHT=Copyright 2011 +HOTSPOT_VM_COPYRIGHT=Copyright 2012 HS_MAJOR_VER=24 HS_MINOR_VER=0 -HS_BUILD_NUMBER=10 +HS_BUILD_NUMBER=11 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 From fd8e6eca55b0f6dcd24cadb0d5f225dd47f9b53d Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Fri, 11 May 2012 17:52:57 -0700 Subject: [PATCH 35/73] 7167976: Fix broken get_source.sh script Reviewed-by: tbell --- make/scripts/hgforest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/scripts/hgforest.sh b/make/scripts/hgforest.sh index bca070be79f..515f1b54b52 100644 --- a/make/scripts/hgforest.sh +++ b/make/scripts/hgforest.sh @@ -59,8 +59,8 @@ if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then done if [ "${pull_extra_base}" != "" ] ; then subrepos_extra="jdk/src/closed jdk/make/closed jdk/test/closed hotspot/src/closed hotspot/test/closed deploy install sponsors pubs" - pull_default_base=`echo ${pull_default} | sed -e 's@\(^.*://[^/]*\)/.*@\1@'` - pull_extra=`echo ${pull_default} | sed -e "s@${pull_default_base}@${pull_extra_base}@"` + pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'` + pull_extra="${pull_extra_base}/${pull_default_tail}" for i in ${subrepos_extra} ; do if [ ! -f ${i}/.hg/hgrc ] ; then repos_extra="${repos_extra} ${i}" From 65a285cb99599695503e7cc7a2e534be9c561707 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Sat, 12 May 2012 12:01:36 +0400 Subject: [PATCH 36/73] 7024965: Stylepad demo: remove non-translatable resources from Stylepad.properties file Reviewed-by: alexp --- jdk/src/share/demo/jfc/Notepad/Notepad.java | 24 +++++++++++++------ ...em.properties => NotepadSystem.properties} | 0 2 files changed, 17 insertions(+), 7 deletions(-) rename jdk/src/share/demo/jfc/Notepad/resources/{system.properties => NotepadSystem.properties} (100%) diff --git a/jdk/src/share/demo/jfc/Notepad/Notepad.java b/jdk/src/share/demo/jfc/Notepad/Notepad.java index d023dee7990..b6c7199e256 100644 --- a/jdk/src/share/demo/jfc/Notepad/Notepad.java +++ b/jdk/src/share/demo/jfc/Notepad/Notepad.java @@ -62,7 +62,7 @@ import javax.swing.UIManager.LookAndFeelInfo; @SuppressWarnings("serial") class Notepad extends JPanel { - private static Properties properties; + protected static Properties properties; private static ResourceBundle resources; private final static String EXIT_AFTER_PAINT = "-exit"; private static boolean exitAfterFirstPaint; @@ -77,12 +77,12 @@ class Notepad extends JPanel { try { properties = new Properties(); properties.load(Notepad.class.getResourceAsStream( - "resources/system.properties")); + "resources/NotepadSystem.properties")); resources = ResourceBundle.getBundle("resources.Notepad", Locale.getDefault()); } catch (MissingResourceException | IOException e) { System.err.println("resources/Notepad.properties " - + "or resources/system.properties not found"); + + "or resources/NotepadSystem.properties not found"); System.exit(1); } } @@ -298,7 +298,7 @@ class Notepad extends JPanel { */ private Component createToolbar() { toolbar = new JToolBar(); - for (String toolKey: TOOLBAR_KEYS) { + for (String toolKey: getToolBarKeys()) { if (toolKey.equals("-")) { toolbar.add(Box.createHorizontalStrut(5)); } else { @@ -363,7 +363,7 @@ class Notepad extends JPanel { */ protected JMenuBar createMenubar() { JMenuBar mb = new JMenuBar(); - for(String menuKey: MENUBAR_KEYS){ + for(String menuKey: getMenuBarKeys()){ JMenu m = createMenu(menuKey); if (m != null) { mb.add(m); @@ -389,8 +389,10 @@ class Notepad extends JPanel { return menu; } - // get keys for menus - private String[] getItemKeys(String key) { + /** + * Get keys for menus + */ + protected String[] getItemKeys(String key) { switch (key) { case "file": return FILE_KEYS; @@ -403,6 +405,14 @@ class Notepad extends JPanel { } } + protected String[] getMenuBarKeys() { + return MENUBAR_KEYS; + } + + protected String[] getToolBarKeys() { + return TOOLBAR_KEYS; + } + // Yarked from JMenu, ideally this would be public. protected PropertyChangeListener createActionChangeListener(JMenuItem b) { return new ActionChangedListener(b); diff --git a/jdk/src/share/demo/jfc/Notepad/resources/system.properties b/jdk/src/share/demo/jfc/Notepad/resources/NotepadSystem.properties similarity index 100% rename from jdk/src/share/demo/jfc/Notepad/resources/system.properties rename to jdk/src/share/demo/jfc/Notepad/resources/NotepadSystem.properties From 3cdc5fa537ec36a6b4c529cf07313f3b4101cdf4 Mon Sep 17 00:00:00 2001 From: Alexander Potochkin Date: Sat, 12 May 2012 17:46:00 +0400 Subject: [PATCH 37/73] 7149005: [macosx] Java Control Panel's UI controls are distorted when draging scroll bar Reviewed-by: serb --- .../macosx/classes/com/apple/laf/AquaButtonLabeledUI.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaButtonLabeledUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaButtonLabeledUI.java index 95503c8271d..d9ebdd0e11d 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaButtonLabeledUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaButtonLabeledUI.java @@ -30,6 +30,7 @@ import java.awt.image.BufferedImage; import javax.swing.*; import javax.swing.border.Border; +import javax.swing.plaf.UIResource; import javax.swing.plaf.basic.BasicHTML; import javax.swing.text.View; @@ -76,8 +77,11 @@ public abstract class AquaButtonLabeledUI extends AquaButtonToggleUI implements protected void setThemeBorder(final AbstractButton b) { super.setThemeBorder(b); - // Set the correct border - b.setBorder(AquaButtonBorder.getBevelButtonBorder()); + Border border = b.getBorder(); + if (border == null || border instanceof UIResource) { + // Set the correct border + b.setBorder(AquaButtonBorder.getBevelButtonBorder()); + } } protected abstract AquaButtonBorder getPainter(); From da0a14421344fe530cfcb688fe5fd809acf57c70 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Sat, 12 May 2012 18:50:27 +0400 Subject: [PATCH 38/73] 7110683: Issues with some KeyboardFocusManager method Reviewed-by: ahgross --- jdk/src/share/classes/java/awt/Component.java | 31 ++- .../java/awt/DefaultKeyboardFocusManager.java | 8 +- .../java/awt/KeyboardFocusManager.java | 225 ++++++++++++------ jdk/src/share/classes/java/awt/Window.java | 2 +- 4 files changed, 175 insertions(+), 91 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index 00d363c1162..20d733fa93c 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -7833,7 +7833,7 @@ public abstract class Component implements ImageObserver, MenuContainer, if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("clear global focus owner"); } - KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwnerPriv(); } if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("returning result: " + res); @@ -7914,7 +7914,7 @@ public abstract class Component implements ImageObserver, MenuContainer, if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("clear global focus owner"); } - KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwnerPriv(); } if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("returning result: " + res); @@ -7947,21 +7947,32 @@ public abstract class Component implements ImageObserver, MenuContainer, if (rootAncestor != null) { Container rootAncestorRootAncestor = rootAncestor.getFocusCycleRootAncestor(); - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot( - (rootAncestorRootAncestor != null) - ? rootAncestorRootAncestor - : rootAncestor); + + final Container fcr = (rootAncestorRootAncestor != null) ? + rootAncestorRootAncestor : rootAncestor; + + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + setGlobalCurrentFocusCycleRoot(fcr); + return null; + } + }); rootAncestor.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP); } else { - Window window = getContainingWindow(); + final Window window = getContainingWindow(); if (window != null) { Component toFocus = window.getFocusTraversalPolicy(). getDefaultComponent(window); if (toFocus != null) { - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot(window); + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + setGlobalCurrentFocusCycleRoot(window); + return null; + } + }); toFocus.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP); } } diff --git a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java index 4f9ef90f5a4..109e70d9d8a 100644 --- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java @@ -116,7 +116,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { } else if (fe.getOppositeComponent() != null && doRestoreFocus(fe.getOppositeComponent(), vetoedComponent, false)) { } else { - clearGlobalFocusOwner(); + clearGlobalFocusOwnerPriv(); } } private void restoreFocus(WindowEvent we) { @@ -130,7 +130,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { { // do nothing, everything is done in restoreFocus() } else { - clearGlobalFocusOwner(); + clearGlobalFocusOwnerPriv(); } } private boolean restoreFocus(Window aWindow, Component vetoedComponent, @@ -141,7 +141,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { if (toFocus != null && toFocus != vetoedComponent && doRestoreFocus(toFocus, vetoedComponent, false)) { return true; } else if (clearOnFailure) { - clearGlobalFocusOwner(); + clearGlobalFocusOwnerPriv(); return true; } else { return false; @@ -164,7 +164,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { { return true; } else if (clearOnFailure) { - clearGlobalFocusOwner(); + clearGlobalFocusOwnerPriv(); return true; } else { return false; diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java index 7b8b9f41e25..d12ed9e3c64 100644 --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -246,15 +246,7 @@ public abstract class KeyboardFocusManager public static void setCurrentKeyboardFocusManager( KeyboardFocusManager newManager) throws SecurityException { - SecurityManager security = System.getSecurityManager(); - if (security != null) { - if (replaceKeyboardFocusManagerPermission == null) { - replaceKeyboardFocusManagerPermission = - new AWTPermission("replaceKeyboardFocusManager"); - } - security. - checkPermission(replaceKeyboardFocusManagerPermission); - } + checkReplaceKFMPermission(); KeyboardFocusManager oldManager = null; @@ -398,11 +390,6 @@ public abstract class KeyboardFocusManager */ private static java.util.Map mostRecentFocusOwners = new WeakHashMap(); - /** - * Error String for initializing SecurityExceptions. - */ - private static final String notPrivileged = "this KeyboardFocusManager is not installed in the current thread's context"; - /** * We cache the permission used to verify that the calling thread is * permitted to access the global focus state. @@ -503,17 +490,13 @@ public abstract class KeyboardFocusManager * @see #setGlobalFocusOwner * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission */ protected Component getGlobalFocusOwner() throws SecurityException { synchronized (KeyboardFocusManager.class) { - if (this == getCurrentKeyboardFocusManager()) { - return focusOwner; - } else { - if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); - } - throw new SecurityException(notPrivileged); - } + checkKFMSecurity(); + return focusOwner; } } @@ -538,15 +521,23 @@ public abstract class KeyboardFocusManager * @see Component#requestFocus() * @see Component#requestFocusInWindow() * @see Component#isFocusable + * @throws SecurityException if this KeyboardFocusManager is not the + * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission * @beaninfo * bound: true */ - protected void setGlobalFocusOwner(Component focusOwner) { + protected void setGlobalFocusOwner(Component focusOwner) + throws SecurityException + { Component oldFocusOwner = null; boolean shouldFire = false; if (focusOwner == null || focusOwner.isFocusable()) { synchronized (KeyboardFocusManager.class) { + checkKFMSecurity(); + oldFocusOwner = getFocusOwner(); try { @@ -583,6 +574,27 @@ public abstract class KeyboardFocusManager } } + /** + * Clears the focus owner at both the Java and native levels if the + * focus owner exists and resides in the same context as the calling thread, + * otherwise the method returns silently. + *

+ * The focus owner component will receive a permanent FOCUS_LOST event. + * After this operation completes, the native windowing system will discard + * all user-generated KeyEvents until the user selects a new Component to + * receive focus, or a Component is given focus explicitly via a call to + * {@code requestFocus()}. This operation does not change the focused or + * active Windows. + * + * @see Component#requestFocus() + * @see java.awt.event.FocusEvent#FOCUS_LOST + */ + public void clearFocusOwner() { + if (getFocusOwner() != null) { + clearGlobalFocusOwner(); + } + } + /** * Clears the global focus owner at both the Java and native levels. If * there exists a focus owner, that Component will receive a permanent @@ -591,11 +603,26 @@ public abstract class KeyboardFocusManager * a new Component to receive focus, or a Component is given focus * explicitly via a call to requestFocus(). This operation * does not change the focused or active Windows. + *

+ * If a SecurityManager is installed, the calling thread must be granted + * the "replaceKeyboardFocusManager" AWTPermission. If this permission is + * not granted, this method will throw a SecurityException, and the current + * focus owner will not be cleared. + *

+ * This method is intended to be used only by KeyboardFocusManager set as + * current KeyboardFocusManager for the calling thread's context. It is not + * for general client use. * + * @see KeyboardFocusManager#clearFocusOwner * @see Component#requestFocus() * @see java.awt.event.FocusEvent#FOCUS_LOST + * @throws SecurityException if the calling thread does not have + * "replaceKeyboardFocusManager" permission */ - public void clearGlobalFocusOwner() { + public void clearGlobalFocusOwner() + throws SecurityException + { + checkReplaceKFMPermission(); if (!GraphicsEnvironment.isHeadless()) { // Toolkit must be fully initialized, otherwise // _clearGlobalFocusOwner will crash or throw an exception @@ -609,6 +636,15 @@ public abstract class KeyboardFocusManager peer.clearGlobalFocusOwner(activeWindow); } + void clearGlobalFocusOwnerPriv() { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + clearGlobalFocusOwner(); + return null; + } + }); + } + Component getNativeFocusOwner() { return peer.getCurrentFocusOwner(); } @@ -660,29 +696,21 @@ public abstract class KeyboardFocusManager * are equivalent unless a temporary focus change is currently in effect. * In such a situation, the permanent focus owner will again be the focus * owner when the temporary focus change ends. - *

- * This method will throw a SecurityException if this KeyboardFocusManager - * is not the current KeyboardFocusManager for the calling thread's - * context. * * @return the permanent focus owner * @see #getPermanentFocusOwner * @see #setGlobalPermanentFocusOwner * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission */ protected Component getGlobalPermanentFocusOwner() throws SecurityException { synchronized (KeyboardFocusManager.class) { - if (this == getCurrentKeyboardFocusManager()) { - return permanentFocusOwner; - } else { - if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); - } - throw new SecurityException(notPrivileged); - } + checkKFMSecurity(); + return permanentFocusOwner; } } @@ -708,16 +736,23 @@ public abstract class KeyboardFocusManager * @see Component#requestFocus() * @see Component#requestFocusInWindow() * @see Component#isFocusable + * @throws SecurityException if this KeyboardFocusManager is not the + * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission * @beaninfo * bound: true */ protected void setGlobalPermanentFocusOwner(Component permanentFocusOwner) + throws SecurityException { Component oldPermanentFocusOwner = null; boolean shouldFire = false; if (permanentFocusOwner == null || permanentFocusOwner.isFocusable()) { synchronized (KeyboardFocusManager.class) { + checkKFMSecurity(); + oldPermanentFocusOwner = getPermanentFocusOwner(); try { @@ -770,27 +805,19 @@ public abstract class KeyboardFocusManager * Returns the focused Window, even if the calling thread is in a different * context than the focused Window. The focused Window is the Window that * is or contains the focus owner. - *

- * This method will throw a SecurityException if this KeyboardFocusManager - * is not the current KeyboardFocusManager for the calling thread's - * context. * * @return the focused Window * @see #getFocusedWindow * @see #setGlobalFocusedWindow * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission */ protected Window getGlobalFocusedWindow() throws SecurityException { synchronized (KeyboardFocusManager.class) { - if (this == getCurrentKeyboardFocusManager()) { - return focusedWindow; - } else { - if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); - } - throw new SecurityException(notPrivileged); - } + checkKFMSecurity(); + return focusedWindow; } } @@ -812,15 +839,23 @@ public abstract class KeyboardFocusManager * @see Component#requestFocus() * @see Component#requestFocusInWindow() * @see Window#isFocusableWindow + * @throws SecurityException if this KeyboardFocusManager is not the + * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission * @beaninfo * bound: true */ - protected void setGlobalFocusedWindow(Window focusedWindow) { + protected void setGlobalFocusedWindow(Window focusedWindow) + throws SecurityException + { Window oldFocusedWindow = null; boolean shouldFire = false; if (focusedWindow == null || focusedWindow.isFocusableWindow()) { synchronized (KeyboardFocusManager.class) { + checkKFMSecurity(); + oldFocusedWindow = getFocusedWindow(); try { @@ -874,27 +909,19 @@ public abstract class KeyboardFocusManager * or its children with special decorations, such as a highlighted title * bar. The active Window is always either the focused Window, or the first * Frame or Dialog that is an owner of the focused Window. - *

- * This method will throw a SecurityException if this KeyboardFocusManager - * is not the current KeyboardFocusManager for the calling thread's - * context. * * @return the active Window * @see #getActiveWindow * @see #setGlobalActiveWindow * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission */ protected Window getGlobalActiveWindow() throws SecurityException { synchronized (KeyboardFocusManager.class) { - if (this == getCurrentKeyboardFocusManager()) { - return activeWindow; - } else { - if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); - } - throw new SecurityException(notPrivileged); - } + checkKFMSecurity(); + return activeWindow; } } @@ -917,12 +944,20 @@ public abstract class KeyboardFocusManager * @see #getGlobalActiveWindow * @see Component#requestFocus() * @see Component#requestFocusInWindow() + * @throws SecurityException if this KeyboardFocusManager is not the + * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission * @beaninfo * bound: true */ - protected void setGlobalActiveWindow(Window activeWindow) { + protected void setGlobalActiveWindow(Window activeWindow) + throws SecurityException + { Window oldActiveWindow; synchronized (KeyboardFocusManager.class) { + checkKFMSecurity(); + oldActiveWindow = getActiveWindow(); if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Setting global active window to " + activeWindow + ", old active " + oldActiveWindow); @@ -1194,10 +1229,6 @@ public abstract class KeyboardFocusManager * Components represent the next and previous Components to focus during * normal focus traversal. In that case, the current focus cycle root is * used to differentiate among the possibilities. - *

- * This method will throw a SecurityException if this KeyboardFocusManager - * is not the current KeyboardFocusManager for the calling thread's - * context. * * @return the current focus cycle root, or null if the current focus cycle * root is not a member of the calling thread's context @@ -1205,19 +1236,15 @@ public abstract class KeyboardFocusManager * @see #setGlobalCurrentFocusCycleRoot * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context + * and if the calling thread does not have "replaceKeyboardFocusManager" + * permission */ protected Container getGlobalCurrentFocusCycleRoot() throws SecurityException { synchronized (KeyboardFocusManager.class) { - if (this == getCurrentKeyboardFocusManager()) { - return currentFocusCycleRoot; - } else { - if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); - } - throw new SecurityException(notPrivileged); - } + checkKFMSecurity(); + return currentFocusCycleRoot; } } @@ -1228,16 +1255,27 @@ public abstract class KeyboardFocusManager * In that case, the current focus cycle root is used to differentiate * among the possibilities. *

+ * If a SecurityManager is installed, the calling thread must be granted + * the "replaceKeyboardFocusManager" AWTPermission. If this permission is + * not granted, this method will throw a SecurityException, and the current + * focus cycle root will not be changed. + *

* This method is intended to be used only by KeyboardFocusManagers and * focus implementations. It is not for general client use. * * @param newFocusCycleRoot the new focus cycle root * @see #getCurrentFocusCycleRoot * @see #getGlobalCurrentFocusCycleRoot + * @throws SecurityException if the calling thread does not have + * "replaceKeyboardFocusManager" permission * @beaninfo * bound: true */ - public void setGlobalCurrentFocusCycleRoot(Container newFocusCycleRoot) { + public void setGlobalCurrentFocusCycleRoot(Container newFocusCycleRoot) + throws SecurityException + { + checkReplaceKFMPermission(); + Container oldFocusCycleRoot; synchronized (KeyboardFocusManager.class) { @@ -3058,4 +3096,39 @@ public abstract class KeyboardFocusManager : null; } } + + private static void checkReplaceKFMPermission() + throws SecurityException + { + SecurityManager security = System.getSecurityManager(); + if (security != null) { + if (replaceKeyboardFocusManagerPermission == null) { + replaceKeyboardFocusManagerPermission = + new AWTPermission("replaceKeyboardFocusManager"); + } + security. + checkPermission(replaceKeyboardFocusManagerPermission); + } + } + + // Checks if this KeyboardFocusManager instance is the current KFM, + // or otherwise checks if the calling thread has "replaceKeyboardFocusManager" + // permission. Here's the reasoning to do so: + // + // A system KFM instance (which is the current KFM by default) may have no + // "replaceKFM" permission when a client code is on the call stack beneath, + // but still it should be able to execute the methods protected by this check + // due to the system KFM is trusted (and so it does like "privileged"). + // + // If this KFM instance is not the current KFM but the client code has all + // permissions we can't throw SecurityException because it would contradict + // the security concepts. In this case the trusted client code is responsible + // for calling the secured methods from KFM instance which is not current. + private void checkKFMSecurity() + throws SecurityException + { + if (this != getCurrentKeyboardFocusManager()) { + checkReplaceKFMPermission(); + } + } } diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java index 1e2ee59a09a..437e806b35c 100644 --- a/jdk/src/share/classes/java/awt/Window.java +++ b/jdk/src/share/classes/java/awt/Window.java @@ -2568,7 +2568,7 @@ public class Window extends Container implements Accessible { } } KeyboardFocusManager.getCurrentKeyboardFocusManager(). - clearGlobalFocusOwner(); + clearGlobalFocusOwnerPriv(); } } From b68794be17d8e9e72604c451e91fe983d34f7086 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Mon, 14 May 2012 17:32:17 +0200 Subject: [PATCH 39/73] 7161545: G1: Minor cleanups to the G1 logging Rename "to-space-overflow" to "to-space-exhausted", Introduce one decimal point in the size format, Add Sum to the aggregate and re-order the entries, Add number of GC workers to the log output Reviewed-by: johnc, jwilhelm --- .../gc_implementation/g1/g1CollectedHeap.cpp | 2 +- .../g1/g1CollectorPolicy.cpp | 59 +++++++++---------- .../g1/g1CollectorPolicy.hpp | 4 +- .../share/vm/utilities/globalDefinitions.hpp | 10 ++-- 4 files changed, 36 insertions(+), 39 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 270e52e32b4..fa71befcfe8 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -5502,7 +5502,7 @@ void G1CollectedHeap::evacuate_collection_set() { if (evacuation_failed()) { remove_self_forwarding_pointers(); if (G1Log::finer()) { - gclog_or_tty->print(" (to-space overflow)"); + gclog_or_tty->print(" (to-space exhausted)"); } else if (G1Log::fine()) { gclog_or_tty->print("--"); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index a4060618131..05dea1c4854 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1010,7 +1010,8 @@ T sum_of(T* sum_arr, int start, int n, int N) { void G1CollectorPolicy::print_par_stats(int level, const char* str, - double* data) { + double* data, + bool showDecimals) { double min = data[0], max = data[0]; double total = 0.0; LineBuffer buf(level); @@ -1023,7 +1024,11 @@ void G1CollectorPolicy::print_par_stats(int level, max = val; total += val; if (G1Log::finest()) { - buf.append(" %.1lf", val); + if (showDecimals) { + buf.append(" %.1lf", val); + } else { + buf.append(" %d", (int)val); + } } } @@ -1031,36 +1036,26 @@ void G1CollectorPolicy::print_par_stats(int level, buf.append_and_print_cr(""); } double avg = total / (double) no_of_gc_threads(); - buf.append_and_print_cr(" Avg: %.1lf Min: %.1lf Max: %.1lf Diff: %.1lf]", - avg, min, max, max - min); -} - -void G1CollectorPolicy::print_par_sizes(int level, - const char* str, - double* data) { - double min = data[0], max = data[0]; - double total = 0.0; - LineBuffer buf(level); - buf.append("[%s :", str); - for (uint i = 0; i < no_of_gc_threads(); ++i) { - double val = data[i]; - if (val < min) - min = val; - if (val > max) - max = val; - total += val; - buf.append(" %d", (int) val); + if (showDecimals) { + buf.append_and_print_cr(" Min: %.1lf, Avg: %.1lf, Max: %.1lf, Diff: %.1lf, Sum: %.1lf]", + min, avg, max, max - min, total); + } else { + buf.append_and_print_cr(" Min: %d, Avg: %d, Max: %d, Diff: %d, Sum: %d]", + (int)min, (int)avg, (int)max, (int)max - (int)min, (int)total); } - buf.append_and_print_cr(""); - double avg = total / (double) no_of_gc_threads(); - buf.append_and_print_cr(" Sum: %d, Avg: %d, Min: %d, Max: %d, Diff: %d]", - (int)total, (int)avg, (int)min, (int)max, (int)max - (int)min); } void G1CollectorPolicy::print_stats(int level, const char* str, double value) { - LineBuffer(level).append_and_print_cr("[%s: %5.1lf ms]", str, value); + LineBuffer(level).append_and_print_cr("[%s: %.1lf ms]", str, value); +} + +void G1CollectorPolicy::print_stats(int level, + const char* str, + double value, + int workers) { + LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: %d]", str, value, workers); } void G1CollectorPolicy::print_stats(int level, @@ -1373,7 +1368,7 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms); } if (parallel) { - print_stats(1, "Parallel Time", _cur_collection_par_time_ms); + print_stats(1, "Parallel Time", _cur_collection_par_time_ms, no_of_gc_threads); print_par_stats(2, "GC Worker Start", _par_last_gc_worker_start_times_ms); print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms); if (print_marking_info) { @@ -1381,13 +1376,15 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { } print_par_stats(2, "Update RS", _par_last_update_rs_times_ms); if (G1Log::finest()) { - print_par_sizes(3, "Processed Buffers", _par_last_update_rs_processed_buffers); + print_par_stats(3, "Processed Buffers", _par_last_update_rs_processed_buffers, + false /* showDecimals */); } print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms); print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms); print_par_stats(2, "Termination", _par_last_termination_times_ms); if (G1Log::finest()) { - print_par_sizes(3, "Termination Attempts", _par_last_termination_attempts); + print_par_stats(3, "Termination Attempts", _par_last_termination_attempts, + false /* showDecimals */); } for (int i = 0; i < _parallel_gc_threads; i++) { @@ -1601,9 +1598,9 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) { _collectionSetChooser->verify(); } -#define EXT_SIZE_FORMAT "%d%s" +#define EXT_SIZE_FORMAT "%.1f%s" #define EXT_SIZE_PARAMS(bytes) \ - byte_size_in_proper_unit((bytes)), \ + byte_size_in_proper_unit((double)(bytes)), \ proper_unit_for_byte_size((bytes)) void G1CollectorPolicy::print_heap_transition() { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index 7cdf79d7feb..88069816ef6 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -552,10 +552,10 @@ public: private: void print_stats(int level, const char* str, double value); + void print_stats(int level, const char* str, double value, int workers); void print_stats(int level, const char* str, int value); - void print_par_stats(int level, const char* str, double* data); - void print_par_sizes(int level, const char* str, double* data); + void print_par_stats(int level, const char* str, double* data, bool showDecimals = true); void check_other_times(int level, NumberSeq* other_times_ms, diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 89201f62f92..55904058bf8 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -188,17 +188,17 @@ inline const char* proper_unit_for_byte_size(size_t s) { } } -inline size_t byte_size_in_proper_unit(size_t s) { +template +inline T byte_size_in_proper_unit(T s) { if (s >= 10*M) { - return s/M; + return (T)(s/M); } else if (s >= 10*K) { - return s/K; + return (T)(s/K); } else { return s; } } - //---------------------------------------------------------------------------------------------------- // VM type definitions From eb4a860bc319bd60d19dcaaf3ac8fcce2747dd19 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Mon, 14 May 2012 09:36:00 -0700 Subject: [PATCH 40/73] 6924259: Remove String.count/String.offset Allow a version of String class that doesn't have count and offset fields. Reviewed-by: never, coleenp --- .../cpu/sparc/vm/c1_LIRAssembler_sparc.cpp | 56 +++-- .../src/cpu/x86/vm/c1_LIRAssembler_x86.cpp | 25 ++- .../src/share/vm/classfile/javaClasses.cpp | 42 ++-- .../src/share/vm/classfile/javaClasses.hpp | 82 +++++-- .../share/vm/classfile/systemDictionary.cpp | 3 + hotspot/src/share/vm/classfile/vmSymbols.hpp | 3 + hotspot/src/share/vm/memory/dump.cpp | 4 +- hotspot/src/share/vm/opto/graphKit.cpp | 80 ++++++- hotspot/src/share/vm/opto/graphKit.hpp | 10 +- hotspot/src/share/vm/opto/library_call.cpp | 201 ++++++++++-------- hotspot/src/share/vm/opto/stringopts.cpp | 45 ++-- hotspot/src/share/vm/opto/stringopts.hpp | 5 +- 12 files changed, 365 insertions(+), 191 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp index 904489e3a2b..b2587e4d8a2 100644 --- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -238,9 +238,12 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst Register result = dst->as_register(); { - // Get a pointer to the first character of string0 in tmp0 and get string0.count in str0 - // Get a pointer to the first character of string1 in tmp1 and get string1.count in str1 - // Also, get string0.count-string1.count in o7 and get the condition code set + // Get a pointer to the first character of string0 in tmp0 + // and get string0.length() in str0 + // Get a pointer to the first character of string1 in tmp1 + // and get string1.length() in str1 + // Also, get string0.length()-string1.length() in + // o7 and get the condition code set // Note: some instructions have been hoisted for better instruction scheduling Register tmp0 = L0; @@ -248,27 +251,40 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst Register tmp2 = L2; int value_offset = java_lang_String:: value_offset_in_bytes(); // char array - int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position - int count_offset = java_lang_String:: count_offset_in_bytes(); - - __ load_heap_oop(str0, value_offset, tmp0); - __ ld(str0, offset_offset, tmp2); - __ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); - __ ld(str0, count_offset, str0); - __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + if (java_lang_String::has_offset_field()) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position + int count_offset = java_lang_String:: count_offset_in_bytes(); + __ load_heap_oop(str0, value_offset, tmp0); + __ ld(str0, offset_offset, tmp2); + __ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); + __ ld(str0, count_offset, str0); + __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + } else { + __ load_heap_oop(str0, value_offset, tmp1); + __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); + __ ld(tmp1, arrayOopDesc::length_offset_in_bytes(), str0); + } // str1 may be null add_debug_info_for_null_check_here(info); - __ load_heap_oop(str1, value_offset, tmp1); - __ add(tmp0, tmp2, tmp0); + if (java_lang_String::has_offset_field()) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position + int count_offset = java_lang_String:: count_offset_in_bytes(); + __ load_heap_oop(str1, value_offset, tmp1); + __ add(tmp0, tmp2, tmp0); - __ ld(str1, offset_offset, tmp2); - __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); - __ ld(str1, count_offset, str1); - __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + __ ld(str1, offset_offset, tmp2); + __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); + __ ld(str1, count_offset, str1); + __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + __ add(tmp1, tmp2, tmp1); + } else { + __ load_heap_oop(str1, value_offset, tmp2); + __ add(tmp2, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); + __ ld(tmp2, arrayOopDesc::length_offset_in_bytes(), str1); + } __ subcc(str0, str1, O7); - __ add(tmp1, tmp2, tmp1); } { @@ -302,7 +318,7 @@ void LIR_Assembler::emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst // Shift base0 and base1 to the end of the arrays, negate limit __ add(base0, limit, base0); __ add(base1, limit, base1); - __ neg(limit); // limit = -min{string0.count, strin1.count} + __ neg(limit); // limit = -min{string0.length(), string1.length()} __ lduh(base0, limit, chr0); __ bind(Lloop); diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp index a7cc42e4912..4b2f8699e02 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -505,19 +505,28 @@ void LIR_Assembler::emit_string_compare(LIR_Opr arg0, LIR_Opr arg1, LIR_Opr dst, // Get addresses of first characters from both Strings __ load_heap_oop(rsi, Address(rax, java_lang_String::value_offset_in_bytes())); - __ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes())); - __ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); - + if (java_lang_String::has_offset_field()) { + __ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes())); + __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); + __ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } else { + __ movl (rax, Address(rsi, arrayOopDesc::length_offset_in_bytes())); + __ lea (rsi, Address(rsi, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } // rbx, may be NULL add_debug_info_for_null_check_here(info); __ load_heap_oop(rdi, Address(rbx, java_lang_String::value_offset_in_bytes())); - __ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes())); - __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + if (java_lang_String::has_offset_field()) { + __ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes())); + __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); + __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } else { + __ movl (rbx, Address(rdi, arrayOopDesc::length_offset_in_bytes())); + __ lea (rdi, Address(rdi, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } // compute minimum length (in rax) and difference of lengths (on top of stack) - __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); - __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); __ mov (rcx, rbx); __ subptr(rbx, rax); // subtract lengths __ push (rbx); // result diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index b5e887f74a8..eab75e181e3 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,7 +143,27 @@ compute_optional_offset(int& dest_offset, } +int java_lang_String::value_offset = 0; +int java_lang_String::offset_offset = 0; +int java_lang_String::count_offset = 0; +int java_lang_String::hash_offset = 0; + +bool java_lang_String::initialized = false; + +void java_lang_String::compute_offsets() { + assert(!initialized, "offsets should be initialized only once"); + + klassOop k = SystemDictionary::String_klass(); + compute_offset(value_offset, k, vmSymbols::value_name(), vmSymbols::char_array_signature()); + compute_optional_offset(offset_offset, k, vmSymbols::offset_name(), vmSymbols::int_signature()); + compute_optional_offset(count_offset, k, vmSymbols::count_name(), vmSymbols::int_signature()); + compute_optional_offset(hash_offset, k, vmSymbols::hash_name(), vmSymbols::int_signature()); + + initialized = true; +} + Handle java_lang_String::basic_create(int length, bool tenured, TRAPS) { + assert(initialized, "Must be initialized"); // Create the String object first, so there's a chance that the String // and the char array it points to end up in the same cache line. oop obj; @@ -2837,10 +2857,6 @@ int java_lang_System::err_offset_in_bytes() { -int java_lang_String::value_offset; -int java_lang_String::offset_offset; -int java_lang_String::count_offset; -int java_lang_String::hash_offset; int java_lang_Class::_klass_offset; int java_lang_Class::_array_klass_offset; int java_lang_Class::_resolved_constructor_offset; @@ -3000,12 +3016,6 @@ void JavaClasses::compute_hard_coded_offsets() { const int x = heapOopSize; const int header = instanceOopDesc::base_offset_in_bytes(); - // Do the String Class - java_lang_String::value_offset = java_lang_String::hc_value_offset * x + header; - java_lang_String::offset_offset = java_lang_String::hc_offset_offset * x + header; - java_lang_String::count_offset = java_lang_String::offset_offset + sizeof (jint); - java_lang_String::hash_offset = java_lang_String::count_offset + sizeof (jint); - // Throwable Class java_lang_Throwable::backtrace_offset = java_lang_Throwable::hc_backtrace_offset * x + header; java_lang_Throwable::detailMessage_offset = java_lang_Throwable::hc_detailMessage_offset * x + header; @@ -3200,9 +3210,13 @@ void JavaClasses::check_offsets() { // java.lang.String CHECK_OFFSET("java/lang/String", java_lang_String, value, "[C"); - CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I"); - CHECK_OFFSET("java/lang/String", java_lang_String, count, "I"); - CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I"); + if (java_lang_String::has_offset_field()) { + CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I"); + CHECK_OFFSET("java/lang/String", java_lang_String, count, "I"); + } + if (java_lang_String::has_hash_field()) { + CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I"); + } // java.lang.Class diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index 2a32801fc73..708ea4f544a 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,26 +52,36 @@ class java_lang_String : AllStatic { private: - enum { - hc_value_offset = 0, - hc_offset_offset = 1 - //hc_count_offset = 2 -- not a word-scaled offset - //hc_hash_offset = 3 -- not a word-scaled offset - }; - static int value_offset; static int offset_offset; static int count_offset; static int hash_offset; + static bool initialized; + static Handle basic_create(int length, bool tenured, TRAPS); static Handle basic_create_from_unicode(jchar* unicode, int length, bool tenured, TRAPS); - static void set_value( oop string, typeArrayOop buffer) { string->obj_field_put(value_offset, (oop)buffer); } - static void set_offset(oop string, int offset) { string->int_field_put(offset_offset, offset); } - static void set_count( oop string, int count) { string->int_field_put(count_offset, count); } + static void set_value( oop string, typeArrayOop buffer) { + assert(initialized, "Must be initialized"); + string->obj_field_put(value_offset, (oop)buffer); + } + static void set_offset(oop string, int offset) { + assert(initialized, "Must be initialized"); + if (offset_offset > 0) { + string->int_field_put(offset_offset, offset); + } + } + static void set_count( oop string, int count) { + assert(initialized, "Must be initialized"); + if (count_offset > 0) { + string->int_field_put(count_offset, count); + } + } public: + static void compute_offsets(); + // Instance creation static Handle create_from_unicode(jchar* unicode, int len, TRAPS); static Handle create_tenured_from_unicode(jchar* unicode, int len, TRAPS); @@ -82,23 +92,61 @@ class java_lang_String : AllStatic { static Handle create_from_platform_dependent_str(const char* str, TRAPS); static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS); - static int value_offset_in_bytes() { return value_offset; } - static int count_offset_in_bytes() { return count_offset; } - static int offset_offset_in_bytes() { return offset_offset; } - static int hash_offset_in_bytes() { return hash_offset; } + static bool has_offset_field() { + assert(initialized, "Must be initialized"); + return (offset_offset > 0); + } + + static bool has_count_field() { + assert(initialized, "Must be initialized"); + return (count_offset > 0); + } + + static bool has_hash_field() { + assert(initialized, "Must be initialized"); + return (hash_offset > 0); + } + + static int value_offset_in_bytes() { + assert(initialized && (value_offset > 0), "Must be initialized"); + return value_offset; + } + static int count_offset_in_bytes() { + assert(initialized && (count_offset > 0), "Must be initialized"); + return count_offset; + } + static int offset_offset_in_bytes() { + assert(initialized && (offset_offset > 0), "Must be initialized"); + return offset_offset; + } + static int hash_offset_in_bytes() { + assert(initialized && (hash_offset > 0), "Must be initialized"); + return hash_offset; + } // Accessors static typeArrayOop value(oop java_string) { + assert(initialized && (value_offset > 0), "Must be initialized"); assert(is_instance(java_string), "must be java_string"); return (typeArrayOop) java_string->obj_field(value_offset); } static int offset(oop java_string) { + assert(initialized, "Must be initialized"); assert(is_instance(java_string), "must be java_string"); - return java_string->int_field(offset_offset); + if (offset_offset > 0) { + return java_string->int_field(offset_offset); + } else { + return 0; + } } static int length(oop java_string) { + assert(initialized, "Must be initialized"); assert(is_instance(java_string), "must be java_string"); - return java_string->int_field(count_offset); + if (count_offset > 0) { + return java_string->int_field(count_offset); + } else { + return ((typeArrayOop)java_string->obj_field(value_offset))->length(); + } } static int utf8_length(oop java_string); diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 04bb9d9f5c5..0bdc16de6ff 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -1971,6 +1971,9 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) { // first do Object, String, Class initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK); + // Calculate offsets for String and Class classes since they are loaded and + // can be used after this point. + java_lang_String::compute_offsets(); java_lang_Class::compute_offsets(); // Fixup mirrors for classes loaded before java.lang.Class. diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp index 9cee5ac0490..b0d014575aa 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp @@ -340,6 +340,9 @@ template(park_event_name, "nativeParkEventPointer") \ template(cache_field_name, "cache") \ template(value_name, "value") \ + template(offset_name, "offset") \ + template(count_name, "count") \ + template(hash_name, "hash") \ template(frontCacheEnabled_name, "frontCacheEnabled") \ template(stringCacheEnabled_name, "stringCacheEnabled") \ template(numberOfLeadingZeros_name, "numberOfLeadingZeros") \ diff --git a/hotspot/src/share/vm/memory/dump.cpp b/hotspot/src/share/vm/memory/dump.cpp index af1d7928dca..e91d33135e4 100644 --- a/hotspot/src/share/vm/memory/dump.cpp +++ b/hotspot/src/share/vm/memory/dump.cpp @@ -78,8 +78,8 @@ public: void do_oop(oop* p) { if (p != NULL) { oop obj = *p; - if (obj->klass() == SystemDictionary::String_klass()) { - + if (obj->klass() == SystemDictionary::String_klass() && + java_lang_String::has_hash_field()) { int hash = java_lang_String::hash_string(obj); obj->int_field_put(hash_offset, hash); } diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index 61d922760c5..b3dca953133 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3748,3 +3748,81 @@ void GraphKit::g1_write_barrier_post(Node* oop_store, final_sync(ideal); } #undef __ + + + +Node* GraphKit::load_String_offset(Node* ctrl, Node* str) { + if (java_lang_String::has_offset_field()) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* offset_field_type = string_type->add_offset(offset_offset); + int offset_field_idx = C->get_alias_index(offset_field_type); + return make_load(ctrl, + basic_plus_adr(str, str, offset_offset), + TypeInt::INT, T_INT, offset_field_idx); + } else { + return intcon(0); + } +} + +Node* GraphKit::load_String_length(Node* ctrl, Node* str) { + if (java_lang_String::has_count_field()) { + int count_offset = java_lang_String::count_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* count_field_type = string_type->add_offset(count_offset); + int count_field_idx = C->get_alias_index(count_field_type); + return make_load(ctrl, + basic_plus_adr(str, str, count_offset), + TypeInt::INT, T_INT, count_field_idx); + } else { + return load_array_length(load_String_value(ctrl, str)); + } +} + +Node* GraphKit::load_String_value(Node* ctrl, Node* str) { + int value_offset = java_lang_String::value_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* value_field_type = string_type->add_offset(value_offset); + const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, + TypeAry::make(TypeInt::CHAR,TypeInt::POS), + ciTypeArrayKlass::make(T_CHAR), true, 0); + int value_field_idx = C->get_alias_index(value_field_type); + return make_load(ctrl, basic_plus_adr(str, str, value_offset), + value_type, T_OBJECT, value_field_idx); +} + +void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* offset_field_type = string_type->add_offset(offset_offset); + int offset_field_idx = C->get_alias_index(offset_field_type); + store_to_memory(ctrl, basic_plus_adr(str, offset_offset), + value, T_INT, offset_field_idx); +} + +void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) { + int value_offset = java_lang_String::value_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* value_field_type = string_type->add_offset(value_offset); + const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, + TypeAry::make(TypeInt::CHAR,TypeInt::POS), + ciTypeArrayKlass::make(T_CHAR), true, 0); + int value_field_idx = C->get_alias_index(value_field_type); + store_to_memory(ctrl, basic_plus_adr(str, value_offset), + value, T_OBJECT, value_field_idx); +} + +void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) { + int count_offset = java_lang_String::count_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* count_field_type = string_type->add_offset(count_offset); + int count_field_idx = C->get_alias_index(count_field_type); + store_to_memory(ctrl, basic_plus_adr(str, count_offset), + value, T_INT, count_field_idx); +} diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp index bffebc8798e..723e65e3b05 100644 --- a/hotspot/src/share/vm/opto/graphKit.hpp +++ b/hotspot/src/share/vm/opto/graphKit.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -781,6 +781,14 @@ class GraphKit : public Phase { Node* new_array(Node* klass_node, Node* count_val, int nargs, Node* *return_size_val = NULL); + // java.lang.String helpers + Node* load_String_offset(Node* ctrl, Node* str); + Node* load_String_length(Node* ctrl, Node* str); + Node* load_String_value(Node* ctrl, Node* str); + void store_String_offset(Node* ctrl, Node* str, Node* value); + void store_String_length(Node* ctrl, Node* str, Node* value); + void store_String_value(Node* ctrl, Node* str, Node* value); + // Handy for making control flow IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) { IfNode* iff = new (C, 2) IfNode(ctrl, tst, prob, cnt);// New IfNode's diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 13c3a4327ce..e0f5f95915f 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -147,7 +147,8 @@ class LibraryCallKit : public GraphKit { return generate_method_call(method_id, true, false); } - Node* make_string_method_node(int opcode, Node* str1, Node* cnt1, Node* str2, Node* cnt2); + Node* make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2); + Node* make_string_method_node(int opcode, Node* str1, Node* str2); bool inline_string_compareTo(); bool inline_string_indexOf(); Node* string_indexOf(Node* string_object, ciTypeArray* target_array, jint offset, jint cache_i, jint md2_i); @@ -873,48 +874,76 @@ Node* LibraryCallKit::generate_current_thread(Node* &tls_output) { //------------------------------make_string_method_node------------------------ -// Helper method for String intrinsic finctions. -Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* cnt1, Node* str2, Node* cnt2) { - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - +// Helper method for String intrinsic functions. This version is called +// with str1 and str2 pointing to String object nodes. +// +Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* str2) { Node* no_ctrl = NULL; - ciInstanceKlass* klass = env()->String_klass(); - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - - const TypeAryPtr* value_type = - TypeAryPtr::make(TypePtr::NotNull, - TypeAry::make(TypeInt::CHAR,TypeInt::POS), - ciTypeArrayKlass::make(T_CHAR), true, 0); - - // Get start addr of string and substring - Node* str1_valuea = basic_plus_adr(str1, str1, value_offset); - Node* str1_value = make_load(no_ctrl, str1_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); - Node* str1_offseta = basic_plus_adr(str1, str1, offset_offset); - Node* str1_offset = make_load(no_ctrl, str1_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); + // Get start addr of string + Node* str1_value = load_String_value(no_ctrl, str1); + Node* str1_offset = load_String_offset(no_ctrl, str1); Node* str1_start = array_element_address(str1_value, str1_offset, T_CHAR); - Node* str2_valuea = basic_plus_adr(str2, str2, value_offset); - Node* str2_value = make_load(no_ctrl, str2_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); - Node* str2_offseta = basic_plus_adr(str2, str2, offset_offset); - Node* str2_offset = make_load(no_ctrl, str2_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); + // Get length of string 1 + Node* str1_len = load_String_length(no_ctrl, str1); + + Node* str2_value = load_String_value(no_ctrl, str2); + Node* str2_offset = load_String_offset(no_ctrl, str2); Node* str2_start = array_element_address(str2_value, str2_offset, T_CHAR); + Node* str2_len = NULL; + Node* result = NULL; + + switch (opcode) { + case Op_StrIndexOf: + // Get length of string 2 + str2_len = load_String_length(no_ctrl, str2); + + result = new (C, 6) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str1_len, str2_start, str2_len); + break; + case Op_StrComp: + // Get length of string 2 + str2_len = load_String_length(no_ctrl, str2); + + result = new (C, 6) StrCompNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str1_len, str2_start, str2_len); + break; + case Op_StrEquals: + result = new (C, 5) StrEqualsNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str2_start, str1_len); + break; + default: + ShouldNotReachHere(); + return NULL; + } + + // All these intrinsics have checks. + C->set_has_split_ifs(true); // Has chance for split-if optimization + + return _gvn.transform(result); +} + +// Helper method for String intrinsic functions. This version is called +// with str1 and str2 pointing to char[] nodes, with cnt1 and cnt2 pointing +// to Int nodes containing the lenghts of str1 and str2. +// +Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2) { + Node* result = NULL; switch (opcode) { case Op_StrIndexOf: result = new (C, 6) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS), - str1_start, cnt1, str2_start, cnt2); + str1_start, cnt1, str2_start, cnt2); break; case Op_StrComp: result = new (C, 6) StrCompNode(control(), memory(TypeAryPtr::CHARS), - str1_start, cnt1, str2_start, cnt2); + str1_start, cnt1, str2_start, cnt2); break; case Op_StrEquals: result = new (C, 5) StrEqualsNode(control(), memory(TypeAryPtr::CHARS), - str1_start, str2_start, cnt1); + str1_start, str2_start, cnt1); break; default: ShouldNotReachHere(); @@ -932,10 +961,6 @@ bool LibraryCallKit::inline_string_compareTo() { if (!Matcher::has_match_rule(Op_StrComp)) return false; - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - _sp += 2; Node *argument = pop(); // pop non-receiver first: it was pushed second Node *receiver = pop(); @@ -952,18 +977,7 @@ bool LibraryCallKit::inline_string_compareTo() { return true; } - ciInstanceKlass* klass = env()->String_klass(); - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - Node* no_ctrl = NULL; - - // Get counts for string and argument - Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); - Node* receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - - Node* argument_cnta = basic_plus_adr(argument, argument, count_offset); - Node* argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - - Node* compare = make_string_method_node(Op_StrComp, receiver, receiver_cnt, argument, argument_cnt); + Node* compare = make_string_method_node(Op_StrComp, receiver, argument); push(compare); return true; } @@ -973,10 +987,6 @@ bool LibraryCallKit::inline_string_equals() { if (!Matcher::has_match_rule(Op_StrEquals)) return false; - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - int nargs = 2; _sp += nargs; Node* argument = pop(); // pop non-receiver first: it was pushed second @@ -1030,24 +1040,31 @@ bool LibraryCallKit::inline_string_equals() { } } - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - - Node* no_ctrl = NULL; - Node* receiver_cnt; - Node* argument_cnt; - if (!stopped()) { + const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); + // Properly cast the argument to String argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type)); // This path is taken only when argument's type is String:NotNull. argument = cast_not_null(argument, false); - // Get counts for string and argument - Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); - receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); + Node* no_ctrl = NULL; - Node* argument_cnta = basic_plus_adr(argument, argument, count_offset); - argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); + // Get start addr of receiver + Node* receiver_val = load_String_value(no_ctrl, receiver); + Node* receiver_offset = load_String_offset(no_ctrl, receiver); + Node* receiver_start = array_element_address(receiver_val, receiver_offset, T_CHAR); + + // Get length of receiver + Node* receiver_cnt = load_String_length(no_ctrl, receiver); + + // Get start addr of argument + Node* argument_val = load_String_value(no_ctrl, argument); + Node* argument_offset = load_String_offset(no_ctrl, argument); + Node* argument_start = array_element_address(argument_val, argument_offset, T_CHAR); + + // Get length of argument + Node* argument_cnt = load_String_length(no_ctrl, argument); // Check for receiver count != argument count Node* cmp = _gvn.transform( new(C, 3) CmpINode(receiver_cnt, argument_cnt) ); @@ -1057,14 +1074,14 @@ bool LibraryCallKit::inline_string_equals() { phi->init_req(4, intcon(0)); region->init_req(4, if_ne); } - } - // Check for count == 0 is done by mach node StrEquals. + // Check for count == 0 is done by assembler code for StrEquals. - if (!stopped()) { - Node* equals = make_string_method_node(Op_StrEquals, receiver, receiver_cnt, argument, argument_cnt); - phi->init_req(1, equals); - region->init_req(1, control()); + if (!stopped()) { + Node* equals = make_string_method_node(Op_StrEquals, receiver_start, receiver_cnt, argument_start, argument_cnt); + phi->init_req(1, equals); + region->init_req(1, control()); + } } // post merge @@ -1162,20 +1179,9 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar const int nargs = 2; // number of arguments to push back for uncommon trap in predicate - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - - ciInstanceKlass* klass = env()->String_klass(); - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - const TypeAryPtr* source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0); - - Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset); - Node* sourceOffset = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); - Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset); - Node* sourceCount = make_load(no_ctrl, sourceCounta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - Node* sourcea = basic_plus_adr(string_object, string_object, value_offset); - Node* source = make_load(no_ctrl, sourcea, source_type, T_OBJECT, string_type->add_offset(value_offset)); + Node* source = load_String_value(no_ctrl, string_object); + Node* sourceOffset = load_String_offset(no_ctrl, string_object); + Node* sourceCount = load_String_length(no_ctrl, string_object); Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) ); jint target_length = target_array->length(); @@ -1243,10 +1249,6 @@ Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_ar //------------------------------inline_string_indexOf------------------------ bool LibraryCallKit::inline_string_indexOf() { - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - _sp += 2; Node *argument = pop(); // pop non-receiver first: it was pushed second Node *receiver = pop(); @@ -1280,12 +1282,21 @@ bool LibraryCallKit::inline_string_indexOf() { Node* result_phi = new (C, 4) PhiNode(result_rgn, TypeInt::INT); Node* no_ctrl = NULL; - // Get counts for string and substr - Node* source_cnta = basic_plus_adr(receiver, receiver, count_offset); - Node* source_cnt = make_load(no_ctrl, source_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); + // Get start addr of source string + Node* source = load_String_value(no_ctrl, receiver); + Node* source_offset = load_String_offset(no_ctrl, receiver); + Node* source_start = array_element_address(source, source_offset, T_CHAR); - Node* substr_cnta = basic_plus_adr(argument, argument, count_offset); - Node* substr_cnt = make_load(no_ctrl, substr_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); + // Get length of source string + Node* source_cnt = load_String_length(no_ctrl, receiver); + + // Get start addr of substring + Node* substr = load_String_value(no_ctrl, argument); + Node* substr_offset = load_String_offset(no_ctrl, argument); + Node* substr_start = array_element_address(substr, substr_offset, T_CHAR); + + // Get length of source string + Node* substr_cnt = load_String_length(no_ctrl, argument); // Check for substr count > string count Node* cmp = _gvn.transform( new(C, 3) CmpINode(substr_cnt, source_cnt) ); @@ -1308,7 +1319,7 @@ bool LibraryCallKit::inline_string_indexOf() { } if (!stopped()) { - result = make_string_method_node(Op_StrIndexOf, receiver, source_cnt, argument, substr_cnt); + result = make_string_method_node(Op_StrIndexOf, source_start, source_cnt, substr_start, substr_cnt); result_phi->init_req(1, result); result_rgn->init_req(1, control()); } @@ -1333,11 +1344,19 @@ bool LibraryCallKit::inline_string_indexOf() { ciInstance* str = str_const->as_instance(); assert(str != NULL, "must be instance"); - ciObject* v = str->field_value_by_offset(value_offset).as_object(); - int o = str->field_value_by_offset(offset_offset).as_int(); - int c = str->field_value_by_offset(count_offset).as_int(); + ciObject* v = str->field_value_by_offset(java_lang_String::value_offset_in_bytes()).as_object(); ciTypeArray* pat = v->as_type_array(); // pattern (argument) character array + int o; + int c; + if (java_lang_String::has_offset_field()) { + o = str->field_value_by_offset(java_lang_String::offset_offset_in_bytes()).as_int(); + c = str->field_value_by_offset(java_lang_String::count_offset_in_bytes()).as_int(); + } else { + o = 0; + c = pat->length(); + } + // constant strings have no offset and count == length which // simplifies the resulting code somewhat so lets optimize for that. if (o != 0 || c != pat->length()) { diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp index 496e7a883d1..99498ea9598 100644 --- a/hotspot/src/share/vm/opto/stringopts.cpp +++ b/hotspot/src/share/vm/opto/stringopts.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -528,16 +528,6 @@ PhaseStringOpts::PhaseStringOpts(PhaseGVN* gvn, Unique_Node_List*): } // Collect the types needed to talk about the various slices of memory - const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), - false, NULL, 0); - - const TypePtr* value_field_type = string_type->add_offset(java_lang_String::value_offset_in_bytes()); - const TypePtr* offset_field_type = string_type->add_offset(java_lang_String::offset_offset_in_bytes()); - const TypePtr* count_field_type = string_type->add_offset(java_lang_String::count_offset_in_bytes()); - - value_field_idx = C->get_alias_index(value_field_type); - count_field_idx = C->get_alias_index(count_field_type); - offset_field_idx = C->get_alias_index(offset_field_type); char_adr_idx = C->get_alias_index(TypeAryPtr::CHARS); // For each locally allocated StringBuffer see if the usages can be @@ -1174,18 +1164,9 @@ void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, N Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* char_array, Node* start) { Node* string = str; - Node* offset = kit.make_load(kit.control(), - kit.basic_plus_adr(string, string, java_lang_String::offset_offset_in_bytes()), - TypeInt::INT, T_INT, offset_field_idx); - Node* count = kit.make_load(kit.control(), - kit.basic_plus_adr(string, string, java_lang_String::count_offset_in_bytes()), - TypeInt::INT, T_INT, count_field_idx); - const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, - TypeAry::make(TypeInt::CHAR,TypeInt::POS), - ciTypeArrayKlass::make(T_CHAR), true, 0); - Node* value = kit.make_load(kit.control(), - kit.basic_plus_adr(string, string, java_lang_String::value_offset_in_bytes()), - value_type, T_OBJECT, value_field_idx); + Node* offset = kit.load_String_offset(kit.control(), string); + Node* count = kit.load_String_length(kit.control(), string); + Node* value = kit.load_String_value (kit.control(), string); // copy the contents if (offset->is_Con() && count->is_Con() && value->is_Con() && count->get_int() < unroll_string_copy_length) { @@ -1342,10 +1323,9 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) { arg = phi; sc->set_argument(argi, arg); } - // Node* offset = kit.make_load(NULL, kit.basic_plus_adr(arg, arg, offset_offset), - // TypeInt::INT, T_INT, offset_field_idx); - Node* count = kit.make_load(kit.control(), kit.basic_plus_adr(arg, arg, java_lang_String::count_offset_in_bytes()), - TypeInt::INT, T_INT, count_field_idx); + + Node* count = kit.load_String_length(kit.control(), arg); + length = __ AddI(length, count); string_sizes->init_req(argi, NULL); break; @@ -1436,12 +1416,11 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) { } // Intialize the string - kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::offset_offset_in_bytes()), - __ intcon(0), T_INT, offset_field_idx); - kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::count_offset_in_bytes()), - length, T_INT, count_field_idx); - kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::value_offset_in_bytes()), - char_array, T_OBJECT, value_field_idx); + if (java_lang_String::has_offset_field()) { + kit.store_String_offset(kit.control(), result, __ intcon(0)); + kit.store_String_length(kit.control(), result, length); + } + kit.store_String_value(kit.control(), result, char_array); // hook up the outgoing control and result kit.replace_call(sc->end(), result); diff --git a/hotspot/src/share/vm/opto/stringopts.hpp b/hotspot/src/share/vm/opto/stringopts.hpp index 1ffe6c3092d..0fb1ed70f64 100644 --- a/hotspot/src/share/vm/opto/stringopts.hpp +++ b/hotspot/src/share/vm/opto/stringopts.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,9 +41,6 @@ class PhaseStringOpts : public Phase { // Memory slices needed for code gen int char_adr_idx; - int value_field_idx; - int count_field_idx; - int offset_field_idx; // Integer.sizeTable - used for int to String conversion ciField* size_table_field; From c23595da74e4ab46e73b3d6c93068f6b0faa847a Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Tue, 15 May 2012 00:56:06 +0200 Subject: [PATCH 41/73] 7158457: division by zero in adaptiveweightedaverage Add ceiling to AdaptiveWeightedAverage Reviewed-by: ysr, iveresov --- .../vm/gc_implementation/shared/gcUtil.cpp | 14 +++++++++----- .../vm/gc_implementation/shared/gcUtil.hpp | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp index 5325fee218b..3b9fd7a68aa 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.cpp @@ -31,9 +31,15 @@ float AdaptiveWeightedAverage::compute_adaptive_average(float new_sample, float average) { // We smooth the samples by not using weight() directly until we've // had enough data to make it meaningful. We'd like the first weight - // used to be 1, the second to be 1/2, etc until we have 100/weight - // samples. - unsigned count_weight = 100/count(); + // used to be 1, the second to be 1/2, etc until we have + // OLD_THRESHOLD/weight samples. + unsigned count_weight = 0; + + // Avoid division by zero if the counter wraps (7158457) + if (!is_old()) { + count_weight = OLD_THRESHOLD/count(); + } + unsigned adaptive_weight = (MAX2(weight(), count_weight)); float new_avg = exp_avg(average, new_sample, adaptive_weight); @@ -43,8 +49,6 @@ float AdaptiveWeightedAverage::compute_adaptive_average(float new_sample, void AdaptiveWeightedAverage::sample(float new_sample) { increment_count(); - assert(count() != 0, - "Wraparound -- history would be incorrectly discarded"); // Compute the new weighted average float new_avg = compute_adaptive_average(new_sample, average()); diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp index 8dd3258de0a..86daba64c3f 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gcUtil.hpp @@ -50,11 +50,20 @@ class AdaptiveWeightedAverage : public CHeapObj { unsigned _weight; // The weight used to smooth the averages // A higher weight favors the most // recent data. + bool _is_old; // Has enough historical data + + const static unsigned OLD_THRESHOLD = 100; protected: float _last_sample; // The last value sampled. - void increment_count() { _sample_count++; } + void increment_count() { + _sample_count++; + if (!_is_old && _sample_count > OLD_THRESHOLD) { + _is_old = true; + } + } + void set_average(float avg) { _average = avg; } // Helper function, computes an adaptive weighted average @@ -64,13 +73,15 @@ class AdaptiveWeightedAverage : public CHeapObj { public: // Input weight must be between 0 and 100 AdaptiveWeightedAverage(unsigned weight, float avg = 0.0) : - _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0) { + _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0), + _is_old(false) { } void clear() { _average = 0; _sample_count = 0; _last_sample = 0; + _is_old = false; } // Useful for modifying static structures after startup. @@ -84,7 +95,8 @@ class AdaptiveWeightedAverage : public CHeapObj { float average() const { return _average; } unsigned weight() const { return _weight; } unsigned count() const { return _sample_count; } - float last_sample() const { return _last_sample; } + float last_sample() const { return _last_sample; } + bool is_old() const { return _is_old; } // Update data with a new sample. void sample(float new_sample); From 73636f80f035e77c4f4dcb9e40b06315d1b81871 Mon Sep 17 00:00:00 2001 From: John Cuthbertson Date: Tue, 15 May 2012 09:49:18 -0700 Subject: [PATCH 42/73] 7168294: G1: Some Full GCs incorrectly report GC cause as "No GC" GC cause was not being set by the VM_G1CollectForAllocation VM operation. Reviewed-by: jmasa, ysr, brutisso --- hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp index 1a330ba6483..d880f5509ad 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp @@ -42,6 +42,7 @@ VM_G1CollectForAllocation::VM_G1CollectForAllocation( void VM_G1CollectForAllocation::doit() { G1CollectedHeap* g1h = G1CollectedHeap::heap(); + GCCauseSetter x(g1h, _gc_cause); _result = g1h->satisfy_failed_allocation(_word_size, &_pause_succeeded); assert(_result == NULL || _pause_succeeded, "if we get back a result, the pause should have succeeded"); From b2d4591455d21e86b271c1f728f69daafa6bae18 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Tue, 15 May 2012 22:26:37 +0200 Subject: [PATCH 43/73] 7169056: Add gigabyte unit to proper_unit_for_byte_size() and byte_size_in_proper_unit() Reviewed-by: jwilhelm, johnc, dholmes --- hotspot/src/share/vm/utilities/globalDefinitions.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 55904058bf8..82a9333b789 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -179,6 +179,11 @@ const jlong NANOSECS_PER_SEC = CONST64(1000000000); const jint NANOSECS_PER_MILLISEC = 1000000; inline const char* proper_unit_for_byte_size(size_t s) { +#ifdef _LP64 + if (s >= 10*G) { + return "G"; + } +#endif if (s >= 10*M) { return "M"; } else if (s >= 10*K) { @@ -190,6 +195,11 @@ inline const char* proper_unit_for_byte_size(size_t s) { template inline T byte_size_in_proper_unit(T s) { +#ifdef _LP64 + if (s >= 10*G) { + return (T)(s/G); + } +#endif if (s >= 10*M) { return (T)(s/M); } else if (s >= 10*K) { From eba9965d54fd3506afb93d2d7e7cad7531c57a72 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Tue, 15 May 2012 10:25:06 +0200 Subject: [PATCH 44/73] 7166894: Add gc cause to GC logging for all collectors Reviewed-by: mgerdin, johnc --- .../concurrentMarkSweepGeneration.cpp | 4 +-- .../concurrentMarkSweepGeneration.hpp | 2 +- .../concurrentMarkSweep/vmCMSOperations.cpp | 4 +-- .../gc_implementation/g1/g1CollectedHeap.cpp | 15 +++------ .../g1/g1CollectorPolicy.cpp | 5 ++- .../parNew/parNewGeneration.cpp | 2 +- .../parallelScavenge/psMarkSweep.cpp | 10 ++---- .../parallelScavenge/psParallelCompact.cpp | 13 ++------ .../parallelScavenge/psScavenge.cpp | 2 +- hotspot/src/share/vm/gc_interface/gcCause.hpp | 32 +++++++++++++++++++ .../src/share/vm/memory/defNewGeneration.cpp | 2 +- .../src/share/vm/memory/genCollectedHeap.cpp | 15 ++------- hotspot/src/share/vm/memory/genMarkSweep.cpp | 2 +- hotspot/src/share/vm/runtime/arguments.cpp | 8 +++++ hotspot/src/share/vm/runtime/globals.hpp | 5 ++- hotspot/src/share/vm/runtime/java.hpp | 8 +++++ 16 files changed, 75 insertions(+), 54 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 5825a5772fc..938e94efcff 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -6332,10 +6332,10 @@ void CMSCollector::reset(bool asynch) { ) } -void CMSCollector::do_CMS_operation(CMS_op_type op) { +void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) { gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - TraceTime t("GC", PrintGC, !PrintGCDetails, gclog_or_tty); + TraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty); TraceCollectorStats tcs(counters()); switch (op) { diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp index a84253888b0..ecc60cc3ead 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @@ -717,7 +717,7 @@ class CMSCollector: public CHeapObj { CMS_op_checkpointRootsFinal }; - void do_CMS_operation(CMS_op_type op); + void do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause); bool stop_world_and_do(CMS_op_type op); OopTaskQueueSet* task_queues() { return _task_queues; } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp index c3b9d54bec3..3b8d5aa0878 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp @@ -146,7 +146,7 @@ void VM_CMS_Initial_Mark::doit() { VM_CMS_Operation::verify_before_gc(); IsGCActiveMark x; // stop-world GC active - _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial); + _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause()); VM_CMS_Operation::verify_after_gc(); #ifndef USDT2 @@ -178,7 +178,7 @@ void VM_CMS_Final_Remark::doit() { VM_CMS_Operation::verify_before_gc(); IsGCActiveMark x; // stop-world GC active - _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal); + _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause()); VM_CMS_Operation::verify_after_gc(); #ifndef USDT2 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index fa71befcfe8..9d1f9d92ddc 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1252,10 +1252,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps); TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); - char verbose_str[128]; - sprintf(verbose_str, "Full GC (%s)", GCCause::to_string(gc_cause())); - TraceTime t(verbose_str, G1Log::fine(), true, gclog_or_tty); - + TraceTime t(GCCauseString("Full GC", gc_cause()), G1Log::fine(), true, gclog_or_tty); TraceCollectorStats tcs(g1mm()->full_collection_counters()); TraceMemoryManagerStats tms(true /* fullGC */, gc_cause()); @@ -3600,12 +3597,10 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps); TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); - char verbose_str[128]; - sprintf(verbose_str, "GC pause (%s) (%s)%s", - GCCause::to_string(gc_cause()), - g1_policy()->gcs_are_young() ? "young" : "mixed", - g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : ""); - TraceTime t(verbose_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty); + GCCauseString gc_cause_str = GCCauseString("GC pause", gc_cause()) + .append(g1_policy()->gcs_are_young() ? " (young)" : " (mixed)") + .append(g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : ""); + TraceTime t(gc_cause_str, G1Log::fine() && !G1Log::finer(), true, gclog_or_tty); TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); TraceMemoryManagerStats tms(false /* fullGC */, gc_cause()); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 05dea1c4854..2050f6f5bba 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -886,9 +886,8 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, size_t start_used) { if (G1Log::finer()) { gclog_or_tty->stamp(PrintGCTimeStamps); - gclog_or_tty->print("[GC pause (%s) (%s)", - GCCause::to_string(_g1->gc_cause()), - gcs_are_young() ? "young" : "mixed"); + gclog_or_tty->print("[%s", (const char*)GCCauseString("GC pause", _g1->gc_cause()) + .append(gcs_are_young() ? " (young)" : " (mixed)")); } // We only need to do this here as the policy will only be applied diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 4f64dff0824..96ae468f0bf 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -916,7 +916,7 @@ void ParNewGeneration::collect(bool full, size_policy->minor_collection_begin(); } - TraceTime t1("GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); + TraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty); // Capture heap used before collection (for printing). size_t gch_prev_used = gch->used(); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index ad599ae3219..0ef97523630 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -160,16 +160,10 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { { HandleMark hm; - const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc; - // This is useful for debugging but don't change the output the - // the customer sees. - const char* gc_cause_str = "Full GC"; - if (is_system_gc && PrintGCDetails) { - gc_cause_str = "Full GC (System)"; - } + gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty); + TraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty); TraceCollectorStats tcs(counters()); TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index 354b3d04347..8e7c74e4495 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -2047,17 +2047,9 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { gc_task_manager()->task_idle_workers(); heap->set_par_threads(gc_task_manager()->active_workers()); - const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc; - - // This is useful for debugging but don't change the output the - // the customer sees. - const char* gc_cause_str = "Full GC"; - if (is_system_gc && PrintGCDetails) { - gc_cause_str = "Full GC (System)"; - } gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty); + TraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty); TraceCollectorStats tcs(counters()); TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); @@ -2090,7 +2082,8 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { } #endif // #ifndef PRODUCT - bool max_on_system_gc = UseMaximumCompactionOnSystemGC && is_system_gc; + bool max_on_system_gc = UseMaximumCompactionOnSystemGC + && gc_cause == GCCause::_java_lang_system_gc; summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc); COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity")); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index 984b1a452eb..65ece052d16 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @@ -325,7 +325,7 @@ bool PSScavenge::invoke_no_policy() { gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - TraceTime t1("GC", PrintGC, !PrintGCDetails, gclog_or_tty); + TraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty); TraceCollectorStats tcs(counters()); TraceMemoryManagerStats tms(false /* not full GC */,gc_cause); diff --git a/hotspot/src/share/vm/gc_interface/gcCause.hpp b/hotspot/src/share/vm/gc_interface/gcCause.hpp index ae14115d7e2..8866d7675ce 100644 --- a/hotspot/src/share/vm/gc_interface/gcCause.hpp +++ b/hotspot/src/share/vm/gc_interface/gcCause.hpp @@ -88,4 +88,36 @@ class GCCause : public AllStatic { static const char* to_string(GCCause::Cause cause); }; +// Helper class for doing logging that includes the GC Cause +// as a string. +class GCCauseString : StackObj { + private: + static const int _length = 128; + char _buffer[_length]; + int _position; + + public: + GCCauseString(const char* prefix, GCCause::Cause cause) { + if (PrintGCCause) { + _position = jio_snprintf(_buffer, _length, "%s (%s)", prefix, GCCause::to_string(cause)); + } else { + _position = jio_snprintf(_buffer, _length, "%s", prefix); + } + assert(_position >= 0 && _position <= _length, + err_msg("Need to increase the buffer size in GCCauseString? %d", _position)); + } + + GCCauseString& append(const char* str) { + int res = jio_snprintf(_buffer + _position, _length - _position, "%s", str); + _position += res; + assert(res >= 0 && _position <= _length, + err_msg("Need to increase the buffer size in GCCauseString? %d", res)); + return *this; + } + + operator const char*() { + return _buffer; + } +}; + #endif // SHARE_VM_GC_INTERFACE_GCCAUSE_HPP diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 315a38248c9..452f630730a 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -548,7 +548,7 @@ void DefNewGeneration::collect(bool full, init_assuming_no_promotion_failure(); - TraceTime t1("GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); + TraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty); // Capture heap used before collection (for printing). size_t gch_prev_used = gch->used(); diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 10c3274548d..40f5afda442 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -480,26 +480,15 @@ void GenCollectedHeap::do_collection(bool full, const size_t perm_prev_used = perm_gen()->used(); print_heap_before_gc(); - if (Verbose) { - gclog_or_tty->print_cr("GC Cause: %s", GCCause::to_string(gc_cause())); - } { FlagSetting fl(_is_gc_active, true); bool complete = full && (max_level == (n_gens()-1)); - const char* gc_cause_str = "GC "; - if (complete) { - GCCause::Cause cause = gc_cause(); - if (cause == GCCause::_java_lang_system_gc) { - gc_cause_str = "Full GC (System) "; - } else { - gc_cause_str = "Full GC "; - } - } + const char* gc_cause_prefix = complete ? "Full GC" : "GC"; gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); - TraceTime t(gc_cause_str, PrintGCDetails, false, gclog_or_tty); + TraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, gclog_or_tty); gc_prologue(complete); increment_total_collections(complete); diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp index d5cf4dc7562..4d13fbb22dd 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp @@ -76,7 +76,7 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, _ref_processor = rp; rp->setup_policy(clear_all_softrefs); - TraceTime t1("Full GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); + TraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty); // When collecting the permanent generation methodOops may be moving, // so we either have to flush all bcp data or convert it into bci. diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 8deacc6f564..7f3ea3ecf7d 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -3092,6 +3092,14 @@ jint Arguments::parse(const JavaVMInitArgs* args) { PrintGC = true; } + if (!JDK_Version::is_gte_jdk18x_version()) { + // To avoid changing the log format for 7 updates this flag is only + // true by default in JDK8 and above. + if (FLAG_IS_DEFAULT(PrintGCCause)) { + FLAG_SET_DEFAULT(PrintGCCause, false); + } + } + // Set object alignment values. set_object_alignment(); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 7ad4f9a042c..d030b4f1740 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -3902,7 +3902,10 @@ class CommandLineFlags { " of this flag is true for JDK 6 and earlier") \ \ diagnostic(bool, WhiteBoxAPI, false, \ - "Enable internal testing APIs") + "Enable internal testing APIs") \ + \ + product(bool, PrintGCCause, true, \ + "Include GC cause in GC logging") /* * Macros for factoring of globals diff --git a/hotspot/src/share/vm/runtime/java.hpp b/hotspot/src/share/vm/runtime/java.hpp index 307fcc2fb36..102fd6b7acd 100644 --- a/hotspot/src/share/vm/runtime/java.hpp +++ b/hotspot/src/share/vm/runtime/java.hpp @@ -206,6 +206,10 @@ class JDK_Version VALUE_OBJ_CLASS_SPEC { return current().compare_major(7) == 0; } + static bool is_jdk18x_version() { + return current().compare_major(8) == 0; + } + static bool is_gte_jdk13x_version() { return current().compare_major(3) >= 0; } @@ -225,6 +229,10 @@ class JDK_Version VALUE_OBJ_CLASS_SPEC { static bool is_gte_jdk17x_version() { return current().compare_major(7) >= 0; } + + static bool is_gte_jdk18x_version() { + return current().compare_major(8) >= 0; + } }; #endif // SHARE_VM_RUNTIME_JAVA_HPP From 6d2f5978f789f139c3265061419b68b3037d610a Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Tue, 15 May 2012 15:04:10 +0400 Subject: [PATCH 45/73] 7168550: [macosx] duplicate OGL context state changes related to vertex cache Reviewed-by: bae, swingler --- .../native/sun/java2d/opengl/CGLSurfaceData.m | 3 +- .../native/sun/java2d/opengl/OGLContext.h | 1 + .../sun/java2d/opengl/OGLTextRenderer.c | 9 ++-- .../native/sun/java2d/opengl/OGLVertexCache.c | 42 ++++++++++--------- .../native/sun/java2d/opengl/OGLVertexCache.h | 2 +- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/jdk/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m b/jdk/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m index 34ba33c496a..cc8de1aa8ec 100644 --- a/jdk/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m +++ b/jdk/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m @@ -204,7 +204,8 @@ JNF_COCOA_ENTER(env); if (!CGLSD_MakeCurrentToScratch(env, oglc)) { return NULL; } - } else if ([NSOpenGLContext currentContext] == nil) { + // make sure our context is current + } else if ([NSOpenGLContext currentContext] != ctxinfo->context) { [ctxinfo->context makeCurrentContext]; } diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLContext.h b/jdk/src/share/native/sun/java2d/opengl/OGLContext.h index 866d8f41280..5e236bb28c6 100644 --- a/jdk/src/share/native/sun/java2d/opengl/OGLContext.h +++ b/jdk/src/share/native/sun/java2d/opengl/OGLContext.h @@ -84,6 +84,7 @@ typedef struct { GLdouble *xformMatrix; GLuint blitTextureID; GLint textureFunction; + jboolean vertexCacheEnabled; } OGLContext; /** diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c b/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c index 12e028452ba..7a24d5222d5 100644 --- a/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c +++ b/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c @@ -202,11 +202,6 @@ OGLTR_InitGlyphCache(jboolean lcdCache) J2dTraceLn(J2D_TRACE_INFO, "OGLTR_InitGlyphCache"); - // init vertex cache (if it hasn't been already) - if (!OGLVertexCache_InitVertexCache()) { - return JNI_FALSE; - } - // init glyph cache data structure gcinfo = AccelGlyphCache_Init(OGLTR_CACHE_WIDTH, OGLTR_CACHE_HEIGHT, @@ -583,6 +578,10 @@ OGLTR_EnableGlyphVertexCache(OGLContext *oglc) { J2dTraceLn(J2D_TRACE_INFO, "OGLTR_EnableGlyphVertexCache"); + if (!OGLVertexCache_InitVertexCache(oglc)) { + return; + } + if (glyphCache == NULL) { if (!OGLTR_InitGlyphCache(JNI_FALSE)) { return; diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c index 87556d61d5d..574e2786fb9 100644 --- a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c +++ b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c @@ -67,29 +67,31 @@ static jint maskCacheIndex = 0; } while (0) jboolean -OGLVertexCache_InitVertexCache() +OGLVertexCache_InitVertexCache(OGLContext *oglc) { J2dTraceLn(J2D_TRACE_INFO, "OGLVertexCache_InitVertexCache"); - if (vertexCache != NULL) { - return JNI_TRUE; - } - - vertexCache = (J2DVertex *)malloc(OGLVC_MAX_INDEX * sizeof(J2DVertex)); if (vertexCache == NULL) { - return JNI_FALSE; + vertexCache = (J2DVertex *)malloc(OGLVC_MAX_INDEX * sizeof(J2DVertex)); + if (vertexCache == NULL) { + return JNI_FALSE; + } } - j2d_glTexCoordPointer(2, GL_FLOAT, - sizeof(J2DVertex), vertexCache); - j2d_glColorPointer(4, GL_UNSIGNED_BYTE, - sizeof(J2DVertex), ((jfloat *)vertexCache) + 2); - j2d_glVertexPointer(2, GL_FLOAT, - sizeof(J2DVertex), ((jfloat *)vertexCache) + 3); + if (!oglc->vertexCacheEnabled) { + j2d_glTexCoordPointer(2, GL_FLOAT, + sizeof(J2DVertex), vertexCache); + j2d_glColorPointer(4, GL_UNSIGNED_BYTE, + sizeof(J2DVertex), ((jfloat *)vertexCache) + 2); + j2d_glVertexPointer(2, GL_FLOAT, + sizeof(J2DVertex), ((jfloat *)vertexCache) + 3); - j2d_glEnableClientState(GL_TEXTURE_COORD_ARRAY); - j2d_glEnableClientState(GL_COLOR_ARRAY); - j2d_glEnableClientState(GL_VERTEX_ARRAY); + j2d_glEnableClientState(GL_TEXTURE_COORD_ARRAY); + j2d_glEnableClientState(GL_COLOR_ARRAY); + j2d_glEnableClientState(GL_VERTEX_ARRAY); + + oglc->vertexCacheEnabled = JNI_TRUE; + } return JNI_TRUE; } @@ -149,10 +151,6 @@ OGLVertexCache_InitMaskCache() { J2dTraceLn(J2D_TRACE_INFO, "OGLVertexCache_InitMaskCache"); - if (!OGLVertexCache_InitVertexCache()) { - return JNI_FALSE; - } - maskCacheTexID = OGLContext_CreateBlitTexture(GL_INTENSITY8, GL_LUMINANCE, OGLVC_MASK_CACHE_WIDTH_IN_TEXELS, @@ -179,6 +177,10 @@ OGLVertexCache_EnableMaskCache(OGLContext *oglc) { J2dTraceLn(J2D_TRACE_INFO, "OGLVertexCache_EnableMaskCache"); + if (!OGLVertexCache_InitVertexCache(oglc)) { + return; + } + if (maskCacheTexID == 0) { if (!OGLVertexCache_InitMaskCache()) { return; diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h index bf22d1f950e..0392d8558ee 100644 --- a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h +++ b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h @@ -65,7 +65,7 @@ /** * Exported methods. */ -jboolean OGLVertexCache_InitVertexCache(); +jboolean OGLVertexCache_InitVertexCache(OGLContext *oglc); void OGLVertexCache_FlushVertexCache(); void OGLVertexCache_RestoreColorState(OGLContext *oglc); From 9b0ee815d46f08fb5dd30f67e23580f1fe028891 Mon Sep 17 00:00:00 2001 From: Michael Fang Date: Tue, 15 May 2012 11:46:41 -0700 Subject: [PATCH 46/73] 7157855: jvisualvm.1 not included in binaries Reviewed-by: katleman, thurka --- jdk/make/common/Release.gmk | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/make/common/Release.gmk b/jdk/make/common/Release.gmk index 6143e261774..4d8ddb1a6c7 100644 --- a/jdk/make/common/Release.gmk +++ b/jdk/make/common/Release.gmk @@ -156,6 +156,7 @@ JDK_MAN_PAGES = \ jstack.1 \ jstat.1 \ jstatd.1 \ + jvisualvm.1 \ native2ascii.1 \ rmic.1 \ schemagen.1 \ From a4ab9d705055ec8edffb49f42b8ded097d354e2b Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Wed, 16 May 2012 13:15:27 +0400 Subject: [PATCH 47/73] 7124337: [macosx] FileDialog fails to select multiple files Reviewed-by: anthony, swingler --- .../classes/sun/lwawt/macosx/CFileDialog.java | 50 +++++++++++-------- jdk/src/macosx/native/sun/awt/CFileDialog.h | 12 +++-- jdk/src/macosx/native/sun/awt/CFileDialog.m | 48 +++++++++++++----- .../share/classes/java/awt/FileDialog.java | 12 ++--- .../share/classes/sun/awt/AWTAccessor.java | 4 +- .../sun/awt/X11/GtkFileDialogPeer.java | 10 +++- .../classes/sun/awt/X11/XFileDialogPeer.java | 11 +++- .../sun/awt/windows/WFileDialogPeer.java | 17 ++++--- 8 files changed, 106 insertions(+), 58 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java index 2c55692218e..b905f0bcc93 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java @@ -34,6 +34,7 @@ import java.util.List; import java.io.*; import sun.awt.CausedFocusEvent.Cause; +import sun.awt.AWTAccessor; import sun.java2d.pipe.Region; class CFileDialog implements FileDialogPeer { @@ -53,33 +54,40 @@ class CFileDialog implements FileDialogPeer { title = " "; } - String userFileName = nativeRunFileDialog(title, - dialogMode, navigateApps, + String[] userFileNames = nativeRunFileDialog(title, + dialogMode, + target.isMultipleMode(), + navigateApps, target.getFilenameFilter() != null, target.getDirectory(), target.getFile()); - File file = null; - if (userFileName != null) { - // the dialog wasn't cancelled - file = new File(userFileName); - } + String directory = null; + String file = null; + File[] files = null; - if (file != null) { - // make sure directory always ends in '/' - String parent = file.getParent(); - if (!parent.endsWith(File.separator)) { - parent = parent + File.separator; + if (userFileNames != null) { + // the dialog wasn't cancelled + int filesNumber = userFileNames.length; + files = new File[filesNumber]; + for (int i = 0; i < filesNumber; i++) { + files[i] = new File(userFileNames[i]); } - // store results back in component - target.setDirectory(parent); - target.setFile(file.getName()); - } else { - // setting file name to null is how we tell - // java client that user hit the cancel button - target.setFile(null); + directory = files[0].getParent(); + // make sure directory always ends in '/' + if (!directory.endsWith(File.separator)) { + directory = directory + File.separator; + } + + file = files[0].getName(); // pick any file } + + // store results back in component + AWTAccessor.FileDialogAccessor accessor = AWTAccessor.getFileDialogAccessor(); + accessor.setDirectory(target, directory); + accessor.setFile(target, file); + accessor.setFiles(target, files); } finally { // Java2 Dialog waits for hide to let show() return target.dispose(); @@ -133,8 +141,8 @@ class CFileDialog implements FileDialogPeer { return ret; } - private native String nativeRunFileDialog(String title, int mode, - boolean shouldNavigateApps, boolean hasFilenameFilter, + private native String[] nativeRunFileDialog(String title, int mode, + boolean multipleMode, boolean shouldNavigateApps, boolean hasFilenameFilter, String directory, String file); @Override diff --git a/jdk/src/macosx/native/sun/awt/CFileDialog.h b/jdk/src/macosx/native/sun/awt/CFileDialog.h index c9015899217..14ed63d24bf 100644 --- a/jdk/src/macosx/native/sun/awt/CFileDialog.h +++ b/jdk/src/macosx/native/sun/awt/CFileDialog.h @@ -46,11 +46,14 @@ // File dialog's mode jint fMode; + // Indicates whether the user can select multiple files + BOOL fMultipleMode; + // Should we navigate into apps? BOOL fNavigateApps; - // panel's filename - NSString *fReturnedFilename; + // Contains the absolute paths of the selected files as URLs + NSArray *fURLs; } // Allocator @@ -60,6 +63,7 @@ directory:(NSString *)inPath file:(NSString *)inFile mode:(jint)inMode + multipleMode:(BOOL)inMultipleMode shouldNavigate:(BOOL)inNavigateApps withEnv:(JNIEnv*)env; @@ -69,7 +73,7 @@ // Get dialog return value - (BOOL) userClickedOK; -// Filename user chose -- (NSString *) filename; +// Returns the absolute paths of the selected files as URLs +- (NSArray *) URLs; @end diff --git a/jdk/src/macosx/native/sun/awt/CFileDialog.m b/jdk/src/macosx/native/sun/awt/CFileDialog.m index 129ffd940b5..283cc8cb781 100644 --- a/jdk/src/macosx/native/sun/awt/CFileDialog.m +++ b/jdk/src/macosx/native/sun/awt/CFileDialog.m @@ -41,6 +41,7 @@ directory:(NSString *)inPath file:(NSString *)inFile mode:(jint)inMode + multipleMode:(BOOL)inMultipleMode shouldNavigate:(BOOL)inNavigateApps withEnv:(JNIEnv*)env; { @@ -54,6 +55,7 @@ fTitle = inTitle; [fTitle retain]; fMode = inMode; + fMultipleMode = inMultipleMode; fNavigateApps = inNavigateApps; fPanelResult = NSCancelButton; } @@ -79,8 +81,8 @@ [fTitle release]; fTitle = nil; - [fReturnedFilename release]; - fReturnedFilename = nil; + [fURLs release]; + fURLs = nil; [super dealloc]; } @@ -105,7 +107,7 @@ if (fMode == java_awt_FileDialog_LOAD) { NSOpenPanel *openPanel = (NSOpenPanel *)thePanel; - [openPanel setAllowsMultipleSelection:NO]; + [openPanel setAllowsMultipleSelection:fMultipleMode]; [openPanel setCanChooseFiles:YES]; [openPanel setCanChooseDirectories:NO]; [openPanel setCanCreateDirectories:YES]; @@ -114,8 +116,16 @@ [thePanel setDelegate:self]; fPanelResult = [thePanel runModalForDirectory:fDirectory file:fFile]; [thePanel setDelegate:nil]; - fReturnedFilename = [thePanel filename]; - [fReturnedFilename retain]; + + if ([self userClickedOK]) { + if (fMode == java_awt_FileDialog_LOAD) { + NSOpenPanel *openPanel = (NSOpenPanel *)thePanel; + fURLs = [openPanel URLs]; + } else { + fURLs = [NSArray arrayWithObject:[thePanel URL]]; + } + [fURLs retain]; + } } [self disposer]; @@ -158,8 +168,8 @@ return fPanelResult == NSOKButton; } -- (NSString *)filename { - return [[fReturnedFilename retain] autorelease]; +- (NSArray *)URLs { + return [[fURLs retain] autorelease]; } @end @@ -167,13 +177,14 @@ * Class: sun_lwawt_macosx_CFileDialog * Method: nativeRunFileDialog * Signature: (Ljava/lang/String;ILjava/io/FilenameFilter; - * Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; + * Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String; */ -JNIEXPORT jstring JNICALL +JNIEXPORT jobjectArray JNICALL Java_sun_lwawt_macosx_CFileDialog_nativeRunFileDialog -(JNIEnv *env, jobject peer, jstring title, jint mode, jboolean navigateApps, jboolean hasFilter, jstring directory, jstring file) +(JNIEnv *env, jobject peer, jstring title, jint mode, jboolean multipleMode, + jboolean navigateApps, jboolean hasFilter, jstring directory, jstring file) { - jstring returnValue = NULL; + jobjectArray returnValue = NULL; JNF_COCOA_ENTER(env); NSString *dialogTitle = JNFJavaToNSString(env, title); @@ -187,6 +198,7 @@ JNF_COCOA_ENTER(env); directory:JNFJavaToNSString(env, directory) file:JNFJavaToNSString(env, file) mode:mode + multipleMode:multipleMode shouldNavigate:navigateApps withEnv:env]; @@ -196,8 +208,18 @@ JNF_COCOA_ENTER(env); waitUntilDone:YES]; if ([dialogDelegate userClickedOK]) { - NSString *filename = [dialogDelegate filename]; - returnValue = JNFNSToJavaString(env, filename); + NSArray *urls = [dialogDelegate URLs]; + jsize count = [urls count]; + + jclass stringClass = (*env)->FindClass(env, "java/lang/String"); + returnValue = (*env)->NewObjectArray(env, count, stringClass, NULL); + (*env)->DeleteLocalRef(env, stringClass); + + [urls enumerateObjectsUsingBlock:^(id url, NSUInteger index, BOOL *stop) { + jstring filename = JNFNormalizedJavaStringForPath(env, [url path]); + (*env)->SetObjectArrayElement(env, returnValue, index, filename); + (*env)->DeleteLocalRef(env, filename); + }]; } [dialogDelegate release]; diff --git a/jdk/src/share/classes/java/awt/FileDialog.java b/jdk/src/share/classes/java/awt/FileDialog.java index ebff2c45fee..3739570abb5 100644 --- a/jdk/src/share/classes/java/awt/FileDialog.java +++ b/jdk/src/share/classes/java/awt/FileDialog.java @@ -147,8 +147,8 @@ public class FileDialog extends Dialog { static { AWTAccessor.setFileDialogAccessor( new AWTAccessor.FileDialogAccessor() { - public void setFiles(FileDialog fileDialog, String directory, String files[]) { - fileDialog.setFiles(directory, files); + public void setFiles(FileDialog fileDialog, File files[]) { + fileDialog.setFiles(files); } public void setFile(FileDialog fileDialog, String file) { fileDialog.file = ("".equals(file)) ? null : file; @@ -446,13 +446,9 @@ public class FileDialog extends Dialog { * @see #getFiles * @since 1.7 */ - private void setFiles(String directory, String files[]) { + private void setFiles(File files[]) { synchronized (getObjectLock()) { - int filesNumber = (files != null) ? files.length : 0; - this.files = new File[filesNumber]; - for (int i = 0; i < filesNumber; i++) { - this.files[i] = new File(directory, files[i]); - } + this.files = files; } } diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java index f8047790155..04a2799fe5f 100644 --- a/jdk/src/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java @@ -34,6 +34,8 @@ import java.awt.geom.Point2D; import java.awt.peer.ComponentPeer; import java.security.AccessControlContext; +import java.io.File; + /** * The AWTAccessor utility class. * The main purpose of this class is to enable accessing @@ -455,7 +457,7 @@ public final class AWTAccessor { /* * Sets the files the user selects */ - void setFiles(FileDialog fileDialog, String directory, String files[]); + void setFiles(FileDialog fileDialog, File files[]); /* * Sets the file the user selects diff --git a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java index ebd434a96df..71cb7f3ddc5 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java @@ -73,7 +73,7 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer { if (filenames == null) { accessor.setDirectory(fd, null); accessor.setFile(fd, null); - accessor.setFiles(fd, null, null); + accessor.setFiles(fd, null); } else { // Fix 6987233: add the trailing slash if it's absent String with_separator = directory; @@ -83,7 +83,13 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer { } accessor.setDirectory(fd, with_separator); accessor.setFile(fd, filenames[0]); - accessor.setFiles(fd, directory, filenames); + + int filesNumber = (filenames != null) ? filenames.length : 0; + File[] files = new File[filesNumber]; + for (int i = 0; i < filesNumber; i++) { + files[i] = new File(directory, filenames[i]); + } + accessor.setFiles(fd, files); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java index 9fac04660ca..f15dbd209d1 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java @@ -396,11 +396,18 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe savedFile = file.substring(index+1); } + String[] fileNames = fileList.getSelectedItems(); + int filesNumber = (fileNames != null) ? fileNames.length : 0; + File[] files = new File[filesNumber]; + for (int i = 0; i < filesNumber; i++) { + files[i] = new File(savedDir, fileNames[i]); + } + AWTAccessor.FileDialogAccessor fileDialogAccessor = AWTAccessor.getFileDialogAccessor(); fileDialogAccessor.setDirectory(target, savedDir); fileDialogAccessor.setFile(target, savedFile); - fileDialogAccessor.setFiles(target, savedDir, fileList.getSelectedItems()); + fileDialogAccessor.setFiles(target, files); } /** @@ -419,7 +426,7 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe fileDialogAccessor.setDirectory(target, null); fileDialogAccessor.setFile(target, null); - fileDialogAccessor.setFiles(target, null, null); + fileDialogAccessor.setFiles(target, null); handleQuitButton(); } diff --git a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java index 56568dcf3a1..11fe02f83d0 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java @@ -139,13 +139,16 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer { String jDirectory = null; String jFile = null; - String jFiles[] = null; + File[] jFiles = null; if (multiple) { jDirectory = wFiles[0]; - jFiles = new String[wFiles.length - 1]; - System.arraycopy(wFiles, 1, jFiles, 0, jFiles.length); - jFile = jFiles[1]; // choose any file + int filesNumber = wFiles.length - 1; + jFiles = new File[filesNumber]; + for (int i = 0; i < filesNumber; i++) { + jFiles[i] = new File(jDirectory, wFiles[i + 1]); + } + jFile = wFiles[1]; // choose any file } else { int index = wFiles[0].lastIndexOf(java.io.File.separatorChar); if (index == -1) { @@ -155,7 +158,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer { jDirectory = wFiles[0].substring(0, index + 1); jFile = wFiles[0].substring(index + 1); } - jFiles = new String[] { jFile }; + jFiles = new File[] { new File(jDirectory, jFile) }; } final FileDialog fileDialog = (FileDialog)target; @@ -163,7 +166,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer { fileDialogAccessor.setDirectory(fileDialog, jDirectory); fileDialogAccessor.setFile(fileDialog, jFile); - fileDialogAccessor.setFiles(fileDialog, jDirectory, jFiles); + fileDialogAccessor.setFiles(fileDialog, jFiles); WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { public void run() { @@ -178,7 +181,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer { final FileDialog fileDialog = (FileDialog)target; AWTAccessor.getFileDialogAccessor().setFile(fileDialog, null); - AWTAccessor.getFileDialogAccessor().setFiles(fileDialog, null, null); + AWTAccessor.getFileDialogAccessor().setFiles(fileDialog, null); WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() { public void run() { From c4b4c6a9a522581a1a79af23e163546688a72a83 Mon Sep 17 00:00:00 2001 From: Anthony Petrov Date: Wed, 16 May 2012 14:28:12 +0400 Subject: [PATCH 48/73] 7168851: [macosx] Netbeans crashes in CImage.nativeCreateNSImageFromArray Eliminate unnecessary -release call Reviewed-by: dcherepanov --- jdk/src/macosx/native/sun/awt/CImage.m | 1 - 1 file changed, 1 deletion(-) diff --git a/jdk/src/macosx/native/sun/awt/CImage.m b/jdk/src/macosx/native/sun/awt/CImage.m index 64a6f3c4ec1..330e9943f62 100644 --- a/jdk/src/macosx/native/sun/awt/CImage.m +++ b/jdk/src/macosx/native/sun/awt/CImage.m @@ -163,7 +163,6 @@ AWT_ASSERT_ANY_THREAD; if ([reps count]) { NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0, 0)]; [nsImage addRepresentations: reps]; - [reps release]; if (nsImage != nil) { CFRetain(nsImage); // GC From 5b3babf9c443dacc569525ba697facb63f78f00e Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Wed, 16 May 2012 16:27:12 +0400 Subject: [PATCH 49/73] 7169226: NLS: Please change the mnemonic assignment system for windows and motif properties Reviewed-by: rupashka --- .../plaf/motif/resources/motif.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_de.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_es.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_fr.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_it.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_ja.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_ko.properties | 43 ++++++++---------- .../motif/resources/motif_pt_BR.properties | 43 ++++++++---------- .../plaf/motif/resources/motif_sv.properties | 43 ++++++++---------- .../motif/resources/motif_zh_CN.properties | 43 ++++++++---------- .../motif/resources/motif_zh_TW.properties | 43 ++++++++---------- .../plaf/windows/resources/windows.properties | 44 +++++++++---------- .../windows/resources/windows_de.properties | 44 +++++++++---------- .../windows/resources/windows_es.properties | 44 +++++++++---------- .../windows/resources/windows_fr.properties | 44 +++++++++---------- .../windows/resources/windows_it.properties | 44 +++++++++---------- .../windows/resources/windows_ja.properties | 44 +++++++++---------- .../windows/resources/windows_ko.properties | 44 +++++++++---------- .../resources/windows_pt_BR.properties | 44 +++++++++---------- .../windows/resources/windows_sv.properties | 44 +++++++++---------- .../resources/windows_zh_CN.properties | 44 +++++++++---------- .../resources/windows_zh_TW.properties | 44 +++++++++---------- 22 files changed, 429 insertions(+), 528 deletions(-) diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif.properties index d3fee304abe..fed806c17dd 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Cancel -FileChooser.saveButtonText=Save -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Save -FileChooser.openDialogTitleText=Open -FileChooser.updateButtonText=Update -FileChooser.helpButtonText=Help -FileChooser.pathLabelText=Enter path or folder name: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filter -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Folders -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Files -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Enter file name: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Enter folder name: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Cancel +FileChooser.saveButton.textAndMnemonic=Save +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Save +FileChooser.openDialogTitle.textAndMnemonic=Open +FileChooser.updateButton.textAndMnemonic=Update +FileChooser.helpButton.textAndMnemonic=Help +FileChooser.pathLabel.textAndMnemonic=Enter &path or folder name: +FileChooser.filterLabel.textAndMnemonic=Filte&r +FileChooser.foldersLabel.textAndMnemonic=Fo&lders +FileChooser.filesLabel.textAndMnemonic=F&iles +FileChooser.enterFileNameLabel.textAndMnemonic=E&nter file name: +FileChooser.enterFolderNameLabel.textAndMnemonic=Enter folder name: -FileChooser.cancelButtonToolTipText=Abort file chooser dialog. -FileChooser.saveButtonToolTipText=Save selected file. -FileChooser.openButtonToolTipText=Open selected file. -FileChooser.updateButtonToolTipText=Update directory listing. -FileChooser.helpButtonToolTipText=FileChooser help. +FileChooser.cancelButtonToolTip.textAndMnemonic=Abort file chooser dialog. +FileChooser.saveButtonToolTip.textAndMnemonic=Save selected file. +FileChooser.openButtonToolTip.textAndMnemonic=Open selected file. +FileChooser.updateButtonToolTip.textAndMnemonic=Update directory listing. +FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser help. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties index e7723574a6d..1d2cc250ed3 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Abbrechen -FileChooser.saveButtonText=Speichern -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Speichern -FileChooser.openDialogTitleText=\u00D6ffnen -FileChooser.updateButtonText=Aktualisieren -FileChooser.helpButtonText=Hilfe -FileChooser.pathLabelText=Pfad- oder Ordnernamen eingeben: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filter -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Ordner -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Dateien -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Dateinamen eingeben: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Ordnernamen eingeben: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Abbrechen +FileChooser.saveButton.textAndMnemonic=Speichern +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Speichern +FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen +FileChooser.updateButton.textAndMnemonic=Aktualisieren +FileChooser.helpButton.textAndMnemonic=Hilfe +FileChooser.pathLabel.textAndMnemonic=&Pfad- oder Ordnernamen eingeben: +FileChooser.filterLabel.textAndMnemonic=Filte&r +FileChooser.foldersLabel.textAndMnemonic=Ordner(&L) +FileChooser.filesLabel.textAndMnemonic=Date&ien +FileChooser.enterFileNameLabel.textAndMnemonic=Datei&namen eingeben: +FileChooser.enterFolderNameLabel.textAndMnemonic=Ordnernamen eingeben: -FileChooser.cancelButtonToolTipText=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen. -FileChooser.saveButtonToolTipText=Ausgew\u00E4hlte Datei speichern. -FileChooser.openButtonToolTipText=Ausgew\u00E4hlte Datei \u00F6ffnen. -FileChooser.updateButtonToolTipText=Verzeichnisliste aktualisieren. -FileChooser.helpButtonToolTipText=FileChooser-Hilfe. +FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen. +FileChooser.saveButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei speichern. +FileChooser.openButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei \u00F6ffnen. +FileChooser.updateButtonToolTip.textAndMnemonic=Verzeichnisliste aktualisieren. +FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser-Hilfe. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties index 6d9aa8f16ba..2add8f218bb 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Cancelar -FileChooser.saveButtonText=Guardar -FileChooser.openButtonText=Aceptar -FileChooser.saveDialogTitleText=Guardar -FileChooser.openDialogTitleText=Abrir -FileChooser.updateButtonText=Actualizar -FileChooser.helpButtonText=Ayuda -FileChooser.pathLabelText=Introducir nombre de la ruta de acceso o carpeta: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filtro -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Carpetas -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Archivos -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Introducir nombre de archivo: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Introducir nombre de carpeta: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Cancelar +FileChooser.saveButton.textAndMnemonic=Guardar +FileChooser.openButton.textAndMnemonic=Aceptar +FileChooser.saveDialogTitle.textAndMnemonic=Guardar +FileChooser.openDialogTitle.textAndMnemonic=Abrir +FileChooser.updateButton.textAndMnemonic=Actualizar +FileChooser.helpButton.textAndMnemonic=Ayuda +FileChooser.pathLabel.textAndMnemonic=Introducir nombre de la ruta de acceso o car&peta: +FileChooser.filterLabel.textAndMnemonic=Filt&ro +FileChooser.foldersLabel.textAndMnemonic=Carpetas(&L) +FileChooser.filesLabel.textAndMnemonic=Arch&ivos +FileChooser.enterFileNameLabel.textAndMnemonic=I&ntroducir nombre de archivo: +FileChooser.enterFolderNameLabel.textAndMnemonic=Introducir nombre de carpeta: -FileChooser.cancelButtonToolTipText=Abortar cuadro de di\u00E1logo del selector de archivos. -FileChooser.saveButtonToolTipText=Guardar archivo seleccionado. -FileChooser.openButtonToolTipText=Abrir archivo seleccionado. -FileChooser.updateButtonToolTipText=Actualizar lista de directorios. -FileChooser.helpButtonToolTipText=Ayuda del selector de archivos. +FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar cuadro de di\u00E1logo del selector de archivos. +FileChooser.saveButtonToolTip.textAndMnemonic=Guardar archivo seleccionado. +FileChooser.openButtonToolTip.textAndMnemonic=Abrir archivo seleccionado. +FileChooser.updateButtonToolTip.textAndMnemonic=Actualizar lista de directorios. +FileChooser.helpButtonToolTip.textAndMnemonic=Ayuda del selector de archivos. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties index 392ecee5bd2..2d9f97885dd 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Annuler -FileChooser.saveButtonText=Enregistrer -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Enregistrer -FileChooser.openDialogTitleText=Ouvrir -FileChooser.updateButtonText=Mettre \u00E0 jour -FileChooser.helpButtonText=Aide -FileChooser.pathLabelText=Entrez le chemin ou le nom du dossier : -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filtre -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Dossiers -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Fichiers -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Entrez le nom du fichier : -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Entrez le nom du dossier : +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Annuler +FileChooser.saveButton.textAndMnemonic=Enregistrer +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer +FileChooser.openDialogTitle.textAndMnemonic=Ouvrir +FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jour +FileChooser.helpButton.textAndMnemonic=Aide +FileChooser.pathLabel.textAndMnemonic=Entrez le chemin ou le nom du dossier (&P): +FileChooser.filterLabel.textAndMnemonic=Filt&re +FileChooser.foldersLabel.textAndMnemonic=Dossiers(&L) +FileChooser.filesLabel.textAndMnemonic=F&ichiers +FileChooser.enterFileNameLabel.textAndMnemonic=E&ntrez le nom du fichier : +FileChooser.enterFolderNameLabel.textAndMnemonic=Entrez le nom du dossier : -FileChooser.cancelButtonToolTipText=Ferme la bo\u00EEte de dialogue du s\u00E9lecteur de fichiers. -FileChooser.saveButtonToolTipText=Enregistre le fichier s\u00E9lectionn\u00E9. -FileChooser.openButtonToolTipText=Ouvre le fichier s\u00E9lectionn\u00E9. -FileChooser.updateButtonToolTipText=Met \u00E0 jour la liste des r\u00E9pertoires. -FileChooser.helpButtonToolTipText=Aide du s\u00E9lecteur de fichiers +FileChooser.cancelButtonToolTip.textAndMnemonic=Ferme la bo\u00EEte de dialogue du s\u00E9lecteur de fichiers. +FileChooser.saveButtonToolTip.textAndMnemonic=Enregistre le fichier s\u00E9lectionn\u00E9. +FileChooser.openButtonToolTip.textAndMnemonic=Ouvre le fichier s\u00E9lectionn\u00E9. +FileChooser.updateButtonToolTip.textAndMnemonic=Met \u00E0 jour la liste des r\u00E9pertoires. +FileChooser.helpButtonToolTip.textAndMnemonic=Aide du s\u00E9lecteur de fichiers diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties index 9763045aee2..352a9d708cf 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Annulla -FileChooser.saveButtonText=Salva -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Salva -FileChooser.openDialogTitleText=Apri -FileChooser.updateButtonText=Aggiorna -FileChooser.helpButtonText=? -FileChooser.pathLabelText=Percorso o nome cartella: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filtro -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Cartelle -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=File -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Nome file: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Nome cartella: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Annulla +FileChooser.saveButton.textAndMnemonic=Salva +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Salva +FileChooser.openDialogTitle.textAndMnemonic=Apri +FileChooser.updateButton.textAndMnemonic=Aggiorna +FileChooser.helpButton.textAndMnemonic=? +FileChooser.pathLabel.textAndMnemonic=&Percorso o nome cartella: +FileChooser.filterLabel.textAndMnemonic=Filt&ro +FileChooser.foldersLabel.textAndMnemonic=Carte&lle +FileChooser.filesLabel.textAndMnemonic=F&ile +FileChooser.enterFileNameLabel.textAndMnemonic=&Nome file: +FileChooser.enterFolderNameLabel.textAndMnemonic=Nome cartella: -FileChooser.cancelButtonToolTipText=Chiude la finestra di dialogo di selezione file. -FileChooser.saveButtonToolTipText=Salva il file selezionato. -FileChooser.openButtonToolTipText=Apre il file selezionato. -FileChooser.updateButtonToolTipText=Aggiorna lista directory. -FileChooser.helpButtonToolTipText=Guida FileChooser. +FileChooser.cancelButtonToolTip.textAndMnemonic=Chiude la finestra di dialogo di selezione file. +FileChooser.saveButtonToolTip.textAndMnemonic=Salva il file selezionato. +FileChooser.openButtonToolTip.textAndMnemonic=Apre il file selezionato. +FileChooser.updateButtonToolTip.textAndMnemonic=Aggiorna lista directory. +FileChooser.helpButtonToolTip.textAndMnemonic=Guida FileChooser. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ja.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ja.properties index 97b505b5741..9b28788a645 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ja.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ja.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=\u53D6\u6D88 -FileChooser.saveButtonText=\u4FDD\u5B58 -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=\u4FDD\u5B58 -FileChooser.openDialogTitleText=\u958B\u304F -FileChooser.updateButtonText=\u66F4\u65B0 -FileChooser.helpButtonText=\u30D8\u30EB\u30D7 -FileChooser.pathLabelText=\u30D1\u30B9\u307E\u305F\u306F\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u5165\u529B: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=\u30D5\u30A3\u30EB\u30BF -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=\u30D5\u30A9\u30EB\u30C0 -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=\u30D5\u30A1\u30A4\u30EB -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u5165\u529B: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u5165\u529B: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88 +FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58 +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58 +FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F +FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0 +FileChooser.helpButton.textAndMnemonic=\u30D8\u30EB\u30D7 +FileChooser.pathLabel.textAndMnemonic=\u30D1\u30B9\u307E\u305F\u306F\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u5165\u529B(&P): +FileChooser.filterLabel.textAndMnemonic=\u30D5\u30A3\u30EB\u30BF(&R) +FileChooser.foldersLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0(&L) +FileChooser.filesLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB(&I) +FileChooser.enterFileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u5165\u529B(&N): +FileChooser.enterFolderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D\u3092\u5165\u529B: -FileChooser.cancelButtonToolTipText=\u30D5\u30A1\u30A4\u30EB\u30FB\u30C1\u30E5\u30FC\u30B6\u30FB\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002 -FileChooser.saveButtonToolTipText=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3057\u307E\u3059\u3002 -FileChooser.openButtonToolTipText=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304D\u307E\u3059\u3002 -FileChooser.updateButtonToolTipText=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30EA\u30B9\u30C8\u3092\u66F4\u65B0\u3057\u307E\u3059\u3002 -FileChooser.helpButtonToolTipText=FileChooser\u306E\u30D8\u30EB\u30D7\u3067\u3059\u3002 +FileChooser.cancelButtonToolTip.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u30FB\u30C1\u30E5\u30FC\u30B6\u30FB\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002 +FileChooser.saveButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3057\u307E\u3059\u3002 +FileChooser.openButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304D\u307E\u3059\u3002 +FileChooser.updateButtonToolTip.textAndMnemonic=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30EA\u30B9\u30C8\u3092\u66F4\u65B0\u3057\u307E\u3059\u3002 +FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser\u306E\u30D8\u30EB\u30D7\u3067\u3059\u3002 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties index 61c06c6949d..f7e2625e9c9 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_ko.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=\uCDE8\uC18C -FileChooser.saveButtonText=\uC800\uC7A5 -FileChooser.openButtonText=\uD655\uC778 -FileChooser.saveDialogTitleText=\uC800\uC7A5 -FileChooser.openDialogTitleText=\uC5F4\uAE30 -FileChooser.updateButtonText=\uAC31\uC2E0 -FileChooser.helpButtonText=\uB3C4\uC6C0\uB9D0 -FileChooser.pathLabelText=\uACBD\uB85C \uB610\uB294 \uD3F4\uB354 \uC774\uB984 \uC785\uB825: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=\uD544\uD130 -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=\uD3F4\uB354 -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=\uD30C\uC77C -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=\uD30C\uC77C \uC774\uB984 \uC785\uB825: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=\uD3F4\uB354 \uC774\uB984 \uC785\uB825: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C +FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5 +FileChooser.openButton.textAndMnemonic=\uD655\uC778 +FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5 +FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30 +FileChooser.updateButton.textAndMnemonic=\uAC31\uC2E0 +FileChooser.helpButton.textAndMnemonic=\uB3C4\uC6C0\uB9D0 +FileChooser.pathLabel.textAndMnemonic=\uACBD\uB85C \uB610\uB294 \uD3F4\uB354 \uC774\uB984 \uC785\uB825(&P): +FileChooser.filterLabel.textAndMnemonic=\uD544\uD130(&R) +FileChooser.foldersLabel.textAndMnemonic=\uD3F4\uB354(&L) +FileChooser.filesLabel.textAndMnemonic=\uD30C\uC77C(&I) +FileChooser.enterFileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984 \uC785\uB825(&N): +FileChooser.enterFolderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984 \uC785\uB825: -FileChooser.cancelButtonToolTipText=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4. -FileChooser.saveButtonToolTipText=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC800\uC7A5\uD569\uB2C8\uB2E4. -FileChooser.openButtonToolTipText=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC5FD\uB2C8\uB2E4. -FileChooser.updateButtonToolTipText=\uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uC744 \uAC31\uC2E0\uD569\uB2C8\uB2E4. -FileChooser.helpButtonToolTipText=FileChooser \uB3C4\uC6C0\uB9D0\uC785\uB2C8\uB2E4. +FileChooser.cancelButtonToolTip.textAndMnemonic=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4. +FileChooser.saveButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC800\uC7A5\uD569\uB2C8\uB2E4. +FileChooser.openButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC5FD\uB2C8\uB2E4. +FileChooser.updateButtonToolTip.textAndMnemonic=\uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uC744 \uAC31\uC2E0\uD569\uB2C8\uB2E4. +FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser \uB3C4\uC6C0\uB9D0\uC785\uB2C8\uB2E4. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties index 6e40ef51c06..a1af5396196 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Cancelar -FileChooser.saveButtonText=Salvar -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Salvar -FileChooser.openDialogTitleText=Abrir -FileChooser.updateButtonText=Atualizar -FileChooser.helpButtonText=Ajuda -FileChooser.pathLabelText=Informar caminho ou nome da pasta: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filtro -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Pastas -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Arquivos -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Informar nome do arquivo: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Informar nome da pasta: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Cancelar +FileChooser.saveButton.textAndMnemonic=Salvar +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Salvar +FileChooser.openDialogTitle.textAndMnemonic=Abrir +FileChooser.updateButton.textAndMnemonic=Atualizar +FileChooser.helpButton.textAndMnemonic=Ajuda +FileChooser.pathLabel.textAndMnemonic=Informar caminho ou nome da &pasta: +FileChooser.filterLabel.textAndMnemonic=Filt&ro +FileChooser.foldersLabel.textAndMnemonic=Pastas(&L) +FileChooser.filesLabel.textAndMnemonic=Arqu&ivos +FileChooser.enterFileNameLabel.textAndMnemonic=I&nformar nome do arquivo: +FileChooser.enterFolderNameLabel.textAndMnemonic=Informar nome da pasta: -FileChooser.cancelButtonToolTipText=Abortar caixa de di\u00E1logo do seletor de arquivos. -FileChooser.saveButtonToolTipText=Salvar arquivo selecionado. -FileChooser.openButtonToolTipText=Abrir arquivo selecionado. -FileChooser.updateButtonToolTipText=Atualizar lista de diret\u00F3rios. -FileChooser.helpButtonToolTipText=Ajuda do FileChooser. +FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar caixa de di\u00E1logo do seletor de arquivos. +FileChooser.saveButtonToolTip.textAndMnemonic=Salvar arquivo selecionado. +FileChooser.openButtonToolTip.textAndMnemonic=Abrir arquivo selecionado. +FileChooser.updateButtonToolTip.textAndMnemonic=Atualizar lista de diret\u00F3rios. +FileChooser.helpButtonToolTip.textAndMnemonic=Ajuda do FileChooser. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties index 4cd736baa9d..3592f4dca7e 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=Avbryt -FileChooser.saveButtonText=Spara -FileChooser.openButtonText=OK -FileChooser.saveDialogTitleText=Spara -FileChooser.openDialogTitleText=\u00D6ppna -FileChooser.updateButtonText=Uppdatera -FileChooser.helpButtonText=Hj\u00E4lp -FileChooser.pathLabelText=Ange s\u00F6kv\u00E4g eller mappnamn: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=Filter -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=Mappar -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=Filer -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=Ange filnamn: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=Ange ett mappnamn: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=Avbryt +FileChooser.saveButton.textAndMnemonic=Spara +FileChooser.openButton.textAndMnemonic=OK +FileChooser.saveDialogTitle.textAndMnemonic=Spara +FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna +FileChooser.updateButton.textAndMnemonic=Uppdatera +FileChooser.helpButton.textAndMnemonic=Hj\u00E4lp +FileChooser.pathLabel.textAndMnemonic=Ange s\u00F6kv\u00E4g eller mappnamn(&P): +FileChooser.filterLabel.textAndMnemonic=Filte&r +FileChooser.foldersLabel.textAndMnemonic=Mappar(&L) +FileChooser.filesLabel.textAndMnemonic=F&iler +FileChooser.enterFileNameLabel.textAndMnemonic=A&nge filnamn: +FileChooser.enterFolderNameLabel.textAndMnemonic=Ange ett mappnamn: -FileChooser.cancelButtonToolTipText=Avbryt dialogrutan Filv\u00E4ljare. -FileChooser.saveButtonToolTipText=Spara vald fil. -FileChooser.openButtonToolTipText=\u00D6ppna vald fil. -FileChooser.updateButtonToolTipText=Uppdatera kataloglistan. -FileChooser.helpButtonToolTipText=Hj\u00E4lp - Filv\u00E4ljare. +FileChooser.cancelButtonToolTip.textAndMnemonic=Avbryt dialogrutan Filv\u00E4ljare. +FileChooser.saveButtonToolTip.textAndMnemonic=Spara vald fil. +FileChooser.openButtonToolTip.textAndMnemonic=\u00D6ppna vald fil. +FileChooser.updateButtonToolTip.textAndMnemonic=Uppdatera kataloglistan. +FileChooser.helpButtonToolTip.textAndMnemonic=Hj\u00E4lp - Filv\u00E4ljare. diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties index 121fe60a8ff..c2c1ecdfc9f 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=\u53D6\u6D88 -FileChooser.saveButtonText=\u4FDD\u5B58 -FileChooser.openButtonText=\u786E\u5B9A -FileChooser.saveDialogTitleText=\u4FDD\u5B58 -FileChooser.openDialogTitleText=\u6253\u5F00 -FileChooser.updateButtonText=\u66F4\u65B0 -FileChooser.helpButtonText=\u5E2E\u52A9 -FileChooser.pathLabelText=\u952E\u5165\u8DEF\u5F84\u6216\u6587\u4EF6\u5939\u540D: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=\u7B5B\u9009\u5668 -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=\u6587\u4EF6\u5939 -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=\u6587\u4EF6 -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=\u952E\u5165\u6587\u4EF6\u540D: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=\u8F93\u5165\u6587\u4EF6\u5939\u540D: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88 +FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58 +FileChooser.openButton.textAndMnemonic=\u786E\u5B9A +FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58 +FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00 +FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0 +FileChooser.helpButton.textAndMnemonic=\u5E2E\u52A9 +FileChooser.pathLabel.textAndMnemonic=\u952E\u5165\u8DEF\u5F84\u6216\u6587\u4EF6\u5939\u540D: (&P) +FileChooser.filterLabel.textAndMnemonic=\u7B5B\u9009\u5668(&R) +FileChooser.foldersLabel.textAndMnemonic=\u6587\u4EF6\u5939(&L) +FileChooser.filesLabel.textAndMnemonic=\u6587\u4EF6(&I) +FileChooser.enterFileNameLabel.textAndMnemonic=\u952E\u5165\u6587\u4EF6\u540D: (&N) +FileChooser.enterFolderNameLabel.textAndMnemonic=\u8F93\u5165\u6587\u4EF6\u5939\u540D: -FileChooser.cancelButtonToolTipText=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002 -FileChooser.saveButtonToolTipText=\u4FDD\u5B58\u6240\u9009\u6587\u4EF6\u3002 -FileChooser.openButtonToolTipText=\u6253\u5F00\u6240\u9009\u6587\u4EF6\u3002 -FileChooser.updateButtonToolTipText=\u66F4\u65B0\u76EE\u5F55\u5217\u8868\u3002 -FileChooser.helpButtonToolTipText=FileChooser \u5E2E\u52A9\u3002 +FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002 +FileChooser.saveButtonToolTip.textAndMnemonic=\u4FDD\u5B58\u6240\u9009\u6587\u4EF6\u3002 +FileChooser.openButtonToolTip.textAndMnemonic=\u6253\u5F00\u6240\u9009\u6587\u4EF6\u3002 +FileChooser.updateButtonToolTip.textAndMnemonic=\u66F4\u65B0\u76EE\u5F55\u5217\u8868\u3002 +FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser \u5E2E\u52A9\u3002 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties index 1b2d9d76c4b..6e77bbaf126 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_TW.properties @@ -18,28 +18,23 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.acceptAllFileFilterText=* -FileChooser.cancelButtonText=\u53D6\u6D88 -FileChooser.saveButtonText=\u5132\u5B58 -FileChooser.openButtonText=\u78BA\u5B9A -FileChooser.saveDialogTitleText=\u5132\u5B58 -FileChooser.openDialogTitleText=\u958B\u555F -FileChooser.updateButtonText=\u66F4\u65B0 -FileChooser.helpButtonText=\u8AAA\u660E -FileChooser.pathLabelText=\u8F38\u5165\u8DEF\u5F91\u6216\u8CC7\u6599\u593E\u540D\u7A31: -FileChooser.pathLabelMnemonic=80 -FileChooser.filterLabelText=\u7BE9\u9078 -FileChooser.filterLabelMnemonic=82 -FileChooser.foldersLabelText=\u8CC7\u6599\u593E -FileChooser.foldersLabelMnemonic=76 -FileChooser.filesLabelText=\u6A94\u6848 -FileChooser.filesLabelMnemonic=73 -FileChooser.enterFileNameLabelText=\u8F38\u5165\u6A94\u6848\u540D\u7A31: -FileChooser.enterFileNameLabelMnemonic=78 -FileChooser.enterFolderNameLabelText=\u8F38\u5165\u8CC7\u6599\u593E\u540D\u7A31: +FileChooser.acceptAllFileFilter.textAndMnemonic=* +FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88 +FileChooser.saveButton.textAndMnemonic=\u5132\u5B58 +FileChooser.openButton.textAndMnemonic=\u78BA\u5B9A +FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58 +FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F +FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0 +FileChooser.helpButton.textAndMnemonic=\u8AAA\u660E +FileChooser.pathLabel.textAndMnemonic=\u8F38\u5165\u8DEF\u5F91\u6216\u8CC7\u6599\u593E\u540D\u7A31(&P): +FileChooser.filterLabel.textAndMnemonic=\u7BE9\u9078(&R) +FileChooser.foldersLabel.textAndMnemonic=\u8CC7\u6599\u593E(&L) +FileChooser.filesLabel.textAndMnemonic=\u6A94\u6848(&I) +FileChooser.enterFileNameLabel.textAndMnemonic=\u8F38\u5165\u6A94\u6848\u540D\u7A31(&N): +FileChooser.enterFolderNameLabel.textAndMnemonic=\u8F38\u5165\u8CC7\u6599\u593E\u540D\u7A31: -FileChooser.cancelButtonToolTipText=\u4E2D\u6B62\u6A94\u6848\u9078\u64C7\u5668\u5C0D\u8A71\u65B9\u584A\u3002 -FileChooser.saveButtonToolTipText=\u5132\u5B58\u9078\u53D6\u7684\u6A94\u6848\u3002 -FileChooser.openButtonToolTipText=\u958B\u555F\u9078\u53D6\u7684\u6A94\u6848\u3002 -FileChooser.updateButtonToolTipText=\u66F4\u65B0\u76EE\u9304\u6E05\u55AE\u3002 -FileChooser.helpButtonToolTipText=\u300C\u6A94\u6848\u9078\u64C7\u5668\u300D\u8AAA\u660E\u3002 +FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6A94\u6848\u9078\u64C7\u5668\u5C0D\u8A71\u65B9\u584A\u3002 +FileChooser.saveButtonToolTip.textAndMnemonic=\u5132\u5B58\u9078\u53D6\u7684\u6A94\u6848\u3002 +FileChooser.openButtonToolTip.textAndMnemonic=\u958B\u555F\u9078\u53D6\u7684\u6A94\u6848\u3002 +FileChooser.updateButtonToolTip.textAndMnemonic=\u66F4\u65B0\u76EE\u9304\u6E05\u55AE\u3002 +FileChooser.helpButtonToolTip.textAndMnemonic=\u300C\u6A94\u6848\u9078\u64C7\u5668\u300D\u8AAA\u660E\u3002 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows.properties index 0f27244f37a..7f36db65a47 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Look in: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Save in: -FileChooser.fileNameLabelText=File name: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Folder name: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Files of type: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Up One Level +FileChooser.lookInLabel.textAndMnemonic=Look &in: +FileChooser.saveInLabel.textAndMnemonic=Save in: +FileChooser.fileNameLabel.textAndMnemonic=File &name: +FileChooser.folderNameLabel.textAndMnemonic=Folder &name: +FileChooser.filesOfTypeLabel.textAndMnemonic=Files of &type: +FileChooser.upFolderToolTip.textAndMnemonic=Up One Level FileChooser.upFolderAccessibleName=Up -FileChooser.homeFolderToolTipText=Home +FileChooser.homeFolderToolTip.textAndMnemonic=Home FileChooser.homeFolderAccessibleName=Home -FileChooser.newFolderToolTipText=Create New Folder +FileChooser.newFolderToolTip.textAndMnemonic=Create New Folder FileChooser.newFolderAccessibleName=New Folder -FileChooser.newFolderActionLabelText=New Folder -FileChooser.listViewButtonToolTipText=List +FileChooser.newFolderActionLabel.textAndMnemonic=New Folder +FileChooser.listViewButtonToolTip.textAndMnemonic=List FileChooser.listViewButtonAccessibleName=List -FileChooser.listViewActionLabelText=List -FileChooser.detailsViewButtonToolTipText=Details +FileChooser.listViewActionLabel.textAndMnemonic=List +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details FileChooser.detailsViewButtonAccessibleName=Details FileChooser.viewMenuButtonToolTipText = View Menu FileChooser.viewMenuButtonAccessibleName = View Menu -FileChooser.detailsViewActionLabelText=Details -FileChooser.refreshActionLabelText=Refresh -FileChooser.viewMenuLabelText=View -FileChooser.fileNameHeaderText=Name -FileChooser.fileSizeHeaderText=Size -FileChooser.fileTypeHeaderText=Type -FileChooser.fileDateHeaderText=Modified -FileChooser.fileAttrHeaderText=Attributes +FileChooser.detailsViewActionLabel.textAndMnemonic=Details +FileChooser.refreshActionLabel.textAndMnemonic=Refresh +FileChooser.viewMenuLabel.textAndMnemonic=View +FileChooser.fileNameHeader.textAndMnemonic=Name +FileChooser.fileSizeHeader.textAndMnemonic=Size +FileChooser.fileTypeHeader.textAndMnemonic=Type +FileChooser.fileDateHeader.textAndMnemonic=Modified +FileChooser.fileAttrHeader.textAndMnemonic=Attributes diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties index b9d8c341f47..0fb04994737 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Suchen in: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Speichern in: -FileChooser.fileNameLabelText=Dateiname: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Ordnername: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Dateityp: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Eine Ebene h\u00F6her +FileChooser.lookInLabel.textAndMnemonic=Suchen &in: +FileChooser.saveInLabel.textAndMnemonic=Speichern in: +FileChooser.fileNameLabel.textAndMnemonic=Datei&name: +FileChooser.folderNameLabel.textAndMnemonic=Ord&nername: +FileChooser.filesOfTypeLabel.textAndMnemonic=Da&teityp: +FileChooser.upFolderToolTip.textAndMnemonic=Eine Ebene h\u00F6her FileChooser.upFolderAccessibleName=Nach oben -FileChooser.homeFolderToolTipText=Home +FileChooser.homeFolderToolTip.textAndMnemonic=Home FileChooser.homeFolderAccessibleName=Home -FileChooser.newFolderToolTipText=Neuen Ordner erstellen +FileChooser.newFolderToolTip.textAndMnemonic=Neuen Ordner erstellen FileChooser.newFolderAccessibleName=Neuer Ordner -FileChooser.newFolderActionLabelText=Neuer Ordner -FileChooser.listViewButtonToolTipText=Liste +FileChooser.newFolderActionLabel.textAndMnemonic=Neuer Ordner +FileChooser.listViewButtonToolTip.textAndMnemonic=Liste FileChooser.listViewButtonAccessibleName=Liste -FileChooser.listViewActionLabelText=Liste -FileChooser.detailsViewButtonToolTipText=Details +FileChooser.listViewActionLabel.textAndMnemonic=Liste +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details FileChooser.detailsViewButtonAccessibleName=Details FileChooser.viewMenuButtonToolTipText = Ansichtsmen\u00FC FileChooser.viewMenuButtonAccessibleName = Ansichtsmen\u00FC -FileChooser.detailsViewActionLabelText=Details -FileChooser.refreshActionLabelText=Aktualisieren -FileChooser.viewMenuLabelText=Ansicht -FileChooser.fileNameHeaderText=Name -FileChooser.fileSizeHeaderText=Gr\u00F6\u00DFe -FileChooser.fileTypeHeaderText=Typ -FileChooser.fileDateHeaderText=Ge\u00E4ndert -FileChooser.fileAttrHeaderText=Attribute +FileChooser.detailsViewActionLabel.textAndMnemonic=Details +FileChooser.refreshActionLabel.textAndMnemonic=Aktualisieren +FileChooser.viewMenuLabel.textAndMnemonic=Ansicht +FileChooser.fileNameHeader.textAndMnemonic=Name +FileChooser.fileSizeHeader.textAndMnemonic=Gr\u00F6\u00DFe +FileChooser.fileTypeHeader.textAndMnemonic=Typ +FileChooser.fileDateHeader.textAndMnemonic=Ge\u00E4ndert +FileChooser.fileAttrHeader.textAndMnemonic=Attribute diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties index d7b610e746d..4e68630f090 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Buscar en: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Guardar en: -FileChooser.fileNameLabelText=Nombre de Archivo: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Nombre de la Carpeta: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Archivos de Tipo: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Subir un Nivel +FileChooser.lookInLabel.textAndMnemonic=Buscar en(&I): +FileChooser.saveInLabel.textAndMnemonic=Guardar en: +FileChooser.fileNameLabel.textAndMnemonic=&Nombre de Archivo: +FileChooser.folderNameLabel.textAndMnemonic=&Nombre de la Carpeta: +FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &Tipo: +FileChooser.upFolderToolTip.textAndMnemonic=Subir un Nivel FileChooser.upFolderAccessibleName=Arriba -FileChooser.homeFolderToolTipText=Inicio +FileChooser.homeFolderToolTip.textAndMnemonic=Inicio FileChooser.homeFolderAccessibleName=Inicio -FileChooser.newFolderToolTipText=Crear Nueva Carpeta +FileChooser.newFolderToolTip.textAndMnemonic=Crear Nueva Carpeta FileChooser.newFolderAccessibleName=Nueva Carpeta -FileChooser.newFolderActionLabelText=Nueva Carpeta -FileChooser.listViewButtonToolTipText=Lista +FileChooser.newFolderActionLabel.textAndMnemonic=Nueva Carpeta +FileChooser.listViewButtonToolTip.textAndMnemonic=Lista FileChooser.listViewButtonAccessibleName=Lista -FileChooser.listViewActionLabelText=Lista -FileChooser.detailsViewButtonToolTipText=Detalles +FileChooser.listViewActionLabel.textAndMnemonic=Lista +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalles FileChooser.detailsViewButtonAccessibleName=Detalles FileChooser.viewMenuButtonToolTipText = Men\u00FA Ver FileChooser.viewMenuButtonAccessibleName = Men\u00FA Ver -FileChooser.detailsViewActionLabelText=Detalles -FileChooser.refreshActionLabelText=Refrescar -FileChooser.viewMenuLabelText=Ver -FileChooser.fileNameHeaderText=Nombre -FileChooser.fileSizeHeaderText=Tama\u00F1o -FileChooser.fileTypeHeaderText=Tipo -FileChooser.fileDateHeaderText=Modificado -FileChooser.fileAttrHeaderText=Atributos +FileChooser.detailsViewActionLabel.textAndMnemonic=Detalles +FileChooser.refreshActionLabel.textAndMnemonic=Refrescar +FileChooser.viewMenuLabel.textAndMnemonic=Ver +FileChooser.fileNameHeader.textAndMnemonic=Nombre +FileChooser.fileSizeHeader.textAndMnemonic=Tama\u00F1o +FileChooser.fileTypeHeader.textAndMnemonic=Tipo +FileChooser.fileDateHeader.textAndMnemonic=Modificado +FileChooser.fileAttrHeader.textAndMnemonic=Atributos diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties index 39736484777..b410f5f4926 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Rechercher dans : -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Enregistrer dans : -FileChooser.fileNameLabelText=Nom du fichier : -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Nom du dossier : -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Fichiers de type : -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Remonte d'un niveau. +FileChooser.lookInLabel.textAndMnemonic=Rechercher dans (&I): +FileChooser.saveInLabel.textAndMnemonic=Enregistrer dans : +FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier : +FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier : +FileChooser.filesOfTypeLabel.textAndMnemonic=Fichiers de &type : +FileChooser.upFolderToolTip.textAndMnemonic=Remonte d'un niveau. FileChooser.upFolderAccessibleName=Monter -FileChooser.homeFolderToolTipText=R\u00E9pertoire d'origine +FileChooser.homeFolderToolTip.textAndMnemonic=R\u00E9pertoire d'origine FileChooser.homeFolderAccessibleName=R\u00E9pertoire d'origine -FileChooser.newFolderToolTipText=Cr\u00E9e un dossier. +FileChooser.newFolderToolTip.textAndMnemonic=Cr\u00E9e un dossier. FileChooser.newFolderAccessibleName=Nouveau dossier -FileChooser.newFolderActionLabelText=Nouveau dossier -FileChooser.listViewButtonToolTipText=Liste +FileChooser.newFolderActionLabel.textAndMnemonic=Nouveau dossier +FileChooser.listViewButtonToolTip.textAndMnemonic=Liste FileChooser.listViewButtonAccessibleName=Liste -FileChooser.listViewActionLabelText=Liste -FileChooser.detailsViewButtonToolTipText=D\u00E9tails +FileChooser.listViewActionLabel.textAndMnemonic=Liste +FileChooser.detailsViewButtonToolTip.textAndMnemonic=D\u00E9tails FileChooser.detailsViewButtonAccessibleName=D\u00E9tails FileChooser.viewMenuButtonToolTipText = Menu Affichage FileChooser.viewMenuButtonAccessibleName = Menu Affichage -FileChooser.detailsViewActionLabelText=D\u00E9tails -FileChooser.refreshActionLabelText=Actualiser -FileChooser.viewMenuLabelText=Affichage -FileChooser.fileNameHeaderText=Nom -FileChooser.fileSizeHeaderText=Taille -FileChooser.fileTypeHeaderText=Type -FileChooser.fileDateHeaderText=Modifi\u00E9 -FileChooser.fileAttrHeaderText=Attributs +FileChooser.detailsViewActionLabel.textAndMnemonic=D\u00E9tails +FileChooser.refreshActionLabel.textAndMnemonic=Actualiser +FileChooser.viewMenuLabel.textAndMnemonic=Affichage +FileChooser.fileNameHeader.textAndMnemonic=Nom +FileChooser.fileSizeHeader.textAndMnemonic=Taille +FileChooser.fileTypeHeader.textAndMnemonic=Type +FileChooser.fileDateHeader.textAndMnemonic=Modifi\u00E9 +FileChooser.fileAttrHeader.textAndMnemonic=Attributs diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties index 5e3e6f12634..dc9e9c02a98 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Cerca in: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Salva in: -FileChooser.fileNameLabelText=Nome file: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Nome della cartella: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Tipo file: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Cartella superiore +FileChooser.lookInLabel.textAndMnemonic=Cerca &in: +FileChooser.saveInLabel.textAndMnemonic=Salva in: +FileChooser.fileNameLabel.textAndMnemonic=&Nome file: +FileChooser.folderNameLabel.textAndMnemonic=&Nome della cartella: +FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo file: +FileChooser.upFolderToolTip.textAndMnemonic=Cartella superiore FileChooser.upFolderAccessibleName=Superiore -FileChooser.homeFolderToolTipText=Home +FileChooser.homeFolderToolTip.textAndMnemonic=Home FileChooser.homeFolderAccessibleName=Home -FileChooser.newFolderToolTipText=Crea nuova cartella +FileChooser.newFolderToolTip.textAndMnemonic=Crea nuova cartella FileChooser.newFolderAccessibleName=Nuova cartella -FileChooser.newFolderActionLabelText=Nuova cartella -FileChooser.listViewButtonToolTipText=Lista +FileChooser.newFolderActionLabel.textAndMnemonic=Nuova cartella +FileChooser.listViewButtonToolTip.textAndMnemonic=Lista FileChooser.listViewButtonAccessibleName=Lista -FileChooser.listViewActionLabelText=Lista -FileChooser.detailsViewButtonToolTipText=Dettagli +FileChooser.listViewActionLabel.textAndMnemonic=Lista +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Dettagli FileChooser.detailsViewButtonAccessibleName=Dettagli FileChooser.viewMenuButtonToolTipText = Visualizza menu FileChooser.viewMenuButtonAccessibleName = Visualizza menu -FileChooser.detailsViewActionLabelText=Dettagli -FileChooser.refreshActionLabelText=Aggiorna -FileChooser.viewMenuLabelText=Visualizza -FileChooser.fileNameHeaderText=Nome -FileChooser.fileSizeHeaderText=Dimensioni -FileChooser.fileTypeHeaderText=Tipo -FileChooser.fileDateHeaderText=Modificato -FileChooser.fileAttrHeaderText=Attributi +FileChooser.detailsViewActionLabel.textAndMnemonic=Dettagli +FileChooser.refreshActionLabel.textAndMnemonic=Aggiorna +FileChooser.viewMenuLabel.textAndMnemonic=Visualizza +FileChooser.fileNameHeader.textAndMnemonic=Nome +FileChooser.fileSizeHeader.textAndMnemonic=Dimensioni +FileChooser.fileTypeHeader.textAndMnemonic=Tipo +FileChooser.fileDateHeader.textAndMnemonic=Modificato +FileChooser.fileAttrHeader.textAndMnemonic=Attributi diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties index adc5d930d69..edeaac2e862 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=\u53C2\u7167: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=\u4FDD\u5B58: -FileChooser.fileNameLabelText=\u30D5\u30A1\u30A4\u30EB\u540D: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=\u30D5\u30A9\u30EB\u30C0\u540D: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=1\u30EC\u30D9\u30EB\u4E0A\u3078 +FileChooser.lookInLabel.textAndMnemonic=\u53C2\u7167(&I): +FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58: +FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D(&N): +FileChooser.folderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D(&N): +FileChooser.filesOfTypeLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7(&T): +FileChooser.upFolderToolTip.textAndMnemonic=1\u30EC\u30D9\u30EB\u4E0A\u3078 FileChooser.upFolderAccessibleName=\u4E0A\u3078 -FileChooser.homeFolderToolTipText=\u30DB\u30FC\u30E0 +FileChooser.homeFolderToolTip.textAndMnemonic=\u30DB\u30FC\u30E0 FileChooser.homeFolderAccessibleName=\u30DB\u30FC\u30E0 -FileChooser.newFolderToolTipText=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u306E\u4F5C\u6210 +FileChooser.newFolderToolTip.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u306E\u4F5C\u6210 FileChooser.newFolderAccessibleName=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0 -FileChooser.newFolderActionLabelText=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0 -FileChooser.listViewButtonToolTipText=\u30EA\u30B9\u30C8 +FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0 +FileChooser.listViewButtonToolTip.textAndMnemonic=\u30EA\u30B9\u30C8 FileChooser.listViewButtonAccessibleName=\u30EA\u30B9\u30C8 -FileChooser.listViewActionLabelText=\u30EA\u30B9\u30C8 -FileChooser.detailsViewButtonToolTipText=\u8A73\u7D30 +FileChooser.listViewActionLabel.textAndMnemonic=\u30EA\u30B9\u30C8 +FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30 FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30 FileChooser.viewMenuButtonToolTipText = \u8868\u793A\u30E1\u30CB\u30E5\u30FC FileChooser.viewMenuButtonAccessibleName = \u8868\u793A\u30E1\u30CB\u30E5\u30FC -FileChooser.detailsViewActionLabelText=\u8A73\u7D30 -FileChooser.refreshActionLabelText=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5 -FileChooser.viewMenuLabelText=\u8868\u793A -FileChooser.fileNameHeaderText=\u540D\u524D -FileChooser.fileSizeHeaderText=\u30B5\u30A4\u30BA -FileChooser.fileTypeHeaderText=\u30BF\u30A4\u30D7 -FileChooser.fileDateHeaderText=\u4FEE\u6B63\u65E5 -FileChooser.fileAttrHeaderText=\u5C5E\u6027 +FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30 +FileChooser.refreshActionLabel.textAndMnemonic=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5 +FileChooser.viewMenuLabel.textAndMnemonic=\u8868\u793A +FileChooser.fileNameHeader.textAndMnemonic=\u540D\u524D +FileChooser.fileSizeHeader.textAndMnemonic=\u30B5\u30A4\u30BA +FileChooser.fileTypeHeader.textAndMnemonic=\u30BF\u30A4\u30D7 +FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6B63\u65E5 +FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties index 6922556c77e..94a1054bcef 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=\uAC80\uC0C9 \uC704\uCE58: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=\uC800\uC7A5 \uC704\uCE58: -FileChooser.fileNameLabelText=\uD30C\uC77C \uC774\uB984: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=\uD3F4\uB354 \uC774\uB984: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=\uD30C\uC77C \uC720\uD615: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=\uD55C \uB808\uBCA8 \uC704\uB85C +FileChooser.lookInLabel.textAndMnemonic=\uAC80\uC0C9 \uC704\uCE58(&I): +FileChooser.saveInLabel.textAndMnemonic=\uC800\uC7A5 \uC704\uCE58: +FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984(&N): +FileChooser.folderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984(&N): +FileChooser.filesOfTypeLabel.textAndMnemonic=\uD30C\uC77C \uC720\uD615(&T): +FileChooser.upFolderToolTip.textAndMnemonic=\uD55C \uB808\uBCA8 \uC704\uB85C FileChooser.upFolderAccessibleName=\uC704\uB85C -FileChooser.homeFolderToolTipText=\uD648 +FileChooser.homeFolderToolTip.textAndMnemonic=\uD648 FileChooser.homeFolderAccessibleName=\uD648 -FileChooser.newFolderToolTipText=\uC0C8 \uD3F4\uB354 \uC0DD\uC131 +FileChooser.newFolderToolTip.textAndMnemonic=\uC0C8 \uD3F4\uB354 \uC0DD\uC131 FileChooser.newFolderAccessibleName=\uC0C8 \uD3F4\uB354 -FileChooser.newFolderActionLabelText=\uC0C8 \uD3F4\uB354 -FileChooser.listViewButtonToolTipText=\uBAA9\uB85D +FileChooser.newFolderActionLabel.textAndMnemonic=\uC0C8 \uD3F4\uB354 +FileChooser.listViewButtonToolTip.textAndMnemonic=\uBAA9\uB85D FileChooser.listViewButtonAccessibleName=\uBAA9\uB85D -FileChooser.listViewActionLabelText=\uBAA9\uB85D -FileChooser.detailsViewButtonToolTipText=\uC138\uBD80 \uC815\uBCF4 +FileChooser.listViewActionLabel.textAndMnemonic=\uBAA9\uB85D +FileChooser.detailsViewButtonToolTip.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4 FileChooser.detailsViewButtonAccessibleName=\uC138\uBD80 \uC815\uBCF4 FileChooser.viewMenuButtonToolTipText = \uBCF4\uAE30 \uBA54\uB274 FileChooser.viewMenuButtonAccessibleName = \uBCF4\uAE30 \uBA54\uB274 -FileChooser.detailsViewActionLabelText=\uC138\uBD80 \uC815\uBCF4 -FileChooser.refreshActionLabelText=\uC0C8\uB85C \uACE0\uCE68 -FileChooser.viewMenuLabelText=\uBCF4\uAE30 -FileChooser.fileNameHeaderText=\uC774\uB984 -FileChooser.fileSizeHeaderText=\uD06C\uAE30 -FileChooser.fileTypeHeaderText=\uC720\uD615 -FileChooser.fileDateHeaderText=\uC218\uC815 \uB0A0\uC9DC -FileChooser.fileAttrHeaderText=\uC18D\uC131 +FileChooser.detailsViewActionLabel.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4 +FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C \uACE0\uCE68 +FileChooser.viewMenuLabel.textAndMnemonic=\uBCF4\uAE30 +FileChooser.fileNameHeader.textAndMnemonic=\uC774\uB984 +FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30 +FileChooser.fileTypeHeader.textAndMnemonic=\uC720\uD615 +FileChooser.fileDateHeader.textAndMnemonic=\uC218\uC815 \uB0A0\uC9DC +FileChooser.fileAttrHeader.textAndMnemonic=\uC18D\uC131 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties index 7faf8c19c80..44ecb60ed6e 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Consultar em: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Salvar em: -FileChooser.fileNameLabelText=Nome do arquivo: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Nome da pasta: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Arquivos do tipo: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Um N\u00EDvel Acima +FileChooser.lookInLabel.textAndMnemonic=Consultar em(&I): +FileChooser.saveInLabel.textAndMnemonic=Salvar em: +FileChooser.fileNameLabel.textAndMnemonic=&Nome do arquivo: +FileChooser.folderNameLabel.textAndMnemonic=&Nome da pasta: +FileChooser.filesOfTypeLabel.textAndMnemonic=Arquivos do &tipo: +FileChooser.upFolderToolTip.textAndMnemonic=Um N\u00EDvel Acima FileChooser.upFolderAccessibleName=Acima -FileChooser.homeFolderToolTipText=In\u00EDcio +FileChooser.homeFolderToolTip.textAndMnemonic=In\u00EDcio FileChooser.homeFolderAccessibleName=In\u00EDcio -FileChooser.newFolderToolTipText=Criar Nova Pasta +FileChooser.newFolderToolTip.textAndMnemonic=Criar Nova Pasta FileChooser.newFolderAccessibleName=Nova Pasta -FileChooser.newFolderActionLabelText=Nova Pasta -FileChooser.listViewButtonToolTipText=Lista +FileChooser.newFolderActionLabel.textAndMnemonic=Nova Pasta +FileChooser.listViewButtonToolTip.textAndMnemonic=Lista FileChooser.listViewButtonAccessibleName=Lista -FileChooser.listViewActionLabelText=Lista -FileChooser.detailsViewButtonToolTipText=Detalhes +FileChooser.listViewActionLabel.textAndMnemonic=Lista +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalhes FileChooser.detailsViewButtonAccessibleName=Detalhes FileChooser.viewMenuButtonToolTipText = Exibir Menu FileChooser.viewMenuButtonAccessibleName = Exibir Menu -FileChooser.detailsViewActionLabelText=Detalhes -FileChooser.refreshActionLabelText=Atualizar -FileChooser.viewMenuLabelText=Exibir -FileChooser.fileNameHeaderText=Nome -FileChooser.fileSizeHeaderText=Tamanho -FileChooser.fileTypeHeaderText=Tipo -FileChooser.fileDateHeaderText=Modificado -FileChooser.fileAttrHeaderText=Atributos +FileChooser.detailsViewActionLabel.textAndMnemonic=Detalhes +FileChooser.refreshActionLabel.textAndMnemonic=Atualizar +FileChooser.viewMenuLabel.textAndMnemonic=Exibir +FileChooser.fileNameHeader.textAndMnemonic=Nome +FileChooser.fileSizeHeader.textAndMnemonic=Tamanho +FileChooser.fileTypeHeader.textAndMnemonic=Tipo +FileChooser.fileDateHeader.textAndMnemonic=Modificado +FileChooser.fileAttrHeader.textAndMnemonic=Atributos diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties index 4e83498093f..e44a096a29e 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=Leta i: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=Spara i: -FileChooser.fileNameLabelText=Filnamn: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=Mapp: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=Filformat: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=Upp en niv\u00E5 +FileChooser.lookInLabel.textAndMnemonic=Leta &i: +FileChooser.saveInLabel.textAndMnemonic=Spara i: +FileChooser.fileNameLabel.textAndMnemonic=Fil&namn: +FileChooser.folderNameLabel.textAndMnemonic=Mapp(&N): +FileChooser.filesOfTypeLabel.textAndMnemonic=Filforma&t: +FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5 FileChooser.upFolderAccessibleName=Upp -FileChooser.homeFolderToolTipText=Hem +FileChooser.homeFolderToolTip.textAndMnemonic=Hem FileChooser.homeFolderAccessibleName=Hem -FileChooser.newFolderToolTipText=Skapa ny mapp +FileChooser.newFolderToolTip.textAndMnemonic=Skapa ny mapp FileChooser.newFolderAccessibleName=Ny mapp -FileChooser.newFolderActionLabelText=Ny mapp -FileChooser.listViewButtonToolTipText=Lista +FileChooser.newFolderActionLabel.textAndMnemonic=Ny mapp +FileChooser.listViewButtonToolTip.textAndMnemonic=Lista FileChooser.listViewButtonAccessibleName=Lista -FileChooser.listViewActionLabelText=Lista -FileChooser.detailsViewButtonToolTipText=Detaljer +FileChooser.listViewActionLabel.textAndMnemonic=Lista +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detaljer FileChooser.detailsViewButtonAccessibleName=Detaljer FileChooser.viewMenuButtonToolTipText = Menyn Visa FileChooser.viewMenuButtonAccessibleName = Menyn Visa -FileChooser.detailsViewActionLabelText=Detaljer -FileChooser.refreshActionLabelText=F\u00F6rnya -FileChooser.viewMenuLabelText=Vy -FileChooser.fileNameHeaderText=Namn -FileChooser.fileSizeHeaderText=Storlek -FileChooser.fileTypeHeaderText=Typ -FileChooser.fileDateHeaderText=\u00C4ndrad -FileChooser.fileAttrHeaderText=Attribut +FileChooser.detailsViewActionLabel.textAndMnemonic=Detaljer +FileChooser.refreshActionLabel.textAndMnemonic=F\u00F6rnya +FileChooser.viewMenuLabel.textAndMnemonic=Vy +FileChooser.fileNameHeader.textAndMnemonic=Namn +FileChooser.fileSizeHeader.textAndMnemonic=Storlek +FileChooser.fileTypeHeader.textAndMnemonic=Typ +FileChooser.fileDateHeader.textAndMnemonic=\u00C4ndrad +FileChooser.fileAttrHeader.textAndMnemonic=Attribut diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties index 3a4c0cd6942..3dfa7533aa3 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=\u67E5\u770B: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=\u4FDD\u5B58: -FileChooser.fileNameLabelText=\u6587\u4EF6\u540D: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=\u6587\u4EF6\u5939\u540D: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=\u6587\u4EF6\u7C7B\u578B: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=\u5411\u4E0A\u4E00\u7EA7 +FileChooser.lookInLabel.textAndMnemonic=\u67E5\u770B: (&I) +FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58: +FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D: (&N) +FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D: (&N) +FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B: (&T) +FileChooser.upFolderToolTip.textAndMnemonic=\u5411\u4E0A\u4E00\u7EA7 FileChooser.upFolderAccessibleName=\u5411\u4E0A -FileChooser.homeFolderToolTipText=\u4E3B\u76EE\u5F55 +FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u5F55 FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u5F55 -FileChooser.newFolderToolTipText=\u521B\u5EFA\u65B0\u6587\u4EF6\u5939 +FileChooser.newFolderToolTip.textAndMnemonic=\u521B\u5EFA\u65B0\u6587\u4EF6\u5939 FileChooser.newFolderAccessibleName=\u65B0\u5EFA\u6587\u4EF6\u5939 -FileChooser.newFolderActionLabelText=\u65B0\u5EFA\u6587\u4EF6\u5939 -FileChooser.listViewButtonToolTipText=\u5217\u8868 +FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u5EFA\u6587\u4EF6\u5939 +FileChooser.listViewButtonToolTip.textAndMnemonic=\u5217\u8868 FileChooser.listViewButtonAccessibleName=\u5217\u8868 -FileChooser.listViewActionLabelText=\u5217\u8868 -FileChooser.detailsViewButtonToolTipText=\u8BE6\u7EC6\u8D44\u6599 +FileChooser.listViewActionLabel.textAndMnemonic=\u5217\u8868 +FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599 FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u8D44\u6599 FileChooser.viewMenuButtonToolTipText = \u67E5\u770B\u83DC\u5355 FileChooser.viewMenuButtonAccessibleName = \u67E5\u770B\u83DC\u5355 -FileChooser.detailsViewActionLabelText=\u8BE6\u7EC6\u8D44\u6599 -FileChooser.refreshActionLabelText=\u5237\u65B0 -FileChooser.viewMenuLabelText=\u89C6\u56FE -FileChooser.fileNameHeaderText=\u540D\u79F0 -FileChooser.fileSizeHeaderText=\u5927\u5C0F -FileChooser.fileTypeHeaderText=\u7C7B\u578B -FileChooser.fileDateHeaderText=\u4FEE\u6539\u65E5\u671F -FileChooser.fileAttrHeaderText=\u5C5E\u6027 +FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599 +FileChooser.refreshActionLabel.textAndMnemonic=\u5237\u65B0 +FileChooser.viewMenuLabel.textAndMnemonic=\u89C6\u56FE +FileChooser.fileNameHeader.textAndMnemonic=\u540D\u79F0 +FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F +FileChooser.fileTypeHeader.textAndMnemonic=\u7C7B\u578B +FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F +FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties index e4c8ad0c081..099caadda8c 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_TW.properties @@ -18,34 +18,30 @@ ############ FILE CHOOSER STRINGS ############# -FileChooser.lookInLabelText=\u67E5\u8A62: -FileChooser.lookInLabelMnemonic=73 -FileChooser.saveInLabelText=\u5132\u5B58\u65BC: -FileChooser.fileNameLabelText=\u6A94\u6848\u540D\u7A31: -FileChooser.fileNameLabelMnemonic=78 -FileChooser.folderNameLabelText=\u8CC7\u6599\u593E\u540D\u7A31: -FileChooser.folderNameLabelMnemonic=78 -FileChooser.filesOfTypeLabelText=\u6A94\u6848\u985E\u578B: -FileChooser.filesOfTypeLabelMnemonic=84 -FileChooser.upFolderToolTipText=\u5F80\u4E0A\u4E00\u5C64 +FileChooser.lookInLabel.textAndMnemonic=\u67E5\u8A62(&I): +FileChooser.saveInLabel.textAndMnemonic=\u5132\u5B58\u65BC: +FileChooser.fileNameLabel.textAndMnemonic=\u6A94\u6848\u540D\u7A31(&N): +FileChooser.folderNameLabel.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31(&N): +FileChooser.filesOfTypeLabel.textAndMnemonic=\u6A94\u6848\u985E\u578B(&T): +FileChooser.upFolderToolTip.textAndMnemonic=\u5F80\u4E0A\u4E00\u5C64 FileChooser.upFolderAccessibleName=\u5F80\u4E0A -FileChooser.homeFolderToolTipText=\u4E3B\u76EE\u9304 +FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u9304 FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u9304 -FileChooser.newFolderToolTipText=\u5EFA\u7ACB\u65B0\u8CC7\u6599\u593E +FileChooser.newFolderToolTip.textAndMnemonic=\u5EFA\u7ACB\u65B0\u8CC7\u6599\u593E FileChooser.newFolderAccessibleName=\u65B0\u8CC7\u6599\u593E -FileChooser.newFolderActionLabelText=\u65B0\u8CC7\u6599\u593E -FileChooser.listViewButtonToolTipText=\u6E05\u55AE +FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u8CC7\u6599\u593E +FileChooser.listViewButtonToolTip.textAndMnemonic=\u6E05\u55AE FileChooser.listViewButtonAccessibleName=\u6E05\u55AE -FileChooser.listViewActionLabelText=\u6E05\u55AE -FileChooser.detailsViewButtonToolTipText=\u8A73\u7D30\u8CC7\u8A0A +FileChooser.listViewActionLabel.textAndMnemonic=\u6E05\u55AE +FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30\u8CC7\u8A0A FileChooser.viewMenuButtonToolTipText = \u6AA2\u8996\u529F\u80FD\u8868 FileChooser.viewMenuButtonAccessibleName = \u6AA2\u8996\u529F\u80FD\u8868 -FileChooser.detailsViewActionLabelText=\u8A73\u7D30\u8CC7\u8A0A -FileChooser.refreshActionLabelText=\u91CD\u65B0\u6574\u7406 -FileChooser.viewMenuLabelText=\u6AA2\u8996 -FileChooser.fileNameHeaderText=\u540D\u7A31 -FileChooser.fileSizeHeaderText=\u5927\u5C0F -FileChooser.fileTypeHeaderText=\u985E\u578B -FileChooser.fileDateHeaderText=\u4FEE\u6539\u65E5\u671F -FileChooser.fileAttrHeaderText=\u5C6C\u6027 +FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A +FileChooser.refreshActionLabel.textAndMnemonic=\u91CD\u65B0\u6574\u7406 +FileChooser.viewMenuLabel.textAndMnemonic=\u6AA2\u8996 +FileChooser.fileNameHeader.textAndMnemonic=\u540D\u7A31 +FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F +FileChooser.fileTypeHeader.textAndMnemonic=\u985E\u578B +FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F +FileChooser.fileAttrHeader.textAndMnemonic=\u5C6C\u6027 From f7483afe41a02ed5fb445a8467a9a5572f5e6dc3 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Wed, 16 May 2012 18:11:48 +0400 Subject: [PATCH 50/73] 7158928: [macosx] NLS: Please change the mnemonic assignment system Reviewed-by: rupashka, serb --- jdk/make/com/apple/osxui/Makefile | 8 +- jdk/make/common/internal/Resources.gmk | 4 + .../com/apple/laf/AquaLookAndFeel.java | 2 +- .../com/apple/laf/resources/aqua.properties | 180 ++++++++---------- 4 files changed, 86 insertions(+), 108 deletions(-) diff --git a/jdk/make/com/apple/osxui/Makefile b/jdk/make/com/apple/osxui/Makefile index 63d78d2872e..0970061d1f7 100644 --- a/jdk/make/com/apple/osxui/Makefile +++ b/jdk/make/com/apple/osxui/Makefile @@ -65,12 +65,8 @@ FILES_export = \ com/apple/laf/ScreenMenuPropertyHandler.java \ com/apple/laf/ScreenMenuPropertyListener.java -#RESOURCE_BUNDLES_COMPILED_PROPERTIES += \ -# com/apple/laf/resources/aqua.properties \ -# com/apple/laf/resources/aqua_de.properties \ -# com/apple/laf/resources/aqua_fr.properties \ -# com/apple/laf/resources/aqua_ja.properties - +RESOURCE_BUNDLES_COMPILED_PROPERTIES += \ + com/apple/laf/resources/aqua.properties # # Rules diff --git a/jdk/make/common/internal/Resources.gmk b/jdk/make/common/internal/Resources.gmk index 56a81fbf09e..fccfe273c63 100644 --- a/jdk/make/common/internal/Resources.gmk +++ b/jdk/make/common/internal/Resources.gmk @@ -197,6 +197,10 @@ $(GENSRCDIR)/%.java: $(SHARE_SRC)/classes/%.properties $(add-property-java-file) $(GENSRCDIR)/%.java: $(GENSRCDIR)/%.properties $(add-property-java-file) +ifdef PLATFORM_SRC_MACOS +$(GENSRCDIR)/%.java: $(PLATFORM_SRC_MACOS)/classes/%.properties + $(add-property-java-file) +endif ifndef OPENJDK $(GENSRCDIR)/%.java: $(CLOSED_PLATFORM_SRC)/classes/%.properties $(add-property-java-file) diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java index c7d970c13fd..3c872df2b26 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java @@ -250,6 +250,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel { */ private void initResourceBundle(final UIDefaults table) { table.setDefaultLocale(Locale.getDefault()); + table.addResourceBundle(PKG_PREFIX + "resources.aqua"); try { final ResourceBundle aquaProperties = MacOSXResourceBundle.getMacResourceBundle(PKG_PREFIX + "resources.aqua"); final Enumeration propertyKeys = aquaProperties.getKeys(); @@ -259,7 +260,6 @@ public class AquaLookAndFeel extends BasicLookAndFeel { table.put(key, aquaProperties.getString(key)); } } catch (final Exception e) { - table.addResourceBundle(PKG_PREFIX + "resources.aqua"); } } diff --git a/jdk/src/macosx/classes/com/apple/laf/resources/aqua.properties b/jdk/src/macosx/classes/com/apple/laf/resources/aqua.properties index 30a840d9520..17f7a94584a 100644 --- a/jdk/src/macosx/classes/com/apple/laf/resources/aqua.properties +++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua.properties @@ -36,45 +36,45 @@ # support. ############ FILE CHOOSER STRINGS ############# -FileChooser.fileDescriptionText=Generic File -FileChooser.directoryDescriptionText=Directory -FileChooser.newFolderErrorText=Error occured during folder creation +FileChooser.fileDescription.textAndMnemonic=Generic File +FileChooser.directoryDescription.textAndMnemonic=Directory +FileChooser.newFolderError.textAndMnemonic=Error occured during folder creation FileChooser.newFolderErrorSeparator= : -FileChooser.acceptAllFileFilterText=All Files -FileChooser.cancelButtonText=Cancel -FileChooser.saveButtonText=Save -FileChooser.openButtonText=Open -FileChooser.saveDialogTitleText=Save -FileChooser.openDialogTitleText=Open -FileChooser.updateButtonText=Update -FileChooser.helpButtonText=Help -FileChooser.directoryOpenButtonText=Open +FileChooser.acceptAllFileFilter.textAndMnemonic=All Files +FileChooser.cancelButton.textAndMnemonic=Cancel +FileChooser.saveButton.textAndMnemonic=Save +FileChooser.openButton.textAndMnemonic=Open +FileChooser.saveDialogTitle.textAndMnemonic=Save +FileChooser.openDialogTitle.textAndMnemonic=Open +FileChooser.updateButton.textAndMnemonic=Update +FileChooser.helpButton.textAndMnemonic=Help +FileChooser.directoryOpenButton.textAndMnemonic=Open # File Size Units FileChooser.fileSizeKiloBytes={0} KB FileChooser.fileSizeMegaBytes={0} MB FileChooser.fileSizeGigaBytes={0} GB -// Mac-specific strings -FileChooser.saveTitleText=Save -FileChooser.openTitleText=Open -FileChooser.newFolderExistsErrorText=That name is already taken -FileChooser.chooseButtonText=Choose +# Mac-specific strings +FileChooser.saveTitle.textAndMnemonic=Save +FileChooser.openTitle.textAndMnemonic=Open +FileChooser.newFolderExistsError.textAndMnemonic=That name is already taken +FileChooser.chooseButton.textAndMnemonic=Choose -FileChooser.newFolderButtonText=New Folder -FileChooser.newFolderTitleText=New Folder -FileChooser.fileNameLabelText=File: -FileChooser.saveDialogFileNameLabelText=Save As: -FileChooser.filesOfTypeLabelText=File Format: +FileChooser.newFolderButton.textAndMnemonic=New Folder +FileChooser.newFolderTitle.textAndMnemonic=New Folder +FileChooser.fileNameLabel.textAndMnemonic=File: +FileChooser.saveDialogFileNameLabel.textAndMnemonic=Save As: +FileChooser.filesOfTypeLabel.textAndMnemonic=File Format: FileChooser.desktopName=Desktop -FileChooser.newFolderPromptText=Name of new folder: +FileChooser.newFolderPrompt.textAndMnemonic=Name of new folder: FileChooser.untitledFolderName=untitled folder FileChooser.untitledFileName=untitled -FileChooser.createButtonText=Create +FileChooser.createButton.textAndMnemonic=Create -FileChooser.byDateText=Date Modified -FileChooser.byNameText=Name +FileChooser.byDate.textAndMnemonic=Date Modified +FileChooser.by.textAndMnemonic=Name FileChooser.newFolderAccessibleName=New Folder FileChooser.mac.newFolder=untitled folder @@ -82,76 +82,54 @@ FileChooser.mac.newFolder.subsequent=untitled folder {0} ############ COLOR CHOOSER STRINGS ############# -ColorChooser.previewText=Preview -ColorChooser.okText=OK -ColorChooser.cancelText=Cancel -ColorChooser.resetText=Reset -# VK_XXX constant for 'ColorChooser.resetText' button to make mnemonic -ColorChooser.resetMnemonic=82 -ColorChooser.sampleText=Sample Text Sample Text -ColorChooser.swatchesNameText=Swatches -ColorChooser.swatchesMnemonic=83 -ColorChooser.swatchesDisplayedMnemonicIndex=0 -ColorChooser.swatchesRecentText=Recent: -ColorChooser.hsbNameText=HSB -# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX -# constant, and an index into the text to render the mnemonic as. The -# mnemonic is xxxMnemonic and the index of the character to underline is -# xxxDisplayedMnemonicIndex. -ColorChooser.hsbMnemonic=72 -ColorChooser.hsbDisplayedMnemonicIndex=0 -ColorChooser.hsbHueText=H -ColorChooser.hsbSaturationText=S -ColorChooser.hsbBrightnessText=B -ColorChooser.hsbRedText=R -ColorChooser.hsbGreenText=G -ColorChooser.hsbBlueText=B -ColorChooser.rgbNameText=RGB -ColorChooser.rgbMnemonic=71 -ColorChooser.rgbDisplayedMnemonicIndex=1 -ColorChooser.rgbRedText=Red -ColorChooser.rgbRedMnemonic=68 -ColorChooser.rgbGreenText=Green -ColorChooser.rgbGreenMnemonic=78 -ColorChooser.rgbBlueText=Blue -ColorChooser.rgbBlueMnemonic=66 +ColorChooser.preview.textAndMnemonic=Preview +ColorChooser.ok.textAndMnemonic=OK +ColorChooser.cancel.textAndMnemonic=Cancel +ColorChooser.reset.textAndMnemonic=&Reset +ColorChooser.sample.textAndMnemonic=Sample Text Sample Text +ColorChooser.swatches.textAndMnemonic=&Swatches +ColorChooser.swatchesRecent.textAndMnemonic=Recent: +ColorChooser.hsb.textAndMnemonic=&HSB +ColorChooser.hsbHue.textAndMnemonic=H +ColorChooser.hsbSaturation.textAndMnemonic=S +ColorChooser.hsbBrightness.textAndMnemonic=B +ColorChooser.hsbRed.textAndMnemonic=R +ColorChooser.hsbGreen.textAndMnemonic=G +ColorChooser.hsbBlue.textAndMnemonic=B +ColorChooser.rgb.textAndMnemonic=R&GB +ColorChooser.rgbRed.textAndMnemonic=Re&d +ColorChooser.rgbGreen.textAndMnemonic=Gree&n +ColorChooser.rgbBlue.textAndMnemonic=&Blue ############ OPTION PANE STRINGS ############# -# Mnemonic keys correspond to KeyEvent.VK_XXX constant # We only define mnemonics for YES/NO, but for completeness you can # define mnemonics for any of the buttons. -OptionPane.yesButtonText=Yes -OptionPane.yesButtonMnemonic=89 -OptionPane.noButtonText=No -OptionPane.noButtonMnemonic=78 -OptionPane.okButtonText=OK -OptionPane.okButtonMnemonic=0 -OptionPane.cancelButtonText=Cancel -OptionPane.cancelButtonMnemonic=0 -OptionPane.titleText=Select an Option +OptionPane.yesButton.textAndMnemonic=&Yes +OptionPane.noButton.textAndMnemonic=&No +OptionPane.okButton.textAndMnemonic=OK +OptionPane.cancelButton.textAndMnemonic=Cancel +OptionPane.title.textAndMnemonic=Select an Option # Title for the dialog for the showInputDialog methods. Only used if # the developer uses one of the variants that doesn't take a title. -OptionPane.inputDialogTitle=Input +OptionPane.inputDialog.titleAndMnemonic=Input # Title for the dialog for the showMessageDialog methods. Only used if # the developer uses one of the variants that doesn't take a title. -OptionPane.messageDialogTitle=Message +OptionPane.messageDialog.titleAndMnemonic=Message ############ Printing Dialog Strings ############ -PrintingDialog.titleProgressText=Printing -PrintingDialog.titleAbortingText=Printing (Aborting) +PrintingDialog.titleProgress.textAndMnemonic=Printing +PrintingDialog.titleAborting.textAndMnemonic=Printing (Aborting) -PrintingDialog.contentInitialText=Printing in progress... +PrintingDialog.contentInitial.textAndMnemonic=Printing in progress... # The following string will be formatted by a MessageFormat # and {0} will be replaced by page number being printed -PrintingDialog.contentProgressText=Printed page {0}... +PrintingDialog.contentProgress.textAndMnemonic=Printed page {0}... -PrintingDialog.contentAbortingText=Printing aborting... +PrintingDialog.contentAborting.textAndMnemonic=Printing aborting... -PrintingDialog.abortButtonText=Abort -PrintingDialog.abortButtonMnemonic=65 -PrintingDialog.abortButtonDisplayedMnemonicIndex=0 -PrintingDialog.abortButtonToolTipText=Abort Printing +PrintingDialog.abortButton.textAndMnemonic=&Abort +PrintingDialog.abortButtonToolTip.textAndMnemonic=Abort Printing ############ Internal Frame Strings ############ InternalFrame.iconButtonToolTip=Minimize @@ -160,42 +138,42 @@ InternalFrame.restoreButtonToolTip=Restore InternalFrame.closeButtonToolTip=Close ############ Internal Frame Title Pane Strings ############ -InternalFrameTitlePane.restoreButtonText=Restore -InternalFrameTitlePane.moveButtonText=Move -InternalFrameTitlePane.sizeButtonText=Size -InternalFrameTitlePane.minimizeButtonText=Minimize -InternalFrameTitlePane.maximizeButtonText=Maximize -InternalFrameTitlePane.closeButtonText=Close +InternalFrameTitlePane.restoreButton.textAndMnemonic=Restore +InternalFrameTitlePane.moveButton.textAndMnemonic=Move +InternalFrameTitlePane.sizeButton.textAndMnemonic=Size +InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimize +InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximize +InternalFrameTitlePane.closeButton.textAndMnemonic=Close ############ Text strings ############# # Used for html forms -FormView.submitButtonText=Submit Query -FormView.resetButtonText=Reset -FormView.browseFileButtonText=Browse... +FormView.submitButton.textAndMnemonic=Submit Query +FormView.resetButton.textAndMnemonic=Reset +FormView.browseFileButton.textAndMnemonic=Browse... ############ Abstract Document Strings ############ -AbstractDocument.styleChangeText=style change -AbstractDocument.additionText=addition -AbstractDocument.deletionText=deletion -AbstractDocument.undoText=Undo -AbstractDocument.redoText=Redo +AbstractDocument.styleChange.textAndMnemonic=style change +AbstractDocument.addition.textAndMnemonic=addition +AbstractDocument.deletion.textAndMnemonic=deletion +AbstractDocument.undo.textAndMnemonic=Undo +AbstractDocument.redo.textAndMnemonic=Redo ############ Abstract Button Strings ############ -AbstractButton.clickText=click +AbstractButton.click.textAndMnemonic=click ############ Abstract Undoable Edit Strings ############ -AbstractUndoableEdit.undoText=Undo -AbstractUndoableEdit.redoText=Redo +AbstractUndoableEdit.undo.textAndMnemonic=Undo +AbstractUndoableEdit.redo.textAndMnemonic=Redo ############ Combo Box Strings ############ -ComboBox.togglePopupText=togglePopup +ComboBox.togglePopup.textAndMnemonic=togglePopup ############ Progress Monitor Strings ############ -ProgressMonitor.progressText=Progress... +ProgressMonitor.progress.textAndMnemonic=Progress... ############ Split Pane Strings ############ -SplitPane.leftButtonText=left button -SplitPane.rightButtonText=right button +SplitPane.leftButton.textAndMnemonic=left button +SplitPane.rightButton.textAndMnemonic=right button # Used for Isindex IsindexView.prompt=This is a searchable index. Enter search keywords: From d06f47f95c85ab6001e6c161b56b9ccf828a34ab Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Thu, 17 May 2012 14:27:11 +0400 Subject: [PATCH 51/73] 7148281: [macosx] JTabbedPane tabs with HTML text do not render correctly Reviewed-by: kizune --- jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java index f463d640fed..7dbc187296d 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java @@ -318,7 +318,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI { } // not for the scrolling tabs - if (tabIndex >= 0) { + if (component == null && tabIndex >= 0) { paintTitle(g2d, font, metrics, textRect, tabIndex, title); } From c0f2f2b464b576b6cc7c1473c0d11a96c3862306 Mon Sep 17 00:00:00 2001 From: Pavel Porvatov Date: Thu, 17 May 2012 15:41:09 +0400 Subject: [PATCH 52/73] 7166322: closed/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java failed since 1.8.0b36 Reviewed-by: alexsch --- .../HTMLEditorKit/4242228/bug4242228.java | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java diff --git a/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java b/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java new file mode 100644 index 00000000000..c18dccd02de --- /dev/null +++ b/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 4242228 + @summary Tests that HTMLEditorKit.setText() doesn't throw exceptions + @author Peter Zhelezniakov +*/ + +import sun.awt.SunToolkit; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.text.StyledEditorKit; +import javax.swing.text.html.HTMLDocument; +import javax.swing.text.html.HTMLEditorKit; +import java.awt.*; + +public class bug4242228 { + private static JTabbedPane tabPane; + private static JFrame frame; + + public static void main(String[] argv) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame = new JFrame("4242228 Test"); + + JScrollPane sourcePane = new JScrollPane(); + final JTextPane htmlEditor = new JTextPane(); + final JTextPane sourceEditor = new JTextPane(); + final JScrollPane editorPane = new JScrollPane(); + + tabPane = new JTabbedPane(); + htmlEditor.setText(" "); + htmlEditor.setEditorKit(new HTMLEditorKit()); + + sourceEditor.setText(" "); + sourceEditor.setEditorKit(new StyledEditorKit()); + + frame.setLayout(new BorderLayout()); + + editorPane.getViewport().add(htmlEditor); + + tabPane.addTab("Editor", editorPane); + tabPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + if (tabPane.getSelectedComponent() == editorPane) { + htmlEditor.setText(sourceEditor.getText()); + } else { + sourceEditor.setText(htmlEditor.getText()); + } + } + }); + + sourcePane.getViewport().add(sourceEditor); + tabPane.addTab("Source", sourcePane); + tabPane.setTabPlacement(SwingConstants.BOTTOM); + htmlEditor.setDocument(new HTMLDocument()); + + frame.add(tabPane); + frame.setSize(400, 300); + frame.setVisible(true); + } + }); + + ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + for (int i = 0; i < 50; i++) { + tabPane.setSelectedIndex(i % 2); + } + + frame.dispose(); + } + }); + } +} From 00a5b03f1ba51c83e222852670c229056315ad5b Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:10 -0700 Subject: [PATCH 53/73] Added tag jdk8-b39 for changeset 8c8235b1fcb6 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 7c912d85790..5b76297fec5 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -160,3 +160,4 @@ cc771d92284f71765eca14d6d08703c4af254c04 jdk8-b21 6a6ba0a07f33d37a2f97b1107e60c6a9a69ec84d jdk8-b36 b2972095a4b1e2a97409b7c3df61f3b263a5ce14 jdk8-b37 d939bd0ab13c16647ffa38cc4b64fb31b7d44e10 jdk8-b38 +8927dd68aee3fa54a1a698e2980e1b2f6c7c12c1 jdk8-b39 From c285bb9bd613aba4a9e75b56ab545f434f4dd9d2 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:16 -0700 Subject: [PATCH 54/73] Added tag jdk8-b39 for changeset 999611eec364 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index ec31f642407..611c780360f 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -160,3 +160,4 @@ e3d735914edd0a621b16bb85417423f8e6af5d51 jdk8-b35 a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36 83fac66442cf680bb59ec9e3a71cc4729322b595 jdk8-b37 b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38 +785af00e2827990f149b32ec37f523dbca3efdd1 jdk8-b39 From 6412273c9485d60ad767682c64d4589a92d98132 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:23 -0700 Subject: [PATCH 55/73] Added tag jdk8-b39 for changeset 402efa0d91d4 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index ae16a349a6a..6beed08f8a6 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -246,3 +246,4 @@ bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37 7d5ec8bf38d1b12e0e09ec381f10976b8beede3b hs24-b09 637c3f5f068f88fb9ec9c5867341cf59fd5ebedc jdk8-b38 73147e6c48813b5fee904aa33f79a77103250ff4 hs24-b10 +96a403721094ecdaf6a1f4f52ebd0a82e07df199 jdk8-b39 From b57dfbffa8c16e3e818fd2a73781c358356fd641 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:35 -0700 Subject: [PATCH 56/73] Added tag jdk8-b39 for changeset a70d185bcc77 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index c8892c35ae6..0c06d95a38f 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -160,3 +160,4 @@ e187f3ede64965dc2979df9a211107cd3d38eacb jdk8-b35 cfd288fe1d3e2b700838342e70d71d44ac991af5 jdk8-b36 90204bfab4e2bed402badcc997cbf8446ab5669f jdk8-b37 5bbe0cb6f2f2d7ce292da77bf4fa9d618d770a78 jdk8-b38 +f95fdbe525c88ef0d57dc1390be6582a8af5e07c jdk8-b39 From 66e90b1610c55dcdf55eff3447aece3a59b561c9 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:38 -0700 Subject: [PATCH 57/73] Added tag jdk8-b39 for changeset b5e60661b9a2 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 6513a494ea2..a0c4c18e846 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -160,3 +160,4 @@ e8afc16522e190cb93c66bcb15d6fba0fe9e6833 jdk8-b35 89b36c658e39f0a2957be55453a3a3befd9c8a6b jdk8-b36 b05a948db1b6c933c980f24e4dc8fd897b7cf4ef jdk8-b37 ac1ba3b56775e3cdcd91b7a48793b59f6a3c18b5 jdk8-b38 +7f6b44fd303478caa83575dbc225de187c509c50 jdk8-b39 From df34620afa26f42047786561aff25932941174fe Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:44 -0700 Subject: [PATCH 58/73] Added tag jdk8-b39 for changeset 2052d5a6991c --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 296cc4b01a8..29bb09eac0e 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -160,3 +160,4 @@ ddfe5562f61f54ed2121ac0c73b688b94f3e66b5 jdk8-b32 45da9cb055ee258dc09e69c1718e27eadea38e45 jdk8-b36 9e82ac15ab80370d6e021aea7b98c7c9626adb5e jdk8-b37 c45f3509a70796c54b48f32910d1caf435763416 jdk8-b38 +b6f52911752110a2889681923992c7a0baa52ccc jdk8-b39 From 4b002876d3ff21dc97c8cfe352a7926103e03c0b Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 17 May 2012 06:20:51 -0700 Subject: [PATCH 59/73] Added tag jdk8-b39 for changeset 679d89b6a21a --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index e3d8e553653..56653f53587 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -160,3 +160,4 @@ defd666a786334465496c8901fa302b779c7e045 jdk8-b35 94bbaa67686f44a124cd16fd9f1e8a6a3f684d2d jdk8-b36 5891b38985e8b2502296fc29e726b527d03116d2 jdk8-b37 1f224f160aa852c9541380735a27a3439dfb7217 jdk8-b38 +a9f547c218d957306dfc0cdd710be041bb62a555 jdk8-b39 From e49b6e7624fd15d0d6d281df95e6f99c137e5c80 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Thu, 17 May 2012 21:27:19 +0400 Subject: [PATCH 60/73] 7142565: [macosx] Many special keys processed twice in text fields Forward port from 7u4 Reviewed-by: anthony --- jdk/src/macosx/native/sun/awt/AWTView.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index f737c4e8b87..16e8ed7aab3 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -48,7 +48,6 @@ //#define IM_DEBUG TRUE //#define EXTRA_DEBUG - static BOOL shouldUsePressAndHold() { static int shouldUsePressAndHold = -1; if (shouldUsePressAndHold != -1) return shouldUsePressAndHold; @@ -394,6 +393,13 @@ AWT_ASSERT_APPKIT_THREAD; } -(void) deliverJavaKeyEventHelper: (NSEvent *) event { + static id sUnretainedLastKeyEvent = nil; + if (event == sUnretainedLastKeyEvent) { + // The event is repeatedly delivered by keyDown: after performKeyEquivalent: + return; + } + sUnretainedLastKeyEvent = event; + [AWTToolkit eventCountPlusPlus]; JNIEnv *env = [ThreadUtilities getJNIEnv]; From 50220cd3d115c3f744e68a3065c13afb3ebb0992 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Thu, 17 May 2012 21:31:55 +0400 Subject: [PATCH 61/73] 7154072: [macosx] swallowing key events Forward posrt from 7u4 Reviewed-by: anthony --- jdk/src/macosx/native/sun/awt/AWTView.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index 16e8ed7aab3..f46714c9ee9 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -393,12 +393,13 @@ AWT_ASSERT_APPKIT_THREAD; } -(void) deliverJavaKeyEventHelper: (NSEvent *) event { - static id sUnretainedLastKeyEvent = nil; - if (event == sUnretainedLastKeyEvent) { + static NSEvent* sLastKeyEvent = nil; + if (event == sLastKeyEvent) { // The event is repeatedly delivered by keyDown: after performKeyEquivalent: return; } - sUnretainedLastKeyEvent = event; + [sLastKeyEvent release]; + sLastKeyEvent = [event retain]; [AWTToolkit eventCountPlusPlus]; JNIEnv *env = [ThreadUtilities getJNIEnv]; From 781549f47d26e153d30b5a5c09eb4036c946c6df Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Thu, 17 May 2012 21:48:57 +0400 Subject: [PATCH 62/73] 7125044: [macosx] Test failure because Component.transferFocus() works differently in applet and application Forward port from 7u4 Reviewed-by: art --- jdk/src/share/classes/java/awt/Dialog.java | 4 +- jdk/src/share/classes/java/awt/Frame.java | 2 +- jdk/src/share/classes/java/awt/Window.java | 2 +- .../share/classes/javax/swing/JApplet.java | 2 +- .../share/classes/javax/swing/JDialog.java | 2 +- jdk/src/share/classes/javax/swing/JFrame.java | 2 +- .../classes/javax/swing/JInternalFrame.java | 2 +- .../share/classes/javax/swing/JWindow.java | 2 +- .../share/classes/javax/swing/UIManager.java | 34 ++++-- jdk/src/share/classes/sun/awt/SunToolkit.java | 45 +------- .../FocusTraversalPolicy/InitialFTP.java | 26 +++++ .../FocusTraversalPolicy/InitialFTP_AWT.java | 50 +++++++++ .../InitialFTP_Swing.java | 46 ++++++++ .../SwallowKeyEvents/SwallowKeyEvents.java | 100 ++++++++++++++++++ 14 files changed, 258 insertions(+), 61 deletions(-) create mode 100644 jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP.java create mode 100644 jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java create mode 100644 jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java create mode 100644 jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java diff --git a/jdk/src/share/classes/java/awt/Dialog.java b/jdk/src/share/classes/java/awt/Dialog.java index 3faa9280abe..47f2f221c0d 100644 --- a/jdk/src/share/classes/java/awt/Dialog.java +++ b/jdk/src/share/classes/java/awt/Dialog.java @@ -670,7 +670,7 @@ public class Dialog extends Window { this.title = title; setModalityType(modalityType); - SunToolkit.checkAndSetPolicy(this, false); + SunToolkit.checkAndSetPolicy(this); } /** @@ -721,7 +721,7 @@ public class Dialog extends Window { this.title = title; setModalityType(modalityType); - SunToolkit.checkAndSetPolicy(this, false); + SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/java/awt/Frame.java b/jdk/src/share/classes/java/awt/Frame.java index 4c6a46938c2..1a3173730e5 100644 --- a/jdk/src/share/classes/java/awt/Frame.java +++ b/jdk/src/share/classes/java/awt/Frame.java @@ -449,7 +449,7 @@ public class Frame extends Window implements MenuContainer { private void init(String title, GraphicsConfiguration gc) { this.title = title; - SunToolkit.checkAndSetPolicy(this, false); + SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java index 437e806b35c..984e287bd50 100644 --- a/jdk/src/share/classes/java/awt/Window.java +++ b/jdk/src/share/classes/java/awt/Window.java @@ -506,7 +506,7 @@ public class Window extends Container implements Accessible { modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE; - SunToolkit.checkAndSetPolicy(this, false); + SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/javax/swing/JApplet.java b/jdk/src/share/classes/javax/swing/JApplet.java index e36cd55e891..0da6c3e532a 100644 --- a/jdk/src/share/classes/javax/swing/JApplet.java +++ b/jdk/src/share/classes/javax/swing/JApplet.java @@ -149,7 +149,7 @@ public class JApplet extends Applet implements Accessible, setRootPaneCheckingEnabled(true); setFocusTraversalPolicyProvider(true); - sun.awt.SunToolkit.checkAndSetPolicy(this, true); + sun.awt.SunToolkit.checkAndSetPolicy(this); enableEvents(AWTEvent.KEY_EVENT_MASK); } diff --git a/jdk/src/share/classes/javax/swing/JDialog.java b/jdk/src/share/classes/javax/swing/JDialog.java index a4e35b66351..a53c4abe50c 100644 --- a/jdk/src/share/classes/javax/swing/JDialog.java +++ b/jdk/src/share/classes/javax/swing/JDialog.java @@ -654,7 +654,7 @@ public class JDialog extends Dialog implements WindowConstants, getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); } } - sun.awt.SunToolkit.checkAndSetPolicy(this, true); + sun.awt.SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/javax/swing/JFrame.java b/jdk/src/share/classes/javax/swing/JFrame.java index 3d5dea1f7cb..cccd6f98aa5 100644 --- a/jdk/src/share/classes/javax/swing/JFrame.java +++ b/jdk/src/share/classes/javax/swing/JFrame.java @@ -266,7 +266,7 @@ public class JFrame extends Frame implements WindowConstants, getRootPane().setWindowDecorationStyle(JRootPane.FRAME); } } - sun.awt.SunToolkit.checkAndSetPolicy(this, true); + sun.awt.SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/javax/swing/JInternalFrame.java b/jdk/src/share/classes/javax/swing/JInternalFrame.java index 516ac9afb08..a0ba3a18084 100644 --- a/jdk/src/share/classes/javax/swing/JInternalFrame.java +++ b/jdk/src/share/classes/javax/swing/JInternalFrame.java @@ -349,7 +349,7 @@ public class JInternalFrame extends JComponent implements setRootPaneCheckingEnabled(true); desktopIcon = new JDesktopIcon(this); updateUI(); - sun.awt.SunToolkit.checkAndSetPolicy(this, true); + sun.awt.SunToolkit.checkAndSetPolicy(this); addPropertyChangeListenerIfNecessary(); } diff --git a/jdk/src/share/classes/javax/swing/JWindow.java b/jdk/src/share/classes/javax/swing/JWindow.java index 4a12d0205fb..f5d7b08a4bd 100644 --- a/jdk/src/share/classes/javax/swing/JWindow.java +++ b/jdk/src/share/classes/javax/swing/JWindow.java @@ -264,7 +264,7 @@ public class JWindow extends Window implements Accessible, setLocale( JComponent.getDefaultLocale() ); setRootPane(createRootPane()); setRootPaneCheckingEnabled(true); - sun.awt.SunToolkit.checkAndSetPolicy(this, true); + sun.awt.SunToolkit.checkAndSetPolicy(this); } /** diff --git a/jdk/src/share/classes/javax/swing/UIManager.java b/jdk/src/share/classes/javax/swing/UIManager.java index c3199d5f8d2..d135e34b5c9 100644 --- a/jdk/src/share/classes/javax/swing/UIManager.java +++ b/jdk/src/share/classes/javax/swing/UIManager.java @@ -191,6 +191,7 @@ public class UIManager implements Serializable private UIDefaults[] tables = new UIDefaults[2]; boolean initialized = false; + boolean focusPolicyInitialized = false; MultiUIDefaults multiUIDefaults = new MultiUIDefaults(tables); LookAndFeel lookAndFeel; LookAndFeel multiLookAndFeel = null; @@ -1000,6 +1001,7 @@ public class UIManager implements Serializable */ public static ComponentUI getUI(JComponent target) { maybeInitialize(); + maybeInitializeFocusPolicy(target); ComponentUI ui = null; LookAndFeel multiLAF = getLAFState().multiLookAndFeel; if (multiLAF != null) { @@ -1422,6 +1424,27 @@ public class UIManager implements Serializable } } + /* + * Sets default swing focus traversal policy. + */ + private static void maybeInitializeFocusPolicy(JComponent comp) { + // Check for JRootPane which indicates that a swing toplevel + // is coming, in which case a swing default focus policy + // should be instatiated. See 7125044. + if (comp instanceof JRootPane) { + synchronized (classLock) { + if (!getLAFState().focusPolicyInitialized) { + getLAFState().focusPolicyInitialized = true; + + if (FocusManager.isFocusManagerEnabled()) { + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + setDefaultFocusTraversalPolicy( + new LayoutFocusTraversalPolicy()); + } + } + } + } + } /* * Only called by maybeInitialize(). @@ -1433,17 +1456,6 @@ public class UIManager implements Serializable initializeAuxiliaryLAFs(swingProps); initializeInstalledLAFs(swingProps); - // Enable the Swing default LayoutManager. - String toolkitName = Toolkit.getDefaultToolkit().getClass().getName(); - // don't set default policy if this is XAWT. - if (!"sun.awt.X11.XToolkit".equals(toolkitName)) { - if (FocusManager.isFocusManagerEnabled()) { - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setDefaultFocusTraversalPolicy( - new LayoutFocusTraversalPolicy()); - } - } - // Install Swing's PaintEventDispatcher if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) { sun.awt.PaintEventDispatcher.setPaintEventDispatcher( diff --git a/jdk/src/share/classes/sun/awt/SunToolkit.java b/jdk/src/share/classes/sun/awt/SunToolkit.java index b63403961a6..a1c0d184eb9 100644 --- a/jdk/src/share/classes/sun/awt/SunToolkit.java +++ b/jdk/src/share/classes/sun/awt/SunToolkit.java @@ -461,48 +461,11 @@ public abstract class SunToolkit extends Toolkit AWTAccessor.getWindowAccessor().setLWRequestStatus(changed, status); }; - public static void checkAndSetPolicy(Container cont, boolean isSwingCont) - { - FocusTraversalPolicy defaultPolicy = KeyboardFocusManager - .getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy(); + public static void checkAndSetPolicy(Container cont) { + FocusTraversalPolicy defaultPolicy = KeyboardFocusManager. + getCurrentKeyboardFocusManager(). + getDefaultFocusTraversalPolicy(); - String toolkitName = Toolkit.getDefaultToolkit().getClass().getName(); - // if this is not XAWT then use default policy - // because Swing change it - if (!"sun.awt.X11.XToolkit".equals(toolkitName)) { - cont.setFocusTraversalPolicy(defaultPolicy); - return; - } - - String policyName = defaultPolicy.getClass().getName(); - - if (DefaultFocusTraversalPolicy.class != defaultPolicy.getClass()) { - // Policy was changed - // Check if it is awt policy or swing policy - // If it is Swing policy we shouldn't use it in AWT frames - // If it is AWT policy we shouldn't use it in Swing frames - // Otherwise we should use this policy - if (policyName.startsWith("java.awt.")) { - // AWT - if (isSwingCont) { - // Can't use AWT policy in Swing windows - should use Swing's one. - defaultPolicy = createLayoutPolicy(); - } else { - // New awt policy. - } - } else if (policyName.startsWith("javax.swing.")) { - if (isSwingCont) { - // New Swing's policy - } else { - defaultPolicy = new DefaultFocusTraversalPolicy(); - } - } - } else { - // Policy is default, use different default policy for swing - if (isSwingCont) { - defaultPolicy = createLayoutPolicy(); - } - } cont.setFocusTraversalPolicy(defaultPolicy); } diff --git a/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP.java b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP.java new file mode 100644 index 00000000000..44cf627ba51 --- /dev/null +++ b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP.java @@ -0,0 +1,26 @@ +/* + @test + @bug 7125044 + @summary Tests defaut focus traversal policy in AWT & Swing toplevel windows. + @author anton.tarasov@sun.com: area=awt.focus + @run main InitialFTP_AWT + @run main InitialFTP_Swing +*/ + +import java.awt.FocusTraversalPolicy; +import java.awt.Window; + +public class InitialFTP { + public static void test(Window win, Class expectedPolicy) { + FocusTraversalPolicy ftp = win.getFocusTraversalPolicy(); + + System.out.println("==============" + "\n" + + "Tested window: " + win + "\n" + + "Expected policy: " + expectedPolicy + "\n" + + "Effective policy: " + ftp.getClass()); + + if (!expectedPolicy.equals(ftp.getClass())) { + throw new RuntimeException("Test failed: wrong effective focus policy"); + } + } +} diff --git a/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java new file mode 100644 index 00000000000..b22117a1dec --- /dev/null +++ b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java @@ -0,0 +1,50 @@ +/* + @bug 7125044 + @summary Tests default focus traversal policy in AWT toplevel windows. + @author anton.tarasov@sun.com: area=awt.focus +*/ + +import java.awt.Button; +import java.awt.DefaultFocusTraversalPolicy; +import java.awt.FlowLayout; +import java.awt.FocusTraversalPolicy; +import java.awt.Frame; +import java.awt.List; +import java.awt.TextArea; +import java.awt.Window; + +public class InitialFTP_AWT { + public static void main(String[] args) { + AWTFrame f0 = new AWTFrame("frame0"); + f0.setVisible(true); + + InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); + + AWTFrame f1 = new AWTFrame("frame1"); + f1.setVisible(true); + + InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); + + System.out.println("Test passed."); + } +} + +class AWTFrame extends Frame { + Button button = new Button("button"); + TextArea text = new TextArea("qwerty"); + List list = new List(); + + public AWTFrame(String title) { + super(title); + + list.add("one"); + list.add("two"); + list.add("three"); + + this.setLayout(new FlowLayout()); + this.add(button); + this.add(text); + this.add(list); + this.pack(); + } +} diff --git a/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java new file mode 100644 index 00000000000..ab756220b6b --- /dev/null +++ b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java @@ -0,0 +1,46 @@ +/* + @bug 7125044 + @summary Tests default focus traversal policy in Swing toplevel windows. + @author anton.tarasov@sun.com: area=awt.focus +*/ + +import java.awt.FlowLayout; +import java.awt.FocusTraversalPolicy; +import java.awt.Window; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JTextArea; +import javax.swing.LayoutFocusTraversalPolicy; + +public class InitialFTP_Swing { + public static void main(String[] args) { + SwingFrame f0 = new SwingFrame("frame0"); + f0.setVisible(true); + + InitialFTP.test(f0, LayoutFocusTraversalPolicy.class); + + SwingFrame f1 = new SwingFrame("frame1"); + f1.setVisible(true); + + InitialFTP.test(f1, LayoutFocusTraversalPolicy.class); + + System.out.println("Test passed."); + } +} + +class SwingFrame extends JFrame { + JButton button = new JButton("button"); + JTextArea text = new JTextArea("qwerty"); + JList list = new JList(new String[] {"one", "two", "three"}); + + public SwingFrame(String title) { + super(title); + + this.setLayout(new FlowLayout()); + this.add(button); + this.add(text); + this.add(list); + this.pack(); + } +} diff --git a/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java b/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java new file mode 100644 index 00000000000..c10094eed67 --- /dev/null +++ b/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 7154072 + @summary Tests that key events with modifiers are not swallowed. + @author anton.tarasov: area=awt.focus + @library ../../../regtesthelpers + @build Util + @run main SwallowKeyEvents +*/ + +import java.awt.AWTException; +import java.awt.Frame; +import java.awt.Robot; +import java.awt.TextField; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import test.java.awt.regtesthelpers.Util; + +public class SwallowKeyEvents { + static final int PRESS_COUNT = 10; + + static int keyPressedCount = 0; + + static Frame f = new Frame("Frame"); + static TextField t = new TextField("text"); + static Robot r; + + public static void main(String[] args) { + f.add(t); + f.pack(); + f.setVisible(true); + + t.requestFocus(); + + try { + r = new Robot(); + } catch (AWTException ex) { + throw new RuntimeException(ex); + } + + Util.waitForIdle(r); + + t.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent ke) { + System.out.println(ke); + if (ke.getKeyCode() == KeyEvent.VK_M) { + keyPressedCount++; + } + } + }); + + test(); + + System.out.println("key_pressed count: " + keyPressedCount); + + if (keyPressedCount != PRESS_COUNT) { + throw new RuntimeException("Test failed!"); + } else { + System.out.println("Test passed."); + } + } + + public static void test() { + r.keyPress(KeyEvent.VK_SHIFT); + r.keyPress(KeyEvent.VK_META); + + for (int i=0; i Date: Thu, 17 May 2012 22:10:40 +0400 Subject: [PATCH 63/73] 7145768: [macosx] Regression: failure in b11 of ModalDialogInFocusEventTest Forward port from 7u4 Reviewed-by: art --- .../classes/sun/lwawt/LWComponentPeer.java | 40 ++++++++++++++++++- .../classes/sun/lwawt/LWWindowPeer.java | 32 +++++++++------ 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java index 0b8b290f082..517973b98b5 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -56,6 +56,8 @@ import sun.java2d.SunGraphics2D; import sun.java2d.opengl.OGLRenderQueue; import sun.java2d.pipe.Region; +import sun.util.logging.PlatformLogger; + import javax.swing.JComponent; import javax.swing.SwingUtilities; import javax.swing.RepaintManager; @@ -65,7 +67,10 @@ import sun.lwawt.macosx.CDropTarget; import com.sun.java.swing.SwingUtilities3; public abstract class LWComponentPeer - implements ComponentPeer, DropTargetPeer { + implements ComponentPeer, DropTargetPeer +{ + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWComponentPeer"); + // State lock is to be used for modifications to this // peer's fields (e.g. bounds, background, font, etc.) // It should be the last lock in the lock chain @@ -885,7 +890,13 @@ public abstract class LWComponentPeer @Override public boolean requestFocus(Component lightweightChild, boolean temporary, boolean focusedWindowChangeAllowed, long time, - CausedFocusEvent.Cause cause) { + CausedFocusEvent.Cause cause) + { + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("lightweightChild=" + lightweightChild + ", temporary=" + temporary + + ", focusedWindowChangeAllowed=" + focusedWindowChangeAllowed + + ", time= " + time + ", cause=" + cause); + } if (LWKeyboardFocusManagerPeer.getInstance(getAppContext()). processSynchronousLightweightTransfer(getTarget(), lightweightChild, temporary, focusedWindowChangeAllowed, time)) { @@ -901,19 +912,44 @@ public abstract class LWComponentPeer case LWKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED: Window parentWindow = SunToolkit.getContainingWindow(getTarget()); if (parentWindow == null) { + focusLog.fine("request rejected, parentWindow is null"); LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); return false; } LWWindowPeer parentPeer = (LWWindowPeer) parentWindow.getPeer(); if (parentPeer == null) { + focusLog.fine("request rejected, parentPeer is null"); LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); return false; } + // A fix for 7145768. Ensure the parent window is currently natively focused. + // The more evident place to perform this check is in KFM.shouldNativelyFocusHeavyweight, + // however that is the shared code and this particular problem's reproducibility has + // platform specifics. So, it was decided to narrow down the fix to lwawt (OSX) in + // current release. TODO: consider fixing it in the shared code. + if (!focusedWindowChangeAllowed) { + LWWindowPeer decoratedPeer = parentPeer.isSimpleWindow() ? + LWWindowPeer.getOwnerFrameDialog(parentPeer) : parentPeer; + + if (decoratedPeer == null || !decoratedPeer.getPlatformWindow().isActive()) { + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("request rejected, focusedWindowChangeAllowed==false, " + + "decoratedPeer is inactive: " + decoratedPeer); + } + LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); + return false; + } + } + boolean res = parentPeer.requestWindowFocus(cause); // If parent window can be made focused and has been made focused (synchronously) // then we can proceed with children, otherwise we retreat if (!res || !parentWindow.isFocused()) { + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("request rejected, res= " + res + ", parentWindow.isFocused()=" + + parentWindow.isFocused()); + } LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget()); return false; } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index 82d97c01aaa..997e4740040 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -50,7 +50,7 @@ public class LWWindowPeer EMBEDDEDFRAME } - private static final sun.util.logging.PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer"); private PlatformWindow platformWindow; @@ -245,15 +245,17 @@ public class LWWindowPeer getInstance(getAppContext()); if (visible) { - updateFocusableWindowState(); - changeFocusedWindow(true, true); - + if (!getTarget().isAutoRequestFocus()) { + return; + } else { + requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION); + } // Focus the owner in case this window is focused. } else if (manager.getCurrentFocusedWindow() == getTarget()) { + // Transfer focus to the owner. LWWindowPeer owner = getOwnerFrameDialog(LWWindowPeer.this); if (owner != null) { - // KFM will do all the rest. - owner.changeFocusedWindow(true, false); + owner.requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION); } } } @@ -619,7 +621,7 @@ public class LWWindowPeer } public void notifyActivation(boolean activation) { - changeFocusedWindow(activation, false); + changeFocusedWindow(activation); } // MouseDown in non-client area @@ -1065,6 +1067,10 @@ public class LWWindowPeer return lastMouseEventPeer; } + /* + * Requests platform to set native focus on a frame/dialog. + * In case of a simple window, triggers appropriate java focus change. + */ public boolean requestWindowFocus(CausedFocusEvent.Cause cause) { if (focusLog.isLoggable(PlatformLogger.FINE)) { focusLog.fine("requesting native focus to " + this); @@ -1108,14 +1114,14 @@ public class LWWindowPeer } // DKFM will synthesize all the focus/activation events correctly. - changeFocusedWindow(true, false); + changeFocusedWindow(true); return true; // In case the toplevel is active but not focused, change focus directly, // as requesting native focus on it will not have effect. } else if (getTarget() == currentActive && !getTarget().hasFocus()) { - changeFocusedWindow(true, false); + changeFocusedWindow(true); return true; } return platformWindow.requestWindowFocus(); @@ -1133,13 +1139,13 @@ public class LWWindowPeer } /* - * "Delegates" the responsibility of managing focus to keyboard focus manager. + * Changes focused window on java level. */ - private void changeFocusedWindow(boolean becomesFocused, boolean isShowing) { + private void changeFocusedWindow(boolean becomesFocused) { if (focusLog.isLoggable(PlatformLogger.FINE)) { focusLog.fine((becomesFocused?"gaining":"loosing") + " focus window: " + this); } - if (isShowing && !getTarget().isAutoRequestFocus() || skipNextFocusChange) { + if (skipNextFocusChange) { focusLog.fine("skipping focus change"); skipNextFocusChange = false; return; @@ -1184,7 +1190,7 @@ public class LWWindowPeer postEvent(windowEvent); } - private static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) { + static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) { Window owner = (peer != null ? peer.getTarget().getOwner() : null); while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { owner = owner.getOwner(); From 4a46c4fa607e84ac968fb7fb3a1dd9dd05e29ad0 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Thu, 17 May 2012 22:21:27 +0400 Subject: [PATCH 64/73] 7145827: [macosx] JCK failure in b11: FocusableWindow3 Forward posrt from 7u4 Reviewed-by: art --- .../classes/sun/lwawt/LWWindowPeer.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index 997e4740040..f5617772458 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -101,8 +101,6 @@ public class LWWindowPeer // events between MOUSE_PRESSED and MOUSE_RELEASED for particular button private static int mouseClickButtons = 0; - private volatile boolean cachedFocusableWindow; - private volatile boolean isOpaque = true; private static final Font DEFAULT_FONT = new Font("Lucida Grande", Font.PLAIN, 13); @@ -172,8 +170,6 @@ public class LWWindowPeer setAlwaysOnTop(getTarget().isAlwaysOnTop()); updateMinimumSize(); - cachedFocusableWindow = getTarget().isFocusableWindow(); - setOpacity(getTarget().getOpacity()); setOpaque(getTarget().isOpaque()); @@ -402,7 +398,6 @@ public class LWWindowPeer @Override public void updateFocusableWindowState() { - cachedFocusableWindow = getTarget().isFocusableWindow(); platformWindow.updateFocusableWindowState(); } @@ -1130,7 +1125,19 @@ public class LWWindowPeer private boolean focusAllowedFor() { Window window = getTarget(); // TODO: check if modal blocked - return window.isVisible() && window.isEnabled() && window.isFocusableWindow(); + return window.isVisible() && window.isEnabled() && isFocusableWindow(); + } + + private boolean isFocusableWindow() { + boolean focusable = getTarget().isFocusableWindow(); + if (isSimpleWindow()) { + LWWindowPeer ownerPeer = getOwnerFrameDialog(this); + if (ownerPeer == null) { + return false; + } + return focusable && ownerPeer.getTarget().isFocusableWindow(); + } + return focusable; } public boolean isSimpleWindow() { @@ -1150,8 +1157,8 @@ public class LWWindowPeer skipNextFocusChange = false; return; } - - if (!cachedFocusableWindow) { + if (!isFocusableWindow() && becomesFocused) { + focusLog.fine("the window is not focusable"); return; } if (becomesFocused) { From 7f4d14efbe41ed07e4190a5268eea2d57de514aa Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Fri, 18 May 2012 19:39:24 +0400 Subject: [PATCH 65/73] 7156191: [macosx] Can't type into applet demos in Pivot Reviewed-by: art --- .../sun/lwawt/macosx/CEmbeddedFrame.java | 21 ++++++------------- .../sun/lwawt/macosx/CPlatformResponder.java | 4 ++++ .../sun/lwawt/macosx/CPlatformView.java | 4 ++-- .../sun/lwawt/macosx/CPlatformWindow.java | 6 ++++-- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java index fa711c9a9d2..2415ff7d8d8 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java @@ -112,28 +112,19 @@ public class CEmbeddedFrame extends EmbeddedFrame { public void handleFocusEvent(boolean focused) { this.focused = focused; - updateOverlayWindowActiveState(); + if (parentWindowActive) { + responder.handleWindowFocusEvent(focused); + } } public void handleWindowFocusEvent(boolean parentWindowActive) { this.parentWindowActive = parentWindowActive; - updateOverlayWindowActiveState(); + if (focused) { + responder.handleWindowFocusEvent(parentWindowActive); + } } public boolean isParentWindowActive() { return parentWindowActive; } - - /* - * May change appearance of contents of window, and generate a - * WINDOW_ACTIVATED event. - */ - private void updateOverlayWindowActiveState() { - final boolean showAsFocused = parentWindowActive && focused; - dispatchEvent( - new FocusEvent(this, showAsFocused ? - FocusEvent.FOCUS_GAINED : - FocusEvent.FOCUS_LOST)); - } - } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java index 739e5679008..aa5c616b428 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java @@ -204,4 +204,8 @@ final class CPlatformResponder { } } } + + void handleWindowFocusEvent(boolean gained) { + peer.notifyActivation(gained); + } } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java index 77a81e0d78f..5c072a69800 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java @@ -49,9 +49,9 @@ public class CPlatformView extends CFRetainedResource { super(0, true); } - public void initialize(LWWindowPeer peer) { + public void initialize(LWWindowPeer peer, CPlatformResponder responder) { this.peer = peer; - this.responder = new CPlatformResponder(peer, false); + this.responder = responder; if (!LWCToolkit.getSunAwtDisableCALayers()) { this.windowLayer = new CGLLayer(peer); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index efad23e636e..2d7cfea3941 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -208,6 +208,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo private boolean visible = false; // visibility status from native perspective private boolean undecorated; // initialized in getInitialStyleBits() private Rectangle normalBounds = null; // not-null only for undecorated maximized windows + private CPlatformResponder responder; public CPlatformWindow(final PeerType peerType) { super(0, true); @@ -232,8 +233,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo final long parentNSWindowPtr = (owner != null ? owner.getNSWindowPtr() : 0); String warningString = target.getWarningString(); + responder = new CPlatformResponder(peer, false); contentView = new CPlatformView(); - contentView.initialize(peer); + contentView.initialize(peer, responder); final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0); setPtr(nativeWindowPtr); @@ -865,7 +867,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo focusLogger.fine("the app is inactive, so the notification is ignored"); return; } - peer.notifyActivation(gained); + responder.handleWindowFocusEvent(gained); } private void deliverMoveResizeEvent(int x, int y, int width, int height) { From f1828f22b9bd0faa721032fe97bd9a793e3d6acd Mon Sep 17 00:00:00 2001 From: Alejandro Murillo Date: Fri, 18 May 2012 14:50:18 -0700 Subject: [PATCH 66/73] Added tag hs24-b11 for changeset 100019c94f7c --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 6beed08f8a6..03a516d1f0d 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -247,3 +247,4 @@ bfcf92bfefb82da00f7fdbf0d9273feaa0a9456d jdk8-b37 637c3f5f068f88fb9ec9c5867341cf59fd5ebedc jdk8-b38 73147e6c48813b5fee904aa33f79a77103250ff4 hs24-b10 96a403721094ecdaf6a1f4f52ebd0a82e07df199 jdk8-b39 +14b0e07ab9a6fa1662414496b7e07ac8450cf517 hs24-b11 From 9ea4ab4133f05c27f588716e06518431b46b0b17 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Mon, 21 May 2012 14:04:46 +0400 Subject: [PATCH 67/73] 7124400: [macosx] CGraphicsDevice.getConfigurations() returns reference to member (does not copy configs) Reviewed-by: anthony, kizune --- jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java | 6 +++--- jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java b/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java index 1fda340c509..02f743d3e72 100644 --- a/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java +++ b/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java @@ -40,7 +40,7 @@ public class CGraphicsDevice extends GraphicsDevice { private final int displayID; // Array of all GraphicsConfig instances for this device - private final CGraphicsConfig[] configs; + private final GraphicsConfiguration[] configs; // Default config (temporarily hard coded) private final int DEFAULT_CONFIG = 0; @@ -49,7 +49,7 @@ public class CGraphicsDevice extends GraphicsDevice { public CGraphicsDevice(int displayID) { this.displayID = displayID; - configs = new CGraphicsConfig[] { + configs = new GraphicsConfiguration[] { CGLGraphicsConfig.getConfig(this, 0) }; } @@ -66,7 +66,7 @@ public class CGraphicsDevice extends GraphicsDevice { */ @Override public GraphicsConfiguration[] getConfigurations() { - return configs; + return configs.clone(); } /** diff --git a/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java b/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java index c124ff5f434..29c3aa9b575 100644 --- a/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java +++ b/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6822057 + * @bug 6822057 7124400 * * @summary Test verifies that list of supported graphics configurations * can not be changed via modification of elements of an array From ecf06b34593b06009308c51b6822a3fefcf62cb1 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Mon, 21 May 2012 14:53:51 +0400 Subject: [PATCH 68/73] 7154088: [macosx] Regression: Component.createImage do not inherits component attributes Reviewed-by: art, kizune --- jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java index a7b15e07c96..6701434bb20 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -940,8 +940,8 @@ public abstract class LWComponentPeer @Override public Image createImage(int w, int h) { - // TODO: accelerated image - return getGraphicsConfiguration().createCompatibleImage(w, h); + CGraphicsConfig gc = (CGraphicsConfig)getGraphicsConfiguration(); + return gc.createAcceleratedImage(getTarget(), w, h); } @Override From 1d1ed3ddb34545aad060e93e190084450e740dd8 Mon Sep 17 00:00:00 2001 From: Pavel Porvatov Date: Mon, 21 May 2012 18:55:36 +0400 Subject: [PATCH 69/73] 7168144: No appropriate CCC request for changes introduced by 7154030 Reviewed-by: alexsch --- jdk/src/share/classes/javax/swing/JComponent.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java index 83f88bfbfdc..dbf4b3c3343 100644 --- a/jdk/src/share/classes/javax/swing/JComponent.java +++ b/jdk/src/share/classes/javax/swing/JComponent.java @@ -5573,6 +5573,7 @@ public abstract class JComponent extends Container implements Serializable, * {@inheritDoc} */ @Override + @Deprecated public void hide() { boolean showing = isShowing(); super.hide(); From 33648efb4cf56722a43da96c5a977f3beecf4dc1 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Tue, 22 May 2012 01:12:16 +0400 Subject: [PATCH 70/73] 7170427: setGlobalCurrentFocusCycleRoot unexpectedly throws SecurityException Reviewed-by: art --- jdk/src/share/classes/java/awt/Component.java | 23 +++++-------------- jdk/src/share/classes/java/awt/Container.java | 6 ++--- .../java/awt/KeyboardFocusManager.java | 13 +++++++++-- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index 20d733fa93c..df80032a1a9 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -7947,32 +7947,21 @@ public abstract class Component implements ImageObserver, MenuContainer, if (rootAncestor != null) { Container rootAncestorRootAncestor = rootAncestor.getFocusCycleRootAncestor(); - - final Container fcr = (rootAncestorRootAncestor != null) ? + Container fcr = (rootAncestorRootAncestor != null) ? rootAncestorRootAncestor : rootAncestor; - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot(fcr); - return null; - } - }); + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + setGlobalCurrentFocusCycleRootPriv(fcr); rootAncestor.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP); } else { - final Window window = getContainingWindow(); + Window window = getContainingWindow(); if (window != null) { Component toFocus = window.getFocusTraversalPolicy(). getDefaultComponent(window); if (toFocus != null) { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot(window); - return null; - } - }); + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + setGlobalCurrentFocusCycleRootPriv(window); toFocus.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP); } } diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java index 99cbdaff124..65c7ceaec5f 100644 --- a/jdk/src/share/classes/java/awt/Container.java +++ b/jdk/src/share/classes/java/awt/Container.java @@ -3245,7 +3245,7 @@ public class Container extends Component { if (root != currentFocusCycleRoot) { KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot(root); + setGlobalCurrentFocusCycleRootPriv(root); } return root; } @@ -3302,7 +3302,7 @@ public class Container extends Component { Container cont = kfm.getCurrentFocusCycleRoot(); if (cont == this || isParentOf(cont)) { - kfm.setGlobalCurrentFocusCycleRoot(null); + kfm.setGlobalCurrentFocusCycleRootPriv(null); } } @@ -3506,7 +3506,7 @@ public class Container extends Component { public void transferFocusDownCycle() { if (isFocusCycleRoot()) { KeyboardFocusManager.getCurrentKeyboardFocusManager(). - setGlobalCurrentFocusCycleRoot(this); + setGlobalCurrentFocusCycleRootPriv(this); Component toFocus = getFocusTraversalPolicy(). getDefaultComponent(this); if (toFocus != null) { diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java index d12ed9e3c64..5e7792a26d8 100644 --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java @@ -637,8 +637,8 @@ public abstract class KeyboardFocusManager } void clearGlobalFocusOwnerPriv() { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { clearGlobalFocusOwner(); return null; } @@ -1287,6 +1287,15 @@ public abstract class KeyboardFocusManager newFocusCycleRoot); } + void setGlobalCurrentFocusCycleRootPriv(final Container newFocusCycleRoot) { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { + setGlobalCurrentFocusCycleRoot(newFocusCycleRoot); + return null; + } + }); + } + /** * Adds a PropertyChangeListener to the listener list. The listener is * registered for all bound properties of this class, including the From 614cc9b497b4ab771e2077f9a3af1e6ab0983078 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 18:10:28 +0200 Subject: [PATCH 71/73] Added tag jdk8-b38 for changeset 4cc5610a6dd6 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 41f7b254bf7..fd9cacb7c88 100644 --- a/.hgtags +++ b/.hgtags @@ -159,3 +159,4 @@ a6e6d42203e6d35f9e8b31eac25b0021b4dd58ad jdk8-b33 f151d5833912a82cd4f203944da0305c3be83ecc jdk8-b35 98ce9816ae089c959ba1e70fba98423a31c4e9fa jdk8-b36 b3a91113026c99b0da010d41055719ab0d8938f0 jdk8-b37 +4cc5610a6dd6227da766ebf9742eb11ff5ded6c0 jdk8-b38 From 7dabba40eef869019c3c395456e3645f11ae60d9 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 18:10:55 +0200 Subject: [PATCH 72/73] Added tag jdk8-b39 for changeset 35a539727877 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index fd9cacb7c88..b9e82f0d134 100644 --- a/.hgtags +++ b/.hgtags @@ -160,3 +160,4 @@ f151d5833912a82cd4f203944da0305c3be83ecc jdk8-b35 98ce9816ae089c959ba1e70fba98423a31c4e9fa jdk8-b36 b3a91113026c99b0da010d41055719ab0d8938f0 jdk8-b37 4cc5610a6dd6227da766ebf9742eb11ff5ded6c0 jdk8-b38 +35a5397278779a2f8f3013f81586dc8f30cb149d jdk8-b39 From 66750be14c44dfc23b9059b8fd938dfe3cf0eee4 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 24 May 2012 16:15:58 -0700 Subject: [PATCH 73/73] Added tag jdk8-b40 for changeset 95f428cdf9d2 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 29bb09eac0e..d1ac29cc4ec 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -161,3 +161,4 @@ ddfe5562f61f54ed2121ac0c73b688b94f3e66b5 jdk8-b32 9e82ac15ab80370d6e021aea7b98c7c9626adb5e jdk8-b37 c45f3509a70796c54b48f32910d1caf435763416 jdk8-b38 b6f52911752110a2889681923992c7a0baa52ccc jdk8-b39 +b88fc3359dc7edabfa8a228855d8cebf8843c055 jdk8-b40