From 6d199252f6ec0dfa97210542e1853a95ddcf7662 Mon Sep 17 00:00:00 2001 From: Keith McGuigan Date: Fri, 15 Apr 2011 10:17:23 -0400 Subject: [PATCH 001/117] 6519228: JDWP Spec: need references at capability canRequestMonitorEvents for JDWP 1.6 Monitor* events Add descriptions in event type table Reviewed-by: ohair, jjh, acorn, dcubed --- jdk/make/jpda/jdwp/jdwp.spec | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/jdk/make/jpda/jdwp/jdwp.spec b/jdk/make/jpda/jdwp/jdwp.spec index 86bce315226..3f28a918ef4 100644 --- a/jdk/make/jpda/jdwp/jdwp.spec +++ b/jdk/make/jpda/jdwp/jdwp.spec @@ -2190,7 +2190,8 @@ JDWP "Java(tm) Debug Wire Protocol" (Out (byte eventKind "Event kind to request. " "See JDWP.EventKind " - "for a complete list of events that can be requested. " + "for a complete list of events that can be requested; " + "some events may require a capability in order to be requested. " ) (byte suspendPolicy "What threads are suspended when this event occurs? " @@ -2732,6 +2733,8 @@ JDWP "Java(tm) Debug Wire Protocol" (Alt MonitorContendedEnter=JDWP.EventKind.MONITOR_CONTENDED_ENTER "Notification that a thread in the target VM is attempting " "to enter a monitor that is already acquired by another thread. " + "Requires canRequestMonitorEvents capability - see " + "CapabilitiesNew. " "

Since JDWP version 1.6. " (int requestID @@ -2743,6 +2746,8 @@ JDWP "Java(tm) Debug Wire Protocol" (Alt MonitorContendedEntered=JDWP.EventKind.MONITOR_CONTENDED_ENTERED "Notification of a thread in the target VM is entering a monitor " "after waiting for it to be released by another thread. " + "Requires canRequestMonitorEvents capability - see " + "CapabilitiesNew. " "

Since JDWP version 1.6. " (int requestID @@ -2753,6 +2758,8 @@ JDWP "Java(tm) Debug Wire Protocol" ) (Alt MonitorWait=JDWP.EventKind.MONITOR_WAIT "Notification of a thread about to wait on a monitor object. " + "Requires canRequestMonitorEvents capability - see " + "CapabilitiesNew. " "

Since JDWP version 1.6. " (int requestID @@ -2764,6 +2771,8 @@ JDWP "Java(tm) Debug Wire Protocol" ) (Alt MonitorWaited=JDWP.EventKind.MONITOR_WAITED "Notification that a thread in the target VM has finished waiting on " + "Requires canRequestMonitorEvents capability - see " + "CapabilitiesNew. " "a monitor object. " "

Since JDWP version 1.6. " @@ -3050,9 +3059,9 @@ JDWP "Java(tm) Debug Wire Protocol" (Constant METHOD_EXIT =41 ) (Constant METHOD_EXIT_WITH_RETURN_VALUE =42 ) (Constant MONITOR_CONTENDED_ENTER =43 ) - (Constant MONITOR_CONTENDED_ENTERED =44 ) - (Constant MONITOR_WAIT =45 ) - (Constant MONITOR_WAITED =46 ) + (Constant MONITOR_CONTENDED_ENTERED =44 ) + (Constant MONITOR_WAIT =45 ) + (Constant MONITOR_WAITED =46 ) (Constant VM_START =90 ) (Constant VM_INIT =90 "obsolete - was used in jvmdi") (Constant VM_DEATH =99 ) From 0b2d972fd3d10307bb613cb23d4f09385eb76287 Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Mon, 18 Apr 2011 01:33:28 -0700 Subject: [PATCH 002/117] 7018355: JSR 292: VM crash in DefNewGeneration::copy_to_survivor_space Reviewed-by: kvn, jrose --- hotspot/src/share/vm/ci/ciMethod.hpp | 6 +- .../src/share/vm/memory/genOopClosures.hpp | 4 +- .../src/share/vm/prims/methodHandleWalk.cpp | 6 +- hotspot/src/share/vm/prims/methodHandles.cpp | 213 +++++++++--------- hotspot/src/share/vm/prims/methodHandles.hpp | 16 +- .../src/share/vm/runtime/sharedRuntime.cpp | 8 +- 6 files changed, 121 insertions(+), 132 deletions(-) diff --git a/hotspot/src/share/vm/ci/ciMethod.hpp b/hotspot/src/share/vm/ci/ciMethod.hpp index 745806c0c06..840fb5da020 100644 --- a/hotspot/src/share/vm/ci/ciMethod.hpp +++ b/hotspot/src/share/vm/ci/ciMethod.hpp @@ -276,9 +276,9 @@ class ciMethod : public ciObject { void print_short_name(outputStream* st = tty); methodOop get_method_handle_target() { - klassOop receiver_limit_oop = NULL; - int flags = 0; - return MethodHandles::decode_method(get_oop(), receiver_limit_oop, flags); + KlassHandle receiver_limit; int flags = 0; + methodHandle m = MethodHandles::decode_method(get_oop(), receiver_limit, flags); + return m(); } }; diff --git a/hotspot/src/share/vm/memory/genOopClosures.hpp b/hotspot/src/share/vm/memory/genOopClosures.hpp index 77ae7efba6d..6d5257c4f36 100644 --- a/hotspot/src/share/vm/memory/genOopClosures.hpp +++ b/hotspot/src/share/vm/memory/genOopClosures.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -175,7 +175,7 @@ class VerifyOopClosure: public OopClosure { protected: template inline void do_oop_work(T* p) { oop obj = oopDesc::load_decode_heap_oop(p); - guarantee(obj->is_oop_or_null(), "invalid oop"); + guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, obj)); } public: virtual void do_oop(oop* p); diff --git a/hotspot/src/share/vm/prims/methodHandleWalk.cpp b/hotspot/src/share/vm/prims/methodHandleWalk.cpp index 3570d2db403..936d1e73952 100644 --- a/hotspot/src/share/vm/prims/methodHandleWalk.cpp +++ b/hotspot/src/share/vm/prims/methodHandleWalk.cpp @@ -82,10 +82,8 @@ void MethodHandleChain::set_method_handle(Handle mh, TRAPS) { void MethodHandleChain::set_last_method(oop target, TRAPS) { _is_last = true; - klassOop receiver_limit_oop = NULL; - int flags = 0; - methodOop m = MethodHandles::decode_method(target, receiver_limit_oop, flags); - _last_method = methodHandle(THREAD, m); + KlassHandle receiver_limit; int flags = 0; + _last_method = MethodHandles::decode_method(target, receiver_limit, flags); if ((flags & MethodHandles::_dmf_has_receiver) == 0) _last_invoke = Bytecodes::_invokestatic; else if ((flags & MethodHandles::_dmf_does_dispatch) == 0) diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp index eb0ba3df1f0..12a483f23b5 100644 --- a/hotspot/src/share/vm/prims/methodHandles.cpp +++ b/hotspot/src/share/vm/prims/methodHandles.cpp @@ -153,9 +153,9 @@ void MethodHandles::set_enabled(bool z) { // and local, like parse a data structure. For speed, such methods work on plain // oops, not handles. Trapping methods uniformly operate on handles. -methodOop MethodHandles::decode_vmtarget(oop vmtarget, int vmindex, oop mtype, - klassOop& receiver_limit_result, int& decode_flags_result) { - if (vmtarget == NULL) return NULL; +methodHandle MethodHandles::decode_vmtarget(oop vmtarget, int vmindex, oop mtype, + KlassHandle& receiver_limit_result, int& decode_flags_result) { + if (vmtarget == NULL) return methodHandle(); assert(methodOopDesc::nonvirtual_vtable_index < 0, "encoding"); if (vmindex < 0) { // this DMH performs no dispatch; it is directly bound to a methodOop @@ -198,20 +198,20 @@ methodOop MethodHandles::decode_vmtarget(oop vmtarget, int vmindex, oop mtype, // MemberName and DirectMethodHandle have the same linkage to the JVM internals. // (MemberName is the non-operational name used for queries and setup.) -methodOop MethodHandles::decode_DirectMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) { +methodHandle MethodHandles::decode_DirectMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result) { oop vmtarget = java_lang_invoke_DirectMethodHandle::vmtarget(mh); int vmindex = java_lang_invoke_DirectMethodHandle::vmindex(mh); oop mtype = java_lang_invoke_DirectMethodHandle::type(mh); return decode_vmtarget(vmtarget, vmindex, mtype, receiver_limit_result, decode_flags_result); } -methodOop MethodHandles::decode_BoundMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) { +methodHandle MethodHandles::decode_BoundMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result) { assert(java_lang_invoke_BoundMethodHandle::is_instance(mh), ""); assert(mh->klass() != SystemDictionary::AdapterMethodHandle_klass(), ""); for (oop bmh = mh;;) { // Bound MHs can be stacked to bind several arguments. oop target = java_lang_invoke_MethodHandle::vmtarget(bmh); - if (target == NULL) return NULL; + if (target == NULL) return methodHandle(); decode_flags_result |= MethodHandles::_dmf_binds_argument; klassOop tk = target->klass(); if (tk == SystemDictionary::BoundMethodHandle_klass()) { @@ -236,14 +236,14 @@ methodOop MethodHandles::decode_BoundMethodHandle(oop mh, klassOop& receiver_lim } } -methodOop MethodHandles::decode_AdapterMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) { +methodHandle MethodHandles::decode_AdapterMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result) { assert(mh->klass() == SystemDictionary::AdapterMethodHandle_klass(), ""); for (oop amh = mh;;) { // Adapter MHs can be stacked to convert several arguments. int conv_op = adapter_conversion_op(java_lang_invoke_AdapterMethodHandle::conversion(amh)); decode_flags_result |= (_dmf_adapter_lsb << conv_op) & _DMF_ADAPTER_MASK; oop target = java_lang_invoke_MethodHandle::vmtarget(amh); - if (target == NULL) return NULL; + if (target == NULL) return methodHandle(); klassOop tk = target->klass(); if (tk == SystemDictionary::AdapterMethodHandle_klass()) { amh = target; @@ -255,8 +255,8 @@ methodOop MethodHandles::decode_AdapterMethodHandle(oop mh, klassOop& receiver_l } } -methodOop MethodHandles::decode_MethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result) { - if (mh == NULL) return NULL; +methodHandle MethodHandles::decode_MethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result) { + if (mh == NULL) return methodHandle(); klassOop mhk = mh->klass(); assert(java_lang_invoke_MethodHandle::is_subclass(mhk), "must be a MethodHandle"); if (mhk == SystemDictionary::DirectMethodHandle_klass()) { @@ -270,7 +270,7 @@ methodOop MethodHandles::decode_MethodHandle(oop mh, klassOop& receiver_limit_re return decode_BoundMethodHandle(mh, receiver_limit_result, decode_flags_result); } else { assert(false, "cannot parse this MH"); - return NULL; // random MH? + return methodHandle(); // random MH? } } @@ -299,9 +299,9 @@ methodOop MethodHandles::decode_methodOop(methodOop m, int& decode_flags_result) // A trusted party is handing us a cookie to determine a method. // Let's boil it down to the method oop they really want. -methodOop MethodHandles::decode_method(oop x, klassOop& receiver_limit_result, int& decode_flags_result) { +methodHandle MethodHandles::decode_method(oop x, KlassHandle& receiver_limit_result, int& decode_flags_result) { decode_flags_result = 0; - receiver_limit_result = NULL; + receiver_limit_result = KlassHandle(); klassOop xk = x->klass(); if (xk == Universe::methodKlassObj()) { return decode_methodOop((methodOop) x, decode_flags_result); @@ -329,7 +329,7 @@ methodOop MethodHandles::decode_method(oop x, klassOop& receiver_limit_result, i assert(!x->is_method(), "already checked"); assert(!java_lang_invoke_MemberName::is_instance(x), "already checked"); } - return NULL; + return methodHandle(); } @@ -389,11 +389,10 @@ void MethodHandles::init_MemberName(oop mname_oop, oop target_oop) { int offset = instanceKlass::cast(k)->offset_from_fields(slot); init_MemberName(mname_oop, k, accessFlags_from(mods), offset); } else { - int decode_flags = 0; klassOop receiver_limit = NULL; - methodOop m = MethodHandles::decode_method(target_oop, - receiver_limit, decode_flags); + KlassHandle receiver_limit; int decode_flags = 0; + methodHandle m = MethodHandles::decode_method(target_oop, receiver_limit, decode_flags); bool do_dispatch = ((decode_flags & MethodHandles::_dmf_does_dispatch) != 0); - init_MemberName(mname_oop, m, do_dispatch); + init_MemberName(mname_oop, m(), do_dispatch); } } @@ -423,13 +422,14 @@ void MethodHandles::init_MemberName(oop mname_oop, klassOop field_holder, Access } -methodOop MethodHandles::decode_MemberName(oop mname, klassOop& receiver_limit_result, int& decode_flags_result) { +methodHandle MethodHandles::decode_MemberName(oop mname, KlassHandle& receiver_limit_result, int& decode_flags_result) { + methodHandle empty; int flags = java_lang_invoke_MemberName::flags(mname); - if ((flags & (IS_METHOD | IS_CONSTRUCTOR)) == 0) return NULL; // not invocable + if ((flags & (IS_METHOD | IS_CONSTRUCTOR)) == 0) return empty; // not invocable oop vmtarget = java_lang_invoke_MemberName::vmtarget(mname); int vmindex = java_lang_invoke_MemberName::vmindex(mname); - if (vmindex == VM_INDEX_UNINITIALIZED) return NULL; // not resolved - methodOop m = decode_vmtarget(vmtarget, vmindex, NULL, receiver_limit_result, decode_flags_result); + if (vmindex == VM_INDEX_UNINITIALIZED) return empty; // not resolved + methodHandle m = decode_vmtarget(vmtarget, vmindex, NULL, receiver_limit_result, decode_flags_result); oop clazz = java_lang_invoke_MemberName::clazz(mname); if (clazz != NULL && java_lang_Class::is_instance(clazz)) { klassOop klass = java_lang_Class::as_klassOop(clazz); @@ -439,9 +439,7 @@ methodOop MethodHandles::decode_MemberName(oop mname, klassOop& receiver_limit_r } // convert the external string or reflective type to an internal signature -Symbol* MethodHandles::convert_to_signature(oop type_str, - bool polymorphic, - TRAPS) { +Symbol* MethodHandles::convert_to_signature(oop type_str, bool polymorphic, TRAPS) { if (java_lang_invoke_MethodType::is_instance(type_str)) { return java_lang_invoke_MethodType::as_signature(type_str, polymorphic, CHECK_NULL); } else if (java_lang_Class::is_instance(type_str)) { @@ -474,48 +472,48 @@ void MethodHandles::resolve_MemberName(Handle mname, TRAPS) { #endif if (java_lang_invoke_MemberName::vmindex(mname()) != VM_INDEX_UNINITIALIZED) return; // already resolved - oop defc_oop = java_lang_invoke_MemberName::clazz(mname()); - oop name_str = java_lang_invoke_MemberName::name(mname()); - oop type_str = java_lang_invoke_MemberName::type(mname()); - int flags = java_lang_invoke_MemberName::flags(mname()); + Handle defc_oop(THREAD, java_lang_invoke_MemberName::clazz(mname())); + Handle name_str(THREAD, java_lang_invoke_MemberName::name( mname())); + Handle type_str(THREAD, java_lang_invoke_MemberName::type( mname())); + int flags = java_lang_invoke_MemberName::flags(mname()); - if (defc_oop == NULL || name_str == NULL || type_str == NULL) { + if (defc_oop.is_null() || name_str.is_null() || type_str.is_null()) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "nothing to resolve"); } - klassOop defc_klassOop = java_lang_Class::as_klassOop(defc_oop); - defc_oop = NULL; // safety - if (defc_klassOop == NULL) return; // a primitive; no resolution possible - if (!Klass::cast(defc_klassOop)->oop_is_instance()) { - if (!Klass::cast(defc_klassOop)->oop_is_array()) return; - defc_klassOop = SystemDictionary::Object_klass(); + + instanceKlassHandle defc; + { + klassOop defc_klassOop = java_lang_Class::as_klassOop(defc_oop()); + if (defc_klassOop == NULL) return; // a primitive; no resolution possible + if (!Klass::cast(defc_klassOop)->oop_is_instance()) { + if (!Klass::cast(defc_klassOop)->oop_is_array()) return; + defc_klassOop = SystemDictionary::Object_klass(); + } + defc = instanceKlassHandle(THREAD, defc_klassOop); } - instanceKlassHandle defc(THREAD, defc_klassOop); - defc_klassOop = NULL; // safety if (defc.is_null()) { THROW_MSG(vmSymbols::java_lang_InternalError(), "primitive class"); } - defc->link_class(CHECK); + defc->link_class(CHECK); // possible safepoint // convert the external string name to an internal symbol - TempNewSymbol name = java_lang_String::as_symbol_or_null(name_str); + TempNewSymbol name = java_lang_String::as_symbol_or_null(name_str()); if (name == NULL) return; // no such name - name_str = NULL; // safety Handle polymorphic_method_type; bool polymorphic_signature = false; if ((flags & ALL_KINDS) == IS_METHOD && (defc() == SystemDictionary::MethodHandle_klass() && - methodOopDesc::is_method_handle_invoke_name(name))) + methodOopDesc::is_method_handle_invoke_name(name))) { polymorphic_signature = true; - - // convert the external string or reflective type to an internal signature - TempNewSymbol type = convert_to_signature(type_str, polymorphic_signature, CHECK); - if (java_lang_invoke_MethodType::is_instance(type_str) && polymorphic_signature) { - polymorphic_method_type = Handle(THREAD, type_str); //preserve exactly } + // convert the external string or reflective type to an internal signature + TempNewSymbol type = convert_to_signature(type_str(), polymorphic_signature, CHECK); + if (java_lang_invoke_MethodType::is_instance(type_str()) && polymorphic_signature) { + polymorphic_method_type = type_str; // preserve exactly + } if (type == NULL) return; // no such signature exists in the VM - type_str = NULL; // safety // Time to do the lookup. switch (flags & ALL_KINDS) { @@ -560,8 +558,8 @@ void MethodHandles::resolve_MemberName(Handle mname, TRAPS) { java_lang_invoke_MemberName::set_vmtarget(mname(), vmtarget); java_lang_invoke_MemberName::set_vmindex(mname(), vmindex); java_lang_invoke_MemberName::set_modifiers(mname(), mods); - DEBUG_ONLY(int junk; klassOop junk2); - assert(decode_MemberName(mname(), junk2, junk) == result.resolved_method()(), + DEBUG_ONLY(KlassHandle junk1; int junk2); + assert(decode_MemberName(mname(), junk1, junk2) == result.resolved_method(), "properly stored for later decoding"); return; } @@ -589,8 +587,8 @@ void MethodHandles::resolve_MemberName(Handle mname, TRAPS) { java_lang_invoke_MemberName::set_vmtarget(mname(), vmtarget); java_lang_invoke_MemberName::set_vmindex(mname(), vmindex); java_lang_invoke_MemberName::set_modifiers(mname(), mods); - DEBUG_ONLY(int junk; klassOop junk2); - assert(decode_MemberName(mname(), junk2, junk) == result.resolved_method()(), + DEBUG_ONLY(KlassHandle junk1; int junk2); + assert(decode_MemberName(mname(), junk1, junk2) == result.resolved_method(), "properly stored for later decoding"); return; } @@ -677,16 +675,14 @@ void MethodHandles::expand_MemberName(Handle mname, int suppress, TRAPS) { case IS_METHOD: case IS_CONSTRUCTOR: { - klassOop receiver_limit = NULL; - int decode_flags = 0; - methodHandle m(THREAD, decode_vmtarget(vmtarget, vmindex, NULL, - receiver_limit, decode_flags)); + KlassHandle receiver_limit; int decode_flags = 0; + methodHandle m = decode_vmtarget(vmtarget, vmindex, NULL, receiver_limit, decode_flags); if (m.is_null()) break; if (!have_defc) { klassOop defc = m->method_holder(); - if (receiver_limit != NULL && receiver_limit != defc - && Klass::cast(receiver_limit)->is_subtype_of(defc)) - defc = receiver_limit; + if (receiver_limit.not_null() && receiver_limit() != defc + && Klass::cast(receiver_limit())->is_subtype_of(defc)) + defc = receiver_limit(); java_lang_invoke_MemberName::set_clazz(mname(), Klass::cast(defc)->java_mirror()); } if (!have_name) { @@ -884,10 +880,9 @@ oop MethodHandles::encode_target(Handle mh, int format, TRAPS) { // - AMH can have methodOop for static invoke with bound receiver // - DMH can have methodOop for static invoke (on variable receiver) // - DMH can have klassOop for dispatched (non-static) invoke - klassOop receiver_limit = NULL; - int decode_flags = 0; - methodOop m = decode_MethodHandle(mh(), receiver_limit, decode_flags); - if (m == NULL) return NULL; + KlassHandle receiver_limit; int decode_flags = 0; + methodHandle m = decode_MethodHandle(mh(), receiver_limit, decode_flags); + if (m.is_null()) return NULL; switch (format) { case ETF_REFLECT_METHOD: // same as jni_ToReflectedMethod: @@ -903,10 +898,10 @@ oop MethodHandles::encode_target(Handle mh, int format, TRAPS) { if (SystemDictionary::MemberName_klass() == NULL) break; instanceKlassHandle mname_klass(THREAD, SystemDictionary::MemberName_klass()); mname_klass->initialize(CHECK_NULL); - Handle mname = mname_klass->allocate_instance_handle(CHECK_NULL); + Handle mname = mname_klass->allocate_instance_handle(CHECK_NULL); // possible safepoint java_lang_invoke_MemberName::set_vmindex(mname(), VM_INDEX_UNINITIALIZED); bool do_dispatch = ((decode_flags & MethodHandles::_dmf_does_dispatch) != 0); - init_MemberName(mname(), m, do_dispatch); + init_MemberName(mname(), m(), do_dispatch); expand_MemberName(mname, 0, CHECK_NULL); return mname(); } @@ -1459,8 +1454,8 @@ void MethodHandles::init_DirectMethodHandle(Handle mh, methodHandle m, bool do_d // that links the interpreter calls to the method. We need the same // bits, and will use the same calling sequence code. - int vmindex = methodOopDesc::garbage_vtable_index; - oop vmtarget = NULL; + int vmindex = methodOopDesc::garbage_vtable_index; + Handle vmtarget; instanceKlass::cast(m->method_holder())->link_class(CHECK); @@ -1478,7 +1473,7 @@ void MethodHandles::init_DirectMethodHandle(Handle mh, methodHandle m, bool do_d } else if (!do_dispatch || m->can_be_statically_bound()) { // We are simulating an invokestatic or invokespecial instruction. // Set up the method pointer, just like ConstantPoolCacheEntry::set_method(). - vmtarget = m(); + vmtarget = m; // this does not help dispatch, but it will make it possible to parse this MH: vmindex = methodOopDesc::nonvirtual_vtable_index; assert(vmindex < 0, "(>=0) == do_dispatch"); @@ -1490,7 +1485,7 @@ void MethodHandles::init_DirectMethodHandle(Handle mh, methodHandle m, bool do_d // For a DMH, it is done now, when the handle is created. Klass* k = Klass::cast(m->method_holder()); if (k->should_be_initialized()) { - k->initialize(CHECK); + k->initialize(CHECK); // possible safepoint } } } else { @@ -1504,10 +1499,10 @@ void MethodHandles::init_DirectMethodHandle(Handle mh, methodHandle m, bool do_d if (me == NULL) { THROW(vmSymbols::java_lang_InternalError()); } - java_lang_invoke_DirectMethodHandle::set_vmtarget(mh(), vmtarget); - java_lang_invoke_DirectMethodHandle::set_vmindex(mh(), vmindex); - DEBUG_ONLY(int flags; klassOop rlimit); - assert(MethodHandles::decode_method(mh(), rlimit, flags) == m(), + java_lang_invoke_DirectMethodHandle::set_vmtarget(mh(), vmtarget()); + java_lang_invoke_DirectMethodHandle::set_vmindex( mh(), vmindex); + DEBUG_ONLY(KlassHandle rlimit; int flags); + assert(MethodHandles::decode_method(mh(), rlimit, flags) == m, "properly stored for later decoding"); DEBUG_ONLY(bool actual_do_dispatch = ((flags & _dmf_does_dispatch) != 0)); assert(!(actual_do_dispatch && !do_dispatch), @@ -1523,10 +1518,13 @@ void MethodHandles::verify_BoundMethodHandle_with_receiver(Handle mh, methodHandle m, TRAPS) { // Verify type. - oop receiver = java_lang_invoke_BoundMethodHandle::argument(mh()); - Handle mtype(THREAD, java_lang_invoke_MethodHandle::type(mh())); KlassHandle bound_recv_type; - if (receiver != NULL) bound_recv_type = KlassHandle(THREAD, receiver->klass()); + { + oop receiver = java_lang_invoke_BoundMethodHandle::argument(mh()); + if (receiver != NULL) + bound_recv_type = KlassHandle(THREAD, receiver->klass()); + } + Handle mtype(THREAD, java_lang_invoke_MethodHandle::type(mh())); verify_method_type(m, mtype, true, bound_recv_type, CHECK); int receiver_pos = m->size_of_parameters() - 1; @@ -1573,8 +1571,8 @@ void MethodHandles::init_BoundMethodHandle_with_receiver(Handle mh, java_lang_invoke_BoundMethodHandle::set_vmtarget(mh(), m()); - DEBUG_ONLY(int junk; klassOop junk2); - assert(MethodHandles::decode_method(mh(), junk2, junk) == m(), "properly stored for later decoding"); + DEBUG_ONLY(KlassHandle junk1; int junk2); + assert(MethodHandles::decode_method(mh(), junk1, junk2) == m, "properly stored for later decoding"); assert(decode_MethodHandle_stack_pushes(mh()) == 1, "BMH pushes one stack slot"); // Done! @@ -1682,8 +1680,11 @@ void MethodHandles::init_BoundMethodHandle(Handle mh, Handle target, int argnum, } // Get bound type and required slots. - oop ptype_oop = java_lang_invoke_MethodType::ptype(java_lang_invoke_MethodHandle::type(target()), argnum); - BasicType ptype = java_lang_Class::as_BasicType(ptype_oop); + BasicType ptype; + { + oop ptype_oop = java_lang_invoke_MethodType::ptype(java_lang_invoke_MethodHandle::type(target()), argnum); + ptype = java_lang_Class::as_BasicType(ptype_oop); + } int slots_pushed = type2size[ptype]; // If (a) the target is a direct non-dispatched method handle, @@ -1694,13 +1695,12 @@ void MethodHandles::init_BoundMethodHandle(Handle mh, Handle target, int argnum, if (OptimizeMethodHandles && target->klass() == SystemDictionary::DirectMethodHandle_klass() && (argnum == 0 || java_lang_invoke_DirectMethodHandle::vmindex(target()) < 0)) { - int decode_flags = 0; klassOop receiver_limit_oop = NULL; - methodHandle m(THREAD, decode_method(target(), receiver_limit_oop, decode_flags)); + KlassHandle receiver_limit; int decode_flags = 0; + methodHandle m = decode_method(target(), receiver_limit, decode_flags); if (m.is_null()) { THROW_MSG(vmSymbols::java_lang_InternalError(), "DMH failed to decode"); } DEBUG_ONLY(int m_vmslots = m->size_of_parameters() - slots_pushed); // pos. of 1st arg. assert(java_lang_invoke_BoundMethodHandle::vmslots(mh()) == m_vmslots, "type w/ m sig"); if (argnum == 0 && (decode_flags & _dmf_has_receiver) != 0) { - KlassHandle receiver_limit(THREAD, receiver_limit_oop); init_BoundMethodHandle_with_receiver(mh, m, receiver_limit, decode_flags, CHECK); @@ -2019,7 +2019,6 @@ void MethodHandles::verify_AdapterMethodHandle(Handle mh, int argnum, TRAPS) { } void MethodHandles::init_AdapterMethodHandle(Handle mh, Handle target, int argnum, TRAPS) { - oop argument = java_lang_invoke_AdapterMethodHandle::argument(mh()); int argslot = java_lang_invoke_AdapterMethodHandle::vmargslot(mh()); jint conversion = java_lang_invoke_AdapterMethodHandle::conversion(mh()); jint conv_op = adapter_conversion_op(conversion); @@ -2215,18 +2214,14 @@ JVM_ENTRY(void, MHN_init_DMH(JNIEnv *env, jobject igcls, jobject mh_jh, // which method are we really talking about? if (target_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); } - oop target_oop = JNIHandles::resolve_non_null(target_jh); - if (java_lang_invoke_MemberName::is_instance(target_oop) && - java_lang_invoke_MemberName::vmindex(target_oop) == VM_INDEX_UNINITIALIZED) { - Handle mname(THREAD, target_oop); - MethodHandles::resolve_MemberName(mname, CHECK); - target_oop = mname(); // in case of GC + Handle target(THREAD, JNIHandles::resolve_non_null(target_jh)); + if (java_lang_invoke_MemberName::is_instance(target()) && + java_lang_invoke_MemberName::vmindex(target()) == VM_INDEX_UNINITIALIZED) { + MethodHandles::resolve_MemberName(target, CHECK); } - int decode_flags = 0; klassOop receiver_limit = NULL; - methodHandle m(THREAD, - MethodHandles::decode_method(target_oop, - receiver_limit, decode_flags)); + KlassHandle receiver_limit; int decode_flags = 0; + methodHandle m = MethodHandles::decode_method(target(), receiver_limit, decode_flags); if (m.is_null()) { THROW_MSG(vmSymbols::java_lang_InternalError(), "no such method"); } // The trusted Java code that calls this method should already have performed @@ -2284,12 +2279,8 @@ JVM_ENTRY(void, MHN_init_BMH(JNIEnv *env, jobject igcls, jobject mh_jh, // Target object is a reflective method. (%%% Do we need this alternate path?) Untested("init_BMH of non-MH"); if (argnum != 0) { THROW(vmSymbols::java_lang_InternalError()); } - int decode_flags = 0; klassOop receiver_limit_oop = NULL; - methodHandle m(THREAD, - MethodHandles::decode_method(target(), - receiver_limit_oop, - decode_flags)); - KlassHandle receiver_limit(THREAD, receiver_limit_oop); + KlassHandle receiver_limit; int decode_flags = 0; + methodHandle m = MethodHandles::decode_method(target(), receiver_limit, decode_flags); MethodHandles::init_BoundMethodHandle_with_receiver(mh, m, receiver_limit, decode_flags, @@ -2424,12 +2415,12 @@ JVM_ENTRY(jint, MHN_getNamedCon(JNIEnv *env, jobject igcls, jint which, jobjectA #ifndef PRODUCT if (which >= 0 && which < con_value_count) { int con = con_values[which]; - objArrayOop box = (objArrayOop) JNIHandles::resolve(box_jh); - if (box != NULL && box->klass() == Universe::objectArrayKlassObj() && box->length() > 0) { + objArrayHandle box(THREAD, (objArrayOop) JNIHandles::resolve(box_jh)); + if (box.not_null() && box->klass() == Universe::objectArrayKlassObj() && box->length() > 0) { const char* str = &con_names[0]; for (int i = 0; i < which; i++) str += strlen(str) + 1; // skip name and null - oop name = java_lang_String::create_oop_from_str(str, CHECK_0); + oop name = java_lang_String::create_oop_from_str(str, CHECK_0); // possible safepoint box->obj_at_put(0, name); } return con; @@ -2486,10 +2477,10 @@ JVM_ENTRY(jint, MHN_getMembers(JNIEnv *env, jobject igcls, jclass clazz_jh, jstring name_jh, jstring sig_jh, int mflags, jclass caller_jh, jint skip, jobjectArray results_jh)) { if (clazz_jh == NULL || results_jh == NULL) return -1; - klassOop k_oop = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz_jh)); + KlassHandle k(THREAD, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz_jh))); - objArrayOop results = (objArrayOop) JNIHandles::resolve(results_jh); - if (results == NULL || !results->is_objArray()) return -1; + objArrayHandle results(THREAD, (objArrayOop) JNIHandles::resolve(results_jh)); + if (results.is_null() || !results->is_objArray()) return -1; TempNewSymbol name = NULL; TempNewSymbol sig = NULL; @@ -2502,20 +2493,20 @@ JVM_ENTRY(jint, MHN_getMembers(JNIEnv *env, jobject igcls, if (sig == NULL) return 0; // a match is not possible } - klassOop caller = NULL; + KlassHandle caller; if (caller_jh != NULL) { oop caller_oop = JNIHandles::resolve_non_null(caller_jh); if (!java_lang_Class::is_instance(caller_oop)) return -1; - caller = java_lang_Class::as_klassOop(caller_oop); + caller = KlassHandle(THREAD, java_lang_Class::as_klassOop(caller_oop)); } - if (name != NULL && sig != NULL && results != NULL) { + if (name != NULL && sig != NULL && results.not_null()) { // try a direct resolve // %%% TO DO } - int res = MethodHandles::find_MemberNames(k_oop, name, sig, mflags, - caller, skip, results); + int res = MethodHandles::find_MemberNames(k(), name, sig, mflags, + caller(), skip, results()); // TO DO: expand at least some of the MemberNames, to avoid massive callbacks return res; } diff --git a/hotspot/src/share/vm/prims/methodHandles.hpp b/hotspot/src/share/vm/prims/methodHandles.hpp index 08e0b537700..d104783d40f 100644 --- a/hotspot/src/share/vm/prims/methodHandles.hpp +++ b/hotspot/src/share/vm/prims/methodHandles.hpp @@ -265,13 +265,13 @@ class MethodHandles: AllStatic { static inline address from_interpreted_entry(EntryKind ek); // helpers for decode_method. - static methodOop decode_methodOop(methodOop m, int& decode_flags_result); - static methodOop decode_vmtarget(oop vmtarget, int vmindex, oop mtype, klassOop& receiver_limit_result, int& decode_flags_result); - static methodOop decode_MemberName(oop mname, klassOop& receiver_limit_result, int& decode_flags_result); - static methodOop decode_MethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result); - static methodOop decode_DirectMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result); - static methodOop decode_BoundMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result); - static methodOop decode_AdapterMethodHandle(oop mh, klassOop& receiver_limit_result, int& decode_flags_result); + static methodOop decode_methodOop(methodOop m, int& decode_flags_result); + static methodHandle decode_vmtarget(oop vmtarget, int vmindex, oop mtype, KlassHandle& receiver_limit_result, int& decode_flags_result); + static methodHandle decode_MemberName(oop mname, KlassHandle& receiver_limit_result, int& decode_flags_result); + static methodHandle decode_MethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result); + static methodHandle decode_DirectMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result); + static methodHandle decode_BoundMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result); + static methodHandle decode_AdapterMethodHandle(oop mh, KlassHandle& receiver_limit_result, int& decode_flags_result); // Find out how many stack slots an mh pushes or pops. // The result is *not* reported as a multiple of stack_move_unit(); @@ -317,7 +317,7 @@ class MethodHandles: AllStatic { _dmf_adapter_lsb = 0x20, _DMF_ADAPTER_MASK = (_dmf_adapter_lsb << CONV_OP_LIMIT) - _dmf_adapter_lsb }; - static methodOop decode_method(oop x, klassOop& receiver_limit_result, int& decode_flags_result); + static methodHandle decode_method(oop x, KlassHandle& receiver_limit_result, int& decode_flags_result); enum { // format of query to getConstant: GC_JVM_PUSH_LIMIT = 0, diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index 820678701f4..f60b2f07029 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -1721,14 +1721,14 @@ char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread, targetArity = ArgumentCount(target->signature()).size(); } } - klassOop kignore; int dmf_flags = 0; - methodOop actual_method = MethodHandles::decode_method(actual, kignore, dmf_flags); + KlassHandle kignore; int dmf_flags = 0; + methodHandle actual_method = MethodHandles::decode_method(actual, kignore, dmf_flags); if ((dmf_flags & ~(MethodHandles::_dmf_has_receiver | MethodHandles::_dmf_does_dispatch | MethodHandles::_dmf_from_interface)) != 0) - actual_method = NULL; // MH does extra binds, drops, etc. + actual_method = methodHandle(); // MH does extra binds, drops, etc. bool has_receiver = ((dmf_flags & MethodHandles::_dmf_has_receiver) != 0); - if (actual_method != NULL) { + if (actual_method.not_null()) { mhName = actual_method->signature()->as_C_string(); mhArity = ArgumentCount(actual_method->signature()).size(); if (!actual_method->is_static()) mhArity += 1; From 7fb4bcc550613354a9b00517488414aff64cec67 Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Mon, 18 Apr 2011 06:50:57 -0700 Subject: [PATCH 003/117] 7036960: TemplateTable::fast_aldc in templateTable_x86_64.cpp uses movptr instead of load_klass Reviewed-by: kvn, iveresov --- .../src/cpu/x86/vm/templateTable_x86_32.cpp | 24 +++++++++---------- .../src/cpu/x86/vm/templateTable_x86_64.cpp | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp index b152f698cfd..483660826ac 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp @@ -413,7 +413,7 @@ void TemplateTable::fast_aldc(bool wide) { Label L_done, L_throw_exception; const Register con_klass_temp = rcx; // same as Rcache - __ movptr(con_klass_temp, Address(rax, oopDesc::klass_offset_in_bytes())); + __ load_klass(con_klass_temp, rax); __ cmpptr(con_klass_temp, ExternalAddress((address)Universe::systemObjArrayKlassObj_addr())); __ jcc(Assembler::notEqual, L_done); __ cmpl(Address(rax, arrayOopDesc::length_offset_in_bytes()), 0); @@ -423,7 +423,7 @@ void TemplateTable::fast_aldc(bool wide) { // Load the exception from the system-array which wraps it: __ bind(L_throw_exception); - __ movptr(rax, Address(rax, arrayOopDesc::base_offset_in_bytes(T_OBJECT))); + __ load_heap_oop(rax, Address(rax, arrayOopDesc::base_offset_in_bytes(T_OBJECT))); __ jump(ExternalAddress(Interpreter::throw_exception_entry())); __ bind(L_done); @@ -937,9 +937,9 @@ void TemplateTable::aastore() { __ jcc(Assembler::zero, is_null); // Move subklass into EBX - __ movptr(rbx, Address(rax, oopDesc::klass_offset_in_bytes())); + __ load_klass(rbx, rax); // Move superklass into EAX - __ movptr(rax, Address(rdx, oopDesc::klass_offset_in_bytes())); + __ load_klass(rax, rdx); __ movptr(rax, Address(rax, sizeof(oopDesc) + objArrayKlass::element_klass_offset_in_bytes())); // Compress array+index*wordSize+12 into a single register. Frees ECX. __ lea(rdx, element_address); @@ -1992,7 +1992,7 @@ void TemplateTable::_return(TosState state) { if (_desc->bytecode() == Bytecodes::_return_register_finalizer) { assert(state == vtos, "only valid state"); __ movptr(rax, aaddress(0)); - __ movptr(rdi, Address(rax, oopDesc::klass_offset_in_bytes())); + __ load_klass(rdi, rax); __ movl(rdi, Address(rdi, Klass::access_flags_offset_in_bytes() + sizeof(oopDesc))); __ testl(rdi, JVM_ACC_HAS_FINALIZER); Label skip_register_finalizer; @@ -2939,7 +2939,7 @@ void TemplateTable::invokevirtual_helper(Register index, Register recv, // get receiver klass __ null_check(recv, oopDesc::klass_offset_in_bytes()); // Keep recv in rcx for callee expects it there - __ movptr(rax, Address(recv, oopDesc::klass_offset_in_bytes())); + __ load_klass(rax, recv); __ verify_oop(rax); // profile this call @@ -3019,7 +3019,7 @@ void TemplateTable::invokeinterface(int byte_no) { // Get receiver klass into rdx - also a null check __ restore_locals(); // restore rdi - __ movptr(rdx, Address(rcx, oopDesc::klass_offset_in_bytes())); + __ load_klass(rdx, rcx); __ verify_oop(rdx); // profile this call @@ -3103,7 +3103,7 @@ void TemplateTable::invokedynamic(int byte_no) { __ profile_call(rsi); } - __ movptr(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rcx))); + __ load_heap_oop(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rcx))); __ null_check(rcx_method_handle); __ prepare_to_jump_from_interpreted(); __ jump_to_method_handle_entry(rcx_method_handle, rdx); @@ -3249,7 +3249,7 @@ void TemplateTable::_new() { (int32_t)markOopDesc::prototype()); // header __ pop(rcx); // get saved klass back in the register. } - __ movptr(Address(rax, oopDesc::klass_offset_in_bytes()), rcx); // klass + __ store_klass(rax, rcx); // klass { SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0); @@ -3324,7 +3324,7 @@ void TemplateTable::checkcast() { __ movptr(rax, Address(rcx, rbx, Address::times_ptr, sizeof(constantPoolOopDesc))); __ bind(resolved); - __ movptr(rbx, Address(rdx, oopDesc::klass_offset_in_bytes())); + __ load_klass(rbx, rdx); // Generate subtype check. Blows ECX. Resets EDI. Object in EDX. // Superklass in EAX. Subklass in EBX. @@ -3367,12 +3367,12 @@ void TemplateTable::instanceof() { __ push(atos); call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc) ); __ pop_ptr(rdx); - __ movptr(rdx, Address(rdx, oopDesc::klass_offset_in_bytes())); + __ load_klass(rdx, rdx); __ jmp(resolved); // Get superklass in EAX and subklass in EDX __ bind(quicked); - __ movptr(rdx, Address(rax, oopDesc::klass_offset_in_bytes())); + __ load_klass(rdx, rax); __ movptr(rax, Address(rcx, rbx, Address::times_ptr, sizeof(constantPoolOopDesc))); __ bind(resolved); diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp index 64385a7d54c..e1ec5ad4474 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp @@ -427,7 +427,7 @@ void TemplateTable::fast_aldc(bool wide) { Label L_done, L_throw_exception; const Register con_klass_temp = rcx; // same as cache const Register array_klass_temp = rdx; // same as index - __ movptr(con_klass_temp, Address(rax, oopDesc::klass_offset_in_bytes())); + __ load_klass(con_klass_temp, rax); __ lea(array_klass_temp, ExternalAddress((address)Universe::systemObjArrayKlassObj_addr())); __ cmpptr(con_klass_temp, Address(array_klass_temp, 0)); __ jcc(Assembler::notEqual, L_done); @@ -438,7 +438,7 @@ void TemplateTable::fast_aldc(bool wide) { // Load the exception from the system-array which wraps it: __ bind(L_throw_exception); - __ movptr(rax, Address(rax, arrayOopDesc::base_offset_in_bytes(T_OBJECT))); + __ load_heap_oop(rax, Address(rax, arrayOopDesc::base_offset_in_bytes(T_OBJECT))); __ jump(ExternalAddress(Interpreter::throw_exception_entry())); __ bind(L_done); From 2da9c4454aa3ad663a0ad83a692d2ca65ff0da10 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Mon, 18 Apr 2011 21:44:03 -0700 Subject: [PATCH 004/117] 7027900: (fs) glob syntax under-specified Clarify how leading dots are treated in nio2 glob Reviewed-by: alanb --- jdk/src/share/classes/java/nio/file/FileSystem.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jdk/src/share/classes/java/nio/file/FileSystem.java b/jdk/src/share/classes/java/nio/file/FileSystem.java index 97dfc4649fc..9091f4aae6e 100644 --- a/jdk/src/share/classes/java/nio/file/FileSystem.java +++ b/jdk/src/share/classes/java/nio/file/FileSystem.java @@ -391,6 +391,13 @@ public abstract class FileSystem * character is used to separate the subpatterns. Groups cannot be nested. *

* + *
  • Leading period/dot characters in file name are + * treated as regular characters in match operations. For example, + * the {@code "*"} glob pattern matches file name {@code ".login"}. + * The {@link Files#isHidden} method may be used to test whether a file + * is considered hidden. + *

  • + * *
  • All other characters match themselves in an implementation * dependent manner. This includes characters representing any {@link * FileSystem#getSeparator name-separators}.

  • From 06c379e859be3678183feec8ba4b680fe0b4172f Mon Sep 17 00:00:00 2001 From: Pavel Porvatov Date: Tue, 19 Apr 2011 10:11:58 +0400 Subject: [PATCH 005/117] 7036025: java.security.AccessControlException when creating JFileChooser in signed applet Reviewed-by: malenkov --- .../classes/sun/swing/WindowsPlacesBar.java | 9 ++- .../JFileChooser/7036025/bug7036025.java | 62 +++++++++++++++++++ .../JFileChooser/7036025/security.policy | 5 ++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 jdk/test/javax/swing/JFileChooser/7036025/bug7036025.java create mode 100644 jdk/test/javax/swing/JFileChooser/7036025/security.policy diff --git a/jdk/src/share/classes/sun/swing/WindowsPlacesBar.java b/jdk/src/share/classes/sun/swing/WindowsPlacesBar.java index 9972b671d75..a05259e5978 100644 --- a/jdk/src/share/classes/sun/swing/WindowsPlacesBar.java +++ b/jdk/src/share/classes/sun/swing/WindowsPlacesBar.java @@ -29,6 +29,8 @@ import java.awt.event.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.*; +import java.security.AccessController; +import java.security.PrivilegedAction; import javax.swing.*; import javax.swing.border.*; @@ -79,7 +81,12 @@ public class WindowsPlacesBar extends JToolBar setBackground(bgColor); FileSystemView fsv = fc.getFileSystemView(); - files = (File[])ShellFolder.get("fileChooserShortcutPanelFolders"); + files = AccessController.doPrivileged(new PrivilegedAction() { + public File[] run() { + return (File[]) ShellFolder.get("fileChooserShortcutPanelFolders"); + } + }); + buttons = new JToggleButton[files.length]; buttonGroup = new ButtonGroup(); for (int i = 0; i < files.length; i++) { diff --git a/jdk/test/javax/swing/JFileChooser/7036025/bug7036025.java b/jdk/test/javax/swing/JFileChooser/7036025/bug7036025.java new file mode 100644 index 00000000000..dd7b003a01f --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/7036025/bug7036025.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 7036025 + @summary java.security.AccessControlException when creating JFileChooser in signed applet + @author Pavel Porvatov + @run main/othervm/policy=security.policy bug7036025 +*/ + +import javax.swing.*; +import java.io.File; + +public class bug7036025 { + public static final String DIR = "c:/temp"; + + public static void main(String[] args) throws Exception { + String systemLookAndFeelClassName = UIManager.getSystemLookAndFeelClassName(); + + if (!systemLookAndFeelClassName.toLowerCase().contains("windows")) { + System.out.println("The test is only for Windows OS."); + + return; + } + + File file = new File(DIR); + + if (!file.exists()) { + if (!file.mkdir()) { + throw new RuntimeException("Cannot create " + DIR); + } + + file.deleteOnExit(); + } + + UIManager.setLookAndFeel(systemLookAndFeelClassName); + + new JFileChooser(file); + + System.out.println("Test passed for LookAndFeel " + UIManager.getLookAndFeel().getName()); + } +} diff --git a/jdk/test/javax/swing/JFileChooser/7036025/security.policy b/jdk/test/javax/swing/JFileChooser/7036025/security.policy new file mode 100644 index 00000000000..57e0bd2af52 --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/7036025/security.policy @@ -0,0 +1,5 @@ +grant { + permission java.io.FilePermission "C:\\temp\\*", "read"; + permission java.io.FilePermission "C:\\temp", "read,write,delete"; + permission java.util.PropertyPermission "*", "read"; +}; From 89d504b32f618ac6beecf8aa773fe94d09c1f5bb Mon Sep 17 00:00:00 2001 From: Anthony Petrov Date: Tue, 19 Apr 2011 14:44:09 +0400 Subject: [PATCH 006/117] 7036669: Simplify revalidating component hierarchy with multiple validate roots Introduce Component.revalidate() method Reviewed-by: art, alexp --- jdk/src/share/classes/java/awt/Component.java | 40 ++++++ .../plaf/basic/BasicSplitPaneDivider.java | 6 +- .../awt/Component/Revalidate/Revalidate.java | 122 ++++++++++++++++++ 3 files changed, 165 insertions(+), 3 deletions(-) create mode 100644 jdk/test/java/awt/Component/Revalidate/Revalidate.java diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index 5b572797d84..f577887abe6 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -2944,6 +2944,46 @@ public abstract class Component implements ImageObserver, MenuContainer, } } + /** + * Revalidates the component hierarchy up to the nearest validate root. + *

    + * This method first invalidates the component hierarchy starting from this + * component up to the nearest validate root. Afterwards, the component + * hierarchy is validated starting from the nearest validate root. + *

    + * This is a convenience method supposed to help application developers + * avoid looking for validate roots manually. Basically, it's equivalent to + * first calling the {@link #invalidate()} method on this component, and + * then calling the {@link #validate()} method on the nearest validate + * root. + * + * @see Container#isValidateRoot + * @since 1.7 + */ + public void revalidate() { + synchronized (getTreeLock()) { + invalidate(); + + Container root = getContainer(); + if (root == null) { + // There's no parents. Just validate itself. + validate(); + } else { + while (!root.isValidateRoot()) { + if (root.getContainer() == null) { + // If there's no validate roots, we'll validate the + // topmost container + break; + } + + root = root.getContainer(); + } + + root.validate(); + } + } + } + /** * Creates a graphics context for this component. This method will * return null if this component is currently not diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java index 42c88e02823..70b0bffaac7 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java @@ -154,7 +154,7 @@ public class BasicSplitPaneDivider extends Container setBackground(UIManager.getColor("SplitPane.background")); } - private void revalidate() { + private void revalidateSplitPane() { invalidate(); if (splitPane != null) { splitPane.revalidate(); @@ -315,7 +315,7 @@ public class BasicSplitPaneDivider extends Container setCursor((orientation == JSplitPane.HORIZONTAL_SPLIT) ? Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR) : Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR)); - revalidate(); + revalidateSplitPane(); } else if (e.getPropertyName() == JSplitPane. ONE_TOUCH_EXPANDABLE_PROPERTY) { @@ -376,7 +376,7 @@ public class BasicSplitPaneDivider extends Container add(rightButton); } } - revalidate(); + revalidateSplitPane(); } diff --git a/jdk/test/java/awt/Component/Revalidate/Revalidate.java b/jdk/test/java/awt/Component/Revalidate/Revalidate.java new file mode 100644 index 00000000000..670c374f87d --- /dev/null +++ b/jdk/test/java/awt/Component/Revalidate/Revalidate.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 7036669 + @summary Test Component.revalidate() method + @author anthony.petrov@oracle.com: area=awt.component + @run main Revalidate +*/ + +import java.awt.*; + +public class Revalidate { + private static Frame frame = new Frame(); + private static Panel panel = new Panel() { + @Override + public boolean isValidateRoot() { + return true; + } + }; + private static Button button = new Button("Test"); + + private static void sleep() { + try { Thread.sleep(500); } catch (Exception e) {} + } + + private static void printState(String str) { + System.out.println(str + " isValid state: "); + System.out.println(" frame: " + frame.isValid()); + System.out.println(" panel: " + panel.isValid()); + System.out.println(" button: " + button.isValid()); + } + + private static void fail(String msg) { + frame.dispose(); + throw new RuntimeException(msg); + } + + private static void check(String n, Component c, boolean v) { + if (c.isValid() != v) { + fail(n + ".isValid() = " + c.isValid() + "; expected: " + v); + } + } + private static void check(String str, boolean f, boolean p, boolean b) { + printState(str); + + check("frame", frame, f); + check("panel", panel, p); + check("button", button, b); + } + + public static void main(String[] args) { + // setup + frame.add(panel); + panel.add(button); + frame.setBounds(200, 200, 300, 200); + frame.setVisible(true); + sleep(); + check("Upon showing", true, true, true); + + button.setBounds(1, 1, 30, 30); + sleep(); + check("button.setBounds():", true, false, false); + + button.revalidate(); + sleep(); + check("button.revalidate():", true, true, true); + + button.setBounds(1, 1, 30, 30); + sleep(); + check("button.setBounds():", true, false, false); + + panel.revalidate(); + sleep(); + // because the panel's validate root is actually OK + check("panel.revalidate():", true, false, false); + + button.revalidate(); + sleep(); + check("button.revalidate():", true, true, true); + + panel.setBounds(2, 2, 125, 130); + sleep(); + check("panel.setBounds():", false, false, true); + + button.revalidate(); + sleep(); + check("button.revalidate():", false, true, true); + + panel.setBounds(3, 3, 152, 121); + sleep(); + check("panel.setBounds():", false, false, true); + + panel.revalidate(); + sleep(); + check("panel.revalidate():", true, true, true); + + // cleanup + frame.dispose(); + } +} From d097a2cab142e19c36b1d8c4ca5455eb125ba719 Mon Sep 17 00:00:00 2001 From: Andrei Dmitriev Date: Tue, 19 Apr 2011 18:52:49 +0400 Subject: [PATCH 007/117] 7036733: Regression : NullPointerException when scrolling horizontally on AWT List Reviewed-by: dcherepanov --- .../classes/sun/awt/X11/XListPeer.java | 5 +- .../awt/List/ScrollOutside/ScrollOut.java | 84 +++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 jdk/test/java/awt/List/ScrollOutside/ScrollOut.java diff --git a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java index c8799a1ad07..838899e49b8 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java @@ -1479,16 +1479,19 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { int h = height - (SCROLLBAR_AREA + (2 * MARGIN)); hsb.setValue(hsb.getValue() + x); + int options = PAINT_ITEMS | PAINT_HSCROLL; + Rectangle source = null; Point distance = null; if (x < 0) { source = new Rectangle(MARGIN + SPACE, MARGIN, w + x, h); distance = new Point(-x, 0); + options |= COPY_AREA; } else if (x > 0) { source = new Rectangle(MARGIN + SPACE + x, MARGIN, w - x, h); distance = new Point(-x, 0); + options |= COPY_AREA; } - int options = COPY_AREA | PAINT_ITEMS | PAINT_HSCROLL; repaint(vsb.getValue(), lastItemDisplayed(), options, source, distance); } diff --git a/jdk/test/java/awt/List/ScrollOutside/ScrollOut.java b/jdk/test/java/awt/List/ScrollOutside/ScrollOut.java new file mode 100644 index 00000000000..21b8f848229 --- /dev/null +++ b/jdk/test/java/awt/List/ScrollOutside/ScrollOut.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * 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 7036733 + @summary Regression : NullPointerException when scrolling horizontally on AWT List + @author Andrei Dmitriev area=awt-list + @library ../../regtesthelpers + @build Util + @run main ScrollOut +*/ + +import java.awt.*; +import java.awt.event.*; +import sun.awt.SunToolkit; +import test.java.awt.regtesthelpers.Util; + +public class ScrollOut +{ + public static final void main(String args[]) + { + final Frame frame = new Frame(); + final List list = new List(); + Robot robot = null; + + for (int i = 0; i < 5; i++){ + list.add("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); + } + + frame.add(list); + + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + + ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + + try{ + robot = new Robot(); + }catch(AWTException e){ + throw new RuntimeException(e); + } + + //Drag from center to the outside on left + Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2, + list.getLocationOnScreen().y + list.getHeight()/2); + Point to = new Point(list.getLocationOnScreen().x - 30, + from.y); + + ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + Util.drag(robot, from, to, InputEvent.BUTTON1_MASK); + + ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + + //Drag from center to the outside on up + to = new Point(from.x, + list.getLocationOnScreen().y - 50); + + ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + Util.drag(robot, from, to, InputEvent.BUTTON1_MASK); + + }//End init() +} From e8d2ed978ffa48cba68457642727d708cd390a69 Mon Sep 17 00:00:00 2001 From: Tom Deneau Date: Tue, 19 Apr 2011 09:30:17 -0700 Subject: [PATCH 008/117] 7037812: few more defaults changes for new AMD processors Use PREFETCHW as default prefetch instruction, set UseXMMForArrayCopy and UseUnalignedLoadStores to true by default. Reviewed-by: kvn --- hotspot/src/cpu/x86/vm/vm_version_x86.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp index 87982e9ab04..fb81bf3d475 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp @@ -441,12 +441,25 @@ void VM_Version::get_processor_features() { } } - // On family 21 processors default is no sw prefetch - if ( cpu_family() == 21 ) { + // some defaults for AMD family 15h + if ( cpu_family() == 0x15 ) { + // On family 15h processors default is no sw prefetch if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) { AllocatePrefetchStyle = 0; } + // Also, if some other prefetch style is specified, default instruction type is PREFETCHW + if (FLAG_IS_DEFAULT(AllocatePrefetchInstr)) { + AllocatePrefetchInstr = 3; + } + // On family 15h processors use XMM and UnalignedLoadStores for Array Copy + if( FLAG_IS_DEFAULT(UseXMMForArrayCopy) ) { + UseXMMForArrayCopy = true; + } + if( FLAG_IS_DEFAULT(UseUnalignedLoadStores) && UseXMMForArrayCopy ) { + UseUnalignedLoadStores = true; + } } + } if( is_intel() ) { // Intel cpus specific settings From 21a2cb6922e271ea395936f683de6bd5ab8855cc Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Tue, 19 Apr 2011 10:47:33 -0700 Subject: [PATCH 009/117] 7030579: Extra words in documentation of ListIterator may cause confusion Reviewed-by: dholmes, alanb --- jdk/src/share/classes/java/util/ListIterator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/java/util/ListIterator.java b/jdk/src/share/classes/java/util/ListIterator.java index cad6d9bae2f..92859173a56 100644 --- a/jdk/src/share/classes/java/util/ListIterator.java +++ b/jdk/src/share/classes/java/util/ListIterator.java @@ -173,9 +173,9 @@ public interface ListIterator extends Iterator { /** * Inserts the specified element into the list (optional operation). - * The element is inserted immediately before the next element that - * would be returned by {@link #next}, if any, and after the next - * element that would be returned by {@link #previous}, if any. (If the + * The element is inserted immediately before the element that + * would be returned by {@link #next}, if any, and after the element + * that would be returned by {@link #previous}, if any. (If the * list contains no elements, the new element becomes the sole element * on the list.) The new element is inserted before the implicit * cursor: a subsequent call to {@code next} would be unaffected, and a From 12d1d9acc1d4f2c3cf5addbdd21f5f7c0cdcf05a Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Tue, 19 Apr 2011 15:46:59 -0400 Subject: [PATCH 010/117] 7011855: G1: non-product flag to artificially grow the heap It introduces non-product cmd line parameter G1DummyRegionsPerGC which indicates how many "dummy" regions to allocate at the end of each GC. This allows the G1 heap to grow artificially and makes concurrent marking cycles more frequent irrespective of what the application that is running is doing. The dummy regions will be found totally empty during cleanup so this parameter can also be used to stress the concurrent cleanup operation. Reviewed-by: brutisso, johnc --- .../gc_implementation/g1/g1CollectedHeap.cpp | 24 +++++++++++++++++++ .../gc_implementation/g1/g1CollectedHeap.hpp | 8 +++++++ .../vm/gc_implementation/g1/g1_globals.hpp | 5 ++++ 3 files changed, 37 insertions(+) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 1c2b116a5ba..becc9451265 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2113,6 +2113,28 @@ bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) { (cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent)); } +#ifndef PRODUCT +void G1CollectedHeap::allocate_dummy_regions() { + // Let's fill up most of the region + size_t word_size = HeapRegion::GrainWords - 1024; + // And as a result the region we'll allocate will be humongous. + guarantee(isHumongous(word_size), "sanity"); + + for (uintx i = 0; i < G1DummyRegionsPerGC; ++i) { + // Let's use the existing mechanism for the allocation + HeapWord* dummy_obj = humongous_obj_allocate(word_size); + if (dummy_obj != NULL) { + MemRegion mr(dummy_obj, word_size); + CollectedHeap::fill_with_object(mr); + } else { + // If we can't allocate once, we probably cannot allocate + // again. Let's get out of the loop. + break; + } + } +} +#endif // !PRODUCT + void G1CollectedHeap::increment_full_collections_completed(bool concurrent) { MonitorLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag); @@ -3338,6 +3360,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { doConcurrentMark(); } + allocate_dummy_regions(); + #if YOUNG_LIST_VERBOSE gclog_or_tty->print_cr("\nEnd of the pause.\nYoung_list:"); _young_list->print(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index a9412774486..1b7e6a307bc 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -298,6 +298,14 @@ private: // started is maintained in _total_full_collections in CollectedHeap. volatile unsigned int _full_collections_completed; + // This is a non-product method that is helpful for testing. It is + // called at the end of a GC and artificially expands the heap by + // allocating a number of dead regions. This way we can induce very + // frequent marking cycles and stress the cleanup / concurrent + // cleanup code more (as all the regions that will be allocated by + // this method will be found dead by the marking cycle). + void allocate_dummy_regions() PRODUCT_RETURN; + // These are macros so that, if the assert fires, we get the correct // line number, file, etc. diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp index 5fd535533e1..cea90240141 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp @@ -300,6 +300,11 @@ develop(uintx, G1StressConcRegionFreeingDelayMillis, 0, \ "Artificial delay during concurrent region freeing") \ \ + develop(uintx, G1DummyRegionsPerGC, 0, \ + "The number of dummy regions G1 will allocate at the end of " \ + "each evacuation pause in order to artificially fill up the " \ + "heap and stress the marking implementation.") \ + \ develop(bool, ReduceInitialCardMarksForG1, false, \ "When ReduceInitialCardMarks is true, this flag setting " \ " controls whether G1 allows the RICM optimization") \ From 68d5cd6f233d0215e498fce5cec57f1b68ba2f95 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 20 Apr 2011 18:41:32 +0800 Subject: [PATCH 011/117] 6894072: always refresh keytab Reviewed-by: valeriep --- .../security/auth/module/Krb5LoginModule.java | 131 ++++++---- .../JavaxSecurityAuthKerberosAccessImpl.java | 38 +++ .../security/auth/kerberos/KerberosKey.java | 10 +- .../javax/security/auth/kerberos/KeyTab.java | 230 ++++++++++++++++++ .../misc/JavaxSecurityAuthKerberosAccess.java | 43 ++++ .../share/classes/sun/misc/SharedSecrets.java | 14 ++ .../jgss/krb5/Krb5AcceptCredential.java | 55 ++--- .../sun/security/jgss/krb5/Krb5Util.java | 193 ++++++++++++--- .../sun/security/jgss/krb5/SubjectComber.java | 73 +++--- .../classes/sun/security/krb5/Config.java | 1 - .../sun/security/krb5/EncryptionKey.java | 10 +- .../classes/sun/security/krb5/KrbAsRep.java | 37 +-- .../sun/security/krb5/KrbAsReqBuilder.java | 92 +++---- .../security/krb5/internal/ktab/KeyTab.java | 225 +++++++++-------- .../sun/security/ssl/ServerHandshaker.java | 11 +- .../sun/security/ssl/krb5/Krb5ProxyImpl.java | 6 +- .../security/krb5/internal/tools/Kinit.java | 20 +- .../security/krb5/internal/tools/Klist.java | 20 +- .../security/krb5/internal/tools/Ktab.java | 4 +- jdk/test/sun/security/krb5/auto/Context.java | 38 ++- .../sun/security/krb5/auto/DynamicKeytab.java | 140 +++++++++++ jdk/test/sun/security/krb5/auto/KDC.java | 56 ++++- .../sun/security/krb5/auto/KeyTabCompat.java | 90 +++++++ .../krb5/auto/LoginModuleOptions.java | 4 +- jdk/test/sun/security/krb5/auto/SSL.java | 60 ++++- .../sun/security/krb5/auto/TwoPrinces.java | 102 ++++++++ .../sun/security/krb5/ktab/KeyTabIndex.java | 3 +- 27 files changed, 1334 insertions(+), 372 deletions(-) create mode 100644 jdk/src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java create mode 100644 jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java create mode 100644 jdk/src/share/classes/sun/misc/JavaxSecurityAuthKerberosAccess.java create mode 100644 jdk/test/sun/security/krb5/auto/DynamicKeytab.java create mode 100644 jdk/test/sun/security/krb5/auto/KeyTabCompat.java create mode 100644 jdk/test/sun/security/krb5/auto/TwoPrinces.java diff --git a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java index c9499f1d1a0..5da153d72ea 100644 --- a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java +++ b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -395,7 +395,13 @@ public class Krb5LoginModule implements LoginModule { private boolean succeeded = false; private boolean commitSucceeded = false; private String username; + + // Encryption keys calculated from password. Assigned when storekey == true + // and useKeyTab == false (or true but not found) private EncryptionKey[] encKeys = null; + + KeyTab ktab = null; + private Credentials cred = null; private PrincipalName principal = null; @@ -663,28 +669,49 @@ public class Krb5LoginModule implements LoginModule { (krb5PrincName.toString(), PrincipalName.KRB_NT_PRINCIPAL); } + + /* + * Before dynamic KeyTab support (6894072), here we check if + * the keytab contains keys for the principal. If no, keytab + * will not be used and password is prompted for. + * + * After 6894072, we normally don't check it, and expect the + * keys can be populated until a real connection is made. The + * check is still done when isInitiator == true, where the keys + * will be used right now. + * + * Probably tricky relations: + * + * useKeyTab is config flag, but when it's true but the ktab + * does not contains keys for principal, we would use password + * and keep the flag unchanged (for reuse?). In this method, + * we use (ktab != null) to check whether keytab is used. + * After this method (and when storeKey == true), we use + * (encKeys == null) to check. + */ if (useKeyTab) { - encKeys = - EncryptionKey.acquireSecretKeys(principal, keyTabName); - - if (debug) { - if (encKeys != null) - System.out.println - ("principal's key obtained from the keytab"); - else - System.out.println - ("Key for the principal " + - principal + - " not available in " + - ((keyTabName == null) ? - "default key tab" : keyTabName)); + ktab = (keyTabName == null) + ? KeyTab.getInstance() + : KeyTab.getInstance(new File(keyTabName)); + if (isInitiator) { + if (Krb5Util.keysFromJavaxKeyTab(ktab, principal).length + == 0) { + ktab = null; + if (debug) { + System.out.println + ("Key for the principal " + + principal + + " not available in " + + ((keyTabName == null) ? + "default key tab" : keyTabName)); + } + } } - } KrbAsReqBuilder builder; - // We can't get the key from the keytab so prompt - if (encKeys == null) { + + if (ktab == null) { promptForPass(getPasswdFromSharedState); builder = new KrbAsReqBuilder(principal, password); if (isInitiator) { @@ -693,9 +720,13 @@ public class Krb5LoginModule implements LoginModule { // updated with PA info cred = builder.action().getCreds(); } - encKeys = builder.getKeys(); + if (storeKey) { + encKeys = builder.getKeys(); + // When encKeys is empty, the login actually fails. + // For compatibility, exception is thrown in commit(). + } } else { - builder = new KrbAsReqBuilder(principal, encKeys); + builder = new KrbAsReqBuilder(principal, ktab); if (isInitiator) { cred = builder.action().getCreds(); } @@ -705,10 +736,15 @@ public class Krb5LoginModule implements LoginModule { if (debug) { System.out.println("principal is " + principal); HexDumpEncoder hd = new HexDumpEncoder(); - for (int i = 0; i < encKeys.length; i++) { - System.out.println("EncryptionKey: keyType=" + - encKeys[i].getEType() + " keyBytes (hex dump)=" + - hd.encodeBuffer(encKeys[i].getBytes())); + if (ktab != null) { + System.out.println("Will use keytab"); + } else if (storeKey) { + for (int i = 0; i < encKeys.length; i++) { + System.out.println("EncryptionKey: keyType=" + + encKeys[i].getEType() + + " keyBytes (hex dump)=" + + hd.encodeBuffer(encKeys[i].getBytes())); + } } } @@ -989,8 +1025,8 @@ public class Krb5LoginModule implements LoginModule { kerbTicket = Krb5Util.credsToTicket(cred); } - if (storeKey) { - if (encKeys == null || encKeys.length <= 0) { + if (storeKey && encKeys != null) { + if (encKeys.length == 0) { succeeded = false; throw new LoginException("Null Server Key "); } @@ -1006,10 +1042,11 @@ public class Krb5LoginModule implements LoginModule { } } - // Let us add the kerbClientPrinc,kerbTicket and kerbKey (if + // Let us add the kerbClientPrinc,kerbTicket and KeyTab/KerbKey (if // storeKey is true) - if (!princSet.contains(kerbClientPrinc)) + if (!princSet.contains(kerbClientPrinc)) { princSet.add(kerbClientPrinc); + } // add the TGT if (kerbTicket != null) { @@ -1018,19 +1055,29 @@ public class Krb5LoginModule implements LoginModule { } if (storeKey) { - for (int i = 0; i < kerbKeys.length; i++) { - if (!privCredSet.contains(kerbKeys[i])) { - privCredSet.add(kerbKeys[i]); + if (encKeys == null) { + if (!privCredSet.contains(ktab)) { + privCredSet.add(ktab); + // Compatibility; also add keys to privCredSet + for (KerberosKey key: ktab.getKeys(kerbClientPrinc)) { + privCredSet.add(new Krb5Util.KeysFromKeyTab(key)); + } } - encKeys[i].destroy(); - encKeys[i] = null; - if (debug) { - System.out.println("Added server's key" - + kerbKeys[i]); - System.out.println("\t\t[Krb5LoginModule] " + - "added Krb5Principal " + - kerbClientPrinc.toString() - + " to Subject"); + } else { + for (int i = 0; i < kerbKeys.length; i ++) { + if (!privCredSet.contains(kerbKeys[i])) { + privCredSet.add(kerbKeys[i]); + } + encKeys[i].destroy(); + encKeys[i] = null; + if (debug) { + System.out.println("Added server's key" + + kerbKeys[i]); + System.out.println("\t\t[Krb5LoginModule] " + + "added Krb5Principal " + + kerbClientPrinc.toString() + + " to Subject"); + } } } } @@ -1106,7 +1153,8 @@ public class Krb5LoginModule implements LoginModule { while (it.hasNext()) { Object o = it.next(); if (o instanceof KerberosTicket || - o instanceof KerberosKey) { + o instanceof KerberosKey || + o instanceof KeyTab) { it.remove(); } } @@ -1161,6 +1209,7 @@ public class Krb5LoginModule implements LoginModule { } else { // remove temp results for the next try encKeys = null; + ktab = null; principal = null; } username = null; diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java b/jdk/src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java new file mode 100644 index 00000000000..56ed40eed3e --- /dev/null +++ b/jdk/src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.security.auth.kerberos; + +import sun.misc.JavaxSecurityAuthKerberosAccess; +import sun.security.krb5.EncryptionKey; +import sun.security.krb5.PrincipalName; + +class JavaxSecurityAuthKerberosAccessImpl + implements JavaxSecurityAuthKerberosAccess { + public EncryptionKey[] keyTabGetEncryptionKeys( + KeyTab ktab, PrincipalName principal) { + return ktab.getEncryptionKeys(principal); + } +} diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java index 7eb7118a5bc..ba530f9583c 100644 --- a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java +++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,14 +35,16 @@ import javax.security.auth.DestroyFailedException; * principal.

    * * All Kerberos JAAS login modules that obtain a principal's password and - * generate the secret key from it should use this class. Where available, - * the login module might even read this secret key directly from a - * Kerberos "keytab". Sometimes, such as when authenticating a server in + * generate the secret key from it should use this class. + * Sometimes, such as when authenticating a server in * the absence of user-to-user authentication, the login module will store * an instance of this class in the private credential set of a * {@link javax.security.auth.Subject Subject} during the commit phase of the * authentication process.

    * + * A Kerberos service using a keytab to read secret keys should use + * the {@link KeyTab} class, where latest keys can be read when needed.

    + * * It might be necessary for the application to be granted a * {@link javax.security.auth.PrivateCredentialPermission * PrivateCredentialPermission} if it needs to access the KerberosKey diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java b/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java new file mode 100644 index 00000000000..c2f8dd79478 --- /dev/null +++ b/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java @@ -0,0 +1,230 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.security.auth.kerberos; + +import java.io.File; +import java.util.Objects; +import sun.misc.SharedSecrets; +import sun.security.krb5.EncryptionKey; +import sun.security.krb5.PrincipalName; +import sun.security.krb5.RealmException; + +/** + * This class encapsulates a keytab file. + *

    + * A Kerberos JAAS login module that obtains long term secret keys from a + * keytab file should use this class. The login module will store + * an instance of this class in the private credential set of a + * {@link javax.security.auth.Subject Subject} during the commit phase of the + * authentication process. + *

    + * It might be necessary for the application to be granted a + * {@link javax.security.auth.PrivateCredentialPermission + * PrivateCredentialPermission} if it needs to access the KeyTab + * instance from a Subject. This permission is not needed when the + * application depends on the default JGSS Kerberos mechanism to access the + * KeyTab. In that case, however, the application will need an appropriate + * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}. + *

    + * The keytab file format is described at + * + * http://www.ioplex.com/utilities/keytab.txt. + * + * @since 1.7 + */ +public final class KeyTab { + + /* + * Impl notes: + * + * This class is only a name, a permanent link to the keytab source + * (can be missing). Itself has no content. In order to read content, + * take a snapshot and read from it. + * + * The snapshot is of type sun.security.krb5.internal.ktab.KeyTab, which + * contains the content of the keytab file when the snapshot is taken. + * Itself has no refresh function and mostly an immutable class (except + * for the create/add/save methods only used by the ktab command). + */ + + // Source, null if using the default one. Note that the default name + // is maintained in snapshot, this field is never "resolved". + private final File file; + + // Set up JavaxSecurityAuthKerberosAccess in SharedSecrets + static { + SharedSecrets.setJavaxSecurityAuthKerberosAccess( + new JavaxSecurityAuthKerberosAccessImpl()); + } + + private KeyTab(File file) { + this.file = file; + } + + /** + * Returns a {@code KeyTab} instance from a {@code File} object. + *

    + * The result of this method is never null. This method only associates + * the returned {@code KeyTab} object with the file and does not read it. + * @param file the keytab {@code File} object, must not be null + * @return the keytab instance + * @throws NullPointerException if the {@code file} argument is null + */ + public static KeyTab getInstance(File file) { + if (file == null) { + throw new NullPointerException("file must be non null"); + } + return new KeyTab(file); + } + + /** + * Returns the default {@code KeyTab} instance. + *

    + * The result of this method is never null. This method only associates + * the returned {@code KeyTab} object with the default keytab file and + * does not read it. + * @return the default keytab instance. + */ + public static KeyTab getInstance() { + return new KeyTab(null); + } + + //Takes a snapshot of the keytab content + private sun.security.krb5.internal.ktab.KeyTab takeSnapshot() { + return sun.security.krb5.internal.ktab.KeyTab.getInstance(file); + } + + /** + * Returns fresh keys for the given Kerberos principal. + *

    + * Implementation of this method should make sure the returned keys match + * the latest content of the keytab file. The result is a newly created + * copy that can be modified by the caller without modifying the keytab + * object. The caller should {@link KerberosKey#destroy() destroy} the + * result keys after they are used. + *

    + * Please note that the keytab file can be created after the + * {@code KeyTab} object is instantiated and its content may change over + * time. Therefore, an application should call this method only when it + * needs to use the keys. Any previous result from an earlier invocation + * could potentially be expired. + *

    + * If there is any error (say, I/O error or format error) + * during the reading process of the KeyTab file, a saved result should be + * returned. If there is no saved result (say, this is the first time this + * method is called, or, all previous read attempts failed), an empty array + * should be returned. This can make sure the result is not drastically + * changed during the (probably slow) update of the keytab file. + *

    + * Each time this method is called and the reading of the file succeeds + * with no exception (say, I/O error or file format error), + * the result should be saved for {@code principal}. The implementation can + * also save keys for other principals having keys in the same keytab object + * if convenient. + *

    + * Any unsupported key read from the keytab is ignored and not included + * in the result. + * + * @param principal the Kerberos principal, must not be null. + * @return the keys (never null, may be empty) + * @throws NullPointerException if the {@code principal} + * argument is null + * @throws SecurityException if a security manager exists and the read + * access to the keytab file is not permitted + */ + public KerberosKey[] getKeys(KerberosPrincipal principal) { + try { + EncryptionKey[] keys = takeSnapshot().readServiceKeys( + new PrincipalName(principal.getName())); + KerberosKey[] kks = new KerberosKey[keys.length]; + for (int i=0; i + * The caller can use the result to determine if it should fallback to + * another mechanism to read the keys. + * @return true if the keytab file exists; false otherwise. + * @throws SecurityException if a security manager exists and the read + * access to the keytab file is not permitted + */ + public boolean exists() { + return !takeSnapshot().isMissing(); + } + + public String toString() { + return file == null ? "Default keytab" : file.toString(); + } + + /** + * Returns a hashcode for this KeyTab. + * + * @return a hashCode() for the KeyTab + */ + public int hashCode() { + return Objects.hash(file); + } + + /** + * Compares the specified Object with this KeyTab for equality. + * Returns true if the given object is also a + * KeyTab and the two + * KeyTab instances are equivalent. + * + * @param other the Object to compare to + * @return true if the specified object is equal to this KeyTab + */ + public boolean equals(Object other) { + if (other == this) + return true; + + if (! (other instanceof KeyTab)) { + return false; + } + + KeyTab otherKtab = (KeyTab) other; + return Objects.equals(otherKtab.file, file); + } +} diff --git a/jdk/src/share/classes/sun/misc/JavaxSecurityAuthKerberosAccess.java b/jdk/src/share/classes/sun/misc/JavaxSecurityAuthKerberosAccess.java new file mode 100644 index 00000000000..9c8f9f2d3d2 --- /dev/null +++ b/jdk/src/share/classes/sun/misc/JavaxSecurityAuthKerberosAccess.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.misc; + +import javax.security.auth.kerberos.KeyTab; +import sun.security.krb5.EncryptionKey; +import sun.security.krb5.PrincipalName; + +/** + * An unsafe tunnel to get non-public access to classes in the + * javax.security.auth.kerberos package. + */ +public interface JavaxSecurityAuthKerberosAccess { + /** + * Returns keys for a principal in a keytab. + * @return the keys, never null, can be empty. + */ + public EncryptionKey[] keyTabGetEncryptionKeys( + KeyTab ktab, PrincipalName principal); +} diff --git a/jdk/src/share/classes/sun/misc/SharedSecrets.java b/jdk/src/share/classes/sun/misc/SharedSecrets.java index 0bd39b4a5d4..969da9a744f 100644 --- a/jdk/src/share/classes/sun/misc/SharedSecrets.java +++ b/jdk/src/share/classes/sun/misc/SharedSecrets.java @@ -29,6 +29,7 @@ import java.util.jar.JarFile; import java.io.Console; import java.io.FileDescriptor; import java.security.ProtectionDomain; +import javax.security.auth.kerberos.KeyTab; import java.security.AccessController; @@ -51,6 +52,7 @@ public class SharedSecrets { private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess; private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess; private static JavaSecurityAccess javaSecurityAccess; + private static JavaxSecurityAuthKerberosAccess javaxSecurityAuthKerberosAccess; public static JavaUtilJarAccess javaUtilJarAccess() { if (javaUtilJarAccess == null) { @@ -139,4 +141,16 @@ public class SharedSecrets { } return javaSecurityAccess; } + + public static void setJavaxSecurityAuthKerberosAccess + (JavaxSecurityAuthKerberosAccess jsaka) { + javaxSecurityAuthKerberosAccess = jsaka; + } + + public static JavaxSecurityAuthKerberosAccess + getJavaxSecurityAuthKerberosAccess() { + if (javaxSecurityAuthKerberosAccess == null) + unsafe.ensureClassInitialized(KeyTab.class); + return javaxSecurityAuthKerberosAccess; + } } diff --git a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5AcceptCredential.java b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5AcceptCredential.java index 7a7156d9b1c..1df500bc524 100644 --- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5AcceptCredential.java +++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5AcceptCredential.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ import org.ietf.jgss.*; import sun.security.jgss.GSSCaller; import sun.security.jgss.spi.*; import sun.security.krb5.*; -import javax.security.auth.kerberos.*; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.security.AccessController; @@ -43,40 +42,23 @@ import javax.security.auth.DestroyFailedException; * @since 1.4 */ public class Krb5AcceptCredential - extends KerberosKey implements Krb5CredElement { private static final long serialVersionUID = 7714332137352567952L; private Krb5NameElement name; - /** - * We cache an EncryptionKey representation of this key because many - * Krb5 operation require a key in that form. At some point we might do - * away with EncryptionKey altogether and use the base class - * KerberosKey everywhere. - */ - private EncryptionKey[] krb5EncryptionKeys; + private Krb5Util.ServiceCreds screds; - private Krb5AcceptCredential(Krb5NameElement name, KerberosKey[] keys) { + private Krb5AcceptCredential(Krb5NameElement name, Krb5Util.ServiceCreds creds) { /* * Initialize this instance with the data from the acquired * KerberosKey. This class needs to be a KerberosKey too * hence we can't just store a reference. */ - super(keys[0].getPrincipal(), - keys[0].getEncoded(), - keys[0].getKeyType(), - keys[0].getVersionNumber()); this.name = name; - // Cache this for later use by the sun.security.krb5 package. - krb5EncryptionKeys = new EncryptionKey[keys.length]; - for (int i = 0; i < keys.length; i++) { - krb5EncryptionKeys[i] = new EncryptionKey(keys[i].getEncoded(), - keys[i].getKeyType(), - new Integer(keys[i].getVersionNumber())); - } + this.screds = creds; } static Krb5AcceptCredential getInstance(final GSSCaller caller, Krb5NameElement name) @@ -86,12 +68,12 @@ public class Krb5AcceptCredential name.getKrb5PrincipalName().getName()); final AccessControlContext acc = AccessController.getContext(); - KerberosKey[] keys; + Krb5Util.ServiceCreds creds = null; try { - keys = AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public KerberosKey[] run() throws Exception { - return Krb5Util.getKeys( + creds = AccessController.doPrivileged( + new PrivilegedExceptionAction() { + public Krb5Util.ServiceCreds run() throws Exception { + return Krb5Util.getServiceCreds( caller == GSSCaller.CALLER_UNKNOWN ? GSSCaller.CALLER_ACCEPT: caller, serverPrinc, acc); }}); @@ -103,17 +85,17 @@ public class Krb5AcceptCredential throw ge; } - if (keys == null || keys.length == 0) + if (creds == null) throw new GSSException(GSSException.NO_CRED, -1, - "Failed to find any Kerberos Key"); + "Failed to find any Kerberos credentails"); if (name == null) { - String fullName = keys[0].getPrincipal().getName(); + String fullName = creds.getName(); name = Krb5NameElement.getInstance(fullName, Krb5MechFactory.NT_GSS_KRB5_PRINCIPAL); } - return new Krb5AcceptCredential(name, keys); + return new Krb5AcceptCredential(name, creds); } /** @@ -171,7 +153,7 @@ public class Krb5AcceptCredential } EncryptionKey[] getKrb5EncryptionKeys() { - return krb5EncryptionKeys; + return screds.getEKeys(); } /** @@ -193,13 +175,6 @@ public class Krb5AcceptCredential * destroy in the base class. */ public void destroy() throws DestroyFailedException { - if (krb5EncryptionKeys != null) { - for (int i = 0; i < krb5EncryptionKeys.length; i++) { - krb5EncryptionKeys[i].destroy(); - } - krb5EncryptionKeys = null; - } - - super.destroy(); + screds.destroy(); } } diff --git a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java index d5b172f9249..22552a71c3f 100644 --- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java +++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ package sun.security.jgss.krb5; import javax.security.auth.kerberos.KerberosTicket; import javax.security.auth.kerberos.KerberosKey; import javax.security.auth.kerberos.KerberosPrincipal; +import javax.security.auth.kerberos.KeyTab; import javax.security.auth.Subject; import javax.security.auth.login.LoginException; import java.security.AccessControlContext; @@ -38,7 +39,13 @@ import sun.security.krb5.Credentials; import sun.security.krb5.EncryptionKey; import sun.security.krb5.KrbException; import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; +import java.util.Objects; +import java.util.Set; +import sun.misc.SharedSecrets; +import sun.security.krb5.PrincipalName; /** * Utilities for obtaining and converting Kerberos tickets. * @@ -75,7 +82,7 @@ public class Krb5Util { // 1. Try to find service ticket in acc subject Subject accSubj = Subject.getSubject(acc); - KerberosTicket ticket = (KerberosTicket) SubjectComber.find(accSubj, + KerberosTicket ticket = SubjectComber.find(accSubj, serverPrincipal, clientPrincipal, KerberosTicket.class); if (ticket != null) { @@ -87,7 +94,7 @@ public class Krb5Util { // 2. Try to get ticket from login try { loginSubj = GSSUtil.login(caller, GSSUtil.GSS_KRB5_MECH_OID); - ticket = (KerberosTicket) SubjectComber.find(loginSubj, + ticket = SubjectComber.find(loginSubj, serverPrincipal, clientPrincipal, KerberosTicket.class); if (ticket != null) { return ticket; // found it @@ -102,13 +109,13 @@ public class Krb5Util { // Try to get TGT to acquire service ticket // 3. Try to get TGT from acc subject - KerberosTicket tgt = (KerberosTicket) SubjectComber.find(accSubj, + KerberosTicket tgt = SubjectComber.find(accSubj, tgsPrincipal, clientPrincipal, KerberosTicket.class); boolean fromAcc; if (tgt == null && loginSubj != null) { // 4. Try to get TGT from login subject - tgt = (KerberosTicket) SubjectComber.find(loginSubj, + tgt = SubjectComber.find(loginSubj, tgsPrincipal, clientPrincipal, KerberosTicket.class); fromAcc = false; } else { @@ -145,14 +152,14 @@ public class Krb5Util { // Try to get ticket from acc's Subject Subject accSubj = Subject.getSubject(acc); - KerberosTicket ticket = (KerberosTicket) + KerberosTicket ticket = SubjectComber.find(accSubj, serverPrincipal, clientPrincipal, KerberosTicket.class); // Try to get ticket from Subject obtained from GSSUtil if (ticket == null && !GSSUtil.useSubjectCredsOnly(caller)) { Subject subject = GSSUtil.login(caller, GSSUtil.GSS_KRB5_MECH_OID); - ticket = (KerberosTicket) SubjectComber.find(subject, + ticket = SubjectComber.find(subject, serverPrincipal, clientPrincipal, KerberosTicket.class); } return ticket; @@ -182,37 +189,152 @@ public class Krb5Util { return subject; } + // A special KerberosKey, used as keys read from a KeyTab object. + // Each time new keys are read from KeyTab objects in the private + // credentials set, old ones are removed and new ones added. + public static class KeysFromKeyTab extends KerberosKey { + public KeysFromKeyTab(KerberosKey key) { + super(key.getPrincipal(), key.getEncoded(), + key.getKeyType(), key.getVersionNumber()); + } + } + /** - * Retrieves the keys for the specified server principal from - * the Subject in the specified AccessControlContext. - * If the ticket can not be found in the Subject, and if - * useSubjectCredsOnly is false, then obtain keys from - * a LoginContext. + * Credentials of a service, the private secret to authenticate its + * identity, which can be: + * 1. Some KerberosKeys (generated from password) + * 2. A KeyTab (for a typical service) + * 3. A TGT (for a user2user service. Not supported yet) * - * NOTE: This method is used by JSSE Kerberos Cipher Suites + * Note that some creds can coexist. For example, a user2user service + * can use its keytab (or keys) if the client can successfully obtain a + * normal service ticket, otherwise, it can uses the TGT (actually, the + * session key of the TGT) if the client can only acquire a service ticket + * of ENC-TKT-IN-SKEY style. */ - public static KerberosKey[] getKeys(GSSCaller caller, + public static class ServiceCreds { + private KerberosPrincipal kp; + private List ktabs; + private List kk; + private Subject subj; + //private KerberosTicket tgt; // user2user, not supported yet + + private static ServiceCreds getInstance( + Subject subj, String serverPrincipal) { + + ServiceCreds sc = new ServiceCreds(); + sc.subj = subj; + + for (KerberosPrincipal p: subj.getPrincipals(KerberosPrincipal.class)) { + if (serverPrincipal == null || + p.getName().equals(serverPrincipal)) { + sc.kp = p; + serverPrincipal = p.getName(); + break; + } + } + if (sc.kp == null) { + // Compatibility with old behavior: even when there is no + // KerberosPrincipal, we can find one from KerberosKeys + List keys = SubjectComber.findMany( + subj, null, null, KerberosKey.class); + if (!keys.isEmpty()) { + sc.kp = keys.get(0).getPrincipal(); + serverPrincipal = sc.kp.getName(); + if (DEBUG) { + System.out.println(">>> ServiceCreds: no kp?" + + " find one from kk: " + serverPrincipal); + } + } else { + return null; + } + } + sc.ktabs = SubjectComber.findMany( + subj, null, null, KeyTab.class); + sc.kk = SubjectComber.findMany( + subj, serverPrincipal, null, KerberosKey.class); + if (sc.ktabs.isEmpty() && sc.kk.isEmpty()) { + return null; + } + return sc; + } + + public String getName() { + return kp.getName(); + } + + public KerberosKey[] getKKeys() { + if (ktabs.isEmpty()) { + return kk.toArray(new KerberosKey[kk.size()]); + } else { + List keys = new ArrayList<>(); + for (KeyTab ktab: ktabs) { + for (KerberosKey k: ktab.getKeys(kp)) { + keys.add(k); + } + } + // Compatibility: also add keys to privCredSet. Remove old + // ones first, only remove those from keytab. + if (!subj.isReadOnly()) { + Set pcs = subj.getPrivateCredentials(); + synchronized (pcs) { + Iterator iterator = pcs.iterator(); + while (iterator.hasNext()) { + Object obj = iterator.next(); + if (obj instanceof KeysFromKeyTab) { + KerberosKey key = (KerberosKey)obj; + if (Objects.equals(key.getPrincipal(), kp)) { + iterator.remove(); + } + } + } + } + for (KerberosKey key: keys) { + subj.getPrivateCredentials().add(new KeysFromKeyTab(key)); + } + } + return keys.toArray(new KerberosKey[keys.size()]); + } + } + + public EncryptionKey[] getEKeys() { + KerberosKey[] kkeys = getKKeys(); + EncryptionKey[] ekeys = new EncryptionKey[kkeys.length]; + for (int i=0; i kkeys = (List)SubjectComber.findMany( - accSubj, serverPrincipal, null, KerberosKey.class); - - if (kkeys == null && !GSSUtil.useSubjectCredsOnly(caller)) { + ServiceCreds sc = null; + if (accSubj != null) { + sc = ServiceCreds.getInstance(accSubj, serverPrincipal); + } + if (sc == null && !GSSUtil.useSubjectCredsOnly(caller)) { Subject subject = GSSUtil.login(caller, GSSUtil.GSS_KRB5_MECH_OID); - kkeys = (List) SubjectComber.findMany(subject, - serverPrincipal, null, KerberosKey.class); - } - - int len; - if (kkeys != null && (len = kkeys.size()) > 0) { - KerberosKey[] keys = new KerberosKey[len]; - kkeys.toArray(keys); - return keys; - } else { - return null; + sc = ServiceCreds.getInstance(subject, serverPrincipal); } + return sc; } public static KerberosTicket credsToTicket(Credentials serviceCreds) { @@ -247,4 +369,17 @@ public class Krb5Util { kerbTicket.getRenewTill(), kerbTicket.getClientAddresses()); } + + /** + * A helper method to get EncryptionKeys from a javax..KeyTab + * @param ktab the javax..KeyTab class + * @param cname the PrincipalName + * @return the EKeys, never null, might be empty + */ + public static EncryptionKey[] keysFromJavaxKeyTab( + KeyTab ktab, PrincipalName cname) { + return SharedSecrets.getJavaxSecurityAuthKerberosAccess(). + keyTabGetEncryptionKeys(ktab, cname); + } + } diff --git a/jdk/src/share/classes/sun/security/jgss/krb5/SubjectComber.java b/jdk/src/share/classes/sun/security/jgss/krb5/SubjectComber.java index e33867dedc8..c7269cb874f 100644 --- a/jdk/src/share/classes/sun/security/jgss/krb5/SubjectComber.java +++ b/jdk/src/share/classes/sun/security/jgss/krb5/SubjectComber.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,10 +33,11 @@ import java.util.Iterator; import java.util.ArrayList; import java.util.List; import java.util.Set; +import javax.security.auth.kerberos.KeyTab; /** - * This utility looks through the current Subject and retrieves a ticket or key - * for the desired client/server principals. + * This utility looks through the current Subject and retrieves private + * credentials for the desired client/server principals. * * @author Ram Marti * @since 1.4.2 @@ -52,58 +53,70 @@ class SubjectComber { private SubjectComber() { // Cannot create one of these } - static Object find(Subject subject, String serverPrincipal, - String clientPrincipal, Class credClass) { + static T find(Subject subject, String serverPrincipal, + String clientPrincipal, Class credClass) { - return findAux(subject, serverPrincipal, clientPrincipal, credClass, + return (T)findAux(subject, serverPrincipal, clientPrincipal, credClass, true); } - static Object findMany(Subject subject, String serverPrincipal, - String clientPrincipal, Class credClass) { + static List findMany(Subject subject, String serverPrincipal, + String clientPrincipal, Class credClass) { - return findAux(subject, serverPrincipal, clientPrincipal, credClass, + return (List)findAux(subject, serverPrincipal, clientPrincipal, credClass, false); } /** - * Find the ticket or key for the specified client/server principals + * Find private credentials for the specified client/server principals * in the subject. Returns null if the subject is null. * - * @return the ticket or key + * @return the private credentials */ - private static Object findAux(Subject subject, String serverPrincipal, - String clientPrincipal, Class credClass, boolean oneOnly) { + private static Object findAux(Subject subject, String serverPrincipal, + String clientPrincipal, Class credClass, boolean oneOnly) { if (subject == null) { return null; } else { - List answer = (oneOnly ? null : new ArrayList()); + List answer = (oneOnly ? null : new ArrayList()); - if (credClass == KerberosKey.class) { - // We are looking for a KerberosKey credentials for the - // serverPrincipal - Iterator iterator = - subject.getPrivateCredentials(KerberosKey.class).iterator(); + if (credClass == KeyTab.class) { // Principal un-related + // We are looking for credentials unrelated to serverPrincipal + Iterator iterator = + subject.getPrivateCredentials(credClass).iterator(); while (iterator.hasNext()) { - KerberosKey key = iterator.next(); - if (serverPrincipal == null || - serverPrincipal.equals(key.getPrincipal().getName())) { + T t = iterator.next(); + if (DEBUG) { + System.out.println("Found " + credClass.getSimpleName()); + } + if (oneOnly) { + return t; + } else { + answer.add(t); + } + } + } else if (credClass == KerberosKey.class) { + // We are looking for credentials for the serverPrincipal + Iterator iterator = + subject.getPrivateCredentials(credClass).iterator(); + while (iterator.hasNext()) { + T t = iterator.next(); + String name = ((KerberosKey)t).getPrincipal().getName(); + if (serverPrincipal == null || serverPrincipal.equals(name)) { if (DEBUG) { - System.out.println("Found key for " - + key.getPrincipal() + "(" + - key.getKeyType() + ")"); + System.out.println("Found " + + credClass.getSimpleName() + " for " + name); } if (oneOnly) { - return key; + return t; } else { if (serverPrincipal == null) { // Record name so that keys returned will all // belong to the same principal - serverPrincipal = - key.getPrincipal().getName(); + serverPrincipal = name; } - answer.add(key); + answer.add(t); } } } @@ -167,7 +180,7 @@ class SubjectComber { serverPrincipal = ticket.getServer().getName(); } - answer.add(ticket); + answer.add((T)ticket); } } } diff --git a/jdk/src/share/classes/sun/security/krb5/Config.java b/jdk/src/share/classes/sun/security/krb5/Config.java index 01d97eaf599..2ec4e12bd71 100644 --- a/jdk/src/share/classes/sun/security/krb5/Config.java +++ b/jdk/src/share/classes/sun/security/krb5/Config.java @@ -110,7 +110,6 @@ public class Config { public static synchronized void refresh() throws KrbException { singleton = new Config(); - KeyTab.refresh(); KdcComm.initStatic(); } diff --git a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java index 8ce51c0c659..1de032945ff 100644 --- a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java +++ b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -138,8 +138,7 @@ public class EncryptionKey * @returns an array of secret keys or null if none were found. */ public static EncryptionKey[] acquireSecretKeys(PrincipalName princ, - String keytab) - throws KrbException, IOException { + String keytab) { if (princ == null) throw new IllegalArgumentException( @@ -148,11 +147,6 @@ public class EncryptionKey // KeyTab getInstance(keytab) will call KeyTab.getInstance() // if keytab is null KeyTab ktab = KeyTab.getInstance(keytab); - - if (ktab == null) { - return null; - } - return ktab.readServiceKeys(princ); } diff --git a/jdk/src/share/classes/sun/security/krb5/KrbAsRep.java b/jdk/src/share/classes/sun/security/krb5/KrbAsRep.java index 16c7d87895f..29a7a5b4ccd 100644 --- a/jdk/src/share/classes/sun/security/krb5/KrbAsRep.java +++ b/jdk/src/share/classes/sun/security/krb5/KrbAsRep.java @@ -37,6 +37,8 @@ import sun.security.krb5.internal.crypto.EType; import sun.security.util.*; import java.io.IOException; import java.util.Objects; +import javax.security.auth.kerberos.KeyTab; +import sun.security.jgss.krb5.Krb5Util; /** * This class encapsulates a AS-REP message that the KDC sends to the @@ -90,29 +92,32 @@ class KrbAsRep extends KrbKdcRep { } /** - * Called by KrbAsReqBuilder to resolve a AS-REP message using keys. - * @param keys user provided keys, not null + * Called by KrbAsReqBuilder to resolve a AS-REP message using a keytab. + * @param ktab the keytab, not null * @param asReq the original AS-REQ sent, used to validate AS-REP + * @param cname the user principal name, used to locate keys in ktab */ - void decryptUsingKeys(EncryptionKey[] keys, KrbAsReq asReq) + void decryptUsingKeyTab(KeyTab ktab, KrbAsReq asReq, PrincipalName cname) throws KrbException, Asn1Exception, IOException { EncryptionKey dkey = null; int encPartKeyType = rep.encPart.getEType(); Integer encPartKvno = rep.encPart.kvno; - try { - dkey = EncryptionKey.findKey(encPartKeyType, encPartKvno, keys); - } catch (KrbException ke) { - if (ke.returnCode() == Krb5.KRB_AP_ERR_BADKEYVER) { - // Fallback to no kvno. In some cases, keytab is generated - // not by sysadmin but Java's ktab command - dkey = EncryptionKey.findKey(encPartKeyType, keys); + try { + dkey = EncryptionKey.findKey(encPartKeyType, encPartKvno, + Krb5Util.keysFromJavaxKeyTab(ktab, cname)); + } catch (KrbException ke) { + if (ke.returnCode() == Krb5.KRB_AP_ERR_BADKEYVER) { + // Fallback to no kvno. In some cases, keytab is generated + // not by sysadmin but Java's ktab command + dkey = EncryptionKey.findKey(encPartKeyType, + Krb5Util.keysFromJavaxKeyTab(ktab, cname)); + } + } + if (dkey == null) { + throw new KrbException(Krb5.API_INVALID_ARG, + "Cannot find key for type/kvno to decrypt AS REP - " + + EType.toString(encPartKeyType) + "/" + encPartKvno); } - } - if (dkey == null) { - throw new KrbException(Krb5.API_INVALID_ARG, - "Cannot find key for type/kvno to decrypt AS REP - " + - EType.toString(encPartKeyType) + "/" + encPartKvno); - } decrypt(dkey, asReq); } diff --git a/jdk/src/share/classes/sun/security/krb5/KrbAsReqBuilder.java b/jdk/src/share/classes/sun/security/krb5/KrbAsReqBuilder.java index 940d31107e5..dd9b8dcfb92 100644 --- a/jdk/src/share/classes/sun/security/krb5/KrbAsReqBuilder.java +++ b/jdk/src/share/classes/sun/security/krb5/KrbAsReqBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ package sun.security.krb5; import java.io.IOException; import java.util.Arrays; +import javax.security.auth.kerberos.KeyTab; +import sun.security.jgss.krb5.Krb5Util; import sun.security.krb5.internal.HostAddresses; import sun.security.krb5.internal.KDCOptions; import sun.security.krb5.internal.KRBError; @@ -42,13 +44,16 @@ import sun.security.krb5.internal.crypto.EType; * 1. Gather information to create AS-REQ * 2. Create and send AS-REQ * 3. Receive AS-REP and KRB-ERROR (-KRB_ERR_RESPONSE_TOO_BIG) and parse them - * 4. Emit credentials and secret keys (for JAAS storeKey=true) + * 4. Emit credentials and secret keys (for JAAS storeKey=true with password) * * This class does not: * 1. Deal with real communications (KdcComm does it, and TGS-REQ) * a. Name of KDCs for a realm * b. Server availability, timeout, UDP or TCP * d. KRB_ERR_RESPONSE_TOO_BIG + * 2. Stores its own copy of password, this means: + * a. Do not change/wipe it before Builder finish + * b. Builder will not wipe it for you * * With this class: * 1. KrbAsReq has only one constructor @@ -70,19 +75,17 @@ public final class KrbAsReqBuilder { private HostAddresses addresses; // Secret source: can't be changed once assigned, only one (of the two - // sources) can be set and should be non-null - private EncryptionKey[] keys; - private char[] password; + // sources) can be set to non-null + private final char[] password; + private final KeyTab ktab; // Used to create a ENC-TIMESTAMP in the 2nd AS-REQ - private EncryptionKey pakey; private PAData[] paList; // PA-DATA from both KRB-ERROR and AS-REP. // Used by getKeys() only. // Only AS-REP should be enough per RFC, // combined in case etypes are different. // The generated and received: - int[] eTypes; private KrbAsReq req; private KrbAsRep rep; @@ -94,7 +97,7 @@ public final class KrbAsReqBuilder { private State state; // Called by other constructors - private KrbAsReqBuilder(PrincipalName cname) + private void init(PrincipalName cname) throws KrbException { if (cname.getRealm() == null) { cname.setRealm(Config.getInstance().getDefaultRealm()); @@ -114,14 +117,11 @@ public final class KrbAsReqBuilder { * This argument will neither be modified nor stored by the method. * @throws KrbException */ - public KrbAsReqBuilder(PrincipalName cname, EncryptionKey[] keys) + public KrbAsReqBuilder(PrincipalName cname, KeyTab ktab) throws KrbException { - this(cname); - this.keys = new EncryptionKey[keys.length]; - for (int i=0; i map = new HashMap<>(); + + // KeyTab file does not exist. Note: a missing keytab is still valid + private boolean isMissing = false; + + // KeyTab file is invalid, possibly an I/O error or a file format error. + private boolean isValid = true; + + private final String tabName; + private long lastModified; + private int kt_vno; + private Vector entries = new Vector<>(); - private KeyTab(String filename) throws IOException, RealmException { - init(filename); - } - - public static KeyTab getInstance(String s) { - name = parse(s); - if (name == null) { - return getInstance(); + /** + * Constructs a KeyTab object. + * + * If there is any I/O error or format errot during the loading, the + * isValid flag is set to false, and all half-read entries are dismissed. + * @param filename path name for the keytab file, must not be null + */ + private KeyTab(String filename) { + tabName = filename; + try { + lastModified = new File(tabName).lastModified(); + KeyTabInputStream kis = + new KeyTabInputStream(new FileInputStream(filename)); + load(kis); + kis.close(); + } catch (FileNotFoundException e) { + entries.clear(); + isMissing = true; + } catch (Exception ioe) { + entries.clear(); + isValid = false; } - return getInstance(new File(name)); } /** - * Gets the single instance of KeyTab class. + * Read a keytab file. Returns a new object and save it into cache when + * new content (modified since last read) is available. If keytab file is + * invalid, the old object will be returned. This is a safeguard for + * partial-written keytab files or non-stable network. Please note that + * a missing keytab is valid, which is equivalent to an empty keytab. + * + * @param s file name of keytab, must not be null + * @return the keytab object, can be invalid, but never null. + */ + private synchronized static KeyTab getInstance0(String s) { + long lm = new File(s).lastModified(); + KeyTab old = map.get(s); + if (old != null && old.isValid() && old.lastModified == lm) { + return old; + } + KeyTab ktab = new KeyTab(s); + if (ktab.isValid()) { // A valid new keytab + map.put(s, ktab); + return ktab; + } else if (old != null) { // An existing old one + return old; + } else { + return ktab; // first read is invalid + } + } + + /** + * Gets a KeyTab object. + * @param s the key tab file name. + * @return the KeyTab object, never null. + */ + public static KeyTab getInstance(String s) { + if (s == null) { + return getInstance(); + } else { + return getInstance0(s); + } + } + + /** + * Gets a KeyTab object. * @param file the key tab file. - * @return single instance of KeyTab; - * return null if error occurs while reading data out of the file. + * @return the KeyTab object, never null. */ public static KeyTab getInstance(File file) { - try { - if (!(file.exists())) { - singleton = null; - } else { - String fname = file.getAbsolutePath(); - // Since this class deals with file I/O operations, - // we want only one class instance existing. - if (singleton != null) { - File kfile = new File(singleton.name); - String kname = kfile.getAbsolutePath(); - if (kname.equalsIgnoreCase(fname)) { - if (DEBUG) { - System.out.println("KeyTab instance already exists"); - } - } - } else { - singleton = new KeyTab(fname); - } - } - } catch (Exception e) { - singleton = null; - if (DEBUG) { - System.out.println("Could not obtain an instance of KeyTab" + - e.getMessage()); - } + if (file == null) { + return getInstance(); + } else { + return getInstance0(file.getPath()); } - return singleton; } /** - * Gets the single instance of KeyTab class. - * @return single instance of KeyTab; return null if default keytab file - * does not exist, or error occurs while reading data from the file. + * Gets the default KeyTab object. + * @return the KeyTab object, never null. */ public static KeyTab getInstance() { - try { - name = getDefaultKeyTab(); - if (name != null) { - singleton = getInstance(new File(name)); - } - } catch (Exception e) { - singleton = null; - if (DEBUG) { - System.out.println("Could not obtain an instance of KeyTab" + - e.getMessage()); - } - } - return singleton; + return getInstance(getDefaultTabName()); + } + + public boolean isMissing() { + return isMissing; + } + + public boolean isValid() { + return isValid; } /** * The location of keytab file will be read from the configuration file * If it is not specified, consider user.home as the keytab file's * default location. + * @return never null */ - private static String getDefaultKeyTab() { - if (name != null) { - return name; + private static String getDefaultTabName() { + if (defaultTabName != null) { + return defaultTabName; } else { String kname = null; try { @@ -145,7 +192,7 @@ public class KeyTab implements KeyTabConstants { StringTokenizer st = new StringTokenizer(keytab_names, " "); while (st.hasMoreTokens()) { kname = parse(st.nextToken()); - if (kname != null) { + if (new File(kname).exists()) { break; } } @@ -165,19 +212,20 @@ public class KeyTab implements KeyTabConstants { new sun.security.action.GetPropertyAction("user.dir")); } - if (user_home != null) { - kname = user_home + File.separator + "krb5.keytab"; - } + kname = user_home + File.separator + "krb5.keytab"; } + defaultTabName = kname; return kname; } } + /** + * Parses some common keytab name formats + * @param name never null + * @return never null + */ private static String parse(String name) { - String kname = null; - if (name == null) { - return null; - } + String kname; if ((name.length() >= 5) && (name.substring(0, 5).equalsIgnoreCase("FILE:"))) { kname = name.substring(5); @@ -194,18 +242,6 @@ public class KeyTab implements KeyTabConstants { return kname; } - private synchronized void init(String filename) - throws IOException, RealmException { - - if (filename != null) { - KeyTabInputStream kis = - new KeyTabInputStream(new FileInputStream(filename)); - load(kis); - kis.close(); - name = filename; - } - } - private void load(KeyTabInputStream kis) throws IOException, RealmException { @@ -234,14 +270,13 @@ public class KeyTab implements KeyTabConstants { * etypes that have been configured for use. If there are multiple * keys with same etype, the one with the highest kvno is returned. * @param service the PrincipalName of the requested service - * @return an array containing all the service keys + * @return an array containing all the service keys, never null */ public EncryptionKey[] readServiceKeys(PrincipalName service) { KeyTabEntry entry; EncryptionKey key; int size = entries.size(); ArrayList keys = new ArrayList<>(size); - for (int i = size-1; i >= 0; i--) { entry = entries.elementAt(i); if (entry.service.match(service)) { @@ -260,10 +295,7 @@ public class KeyTab implements KeyTabConstants { } } } - size = keys.size(); - if (size == 0) - return null; EncryptionKey[] retVal = keys.toArray(new EncryptionKey[size]); // Sort keys according to default_tkt_enctypes @@ -328,10 +360,13 @@ public class KeyTab implements KeyTabConstants { return false; } - public static String tabName() { - return name; + public String tabName() { + return tabName; } + /////////////////// THE WRITE SIDE /////////////////////// + /////////////// only used by ktab tool ////////////////// + /** * Adds a new entry in the key table. * @param service the service which will have a new entry in the key table. @@ -394,7 +429,7 @@ public class KeyTab implements KeyTabConstants { */ public synchronized static KeyTab create() throws IOException, RealmException { - String dname = getDefaultKeyTab(); + String dname = getDefaultTabName(); return create(dname); } @@ -408,8 +443,7 @@ public class KeyTab implements KeyTabConstants { new KeyTabOutputStream(new FileOutputStream(name)); kos.writeVersion(KRB5_KT_VNO); kos.close(); - singleton = new KeyTab(name); - return singleton; + return new KeyTab(name); } /** @@ -417,7 +451,7 @@ public class KeyTab implements KeyTabConstants { */ public synchronized void save() throws IOException { KeyTabOutputStream kos = - new KeyTabOutputStream(new FileOutputStream(name)); + new KeyTabOutputStream(new FileOutputStream(tabName)); kos.writeVersion(kt_vno); for (int i = 0; i < entries.size(); i++) { kos.writeEntry(entries.elementAt(i)); @@ -490,13 +524,4 @@ public class KeyTab implements KeyTabConstants { kos.write16(KRB5_KT_VNO); kos.close(); } - - public static void refresh() { - if (singleton != null) { - if (DEBUG) { - System.out.println("Refreshing Keytab"); - } - singleton = null; - } - } } diff --git a/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java b/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java index ff1c8d7d5c9..125de5f3f50 100644 --- a/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java +++ b/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1285,11 +1285,12 @@ final class ServerHandshaker extends Handshaker { // check permission to access and use the secret key of the // Kerberized "host" service - if (kerberosKeys != null) { - + if (kerberosKeys != null && kerberosKeys.length > 0) { if (debug != null && Debug.isOn("handshake")) { - System.out.println("Using Kerberos key: " + - kerberosKeys[0]); + for (SecretKey k: kerberosKeys) { + System.out.println("Using Kerberos key: " + + k); + } } String serverPrincipal = diff --git a/jdk/src/share/classes/sun/security/ssl/krb5/Krb5ProxyImpl.java b/jdk/src/share/classes/sun/security/ssl/krb5/Krb5ProxyImpl.java index 94d1e8e75be..652268e166f 100644 --- a/jdk/src/share/classes/sun/security/ssl/krb5/Krb5ProxyImpl.java +++ b/jdk/src/share/classes/sun/security/ssl/krb5/Krb5ProxyImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ import sun.security.krb5.PrincipalName; import sun.security.ssl.Krb5Proxy; /** - * An implementatin of Krb5Proxy that simply delegates to the appropriate + * An implementation of Krb5Proxy that simply delegates to the appropriate * Kerberos APIs. */ public class Krb5ProxyImpl implements Krb5Proxy { @@ -62,7 +62,7 @@ public class Krb5ProxyImpl implements Krb5Proxy { @Override public SecretKey[] getServerKeys(AccessControlContext acc) throws LoginException { - return Krb5Util.getKeys(GSSCaller.CALLER_SSL_SERVER, null, acc); + return Krb5Util.getServiceCreds(GSSCaller.CALLER_SSL_SERVER, null, acc).getKKeys(); } @Override diff --git a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java index f6c53f81f1e..41354c88a74 100644 --- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java +++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,12 +30,15 @@ package sun.security.krb5.internal.tools; +import java.io.File; import sun.security.krb5.*; import sun.security.krb5.internal.*; import sun.security.krb5.internal.ccache.*; import java.io.IOException; import java.util.Arrays; +import javax.security.auth.kerberos.KerberosPrincipal; import sun.security.util.Password; +import javax.security.auth.kerberos.KeyTab; /** * Kinit tool for obtaining Kerberos v5 tickets. @@ -153,7 +156,6 @@ public class Kinit { System.out.println("Principal is " + principal); } char[] psswd = options.password; - EncryptionKey[] skeys = null; boolean useKeytab = options.useKeytabFile(); if (!useKeytab) { if (princName == null) { @@ -186,17 +188,9 @@ public class Kinit { } } - // assert princName and principal are nonnull - skeys = EncryptionKey.acquireSecretKeys(principal, ktabName); - - if (skeys == null || skeys.length == 0) { - String msg = "No supported key found in keytab"; - if (princName != null) { - msg += " for principal " + princName; - } - throw new KrbException(msg); - } - builder = new KrbAsReqBuilder(principal, skeys); + builder = new KrbAsReqBuilder(principal, ktabName == null + ? KeyTab.getInstance() + : KeyTab.getInstance(new File(ktabName))); } KDCOptions opt = new KDCOptions(); diff --git a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java index ad5c8aa34f0..6cbc8a3fa61 100644 --- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java +++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,16 +95,15 @@ public class Klist { } break; case 'k': - if (klist.name == null) { - klist.target = KeyTab.getInstance(); - klist.name = KeyTab.tabName(); - } else klist.target = KeyTab.getInstance(klist.name); - if (klist.target != null) { - klist.displayTab(); - } else { + try { + KeyTab ktab = KeyTab.getInstance(klist.name); + klist.target = ktab; + klist.name = ktab.tabName(); + } catch (Exception e) { klist.displayMessage("KeyTab"); System.exit(-1); } + klist.displayTab(); break; default: if (klist.name != null) { @@ -295,9 +294,10 @@ public class Klist { void displayMessage(String target) { if (name == null) { - name = ""; + System.out.println("Default " + target + " not found."); + } else { + System.out.println(target + " " + name + " not found."); } - System.out.println(target + " " + name + " not found."); } /** * Reformats the date from the form - diff --git a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Ktab.java b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Ktab.java index 216c3a30c12..fe29462add5 100644 --- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Ktab.java +++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Ktab.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -321,7 +321,7 @@ public class Ktab { * Lists key table name and entries in it. */ void listKt() { - System.out.println("Keytab name: " + KeyTab.tabName()); + System.out.println("Keytab name: " + table.tabName()); KeyTabEntry[] entries = table.getEntries(); if ((entries != null) && (entries.length > 0)) { String[][] output = new String[entries.length+1][showTime?3:2]; diff --git a/jdk/test/sun/security/krb5/auto/Context.java b/jdk/test/sun/security/krb5/auto/Context.java index 676042ba993..1739f876f08 100644 --- a/jdk/test/sun/security/krb5/auto/Context.java +++ b/jdk/test/sun/security/krb5/auto/Context.java @@ -44,6 +44,7 @@ import com.sun.security.jgss.InquireType; import com.sun.security.jgss.AuthorizationDataEntry; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import javax.security.auth.kerberos.KeyTab; /** * Context of a JGSS subject, encapsulating Subject and GSSContext. @@ -107,15 +108,19 @@ public class Context { return out; } + public static Context fromUserPass( + String user, char[] pass, boolean storeKey) throws Exception { + return fromUserPass(null, user, pass, storeKey); + } /** * Logins with a username and a password, using Krb5LoginModule directly * @param storeKey true if key should be saved, used on acceptor side */ - public static Context fromUserPass(String user, char[] pass, boolean storeKey) - throws Exception { + public static Context fromUserPass(Subject s, + String user, char[] pass, boolean storeKey) throws Exception { Context out = new Context(); out.name = user; - out.s = new Subject(); + out.s = s == null ? new Subject() : s; Krb5LoginModule krb5 = new Krb5LoginModule(); Map map = new HashMap<>(); Map shared = new HashMap<>(); @@ -198,12 +203,25 @@ public class Context { * @throws java.lang.Exception */ public void startAsServer(final Oid mech) throws Exception { + startAsServer(null, mech); + } + + /** + * Starts as a server with the specified service name + * @param name the service name + * @param mech GSS mech + * @throws java.lang.Exception + */ + public void startAsServer(final String name, final Oid mech) throws Exception { doAs(new Action() { @Override public byte[] run(Context me, byte[] dummy) throws Exception { GSSManager m = GSSManager.getInstance(); me.x = (ExtendedGSSContext)m.createContext(m.createCredential( - null, + name == null ? null : + (name.indexOf('@') < 0 ? + m.createName(name, null) : + m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), GSSCredential.INDEFINITE_LIFETIME, mech, GSSCredential.ACCEPT_ONLY)); @@ -229,6 +247,14 @@ public class Context { return x; } + /** + * Accesses the internal subject. + * @return the subject + */ + public Subject s() { + return s; + } + /** * Disposes the GSSContext within * @throws org.ietf.jgss.GSSException @@ -297,7 +323,7 @@ public class Context { } catch (Exception e) { ;// Don't care } - System.out.println("====================================="); + System.out.println("====== Private Credentials Set ======"); for (Object o : s.getPrivateCredentials()) { System.out.println(" " + o.getClass()); if (o instanceof KerberosTicket) { @@ -315,6 +341,8 @@ public class Context { for (Object k : map.keySet()) { System.out.println(" " + k + ": " + map.get(k)); } + } else { + System.out.println(" " + o); } } if (x != null && x instanceof ExtendedGSSContext) { diff --git a/jdk/test/sun/security/krb5/auto/DynamicKeytab.java b/jdk/test/sun/security/krb5/auto/DynamicKeytab.java new file mode 100644 index 00000000000..256476b0b5e --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/DynamicKeytab.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 6894072 + * @run main/othervm DynamicKeytab + * @summary always refresh keytab + */ + +import java.io.File; +import java.io.FileOutputStream; +import org.ietf.jgss.GSSException; +import sun.security.jgss.GSSUtil; +import sun.security.krb5.KrbException; +import sun.security.krb5.internal.Krb5; + +public class DynamicKeytab { + + Context c, s; + public static void main(String[] args) + throws Exception { + new DynamicKeytab().go(); + } + + void go() throws Exception { + OneKDC k = new OneKDC(null); + k.writeJAASConf(); + + new File(OneKDC.KTAB).delete(); + + + // Starts with no keytab + c = Context.fromJAAS("client"); + s = Context.fromJAAS("com.sun.security.jgss.krb5.accept"); + + // Test 1: read new key 1 from keytab + k.addPrincipal(OneKDC.SERVER, "pass1".toCharArray()); + k.writeKtab(OneKDC.KTAB); + connect(); + + // Test 2: service key cached, find 1 in keytab (now contains 1 and 2) + k.addPrincipal(OneKDC.SERVER, "pass2".toCharArray()); + k.appendKtab(OneKDC.KTAB); + connect(); + + // Test 3: re-login. Now find 2 in keytab + c = Context.fromJAAS("client"); + connect(); + + // Test 4: re-login, KDC use 3 this time. + c = Context.fromJAAS("client"); + // Put 3 and 4 into keytab but keep the real key back to 3. + k.addPrincipal(OneKDC.SERVER, "pass3".toCharArray()); + k.appendKtab(OneKDC.KTAB); + k.addPrincipal(OneKDC.SERVER, "pass4".toCharArray()); + k.appendKtab(OneKDC.KTAB); + k.addPrincipal(OneKDC.SERVER, "pass3".toCharArray()); + connect(); + + // Test 5: invalid keytab file, should ignore + new FileOutputStream(OneKDC.KTAB).write("BADBADBAD".getBytes()); + connect(); + + // Test 6: delete keytab file, identical to revoke all + new File(OneKDC.KTAB).delete(); + try { + connect(); + throw new Exception("Should not success"); + } catch (GSSException gsse) { + System.out.println(gsse); + KrbException ke = (KrbException)gsse.getCause(); + // KrbApReq.authenticate(*) if (dkey == null)... + // This should have been Krb5.KRB_AP_ERR_NOKEY + if (ke.returnCode() != Krb5.API_INVALID_ARG) { + throw new Exception("Not expected failure code: " + + ke.returnCode()); + } + } + + // Test 7: 3 revoked, should fail (now contains only 5) + k.addPrincipal(OneKDC.SERVER, "pass5".toCharArray()); + k.writeKtab(OneKDC.KTAB); // overwrite keytab, which means + // old key is revoked + try { + connect(); + throw new Exception("Should not success"); + } catch (GSSException gsse) { + System.out.println(gsse); + KrbException ke = (KrbException)gsse.getCause(); + if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) { + throw new Exception("Not expected failure code: " + + ke.returnCode()); + } + } + + // Test 8: an empty KDC means revoke all + KDC.create("EMPTY.REALM").writeKtab(OneKDC.KTAB); + try { + connect(); + throw new Exception("Should not success"); + } catch (GSSException gsse) { + System.out.println(gsse); + KrbException ke = (KrbException)gsse.getCause(); + // KrbApReq.authenticate(*) if (dkey == null)... + // This should have been Krb5.KRB_AP_ERR_NOKEY + if (ke.returnCode() != Krb5.API_INVALID_ARG) { + throw new Exception("Not expected failure code: " + + ke.returnCode()); + } + } + } + + void connect() throws Exception { + Thread.sleep(2000); // make sure ktab timestamp is different + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + Context.handshake(c, s); + } +} diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java index 8d01dd346cd..45a3d530c4b 100644 --- a/jdk/test/sun/security/krb5/auto/KDC.java +++ b/jdk/test/sun/security/krb5/auto/KDC.java @@ -228,7 +228,33 @@ public class KDC { } /** - * Write all principals' keys from multiple KDCsinto one keytab file. + * Writes or appends KDC keys into a keytab. See doc for writeMultiKtab. + * @param append true if append, otherwise, overwrite. + */ + private static void writeKtab0(String tab, boolean append, KDC... kdcs) + throws IOException, KrbException { + KeyTab ktab = append ? KeyTab.getInstance(tab) : KeyTab.create(tab); + for (KDC kdc: kdcs) { + for (String name : kdc.passwords.keySet()) { + char[] pass = kdc.passwords.get(name); + int kvno = 0; + if (Character.isDigit(pass[pass.length-1])) { + kvno = pass[pass.length-1] - '0'; + } + ktab.addEntry(new PrincipalName(name, + name.indexOf('/') < 0 ? + PrincipalName.KRB_NT_UNKNOWN : + PrincipalName.KRB_NT_SRV_HST), + pass, + kvno, + true); + } + } + ktab.save(); + } + + /** + * Writes all principals' keys from multiple KDCs into one keytab file. * Note that the keys for the krbtgt principals will not be written. *

    * Attention: This method references krb5.conf settings. If you need to @@ -252,17 +278,16 @@ public class KDC { */ public static void writeMultiKtab(String tab, KDC... kdcs) throws IOException, KrbException { - KeyTab ktab = KeyTab.create(tab); - for (KDC kdc: kdcs) { - for (String name : kdc.passwords.keySet()) { - ktab.addEntry(new PrincipalName(name, - name.indexOf('/') < 0 ? - PrincipalName.KRB_NT_UNKNOWN : - PrincipalName.KRB_NT_SRV_HST), - kdc.passwords.get(name), -1, true); - } - } - ktab.save(); + writeKtab0(tab, false, kdcs); + } + + /** + * Appends all principals' keys from multiple KDCs to one keytab file. + * See writeMultiKtab for details. + */ + public static void appendMultiKtab(String tab, KDC... kdcs) + throws IOException, KrbException { + writeKtab0(tab, true, kdcs); } /** @@ -272,6 +297,13 @@ public class KDC { KDC.writeMultiKtab(tab, this); } + /** + * Appends keys in this KDC to a ktab. + */ + public void appendKtab(String tab) throws IOException, KrbException { + KDC.appendMultiKtab(tab, this); + } + /** * Adds a new principal to this realm with a given password. * @param user the principal's name. For a service principal, use the diff --git a/jdk/test/sun/security/krb5/auto/KeyTabCompat.java b/jdk/test/sun/security/krb5/auto/KeyTabCompat.java new file mode 100644 index 00000000000..f6763510fd2 --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/KeyTabCompat.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 6894072 + * @compile -XDignore.symbol.file KeyTabCompat.java + * @run main/othervm KeyTabCompat + * @summary always refresh keytab + */ + +import javax.security.auth.kerberos.KerberosKey; +import sun.security.jgss.GSSUtil; + +/* + * There are 2 compat issues to check: + * + * 1. If there is only KerberosKeys in private credential set and no + * KerberosPrincipal. JAAS login should go on. + * 2. Even if KeyTab is used, user can still get KerberosKeys from + * private credentials set. + */ +public class KeyTabCompat { + + public static void main(String[] args) + throws Exception { + OneKDC kdc = new OneKDC("aes128-cts"); + kdc.writeJAASConf(); + kdc.addPrincipal(OneKDC.SERVER, "pass1".toCharArray()); + kdc.writeKtab(OneKDC.KTAB); + + Context c, s; + + // Part 1 + c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + s = Context.fromUserPass(OneKDC.USER2, OneKDC.PASS2, true); + + s.s().getPrincipals().clear(); + + c.startAsClient(OneKDC.USER2, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + Context.handshake(c, s); + + // Part 2 + c = Context.fromJAAS("client"); + s = Context.fromJAAS("server"); + + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + s.status(); + + if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) { + throw new Exception("There should be one KerberosKey"); + } + + Thread.sleep(2000); // make sure ktab timestamp is different + + kdc.addPrincipal(OneKDC.SERVER, "pass2".toCharArray()); + kdc.writeKtab(OneKDC.KTAB); + + Context.handshake(c, s); + s.status(); + + if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) { + throw new Exception("There should be only one KerberosKey"); + } + + } +} diff --git a/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java b/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java index a6dd33b8029..2c77451d748 100644 --- a/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java +++ b/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java @@ -28,7 +28,6 @@ * @summary Krb5LoginModule a little too restrictive, and the doc is not clear. */ import com.sun.security.auth.module.Krb5LoginModule; -import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.security.auth.Subject; @@ -36,7 +35,6 @@ import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.UnsupportedCallbackException; public class LoginModuleOptions { @@ -61,10 +59,12 @@ public class LoginModuleOptions { // 1. ccache -> keytab login(null, "useTicketCache", "true", "ticketCache", "krbcc_non_exists", "useKeyTab", "true", "principal", "dummy"); + // 2. keytab -> shared login(null, "useKeyTab", "true", "principal", "dummy", "keyTab", "ktab_non_exist", "tryFirstPass", "true", NAME, OneKDC.USER, PWD, OneKDC.PASS); + // 3. shared -> callback // 3.1. useFirstPass, no callback boolean failed = false; diff --git a/jdk/test/sun/security/krb5/auto/SSL.java b/jdk/test/sun/security/krb5/auto/SSL.java index 7bd4601481e..eca535051fc 100644 --- a/jdk/test/sun/security/krb5/auto/SSL.java +++ b/jdk/test/sun/security/krb5/auto/SSL.java @@ -48,7 +48,7 @@ import sun.security.krb5.internal.ktab.KeyTab; public class SSL { private static String krb5Cipher; - private static final int LOOP_LIMIT = 1; + private static final int LOOP_LIMIT = 3; private static int loopCount = 0; private static volatile String server; private static volatile int port; @@ -98,13 +98,13 @@ public class SSL { fos.close(); f.deleteOnExit(); - final Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + Context c; final Context s = Context.fromJAAS("ssl"); - c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID); + // There's no keytab file when server starts. s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); - new Thread(new Runnable() { + Thread server = new Thread(new Runnable() { public void run() { try { s.doAs(new JsseServerAction(), null); @@ -112,12 +112,57 @@ public class SSL { e.printStackTrace(); } } - }).start(); + }); + server.setDaemon(true); + server.start(); // Warm the server Thread.sleep(2000); + // Now create the keytab + + /* + // Add 3 versions of keys into keytab + KeyTab ktab = KeyTab.create(OneKDC.KTAB); + PrincipalName service = new PrincipalName( + "host/" + server, PrincipalName.KRB_NT_SRV_HST); + ktab.addEntry(service, "pass1".toCharArray(), 1); + ktab.addEntry(service, "pass2".toCharArray(), 2); + ktab.addEntry(service, "pass3".toCharArray(), 3); + ktab.save(); + + // and use the middle one as the real key + kdc.addPrincipal("host/" + server, "pass2".toCharArray()); + */ + c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID); c.doAs(new JsseClientAction(), null); + + // Add another version of key, make sure it can be loaded + Thread.sleep(2000); + ktab = KeyTab.getInstance(OneKDC.KTAB); + ktab.addEntry(service, "pass4".toCharArray(), 4, true); + ktab.save(); + kdc.addPrincipal("host/" + server, "pass4".toCharArray()); + + c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID); + c.doAs(new JsseClientAction(), null); + + // Revoke the old key + /*Thread.sleep(2000); + ktab = KeyTab.create(OneKDC.KTAB); + ktab.addEntry(service, "pass5".toCharArray(), 5, false); + ktab.save(); + + c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID); + try { + c.doAs(new JsseClientAction(), null); + throw new Exception("Should fail this time."); + } catch (SSLException e) { + // Correct behavior. + }*/ } // Following codes copied from @@ -126,6 +171,7 @@ public class SSL { public byte[] run(Context s, byte[] input) throws Exception { SSLSocketFactory sslsf = (SSLSocketFactory) SSLSocketFactory.getDefault(); + System.out.println("Connecting " + server + ":" + port); SSLSocket sslSocket = (SSLSocket) sslsf.createSocket(server, port); // Enable only a KRB5 cipher suite. @@ -154,6 +200,9 @@ public class SSL { System.out.println("Server is: " + peer.toString()); sslSocket.close(); + // This line should not be needed. It's the server's duty to + // forget the old key + //sslSocket.getSession().invalidate(); return null; } } @@ -165,6 +214,7 @@ public class SSL { SSLServerSocket sslServerSocket = (SSLServerSocket) sslssf.createServerSocket(0); // any port port = sslServerSocket.getLocalPort(); + System.out.println("Listening on " + port); // Enable only a KRB5 cipher suite. String enabledSuites[] = {krb5Cipher}; diff --git a/jdk/test/sun/security/krb5/auto/TwoPrinces.java b/jdk/test/sun/security/krb5/auto/TwoPrinces.java new file mode 100644 index 00000000000..30f16e96a25 --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/TwoPrinces.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 6894072 + * @compile -XDignore.symbol.file TwoPrinces.java + * @run main/othervm TwoPrinces + * @summary always refresh keytab + */ + +import java.io.File; +import java.io.FileOutputStream; +import sun.security.jgss.GSSUtil; +import sun.security.krb5.Config; + +public class TwoPrinces { + + public static void main(String[] args) + throws Exception { + + KDC k1 = KDC.create("R1"); + k1.addPrincipal("u1", "hello".toCharArray()); + k1.addPrincipalRandKey("krbtgt/R1"); + k1.addPrincipalRandKey("host/same.host"); + + KDC k2 = KDC.create("R2"); + k2.addPrincipal("u2", "hello".toCharArray()); + k2.addPrincipalRandKey("krbtgt/R2"); + k2.addPrincipalRandKey("host/same.host"); + + System.setProperty("java.security.krb5.conf", "krb5.conf"); + + // R1 is the default realm now + KDC.saveConfig("krb5.conf", k1, k2); + Config.refresh(); + + k1.writeKtab("ktab1"); + k2.writeKtab("ktab2"); + + // A JAAS config file with 2 Krb5LoginModules, after commit, the + // subject with have principals and keytabs from both sides + System.setProperty("java.security.auth.login.config", "jaas.conf"); + File f = new File("jaas.conf"); + FileOutputStream fos = new FileOutputStream(f); + fos.write(( + "me {\n" + + " com.sun.security.auth.module.Krb5LoginModule required" + + " isInitiator=true principal=\"host/same.host@R1\"" + + " useKeyTab=true keyTab=ktab1 storeKey=true;\n" + + " com.sun.security.auth.module.Krb5LoginModule required" + + " isInitiator=true principal=\"host/same.host@R2\"" + + " useKeyTab=true keyTab=ktab2 storeKey=true;\n" + + "};\n" + ).getBytes()); + fos.close(); + + /* + * This server side context will be able to act as services in both + * realms. Please note that we still don't support a single instance + * of server to accept connections from two realms at the same time. + * Therefore, we must call startAsServer in a given realm to start + * working there. The same Subject never changes anyway. + */ + Context s = Context.fromJAAS("me"); + + // Default realm still R1 + s.startAsServer("host@same.host", GSSUtil.GSS_KRB5_MECH_OID); + Context c1 = Context.fromUserPass("u1", "hello".toCharArray(), false); + c1.startAsClient("host@same.host", GSSUtil.GSS_KRB5_MECH_OID); + Context.handshake(c1, s); + + KDC.saveConfig("krb5.conf", k2, k1); + Config.refresh(); + + // Default realm now R2 + s.startAsServer("host@same.host", GSSUtil.GSS_KRB5_MECH_OID); + Context c2 = Context.fromUserPass("u2", "hello".toCharArray(), false); + c2.startAsClient("host@same.host", GSSUtil.GSS_KRB5_MECH_OID); + Context.handshake(c2, s); + } +} diff --git a/jdk/test/sun/security/krb5/ktab/KeyTabIndex.java b/jdk/test/sun/security/krb5/ktab/KeyTabIndex.java index f0cd88e6a65..26eb5621939 100644 --- a/jdk/test/sun/security/krb5/ktab/KeyTabIndex.java +++ b/jdk/test/sun/security/krb5/ktab/KeyTabIndex.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,6 @@ public class KeyTabIndex { KeyTab.getInstance("ktab").getClass(); } }; - KeyTab.refresh(); for (int i=0; i<10; i++) { new Thread(t).start(); } From 1b62e08853c454408829a10496d60105a19e59a0 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Wed, 20 Apr 2011 12:03:30 +0100 Subject: [PATCH 012/117] 7034570: java.lang.Runtime.exec(String[] cmd, String[] env) can not work properly if SystemRoot not inherited Reviewed-by: dholmes, alanb --- .../classes/java/lang/ProcessBuilder.java | 5 ++ jdk/src/share/classes/java/lang/Runtime.java | 5 ++ .../classes/java/lang/ProcessEnvironment.java | 47 +++++++++++++++---- jdk/test/java/lang/ProcessBuilder/Basic.java | 22 +++++++-- 4 files changed, 66 insertions(+), 13 deletions(-) diff --git a/jdk/src/share/classes/java/lang/ProcessBuilder.java b/jdk/src/share/classes/java/lang/ProcessBuilder.java index c580f507d53..6caaaeb906d 100644 --- a/jdk/src/share/classes/java/lang/ProcessBuilder.java +++ b/jdk/src/share/classes/java/lang/ProcessBuilder.java @@ -938,6 +938,11 @@ public final class ProcessBuilder * but at the very least the command must be a non-empty list of * non-null strings. * + *

    A minimal set of system dependent environment variables may + * be required to start a process on some operating systems. + * As a result, the subprocess may inherit additional environment variable + * settings beyond those in the process builder's {@link #environment()}. + * *

    If there is a security manager, its * {@link SecurityManager#checkExec checkExec} * method is called with the first component of this object's diff --git a/jdk/src/share/classes/java/lang/Runtime.java b/jdk/src/share/classes/java/lang/Runtime.java index 5e4a1bceaba..3fc29d08376 100644 --- a/jdk/src/share/classes/java/lang/Runtime.java +++ b/jdk/src/share/classes/java/lang/Runtime.java @@ -544,6 +544,11 @@ public class Runtime { *

    If envp is null, the subprocess inherits the * environment settings of the current process. * + *

    A minimal set of system dependent environment variables may + * be required to start a process on some operating systems. + * As a result, the subprocess may inherit additional environment variable + * settings beyond those in the specified environment. + * *

    {@link ProcessBuilder#start()} is now the preferred way to * start a process with a modified environment. * diff --git a/jdk/src/windows/classes/java/lang/ProcessEnvironment.java b/jdk/src/windows/classes/java/lang/ProcessEnvironment.java index b5a4383019e..89e46899999 100644 --- a/jdk/src/windows/classes/java/lang/ProcessEnvironment.java +++ b/jdk/src/windows/classes/java/lang/ProcessEnvironment.java @@ -143,7 +143,7 @@ final class ProcessEnvironment extends HashMap public void remove() { i.remove();} }; } - private static Map.Entry checkedEntry (Object o) { + private static Map.Entry checkedEntry(Object o) { Map.Entry e = (Map.Entry) o; nonNullString(e.getKey()); nonNullString(e.getValue()); @@ -285,7 +285,7 @@ final class ProcessEnvironment extends HashMap return (Map) theEnvironment.clone(); } - // Only for use by Runtime.exec(...String[]envp...) + // Only for use by ProcessBuilder.environment(String[] envp) static Map emptyEnvironment(int capacity) { return new ProcessEnvironment(capacity); } @@ -299,19 +299,46 @@ final class ProcessEnvironment extends HashMap Collections.sort(list, entryComparator); StringBuilder sb = new StringBuilder(size()*30); - for (Map.Entry e : list) - sb.append(e.getKey()) - .append('=') - .append(e.getValue()) - .append('\u0000'); - // Ensure double NUL termination, - // even if environment is empty. - if (sb.length() == 0) + int cmp = -1; + + // Some versions of MSVCRT.DLL require SystemRoot to be set. + // So, we make sure that it is always set, even if not provided + // by the caller. + final String SYSTEMROOT = "SystemRoot"; + + for (Map.Entry e : list) { + String key = e.getKey(); + String value = e.getValue(); + if (cmp < 0 && (cmp = nameComparator.compare(key, SYSTEMROOT)) > 0) { + // Not set, so add it here + addToEnvIfSet(sb, SYSTEMROOT); + } + addToEnv(sb, key, value); + } + if (cmp < 0) { + // Got to end of list and still not found + addToEnvIfSet(sb, SYSTEMROOT); + } + if (sb.length() == 0) { + // Environment was empty and SystemRoot not set in parent sb.append('\u0000'); + } + // Block is double NUL terminated sb.append('\u0000'); return sb.toString(); } + // add the environment variable to the child, if it exists in parent + private static void addToEnvIfSet(StringBuilder sb, String name) { + String s = getenv(name); + if (s != null) + addToEnv(sb, name, s); + } + + private static void addToEnv(StringBuilder sb, String name, String val) { + sb.append(name).append('=').append(val).append('\u0000'); + } + static String toEnvironmentBlock(Map map) { return map == null ? null : ((ProcessEnvironment)map).toEnvironmentBlock(); diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java index 22916929561..677735474a8 100644 --- a/jdk/test/java/lang/ProcessBuilder/Basic.java +++ b/jdk/test/java/lang/ProcessBuilder/Basic.java @@ -26,7 +26,7 @@ * @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689 * 5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313 * 6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958 - * 4947220 7018606 + * 4947220 7018606 7034570 * @summary Basic tests for Process and Environment Variable code * @run main/othervm/timeout=300 Basic * @author Martin Buchholz @@ -1440,11 +1440,12 @@ public class Basic { // Check for sort order of environment variables on Windows. //---------------------------------------------------------------- try { + String systemRoot = "SystemRoot=" + System.getenv("SystemRoot"); // '+' < 'A' < 'Z' < '_' < 'a' < 'z' < '~' String[]envp = {"FOO=BAR","BAZ=GORP","QUUX=", - "+=+", "_=_", "~=~"}; + "+=+", "_=_", "~=~", systemRoot}; String output = nativeEnv(envp); - String expected = "+=+\nBAZ=GORP\nFOO=BAR\nQUUX=\n_=_\n~=~\n"; + String expected = "+=+\nBAZ=GORP\nFOO=BAR\nQUUX=\n"+systemRoot+"\n_=_\n~=~\n"; // On Windows, Java must keep the environment sorted. // Order is random on Unix, so this test does the sort. if (! Windows.is()) @@ -1452,6 +1453,21 @@ public class Basic { equal(output, expected); } catch (Throwable t) { unexpected(t); } + //---------------------------------------------------------------- + // Test Runtime.exec(...envp...) + // and check SystemRoot gets set automatically on Windows + //---------------------------------------------------------------- + try { + if (Windows.is()) { + String systemRoot = "SystemRoot=" + System.getenv("SystemRoot"); + String[]envp = {"FOO=BAR","BAZ=GORP","QUUX=", + "+=+", "_=_", "~=~"}; + String output = nativeEnv(envp); + String expected = "+=+\nBAZ=GORP\nFOO=BAR\nQUUX=\n"+systemRoot+"\n_=_\n~=~\n"; + equal(output, expected); + } + } catch (Throwable t) { unexpected(t); } + //---------------------------------------------------------------- // System.getenv() must be consistent with System.getenv(String) //---------------------------------------------------------------- From e45512128a063241bb4de8c1463aa7fc11016cf7 Mon Sep 17 00:00:00 2001 From: Alex Menkov Date: Wed, 20 Apr 2011 16:46:31 +0400 Subject: [PATCH 013/117] 7030629: closed/sun/audio/AudioClipClose/AudioClipClose.java test fails just against jdk7 b134 7033899: SoundTestSuite: test050 fails on Ubuntu Linux Reviewed-by: bae --- .../sound/PLATFORM_API_LinuxOS_ALSA_PCM.c | 56 ++++++++++++++++--- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c index fb2ba3c5da3..0c5784bc496 100644 --- a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c +++ b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c @@ -239,6 +239,13 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre snd_pcm_close(handle); } +/** Workaround for cr 7033899, 7030629: + * dmix plugin doesn't like flush (snd_pcm_drop) when the buffer is empty + * (just opened, underruned or already flushed). + * Sometimes it causes PCM falls to -EBADFD error, + * sometimes causes bufferSize change. + * To prevent unnecessary flushes AlsaPcmInfo::isRunning & isFlushed are used. + */ /* ******* ALSA PCM INFO ******************** */ typedef struct tag_AlsaPcmInfo { snd_pcm_t* handle; @@ -248,6 +255,8 @@ typedef struct tag_AlsaPcmInfo { int frameSize; // storage size in Bytes unsigned int periods; snd_pcm_uframes_t periodSize; + short int isRunning; // see comment above + short int isFlushed; // see comment above #ifdef GET_POSITION_METHOD2 // to be used exclusively by getBytePosition! snd_pcm_status_t* positionStatus; @@ -432,6 +441,9 @@ void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource, return NULL; } memset(info, 0, sizeof(AlsaPcmInfo)); + // initial values are: stopped, flushed + info->isRunning = 0; + info->isFlushed = 1; ret = openPCMfromDeviceID(deviceID, &(info->handle), isSource, FALSE /* do open device*/); if (ret == 0) { @@ -587,6 +599,14 @@ int DAUDIO_Start(void* id, int isSource) { || (state == SND_PCM_STATE_RUNNING) || (state == SND_PCM_STATE_XRUN) || (state == SND_PCM_STATE_SUSPENDED); + if (ret) { + info->isRunning = 1; + // source line should keep isFlushed value until Write() is called; + // for target data line reset it right now. + if (!isSource) { + info->isFlushed = 0; + } + } TRACE1("< DAUDIO_Start %s\n", ret?"success":"error"); return ret?TRUE:FALSE; } @@ -606,6 +626,7 @@ int DAUDIO_Stop(void* id, int isSource) { ERROR1("ERROR in snd_pcm_pause: %s\n", snd_strerror(ret)); return FALSE; } + info->isRunning = 0; TRACE0("< DAUDIO_Stop success\n"); return TRUE; } @@ -651,8 +672,7 @@ int xrun_recovery(AlsaPcmInfo* info, int err) { return -1; } return 1; - } - else if (err == -ESTRPIPE) { + } else if (err == -ESTRPIPE) { TRACE0("xrun_recovery: suspended.\n"); ret = snd_pcm_resume(info->handle); if (ret < 0) { @@ -667,11 +687,11 @@ int xrun_recovery(AlsaPcmInfo* info, int err) { return -1; } return 1; - } - else if (err == -EAGAIN) { + } else if (err == -EAGAIN) { TRACE0("xrun_recovery: EAGAIN try again flag.\n"); return 0; } + TRACE2("xrun_recovery: unexpected error %d: %s\n", err, snd_strerror(err)); return -1; } @@ -691,6 +711,7 @@ int DAUDIO_Write(void* id, char* data, int byteSize) { TRACE0("< DAUDIO_Write returning -1\n"); return -1; } + count = 2; // maximum number of trials to recover from underrun //frameSize = snd_pcm_bytes_to_frames(info->handle, byteSize); frameSize = (snd_pcm_sframes_t) (byteSize / info->frameSize); @@ -712,6 +733,12 @@ int DAUDIO_Write(void* id, char* data, int byteSize) { } } while (TRUE); //ret = snd_pcm_frames_to_bytes(info->handle, writtenFrames); + + if (writtenFrames > 0) { + // reset "flushed" flag + info->isFlushed = 0; + } + ret = (int) (writtenFrames * info->frameSize); TRACE1("< DAUDIO_Write: returning %d bytes.\n", ret); return ret; @@ -736,6 +763,11 @@ int DAUDIO_Read(void* id, char* data, int byteSize) { TRACE0("< DAUDIO_Read returning -1\n"); return -1; } + if (!info->isRunning && info->isFlushed) { + // PCM has nothing to read + return 0; + } + count = 2; // maximum number of trials to recover from error //frameSize = snd_pcm_bytes_to_frames(info->handle, byteSize); frameSize = (snd_pcm_sframes_t) (byteSize / info->frameSize); @@ -784,12 +816,22 @@ int DAUDIO_Flush(void* id, int isSource) { int ret; TRACE0("DAUDIO_Flush\n"); + + if (info->isFlushed) { + // nothing to drop + return 1; + } + ret = snd_pcm_drop(info->handle); if (ret != 0) { ERROR1("ERROR in snd_pcm_drop: %s\n", snd_strerror(ret)); return FALSE; } - ret = DAUDIO_Start(id, isSource); + + info->isFlushed = 1; + if (info->isRunning) { + ret = DAUDIO_Start(id, isSource); + } return ret; } @@ -800,7 +842,7 @@ int DAUDIO_GetAvailable(void* id, int isSource) { int ret; state = snd_pcm_state(info->handle); - if (state == SND_PCM_STATE_XRUN) { + if (info->isFlushed || state == SND_PCM_STATE_XRUN) { // if in xrun state then we have the entire buffer available, // not 0 as alsa reports ret = info->bufferSizeInBytes; @@ -841,7 +883,7 @@ INT64 DAUDIO_GetBytePosition(void* id, int isSource, INT64 javaBytePos) { snd_pcm_state_t state; state = snd_pcm_state(info->handle); - if (state != SND_PCM_STATE_XRUN) { + if (!info->isFlushed && state != SND_PCM_STATE_XRUN) { #ifdef GET_POSITION_METHOD2 snd_timestamp_t* ts; snd_pcm_uframes_t framesAvail; From f3c1d5f3ea80220483e024f9f3fffa80063f5267 Mon Sep 17 00:00:00 2001 From: Jennifer Godinez Date: Wed, 20 Apr 2011 09:10:36 -0700 Subject: [PATCH 014/117] 6989724: font warnings in the build, native code Reviewed-by: bae, igor --- .../share/native/sun/awt/giflib/dgif_lib.c | 2 +- .../share/native/sun/font/fontscalerdefs.h | 4 +++- .../sun/font/layout/HangulLayoutEngine.cpp | 2 +- .../native/sun/font/layout/MPreFixups.cpp | 4 ++-- jdk/src/solaris/native/sun/awt/fontpath.c | 3 ++- jdk/src/windows/native/sun/font/fontpath.c | 24 +++++++++---------- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/jdk/src/share/native/sun/awt/giflib/dgif_lib.c b/jdk/src/share/native/sun/awt/giflib/dgif_lib.c index b566e7e1cc1..742ae9c3335 100644 --- a/jdk/src/share/native/sun/awt/giflib/dgif_lib.c +++ b/jdk/src/share/native/sun/awt/giflib/dgif_lib.c @@ -70,7 +70,7 @@ /* avoid extra function call in case we use fread (TVT) */ #define READ(_gif,_buf,_len) \ (((GifFilePrivateType*)_gif->Private)->Read ? \ - ((GifFilePrivateType*)_gif->Private)->Read(_gif,_buf,_len) : \ + (size_t)((GifFilePrivateType*)_gif->Private)->Read(_gif,_buf,_len) : \ fread(_buf,1,_len,((GifFilePrivateType*)_gif->Private)->File)) static int DGifGetWord(GifFileType *GifFile, int *Word); diff --git a/jdk/src/share/native/sun/font/fontscalerdefs.h b/jdk/src/share/native/sun/font/fontscalerdefs.h index 4e1bb99e9c3..8f142752af9 100644 --- a/jdk/src/share/native/sun/font/fontscalerdefs.h +++ b/jdk/src/share/native/sun/font/fontscalerdefs.h @@ -55,13 +55,15 @@ typedef Int32 hsFixed; typedef Int32 hsFract; typedef UInt32 Bool32; +#ifndef __cplusplus #ifndef false - #define false 0 + #define false 0 #endif #ifndef true #define true 1 #endif +#endif #define kPosInfinity32 (0x7fffffff) #define kNegInfinity32 (0x80000000) diff --git a/jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp b/jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp index 806f2dc5813..adc30bd526d 100644 --- a/jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp +++ b/jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp @@ -162,7 +162,7 @@ static le_int32 decompose(LEUnicode syllable, LEUnicode &lead, LEUnicode &vowel, return 0; } - lead = LJMO_FIRST + (sIndex / HSYL_LVCNT); + lead = (LEUnicode)(LJMO_FIRST + (sIndex / HSYL_LVCNT)); vowel = VJMO_FIRST + (sIndex % HSYL_LVCNT) / TJMO_COUNT; trail = TJMO_FIRST + (sIndex % TJMO_COUNT); diff --git a/jdk/src/share/native/sun/font/layout/MPreFixups.cpp b/jdk/src/share/native/sun/font/layout/MPreFixups.cpp index 673ea32ca16..254b3b01ace 100644 --- a/jdk/src/share/native/sun/font/layout/MPreFixups.cpp +++ b/jdk/src/share/native/sun/font/layout/MPreFixups.cpp @@ -65,9 +65,9 @@ void MPreFixups::add(le_int32 baseIndex, le_int32 mpreIndex) } } -void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& success) +void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& leSuccess) { - if (LE_FAILURE(success)) { + if (LE_FAILURE(leSuccess)) { return; } diff --git a/jdk/src/solaris/native/sun/awt/fontpath.c b/jdk/src/solaris/native/sun/awt/fontpath.c index 68c352db16c..98d6f1419fc 100644 --- a/jdk/src/solaris/native/sun/awt/fontpath.c +++ b/jdk/src/solaris/native/sun/awt/fontpath.c @@ -1107,7 +1107,8 @@ Java_sun_font_FontConfigManager_getFontConfig arrlen = (*env)->GetArrayLength(env, fcCompFontArray); for (i=0; iNewString(env, lpelfe->elfFullName, - wcslen((LPWSTR)lpelfe->elfFullName)); + (jsize)wcslen((LPWSTR)lpelfe->elfFullName)); fullnameLC = (*env)->CallObjectMethod(env, fullname, fmi->toLowerCaseMID, fmi->locale); (*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname); @@ -314,7 +314,7 @@ static int CALLBACK EnumFamilyNamesW( GdiFontMapInfo *fmi = (GdiFontMapInfo*)lParam; JNIEnv *env = fmi->env; jstring familyLC; - int slen; + size_t slen; LOGFONTW lfw; /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */ @@ -336,7 +336,7 @@ static int CALLBACK EnumFamilyNamesW( return 1; } slen = wcslen(lpelfe->elfLogFont.lfFaceName); - fmi->family = (*env)->NewString(env,lpelfe->elfLogFont.lfFaceName, slen); + fmi->family = (*env)->NewString(env,lpelfe->elfLogFont.lfFaceName, (jsize)slen); familyLC = (*env)->CallObjectMethod(env, fmi->family, fmi->toLowerCaseMID, fmi->locale); /* check if already seen this family with a different charset */ @@ -386,10 +386,10 @@ static int CALLBACK EnumFamilyNamesW( static BOOL RegistryToBaseTTNameA(LPSTR name) { static const char TTSUFFIX[] = " (TrueType)"; static const char OTSUFFIX[] = " (OpenType)"; - int TTSLEN = strlen(TTSUFFIX); + size_t TTSLEN = strlen(TTSUFFIX); char *suffix; - int len = strlen(name); + size_t len = strlen(name); if (len == 0) { return FALSE; } @@ -412,10 +412,10 @@ static BOOL RegistryToBaseTTNameA(LPSTR name) { static BOOL RegistryToBaseTTNameW(LPWSTR name) { static const wchar_t TTSUFFIX[] = L" (TrueType)"; static const wchar_t OTSUFFIX[] = L" (OpenType)"; - int TTSLEN = wcslen(TTSUFFIX); + size_t TTSLEN = wcslen(TTSUFFIX); wchar_t *suffix; - int len = wcslen(name); + size_t len = wcslen(name); if (len == 0) { return FALSE; } @@ -439,7 +439,7 @@ static void registerFontA(GdiFontMapInfo *fmi, jobject fontToFileMap, LPSTR ptr1, ptr2; jstring fontStr; JNIEnv *env = fmi->env; - int dslen = strlen(data); + size_t dslen = strlen(data); jstring fileStr = JNU_NewStringPlatform(env, data); /* TTC or ttc means it may be a collection. Need to parse out @@ -488,8 +488,8 @@ static void registerFontW(GdiFontMapInfo *fmi, jobject fontToFileMap, wchar_t *ptr1, *ptr2; jstring fontStr; JNIEnv *env = fmi->env; - int dslen = wcslen(data); - jstring fileStr = (*env)->NewString(env, data, dslen); + size_t dslen = wcslen(data); + jstring fileStr = (*env)->NewString(env, data, (jsize)dslen); /* TTC or ttc means it may be a collection. Need to parse out * multiple font face names separated by " & " @@ -510,7 +510,7 @@ static void registerFontW(GdiFontMapInfo *fmi, jobject fontToFileMap, while ((ptr2 = wcsstr(ptr1, L" & ")) != NULL) { ptr1 = ptr2+3; } - fontStr = (*env)->NewString(env, ptr1, wcslen(ptr1)); + fontStr = (*env)->NewString(env, ptr1, (jsize)wcslen(ptr1)); fontStr = (*env)->CallObjectMethod(env, fontStr, fmi->toLowerCaseMID, fmi->locale); @@ -524,7 +524,7 @@ static void registerFontW(GdiFontMapInfo *fmi, jobject fontToFileMap, } } } else { - fontStr = (*env)->NewString(env, name, wcslen(name)); + fontStr = (*env)->NewString(env, name, (jsize)wcslen(name)); fontStr = (*env)->CallObjectMethod(env, fontStr, fmi->toLowerCaseMID, fmi->locale); (*env)->CallObjectMethod(env, fontToFileMap, fmi->putMID, From 75eac4de0f1d459f0fe1dfefa68700662c29a6b5 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Wed, 20 Apr 2011 09:29:00 -0700 Subject: [PATCH 015/117] 7009346: java/dyn/InvokeDynamicPrintArgs.java fails with NPE on solaris-sparc with -Xcomp Reviewed-by: kvn, jrose, twisti --- hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp index 397a59431bc..ac9e39fb6bf 100644 --- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp @@ -486,7 +486,7 @@ void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHan if (ek == _invokespecial_mh) { // Must load & check the first argument before entering the target method. __ load_method_handle_vmslots(O0_argslot, G3_method_handle, O1_scratch); - __ ld_ptr(__ argument_address(O0_argslot), G3_method_handle); + __ ld_ptr(__ argument_address(O0_argslot, -1), G3_method_handle); __ null_check(G3_method_handle); __ verify_oop(G3_method_handle); } From 46259d93bafd4f37136eed70013a1bf54dbcef91 Mon Sep 17 00:00:00 2001 From: Vladimir Danushevsky Date: Wed, 20 Apr 2011 14:07:57 -0400 Subject: [PATCH 016/117] 7035861: linux-armsflt: assert(ni->data() == (int)(x + o)) failed: instructions must match The change avoids generating relocation info entry for the staging area patching stub on systems that don't support movw/movt instructions Reviewed-by: bdelsart --- hotspot/src/share/vm/c1/c1_Runtime1.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp index 03e83420d45..8e012443504 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp @@ -1026,9 +1026,21 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i // first replace the tail, then the call #ifdef ARM if(stub_id == Runtime1::load_klass_patching_id && !VM_Version::supports_movw()) { + nmethod* nm = CodeCache::find_nmethod(instr_pc); + oop* oop_addr = NULL; + assert(nm != NULL, "invalid nmethod_pc"); + RelocIterator oops(nm, copy_buff, copy_buff + 1); + while (oops.next()) { + if (oops.type() == relocInfo::oop_type) { + oop_Relocation* r = oops.oop_reloc(); + oop_addr = r->oop_addr(); + break; + } + } + assert(oop_addr != NULL, "oop relocation must exist"); copy_buff -= *byte_count; NativeMovConstReg* n_copy2 = nativeMovConstReg_at(copy_buff); - n_copy2->set_data((intx) (load_klass()), instr_pc); + n_copy2->set_pc_relative_offset((address)oop_addr, instr_pc); } #endif From 7d1c44eae43e722dd4f9cde369e83f310ee2bb53 Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Wed, 20 Apr 2011 16:30:38 -0700 Subject: [PATCH 017/117] 6896297: (rmi) fix ConcurrentModificationException causing TCK failure Reviewed-by: alanb, dholmes, peterjones --- .../classes/sun/rmi/log/ReliableLog.java | 4 +- .../classes/sun/rmi/server/Activation.java | 123 ++++++++++-------- 2 files changed, 73 insertions(+), 54 deletions(-) diff --git a/jdk/src/share/classes/sun/rmi/log/ReliableLog.java b/jdk/src/share/classes/sun/rmi/log/ReliableLog.java index 30ea3f1d464..fe512c2d87c 100644 --- a/jdk/src/share/classes/sun/rmi/log/ReliableLog.java +++ b/jdk/src/share/classes/sun/rmi/log/ReliableLog.java @@ -380,9 +380,7 @@ public class ReliableLog { } catch (IOException e) { throw e; } catch (Exception e) { - throw new IOException("snapshot failed with exception of type: " + - e.getClass().getName() + - ", message was: " + e.getMessage()); + throw new IOException("snapshot failed", e); } lastSnapshot = System.currentTimeMillis(); } finally { diff --git a/jdk/src/share/classes/sun/rmi/server/Activation.java b/jdk/src/share/classes/sun/rmi/server/Activation.java index 119910ed5cc..919edb7fb65 100644 --- a/jdk/src/share/classes/sun/rmi/server/Activation.java +++ b/jdk/src/share/classes/sun/rmi/server/Activation.java @@ -30,6 +30,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.ObjectInputStream; import java.io.OutputStream; import java.io.PrintStream; import java.io.PrintWriter; @@ -98,6 +99,7 @@ import java.util.MissingResourceException; import java.util.Properties; import java.util.ResourceBundle; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import sun.rmi.log.LogHandler; import sun.rmi.log.ReliableLog; import sun.rmi.registry.RegistryImpl; @@ -147,10 +149,10 @@ public class Activation implements Serializable { /** maps activation id to its respective group id */ private Map idTable = - new HashMap(); + new ConcurrentHashMap<>(); /** maps group id to its GroupEntry groups */ private Map groupTable = - new HashMap(); + new ConcurrentHashMap<>(); private byte majorVersion = MAJOR_VERSION; private byte minorVersion = MINOR_VERSION; @@ -236,9 +238,11 @@ public class Activation implements Serializable { groupSemaphore = getInt("sun.rmi.activation.groupThrottle", 3); groupCounter = 0; Runtime.getRuntime().addShutdownHook(shutdownHook); + + // Use array size of 0, since the value from calling size() + // may be out of date by the time toArray() is called. ActivationGroupID[] gids = - groupTable.keySet().toArray( - new ActivationGroupID[groupTable.size()]); + groupTable.keySet().toArray(new ActivationGroupID[0]); synchronized (startupLock = new Object()) { // all the remote methods briefly synchronize on startupLock @@ -274,6 +278,23 @@ public class Activation implements Serializable { } } + /** + * Previous versions used HashMap instead of ConcurrentHashMap. + * Replace any HashMaps found during deserialization with + * ConcurrentHashMaps. + */ + private void readObject(ObjectInputStream ois) + throws IOException, ClassNotFoundException + { + ois.defaultReadObject(); + if (! (groupTable instanceof ConcurrentHashMap)) { + groupTable = new ConcurrentHashMap<>(groupTable); + } + if (! (idTable instanceof ConcurrentHashMap)) { + idTable = new ConcurrentHashMap<>(idTable); + } + } + private static class SystemRegistryImpl extends RegistryImpl { private static final String NAME = ActivationSystem.class.getName(); @@ -488,9 +509,7 @@ public class Activation implements Serializable { ActivationGroupID id = new ActivationGroupID(systemStub); GroupEntry entry = new GroupEntry(id, desc); // table insertion must take place before log update - synchronized (groupTable) { - groupTable.put(id, entry); - } + groupTable.put(id, entry); addLogRecord(new LogRegisterGroup(id, desc)); return id; } @@ -515,11 +534,7 @@ public class Activation implements Serializable { // remove entry before unregister so state is updated before // logged - synchronized (groupTable) { - GroupEntry entry = getGroupEntry(id); - groupTable.remove(id); - entry.unregisterGroup(true); - } + removeGroupEntry(id).unregisterGroup(true); } public ActivationDesc setActivationDesc(ActivationID id, @@ -637,12 +652,7 @@ public class Activation implements Serializable { unexport(system); // destroy all child processes (groups) - GroupEntry[] groupEntries; - synchronized (groupTable) { - groupEntries = groupTable.values(). - toArray(new GroupEntry[groupTable.size()]); - } - for (GroupEntry groupEntry : groupEntries) { + for (GroupEntry groupEntry : groupTable.values()) { groupEntry.shutdown(); } @@ -693,10 +703,8 @@ public class Activation implements Serializable { } // destroy all child processes (groups) quickly - synchronized (groupTable) { - for (GroupEntry groupEntry : groupTable.values()) { - groupEntry.shutdownFast(); - } + for (GroupEntry groupEntry : groupTable.values()) { + groupEntry.shutdownFast(); } } } @@ -708,15 +716,34 @@ public class Activation implements Serializable { private ActivationGroupID getGroupID(ActivationID id) throws UnknownObjectException { - synchronized (idTable) { - ActivationGroupID groupID = idTable.get(id); - if (groupID != null) { - return groupID; - } + ActivationGroupID groupID = idTable.get(id); + if (groupID != null) { + return groupID; } throw new UnknownObjectException("unknown object: " + id); } + /** + * Returns the group entry for the group id, optionally removing it. + * Throws UnknownGroupException if the group is not registered. + */ + private GroupEntry getGroupEntry(ActivationGroupID id, boolean rm) + throws UnknownGroupException + { + if (id.getClass() == ActivationGroupID.class) { + GroupEntry entry; + if (rm) { + entry = groupTable.remove(id); + } else { + entry = groupTable.get(id); + } + if (entry != null && !entry.removed) { + return entry; + } + } + throw new UnknownGroupException("group unknown"); + } + /** * Returns the group entry for the group id. Throws * UnknownGroupException if the group is not registered. @@ -724,15 +751,17 @@ public class Activation implements Serializable { private GroupEntry getGroupEntry(ActivationGroupID id) throws UnknownGroupException { - if (id.getClass() == ActivationGroupID.class) { - synchronized (groupTable) { - GroupEntry entry = groupTable.get(id); - if (entry != null && !entry.removed) { - return entry; - } - } - } - throw new UnknownGroupException("group unknown"); + return getGroupEntry(id, false); + } + + /** + * Removes and returns the group entry for the group id. Throws + * UnknownGroupException if the group is not registered. + */ + private GroupEntry removeGroupEntry(ActivationGroupID id) + throws UnknownGroupException + { + return getGroupEntry(id, true); } /** @@ -744,11 +773,9 @@ public class Activation implements Serializable { throws UnknownObjectException { ActivationGroupID gid = getGroupID(id); - synchronized (groupTable) { - GroupEntry entry = groupTable.get(gid); - if (entry != null) { - return entry; - } + GroupEntry entry = groupTable.get(gid); + if (entry != null && !entry.removed) { + return entry; } throw new UnknownObjectException("object's group removed"); } @@ -882,9 +909,7 @@ public class Activation implements Serializable { } // table insertion must take place before log update - synchronized (idTable) { - idTable.put(id, groupID); - } + idTable.put(id, groupID); if (addRecord) { addLogRecord(new LogRegisterObject(id, desc)); @@ -901,10 +926,8 @@ public class Activation implements Serializable { restartSet.remove(id); } - // table insertion must take place before log update - synchronized (idTable) { - idTable.remove(id); - } + // table removal must take place before log update + idTable.remove(id); if (addRecord) { addLogRecord(new LogUnregisterObject(id)); } @@ -919,9 +942,7 @@ public class Activation implements Serializable { objects.entrySet()) { ActivationID id = entry.getKey(); - synchronized (idTable) { - idTable.remove(id); - } + idTable.remove(id); ObjectEntry objEntry = entry.getValue(); objEntry.removed = true; } From cf6f747d172817d2573e5012b6677d0d21dcbc0e Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Wed, 20 Apr 2011 17:12:04 -0700 Subject: [PATCH 018/117] 7034464: Support transparent large pages on Linux Support transparent huge pages on Linux available since 2.6.38 Reviewed-by: iveresov, ysr --- hotspot/src/os/linux/vm/globals_linux.hpp | 20 +++-- hotspot/src/os/linux/vm/os_linux.cpp | 102 +++++++++++++++++++--- hotspot/src/os/linux/vm/os_linux.hpp | 3 + 3 files changed, 107 insertions(+), 18 deletions(-) diff --git a/hotspot/src/os/linux/vm/globals_linux.hpp b/hotspot/src/os/linux/vm/globals_linux.hpp index cd74589e40c..9b1a164a6ed 100644 --- a/hotspot/src/os/linux/vm/globals_linux.hpp +++ b/hotspot/src/os/linux/vm/globals_linux.hpp @@ -29,13 +29,19 @@ // Defines Linux specific flags. They are not available on other platforms. // #define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct) \ - product(bool, UseOprofile, false, \ - "enable support for Oprofile profiler") \ - \ - product(bool, UseLinuxPosixThreadCPUClocks, true, \ - "enable fast Linux Posix clocks where available") -// NB: The default value of UseLinuxPosixThreadCPUClocks may be -// overridden in Arguments::parse_each_vm_init_arg. + product(bool, UseOprofile, false, \ + "enable support for Oprofile profiler") \ + \ + product(bool, UseLinuxPosixThreadCPUClocks, true, \ + "enable fast Linux Posix clocks where available") \ +/* NB: The default value of UseLinuxPosixThreadCPUClocks may be \ + overridden in Arguments::parse_each_vm_init_arg. */ \ + \ + product(bool, UseHugeTLBFS, false, \ + "Use MAP_HUGETLB for large pages") \ + \ + product(bool, UseSHM, false, \ + "Use SYSV shared memory for large pages") // // Defines Linux-specific default values. The flags are available on all diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index a3975d89892..cb3959a6831 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -2465,16 +2465,40 @@ bool os::commit_memory(char* addr, size_t size, bool exec) { return res != (uintptr_t) MAP_FAILED; } +// Define MAP_HUGETLB here so we can build HotSpot on old systems. +#ifndef MAP_HUGETLB +#define MAP_HUGETLB 0x40000 +#endif + +// Define MADV_HUGEPAGE here so we can build HotSpot on old systems. +#ifndef MADV_HUGEPAGE +#define MADV_HUGEPAGE 14 +#endif + bool os::commit_memory(char* addr, size_t size, size_t alignment_hint, bool exec) { + if (UseHugeTLBFS && alignment_hint > (size_t)vm_page_size()) { + int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE; + uintptr_t res = + (uintptr_t) ::mmap(addr, size, prot, + MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_HUGETLB, + -1, 0); + return res != (uintptr_t) MAP_FAILED; + } + return commit_memory(addr, size, exec); } -void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { } +void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { + if (UseHugeTLBFS && alignment_hint > (size_t)vm_page_size()) { + // We don't check the return value: madvise(MADV_HUGEPAGE) may not + // be supported or the memory may already be backed by huge pages. + ::madvise(addr, bytes, MADV_HUGEPAGE); + } +} void os::free_memory(char *addr, size_t bytes) { - ::mmap(addr, bytes, PROT_READ | PROT_WRITE, - MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0); + ::madvise(addr, bytes, MADV_DONTNEED); } void os::numa_make_global(char *addr, size_t bytes) { @@ -2818,6 +2842,43 @@ bool os::unguard_memory(char* addr, size_t size) { return linux_mprotect(addr, size, PROT_READ|PROT_WRITE); } +bool os::Linux::hugetlbfs_sanity_check(bool warn, size_t page_size) { + bool result = false; + void *p = mmap (NULL, page_size, PROT_READ|PROT_WRITE, + MAP_ANONYMOUS|MAP_PRIVATE|MAP_HUGETLB, + -1, 0); + + if (p != (void *) -1) { + // We don't know if this really is a huge page or not. + FILE *fp = fopen("/proc/self/maps", "r"); + if (fp) { + while (!feof(fp)) { + char chars[257]; + long x = 0; + if (fgets(chars, sizeof(chars), fp)) { + if (sscanf(chars, "%lx-%*lx", &x) == 1 + && x == (long)p) { + if (strstr (chars, "hugepage")) { + result = true; + break; + } + } + } + } + fclose(fp); + } + munmap (p, page_size); + if (result) + return true; + } + + if (warn) { + warning("HugeTLBFS is not supported by the operating system."); + } + + return result; +} + /* * Set the coredump_filter bits to include largepages in core dump (bit 6) * @@ -2860,7 +2921,16 @@ static void set_coredump_filter(void) { static size_t _large_page_size = 0; bool os::large_page_init() { - if (!UseLargePages) return false; + if (!UseLargePages) { + UseHugeTLBFS = false; + UseSHM = false; + return false; + } + + if (FLAG_IS_DEFAULT(UseHugeTLBFS) && FLAG_IS_DEFAULT(UseSHM)) { + // Our user has not expressed a preference, so we'll try both. + UseHugeTLBFS = UseSHM = true; + } if (LargePageSizeInBytes) { _large_page_size = LargePageSizeInBytes; @@ -2905,6 +2975,9 @@ bool os::large_page_init() { } } + // print a warning if any large page related flag is specified on command line + bool warn_on_failure = !FLAG_IS_DEFAULT(UseHugeTLBFS); + const size_t default_page_size = (size_t)Linux::page_size(); if (_large_page_size > default_page_size) { _page_sizes[0] = _large_page_size; @@ -2912,6 +2985,14 @@ bool os::large_page_init() { _page_sizes[2] = 0; } + UseHugeTLBFS = UseHugeTLBFS && + Linux::hugetlbfs_sanity_check(warn_on_failure, _large_page_size); + + if (UseHugeTLBFS) + UseSHM = false; + + UseLargePages = UseHugeTLBFS || UseSHM; + set_coredump_filter(); // Large page support is available on 2.6 or newer kernel, some vendors @@ -2928,7 +3009,7 @@ bool os::large_page_init() { char* os::reserve_memory_special(size_t bytes, char* req_addr, bool exec) { // "exec" is passed in but not used. Creating the shared image for // the code cache doesn't have an SHM_X executable permission to check. - assert(UseLargePages, "only for large pages"); + assert(UseLargePages && UseSHM, "only for SHM large pages"); key_t key = IPC_PRIVATE; char *addr; @@ -2995,16 +3076,15 @@ size_t os::large_page_size() { return _large_page_size; } -// Linux does not support anonymous mmap with large page memory. The only way -// to reserve large page memory without file backing is through SysV shared -// memory API. The entire memory region is committed and pinned upfront. -// Hopefully this will change in the future... +// HugeTLBFS allows application to commit large page memory on demand; +// with SysV SHM the entire memory region must be allocated as shared +// memory. bool os::can_commit_large_page_memory() { - return false; + return UseHugeTLBFS; } bool os::can_execute_large_page_memory() { - return false; + return UseHugeTLBFS; } // Reserve memory at an arbitrary address, only if that area is diff --git a/hotspot/src/os/linux/vm/os_linux.hpp b/hotspot/src/os/linux/vm/os_linux.hpp index 18803ac3496..c0a63fe88ea 100644 --- a/hotspot/src/os/linux/vm/os_linux.hpp +++ b/hotspot/src/os/linux/vm/os_linux.hpp @@ -86,6 +86,9 @@ class Linux { static void rebuild_cpu_to_node_map(); static GrowableArray* cpu_to_node() { return _cpu_to_node; } + + static bool hugetlbfs_sanity_check(bool warn, size_t page_size); + public: static void init_thread_fpu_state(); static int get_fpu_control_word(); From 1a7f59d292a3b75fa9b7db38db05343cb241a3f3 Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Wed, 20 Apr 2011 17:20:00 -0700 Subject: [PATCH 019/117] 6546713: link the word (optional) in exception specifications to the text which provides explanation and context Reviewed-by: dholmes, dl --- .../share/classes/java/util/AbstractSet.java | 6 ++- .../share/classes/java/util/ArrayList.java | 12 ++++-- .../share/classes/java/util/Collection.java | 36 +++++++++++----- .../share/classes/java/util/Collections.java | 5 ++- jdk/src/share/classes/java/util/Deque.java | 24 +++++++---- jdk/src/share/classes/java/util/List.java | 43 +++++++++++++------ jdk/src/share/classes/java/util/Map.java | 25 +++++++---- jdk/src/share/classes/java/util/Set.java | 31 ++++++++----- jdk/src/share/classes/java/util/Vector.java | 14 ++++-- 9 files changed, 133 insertions(+), 63 deletions(-) diff --git a/jdk/src/share/classes/java/util/AbstractSet.java b/jdk/src/share/classes/java/util/AbstractSet.java index b99da00826d..1f1a49c250e 100644 --- a/jdk/src/share/classes/java/util/AbstractSet.java +++ b/jdk/src/share/classes/java/util/AbstractSet.java @@ -156,9 +156,11 @@ public abstract class AbstractSet extends AbstractCollection implements Se * @throws UnsupportedOperationException if the removeAll operation * is not supported by this set * @throws ClassCastException if the class of an element of this set - * is incompatible with the specified collection (optional) + * is incompatible with the specified collection + * (optional) * @throws NullPointerException if this set contains a null element and the - * specified collection does not permit null elements (optional), + * specified collection does not permit null elements + * (optional), * or if the specified collection is null * @see #remove(Object) * @see #contains(Object) diff --git a/jdk/src/share/classes/java/util/ArrayList.java b/jdk/src/share/classes/java/util/ArrayList.java index 128ec5b5fd8..14b0fbf5599 100644 --- a/jdk/src/share/classes/java/util/ArrayList.java +++ b/jdk/src/share/classes/java/util/ArrayList.java @@ -628,9 +628,11 @@ public class ArrayList extends AbstractList * @param c collection containing elements to be removed from this list * @return {@code true} if this list changed as a result of the call * @throws ClassCastException if the class of an element of this list - * is incompatible with the specified collection (optional) + * is incompatible with the specified collection + * (optional) * @throws NullPointerException if this list contains a null element and the - * specified collection does not permit null elements (optional), + * specified collection does not permit null elements + * (optional), * or if the specified collection is null * @see Collection#contains(Object) */ @@ -646,9 +648,11 @@ public class ArrayList extends AbstractList * @param c collection containing elements to be retained in this list * @return {@code true} if this list changed as a result of the call * @throws ClassCastException if the class of an element of this list - * is incompatible with the specified collection (optional) + * is incompatible with the specified collection + * (optional) * @throws NullPointerException if this list contains a null element and the - * specified collection does not permit null elements (optional), + * specified collection does not permit null elements + * (optional), * or if the specified collection is null * @see Collection#contains(Object) */ diff --git a/jdk/src/share/classes/java/util/Collection.java b/jdk/src/share/classes/java/util/Collection.java index 7d0bcdc5aa3..b8f5869e861 100644 --- a/jdk/src/share/classes/java/util/Collection.java +++ b/jdk/src/share/classes/java/util/Collection.java @@ -60,7 +60,8 @@ package java.util; * but is not required to, throw the exception if the collection to be added * is empty. * - *

    Some collection implementations have restrictions on the elements that + *

    + * Some collection implementations have restrictions on the elements that * they may contain. For example, some implementations prohibit null elements, * and some have restrictions on the types of their elements. Attempting to * add an ineligible element throws an unchecked exception, typically @@ -152,9 +153,11 @@ public interface Collection extends Iterable { * @return true if this collection contains the specified * element * @throws ClassCastException if the type of the specified element - * is incompatible with this collection (optional) + * is incompatible with this collection + * (optional) * @throws NullPointerException if the specified element is null and this - * collection does not permit null elements (optional) + * collection does not permit null elements + * (optional) */ boolean contains(Object o); @@ -279,9 +282,11 @@ public interface Collection extends Iterable { * @param o element to be removed from this collection, if present * @return true if an element was removed as a result of this call * @throws ClassCastException if the type of the specified element - * is incompatible with this collection (optional) + * is incompatible with this collection + * (optional) * @throws NullPointerException if the specified element is null and this - * collection does not permit null elements (optional) + * collection does not permit null elements + * (optional) * @throws UnsupportedOperationException if the remove operation * is not supported by this collection */ @@ -299,10 +304,13 @@ public interface Collection extends Iterable { * in the specified collection * @throws ClassCastException if the types of one or more elements * in the specified collection are incompatible with this - * collection (optional) + * collection + * (optional) * @throws NullPointerException if the specified collection contains one * or more null elements and this collection does not permit null - * elements (optional), or if the specified collection is null + * elements + * (optional), + * or if the specified collection is null. * @see #contains(Object) */ boolean containsAll(Collection c); @@ -346,10 +354,13 @@ public interface Collection extends Iterable { * is not supported by this collection * @throws ClassCastException if the types of one or more elements * in this collection are incompatible with the specified - * collection (optional) + * collection + * (optional) * @throws NullPointerException if this collection contains one or more * null elements and the specified collection does not support - * null elements (optional), or if the specified collection is null + * null elements + * (optional), + * or if the specified collection is null * @see #remove(Object) * @see #contains(Object) */ @@ -367,10 +378,13 @@ public interface Collection extends Iterable { * is not supported by this collection * @throws ClassCastException if the types of one or more elements * in this collection are incompatible with the specified - * collection (optional) + * collection + * (optional) * @throws NullPointerException if this collection contains one or more * null elements and the specified collection does not permit null - * elements (optional), or if the specified collection is null + * elements + * (optional), + * or if the specified collection is null * @see #remove(Object) * @see #contains(Object) */ diff --git a/jdk/src/share/classes/java/util/Collections.java b/jdk/src/share/classes/java/util/Collections.java index 80221c8795b..d15a4292ddd 100644 --- a/jdk/src/share/classes/java/util/Collections.java +++ b/jdk/src/share/classes/java/util/Collections.java @@ -3746,9 +3746,10 @@ public class Collections { * @throws NullPointerException if either collection is {@code null}. * @throws NullPointerException if one collection contains a {@code null} * element and {@code null} is not an eligible element for the other collection. - * (optional) + * (optional) * @throws ClassCastException if one collection contains an element that is - * of a type which is ineligible for the other collection. (optional) + * of a type which is ineligible for the other collection. + * (optional) * @since 1.5 */ public static boolean disjoint(Collection c1, Collection c2) { diff --git a/jdk/src/share/classes/java/util/Deque.java b/jdk/src/share/classes/java/util/Deque.java index b5516211be6..051ae9cca46 100644 --- a/jdk/src/share/classes/java/util/Deque.java +++ b/jdk/src/share/classes/java/util/Deque.java @@ -351,9 +351,11 @@ public interface Deque extends Queue { * @param o element to be removed from this deque, if present * @return true if an element was removed as a result of this call * @throws ClassCastException if the class of the specified element - * is incompatible with this deque (optional) + * is incompatible with this deque + * (optional) * @throws NullPointerException if the specified element is null and this - * deque does not permit null elements (optional) + * deque does not permit null elements + * (optional) */ boolean removeFirstOccurrence(Object o); @@ -369,9 +371,11 @@ public interface Deque extends Queue { * @param o element to be removed from this deque, if present * @return true if an element was removed as a result of this call * @throws ClassCastException if the class of the specified element - * is incompatible with this deque (optional) + * is incompatible with this deque + * (optional) * @throws NullPointerException if the specified element is null and this - * deque does not permit null elements (optional) + * deque does not permit null elements + * (optional) */ boolean removeLastOccurrence(Object o); @@ -527,9 +531,11 @@ public interface Deque extends Queue { * @param o element to be removed from this deque, if present * @return true if an element was removed as a result of this call * @throws ClassCastException if the class of the specified element - * is incompatible with this deque (optional) + * is incompatible with this deque + * (optional) * @throws NullPointerException if the specified element is null and this - * deque does not permit null elements (optional) + * deque does not permit null elements + * (optional) */ boolean remove(Object o); @@ -542,9 +548,11 @@ public interface Deque extends Queue { * @param o element whose presence in this deque is to be tested * @return true if this deque contains the specified element * @throws ClassCastException if the type of the specified element - * is incompatible with this deque (optional) + * is incompatible with this deque + * (optional) * @throws NullPointerException if the specified element is null and this - * deque does not permit null elements (optional) + * deque does not permit null elements + * (optional) */ boolean contains(Object o); diff --git a/jdk/src/share/classes/java/util/List.java b/jdk/src/share/classes/java/util/List.java index 638fcc3a7d1..d3d2a1b8947 100644 --- a/jdk/src/share/classes/java/util/List.java +++ b/jdk/src/share/classes/java/util/List.java @@ -134,9 +134,11 @@ public interface List extends Collection { * @param o element whose presence in this list is to be tested * @return true if this list contains the specified element * @throws ClassCastException if the type of the specified element - * is incompatible with this list (optional) + * is incompatible with this list + * (optional) * @throws NullPointerException if the specified element is null and this - * list does not permit null elements (optional) + * list does not permit null elements + * (optional) */ boolean contains(Object o); @@ -245,9 +247,11 @@ public interface List extends Collection { * @param o element to be removed from this list, if present * @return true if this list contained the specified element * @throws ClassCastException if the type of the specified element - * is incompatible with this list (optional) + * is incompatible with this list + * (optional) * @throws NullPointerException if the specified element is null and this - * list does not permit null elements (optional) + * list does not permit null elements + * (optional) * @throws UnsupportedOperationException if the remove operation * is not supported by this list */ @@ -265,10 +269,13 @@ public interface List extends Collection { * specified collection * @throws ClassCastException if the types of one or more elements * in the specified collection are incompatible with this - * list (optional) + * list + * (optional) * @throws NullPointerException if the specified collection contains one * or more null elements and this list does not permit null - * elements (optional), or if the specified collection is null + * elements + * (optional), + * or if the specified collection is null * @see #contains(Object) */ boolean containsAll(Collection c); @@ -334,9 +341,11 @@ public interface List extends Collection { * @throws UnsupportedOperationException if the removeAll operation * is not supported by this list * @throws ClassCastException if the class of an element of this list - * is incompatible with the specified collection (optional) + * is incompatible with the specified collection + * (optional) * @throws NullPointerException if this list contains a null element and the - * specified collection does not permit null elements (optional), + * specified collection does not permit null elements + * (optional), * or if the specified collection is null * @see #remove(Object) * @see #contains(Object) @@ -354,9 +363,11 @@ public interface List extends Collection { * @throws UnsupportedOperationException if the retainAll operation * is not supported by this list * @throws ClassCastException if the class of an element of this list - * is incompatible with the specified collection (optional) + * is incompatible with the specified collection + * (optional) * @throws NullPointerException if this list contains a null element and the - * specified collection does not permit null elements (optional), + * specified collection does not permit null elements + * (optional), * or if the specified collection is null * @see #remove(Object) * @see #contains(Object) @@ -493,9 +504,11 @@ public interface List extends Collection { * @return the index of the first occurrence of the specified element in * this list, or -1 if this list does not contain the element * @throws ClassCastException if the type of the specified element - * is incompatible with this list (optional) + * is incompatible with this list + * (optional) * @throws NullPointerException if the specified element is null and this - * list does not permit null elements (optional) + * list does not permit null elements + * (optional) */ int indexOf(Object o); @@ -510,9 +523,11 @@ public interface List extends Collection { * @return the index of the last occurrence of the specified element in * this list, or -1 if this list does not contain the element * @throws ClassCastException if the type of the specified element - * is incompatible with this list (optional) + * is incompatible with this list + * (optional) * @throws NullPointerException if the specified element is null and this - * list does not permit null elements (optional) + * list does not permit null elements + * (optional) */ int lastIndexOf(Object o); diff --git a/jdk/src/share/classes/java/util/Map.java b/jdk/src/share/classes/java/util/Map.java index 2f8f1315c1f..ccdb28813a2 100644 --- a/jdk/src/share/classes/java/util/Map.java +++ b/jdk/src/share/classes/java/util/Map.java @@ -144,9 +144,11 @@ public interface Map { * @return true if this map contains a mapping for the specified * key * @throws ClassCastException if the key is of an inappropriate type for - * this map (optional) + * this map + * (optional) * @throws NullPointerException if the specified key is null and this map - * does not permit null keys (optional) + * does not permit null keys + * (optional) */ boolean containsKey(Object key); @@ -162,9 +164,11 @@ public interface Map { * @return true if this map maps one or more keys to the * specified value * @throws ClassCastException if the value is of an inappropriate type for - * this map (optional) + * this map + * (optional) * @throws NullPointerException if the specified value is null and this - * map does not permit null values (optional) + * map does not permit null values + * (optional) */ boolean containsValue(Object value); @@ -187,9 +191,11 @@ public interface Map { * @return the value to which the specified key is mapped, or * {@code null} if this map contains no mapping for the key * @throws ClassCastException if the key is of an inappropriate type for - * this map (optional) + * this map + * (optional) * @throws NullPointerException if the specified key is null and this map - * does not permit null keys (optional) + * does not permit null keys + * (optional) */ V get(Object key); @@ -245,9 +251,11 @@ public interface Map { * @throws UnsupportedOperationException if the remove operation * is not supported by this map * @throws ClassCastException if the key is of an inappropriate type for - * this map (optional) + * this map + * (optional) * @throws NullPointerException if the specified key is null and this - * map does not permit null keys (optional) + * map does not permit null keys + * (optional) */ V remove(Object key); @@ -466,4 +474,5 @@ public interface Map { * @see #equals(Object) */ int hashCode(); + } diff --git a/jdk/src/share/classes/java/util/Set.java b/jdk/src/share/classes/java/util/Set.java index 8d54f4f9d45..004e9708e56 100644 --- a/jdk/src/share/classes/java/util/Set.java +++ b/jdk/src/share/classes/java/util/Set.java @@ -110,9 +110,11 @@ public interface Set extends Collection { * @param o element whose presence in this set is to be tested * @return true if this set contains the specified element * @throws ClassCastException if the type of the specified element - * is incompatible with this set (optional) + * is incompatible with this set + * (optional) * @throws NullPointerException if the specified element is null and this - * set does not permit null elements (optional) + * set does not permit null elements + * (optional) */ boolean contains(Object o); @@ -236,9 +238,11 @@ public interface Set extends Collection { * @param o object to be removed from this set, if present * @return true if this set contained the specified element * @throws ClassCastException if the type of the specified element - * is incompatible with this set (optional) + * is incompatible with this set + * (optional) * @throws NullPointerException if the specified element is null and this - * set does not permit null elements (optional) + * set does not permit null elements + * (optional) * @throws UnsupportedOperationException if the remove operation * is not supported by this set */ @@ -257,10 +261,13 @@ public interface Set extends Collection { * specified collection * @throws ClassCastException if the types of one or more elements * in the specified collection are incompatible with this - * set (optional) + * set + * (optional) * @throws NullPointerException if the specified collection contains one * or more null elements and this set does not permit null - * elements (optional), or if the specified collection is null + * elements + * (optional), + * or if the specified collection is null * @see #contains(Object) */ boolean containsAll(Collection c); @@ -302,9 +309,11 @@ public interface Set extends Collection { * @throws UnsupportedOperationException if the retainAll operation * is not supported by this set * @throws ClassCastException if the class of an element of this set - * is incompatible with the specified collection (optional) + * is incompatible with the specified collection + * (optional) * @throws NullPointerException if this set contains a null element and the - * specified collection does not permit null elements (optional), + * specified collection does not permit null elements + * (optional), * or if the specified collection is null * @see #remove(Object) */ @@ -322,9 +331,11 @@ public interface Set extends Collection { * @throws UnsupportedOperationException if the removeAll operation * is not supported by this set * @throws ClassCastException if the class of an element of this set - * is incompatible with the specified collection (optional) + * is incompatible with the specified collection + * (optional) * @throws NullPointerException if this set contains a null element and the - * specified collection does not permit null elements (optional), + * specified collection does not permit null elements + * (optional), * or if the specified collection is null * @see #remove(Object) * @see #contains(Object) diff --git a/jdk/src/share/classes/java/util/Vector.java b/jdk/src/share/classes/java/util/Vector.java index 0c89889b19b..0d69591abce 100644 --- a/jdk/src/share/classes/java/util/Vector.java +++ b/jdk/src/share/classes/java/util/Vector.java @@ -893,10 +893,13 @@ public class Vector * @return true if this Vector changed as a result of the call * @throws ClassCastException if the types of one or more elements * in this vector are incompatible with the specified - * collection (optional) + * collection + * (optional) * @throws NullPointerException if this vector contains one or more null * elements and the specified collection does not support null - * elements (optional), or if the specified collection is null + * elements + * (optional), + * or if the specified collection is null * @since 1.2 */ public synchronized boolean removeAll(Collection c) { @@ -913,10 +916,13 @@ public class Vector * @return true if this Vector changed as a result of the call * @throws ClassCastException if the types of one or more elements * in this vector are incompatible with the specified - * collection (optional) + * collection + * (optional) * @throws NullPointerException if this vector contains one or more null * elements and the specified collection does not support null - * elements (optional), or if the specified collection is null + * elements + * (optional), + * or if the specified collection is null * @since 1.2 */ public synchronized boolean retainAll(Collection c) { From abc5f94df75ac9e50fce5a85292e4444206e746c Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Wed, 20 Apr 2011 18:29:35 -0700 Subject: [PATCH 020/117] 7026700: regression in 6u24-rev-b23: Crash in C2 compiler in PhaseIdealLoop::build_loop_late_post Memory slices should be always created for non-static fields after allocation Reviewed-by: never --- hotspot/src/share/vm/opto/escape.cpp | 11 ++-- hotspot/src/share/vm/opto/graphKit.cpp | 12 ++--- hotspot/src/share/vm/opto/graphKit.hpp | 6 +-- hotspot/src/share/vm/opto/library_call.cpp | 10 ++-- hotspot/src/share/vm/opto/memnode.cpp | 58 ++++++++++------------ 5 files changed, 43 insertions(+), 54 deletions(-) diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp index a7b509e34c5..21cc00c9cc2 100644 --- a/hotspot/src/share/vm/opto/escape.cpp +++ b/hotspot/src/share/vm/opto/escape.cpp @@ -1437,7 +1437,10 @@ void ConnectionGraph::split_unique_types(GrowableArray &alloc_worklist) // Update the memory inputs of MemNodes with the value we computed // in Phase 2 and move stores memory users to corresponding memory slices. -#ifdef ASSERT + + // Disable memory split verification code until the fix for 6984348. + // Currently it produces false negative results since it does not cover all cases. +#if 0 // ifdef ASSERT visited.Reset(); Node_Stack old_mems(arena, _compile->unique() >> 2); #endif @@ -1447,7 +1450,7 @@ void ConnectionGraph::split_unique_types(GrowableArray &alloc_worklist) Node *n = ptnode_adr(i)->_node; assert(n != NULL, "sanity"); if (n->is_Mem()) { -#ifdef ASSERT +#if 0 // ifdef ASSERT Node* old_mem = n->in(MemNode::Memory); if (!visited.test_set(old_mem->_idx)) { old_mems.push(old_mem, old_mem->outcnt()); @@ -1469,13 +1472,13 @@ void ConnectionGraph::split_unique_types(GrowableArray &alloc_worklist) } } } -#ifdef ASSERT +#if 0 // ifdef ASSERT // Verify that memory was split correctly while (old_mems.is_nonempty()) { Node* old_mem = old_mems.node(); uint old_cnt = old_mems.index(); old_mems.pop(); - assert(old_cnt = old_mem->outcnt(), "old mem could be lost"); + assert(old_cnt == old_mem->outcnt(), "old mem could be lost"); } #endif } diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index afa2efff986..590c05fb35d 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -2950,8 +2950,7 @@ static void hook_memory_on_init(GraphKit& kit, int alias_idx, //---------------------------set_output_for_allocation------------------------- Node* GraphKit::set_output_for_allocation(AllocateNode* alloc, - const TypeOopPtr* oop_type, - bool raw_mem_only) { + const TypeOopPtr* oop_type) { int rawidx = Compile::AliasIdxRaw; alloc->set_req( TypeFunc::FramePtr, frameptr() ); add_safepoint_edges(alloc); @@ -2975,7 +2974,7 @@ Node* GraphKit::set_output_for_allocation(AllocateNode* alloc, rawoop)->as_Initialize(); assert(alloc->initialization() == init, "2-way macro link must work"); assert(init ->allocation() == alloc, "2-way macro link must work"); - if (ReduceFieldZeroing && !raw_mem_only) { + { // Extract memory strands which may participate in the new object's // initialization, and source them from the new InitializeNode. // This will allow us to observe initializations when they occur, @@ -3036,11 +3035,9 @@ Node* GraphKit::set_output_for_allocation(AllocateNode* alloc, // the type to a constant. // The optional arguments are for specialized use by intrinsics: // - If 'extra_slow_test' if not null is an extra condition for the slow-path. -// - If 'raw_mem_only', do not cast the result to an oop. // - If 'return_size_val', report the the total object size to the caller. Node* GraphKit::new_instance(Node* klass_node, Node* extra_slow_test, - bool raw_mem_only, // affect only raw memory Node* *return_size_val) { // Compute size in doublewords // The size is always an integral number of doublewords, represented @@ -3111,7 +3108,7 @@ Node* GraphKit::new_instance(Node* klass_node, size, klass_node, initial_slow_test); - return set_output_for_allocation(alloc, oop_type, raw_mem_only); + return set_output_for_allocation(alloc, oop_type); } //-------------------------------new_array------------------------------------- @@ -3121,7 +3118,6 @@ Node* GraphKit::new_instance(Node* klass_node, Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) Node* length, // number of array elements int nargs, // number of arguments to push back for uncommon trap - bool raw_mem_only, // affect only raw memory Node* *return_size_val) { jint layout_con = Klass::_lh_neutral_value; Node* layout_val = get_layout_helper(klass_node, layout_con); @@ -3266,7 +3262,7 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) ary_type = ary_type->is_aryptr()->cast_to_size(length_type); } - Node* javaoop = set_output_for_allocation(alloc, ary_type, raw_mem_only); + Node* javaoop = set_output_for_allocation(alloc, ary_type); // Cast length on remaining path to be as narrow as possible if (map()->find_edge(length) >= 0) { diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp index 4523326dbaf..724e5bda501 100644 --- a/hotspot/src/share/vm/opto/graphKit.hpp +++ b/hotspot/src/share/vm/opto/graphKit.hpp @@ -769,15 +769,13 @@ class GraphKit : public Phase { // implementation of object creation Node* set_output_for_allocation(AllocateNode* alloc, - const TypeOopPtr* oop_type, - bool raw_mem_only); + const TypeOopPtr* oop_type); Node* get_layout_helper(Node* klass_node, jint& constant_value); Node* new_instance(Node* klass_node, Node* slow_test = NULL, - bool raw_mem_only = false, Node* *return_size_val = NULL); Node* new_array(Node* klass_node, Node* count_val, int nargs, - bool raw_mem_only = false, Node* *return_size_val = NULL); + Node* *return_size_val = NULL); // Handy for making control flow IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) { diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 0f73e144d17..2ace3655978 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -3376,8 +3376,7 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) { Node* orig_tail = _gvn.transform( new(C, 3) SubINode(orig_length, start) ); Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length); - const bool raw_mem_only = true; - newcopy = new_array(klass_node, length, 0, raw_mem_only); + newcopy = new_array(klass_node, length, 0); // Generate a direct call to the right arraycopy function(s). // We know the copy is disjoint but we might not know if the @@ -4174,8 +4173,6 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM; int raw_adr_idx = Compile::AliasIdxRaw; - const bool raw_mem_only = true; - Node* array_ctl = generate_array_guard(obj_klass, (RegionNode*)NULL); if (array_ctl != NULL) { @@ -4184,8 +4181,7 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { set_control(array_ctl); Node* obj_length = load_array_length(obj); Node* obj_size = NULL; - Node* alloc_obj = new_array(obj_klass, obj_length, 0, - raw_mem_only, &obj_size); + Node* alloc_obj = new_array(obj_klass, obj_length, 0, &obj_size); if (!use_ReduceInitialCardMarks()) { // If it is an oop array, it requires very special treatment, @@ -4257,7 +4253,7 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { // It's an instance, and it passed the slow-path tests. PreserveJVMState pjvms(this); Node* obj_size = NULL; - Node* alloc_obj = new_instance(obj_klass, NULL, raw_mem_only, &obj_size); + Node* alloc_obj = new_instance(obj_klass, NULL, &obj_size); copy_to_clone(obj, alloc_obj, obj_size, false, !use_ReduceInitialCardMarks()); diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index d5d53132a3a..804ebee5d1b 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -1259,15 +1259,18 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) { return NULL; // Wait stable graph } uint cnt = mem->req(); - for( uint i = 1; i < cnt; i++ ) { + for (uint i = 1; i < cnt; i++) { + Node* rc = region->in(i); + if (rc == NULL || phase->type(rc) == Type::TOP) + return NULL; // Wait stable graph Node *in = mem->in(i); - if( in == NULL ) { + if (in == NULL) { return NULL; // Wait stable graph } } // Check for loop invariant. if (cnt == 3) { - for( uint i = 1; i < cnt; i++ ) { + for (uint i = 1; i < cnt; i++) { Node *in = mem->in(i); Node* m = MemNode::optimize_memory_chain(in, addr_t, phase); if (m == mem) { @@ -1281,38 +1284,37 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) { // Do nothing here if Identity will find a value // (to avoid infinite chain of value phis generation). - if ( !phase->eqv(this, this->Identity(phase)) ) + if (!phase->eqv(this, this->Identity(phase))) return NULL; // Skip the split if the region dominates some control edge of the address. - if (cnt == 3 && !MemNode::all_controls_dominate(address, region)) + if (!MemNode::all_controls_dominate(address, region)) return NULL; const Type* this_type = this->bottom_type(); int this_index = phase->C->get_alias_index(addr_t); int this_offset = addr_t->offset(); int this_iid = addr_t->is_oopptr()->instance_id(); - int wins = 0; PhaseIterGVN *igvn = phase->is_IterGVN(); Node *phi = new (igvn->C, region->req()) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset); - for( uint i = 1; i < region->req(); i++ ) { + for (uint i = 1; i < region->req(); i++) { Node *x; Node* the_clone = NULL; - if( region->in(i) == phase->C->top() ) { + if (region->in(i) == phase->C->top()) { x = phase->C->top(); // Dead path? Use a dead data op } else { x = this->clone(); // Else clone up the data op the_clone = x; // Remember for possible deletion. // Alter data node to use pre-phi inputs - if( this->in(0) == region ) { - x->set_req( 0, region->in(i) ); + if (this->in(0) == region) { + x->set_req(0, region->in(i)); } else { - x->set_req( 0, NULL ); + x->set_req(0, NULL); } - for( uint j = 1; j < this->req(); j++ ) { + for (uint j = 1; j < this->req(); j++) { Node *in = this->in(j); - if( in->is_Phi() && in->in(0) == region ) - x->set_req( j, in->in(i) ); // Use pre-Phi input for the clone + if (in->is_Phi() && in->in(0) == region) + x->set_req(j, in->in(i)); // Use pre-Phi input for the clone } } // Check for a 'win' on some paths @@ -1321,12 +1323,11 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) { bool singleton = t->singleton(); // See comments in PhaseIdealLoop::split_thru_phi(). - if( singleton && t == Type::TOP ) { + if (singleton && t == Type::TOP) { singleton &= region->is_Loop() && (i != LoopNode::EntryControl); } - if( singleton ) { - wins++; + if (singleton) { x = igvn->makecon(t); } else { // We now call Identity to try to simplify the cloned node. @@ -1340,13 +1341,11 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) { // igvn->type(x) is set to x->Value() already. x->raise_bottom_type(t); Node *y = x->Identity(igvn); - if( y != x ) { - wins++; + if (y != x) { x = y; } else { y = igvn->hash_find(x); - if( y ) { - wins++; + if (y) { x = y; } else { // Else x is a new node we are keeping @@ -1360,13 +1359,9 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) { igvn->remove_dead_node(the_clone); phi->set_req(i, x); } - if( wins > 0 ) { - // Record Phi - igvn->register_new_node_with_optimizer(phi); - return phi; - } - igvn->remove_dead_node(phi); - return NULL; + // Record Phi + igvn->register_new_node_with_optimizer(phi); + return phi; } //------------------------------Ideal------------------------------------------ @@ -1677,14 +1672,15 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const { // If we are loading from a freshly-allocated object, produce a zero, // if the load is provably beyond the header of the object. // (Also allow a variable load from a fresh array to produce zero.) - if (ReduceFieldZeroing) { + const TypeOopPtr *tinst = tp->isa_oopptr(); + bool is_instance = (tinst != NULL) && tinst->is_known_instance_field(); + if (ReduceFieldZeroing || is_instance) { Node* value = can_see_stored_value(mem,phase); if (value != NULL && value->is_Con()) return value->bottom_type(); } - const TypeOopPtr *tinst = tp->isa_oopptr(); - if (tinst != NULL && tinst->is_known_instance_field()) { + if (is_instance) { // If we have an instance type and our memory input is the // programs's initial memory state, there is no matching store, // so just return a zero of the appropriate type From b4d40650b2f38f81ade028db8cb5f17ae7eb940e Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Wed, 20 Apr 2011 19:19:30 -0700 Subject: [PATCH 021/117] 7037276: Unnecessary double traversal of dirty card windows Short-circuited an unnecessary double traversal of dirty card windows when iterating younger refs. Also renamed some cardtable methods for more clarity. Reviewed-by: jmasa, stefank, poonam --- .../parNew/parCardTableModRefBS.cpp | 79 ++++---- .../src/share/vm/memory/cardTableModRefBS.cpp | 32 +-- .../src/share/vm/memory/cardTableModRefBS.hpp | 40 ++-- hotspot/src/share/vm/memory/cardTableRS.cpp | 190 +++++++++--------- hotspot/src/share/vm/memory/cardTableRS.hpp | 19 +- 5 files changed, 198 insertions(+), 162 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp index 58dea49b77f..afc8797ea33 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp @@ -33,44 +33,43 @@ #include "runtime/mutexLocker.hpp" #include "runtime/virtualspace.hpp" -void CardTableModRefBS::par_non_clean_card_iterate_work(Space* sp, MemRegion mr, - DirtyCardToOopClosure* dcto_cl, - MemRegionClosure* cl, - int n_threads) { - if (n_threads > 0) { - assert((n_threads == 1 && ParallelGCThreads == 0) || - n_threads <= (int)ParallelGCThreads, - "# worker threads != # requested!"); - // Make sure the LNC array is valid for the space. - jbyte** lowest_non_clean; - uintptr_t lowest_non_clean_base_chunk_index; - size_t lowest_non_clean_chunk_size; - get_LNC_array_for_space(sp, lowest_non_clean, - lowest_non_clean_base_chunk_index, - lowest_non_clean_chunk_size); +void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, + DirtyCardToOopClosure* dcto_cl, + ClearNoncleanCardWrapper* cl, + int n_threads) { + assert(n_threads > 0, "Error: expected n_threads > 0"); + assert((n_threads == 1 && ParallelGCThreads == 0) || + n_threads <= (int)ParallelGCThreads, + "# worker threads != # requested!"); + // Make sure the LNC array is valid for the space. + jbyte** lowest_non_clean; + uintptr_t lowest_non_clean_base_chunk_index; + size_t lowest_non_clean_chunk_size; + get_LNC_array_for_space(sp, lowest_non_clean, + lowest_non_clean_base_chunk_index, + lowest_non_clean_chunk_size); - int n_strides = n_threads * StridesPerThread; - SequentialSubTasksDone* pst = sp->par_seq_tasks(); - pst->set_n_threads(n_threads); - pst->set_n_tasks(n_strides); + int n_strides = n_threads * StridesPerThread; + SequentialSubTasksDone* pst = sp->par_seq_tasks(); + pst->set_n_threads(n_threads); + pst->set_n_tasks(n_strides); - int stride = 0; - while (!pst->is_task_claimed(/* reference */ stride)) { - process_stride(sp, mr, stride, n_strides, dcto_cl, cl, - lowest_non_clean, - lowest_non_clean_base_chunk_index, - lowest_non_clean_chunk_size); - } - if (pst->all_tasks_completed()) { - // Clear lowest_non_clean array for next time. - intptr_t first_chunk_index = addr_to_chunk_index(mr.start()); - uintptr_t last_chunk_index = addr_to_chunk_index(mr.last()); - for (uintptr_t ch = first_chunk_index; ch <= last_chunk_index; ch++) { - intptr_t ind = ch - lowest_non_clean_base_chunk_index; - assert(0 <= ind && ind < (intptr_t)lowest_non_clean_chunk_size, - "Bounds error"); - lowest_non_clean[ind] = NULL; - } + int stride = 0; + while (!pst->is_task_claimed(/* reference */ stride)) { + process_stride(sp, mr, stride, n_strides, dcto_cl, cl, + lowest_non_clean, + lowest_non_clean_base_chunk_index, + lowest_non_clean_chunk_size); + } + if (pst->all_tasks_completed()) { + // Clear lowest_non_clean array for next time. + intptr_t first_chunk_index = addr_to_chunk_index(mr.start()); + uintptr_t last_chunk_index = addr_to_chunk_index(mr.last()); + for (uintptr_t ch = first_chunk_index; ch <= last_chunk_index; ch++) { + intptr_t ind = ch - lowest_non_clean_base_chunk_index; + assert(0 <= ind && ind < (intptr_t)lowest_non_clean_chunk_size, + "Bounds error"); + lowest_non_clean[ind] = NULL; } } } @@ -81,7 +80,7 @@ process_stride(Space* sp, MemRegion used, jint stride, int n_strides, DirtyCardToOopClosure* dcto_cl, - MemRegionClosure* cl, + ClearNoncleanCardWrapper* cl, jbyte** lowest_non_clean, uintptr_t lowest_non_clean_base_chunk_index, size_t lowest_non_clean_chunk_size) { @@ -127,7 +126,11 @@ process_stride(Space* sp, lowest_non_clean_base_chunk_index, lowest_non_clean_chunk_size); - non_clean_card_iterate_work(chunk_mr, cl); + // We do not call the non_clean_card_iterate_serial() version because + // we want to clear the cards, and the ClearNoncleanCardWrapper closure + // itself does the work of finding contiguous dirty ranges of cards to + // process (and clear). + cl->do_MemRegion(chunk_mr); // Find the next chunk of the stride. chunk_card_start += CardsPerStrideChunk * n_strides; diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp index 0f221653985..abdd31bdb27 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp @@ -456,31 +456,35 @@ bool CardTableModRefBS::mark_card_deferred(size_t card_index) { } -void CardTableModRefBS::non_clean_card_iterate(Space* sp, - MemRegion mr, - DirtyCardToOopClosure* dcto_cl, - MemRegionClosure* cl) { +void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp, + MemRegion mr, + DirtyCardToOopClosure* dcto_cl, + ClearNoncleanCardWrapper* cl) { if (!mr.is_empty()) { int n_threads = SharedHeap::heap()->n_par_threads(); if (n_threads > 0) { #ifndef SERIALGC - par_non_clean_card_iterate_work(sp, mr, dcto_cl, cl, n_threads); + non_clean_card_iterate_parallel_work(sp, mr, dcto_cl, cl, n_threads); #else // SERIALGC fatal("Parallel gc not supported here."); #endif // SERIALGC } else { - non_clean_card_iterate_work(mr, cl); + // We do not call the non_clean_card_iterate_serial() version below because + // we want to clear the cards (which non_clean_card_iterate_serial() does not + // do for us), and the ClearNoncleanCardWrapper closure itself does the work + // of finding contiguous dirty ranges of cards to process (and clear). + cl->do_MemRegion(mr); } } } -// NOTE: For this to work correctly, it is important that -// we look for non-clean cards below (so as to catch those -// marked precleaned), rather than look explicitly for dirty -// cards (and miss those marked precleaned). In that sense, -// the name precleaned is currently somewhat of a misnomer. -void CardTableModRefBS::non_clean_card_iterate_work(MemRegion mr, - MemRegionClosure* cl) { +// The iterator itself is not MT-aware, but +// MT-aware callers and closures can use this to +// accomplish dirty card iteration in parallel. The +// iterator itself does not clear the dirty cards, or +// change their values in any manner. +void CardTableModRefBS::non_clean_card_iterate_serial(MemRegion mr, + MemRegionClosure* cl) { for (int i = 0; i < _cur_covered_regions; i++) { MemRegion mri = mr.intersection(_covered[i]); if (mri.word_size() > 0) { @@ -661,7 +665,7 @@ public: void CardTableModRefBS::verify_clean_region(MemRegion mr) { GuaranteeNotModClosure blk(this); - non_clean_card_iterate_work(mr, &blk); + non_clean_card_iterate_serial(mr, &blk); } // To verify a MemRegion is entirely dirty this closure is passed to diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp index 833a67109b2..770a8e578cc 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp @@ -44,6 +44,7 @@ class Generation; class OopsInGenClosure; class DirtyCardToOopClosure; +class ClearNoncleanCardWrapper; class CardTableModRefBS: public ModRefBarrierSet { // Some classes get to look at some private stuff. @@ -165,22 +166,28 @@ class CardTableModRefBS: public ModRefBarrierSet { // Iterate over the portion of the card-table which covers the given // region mr in the given space and apply cl to any dirty sub-regions - // of mr. cl and dcto_cl must either be the same closure or cl must - // wrap dcto_cl. Both are required - neither may be NULL. Also, dcto_cl - // may be modified. Note that this function will operate in a parallel - // mode if worker threads are available. - void non_clean_card_iterate(Space* sp, MemRegion mr, - DirtyCardToOopClosure* dcto_cl, - MemRegionClosure* cl); + // of mr. Dirty cards are _not_ cleared by the iterator method itself, + // but closures may arrange to do so on their own should they so wish. + void non_clean_card_iterate_serial(MemRegion mr, MemRegionClosure* cl); - // Utility function used to implement the other versions below. - void non_clean_card_iterate_work(MemRegion mr, MemRegionClosure* cl); + // A variant of the above that will operate in a parallel mode if + // worker threads are available, and clear the dirty cards as it + // processes them. + // ClearNoncleanCardWrapper cl must wrap the DirtyCardToOopClosure dcto_cl, + // which may itself be modified by the method. + void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr, + DirtyCardToOopClosure* dcto_cl, + ClearNoncleanCardWrapper* cl); - void par_non_clean_card_iterate_work(Space* sp, MemRegion mr, - DirtyCardToOopClosure* dcto_cl, - MemRegionClosure* cl, - int n_threads); + private: + // Work method used to implement non_clean_card_iterate_possibly_parallel() + // above in the parallel case. + void non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, + DirtyCardToOopClosure* dcto_cl, + ClearNoncleanCardWrapper* cl, + int n_threads); + protected: // Dirty the bytes corresponding to "mr" (not all of which must be // covered.) void dirty_MemRegion(MemRegion mr); @@ -237,7 +244,7 @@ class CardTableModRefBS: public ModRefBarrierSet { MemRegion used, jint stride, int n_strides, DirtyCardToOopClosure* dcto_cl, - MemRegionClosure* cl, + ClearNoncleanCardWrapper* cl, jbyte** lowest_non_clean, uintptr_t lowest_non_clean_base_chunk_index, size_t lowest_non_clean_chunk_size); @@ -409,14 +416,14 @@ public: // marking, where a dirty card may cause scanning, and summarization // marking, of objects that extend onto subsequent cards.) void mod_card_iterate(MemRegionClosure* cl) { - non_clean_card_iterate_work(_whole_heap, cl); + non_clean_card_iterate_serial(_whole_heap, cl); } // Like the "mod_cards_iterate" above, except only invokes the closure // for cards within the MemRegion "mr" (which is required to be // card-aligned and sized.) void mod_card_iterate(MemRegion mr, MemRegionClosure* cl) { - non_clean_card_iterate_work(mr, cl); + non_clean_card_iterate_serial(mr, cl); } static uintx ct_max_alignment_constraint(); @@ -493,4 +500,5 @@ public: void set_CTRS(CardTableRS* rs) { _rs = rs; } }; + #endif // SHARE_VM_MEMORY_CARDTABLEMODREFBS_HPP diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp index 3f8b46a4b5f..4a22ba73a21 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.cpp +++ b/hotspot/src/share/vm/memory/cardTableRS.cpp @@ -105,107 +105,111 @@ void CardTableRS::younger_refs_iterate(Generation* g, g->younger_refs_iterate(blk); } -class ClearNoncleanCardWrapper: public MemRegionClosure { - MemRegionClosure* _dirty_card_closure; - CardTableRS* _ct; - bool _is_par; -private: - // Clears the given card, return true if the corresponding card should be - // processed. - bool clear_card(jbyte* entry) { - if (_is_par) { - while (true) { - // In the parallel case, we may have to do this several times. - jbyte entry_val = *entry; - assert(entry_val != CardTableRS::clean_card_val(), - "We shouldn't be looking at clean cards, and this should " - "be the only place they get cleaned."); - if (CardTableRS::card_is_dirty_wrt_gen_iter(entry_val) - || _ct->is_prev_youngergen_card_val(entry_val)) { - jbyte res = - Atomic::cmpxchg(CardTableRS::clean_card_val(), entry, entry_val); - if (res == entry_val) { - break; - } else { - assert(res == CardTableRS::cur_youngergen_and_prev_nonclean_card, - "The CAS above should only fail if another thread did " - "a GC write barrier."); - } - } else if (entry_val == - CardTableRS::cur_youngergen_and_prev_nonclean_card) { - // Parallelism shouldn't matter in this case. Only the thread - // assigned to scan the card should change this value. - *entry = _ct->cur_youngergen_card_val(); - break; - } else { - assert(entry_val == _ct->cur_youngergen_card_val(), - "Should be the only possibility."); - // In this case, the card was clean before, and become - // cur_youngergen only because of processing of a promoted object. - // We don't have to look at the card. - return false; - } +inline bool ClearNoncleanCardWrapper::clear_card(jbyte* entry) { + if (_is_par) { + return clear_card_parallel(entry); + } else { + return clear_card_serial(entry); + } +} + +inline bool ClearNoncleanCardWrapper::clear_card_parallel(jbyte* entry) { + while (true) { + // In the parallel case, we may have to do this several times. + jbyte entry_val = *entry; + assert(entry_val != CardTableRS::clean_card_val(), + "We shouldn't be looking at clean cards, and this should " + "be the only place they get cleaned."); + if (CardTableRS::card_is_dirty_wrt_gen_iter(entry_val) + || _ct->is_prev_youngergen_card_val(entry_val)) { + jbyte res = + Atomic::cmpxchg(CardTableRS::clean_card_val(), entry, entry_val); + if (res == entry_val) { + break; + } else { + assert(res == CardTableRS::cur_youngergen_and_prev_nonclean_card, + "The CAS above should only fail if another thread did " + "a GC write barrier."); } - return true; + } else if (entry_val == + CardTableRS::cur_youngergen_and_prev_nonclean_card) { + // Parallelism shouldn't matter in this case. Only the thread + // assigned to scan the card should change this value. + *entry = _ct->cur_youngergen_card_val(); + break; } else { - jbyte entry_val = *entry; - assert(entry_val != CardTableRS::clean_card_val(), - "We shouldn't be looking at clean cards, and this should " - "be the only place they get cleaned."); - assert(entry_val != CardTableRS::cur_youngergen_and_prev_nonclean_card, - "This should be possible in the sequential case."); - *entry = CardTableRS::clean_card_val(); - return true; + assert(entry_val == _ct->cur_youngergen_card_val(), + "Should be the only possibility."); + // In this case, the card was clean before, and become + // cur_youngergen only because of processing of a promoted object. + // We don't have to look at the card. + return false; } } + return true; +} -public: - ClearNoncleanCardWrapper(MemRegionClosure* dirty_card_closure, - CardTableRS* ct) : + +inline bool ClearNoncleanCardWrapper::clear_card_serial(jbyte* entry) { + jbyte entry_val = *entry; + assert(entry_val != CardTableRS::clean_card_val(), + "We shouldn't be looking at clean cards, and this should " + "be the only place they get cleaned."); + assert(entry_val != CardTableRS::cur_youngergen_and_prev_nonclean_card, + "This should be possible in the sequential case."); + *entry = CardTableRS::clean_card_val(); + return true; +} + +ClearNoncleanCardWrapper::ClearNoncleanCardWrapper( + MemRegionClosure* dirty_card_closure, CardTableRS* ct) : _dirty_card_closure(dirty_card_closure), _ct(ct) { _is_par = (SharedHeap::heap()->n_par_threads() > 0); - } - void do_MemRegion(MemRegion mr) { - // We start at the high end of "mr", walking backwards - // while accumulating a contiguous dirty range of cards in - // [start_of_non_clean, end_of_non_clean) which we then - // process en masse. - HeapWord* end_of_non_clean = mr.end(); - HeapWord* start_of_non_clean = end_of_non_clean; - jbyte* entry = _ct->byte_for(mr.last()); - const jbyte* first_entry = _ct->byte_for(mr.start()); - while (entry >= first_entry) { - HeapWord* cur = _ct->addr_for(entry); - if (!clear_card(entry)) { - // We hit a clean card; process any non-empty - // dirty range accumulated so far. - if (start_of_non_clean < end_of_non_clean) { - MemRegion mr2(start_of_non_clean, end_of_non_clean); - _dirty_card_closure->do_MemRegion(mr2); - } - // Reset the dirty window while continuing to - // look for the next dirty window to process. - end_of_non_clean = cur; - start_of_non_clean = end_of_non_clean; +} + +void ClearNoncleanCardWrapper::do_MemRegion(MemRegion mr) { + assert(mr.word_size() > 0, "Error"); + assert(_ct->is_aligned(mr.start()), "mr.start() should be card aligned"); + // mr.end() may not necessarily be card aligned. + jbyte* cur_entry = _ct->byte_for(mr.last()); + const jbyte* limit = _ct->byte_for(mr.start()); + HeapWord* end_of_non_clean = mr.end(); + HeapWord* start_of_non_clean = end_of_non_clean; + while (cur_entry >= limit) { + HeapWord* cur_hw = _ct->addr_for(cur_entry); + if ((*cur_entry != CardTableRS::clean_card_val()) && clear_card(cur_entry)) { + // Continue the dirty range by opening the + // dirty window one card to the left. + start_of_non_clean = cur_hw; + } else { + // We hit a "clean" card; process any non-empty + // "dirty" range accumulated so far. + if (start_of_non_clean < end_of_non_clean) { + const MemRegion mrd(start_of_non_clean, end_of_non_clean); + _dirty_card_closure->do_MemRegion(mrd); } - // Open the left end of the window one card to the left. - start_of_non_clean = cur; - // Note that "entry" leads "start_of_non_clean" in - // its leftward excursion after this point - // in the loop and, when we hit the left end of "mr", - // will point off of the left end of the card-table - // for "mr". - entry--; - } - // If the first card of "mr" was dirty, we will have - // been left with a dirty window, co-initial with "mr", - // which we now process. - if (start_of_non_clean < end_of_non_clean) { - MemRegion mr2(start_of_non_clean, end_of_non_clean); - _dirty_card_closure->do_MemRegion(mr2); + // Reset the dirty window, while continuing to look + // for the next dirty card that will start a + // new dirty window. + end_of_non_clean = cur_hw; + start_of_non_clean = cur_hw; } + // Note that "cur_entry" leads "start_of_non_clean" in + // its leftward excursion after this point + // in the loop and, when we hit the left end of "mr", + // will point off of the left end of the card-table + // for "mr". + cur_entry--; } -}; + // If the first card of "mr" was dirty, we will have + // been left with a dirty window, co-initial with "mr", + // which we now process. + if (start_of_non_clean < end_of_non_clean) { + const MemRegion mrd(start_of_non_clean, end_of_non_clean); + _dirty_card_closure->do_MemRegion(mrd); + } +} + // clean (by dirty->clean before) ==> cur_younger_gen // dirty ==> cur_youngergen_and_prev_nonclean_card // precleaned ==> cur_youngergen_and_prev_nonclean_card @@ -246,8 +250,8 @@ void CardTableRS::younger_refs_in_space_iterate(Space* sp, cl->gen_boundary()); ClearNoncleanCardWrapper clear_cl(dcto_cl, this); - _ct_bs->non_clean_card_iterate(sp, sp->used_region_at_save_marks(), - dcto_cl, &clear_cl); + _ct_bs->non_clean_card_iterate_possibly_parallel(sp, sp->used_region_at_save_marks(), + dcto_cl, &clear_cl); } void CardTableRS::clear_into_younger(Generation* gen, bool clear_perm) { diff --git a/hotspot/src/share/vm/memory/cardTableRS.hpp b/hotspot/src/share/vm/memory/cardTableRS.hpp index 13015488550..72c5dacf83d 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.hpp +++ b/hotspot/src/share/vm/memory/cardTableRS.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -166,4 +166,21 @@ public: }; +class ClearNoncleanCardWrapper: public MemRegionClosure { + MemRegionClosure* _dirty_card_closure; + CardTableRS* _ct; + bool _is_par; +private: + // Clears the given card, return true if the corresponding card should be + // processed. + inline bool clear_card(jbyte* entry); + // Work methods called by the clear_card() + inline bool clear_card_serial(jbyte* entry); + inline bool clear_card_parallel(jbyte* entry); + +public: + ClearNoncleanCardWrapper(MemRegionClosure* dirty_card_closure, CardTableRS* ct); + void do_MemRegion(MemRegion mr); +}; + #endif // SHARE_VM_MEMORY_CARDTABLERS_HPP From 868bf68a3e0640e12cb0af432848cd7b75395f50 Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Thu, 21 Apr 2011 00:25:40 -0700 Subject: [PATCH 022/117] 6993078: JSR 292 too many pushes: Lesp points into register window Reviewed-by: kvn, never --- .../src/cpu/sparc/vm/templateTable_sparc.cpp | 4 ++-- .../src/cpu/x86/vm/templateTable_x86_32.cpp | 14 ++++++------- .../src/cpu/x86/vm/templateTable_x86_64.cpp | 13 ++++++------ hotspot/src/share/vm/ci/ciEnv.cpp | 4 ++-- hotspot/src/share/vm/oops/cpCacheOop.cpp | 20 ++++++++++--------- 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index 9f4bcc6b4d6..85c34513fca 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -3289,8 +3289,6 @@ void TemplateTable::invokedynamic(int byte_no) { /*virtual*/ false, /*vfinal*/ false, /*indy*/ true); __ mov(SP, O5_savedSP); // record SP that we wanted the callee to restore - __ verify_oop(G5_callsite); - // profile this call __ profile_call(O4); @@ -3303,8 +3301,10 @@ void TemplateTable::invokedynamic(int byte_no) { __ sll(Rret, LogBytesPerWord, Rret); __ ld_ptr(Rtemp, Rret, Rret); // get return address + __ verify_oop(G5_callsite); __ load_heap_oop(G5_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, Rscratch), G3_method_handle); __ null_check(G3_method_handle); + __ verify_oop(G3_method_handle); // Adjust Rret first so Llast_SP can be same as Rret __ add(Rret, -frame::pc_return_offset, O7); diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp index 483660826ac..a1aa37d7870 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp @@ -3074,6 +3074,7 @@ void TemplateTable::invokeinterface(int byte_no) { void TemplateTable::invokedynamic(int byte_no) { transition(vtos, vtos); + assert(byte_no == f1_oop, "use this argument"); if (!EnableInvokeDynamic) { // We should not encounter this bytecode if !EnableInvokeDynamic. @@ -3086,7 +3087,6 @@ void TemplateTable::invokedynamic(int byte_no) { return; } - assert(byte_no == f1_oop, "use this argument"); prepare_invoke(rax, rbx, byte_no); // rax: CallSite object (f1) @@ -3097,14 +3097,14 @@ void TemplateTable::invokedynamic(int byte_no) { Register rax_callsite = rax; Register rcx_method_handle = rcx; - if (ProfileInterpreter) { - // %%% should make a type profile for any invokedynamic that takes a ref argument - // profile this call - __ profile_call(rsi); - } + // %%% should make a type profile for any invokedynamic that takes a ref argument + // profile this call + __ profile_call(rsi); - __ load_heap_oop(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rcx))); + __ verify_oop(rax_callsite); + __ load_heap_oop(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rdx))); __ null_check(rcx_method_handle); + __ verify_oop(rcx_method_handle); __ prepare_to_jump_from_interpreted(); __ jump_to_method_handle_entry(rcx_method_handle, rdx); } diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp index e1ec5ad4474..446c23f9de7 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp @@ -3128,7 +3128,6 @@ void TemplateTable::invokedynamic(int byte_no) { return; } - assert(byte_no == f1_oop, "use this argument"); prepare_invoke(rax, rbx, byte_no); // rax: CallSite object (f1) @@ -3139,14 +3138,14 @@ void TemplateTable::invokedynamic(int byte_no) { Register rax_callsite = rax; Register rcx_method_handle = rcx; - if (ProfileInterpreter) { - // %%% should make a type profile for any invokedynamic that takes a ref argument - // profile this call - __ profile_call(r13); - } + // %%% should make a type profile for any invokedynamic that takes a ref argument + // profile this call + __ profile_call(r13); - __ load_heap_oop(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rcx))); + __ verify_oop(rax_callsite); + __ load_heap_oop(rcx_method_handle, Address(rax_callsite, __ delayed_value(java_lang_invoke_CallSite::target_offset_in_bytes, rdx))); __ null_check(rcx_method_handle); + __ verify_oop(rcx_method_handle); __ prepare_to_jump_from_interpreted(); __ jump_to_method_handle_entry(rcx_method_handle, rdx); } diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp index 66e23490c09..96ff5a0e8e3 100644 --- a/hotspot/src/share/vm/ci/ciEnv.cpp +++ b/hotspot/src/share/vm/ci/ciEnv.cpp @@ -756,7 +756,7 @@ ciMethod* ciEnv::get_fake_invokedynamic_method_impl(constantPoolHandle cpool, assert(bc == Bytecodes::_invokedynamic, "must be invokedynamic"); bool is_resolved = cpool->cache()->main_entry_at(index)->is_resolved(bc); - if (is_resolved && (oop) cpool->cache()->secondary_entry_at(index)->f1() == NULL) + if (is_resolved && cpool->cache()->secondary_entry_at(index)->is_f1_null()) // FIXME: code generation could allow for null (unlinked) call site is_resolved = false; @@ -770,7 +770,7 @@ ciMethod* ciEnv::get_fake_invokedynamic_method_impl(constantPoolHandle cpool, // Get the invoker methodOop from the constant pool. oop f1_value = cpool->cache()->main_entry_at(index)->f1(); - methodOop signature_invoker = methodOop(f1_value); + methodOop signature_invoker = (methodOop) f1_value; assert(signature_invoker != NULL && signature_invoker->is_method() && signature_invoker->is_method_handle_invoke(), "correct result from LinkResolver::resolve_invokedynamic"); diff --git a/hotspot/src/share/vm/oops/cpCacheOop.cpp b/hotspot/src/share/vm/oops/cpCacheOop.cpp index 953ac789fee..049247b9d7f 100644 --- a/hotspot/src/share/vm/oops/cpCacheOop.cpp +++ b/hotspot/src/share/vm/oops/cpCacheOop.cpp @@ -104,7 +104,7 @@ void ConstantPoolCacheEntry::set_f1_if_null_atomic(oop f1) { void* result = Atomic::cmpxchg_ptr(f1, f1_addr, NULL); bool success = (result == NULL); if (success) { - update_barrier_set(f1_addr, f1); + update_barrier_set((void*) f1_addr, f1); } } @@ -275,21 +275,23 @@ int ConstantPoolCacheEntry::bootstrap_method_index_in_cache() { return (int) bsm_cache_index; } -void ConstantPoolCacheEntry::set_dynamic_call(Handle call_site, - methodHandle signature_invoker) { +void ConstantPoolCacheEntry::set_dynamic_call(Handle call_site, methodHandle signature_invoker) { assert(is_secondary_entry(), ""); + // NOTE: it's important that all other values are set before f1 is + // set since some users short circuit on f1 being set + // (i.e. non-null) and that may result in uninitialized values for + // other racing threads (e.g. flags). int param_size = signature_invoker->size_of_parameters(); assert(param_size >= 1, "method argument size must include MH.this"); - param_size -= 1; // do not count MH.this; it is not stacked for invokedynamic - if (Atomic::cmpxchg_ptr(call_site(), &_f1, NULL) == NULL) { - // racing threads might be trying to install their own favorites - set_f1(call_site()); - } + param_size -= 1; // do not count MH.this; it is not stacked for invokedynamic bool is_final = true; assert(signature_invoker->is_final_method(), "is_final"); - set_flags(as_flags(as_TosState(signature_invoker->result_type()), is_final, false, false, false, true) | param_size); + int flags = as_flags(as_TosState(signature_invoker->result_type()), is_final, false, false, false, true) | param_size; + assert(_flags == 0 || _flags == flags, "flags should be the same"); + set_flags(flags); // do not do set_bytecode on a secondary CP cache entry //set_bytecode_1(Bytecodes::_invokedynamic); + set_f1_if_null_atomic(call_site()); // This must be the last one to set (see NOTE above)! } From 90df638cdcc3f7651ba244ee0c7c16b2701f310b Mon Sep 17 00:00:00 2001 From: Pavel Porvatov Date: Thu, 21 Apr 2011 14:29:23 +0400 Subject: [PATCH 023/117] 7021058: The Create folder button produces error in the Details mode (JFileChooser) Reviewed-by: malenkov --- jdk/src/share/classes/sun/swing/FilePane.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/jdk/src/share/classes/sun/swing/FilePane.java b/jdk/src/share/classes/sun/swing/FilePane.java index a5e7dffda32..5bf5c1f43b0 100644 --- a/jdk/src/share/classes/sun/swing/FilePane.java +++ b/jdk/src/share/classes/sun/swing/FilePane.java @@ -763,7 +763,7 @@ public class FilePane extends JPanel implements PropertyChangeListener { public void setValueAt(Object value, int row, int col) { if (col == COLUMN_FILENAME) { - JFileChooser chooser = getFileChooser(); + final JFileChooser chooser = getFileChooser(); File f = (File)getValueAt(row, col); if (f != null) { String oldDisplayName = chooser.getName(f); @@ -782,18 +782,25 @@ public class FilePane extends JPanel implements PropertyChangeListener { // rename FileSystemView fsv = chooser.getFileSystemView(); - File f2 = fsv.createFileObject(f.getParentFile(), newFileName); + final File f2 = fsv.createFileObject(f.getParentFile(), newFileName); if (f2.exists()) { JOptionPane.showMessageDialog(chooser, MessageFormat.format(renameErrorFileExistsText, oldFileName), renameErrorTitleText, JOptionPane.ERROR_MESSAGE); } else { if (FilePane.this.getModel().renameFile(f, f2)) { if (fsv.isParent(chooser.getCurrentDirectory(), f2)) { - if (chooser.isMultiSelectionEnabled()) { - chooser.setSelectedFiles(new File[]{f2}); - } else { - chooser.setSelectedFile(f2); - } + // The setSelectedFile method produces a new setValueAt invocation while the JTable + // is editing. Postpone file selection to be sure that edit mode of the JTable + // is completed + SwingUtilities.invokeLater(new Runnable() { + public void run() { + if (chooser.isMultiSelectionEnabled()) { + chooser.setSelectedFiles(new File[]{f2}); + } else { + chooser.setSelectedFile(f2); + } + } + }); } else { // Could be because of delay in updating Desktop folder // chooser.setSelectedFile(null); From 6e092bff6a4c7ff85d8f26234ac68b769bc79ff2 Mon Sep 17 00:00:00 2001 From: Doug Lea Date: Thu, 21 Apr 2011 13:53:27 +0100 Subject: [PATCH 024/117] 7038501: Clarify meaning of "(optional)" in javadoc Reviewed-by: chegar --- .../java/util/concurrent/BlockingDeque.java | 24 ++++++++++++------- .../java/util/concurrent/BlockingQueue.java | 12 ++++++---- .../java/util/concurrent/ConcurrentMap.java | 6 +++-- .../util/concurrent/CopyOnWriteArrayList.java | 12 ++++++---- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java b/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java index 3134eae8ec5..7f37f7e66ea 100644 --- a/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java +++ b/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java @@ -400,8 +400,10 @@ public interface BlockingDeque extends BlockingQueue, Deque { * @param o element to be removed from this deque, if present * @return true if an element was removed as a result of this call * @throws ClassCastException if the class of the specified element - * is incompatible with this deque (optional) - * @throws NullPointerException if the specified element is null (optional) + * is incompatible with this deque + * (optional) + * @throws NullPointerException if the specified element is null + * (optional) */ boolean removeFirstOccurrence(Object o); @@ -416,8 +418,10 @@ public interface BlockingDeque extends BlockingQueue, Deque { * @param o element to be removed from this deque, if present * @return true if an element was removed as a result of this call * @throws ClassCastException if the class of the specified element - * is incompatible with this deque (optional) - * @throws NullPointerException if the specified element is null (optional) + * is incompatible with this deque + * (optional) + * @throws NullPointerException if the specified element is null + * (optional) */ boolean removeLastOccurrence(Object o); @@ -591,8 +595,10 @@ public interface BlockingDeque extends BlockingQueue, Deque { * @param o element to be removed from this deque, if present * @return true if this deque changed as a result of the call * @throws ClassCastException if the class of the specified element - * is incompatible with this deque (optional) - * @throws NullPointerException if the specified element is null (optional) + * is incompatible with this deque + * (optional) + * @throws NullPointerException if the specified element is null + * (optional) */ boolean remove(Object o); @@ -604,8 +610,10 @@ public interface BlockingDeque extends BlockingQueue, Deque { * @param o object to be checked for containment in this deque * @return true if this deque contains the specified element * @throws ClassCastException if the class of the specified element - * is incompatible with this deque (optional) - * @throws NullPointerException if the specified element is null (optional) + * is incompatible with this deque + * (optional) + * @throws NullPointerException if the specified element is null + * (optional) */ public boolean contains(Object o); diff --git a/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java b/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java index 9886e6da3c1..4511d27efd7 100644 --- a/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java +++ b/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java @@ -303,8 +303,10 @@ public interface BlockingQueue extends Queue { * @param o element to be removed from this queue, if present * @return true if this queue changed as a result of the call * @throws ClassCastException if the class of the specified element - * is incompatible with this queue (optional) - * @throws NullPointerException if the specified element is null (optional) + * is incompatible with this queue + * (optional) + * @throws NullPointerException if the specified element is null + * (optional) */ boolean remove(Object o); @@ -316,8 +318,10 @@ public interface BlockingQueue extends Queue { * @param o object to be checked for containment in this queue * @return true if this queue contains the specified element * @throws ClassCastException if the class of the specified element - * is incompatible with this queue (optional) - * @throws NullPointerException if the specified element is null (optional) + * is incompatible with this queue + * (optional) + * @throws NullPointerException if the specified element is null + * (optional) */ public boolean contains(Object o); diff --git a/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java b/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java index 25cf98ff0f1..4434c0563b4 100644 --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java @@ -103,9 +103,11 @@ public interface ConcurrentMap extends Map { * @throws UnsupportedOperationException if the remove operation * is not supported by this map * @throws ClassCastException if the key or value is of an inappropriate - * type for this map (optional) + * type for this map + * (optional) * @throws NullPointerException if the specified key or value is null, - * and this map does not permit null keys or values (optional) + * and this map does not permit null keys or values + * (optional) */ boolean remove(Object key, Object value); diff --git a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java index 2774e61136a..785ec6fcede 100644 --- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java +++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java @@ -631,9 +631,11 @@ public class CopyOnWriteArrayList * @param c collection containing elements to be removed from this list * @return true if this list changed as a result of the call * @throws ClassCastException if the class of an element of this list - * is incompatible with the specified collection (optional) + * is incompatible with the specified collection + * (optional) * @throws NullPointerException if this list contains a null element and the - * specified collection does not permit null elements (optional), + * specified collection does not permit null elements + * (optional), * or if the specified collection is null * @see #remove(Object) */ @@ -671,9 +673,11 @@ public class CopyOnWriteArrayList * @param c collection containing elements to be retained in this list * @return true if this list changed as a result of the call * @throws ClassCastException if the class of an element of this list - * is incompatible with the specified collection (optional) + * is incompatible with the specified collection + * (optional) * @throws NullPointerException if this list contains a null element and the - * specified collection does not permit null elements (optional), + * specified collection does not permit null elements + * (optional), * or if the specified collection is null * @see #remove(Object) */ From c74acca8b088533afc78d90d5b88cc56c2263b8b Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Thu, 21 Apr 2011 14:23:57 +0100 Subject: [PATCH 025/117] 6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources Reviewed-by: mullan --- .../sun/security/mscapi/RSACipher.java | 41 ++++++++- .../sun/security/mscapi/RSAPublicKey.java | 6 +- .../sun/security/mscapi/RSASignature.java | 6 +- .../sun/security/mscapi/PublicKeyInterop.java | 92 +++++++++++++++++++ .../sun/security/mscapi/PublicKeyInterop.sh | 84 +++++++++++++++++ 5 files changed, 222 insertions(+), 7 deletions(-) create mode 100644 jdk/test/sun/security/mscapi/PublicKeyInterop.java create mode 100644 jdk/test/sun/security/mscapi/PublicKeyInterop.sh diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java b/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java index 8838cbe8e48..3421450b922 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ package sun.security.mscapi; +import java.math.BigInteger; import java.security.*; import java.security.Key; import java.security.interfaces.*; @@ -33,6 +34,8 @@ import java.security.spec.*; import javax.crypto.*; import javax.crypto.spec.*; +import sun.security.rsa.RSAKeyFactory; + /** * RSA cipher implementation using the Microsoft Crypto API. * Supports RSA en/decryption and signing/verifying using PKCS#1 v1.5 padding. @@ -189,8 +192,38 @@ public final class RSACipher extends CipherSpi { default: throw new InvalidKeyException("Unknown mode: " + opmode); } + if (!(key instanceof sun.security.mscapi.Key)) { - throw new InvalidKeyException("Unsupported key type: " + key); + if (key instanceof java.security.interfaces.RSAPublicKey) { + java.security.interfaces.RSAPublicKey rsaKey = + (java.security.interfaces.RSAPublicKey) key; + + // Convert key to MSCAPI format + + BigInteger modulus = rsaKey.getModulus(); + BigInteger exponent = rsaKey.getPublicExponent(); + + // Check against the local and global values to make sure + // the sizes are ok. Round up to the nearest byte. + RSAKeyFactory.checkKeyLengths(((modulus.bitLength() + 7) & ~7), + exponent, -1, RSAKeyPairGenerator.KEY_SIZE_MAX); + + byte[] modulusBytes = modulus.toByteArray(); + byte[] exponentBytes = exponent.toByteArray(); + + // Adjust key length due to sign bit + int keyBitLength = (modulusBytes[0] == 0) + ? (modulusBytes.length - 1) * 8 + : modulusBytes.length * 8; + + byte[] keyBlob = RSASignature.generatePublicKeyBlob( + keyBitLength, modulusBytes, exponentBytes); + + key = RSASignature.importPublicKey(keyBlob, keyBitLength); + + } else { + throw new InvalidKeyException("Unsupported key type: " + key); + } } if (key instanceof PublicKey) { @@ -358,6 +391,10 @@ public final class RSACipher extends CipherSpi { if (key instanceof sun.security.mscapi.Key) { return ((sun.security.mscapi.Key) key).bitLength(); + + } else if (key instanceof RSAKey) { + return ((RSAKey) key).getModulus().bitLength(); + } else { throw new InvalidKeyException("Unsupported key type: " + key); } diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java b/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java index 9e454e75e5d..b652fabf729 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,7 +91,7 @@ class RSAPublicKey extends Key implements java.security.interfaces.RSAPublicKey if (exponent == null) { publicKeyBlob = getPublicKeyBlob(hCryptKey); - exponent = new BigInteger(getExponent(publicKeyBlob)); + exponent = new BigInteger(1, getExponent(publicKeyBlob)); } return exponent; @@ -104,7 +104,7 @@ class RSAPublicKey extends Key implements java.security.interfaces.RSAPublicKey if (modulus == null) { publicKeyBlob = getPublicKeyBlob(hCryptKey); - modulus = new BigInteger(getModulus(publicKeyBlob)); + modulus = new BigInteger(1, getModulus(publicKeyBlob)); } return modulus; diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java index bb0be095cf6..1c80cc029b9 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java @@ -379,11 +379,13 @@ abstract class RSASignature extends java.security.SignatureSpi /** * Generates a public-key BLOB from a key's components. */ - private native byte[] generatePublicKeyBlob( + // used by RSACipher + static native byte[] generatePublicKeyBlob( int keyBitLength, byte[] modulus, byte[] publicExponent); /** * Imports a public-key BLOB. */ - private native RSAPublicKey importPublicKey(byte[] keyBlob, int keySize); + // used by RSACipher + static native RSAPublicKey importPublicKey(byte[] keyBlob, int keySize); } diff --git a/jdk/test/sun/security/mscapi/PublicKeyInterop.java b/jdk/test/sun/security/mscapi/PublicKeyInterop.java new file mode 100644 index 00000000000..53d5b094681 --- /dev/null +++ b/jdk/test/sun/security/mscapi/PublicKeyInterop.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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. + */ + +/** + * @see PublicKeyInterop.sh + */ + +import java.security.*; +import java.util.*; +import javax.crypto.*; + +import sun.misc.HexDumpEncoder; + +/* + * Confirm interoperability of RSA public keys between SunMSCAPI and SunJCE + * security providers. + */ +public class PublicKeyInterop { + + public static void main(String[] arg) throws Exception { + PrivateKey privKey = null; + Certificate cert = null; + KeyStore ks = KeyStore.getInstance("Windows-MY"); + ks.load(null, null); + System.out.println("Loaded keystore: Windows-MY"); + + PublicKey myPuKey = + (PublicKey) ks.getCertificate("6888925").getPublicKey(); + System.out.println("Public key is a " + myPuKey.getClass().getName()); + PrivateKey myPrKey = (PrivateKey) ks.getKey("6888925", null); + System.out.println("Private key is a " + myPrKey.getClass().getName()); + System.out.println(); + + byte[] plain = new byte[] {0x01, 0x02, 0x03, 0x04, 0x05}; + HexDumpEncoder hde = new HexDumpEncoder(); + System.out.println("Plaintext:\n" + hde.encode(plain) + "\n"); + + Cipher rsa = Cipher.getInstance("RSA/ECB/PKCS1Padding"); + rsa.init(Cipher.ENCRYPT_MODE, myPuKey); + byte[] encrypted = rsa.doFinal(plain); + System.out.println("Encrypted plaintext using RSA Cipher from " + + rsa.getProvider().getName() + " JCE provider\n"); + System.out.println(hde.encode(encrypted) + "\n"); + + Cipher rsa2 = Cipher.getInstance("RSA/ECB/PKCS1Padding", "SunMSCAPI"); + rsa2.init(Cipher.ENCRYPT_MODE, myPuKey); + byte[] encrypted2 = rsa2.doFinal(plain); + System.out.println("Encrypted plaintext using RSA Cipher from " + + rsa2.getProvider().getName() + " JCE provider\n"); + System.out.println(hde.encode(encrypted2) + "\n"); + + Cipher rsa3 = Cipher.getInstance("RSA/ECB/PKCS1Padding", "SunMSCAPI"); + rsa3.init(Cipher.DECRYPT_MODE, myPrKey); + byte[] decrypted = rsa3.doFinal(encrypted); + System.out.println("Decrypted first ciphertext using RSA Cipher from " + + rsa3.getProvider().getName() + " JCE provider\n"); + System.out.println(hde.encode(decrypted) + "\n"); + if (! Arrays.equals(plain, decrypted)) { + throw new Exception("First decrypted ciphertext does not match " + + "original plaintext"); + } + + decrypted = rsa3.doFinal(encrypted2); + System.out.println("Decrypted second ciphertext using RSA Cipher from " + + rsa3.getProvider().getName() + " JCE provider\n"); + System.out.println(hde.encode(decrypted) + "\n"); + if (! Arrays.equals(plain, decrypted)) { + throw new Exception("Second decrypted ciphertext does not match " + + "original plaintext"); + } + } +} diff --git a/jdk/test/sun/security/mscapi/PublicKeyInterop.sh b/jdk/test/sun/security/mscapi/PublicKeyInterop.sh new file mode 100644 index 00000000000..1967e63d266 --- /dev/null +++ b/jdk/test/sun/security/mscapi/PublicKeyInterop.sh @@ -0,0 +1,84 @@ +#!/bin/sh + +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# 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 6888925 +# @run shell PublicKeyInterop.sh +# @summary SunMSCAPI's Cipher can't use RSA public keys obtained from other +# sources. +# + +# set a few environment variables so that the shell-script can run stand-alone +# in the source directory +if [ "${TESTSRC}" = "" ] ; then + TESTSRC="." +fi + +if [ "${TESTCLASSES}" = "" ] ; then + TESTCLASSES="." +fi + +if [ "${TESTJAVA}" = "" ] ; then + echo "TESTJAVA not set. Test cannot execute." + echo "FAILED!!!" + exit 1 +fi + +OS=`uname -s` +case "$OS" in + Windows* | CYGWIN* ) + + echo "Creating a temporary RSA keypair in the Windows-My store..." + ${TESTJAVA}/bin/keytool \ + -genkeypair \ + -storetype Windows-My \ + -keyalg RSA \ + -alias 6888925 \ + -dname "cn=6888925,c=US" \ + -noprompt + + echo + echo "Running the test..." + ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\PublicKeyInterop.java + ${TESTJAVA}/bin/java PublicKeyInterop + + rc=$? + + echo + echo "Removing the temporary RSA keypair from the Windows-My store..." + ${TESTJAVA}/bin/keytool \ + -delete \ + -storetype Windows-My \ + -alias 6888925 + + echo done. + exit $rc + ;; + + * ) + echo "This test is not intended for '$OS' - passing test" + exit 0 + ;; +esac From 9d72155fc57c598370bf1f7ec12435a7602882f8 Mon Sep 17 00:00:00 2001 From: Doug Lea Date: Thu, 21 Apr 2011 17:00:23 +0100 Subject: [PATCH 026/117] 7038542: Small performace regression in ConcurrentHashMap on c1 since CR 703655 Reviewed-by: chegar --- .../util/concurrent/ConcurrentHashMap.java | 63 +++++++++++++------ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java index c66a82e6305..e82148069b4 100644 --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java @@ -239,7 +239,8 @@ public class ConcurrentHashMap extends AbstractMap /** * Gets the ith element of given table (if nonnull) with volatile - * read semantics. + * read semantics. Note: This is manually integrated into a few + * performance-sensitive methods to reduce call overhead. */ @SuppressWarnings("unchecked") static final HashEntry entryAt(HashEntry[] tab, int i) { @@ -389,8 +390,7 @@ public class ConcurrentHashMap extends AbstractMap else node = new HashEntry(hash, key, value, first); int c = count + 1; - if (c > threshold && first != null && - tab.length < MAXIMUM_CAPACITY) + if (c > threshold && tab.length < MAXIMUM_CAPACITY) rehash(node); else setEntryAt(tab, index, node); @@ -647,7 +647,11 @@ public class ConcurrentHashMap extends AbstractMap /** * Gets the jth element of given segment array (if nonnull) with - * volatile element access semantics via Unsafe. + * volatile element access semantics via Unsafe. (The null check + * can trigger harmlessly only during deserialization.) Note: + * because each element of segments array is set only once (using + * fully ordered writes), some performance-sensitive methods rely + * on this method only as a recheck upon null reads. */ @SuppressWarnings("unchecked") static final Segment segmentAt(Segment[] ss, int j) { @@ -913,12 +917,19 @@ public class ConcurrentHashMap extends AbstractMap * @throws NullPointerException if the specified key is null */ public V get(Object key) { - int hash = hash(key.hashCode()); - for (HashEntry e = entryForHash(segmentForHash(hash), hash); - e != null; e = e.next) { - K k; - if ((k = e.key) == key || (e.hash == hash && key.equals(k))) - return e.value; + Segment s; // manually integrate access methods to reduce overhead + HashEntry[] tab; + int h = hash(key.hashCode()); + long u = (((h >>> segmentShift) & segmentMask) << SSHIFT) + SBASE; + if ((s = (Segment)UNSAFE.getObjectVolatile(segments, u)) != null && + (tab = s.table) != null) { + for (HashEntry e = (HashEntry) UNSAFE.getObjectVolatile + (tab, ((long)(((tab.length - 1) & h)) << TSHIFT) + TBASE); + e != null; e = e.next) { + K k; + if ((k = e.key) == key || (e.hash == h && key.equals(k))) + return e.value; + } } return null; } @@ -932,13 +943,21 @@ public class ConcurrentHashMap extends AbstractMap * equals method; false otherwise. * @throws NullPointerException if the specified key is null */ + @SuppressWarnings("unchecked") public boolean containsKey(Object key) { - int hash = hash(key.hashCode()); - for (HashEntry e = entryForHash(segmentForHash(hash), hash); - e != null; e = e.next) { - K k; - if ((k = e.key) == key || (e.hash == hash && key.equals(k))) - return true; + Segment s; // same as get() except no need for volatile value read + HashEntry[] tab; + int h = hash(key.hashCode()); + long u = (((h >>> segmentShift) & segmentMask) << SSHIFT) + SBASE; + if ((s = (Segment)UNSAFE.getObjectVolatile(segments, u)) != null && + (tab = s.table) != null) { + for (HashEntry e = (HashEntry) UNSAFE.getObjectVolatile + (tab, ((long)(((tab.length - 1) & h)) << TSHIFT) + TBASE); + e != null; e = e.next) { + K k; + if ((k = e.key) == key || (e.hash == h && key.equals(k))) + return true; + } } return false; } @@ -1032,13 +1051,15 @@ public class ConcurrentHashMap extends AbstractMap * null if there was no mapping for key * @throws NullPointerException if the specified key or value is null */ + @SuppressWarnings("unchecked") public V put(K key, V value) { + Segment s; if (value == null) throw new NullPointerException(); int hash = hash(key.hashCode()); int j = (hash >>> segmentShift) & segmentMask; - Segment s = segmentAt(segments, j); - if (s == null) + if ((s = (Segment)UNSAFE.getObject // nonvolatile; recheck + (segments, (j << SSHIFT) + SBASE)) == null) // in ensureSegment s = ensureSegment(j); return s.put(key, hash, value, false); } @@ -1050,13 +1071,15 @@ public class ConcurrentHashMap extends AbstractMap * or null if there was no mapping for the key * @throws NullPointerException if the specified key or value is null */ + @SuppressWarnings("unchecked") public V putIfAbsent(K key, V value) { + Segment s; if (value == null) throw new NullPointerException(); int hash = hash(key.hashCode()); int j = (hash >>> segmentShift) & segmentMask; - Segment s = segmentAt(segments, j); - if (s == null) + if ((s = (Segment)UNSAFE.getObject + (segments, (j << SSHIFT) + SBASE)) == null) s = ensureSegment(j); return s.put(key, hash, value, true); } From 6663052a885feb41704d0463ddc986c9a02f53bc Mon Sep 17 00:00:00 2001 From: Jon Masamitsu Date: Thu, 21 Apr 2011 10:23:44 -0700 Subject: [PATCH 027/117] 6946417: G1: Java VisualVM does not support G1 properly Added counters for jstat Reviewed-by: tonyp, jwilhelm, stefank, ysr, johnc --- .../gc_implementation/g1/g1CollectedHeap.cpp | 10 + .../gc_implementation/g1/g1CollectedHeap.hpp | 9 + .../g1/g1MonitoringSupport.cpp | 178 +++++++++++++++ .../g1/g1MonitoringSupport.hpp | 203 ++++++++++++++++++ .../shared/generationCounters.cpp | 7 +- .../shared/generationCounters.hpp | 7 +- .../shared/hSpaceCounters.cpp | 66 ++++++ .../shared/hSpaceCounters.hpp | 87 ++++++++ .../src/share/vm/services/g1MemoryPool.cpp | 37 +--- .../src/share/vm/services/g1MemoryPool.hpp | 88 +------- 10 files changed, 575 insertions(+), 117 deletions(-) create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index becc9451265..d8a9c07f522 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1161,6 +1161,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, TraceTime t(system_gc ? "Full GC (System.gc())" : "Full GC", PrintGC, true, gclog_or_tty); + TraceCollectorStats tcs(g1mm()->full_collection_counters()); TraceMemoryManagerStats tms(true /* fullGC */); double start = os::elapsedTime(); @@ -1339,6 +1340,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, if (PrintHeapAtGC) { Universe::print_heap_after_gc(); } + g1mm()->update_counters(); return true; } @@ -1971,6 +1973,10 @@ jint G1CollectedHeap::initialize() { init_mutator_alloc_region(); + // Do create of the monitoring and management support so that + // values in the heap have been properly initialized. + _g1mm = new G1MonitoringSupport(this, &_g1_storage); + return JNI_OK; } @@ -3186,6 +3192,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); TraceTime t(verbose_str, PrintGC && !PrintGCDetails, true, gclog_or_tty); + TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); TraceMemoryManagerStats tms(false /* fullGC */); // If the secondary_free_list is not empty, append it to the @@ -3425,6 +3432,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { if (PrintHeapAtGC) { Universe::print_heap_after_gc(); } + g1mm()->update_counters(); + if (G1SummarizeRSetStats && (G1SummarizeRSetStatsPeriod > 0) && (total_collections() % G1SummarizeRSetStatsPeriod == 0)) { @@ -5338,6 +5347,7 @@ HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size, if (new_alloc_region != NULL) { g1_policy()->update_region_num(true /* next_is_young */); set_region_short_lived_locked(new_alloc_region); + g1mm()->update_eden_counters(); return new_alloc_region; } } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 1b7e6a307bc..7c318a577b5 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -28,7 +28,9 @@ #include "gc_implementation/g1/concurrentMark.hpp" #include "gc_implementation/g1/g1AllocRegion.hpp" #include "gc_implementation/g1/g1RemSet.hpp" +#include "gc_implementation/g1/g1MonitoringSupport.hpp" #include "gc_implementation/g1/heapRegionSets.hpp" +#include "gc_implementation/shared/hSpaceCounters.hpp" #include "gc_implementation/parNew/parGCAllocBuffer.hpp" #include "memory/barrierSet.hpp" #include "memory/memRegion.hpp" @@ -57,6 +59,7 @@ class HeapRegionRemSetIterator; class ConcurrentMark; class ConcurrentMarkThread; class ConcurrentG1Refine; +class GenerationCounters; typedef OverflowTaskQueue RefToScanQueue; typedef GenericTaskQueueSet RefToScanQueueSet; @@ -236,6 +239,9 @@ private: // current collection. HeapRegion* _gc_alloc_region_list; + // Helper for monitoring and management support. + G1MonitoringSupport* _g1mm; + // Determines PLAB size for a particular allocation purpose. static size_t desired_plab_sz(GCAllocPurpose purpose); @@ -550,6 +556,9 @@ protected: HeapWord* expand_and_allocate(size_t word_size); public: + + G1MonitoringSupport* g1mm() { return _g1mm; } + // Expand the garbage-first heap by at least the given size (in bytes!). // Returns true if the heap was expanded by the requested amount; // false otherwise. diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp new file mode 100644 index 00000000000..aab16dba661 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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. + * + */ + +#include "precompiled.hpp" +#include "gc_implementation/g1/g1MonitoringSupport.hpp" +#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" +#include "gc_implementation/g1/g1CollectorPolicy.hpp" + +G1MonitoringSupport::G1MonitoringSupport(G1CollectedHeap* g1h, + VirtualSpace* g1_storage_addr) : + _g1h(g1h), + _incremental_collection_counters(NULL), + _full_collection_counters(NULL), + _non_young_collection_counters(NULL), + _old_space_counters(NULL), + _young_collection_counters(NULL), + _eden_counters(NULL), + _from_counters(NULL), + _to_counters(NULL), + _g1_storage_addr(g1_storage_addr) +{ + // Counters for GC collections + // + // name "collector.0". In a generational collector this would be the + // young generation collection. + _incremental_collection_counters = + new CollectorCounters("G1 incremental collections", 0); + // name "collector.1". In a generational collector this would be the + // old generation collection. + _full_collection_counters = + new CollectorCounters("G1 stop-the-world full collections", 1); + + // timer sampling for all counters supporting sampling only update the + // used value. See the take_sample() method. G1 requires both used and + // capacity updated so sampling is not currently used. It might + // be sufficient to update all counters in take_sample() even though + // take_sample() only returns "used". When sampling was used, there + // were some anomolous values emitted which may have been the consequence + // of not updating all values simultaneously (i.e., see the calculation done + // in eden_space_used(), is it possbile that the values used to + // calculate either eden_used or survivor_used are being updated by + // the collector when the sample is being done?). + const bool sampled = false; + + // "Generation" and "Space" counters. + // + // name "generation.1" This is logically the old generation in + // generational GC terms. The "1, 1" parameters are for + // the n-th generation (=1) with 1 space. + // Counters are created from minCapacity, maxCapacity, and capacity + _non_young_collection_counters = + new GenerationCounters("whole heap", 1, 1, _g1_storage_addr); + + // name "generation.1.space.0" + // Counters are created from maxCapacity, capacity, initCapacity, + // and used. + _old_space_counters = new HSpaceCounters("space", 0, + _g1h->max_capacity(), _g1h->capacity(), _non_young_collection_counters); + + // Young collection set + // name "generation.0". This is logically the young generation. + // The "0, 3" are paremeters for the n-th genertaion (=0) with 3 spaces. + // See _non_young_collection_counters for additional counters + _young_collection_counters = new GenerationCounters("young", 0, 3, NULL); + + // Replace "max_heap_byte_size() with maximum young gen size for + // g1Collectedheap + // name "generation.0.space.0" + // See _old_space_counters for additional counters + _eden_counters = new HSpaceCounters("eden", 0, + _g1h->max_capacity(), eden_space_committed(), + _young_collection_counters); + + // name "generation.0.space.1" + // See _old_space_counters for additional counters + // Set the arguments to indicate that this survivor space is not used. + _from_counters = new HSpaceCounters("s0", 1, (long) 0, (long) 0, + _young_collection_counters); + + // name "generation.0.space.2" + // See _old_space_counters for additional counters + _to_counters = new HSpaceCounters("s1", 2, + _g1h->max_capacity(), + survivor_space_committed(), + _young_collection_counters); +} + +size_t G1MonitoringSupport::overall_committed() { + return g1h()->capacity(); +} + +size_t G1MonitoringSupport::overall_used() { + return g1h()->used_unlocked(); +} + +size_t G1MonitoringSupport::eden_space_committed() { + return MAX2(eden_space_used(), (size_t) HeapRegion::GrainBytes); +} + +size_t G1MonitoringSupport::eden_space_used() { + size_t young_list_length = g1h()->young_list()->length(); + size_t eden_used = young_list_length * HeapRegion::GrainBytes; + size_t survivor_used = survivor_space_used(); + eden_used = subtract_up_to_zero(eden_used, survivor_used); + return eden_used; +} + +size_t G1MonitoringSupport::survivor_space_committed() { + return MAX2(survivor_space_used(), + (size_t) HeapRegion::GrainBytes); +} + +size_t G1MonitoringSupport::survivor_space_used() { + size_t survivor_num = g1h()->g1_policy()->recorded_survivor_regions(); + size_t survivor_used = survivor_num * HeapRegion::GrainBytes; + return survivor_used; +} + +size_t G1MonitoringSupport::old_space_committed() { + size_t committed = overall_committed(); + size_t eden_committed = eden_space_committed(); + size_t survivor_committed = survivor_space_committed(); + committed = subtract_up_to_zero(committed, eden_committed); + committed = subtract_up_to_zero(committed, survivor_committed); + committed = MAX2(committed, (size_t) HeapRegion::GrainBytes); + return committed; +} + +// See the comment near the top of g1MonitoringSupport.hpp for +// an explanation of these calculations for "used" and "capacity". +size_t G1MonitoringSupport::old_space_used() { + size_t used = overall_used(); + size_t eden_used = eden_space_used(); + size_t survivor_used = survivor_space_used(); + used = subtract_up_to_zero(used, eden_used); + used = subtract_up_to_zero(used, survivor_used); + return used; +} + +void G1MonitoringSupport::update_counters() { + if (UsePerfData) { + eden_counters()->update_capacity(eden_space_committed()); + eden_counters()->update_used(eden_space_used()); + to_counters()->update_capacity(survivor_space_committed()); + to_counters()->update_used(survivor_space_used()); + old_space_counters()->update_capacity(old_space_committed()); + old_space_counters()->update_used(old_space_used()); + non_young_collection_counters()->update_all(); + } +} + +void G1MonitoringSupport::update_eden_counters() { + if (UsePerfData) { + eden_counters()->update_capacity(eden_space_committed()); + eden_counters()->update_used(eden_space_used()); + } +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp new file mode 100644 index 00000000000..61de266fe5f --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1MONITORINGSUPPORT_HPP +#define SHARE_VM_GC_IMPLEMENTATION_G1_G1MONITORINGSUPPORT_HPP + +#include "gc_implementation/shared/hSpaceCounters.hpp" + +class G1CollectedHeap; +class G1SpaceMonitoringSupport; + +// Class for monitoring logical spaces in G1. +// G1 defines a set of regions as a young +// collection (analogous to a young generation). +// The young collection is a logical generation +// with no fixed chunk (see space.hpp) reflecting +// the address space for the generation. In addition +// to the young collection there is its complement +// the non-young collection that is simply the regions +// not in the young collection. The non-young collection +// is treated here as a logical old generation only +// because the monitoring tools expect a generational +// heap. The monitoring tools expect that a Space +// (see space.hpp) exists that describe the +// address space of young collection and non-young +// collection and such a view is provided here. +// +// This class provides interfaces to access +// the value of variables for the young collection +// that include the "capacity" and "used" of the +// young collection along with constant values +// for the minimum and maximum capacities for +// the logical spaces. Similarly for the non-young +// collection. +// +// Also provided are counters for G1 concurrent collections +// and stop-the-world full heap collecitons. +// +// Below is a description of how "used" and "capactiy" +// (or committed) is calculated for the logical spaces. +// +// 1) The used space calculation for a pool is not necessarily +// independent of the others. We can easily get from G1 the overall +// used space in the entire heap, the number of regions in the young +// generation (includes both eden and survivors), and the number of +// survivor regions. So, from that we calculate: +// +// survivor_used = survivor_num * region_size +// eden_used = young_region_num * region_size - survivor_used +// old_gen_used = overall_used - eden_used - survivor_used +// +// Note that survivor_used and eden_used are upper bounds. To get the +// actual value we would have to iterate over the regions and add up +// ->used(). But that'd be expensive. So, we'll accept some lack of +// accuracy for those two. But, we have to be careful when calculating +// old_gen_used, in case we subtract from overall_used more then the +// actual number and our result goes negative. +// +// 2) Calculating the used space is straightforward, as described +// above. However, how do we calculate the committed space, given that +// we allocate space for the eden, survivor, and old gen out of the +// same pool of regions? One way to do this is to use the used value +// as also the committed value for the eden and survivor spaces and +// then calculate the old gen committed space as follows: +// +// old_gen_committed = overall_committed - eden_committed - survivor_committed +// +// Maybe a better way to do that would be to calculate used for eden +// and survivor as a sum of ->used() over their regions and then +// calculate committed as region_num * region_size (i.e., what we use +// to calculate the used space now). This is something to consider +// in the future. +// +// 3) Another decision that is again not straightforward is what is +// the max size that each memory pool can grow to. One way to do this +// would be to use the committed size for the max for the eden and +// survivors and calculate the old gen max as follows (basically, it's +// a similar pattern to what we use for the committed space, as +// described above): +// +// old_gen_max = overall_max - eden_max - survivor_max +// +// Unfortunately, the above makes the max of each pool fluctuate over +// time and, even though this is allowed according to the spec, it +// broke several assumptions in the M&M framework (there were cases +// where used would reach a value greater than max). So, for max we +// use -1, which means "undefined" according to the spec. +// +// 4) Now, there is a very subtle issue with all the above. The +// framework will call get_memory_usage() on the three pools +// asynchronously. As a result, each call might get a different value +// for, say, survivor_num which will yield inconsistent values for +// eden_used, survivor_used, and old_gen_used (as survivor_num is used +// in the calculation of all three). This would normally be +// ok. However, it's possible that this might cause the sum of +// eden_used, survivor_used, and old_gen_used to go over the max heap +// size and this seems to sometimes cause JConsole (and maybe other +// clients) to get confused. There's not a really an easy / clean +// solution to this problem, due to the asynchrounous nature of the +// framework. + +class G1MonitoringSupport : public CHeapObj { + G1CollectedHeap* _g1h; + VirtualSpace* _g1_storage_addr; + + // jstat performance counters + // incremental collections both fully and partially young + CollectorCounters* _incremental_collection_counters; + // full stop-the-world collections + CollectorCounters* _full_collection_counters; + // young collection set counters. The _eden_counters, + // _from_counters, and _to_counters are associated with + // this "generational" counter. + GenerationCounters* _young_collection_counters; + // non-young collection set counters. The _old_space_counters + // below are associated with this "generational" counter. + GenerationCounters* _non_young_collection_counters; + // Counters for the capacity and used for + // the whole heap + HSpaceCounters* _old_space_counters; + // the young collection + HSpaceCounters* _eden_counters; + // the survivor collection (only one, _to_counters, is actively used) + HSpaceCounters* _from_counters; + HSpaceCounters* _to_counters; + + // It returns x - y if x > y, 0 otherwise. + // As described in the comment above, some of the inputs to the + // calculations we have to do are obtained concurrently and hence + // may be inconsistent with each other. So, this provides a + // defensive way of performing the subtraction and avoids the value + // going negative (which would mean a very large result, given that + // the parameter are size_t). + static size_t subtract_up_to_zero(size_t x, size_t y) { + if (x > y) { + return x - y; + } else { + return 0; + } + } + + public: + G1MonitoringSupport(G1CollectedHeap* g1h, VirtualSpace* g1_storage_addr); + + G1CollectedHeap* g1h() { return _g1h; } + VirtualSpace* g1_storage_addr() { return _g1_storage_addr; } + + // Performance Counter accessors + void update_counters(); + void update_eden_counters(); + + CollectorCounters* incremental_collection_counters() { + return _incremental_collection_counters; + } + CollectorCounters* full_collection_counters() { + return _full_collection_counters; + } + GenerationCounters* non_young_collection_counters() { + return _non_young_collection_counters; + } + HSpaceCounters* old_space_counters() { return _old_space_counters; } + HSpaceCounters* eden_counters() { return _eden_counters; } + HSpaceCounters* from_counters() { return _from_counters; } + HSpaceCounters* to_counters() { return _to_counters; } + + // Monitoring support used by + // MemoryService + // jstat counters + size_t overall_committed(); + size_t overall_used(); + + size_t eden_space_committed(); + size_t eden_space_used(); + + size_t survivor_space_committed(); + size_t survivor_space_used(); + + size_t old_space_committed(); + size_t old_space_used(); +}; + +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MONITORINGSUPPORT_HPP diff --git a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.cpp b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.cpp index 4548189335c..f07f486e895 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,15 +51,18 @@ GenerationCounters::GenerationCounters(const char* name, cname = PerfDataManager::counter_name(_name_space, "minCapacity"); PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes, + _virtual_space == NULL ? 0 : _virtual_space->committed_size(), CHECK); cname = PerfDataManager::counter_name(_name_space, "maxCapacity"); PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes, + _virtual_space == NULL ? 0 : _virtual_space->reserved_size(), CHECK); cname = PerfDataManager::counter_name(_name_space, "capacity"); _current_size = PerfDataManager::create_variable(SUN_GC, cname, - PerfData::U_Bytes, + PerfData::U_Bytes, + _virtual_space == NULL ? 0 : _virtual_space->committed_size(), CHECK); } } diff --git a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp index 4fd05e493dc..21f76918c17 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,10 +61,11 @@ class GenerationCounters: public CHeapObj { } virtual void update_all() { - _current_size->set_value(_virtual_space->committed_size()); + _current_size->set_value(_virtual_space == NULL ? 0 : + _virtual_space->committed_size()); } const char* name_space() const { return _name_space; } -}; +}; #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GENERATIONCOUNTERS_HPP diff --git a/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.cpp b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.cpp new file mode 100644 index 00000000000..17a69fa832e --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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. + * + */ + +#include "precompiled.hpp" +#include "gc_implementation/shared/hSpaceCounters.hpp" +#include "memory/generation.hpp" +#include "memory/resourceArea.hpp" + +HSpaceCounters::HSpaceCounters(const char* name, + int ordinal, + size_t max_size, + size_t initial_capacity, + GenerationCounters* gc) { + + if (UsePerfData) { + EXCEPTION_MARK; + ResourceMark rm; + + const char* cns = + PerfDataManager::name_space(gc->name_space(), "space", ordinal); + + _name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1); + strcpy(_name_space, cns); + + const char* cname = PerfDataManager::counter_name(_name_space, "name"); + PerfDataManager::create_string_constant(SUN_GC, cname, name, CHECK); + + cname = PerfDataManager::counter_name(_name_space, "maxCapacity"); + PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes, + (jlong)max_size, CHECK); + + cname = PerfDataManager::counter_name(_name_space, "capacity"); + _capacity = PerfDataManager::create_variable(SUN_GC, cname, + PerfData::U_Bytes, + initial_capacity, CHECK); + + cname = PerfDataManager::counter_name(_name_space, "used"); + _used = PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes, + (jlong) 0, CHECK); + + cname = PerfDataManager::counter_name(_name_space, "initCapacity"); + PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes, + initial_capacity, CHECK); + } +} diff --git a/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp new file mode 100644 index 00000000000..a55d443a91f --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP +#define SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP + +#ifndef SERIALGC +#include "gc_implementation/shared/generationCounters.hpp" +#include "memory/generation.hpp" +#include "runtime/perfData.hpp" +#endif + +// A HSpaceCounter is a holder class for performance counters +// that track a collections (logical spaces) in a heap; + +class HeapSpaceUsedHelper; +class G1SpaceMonitoringSupport; + +class HSpaceCounters: public CHeapObj { + friend class VMStructs; + + private: + PerfVariable* _capacity; + PerfVariable* _used; + + // Constant PerfData types don't need to retain a reference. + // However, it's a good idea to document them here. + + char* _name_space; + + public: + + HSpaceCounters(const char* name, int ordinal, size_t max_size, + size_t initial_capacity, GenerationCounters* gc); + + ~HSpaceCounters() { + if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space); + } + + inline void update_capacity(size_t v) { + _capacity->set_value(v); + } + + inline void update_used(size_t v) { + _used->set_value(v); + } + + debug_only( + // for security reasons, we do not allow arbitrary reads from + // the counters as they may live in shared memory. + jlong used() { + return _used->get_value(); + } + jlong capacity() { + return _used->get_value(); + } + ) + + inline void update_all(size_t capacity, size_t used) { + update_capacity(capacity); + update_used(used); + } + + const char* name_space() const { return _name_space; } +}; +#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP diff --git a/hotspot/src/share/vm/services/g1MemoryPool.cpp b/hotspot/src/share/vm/services/g1MemoryPool.cpp index 1a441595011..ce64f0e3d13 100644 --- a/hotspot/src/share/vm/services/g1MemoryPool.cpp +++ b/hotspot/src/share/vm/services/g1MemoryPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,10 +34,10 @@ G1MemoryPoolSuper::G1MemoryPoolSuper(G1CollectedHeap* g1h, size_t init_size, bool support_usage_threshold) : _g1h(g1h), CollectedMemoryPool(name, - MemoryPool::Heap, - init_size, - undefined_max(), - support_usage_threshold) { + MemoryPool::Heap, + init_size, + undefined_max(), + support_usage_threshold) { assert(UseG1GC, "sanity"); } @@ -48,44 +48,27 @@ size_t G1MemoryPoolSuper::eden_space_committed(G1CollectedHeap* g1h) { // See the comment at the top of g1MemoryPool.hpp size_t G1MemoryPoolSuper::eden_space_used(G1CollectedHeap* g1h) { - size_t young_list_length = g1h->young_list()->length(); - size_t eden_used = young_list_length * HeapRegion::GrainBytes; - size_t survivor_used = survivor_space_used(g1h); - eden_used = subtract_up_to_zero(eden_used, survivor_used); - return eden_used; + return g1h->g1mm()->eden_space_used(); } // See the comment at the top of g1MemoryPool.hpp size_t G1MemoryPoolSuper::survivor_space_committed(G1CollectedHeap* g1h) { - return MAX2(survivor_space_used(g1h), (size_t) HeapRegion::GrainBytes); + return g1h->g1mm()->survivor_space_committed(); } // See the comment at the top of g1MemoryPool.hpp size_t G1MemoryPoolSuper::survivor_space_used(G1CollectedHeap* g1h) { - size_t survivor_num = g1h->g1_policy()->recorded_survivor_regions(); - size_t survivor_used = survivor_num * HeapRegion::GrainBytes; - return survivor_used; + return g1h->g1mm()->survivor_space_used(); } // See the comment at the top of g1MemoryPool.hpp size_t G1MemoryPoolSuper::old_space_committed(G1CollectedHeap* g1h) { - size_t committed = overall_committed(g1h); - size_t eden_committed = eden_space_committed(g1h); - size_t survivor_committed = survivor_space_committed(g1h); - committed = subtract_up_to_zero(committed, eden_committed); - committed = subtract_up_to_zero(committed, survivor_committed); - committed = MAX2(committed, (size_t) HeapRegion::GrainBytes); - return committed; + return g1h->g1mm()->old_space_committed(); } // See the comment at the top of g1MemoryPool.hpp size_t G1MemoryPoolSuper::old_space_used(G1CollectedHeap* g1h) { - size_t used = overall_used(g1h); - size_t eden_used = eden_space_used(g1h); - size_t survivor_used = survivor_space_used(g1h); - used = subtract_up_to_zero(used, eden_used); - used = subtract_up_to_zero(used, survivor_used); - return used; + return g1h->g1mm()->old_space_used(); } G1EdenPool::G1EdenPool(G1CollectedHeap* g1h) : diff --git a/hotspot/src/share/vm/services/g1MemoryPool.hpp b/hotspot/src/share/vm/services/g1MemoryPool.hpp index 9d7d6fd2e46..958a0885b98 100644 --- a/hotspot/src/share/vm/services/g1MemoryPool.hpp +++ b/hotspot/src/share/vm/services/g1MemoryPool.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,68 +46,9 @@ class G1CollectedHeap; // get, as this does affect the performance and behavior of G1. Which // is why we introduce the three memory pools implemented here. // -// The above approach inroduces a couple of challenging issues in the -// implementation of the three memory pools: +// See comments in g1MonitoringSupport.hpp for additional details +// on this model. // -// 1) The used space calculation for a pool is not necessarily -// independent of the others. We can easily get from G1 the overall -// used space in the entire heap, the number of regions in the young -// generation (includes both eden and survivors), and the number of -// survivor regions. So, from that we calculate: -// -// survivor_used = survivor_num * region_size -// eden_used = young_region_num * region_size - survivor_used -// old_gen_used = overall_used - eden_used - survivor_used -// -// Note that survivor_used and eden_used are upper bounds. To get the -// actual value we would have to iterate over the regions and add up -// ->used(). But that'd be expensive. So, we'll accept some lack of -// accuracy for those two. But, we have to be careful when calculating -// old_gen_used, in case we subtract from overall_used more then the -// actual number and our result goes negative. -// -// 2) Calculating the used space is straightforward, as described -// above. However, how do we calculate the committed space, given that -// we allocate space for the eden, survivor, and old gen out of the -// same pool of regions? One way to do this is to use the used value -// as also the committed value for the eden and survivor spaces and -// then calculate the old gen committed space as follows: -// -// old_gen_committed = overall_committed - eden_committed - survivor_committed -// -// Maybe a better way to do that would be to calculate used for eden -// and survivor as a sum of ->used() over their regions and then -// calculate committed as region_num * region_size (i.e., what we use -// to calculate the used space now). This is something to consider -// in the future. -// -// 3) Another decision that is again not straightforward is what is -// the max size that each memory pool can grow to. One way to do this -// would be to use the committed size for the max for the eden and -// survivors and calculate the old gen max as follows (basically, it's -// a similar pattern to what we use for the committed space, as -// described above): -// -// old_gen_max = overall_max - eden_max - survivor_max -// -// Unfortunately, the above makes the max of each pool fluctuate over -// time and, even though this is allowed according to the spec, it -// broke several assumptions in the M&M framework (there were cases -// where used would reach a value greater than max). So, for max we -// use -1, which means "undefined" according to the spec. -// -// 4) Now, there is a very subtle issue with all the above. The -// framework will call get_memory_usage() on the three pools -// asynchronously. As a result, each call might get a different value -// for, say, survivor_num which will yield inconsistent values for -// eden_used, survivor_used, and old_gen_used (as survivor_num is used -// in the calculation of all three). This would normally be -// ok. However, it's possible that this might cause the sum of -// eden_used, survivor_used, and old_gen_used to go over the max heap -// size and this seems to sometimes cause JConsole (and maybe other -// clients) to get confused. There's not a really an easy / clean -// solution to this problem, due to the asynchrounous nature of the -// framework. // This class is shared by the three G1 memory pool classes @@ -116,22 +57,6 @@ class G1CollectedHeap; // (see comment above), we put the calculations in this class so that // we can easily share them among the subclasses. class G1MemoryPoolSuper : public CollectedMemoryPool { -private: - // It returns x - y if x > y, 0 otherwise. - // As described in the comment above, some of the inputs to the - // calculations we have to do are obtained concurrently and hence - // may be inconsistent with each other. So, this provides a - // defensive way of performing the subtraction and avoids the value - // going negative (which would mean a very large result, given that - // the parameter are size_t). - static size_t subtract_up_to_zero(size_t x, size_t y) { - if (x > y) { - return x - y; - } else { - return 0; - } - } - protected: G1CollectedHeap* _g1h; @@ -148,13 +73,6 @@ protected: return (size_t) -1; } - static size_t overall_committed(G1CollectedHeap* g1h) { - return g1h->capacity(); - } - static size_t overall_used(G1CollectedHeap* g1h) { - return g1h->used_unlocked(); - } - static size_t eden_space_committed(G1CollectedHeap* g1h); static size_t eden_space_used(G1CollectedHeap* g1h); From d617d849a08d94ea99725af709e2aa03138bc1ad Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Thu, 21 Apr 2011 19:05:29 +0100 Subject: [PATCH 028/117] 6732372: Some MSCAPI native methods not returning correct exceptions Reviewed-by: mullan --- .../sun/security/ec/ECKeyPairGenerator.java | 21 ++++++----- .../classes/sun/security/mscapi/KeyStore.java | 37 +++++++++++++------ .../sun/security/mscapi/RSACipher.java | 7 +++- .../security/mscapi/RSAKeyPairGenerator.java | 20 ++++++---- .../sun/security/mscapi/RSAPublicKey.java | 29 +++++++++++---- .../sun/security/mscapi/RSASignature.java | 16 ++++++-- .../native/sun/security/mscapi/security.cpp | 8 ++-- 7 files changed, 93 insertions(+), 45 deletions(-) diff --git a/jdk/src/share/classes/sun/security/ec/ECKeyPairGenerator.java b/jdk/src/share/classes/sun/security/ec/ECKeyPairGenerator.java index 6f994ec1f5e..046fb42b7d2 100644 --- a/jdk/src/share/classes/sun/security/ec/ECKeyPairGenerator.java +++ b/jdk/src/share/classes/sun/security/ec/ECKeyPairGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -121,15 +121,16 @@ public final class ECKeyPairGenerator extends KeyPairGeneratorSpi { } random.nextBytes(seed); - long[] handles = generateECKeyPair(keySize, encodedParams, seed); - - // The 'params' object supplied above is equivalent to the native one - // so there is no need to fetch it. - - // handles[0] points to the native private key - BigInteger s = new BigInteger(1, getEncodedBytes(handles[0])); - try { + + long[] handles = generateECKeyPair(keySize, encodedParams, seed); + + // The 'params' object supplied above is equivalent to the native + // one so there is no need to fetch it. + + // handles[0] points to the native private key + BigInteger s = new BigInteger(1, getEncodedBytes(handles[0])); + PrivateKey privateKey = new ECPrivateKeyImpl(s, (ECParameterSpec)params); @@ -163,7 +164,7 @@ public final class ECKeyPairGenerator extends KeyPairGeneratorSpi { * The first handle points to the private key, the second to the public key. */ private static native long[] generateECKeyPair(int keySize, - byte[] encodedParams, byte[] seed); + byte[] encodedParams, byte[] seed) throws GeneralSecurityException; /* * Extracts the encoded key data using the supplied handle. diff --git a/jdk/src/windows/classes/sun/security/mscapi/KeyStore.java b/jdk/src/windows/classes/sun/security/mscapi/KeyStore.java index a89aae18e29..55ac6161074 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/KeyStore.java +++ b/jdk/src/windows/classes/sun/security/mscapi/KeyStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.math.BigInteger; import java.security.AccessController; +import java.security.InvalidKeyException; import java.security.KeyStoreSpi; import java.security.KeyStoreException; import java.security.UnrecoverableKeyException; @@ -123,6 +124,7 @@ abstract class KeyStore extends KeyStoreSpi { * Sets the private key for the keystore entry. */ void setPrivateKey(RSAPrivateCrtKey key) + throws InvalidKeyException, KeyStoreException { byte[] modulusBytes = key.getModulus().toByteArray(); @@ -158,7 +160,7 @@ abstract class KeyStore extends KeyStoreSpi { * Sets the certificate chain for the keystore entry. */ void setCertificateChain(X509Certificate[] chain) - throws CertificateException + throws CertificateException, KeyStoreException { for (int i = 0; i < chain.length; i++) { byte[] encoding = chain[i].getEncoded(); @@ -404,13 +406,16 @@ abstract class KeyStore extends KeyStoreSpi { } entry.setAlias(alias); - entry.setPrivateKey((RSAPrivateCrtKey) key); try { + entry.setPrivateKey((RSAPrivateCrtKey) key); entry.setCertificateChain((X509Certificate[]) chain); } catch (CertificateException ce) { throw new KeyStoreException(ce); + + } catch (InvalidKeyException ike) { + throw new KeyStoreException(ike); } } else { @@ -537,7 +542,7 @@ abstract class KeyStore extends KeyStoreSpi { removeCertificate(getName(), alias, encoding, encoding.length); - } catch (CertificateEncodingException e) { + } catch (CertificateException e) { throw new KeyStoreException("Cannot remove entry: " + e); } @@ -754,8 +759,14 @@ abstract class KeyStore extends KeyStoreSpi { // Clear all key entries entries.clear(); - // Load keys and/or certificate chains - loadKeysOrCertificateChains(getName(), entries); + try { + + // Load keys and/or certificate chains + loadKeysOrCertificateChains(getName(), entries); + + } catch (KeyStoreException e) { + throw new IOException(e); + } } /** @@ -868,7 +879,7 @@ abstract class KeyStore extends KeyStoreSpi { * @param entries Collection of key/certificate. */ private native void loadKeysOrCertificateChains(String name, - Collection entries); + Collection entries) throws KeyStoreException; /** * Stores a DER-encoded certificate into the certificate store @@ -879,7 +890,7 @@ abstract class KeyStore extends KeyStoreSpi { */ private native void storeCertificate(String name, String alias, byte[] encoding, int encodingLength, long hCryptProvider, - long hCryptKey); + long hCryptKey) throws CertificateException, KeyStoreException; /** * Removes the certificate from the certificate store @@ -889,14 +900,16 @@ abstract class KeyStore extends KeyStoreSpi { * @param encoding DER-encoded certificate. */ private native void removeCertificate(String name, String alias, - byte[] encoding, int encodingLength); + byte[] encoding, int encodingLength) + throws CertificateException, KeyStoreException; /** * Destroys the key container. * * @param keyContainerName The name of the key container. */ - private native void destroyKeyContainer(String keyContainerName); + private native void destroyKeyContainer(String keyContainerName) + throws KeyStoreException; /** * Generates a private-key BLOB from a key's components. @@ -910,8 +923,8 @@ abstract class KeyStore extends KeyStoreSpi { byte[] primeQ, byte[] exponentP, byte[] exponentQ, - byte[] crtCoefficient); + byte[] crtCoefficient) throws InvalidKeyException; private native RSAPrivateKey storePrivateKey(byte[] keyBlob, - String keyContainerName, int keySize); + String keyContainerName, int keySize) throws KeyStoreException; } diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java b/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java index 3421450b922..4b146539caf 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java @@ -219,7 +219,12 @@ public final class RSACipher extends CipherSpi { byte[] keyBlob = RSASignature.generatePublicKeyBlob( keyBitLength, modulusBytes, exponentBytes); - key = RSASignature.importPublicKey(keyBlob, keyBitLength); + try { + key = RSASignature.importPublicKey(keyBlob, keyBitLength); + + } catch (KeyStoreException e) { + throw new InvalidKeyException(e); + } } else { throw new InvalidKeyException("Unsupported key type: " + key); diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSAKeyPairGenerator.java b/jdk/src/windows/classes/sun/security/mscapi/RSAKeyPairGenerator.java index a5afe5c16e1..f0d193eb8a6 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSAKeyPairGenerator.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSAKeyPairGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -105,14 +105,20 @@ public final class RSAKeyPairGenerator extends KeyPairGeneratorSpi { // generate the keypair. See JCA doc public KeyPair generateKeyPair() { - // Generate each keypair in a unique key container - RSAKeyPair keys = - generateRSAKeyPair(keySize, - "{" + UUID.randomUUID().toString() + "}"); + try { - return new KeyPair(keys.getPublic(), keys.getPrivate()); + // Generate each keypair in a unique key container + RSAKeyPair keys = + generateRSAKeyPair(keySize, + "{" + UUID.randomUUID().toString() + "}"); + + return new KeyPair(keys.getPublic(), keys.getPrivate()); + + } catch (KeyException e) { + throw new ProviderException(e); + } } private static native RSAKeyPair generateRSAKeyPair(int keySize, - String keyContainerName); + String keyContainerName) throws KeyException; } diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java b/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java index b652fabf729..68148b0e4b5 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java @@ -27,7 +27,9 @@ package sun.security.mscapi; import java.math.BigInteger; import java.security.InvalidKeyException; +import java.security.KeyException; import java.security.KeyRep; +import java.security.ProviderException; import java.security.PublicKey; import sun.security.rsa.RSAPublicKeyImpl; @@ -89,9 +91,14 @@ class RSAPublicKey extends Key implements java.security.interfaces.RSAPublicKey public BigInteger getPublicExponent() { if (exponent == null) { - publicKeyBlob = getPublicKeyBlob(hCryptKey); - exponent = new BigInteger(1, getExponent(publicKeyBlob)); + try { + publicKeyBlob = getPublicKeyBlob(hCryptKey); + exponent = new BigInteger(1, getExponent(publicKeyBlob)); + + } catch (KeyException e) { + throw new ProviderException(e); + } } return exponent; @@ -103,8 +110,14 @@ class RSAPublicKey extends Key implements java.security.interfaces.RSAPublicKey public BigInteger getModulus() { if (modulus == null) { - publicKeyBlob = getPublicKeyBlob(hCryptKey); - modulus = new BigInteger(1, getModulus(publicKeyBlob)); + + try { + publicKeyBlob = getPublicKeyBlob(hCryptKey); + modulus = new BigInteger(1, getModulus(publicKeyBlob)); + + } catch (KeyException e) { + throw new ProviderException(e); + } } return modulus; @@ -147,7 +160,7 @@ class RSAPublicKey extends Key implements java.security.interfaces.RSAPublicKey encoding = new RSAPublicKeyImpl(getModulus(), getPublicExponent()).getEncoded(); - } catch (InvalidKeyException e) { + } catch (KeyException e) { // ignore } } @@ -164,15 +177,15 @@ class RSAPublicKey extends Key implements java.security.interfaces.RSAPublicKey /* * Returns the Microsoft CryptoAPI representation of the key. */ - private native byte[] getPublicKeyBlob(long hCryptKey); + private native byte[] getPublicKeyBlob(long hCryptKey) throws KeyException; /* * Returns the key's public exponent (in big-endian 2's complement format). */ - private native byte[] getExponent(byte[] keyBlob); + private native byte[] getExponent(byte[] keyBlob) throws KeyException; /* * Returns the key's modulus (in big-endian 2's complement format). */ - private native byte[] getModulus(byte[] keyBlob); + private native byte[] getModulus(byte[] keyBlob) throws KeyException; } diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java index 1c80cc029b9..7e80490e652 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ import java.security.PrivateKey; import java.security.InvalidKeyException; import java.security.InvalidParameterException; import java.security.InvalidAlgorithmParameterException; +import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.ProviderException; import java.security.MessageDigest; @@ -146,7 +147,12 @@ abstract class RSASignature extends java.security.SignatureSpi byte[] keyBlob = generatePublicKeyBlob( keyBitLength, modulusBytes, exponentBytes); - publicKey = importPublicKey(keyBlob, keyBitLength); + try { + publicKey = importPublicKey(keyBlob, keyBitLength); + + } catch (KeyStoreException e) { + throw new InvalidKeyException(e); + } } else { publicKey = (sun.security.mscapi.RSAPublicKey) key; @@ -381,11 +387,13 @@ abstract class RSASignature extends java.security.SignatureSpi */ // used by RSACipher static native byte[] generatePublicKeyBlob( - int keyBitLength, byte[] modulus, byte[] publicExponent); + int keyBitLength, byte[] modulus, byte[] publicExponent) + throws InvalidKeyException; /** * Imports a public-key BLOB. */ // used by RSACipher - static native RSAPublicKey importPublicKey(byte[] keyBlob, int keySize); + static native RSAPublicKey importPublicKey(byte[] keyBlob, int keySize) + throws KeyStoreException; } diff --git a/jdk/src/windows/native/sun/security/mscapi/security.cpp b/jdk/src/windows/native/sun/security/mscapi/security.cpp index ed3b16fbca5..f92cc9a9e9e 100644 --- a/jdk/src/windows/native/sun/security/mscapi/security.cpp +++ b/jdk/src/windows/native/sun/security/mscapi/security.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,8 @@ #define CERTIFICATE_PARSING_EXCEPTION \ "java/security/cert/CertificateParsingException" +#define INVALID_KEY_EXCEPTION \ + "java/security/InvalidKeyException" #define KEY_EXCEPTION "java/security/KeyException" #define KEYSTORE_EXCEPTION "java/security/KeyStoreException" #define PROVIDER_EXCEPTION "java/security/ProviderException" @@ -1398,7 +1400,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_RSAPublicKey_getPublicKeyB jbyteArray blob = NULL; DWORD dwBlobLen; - BYTE* pbKeyBlob; + BYTE* pbKeyBlob = NULL; __try { @@ -1656,7 +1658,7 @@ jbyteArray generateKeyBlob( // Sanity check jsize jPublicExponentLength = env->GetArrayLength(jPublicExponent); if (jPublicExponentLength > sizeof(pRsaPubKey->pubexp)) { - ThrowException(env, KEY_EXCEPTION, NTE_BAD_TYPE); + ThrowException(env, INVALID_KEY_EXCEPTION, NTE_BAD_TYPE); __leave; } // The length argument must be the smaller of jPublicExponentLength From 258130179836fe5418fe5f75f1b6382d1738228c Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Thu, 21 Apr 2011 17:39:28 -0400 Subject: [PATCH 029/117] 7038175: Expired PKITS certificates causing CertPathBuilder and CertPathValidator regression test failures Reviewed-by: xuelei --- .../certpath/CrlRevocationChecker.java | 5 +++-- .../certpath/DistributionPointFetcher.java | 18 +++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java index 1f692f235b6..977d465ac47 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java @@ -312,7 +312,8 @@ class CrlRevocationChecker extends PKIXCertPathChecker { DistributionPointFetcher.getInstance(); // all CRLs returned by the DP Fetcher have also been verified mApprovedCRLs.addAll(store.getCRLs(sel, signFlag, prevKey, - mSigProvider, mStores, reasonsMask, trustAnchors)); + mSigProvider, mStores, reasonsMask, trustAnchors, + mParams.getDate())); } catch (Exception e) { if (debug != null) { debug.println("CrlRevocationChecker.verifyRevocationStatus() " @@ -769,7 +770,7 @@ class CrlRevocationChecker extends PKIXCertPathChecker { for (X509CRL crl : crls) { if (dpf.verifyCRL(certImpl, point, crl, reasonsMask, signFlag, prevKey, mSigProvider, - trustAnchors, mStores)) { + trustAnchors, mStores, mParams.getDate())) { results.add(crl); } } diff --git a/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java b/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java index 56c5ab91c43..35d7b2c87e9 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java @@ -90,8 +90,8 @@ class DistributionPointFetcher { */ Collection getCRLs(X509CRLSelector selector, boolean signFlag, PublicKey prevKey, String provider, List certStores, - boolean[] reasonsMask, - Set trustAnchors) throws CertStoreException { + boolean[] reasonsMask, Set trustAnchors, + Date validity) throws CertStoreException { if (USE_CRLDP == false) { return Collections.emptySet(); @@ -122,7 +122,7 @@ class DistributionPointFetcher { DistributionPoint point = t.next(); Collection crls = getCRLs(selector, certImpl, point, reasonsMask, signFlag, prevKey, provider, - certStores, trustAnchors); + certStores, trustAnchors, validity); results.addAll(crls); } if (debug != null) { @@ -143,7 +143,8 @@ class DistributionPointFetcher { private Collection getCRLs(X509CRLSelector selector, X509CertImpl certImpl, DistributionPoint point, boolean[] reasonsMask, boolean signFlag, PublicKey prevKey, String provider, - List certStores, Set trustAnchors) { + List certStores, Set trustAnchors, + Date validity) { // check for full name GeneralNames fullName = point.getFullName(); @@ -196,7 +197,7 @@ class DistributionPointFetcher { selector.setIssuerNames(null); if (selector.match(crl) && verifyCRL(certImpl, point, crl, reasonsMask, signFlag, prevKey, provider, trustAnchors, - certStores)) { + certStores, validity)) { crls.add(crl); } } catch (Exception e) { @@ -280,13 +281,15 @@ class DistributionPointFetcher { * @param trustAnchors a {@code Set} of {@code TrustAnchor}s * @param certStores a {@code List} of {@code CertStore}s to be used in * finding certificates and CRLs + * @param validity the time for which the validity of the CRL issuer's + * certification path should be determined * @return true if ok, false if not */ boolean verifyCRL(X509CertImpl certImpl, DistributionPoint point, X509CRL crl, boolean[] reasonsMask, boolean signFlag, PublicKey prevKey, String provider, - Set trustAnchors, - List certStores) throws CRLException, IOException { + Set trustAnchors, List certStores, + Date validity) throws CRLException, IOException { boolean indirectCRL = false; X509CRLImpl crlImpl = X509CRLImpl.toImpl(crl); @@ -605,6 +608,7 @@ class DistributionPointFetcher { } params.setCertStores(certStores); params.setSigProvider(provider); + params.setDate(validity); try { CertPathBuilder builder = CertPathBuilder.getInstance("PKIX"); PKIXCertPathBuilderResult result = From 896553f4395e1373247869bf059b7ab4af6e1d24 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 21 Apr 2011 15:55:59 -0700 Subject: [PATCH 030/117] 6998871: Support making the Throwable.stackTrace field immutable Reviewed-by: dholmes, mchung, forax --- .../java/lang/ArithmeticException.java | 3 +- jdk/src/share/classes/java/lang/Error.java | 31 ++- .../share/classes/java/lang/Exception.java | 22 ++- .../java/lang/NullPointerException.java | 3 +- .../classes/java/lang/OutOfMemoryError.java | 3 +- .../classes/java/lang/RuntimeException.java | 23 ++- .../share/classes/java/lang/Throwable.java | 185 ++++++++++++++---- jdk/src/share/native/java/lang/Throwable.c | 4 +- .../lang/Throwable/ChainedExceptions.java | 34 ++-- .../Throwable/StackTraceSerialization.java | 63 ++++-- .../lang/Throwable/SuppressedExceptions.java | 3 +- 11 files changed, 295 insertions(+), 79 deletions(-) diff --git a/jdk/src/share/classes/java/lang/ArithmeticException.java b/jdk/src/share/classes/java/lang/ArithmeticException.java index 0d6ed9164ef..af00777dbcd 100644 --- a/jdk/src/share/classes/java/lang/ArithmeticException.java +++ b/jdk/src/share/classes/java/lang/ArithmeticException.java @@ -32,7 +32,8 @@ package java.lang; * * {@code ArithmeticException} objects may be constructed by the * virtual machine as if {@linkplain Throwable#Throwable(String, - * Throwable, boolean) suppression were disabled}. + * Throwable, boolean, boolean) suppression were disabled and/or the + * stack trace was not writable}. * * @author unascribed * @since JDK1.0 diff --git a/jdk/src/share/classes/java/lang/Error.java b/jdk/src/share/classes/java/lang/Error.java index 1c5c50797f4..d18c15f84ce 100644 --- a/jdk/src/share/classes/java/lang/Error.java +++ b/jdk/src/share/classes/java/lang/Error.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,7 +79,7 @@ public class Error extends Throwable { * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is + * {@link #getCause()} method). (A {@code null} value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @since 1.4 @@ -90,13 +90,13 @@ public class Error extends Throwable { /** * Constructs a new error with the specified cause and a detail - * message of (cause==null ? null : cause.toString()) (which - * typically contains the class and detail message of cause). + * message of {@code (cause==null ? null : cause.toString())} (which + * typically contains the class and detail message of {@code cause}). * This constructor is useful for errors that are little more than * wrappers for other throwables. * * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is + * {@link #getCause()} method). (A {@code null} value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @since 1.4 @@ -104,4 +104,25 @@ public class Error extends Throwable { public Error(Throwable cause) { super(cause); } + + /** + * Constructs a new error with the specified detail message, + * cause, suppression enabled or disabled, and writable stack + * trace enabled or disabled. + * + * @param message the detail message. + * @param cause the cause. (A {@code null} value is permitted, + * and indicates that the cause is nonexistent or unknown.) + * @param enableSuppression whether or not suppression is enabled + * or disabled + * @param writableStackTrace whether or not the stack trace should + * be writable + * + * @since 1.7 + */ + protected Error(String message, Throwable cause, + boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/jdk/src/share/classes/java/lang/Exception.java b/jdk/src/share/classes/java/lang/Exception.java index 944aa052369..0bcbf9cd045 100644 --- a/jdk/src/share/classes/java/lang/Exception.java +++ b/jdk/src/share/classes/java/lang/Exception.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,4 +101,24 @@ public class Exception extends Throwable { public Exception(Throwable cause) { super(cause); } + + /** + * Constructs a new exception with the specified detail message, + * cause, suppression enabled or disabled, and writable stack + * trace enabled or disabled. + * + * @param message the detail message. + * @param cause the cause. (A {@code null} value is permitted, + * and indicates that the cause is nonexistent or unknown.) + * @param enableSuppression whether or not suppression is enabled + * or disabled + * @param writableStackTrace whether or not the stack trace should + * be writable + * @since 1.7 + */ + protected Exception(String message, Throwable cause, + boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/jdk/src/share/classes/java/lang/NullPointerException.java b/jdk/src/share/classes/java/lang/NullPointerException.java index 0472710f23f..5b87ec4fd7c 100644 --- a/jdk/src/share/classes/java/lang/NullPointerException.java +++ b/jdk/src/share/classes/java/lang/NullPointerException.java @@ -43,7 +43,8 @@ package java.lang; * * {@code NullPointerException} objects may be constructed by the * virtual machine as if {@linkplain Throwable#Throwable(String, - * Throwable, boolean) suppression were disabled}. + * Throwable, boolean, boolean) suppression were disabled and/or the + * stack trace was not writable}. * * @author unascribed * @since JDK1.0 diff --git a/jdk/src/share/classes/java/lang/OutOfMemoryError.java b/jdk/src/share/classes/java/lang/OutOfMemoryError.java index 37b0ae6f476..0f9df4e2f16 100644 --- a/jdk/src/share/classes/java/lang/OutOfMemoryError.java +++ b/jdk/src/share/classes/java/lang/OutOfMemoryError.java @@ -32,7 +32,8 @@ package java.lang; * * {@code OutOfMemoryError} objects may be constructed by the virtual * machine as if {@linkplain Throwable#Throwable(String, Throwable, - * boolean) suppression were disabled}. + * boolean, boolean) suppression were disabled and/or the stack trace was not + * writable}. * * @author unascribed * @since JDK1.0 diff --git a/jdk/src/share/classes/java/lang/RuntimeException.java b/jdk/src/share/classes/java/lang/RuntimeException.java index 85c0729dc9f..c9731e895a9 100644 --- a/jdk/src/share/classes/java/lang/RuntimeException.java +++ b/jdk/src/share/classes/java/lang/RuntimeException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,4 +95,25 @@ public class RuntimeException extends Exception { public RuntimeException(Throwable cause) { super(cause); } + + /** + * Constructs a new runtime exception with the specified detail + * message, cause, suppression enabled or disabled, and writable + * stack trace enabled or disabled. + * + * @param message the detail message. + * @param cause the cause. (A {@code null} value is permitted, + * and indicates that the cause is nonexistent or unknown.) + * @param enableSuppression whether or not suppression is enabled + * or disabled + * @param writableStackTrace whether or not the stack trace should + * be writable + * + * @since 1.7 + */ + protected RuntimeException(String message, Throwable cause, + boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/jdk/src/share/classes/java/lang/Throwable.java b/jdk/src/share/classes/java/lang/Throwable.java index 8468ecf0d30..fdfa2525b5f 100644 --- a/jdk/src/share/classes/java/lang/Throwable.java +++ b/jdk/src/share/classes/java/lang/Throwable.java @@ -129,16 +129,41 @@ public class Throwable implements Serializable { */ private String detailMessage; + + /** + * Holder class to defer initializing sentinel objects only used + * for serialization. + */ + private static class SentinelHolder { + /** + * {@linkplain #setStackTrace(StackTraceElement[]) Setting the + * stack trace} to a one-element array containing this sentinel + * value indicates future attempts to set the stack trace will be + * ignored. The sentinal is equal to the result of calling:
    + * {@code new StackTraceElement("", "", null, Integer.MIN_VALUE)} + */ + public static final StackTraceElement STACK_TRACE_ELEMENT_SENTINEL = + new StackTraceElement("", "", null, Integer.MIN_VALUE); + + /** + * Sentinel value used in the serial form to indicate an immutable + * stack trace. + */ + public static final StackTraceElement[] STACK_TRACE_SENTINEL = + new StackTraceElement[] {STACK_TRACE_ELEMENT_SENTINEL}; + } + /** * A shared value for an empty stack. */ - private static final StackTraceElement[] EMPTY_STACK = new StackTraceElement[0]; + private static final StackTraceElement[] UNASSIGNED_STACK = new StackTraceElement[0]; /* * To allow Throwable objects to be made immutable and safely * reused by the JVM, such as OutOfMemoryErrors, fields of - * Throwable that are writable in response to user actions, cause - * and suppressedExceptions obey the following protocol: + * Throwable that are writable in response to user actions, cause, + * stackTrace, and suppressedExceptions obey the following + * protocol: * * 1) The fields are initialized to a non-null sentinel value * which indicates the value has logically not been set. @@ -174,10 +199,15 @@ public class Throwable implements Serializable { /** * The stack trace, as returned by {@link #getStackTrace()}. * + * The field is initialized to a zero-length array. A {@code + * null} value of this field indicates subsequent calls to {@link + * #setStackTrace(StackTraceElement[])} and {@link + * #fillInStackTrace()} will be be no-ops. + * * @serial * @since 1.4 */ - private StackTraceElement[] stackTrace; + private StackTraceElement[] stackTrace = UNASSIGNED_STACK; // Setting this static field introduces an acceptable // initialization dependency on a few java.util classes. @@ -284,24 +314,36 @@ public class Throwable implements Serializable { /** * Constructs a new throwable with the specified detail message, - * cause, and {@linkplain #addSuppressed suppression} enabled or - * disabled. If suppression is disabled, {@link #getSuppressed} - * for this object will return a zero-length array and calls to - * {@link #addSuppressed} that would otherwise append an exception - * to the suppressed list will have no effect. + * cause, {@linkplain #addSuppressed suppression} enabled or + * disabled, and writable stack trace enabled or disabled. If + * suppression is disabled, {@link #getSuppressed} for this object + * will return a zero-length array and calls to {@link + * #addSuppressed} that would otherwise append an exception to the + * suppressed list will have no effect. If the writable stack + * trace is false, this constructor will not call {@link + * #fillInStackTrace()}, a {@code null} will be written to the + * {@code stackTrace} field, and subsequent calls to {@code + * fillInStackTrace} and {@link + * #setStackTrace(StackTraceElement[])} will not set the stack + * trace. If the writable stack trace is false, {@link + * #getStackTrace} will return a zero length array. * *

    Note that the other constructors of {@code Throwable} treat - * suppression as being enabled. Subclasses of {@code Throwable} - * should document any conditions under which suppression is - * disabled. Disabling of suppression should only occur in - * exceptional circumstances where special requirements exist, - * such as a virtual machine reusing exception objects under - * low-memory situations. + * suppression as being enabled and the stack trace as being + * writable. Subclasses of {@code Throwable} should document any + * conditions under which suppression is disabled and document + * conditions under which the stack trace is not writable. + * Disabling of suppression should only occur in exceptional + * circumstances where special requirements exist, such as a + * virtual machine reusing exception objects under low-memory + * situations. * * @param message the detail message. * @param cause the cause. (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @param enableSuppression whether or not suppression is enabled or disabled + * @param writableStackTrace whether or not the stack trace should be + * writable * * @see OutOfMemoryError * @see NullPointerException @@ -309,8 +351,13 @@ public class Throwable implements Serializable { * @since 1.7 */ protected Throwable(String message, Throwable cause, - boolean enableSuppression) { - fillInStackTrace(); + boolean enableSuppression, + boolean writableStackTrace) { + if (writableStackTrace) { + fillInStackTrace(); + } else { + stackTrace = null; + } detailMessage = message; this.cause = cause; if (!enableSuppression) @@ -707,10 +754,22 @@ public class Throwable implements Serializable { * {@code Throwable} object information about the current state of * the stack frames for the current thread. * + *

    If the stack trace of this {@code Throwable} {@linkplain + * Throwable#Throwable(String, Throwable, boolean, boolean) is not + * writable}, calling this method has no effect. + * * @return a reference to this {@code Throwable} instance. * @see java.lang.Throwable#printStackTrace() */ - public synchronized native Throwable fillInStackTrace(); + public synchronized Throwable fillInStackTrace() { + if (stackTrace != null) { + fillInStackTrace(0); + stackTrace = UNASSIGNED_STACK; + } + return this; + } + + private native Throwable fillInStackTrace(int dummy); /** * Provides programmatic access to the stack trace information printed by @@ -740,12 +799,15 @@ public class Throwable implements Serializable { } private synchronized StackTraceElement[] getOurStackTrace() { - // Initialize stack trace if this is the first call to this method - if (stackTrace == null) { + // Initialize stack trace field with information from + // backtrace if this is the first call to this method + if (stackTrace == UNASSIGNED_STACK) { int depth = getStackTraceDepth(); stackTrace = new StackTraceElement[depth]; for (int i=0; i < depth; i++) stackTrace[i] = getStackTraceElement(i); + } else if (stackTrace == null) { + return UNASSIGNED_STACK; } return stackTrace; } @@ -761,6 +823,11 @@ public class Throwable implements Serializable { * when a throwable is constructed or deserialized when a throwable is * read from a serialization stream. * + *

    If the stack trace of this {@code Throwable} {@linkplain + * Throwable#Throwable(String, Throwable, boolean, boolean) is not + * writable}, calling this method has no effect other than + * validating its argument. + * * @param stackTrace the stack trace elements to be associated with * this {@code Throwable}. The specified array is copied by this * call; changes in the specified array after the method invocation @@ -768,16 +835,21 @@ public class Throwable implements Serializable { * trace. * * @throws NullPointerException if {@code stackTrace} is - * {@code null}, or if any of the elements of + * {@code null} or if any of the elements of * {@code stackTrace} are {@code null} * * @since 1.4 */ public void setStackTrace(StackTraceElement[] stackTrace) { + // Validate argument StackTraceElement[] defensiveCopy = stackTrace.clone(); - for (int i = 0; i < defensiveCopy.length; i++) + for (int i = 0; i < defensiveCopy.length; i++) { if (defensiveCopy[i] == null) throw new NullPointerException("stackTrace[" + i + "]"); + } + + if (this.stackTrace == null) // Immutable stack + return; synchronized (this) { this.stackTrace = defensiveCopy; @@ -808,7 +880,11 @@ public class Throwable implements Serializable { * well-formedness constraints on fields. Null entries and * self-pointers are not allowed in the list of {@code * suppressedExceptions}. Null entries are not allowed for stack - * trace elements. + * trace elements. A null stack trace in the serial form results + * in a zero-length stack element array. A single-element stack + * trace whose entry is equal to {@code new StackTraceElement("", + * "", null, Integer.MIN_VALUE)} results in a {@code null} {@code + * stackTrace} field. * * Note that there are no constraints on the value the {@code * cause} field can hold; both {@code null} and {@code this} are @@ -837,26 +913,63 @@ public class Throwable implements Serializable { suppressedExceptions = suppressed; } // else a null suppressedExceptions field remains null + /* + * For zero-length stack traces, use a clone of + * UNASSIGNED_STACK rather than UNASSIGNED_STACK itself to + * allow identity comparison against UNASSIGNED_STACK in + * getOurStackTrace. The identity of UNASSIGNED_STACK in + * stackTrace indicates to the getOurStackTrace method that + * the stackTrace needs to be constructed from the information + * in backtrace. + */ if (stackTrace != null) { - for (StackTraceElement ste : stackTrace) { - if (ste == null) - throw new NullPointerException("null StackTraceElement in serial stream. "); + if (stackTrace.length == 0) { + stackTrace = UNASSIGNED_STACK.clone(); + } else if (stackTrace.length == 1 && + // Check for the marker of an immutable stack trace + SentinelHolder.STACK_TRACE_ELEMENT_SENTINEL.equals(stackTrace[0])) { + stackTrace = null; + } else { // Verify stack trace elements are non-null. + for(StackTraceElement ste : stackTrace) { + if (ste == null) + throw new NullPointerException("null StackTraceElement in serial stream. "); + } } } else { - // A null stackTrace field in the serial form can result from - // an exception serialized without that field in older JDK releases. - stackTrace = EMPTY_STACK; + // A null stackTrace field in the serial form can result + // from an exception serialized without that field in + // older JDK releases; treat such exceptions as having + // empty stack traces. + stackTrace = UNASSIGNED_STACK.clone(); } - } /** * Write a {@code Throwable} object to a stream. + * + * A {@code null} stack trace field is represented in the serial + * form as a one-element array whose element is equal to {@code + * new StackTraceElement("", "", null, Integer.MIN_VALUE)}. */ private synchronized void writeObject(ObjectOutputStream s) throws IOException { - getOurStackTrace(); // Ensure that stackTrace field is initialized. - s.defaultWriteObject(); + // Ensure that the stackTrace field is initialized to a + // non-null value, if appropriate. As of JDK 7, a null stack + // trace field is a valid value indicating the stack trace + // should not be set. + getOurStackTrace(); + ObjectOutputStream.PutField fields = s.putFields(); + + fields.put("detailMessage", detailMessage); + fields.put("cause", cause); + // Serialize a null stacktrace using the stack trace sentinel. + if (stackTrace == null) + fields.put("stackTrace", SentinelHolder.STACK_TRACE_SENTINEL); + else + fields.put("stackTrace", stackTrace); + fields.put("suppressedExceptions", suppressedExceptions); + + s.writeFields(); } /** @@ -866,8 +979,8 @@ public class Throwable implements Serializable { * try}-with-resources statement. * *

    The suppression behavior is enabled unless disabled - * {@linkplain #Throwable(String, Throwable, boolean) via a - * constructor}. When suppression is disabled, this method does + * {@linkplain #Throwable(String, Throwable, boolean, boolean) via + * a constructor}. When suppression is disabled, this method does * nothing other than to validate its argument. * *

    Note that when one exception {@linkplain @@ -933,8 +1046,8 @@ public class Throwable implements Serializable { * statement, in order to deliver this exception. * * If no exceptions were suppressed or {@linkplain - * Throwable(String, Throwable, boolean) suppression is disabled}, - * an empty array is returned. + * #Throwable(String, Throwable, boolean, boolean) suppression is + * disabled}, an empty array is returned. * * @return an array containing all of the exceptions that were * suppressed to deliver this exception. diff --git a/jdk/src/share/native/java/lang/Throwable.c b/jdk/src/share/native/java/lang/Throwable.c index ebef64f025a..aaf3c265865 100644 --- a/jdk/src/share/native/java/lang/Throwable.c +++ b/jdk/src/share/native/java/lang/Throwable.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ * `this' so you can write 'throw e.fillInStackTrace();' */ JNIEXPORT jobject JNICALL -Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, jobject throwable) +Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, jobject throwable, int dummy) { JVM_FillInStackTrace(env, throwable); return throwable; diff --git a/jdk/test/java/lang/Throwable/ChainedExceptions.java b/jdk/test/java/lang/Throwable/ChainedExceptions.java index a6577ba4693..2c2fa398d11 100644 --- a/jdk/test/java/lang/Throwable/ChainedExceptions.java +++ b/jdk/test/java/lang/Throwable/ChainedExceptions.java @@ -13,28 +13,28 @@ public class ChainedExceptions { StackTraceElement[] highTrace = e.getStackTrace(); int depthTrim = highTrace.length - 2; - check(highTrace[0], "a", 48); - check(highTrace[1], "main", 11); + check(e, highTrace[0], "a", 48); + check(e, highTrace[1], "main", 11); Throwable mid = e.getCause(); StackTraceElement[] midTrace = mid.getStackTrace(); if (midTrace.length - depthTrim != 4) throw new RuntimeException("Mid depth"); - check(midTrace[0], "c", 58); - check(midTrace[1], "b", 52); - check(midTrace[2], "a", 46); - check(midTrace[3], "main", 11); + check(mid, midTrace[0], "c", 58); + check(mid, midTrace[1], "b", 52); + check(mid, midTrace[2], "a", 46); + check(mid, midTrace[3], "main", 11); Throwable low = mid.getCause(); StackTraceElement[] lowTrace = low.getStackTrace(); if (lowTrace.length - depthTrim != 6) throw new RuntimeException("Low depth"); - check(lowTrace[0], "e", 65); - check(lowTrace[1], "d", 62); - check(lowTrace[2], "c", 56); - check(lowTrace[3], "b", 52); - check(lowTrace[4], "a", 46); - check(lowTrace[5], "main", 11); + check(low, lowTrace[0], "e", 65); + check(low, lowTrace[1], "d", 62); + check(low, lowTrace[2], "c", 56); + check(low, lowTrace[3], "b", 52); + check(low, lowTrace[4], "a", 46); + check(low, lowTrace[5], "main", 11); if (low.getCause() != null) throw new RuntimeException("Low cause != null"); @@ -68,15 +68,15 @@ public class ChainedExceptions { private static final String OUR_CLASS = ChainedExceptions.class.getName(); private static final String OUR_FILE_NAME = "ChainedExceptions.java"; - private static void check(StackTraceElement e, String methodName, int n) { + private static void check(Throwable t, StackTraceElement e, String methodName, int n) { if (!e.getClassName().equals(OUR_CLASS)) - throw new RuntimeException("Class: " + e); + throw new RuntimeException("Class: " + e, t); if (!e.getMethodName().equals(methodName)) - throw new RuntimeException("Method name: " + e); + throw new RuntimeException("Method name: " + e, t); if (!e.getFileName().equals(OUR_FILE_NAME)) - throw new RuntimeException("File name: " + e); + throw new RuntimeException("File name: " + e, t); if (e.getLineNumber() != n) - throw new RuntimeException("Line number: " + e); + throw new RuntimeException("Line number: " + e, t); } } diff --git a/jdk/test/java/lang/Throwable/StackTraceSerialization.java b/jdk/test/java/lang/Throwable/StackTraceSerialization.java index 2d2f4f42a23..29a4d2a8c13 100644 --- a/jdk/test/java/lang/Throwable/StackTraceSerialization.java +++ b/jdk/test/java/lang/Throwable/StackTraceSerialization.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * 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 @@ import java.util.*; /* * @test - * @bug 4202914 4363318 6991528 + * @bug 4202914 4363318 6991528 6998871 * @summary Basic test of serialization of stack trace information * @author Josh Bloch */ @@ -37,14 +37,52 @@ public class StackTraceSerialization { testWithFillInStackTrace(); } - private static void testWithSetStackTrace() throws Exception { - Throwable t = new Throwable(); + private static void testWithSetStackTrace() { + StackTraceElement[] stackTrace = {new StackTraceElement("foo", "bar", "baz", -1)}; - t.setStackTrace(new StackTraceElement[] - {new StackTraceElement("foo", "bar", "baz", -1)}); + Throwable t = new TestThrowable(true, false); // Immutable and empty stack + assertEmptyStackTrace(t); + + // Verify fillInStackTrace is now a no-op. + t.fillInStackTrace(); + assertEmptyStackTrace(t); + + // Verify setStackTrace is now a no-op. + t.setStackTrace(stackTrace); + assertEmptyStackTrace(t); + + // Verify null-handling + try { + t.setStackTrace(null); + throw new RuntimeException("No NPE on a null stack trace."); + } catch(NullPointerException npe) { + assertEmptyStackTrace(t); + } + + try { + t.setStackTrace(new StackTraceElement[]{null}); + throw new RuntimeException("No NPE on a null stack trace element."); + } catch(NullPointerException npe) { + assertEmptyStackTrace(t); + } if (!equal(t, reconstitute(t))) - throw new Exception("Unequal Throwables with set stacktrace"); + throw new RuntimeException("Unequal Throwables with set stacktrace"); + + Throwable t2 = new Throwable(); + t2.setStackTrace(stackTrace); + if (!equal(t2, reconstitute(t2))) + throw new RuntimeException("Unequal Throwables with set stacktrace"); + + } + + private static class TestThrowable extends Throwable { + public TestThrowable(boolean enableSuppression, + boolean writableStackTrace) { + super("the medium", null, + enableSuppression, + writableStackTrace); + } } private static void assertEmptyStackTrace(Throwable t) { @@ -52,7 +90,7 @@ public class StackTraceSerialization { throw new AssertionError("Nonempty stacktrace."); } - private static void testWithFillInStackTrace() throws Exception { + private static void testWithFillInStackTrace() { Throwable original = null; try { a(); @@ -61,16 +99,14 @@ public class StackTraceSerialization { } if (!equal(original, reconstitute(original))) - throw new Exception("Unequal Throwables with filled-in stacktrace"); + throw new RuntimeException("Unequal Throwables with filled-in stacktrace"); } - /** * Serialize the argument and return the deserialized result. */ - private static Throwable reconstitute(Throwable t) throws Exception { + private static Throwable reconstitute(Throwable t) { Throwable result = null; - try(ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bout)) { out.writeObject(t); @@ -80,8 +116,9 @@ public class StackTraceSerialization { ObjectInputStream in = new ObjectInputStream(bin)) { result = (Throwable) in.readObject(); } + } catch(IOException | ClassNotFoundException e) { + throw new RuntimeException(e); } - return result; } diff --git a/jdk/test/java/lang/Throwable/SuppressedExceptions.java b/jdk/test/java/lang/Throwable/SuppressedExceptions.java index b987600dca3..f92fee4e57d 100644 --- a/jdk/test/java/lang/Throwable/SuppressedExceptions.java +++ b/jdk/test/java/lang/Throwable/SuppressedExceptions.java @@ -193,6 +193,7 @@ public class SuppressedExceptions { // Make sure addSuppressed(null) throws an NPE try { t.addSuppressed(null); + throw new RuntimeException("NPE not thrown!"); } catch(NullPointerException e) { ; // Expected } @@ -204,7 +205,7 @@ public class SuppressedExceptions { private static class NoSuppression extends Throwable { public NoSuppression(boolean enableSuppression) { - super("The medium.", null, enableSuppression); + super("The medium.", null, enableSuppression, true); } } } From c5114e7e0ff49ee858523a890f421f906012f2f2 Mon Sep 17 00:00:00 2001 From: Sean Coffey Date: Fri, 22 Apr 2011 11:03:39 +0100 Subject: [PATCH 031/117] 7025227: SSLSocketImpl does not close the TCP layer socket if a close notify cannot be sent to the peer 6932403: SSLSocketImpl state issue Reviewed-by: xuelei --- .../sun/security/ssl/SSLSocketImpl.java | 98 ++++++++++++++----- 1 file changed, 76 insertions(+), 22 deletions(-) diff --git a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java index 8bc8c22a9fd..d12eaf1c091 100644 --- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java +++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java @@ -1453,6 +1453,21 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { } } + private void closeSocket(boolean selfInitiated) throws IOException { + if ((debug != null) && Debug.isOn("ssl")) { + System.out.println(threadName() + ", called closeSocket(selfInitiated)"); + } + if (self == this) { + super.close(); + } else if (autoClose) { + self.close(); + } else if (selfInitiated) { + // layered && non-autoclose + // read close_notify alert to clear input stream + waitForClose(false); + } + } + /* * Closing the connection is tricky ... we can't officially close the * connection until we know the other end is ready to go away too, @@ -1491,6 +1506,8 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { } int state = getConnectionState(); + boolean closeSocketCalled = false; + Throwable cachedThrowable = null; try { switch (state) { /* @@ -1531,8 +1548,18 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { return; // connection was closed while we waited } if (state != cs_SENT_CLOSE) { - warning(Alerts.alert_close_notify); - connectionState = cs_SENT_CLOSE; + try { + warning(Alerts.alert_close_notify); + connectionState = cs_SENT_CLOSE; + } catch (Throwable th) { + // we need to ensure socket is closed out + // if we encounter any errors. + connectionState = cs_ERROR; + // cache this for later use + cachedThrowable = th; + closeSocketCalled = true; + closeSocket(selfInitiated); + } } } // If state was cs_SENT_CLOSE before, we don't do the actual @@ -1569,22 +1596,11 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { return; } - if (self == this) { - super.close(); - } else if (autoClose) { - self.close(); - } else if (selfInitiated) { - // layered && non-autoclose - // read close_notify alert to clear input stream - waitForClose(false); + if (!closeSocketCalled) { + closeSocketCalled = true; + closeSocket(selfInitiated); } - // See comment in changeReadCiphers() - readCipher.dispose(); - writeCipher.dispose(); - - // state will be set to cs_CLOSED in the finally block below - break; } } finally { @@ -1595,6 +1611,20 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { // notify any threads waiting for the closing to finish this.notifyAll(); } + if (closeSocketCalled) { + // Dispose of ciphers since we've closed socket + disposeCiphers(); + } + if (cachedThrowable != null) { + /* + * Rethrow the error to the calling method + * The Throwable caught can only be an Error or RuntimeException + */ + if (cachedThrowable instanceof Error) + throw (Error) cachedThrowable; + if (cachedThrowable instanceof RuntimeException) + throw (RuntimeException) cachedThrowable; + } } } @@ -1641,6 +1671,24 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { } } + /** + * Called by closeInternal() only. Be sure to consider the + * synchronization locks carefully before calling it elsewhere. + */ + private void disposeCiphers() { + // See comment in changeReadCiphers() + synchronized (readLock) { + readCipher.dispose(); + } + // See comment in changeReadCiphers() + writeLock.lock(); + try { + writeCipher.dispose(); + } finally { + writeLock.unlock(); + } + } + // // EXCEPTION AND ALERT HANDLING // @@ -1761,7 +1809,9 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { } int oldState = connectionState; - connectionState = cs_ERROR; + if (connectionState < cs_ERROR) { + connectionState = cs_ERROR; + } /* * Has there been an error received yet? If not, remember it. @@ -1792,13 +1842,17 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { * Clean up our side. */ closeSocket(); + // Another thread may have disposed the ciphers during closing + if (connectionState < cs_CLOSED) { + connectionState = (oldState == cs_APP_CLOSED) ? cs_APP_CLOSED + : cs_CLOSED; - // See comment in changeReadCiphers() - readCipher.dispose(); - writeCipher.dispose(); + // We should lock readLock and writeLock if no deadlock risks. + // See comment in changeReadCiphers() + readCipher.dispose(); + writeCipher.dispose(); + } - connectionState = (oldState == cs_APP_CLOSED) ? cs_APP_CLOSED - : cs_CLOSED; throw closeReason; } From 4071e413e5a994efd39d3ef864367cde582a3f73 Mon Sep 17 00:00:00 2001 From: Doug Lea Date: Fri, 22 Apr 2011 16:33:23 +0100 Subject: [PATCH 032/117] 7038885: Improved bulk operation disclaimers for concurrent collections Reviewed-by: chegar --- .../concurrent/ConcurrentLinkedDeque.java | 13 ++++++++++--- .../concurrent/ConcurrentLinkedQueue.java | 9 ++++++++- .../concurrent/ConcurrentSkipListMap.java | 19 +++++++++++-------- .../concurrent/ConcurrentSkipListSet.java | 14 ++++++++------ .../util/concurrent/LinkedTransferQueue.java | 13 ++++++++++--- 5 files changed, 47 insertions(+), 21 deletions(-) diff --git a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java index 4c1c4616263..21d59cfc460 100644 --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java @@ -59,10 +59,17 @@ import java.util.Queue; * ConcurrentModificationException}, and may proceed concurrently with * other operations. * - *

    Beware that, unlike in most collections, the {@code size} - * method is NOT a constant-time operation. Because of the + *

    Beware that, unlike in most collections, the {@code size} method + * is NOT a constant-time operation. Because of the * asynchronous nature of these deques, determining the current number - * of elements requires a traversal of the elements. + * of elements requires a traversal of the elements, and so may report + * inaccurate results if this collection is modified during traversal. + * Additionally, the bulk operations {@code addAll}, + * {@code removeAll}, {@code retainAll}, {@code containsAll}, + * {@code equals}, and {@code toArray} are not guaranteed + * to be performed atomically. For example, an iterator operating + * concurrently with an {@code addAll} operation might view only some + * of the added elements. * *

    This class and its iterator implement all of the optional * methods of the {@link Deque} and {@link Iterator} interfaces. diff --git a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java index 09f21ef1504..fcdfcf97eb6 100644 --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java @@ -72,7 +72,14 @@ import java.util.Queue; *

    Beware that, unlike in most collections, the {@code size} method * is NOT a constant-time operation. Because of the * asynchronous nature of these queues, determining the current number - * of elements requires a traversal of the elements. + * of elements requires a traversal of the elements, and so may report + * inaccurate results if this collection is modified during traversal. + * Additionally, the bulk operations {@code addAll}, + * {@code removeAll}, {@code retainAll}, {@code containsAll}, + * {@code equals}, and {@code toArray} are not guaranteed + * to be performed atomically. For example, an iterator operating + * concurrently with an {@code addAll} operation might view only some + * of the added elements. * *

    This class and its iterator implement all of the optional * methods of the {@link Queue} and {@link Iterator} interfaces. diff --git a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java index 8e3e4d0a7cc..8d23964512b 100644 --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java @@ -66,12 +66,13 @@ import java.util.concurrent.atomic.*; *

    Beware that, unlike in most collections, the size * method is not a constant-time operation. Because of the * asynchronous nature of these maps, determining the current number - * of elements requires a traversal of the elements. Additionally, - * the bulk operations putAll, equals, and - * clear are not guaranteed to be performed - * atomically. For example, an iterator operating concurrently with a - * putAll operation might view only some of the added - * elements. + * of elements requires a traversal of the elements, and so may report + * inaccurate results if this collection is modified during traversal. + * Additionally, the bulk operations putAll, equals, + * toArray, containsValue, and clear are + * not guaranteed to be performed atomically. For example, an + * iterator operating concurrently with a putAll operation + * might view only some of the added elements. * *

    This class and its views and iterators implement all of the * optional methods of the {@link Map} and {@link Iterator} @@ -1661,7 +1662,9 @@ public class ConcurrentSkipListMap extends AbstractMap /** * Returns true if this map maps one or more keys to the * specified value. This operation requires time linear in the - * map size. + * map size. Additionally, it is possible for the map to change + * during execution of this method, in which case the returned + * result may be inaccurate. * * @param value value whose presence in this map is to be tested * @return true if a mapping to value exists; @@ -1751,7 +1754,7 @@ public class ConcurrentSkipListMap extends AbstractMap * * @return a navigable set view of the keys in this map */ - public NavigableSet keySet() { + public NavigableSet keySet() { KeySet ks = keySet; return (ks != null) ? ks : (keySet = new KeySet(this)); } diff --git a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java index eb90bb0bf9f..7b5dc79a932 100644 --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java @@ -58,12 +58,14 @@ import sun.misc.Unsafe; *

    Beware that, unlike in most collections, the size * method is not a constant-time operation. Because of the * asynchronous nature of these sets, determining the current number - * of elements requires a traversal of the elements. Additionally, the - * bulk operations addAll, removeAll, - * retainAll, and containsAll are not - * guaranteed to be performed atomically. For example, an iterator - * operating concurrently with an addAll operation might view - * only some of the added elements. + * of elements requires a traversal of the elements, and so may report + * inaccurate results if this collection is modified during traversal. + * Additionally, the bulk operations addAll, + * removeAll, retainAll, containsAll, + * equals, and toArray are not guaranteed + * to be performed atomically. For example, an iterator operating + * concurrently with an addAll operation might view only some + * of the added elements. * *

    This class and its iterators implement all of the * optional methods of the {@link Set} and {@link Iterator} diff --git a/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java b/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java index 3fe72477bf9..ebdf223ff6c 100644 --- a/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java +++ b/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java @@ -51,10 +51,17 @@ import java.util.concurrent.locks.LockSupport; * producer. The tail of the queue is that element that has * been on the queue the shortest time for some producer. * - *

    Beware that, unlike in most collections, the {@code size} - * method is NOT a constant-time operation. Because of the + *

    Beware that, unlike in most collections, the {@code size} method + * is NOT a constant-time operation. Because of the * asynchronous nature of these queues, determining the current number - * of elements requires a traversal of the elements. + * of elements requires a traversal of the elements, and so may report + * inaccurate results if this collection is modified during traversal. + * Additionally, the bulk operations {@code addAll}, + * {@code removeAll}, {@code retainAll}, {@code containsAll}, + * {@code equals}, and {@code toArray} are not guaranteed + * to be performed atomically. For example, an iterator operating + * concurrently with an {@code addAll} operation might view only some + * of the added elements. * *

    This class and its iterator implement all of the * optional methods of the {@link Collection} and {@link From dc6eb040b713a679852328c1f99d804975a80318 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Fri, 22 Apr 2011 17:03:51 +0100 Subject: [PATCH 033/117] 6931562: Support SunMSCAPI Security Provider in Windows 64-bit releases of JVM Reviewed-by: mullan --- jdk/make/java/security/Makefile | 8 +++----- jdk/make/sun/security/Makefile | 8 +++----- jdk/test/sun/security/mscapi/AccessKeyStore.sh | 6 ++---- jdk/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh | 6 ++---- jdk/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh | 6 ++---- jdk/test/sun/security/mscapi/KeytoolChangeAlias.sh | 6 ++---- jdk/test/sun/security/mscapi/RSAEncryptDecrypt.sh | 6 ++---- 7 files changed, 16 insertions(+), 30 deletions(-) diff --git a/jdk/make/java/security/Makefile b/jdk/make/java/security/Makefile index fa87a586468..d06fc91404e 100644 --- a/jdk/make/java/security/Makefile +++ b/jdk/make/java/security/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1996, 2011 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -44,11 +44,9 @@ PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-solaris else # PLATFORM -# Register Microsoft CryptoAPI provider only on (non-64-bit) Windows platform. +# Register Microsoft CryptoAPI provider only on Windows platform. ifeq ($(PLATFORM), windows) - ifneq ($(ARCH_DATA_MODEL), 64) - PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-windows - endif + PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-windows endif endif # PLATFORM diff --git a/jdk/make/sun/security/Makefile b/jdk/make/sun/security/Makefile index efff97d7e55..6e03ffbe05d 100644 --- a/jdk/make/sun/security/Makefile +++ b/jdk/make/sun/security/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. # 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,12 +52,10 @@ ifeq ($(ARCH_DATA_MODEL), 64) endif endif -# Build Microsoft CryptoAPI provider only on (non-64-bit) Windows platform. +# Build Microsoft CryptoAPI provider only on Windows platform. MSCAPI = ifeq ($(PLATFORM), windows) - ifneq ($(ARCH_DATA_MODEL), 64) - MSCAPI = mscapi - endif + MSCAPI = mscapi endif # Build in-tree elliptic curve crypto provider only when diff --git a/jdk/test/sun/security/mscapi/AccessKeyStore.sh b/jdk/test/sun/security/mscapi/AccessKeyStore.sh index 5adef063cdb..6706aa3ff39 100644 --- a/jdk/test/sun/security/mscapi/AccessKeyStore.sh +++ b/jdk/test/sun/security/mscapi/AccessKeyStore.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,9 @@ # @test -# @bug 6324295 +# @bug 6324295 6931562 # @run shell AccessKeyStore.sh # @summary Confirm that permission must be granted to access keystores. -# -# Run only on non-64-bit Windows platform. OS=`uname -s` case "$OS" in diff --git a/jdk/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh b/jdk/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh index b712dd7ddb5..197ee37b134 100644 --- a/jdk/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh +++ b/jdk/test/sun/security/mscapi/IsSunMSCAPIAvailable.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,9 @@ # @test -# @bug 6318171 +# @bug 6318171 6931562 # @run shell IsSunMSCAPIAvailable.sh # @summary Basic test of the Microsoft CryptoAPI provider. -# -# Run only on non-64-bit Windows platform. OS=`uname -s` case "$OS" in diff --git a/jdk/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh b/jdk/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh index 7d0f1b47ba0..ee0c6c3609f 100644 --- a/jdk/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh +++ b/jdk/test/sun/security/mscapi/KeyStoreCompatibilityMode.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,10 @@ # @test -# @bug 6324294 +# @bug 6324294 6931562 # @run shell KeyStoreCompatibilityMode.sh # @summary Confirm that a null stream or password is not permitted when # compatibility mode is enabled (and vice versa). -# -# Run only on non-64-bit Windows platform. OS=`uname -s` case "$OS" in diff --git a/jdk/test/sun/security/mscapi/KeytoolChangeAlias.sh b/jdk/test/sun/security/mscapi/KeytoolChangeAlias.sh index b42c51dddee..0012a93af52 100644 --- a/jdk/test/sun/security/mscapi/KeytoolChangeAlias.sh +++ b/jdk/test/sun/security/mscapi/KeytoolChangeAlias.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,9 @@ # @test -# @bug 6415696 +# @bug 6415696 6931562 # @run shell KeytoolChangeAlias.sh # @summary Test "keytool -changealias" using the Microsoft CryptoAPI provider. -# -# Run only on non-64-bit Windows platform. # set a few environment variables so that the shell-script can run stand-alone # in the source directory diff --git a/jdk/test/sun/security/mscapi/RSAEncryptDecrypt.sh b/jdk/test/sun/security/mscapi/RSAEncryptDecrypt.sh index 4191fb1b0c0..19add0a7356 100644 --- a/jdk/test/sun/security/mscapi/RSAEncryptDecrypt.sh +++ b/jdk/test/sun/security/mscapi/RSAEncryptDecrypt.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. # 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,13 +24,11 @@ # # @test -# @bug 6457422 +# @bug 6457422 6931562 # @run shell RSAEncryptDecrypt.sh # @summary Confirm that plaintext can be encrypted and then decrypted using the # RSA cipher in the SunMSCAPI crypto provider. NOTE: The RSA cipher is # absent from the SunMSCAPI provider in OpenJDK builds. -# -# Run only on non-64-bit Windows platform. # set a few environment variables so that the shell-script can run stand-alone # in the source directory From 6431b121c725e931240020868be7f13e26a436c5 Mon Sep 17 00:00:00 2001 From: Alexander Potochkin Date: Fri, 22 Apr 2011 20:54:37 +0400 Subject: [PATCH 034/117] 7036871: Some JCK interactive JSplitPane tests that test continuous layout fail with Nimbus L&F Reviewed-by: rupashka --- jdk/src/share/classes/javax/swing/JSplitPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/javax/swing/JSplitPane.java b/jdk/src/share/classes/javax/swing/JSplitPane.java index d947329d663..fa773e5ae67 100644 --- a/jdk/src/share/classes/javax/swing/JSplitPane.java +++ b/jdk/src/share/classes/javax/swing/JSplitPane.java @@ -671,7 +671,7 @@ public class JSplitPane extends JComponent implements Accessible * which must be true for the child components * to be continuously * redisplayed and laid out during user intervention. - * The default value of this property is false. + * The default value of this property is look and feel dependent. * Some look and feels might not support continuous layout; * they will ignore this property. * From b5141e63fd863154e856d0147176b7fd65a8f620 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 22 Apr 2011 12:59:15 -0700 Subject: [PATCH 035/117] 7031011: fallbackfont testing failed on OEL 6 Reviewed-by: igor, jgodinez --- jdk/src/solaris/classes/sun/font/FcFontConfiguration.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java index ce2c935ba71..14d8e7ed221 100644 --- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java +++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java @@ -256,9 +256,9 @@ public class FcFontConfiguration extends FontConfiguration { } if (installedFallbackFontFiles != null) { - System.arraycopy(fileNames, index, - installedFallbackFontFiles, - 0, installedFallbackFontFiles.length); + System.arraycopy(installedFallbackFontFiles, 0, + fileNames, fcFonts.length, + installedFallbackFontFiles.length); } result[fontIndex * NUM_STYLES + styleIndex] From 385e7253a7f3163bbd38527288e5e051bcee1ce0 Mon Sep 17 00:00:00 2001 From: John Coomes Date: Sat, 23 Apr 2011 04:20:09 -0700 Subject: [PATCH 036/117] 7037250: cscope.make database generation is silently broken Reviewed-by: stefank --- .../make/{solaris/makefiles => }/cscope.make | 113 +++++-------- hotspot/make/linux/Makefile | 2 +- hotspot/make/linux/makefiles/cscope.make | 160 ------------------ hotspot/make/solaris/Makefile | 2 +- 4 files changed, 48 insertions(+), 229 deletions(-) rename hotspot/make/{solaris/makefiles => }/cscope.make (52%) delete mode 100644 hotspot/make/linux/makefiles/cscope.make diff --git a/hotspot/make/solaris/makefiles/cscope.make b/hotspot/make/cscope.make similarity index 52% rename from hotspot/make/solaris/makefiles/cscope.make rename to hotspot/make/cscope.make index 3fa51fb30af..17c3aa37481 100644 --- a/hotspot/make/solaris/makefiles/cscope.make +++ b/hotspot/make/cscope.make @@ -22,29 +22,23 @@ # # -# -# The cscope.out file is made in the current directory and spans the entire -# source tree. -# -# Things to note: -# 1. We use relative names for cscope. -# 2. We *don't* remove the old cscope.out file, because cscope is smart -# enough to only build what has changed. It can be confused, however, -# if files are renamed or removed, so it may be necessary to manually -# remove cscope.out if a lot of reorganization has occurred. -# +# The cscope.out file is generated in the current directory. The old cscope.out +# file is *not* removed because cscope is smart enough to only build what has +# changed. cscope can be confused if files are renamed or removed, so it may be +# necessary to remove cscope.out (gmake cscope.clean) if a lot of reorganization +# has occurred. include $(GAMMADIR)/make/scm.make -NAWK = /usr/xpg4/bin/awk RM = rm -f HG = hg -CS_TOP = ../.. +CS_TOP = $(GAMMADIR) CSDIRS = $(CS_TOP)/src $(CS_TOP)/make CSINCS = $(CSDIRS:%=-I%) CSCOPE = cscope +CSCOPE_OUT = cscope.out CSCOPE_FLAGS = -b # Allow .java files to be added from the environment (CSCLASSES=yes). @@ -61,25 +55,22 @@ ifndef CSHEADERS RMCCHEADERS= -o -name CClassHeaders endif -# Use CS_GENERATED=x to include auto-generated files in the make directories. -ifdef CS_GENERATED -CS_ADD_GENERATED = -o -name '*.incl' -else -CS_PRUNE_GENERATED = -o -name '${OS}_*_core' -o -name '${OS}_*_compiler?' +# Ignore build products. +CS_PRUNE_GENERATED = -o -name '${OSNAME}_*_core' -o \ + -name '${OSNAME}_*_compiler?' + +# O/S-specific files for all systems are included by default. Set CS_OS to a +# space-separated list of identifiers to include only those systems. +ifdef CS_OS +CS_PRUNE_OS = $(patsubst %,-o -name '*%*',\ + $(filter-out ${CS_OS},linux macos solaris windows)) endif -# OS-specific files for other systems are excluded by default. Use CS_OS=yes -# to include platform-specific files for other platforms. -ifndef CS_OS -CS_OS = linux macos solaris win32 -CS_PRUNE_OS = $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS})) -endif - -# Processor-specific files for other processors are excluded by default. Use -# CS_CPU=x to include platform-specific files for other platforms. -ifndef CS_CPU -CS_CPU = i486 sparc amd64 ia64 -CS_PRUNE_CPU = $(patsubst %,-o -name '*%*',$(filter-out ${SRCARCH},${CS_CPU})) +# CPU-specific files for all processors are included by default. Set CS_CPU +# space-separated list identifiers to include only those CPUs. +ifdef CS_CPU +CS_PRUNE_CPU = $(patsubst %,-o -name '*%*',\ + $(filter-out ${CS_CPU},arm ppc sparc x86 zero)) endif # What files should we include? A simple rule might be just those files under @@ -95,10 +86,14 @@ CS_PRUNE_STD = $(SCM_DIRS) \ -o -name '*demo' \ -o -name pkgarchive +# Placeholder for user-defined excludes. +CS_PRUNE_EX = + CS_PRUNE = $(CS_PRUNE_STD) \ $(CS_PRUNE_OS) \ $(CS_PRUNE_CPU) \ $(CS_PRUNE_GENERATED) \ + $(CS_PRUNE_EX) \ $(RMCCHEADERS) # File names to include. @@ -114,49 +109,33 @@ CSFILENAMES = -name '*.[ch]pp' \ -o -name '*.ad' \ $(ADDCLASSES) +.PHONY: cscope cscope.clean cscope.scratch TAGS.clean FORCE .PRECIOUS: cscope.out -cscope cscope.out: cscope.files FORCE - $(CSCOPE) $(CSCOPE_FLAGS) +cscope $(CSCOPE_OUT): cscope.files FORCE + $(CSCOPE) -f $(CSCOPE_OUT) $(CSCOPE_FLAGS) -# The .raw file is reordered here in an attempt to make cscope display the most -# relevant files first. -cscope.files: .cscope.files.raw - echo "$(CSINCS)" > $@ - -egrep -v "\.java|\/make\/" $< >> $@ - -fgrep ".java" $< >> $@ - -fgrep "/make/" $< >> $@ +cscope.clean: + $(QUIETLY) $(RM) $(CSCOPE_OUT) cscope.files -.cscope.files.raw: .nametable.files - -find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \ - -type f \( $(CSFILENAMES) \) -print > $@ +cscope.scratch: cscope.clean cscope -cscope.clean: nametable.clean - -$(RM) cscope.out cscope.files .cscope.files.raw +# The raw list is reordered so cscope displays the most relevant files first. +cscope.files: + $(QUIETLY) \ + raw=cscope.$$$$; \ + find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \ + -type f \( $(CSFILENAMES) \) -print > $$raw; \ + { \ + echo "$(CSINCS)"; \ + egrep -v "\.java|/make/" $$raw; \ + fgrep ".java" $$raw; \ + fgrep "/make/" $$raw; \ + } > $@; \ + rm -f $$raw TAGS: cscope.files FORCE egrep -v '^-|^$$' $< | etags --members - -TAGS.clean: nametable.clean - -$(RM) TAGS - -# .nametable.files and .nametable.files.tmp are used to determine if any files -# were added to/deleted from/renamed in the workspace. If not, then there's -# normally no need to rebuild the cscope database. To force a rebuild of -# the cscope database: gmake nametable.clean. -.nametable.files: .nametable.files.tmp - ( cmp -s $@ $< ) || ( cp $< $@ ) - -$(RM) $< - -# `hg status' is slightly faster than `hg fstatus'. Both are -# quite a bit slower on an NFS mounted file system, so this is -# really geared towards repos on local file systems. -.nametable.files.tmp: - -$(HG) fstatus -acmn > $@ - -nametable.clean: - -$(RM) .nametable.files .nametable.files.tmp - -FORCE: - -.PHONY: cscope cscope.clean TAGS.clean nametable.clean FORCE +TAGS.clean: + $(RM) TAGS diff --git a/hotspot/make/linux/Makefile b/hotspot/make/linux/Makefile index 49ac97c199e..fa1f56dd855 100644 --- a/hotspot/make/linux/Makefile +++ b/hotspot/make/linux/Makefile @@ -359,7 +359,7 @@ clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark: clean: clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_docs -include $(GAMMADIR)/make/$(OSNAME)/makefiles/cscope.make +include $(GAMMADIR)/make/cscope.make #------------------------------------------------------------------------------- diff --git a/hotspot/make/linux/makefiles/cscope.make b/hotspot/make/linux/makefiles/cscope.make deleted file mode 100644 index e045c2dde96..00000000000 --- a/hotspot/make/linux/makefiles/cscope.make +++ /dev/null @@ -1,160 +0,0 @@ -# -# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. -# 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. -# -# - -# -# The cscope.out file is made in the current directory and spans the entire -# source tree. -# -# Things to note: -# 1. We use relative names for cscope. -# 2. We *don't* remove the old cscope.out file, because cscope is smart -# enough to only build what has changed. It can be confused, however, -# if files are renamed or removed, so it may be necessary to manually -# remove cscope.out if a lot of reorganization has occurred. -# - -include $(GAMMADIR)/make/scm.make - -NAWK = awk -RM = rm -f -HG = hg -CS_TOP = ../.. - -CSDIRS = $(CS_TOP)/src $(CS_TOP)/build -CSINCS = $(CSDIRS:%=-I%) - -CSCOPE = cscope -CSCOPE_FLAGS = -b - -# Allow .java files to be added from the environment (CSCLASSES=yes). -ifdef CSCLASSES -ADDCLASSES= -o -name '*.java' -endif - -# Adding CClassHeaders also pushes the file count of a full workspace up about -# 200 files (these files also don't exist in a new workspace, and thus will -# cause the recreation of the database as they get created, which might seem -# a little confusing). Thus allow these files to be added from the environment -# (CSHEADERS=yes). -ifndef CSHEADERS -RMCCHEADERS= -o -name CClassHeaders -endif - -# Use CS_GENERATED=x to include auto-generated files in the build directories. -ifdef CS_GENERATED -CS_ADD_GENERATED = -o -name '*.incl' -else -CS_PRUNE_GENERATED = -o -name '${OS}_*_core' -o -name '${OS}_*_compiler?' -endif - -# OS-specific files for other systems are excluded by default. Use CS_OS=yes -# to include platform-specific files for other platforms. -ifndef CS_OS -CS_OS = linux macos solaris win32 -CS_PRUNE_OS = $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS})) -endif - -# Processor-specific files for other processors are excluded by default. Use -# CS_CPU=x to include platform-specific files for other platforms. -ifndef CS_CPU -CS_CPU = i486 sparc amd64 ia64 -CS_PRUNE_CPU = $(patsubst %,-o -name '*%*',$(filter-out ${SRCARCH},${CS_CPU})) -endif - -# What files should we include? A simple rule might be just those files under -# SCCS control, however this would miss files we create like the opcodes and -# CClassHeaders. The following attempts to find everything that is *useful*. -# (.del files are created by sccsrm, demo directories contain many .java files -# that probably aren't useful for development, and the pkgarchive may contain -# duplicates of files within the source hierarchy). - -# Directories to exclude. -CS_PRUNE_STD = $(SCM_DIRS) \ - -o -name '.del-*' \ - -o -name '*demo' \ - -o -name pkgarchive - -CS_PRUNE = $(CS_PRUNE_STD) \ - $(CS_PRUNE_OS) \ - $(CS_PRUNE_CPU) \ - $(CS_PRUNE_GENERATED) \ - $(RMCCHEADERS) - -# File names to include. -CSFILENAMES = -name '*.[ch]pp' \ - -o -name '*.[Ccshlxy]' \ - $(CS_ADD_GENERATED) \ - -o -name '*.il' \ - -o -name '*.cc' \ - -o -name '*[Mm]akefile*' \ - -o -name '*.gmk' \ - -o -name '*.make' \ - -o -name '*.ad' \ - $(ADDCLASSES) - -.PRECIOUS: cscope.out - -cscope cscope.out: cscope.files FORCE - $(CSCOPE) $(CSCOPE_FLAGS) - -# The .raw file is reordered here in an attempt to make cscope display the most -# relevant files first. -cscope.files: .cscope.files.raw - echo "$(CSINCS)" > $@ - -egrep -v "\.java|\/make\/" $< >> $@ - -fgrep ".java" $< >> $@ - -fgrep "/make/" $< >> $@ - -.cscope.files.raw: .nametable.files - -find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \ - -type f \( $(CSFILENAMES) \) -print > $@ - -cscope.clean: nametable.clean - -$(RM) cscope.out cscope.files .cscope.files.raw - -TAGS: cscope.files FORCE - egrep -v '^-|^$$' $< | etags --members - - -TAGS.clean: nametable.clean - -$(RM) TAGS - -# .nametable.files and .nametable.files.tmp are used to determine if any files -# were added to/deleted from/renamed in the workspace. If not, then there's -# normally no need to rebuild the cscope database. To force a rebuild of -# the cscope database: gmake nametable.clean. -.nametable.files: .nametable.files.tmp - ( cmp -s $@ $< ) || ( cp $< $@ ) - -$(RM) $< - -# `hg status' is slightly faster than `hg fstatus'. Both are -# quite a bit slower on an NFS mounted file system, so this is -# really geared towards repos on local file systems. -.nametable.files.tmp: - -$(HG) fstatus -acmn > $@ -nametable.clean: - -$(RM) .nametable.files .nametable.files.tmp - -FORCE: - -.PHONY: cscope cscope.clean TAGS.clean nametable.clean FORCE diff --git a/hotspot/make/solaris/Makefile b/hotspot/make/solaris/Makefile index d4bcb90f57a..b3af8513a73 100644 --- a/hotspot/make/solaris/Makefile +++ b/hotspot/make/solaris/Makefile @@ -296,7 +296,7 @@ clean_compiler1 clean_compiler2 clean_core clean_kernel: clean: clean_compiler2 clean_compiler1 clean_core clean_docs clean_kernel -include $(GAMMADIR)/make/$(OSNAME)/makefiles/cscope.make +include $(GAMMADIR)/make/cscope.make #------------------------------------------------------------------------------- From b91701fce632312a5aacec63e7f9126dccc2dec0 Mon Sep 17 00:00:00 2001 From: Andrei Dmitriev Date: Mon, 25 Apr 2011 21:08:14 +0400 Subject: [PATCH 037/117] 7030632: Pasting HTML that was copied from MS Word results in IOException Reviewed-by: uta, denis --- .../windows/classes/sun/awt/windows/WDataTransferer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java index 21c1945140f..47dcf275430 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java @@ -830,7 +830,14 @@ class HTMLCodec extends InputStream { if( -1 == iStartOffset ){ throw new IOException(FAILURE_MSG + "invalid HTML format."); } - iReadCount = bufferedStream.skip(iStartOffset); + + int curOffset = 0; + while (curOffset < iStartOffset){ + curOffset += bufferedStream.skip(iStartOffset - curOffset); + } + + iReadCount = curOffset; + if( iStartOffset != iReadCount ){ throw new IOException(FAILURE_MSG + "Byte stream ends in description."); } From 5621d404bfbc05943b42affbba32ad2e43cda565 Mon Sep 17 00:00:00 2001 From: Denis Fokin Date: Mon, 25 Apr 2011 20:39:35 +0400 Subject: [PATCH 038/117] 6888182: Readable and permitted to delete files could not be transferred through Clipboard and DnD Reviewed-by: uta --- jdk/src/windows/native/sun/windows/awt_Clipboard.cpp | 2 +- jdk/src/windows/native/sun/windows/awt_DnDDS.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/windows/native/sun/windows/awt_Clipboard.cpp b/jdk/src/windows/native/sun/windows/awt_Clipboard.cpp index d978090b8b3..6cea4a715fb 100644 --- a/jdk/src/windows/native/sun/windows/awt_Clipboard.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Clipboard.cpp @@ -294,7 +294,7 @@ Java_sun_awt_windows_WClipboard_publishClipboardData(JNIEnv *env, if (format == CF_HDROP) { DROPFILES *dropfiles = (DROPFILES *)dataout; dropfiles->pFiles = sizeof(DROPFILES); - dropfiles->fWide = FALSE; // good guess! + dropfiles->fWide = TRUE; // we publish only Unicode dataout += sizeof(DROPFILES); } diff --git a/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp b/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp index 1aea026c885..2d585e0330a 100644 --- a/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp +++ b/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp @@ -843,7 +843,7 @@ HRESULT __stdcall AwtDragSource::GetData(FORMATETC __RPC_FAR *pFormatEtc, dropfiles->pt.x = m_dropPoint.x; dropfiles->pt.y = m_dropPoint.y; dropfiles->fNC = m_fNC; - dropfiles->fWide = TRUE; // good guess! + dropfiles->fWide = TRUE; // we publish only Unicode dataout += sizeof(DROPFILES); } From 16d641461964970c44daf92c898a648335156913 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Mon, 25 Apr 2011 16:25:58 -0700 Subject: [PATCH 039/117] 7030715: JSR 292 JRuby test/test_super_call_site_caching.rb asserts with +DoEscapeAnalysis Reviewed-by: twisti --- hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp | 9 +-------- hotspot/src/share/vm/ci/ciMethod.hpp | 19 ++++++++++++++++++- hotspot/src/share/vm/opto/graphKit.cpp | 6 +----- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp index 45910919080..97b414448ae 100644 --- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp +++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp @@ -232,14 +232,7 @@ void BCEscapeAnalyzer::invoke(StateInfo &state, Bytecodes::Code code, ciMethod* } // compute size of arguments - int arg_size = target->arg_size(); - if (code == Bytecodes::_invokedynamic) { - assert(!target->is_static(), "receiver explicit in method"); - arg_size--; // implicit, not really on stack - } - if (!target->is_loaded() && code == Bytecodes::_invokestatic) { - arg_size--; - } + int arg_size = target->invoke_arg_size(code); int arg_base = MAX2(state._stack_height - arg_size, 0); // direct recursive calls are skipped if they can be bound statically without introducing diff --git a/hotspot/src/share/vm/ci/ciMethod.hpp b/hotspot/src/share/vm/ci/ciMethod.hpp index 840fb5da020..bf9568306b7 100644 --- a/hotspot/src/share/vm/ci/ciMethod.hpp +++ b/hotspot/src/share/vm/ci/ciMethod.hpp @@ -127,7 +127,24 @@ class ciMethod : public ciObject { ciSignature* signature() const { return _signature; } ciType* return_type() const { return _signature->return_type(); } int arg_size_no_receiver() const { return _signature->size(); } - int arg_size() const { return _signature->size() + (_flags.is_static() ? 0 : 1); } + // Can only be used on loaded ciMethods + int arg_size() const { + check_is_loaded(); + return _signature->size() + (_flags.is_static() ? 0 : 1); + } + // Report the number of elements on stack when invoking this method. + // This is different than the regular arg_size because invokdynamic + // has an implicit receiver. + int invoke_arg_size(Bytecodes::Code code) const { + int arg_size = _signature->size(); + // Add a receiver argument, maybe: + if (code != Bytecodes::_invokestatic && + code != Bytecodes::_invokedynamic) { + arg_size++; + } + return arg_size; + } + // Method code and related information. address code() { if (_code == NULL) load_code(); return _code; } diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index 590c05fb35d..e1612b843dc 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -1033,14 +1033,10 @@ bool GraphKit::compute_stack_effects(int& inputs, int& depth) { iter.reset_to_bci(bci()); iter.next(); ciMethod* method = iter.get_method(ignore); - inputs = method->arg_size_no_receiver(); - // Add a receiver argument, maybe: - if (code != Bytecodes::_invokestatic && - code != Bytecodes::_invokedynamic) - inputs += 1; // (Do not use ciMethod::arg_size(), because // it might be an unloaded method, which doesn't // know whether it is static or not.) + inputs = method->invoke_arg_size(code); int size = method->return_type()->size(); depth = size - inputs; } From 58aa826b315dbb63a3d5844c221920af0d660922 Mon Sep 17 00:00:00 2001 From: Yuka Kamiya Date: Tue, 26 Apr 2011 10:46:19 +0900 Subject: [PATCH 040/117] 7039469: (tz) Support tzdata2011g Reviewed-by: okutsu --- jdk/make/sun/javazic/tzdata/VERSION | 2 +- jdk/make/sun/javazic/tzdata/africa | 18 ++++++++++++++++-- jdk/make/sun/javazic/tzdata/europe | 4 ++-- jdk/make/sun/javazic/tzdata/southamerica | 23 +++++++++++++++++++++-- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/jdk/make/sun/javazic/tzdata/VERSION b/jdk/make/sun/javazic/tzdata/VERSION index c19847f5a11..c52096254ae 100644 --- a/jdk/make/sun/javazic/tzdata/VERSION +++ b/jdk/make/sun/javazic/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2011e +tzdata2011g diff --git a/jdk/make/sun/javazic/tzdata/africa b/jdk/make/sun/javazic/tzdata/africa index bea5f8157bb..a43e73ce10b 100644 --- a/jdk/make/sun/javazic/tzdata/africa +++ b/jdk/make/sun/javazic/tzdata/africa @@ -234,7 +234,21 @@ Rule Egypt 1989 only - May 6 1:00 1:00 S Rule Egypt 1990 1994 - May 1 1:00 1:00 S # IATA (after 1990) says transitions are at 0:00. # Go with IATA starting in 1995, except correct 1995 entry from 09-30 to 09-29. -Rule Egypt 1995 max - Apr lastFri 0:00s 1:00 S + +# From Alexander Krivenyshev (2011-04-20): +# "...Egypt's interim cabinet decided on Wednesday to cancel daylight +# saving time after a poll posted on its website showed the majority of +# Egyptians would approve the cancellation." +# +# Egypt to cancel daylight saving time +# +# http://www.almasryalyoum.com/en/node/407168 +# +# or +# +# http://www.worldtimezone.com/dst_news/dst_news_egypt04.html +# +Rule Egypt 1995 2010 - Apr lastFri 0:00s 1:00 S Rule Egypt 1995 2005 - Sep lastThu 23:00s 0 - # From Steffen Thorsen (2006-09-19): # The Egyptian Gazette, issue 41,090 (2006-09-18), page 1, reports: @@ -335,7 +349,7 @@ Rule Egypt 2008 only - Aug lastThu 23:00s 0 - Rule Egypt 2009 only - Aug 20 23:00s 0 - Rule Egypt 2010 only - Aug 11 0:00 0 - Rule Egypt 2010 only - Sep 10 0:00 1:00 S -Rule Egypt 2010 max - Sep lastThu 23:00s 0 - +Rule Egypt 2010 only - Sep lastThu 23:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Cairo 2:05:00 - LMT 1900 Oct diff --git a/jdk/make/sun/javazic/tzdata/europe b/jdk/make/sun/javazic/tzdata/europe index 5b11dfb5122..89bf6c5d3dc 100644 --- a/jdk/make/sun/javazic/tzdata/europe +++ b/jdk/make/sun/javazic/tzdata/europe @@ -168,7 +168,7 @@ # A monument to Willett was unveiled on 1927-05-21, in an open space in # a 45-acre wood near Chislehurst, Kent that was purchased by popular # subscription and open to the public. On the south face of the monolith, -# designed by G. W. Miller, is the the William Willett Memorial Sundial, +# designed by G. W. Miller, is the...William Willett Memorial Sundial, # which is permanently set to Summer Time. # From Winston Churchill (1934-04-28): @@ -1808,7 +1808,7 @@ Zone Europe/Oslo 0:43:00 - LMT 1895 Jan 1 # # All these events predate our cutoff date of 1970. Unless we can # come up with more definitive info about the timekeeping during the -# war years it's probably best just do do the following for now: +# war years it's probably best just do...the following for now: Link Europe/Oslo Arctic/Longyearbyen # Poland diff --git a/jdk/make/sun/javazic/tzdata/southamerica b/jdk/make/sun/javazic/tzdata/southamerica index 7afec35d696..7717d12d17a 100644 --- a/jdk/make/sun/javazic/tzdata/southamerica +++ b/jdk/make/sun/javazic/tzdata/southamerica @@ -767,7 +767,7 @@ Zone America/La_Paz -4:32:36 - LMT 1890 # # As a result of the above Decree I believe the America/Rio_Branco # timezone shall be modified from UTC-5 to UTC-4 and a new timezone shall -# be created to represent the the west side of the Para State. I +# be created to represent the...west side of the Para State. I # suggest this new timezone be called Santarem as the most # important/populated city in the affected area. # @@ -1365,6 +1365,24 @@ Zone Pacific/Galapagos -5:58:24 - LMT 1931 # Puerto Baquerizo Moreno # For now, we'll just record the time in Stanley, since we have no # better info. +# From Steffen Thorsen (2011-04-01): +# The Falkland Islands will not turn back clocks this winter, but stay on +# daylight saving time. +# +# One source: +# +# http://www.falklandnews.com/public/story.cfm?get=5914&source=3 +# +# +# We have gotten this confirmed by a clerk of the legislative assembly: +# Normally the clocks revert to Local Mean Time (UTC/GMT -4 hours) on the +# third Sunday of April at 0200hrs and advance to Summer Time (UTC/GMT -3 +# hours) on the first Sunday of September at 0200hrs. +# +# IMPORTANT NOTE: During 2011, on a trial basis, the Falkland Islands +# will not revert to local mean time, but clocks will remain on Summer +# time (UTC/GMT - 3 hours) throughout the whole of 2011. Any long term +# change to local time following the trial period will be notified. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Falk 1937 1938 - Sep lastSun 0:00 1:00 S Rule Falk 1938 1942 - Mar Sun>=19 0:00 0 - @@ -1376,7 +1394,8 @@ Rule Falk 1984 1985 - Apr lastSun 0:00 0 - Rule Falk 1984 only - Sep 16 0:00 1:00 S Rule Falk 1985 2000 - Sep Sun>=9 0:00 1:00 S Rule Falk 1986 2000 - Apr Sun>=16 0:00 0 - -Rule Falk 2001 max - Apr Sun>=15 2:00 0 - +Rule Falk 2001 2010 - Apr Sun>=15 2:00 0 - +Rule Falk 2012 max - Apr Sun>=15 2:00 0 - Rule Falk 2001 max - Sep Sun>=1 2:00 1:00 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Atlantic/Stanley -3:51:24 - LMT 1890 From 8b9fe065648dd28f7272009f66e061cb676afe14 Mon Sep 17 00:00:00 2001 From: Michael Fang Date: Mon, 25 Apr 2011 20:16:46 -0700 Subject: [PATCH 041/117] 7039493: incorporating WPTG translation bug fixes Reviewed-by: yhuang --- .../com/sun/tools/javadoc/resources/javadoc_zh_CN.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties b/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties index 8bcfafdb1eb..8bbe4a7abf8 100644 --- a/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties +++ b/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties @@ -43,7 +43,7 @@ main.Building_tree=\u6B63\u5728\u6784\u9020 Javadoc \u4FE1\u606F... main.no_source_files_for_package=\u6CA1\u6709\u7A0B\u5E8F\u5305{0}\u7684\u6E90\u6587\u4EF6 main.fatal.error=\u81F4\u547D\u9519\u8BEF main.fatal.exception=\u81F4\u547D\u5F02\u5E38\u9519\u8BEF -main.out.of.memory=java.lang.OutOfMemoryError: \u8BF7\u589E\u5927\u5185\u5B58\u3002\n\u4F8B\u5982, \u5BF9\u4E8E JDK \u7ECF\u5178\u6216\u70ED\u70B9 VM, \u8BF7\u589E\u5927\u9009\u9879 -J-Xmx,\n\u4F8B\u5982 -J-Xmx32m\u3002 +main.out.of.memory=java.lang.OutOfMemoryError: \u8BF7\u589E\u5927\u5185\u5B58\u3002\n\u4F8B\u5982, \u5BF9\u4E8E JDK \u7ECF\u5178\u6216 HotSpot VM, \u8BF7\u589E\u5927\u9009\u9879 -J-Xmx,\n\u4F8B\u5982 -J-Xmx32m\u3002 main.done_in=[\u5728 {0} \u6BEB\u79D2\u5185\u5B8C\u6210] main.doclet_method_must_be_static=\u5728 doclet \u7C7B{0}\u4E2D, \u65B9\u6CD5{1}\u5FC5\u987B\u4E3A\u9759\u6001\u3002 main.must_return_int=\u5728 doclet \u7C7B{0}\u4E2D, \u65B9\u6CD5{1}\u5FC5\u987B\u8FD4\u56DE\u6574\u578B\u503C\u3002 From a5e7b8d0d73a165bebbfe06a1fcd99c6a4e4d3d3 Mon Sep 17 00:00:00 2001 From: Nils Loodin Date: Tue, 26 Apr 2011 12:49:34 +0200 Subject: [PATCH 042/117] 7029383: Refresh of non-client demos Reviewed-by: mchung, ohair --- .../debug/bdi/AccessWatchpointSpec.java | 3 +- .../debug/bdi/AmbiguousMethodException.java | 3 + .../example/debug/bdi/BreakpointSpec.java | 7 +- .../tools/example/debug/bdi/ChildSession.java | 19 +- .../debug/bdi/EvaluationException.java | 5 +- .../example/debug/bdi/EventRequestSpec.java | 2 - .../example/debug/bdi/ExceptionSpec.java | 14 +- .../example/debug/bdi/ExecutionManager.java | 73 +- .../bdi/FrameIndexOutOfBoundsException.java | 5 +- .../example/debug/bdi/JDIEventSource.java | 15 +- .../example/debug/bdi/LineBreakpointSpec.java | 9 +- .../debug/bdi/LineNotFoundException.java | 3 + .../bdi/MalformedMemberNameException.java | 3 + .../debug/bdi/MethodBreakpointSpec.java | 10 +- .../debug/bdi/MethodNotFoundException.java | 2 + .../debug/bdi/ModificationWatchpointSpec.java | 3 +- .../example/debug/bdi/NoSessionException.java | 5 +- .../example/debug/bdi/NoThreadException.java | 6 +- .../debug/bdi/PatternReferenceTypeSpec.java | 4 + .../example/debug/bdi/ReferenceTypeSpec.java | 2 + .../sun/tools/example/debug/bdi/Session.java | 1 - .../bdi/SourceNameReferenceTypeSpec.java | 7 +- .../example/debug/bdi/SpecErrorEvent.java | 3 +- .../tools/example/debug/bdi/SpecEvent.java | 1 + .../debug/bdi/ThreadGroupIterator.java | 4 +- .../tools/example/debug/bdi/ThreadInfo.java | 3 - .../example/debug/bdi/ThreadIterator.java | 3 + .../sun/tools/example/debug/bdi/Utils.java | 3 - .../debug/bdi/VMLaunchFailureException.java | 5 +- .../debug/bdi/VMNotInterruptedException.java | 5 +- .../example/debug/bdi/WatchpointSpec.java | 11 +- .../example/debug/event/AbstractEventSet.java | 18 + .../debug/event/AccessWatchpointEventSet.java | 4 +- .../debug/event/ClassPrepareEventSet.java | 3 + .../debug/event/ClassUnloadEventSet.java | 4 +- .../debug/event/ExceptionEventSet.java | 3 + .../tools/example/debug/event/JDIAdapter.java | 11 + .../debug/event/LocatableEventSet.java | 2 + .../debug/event/LocationTriggerEventSet.java | 4 +- .../event/ModificationWatchpointEventSet.java | 3 + .../debug/event/ThreadDeathEventSet.java | 3 + .../debug/event/ThreadStartEventSet.java | 3 + .../example/debug/event/VMDeathEventSet.java | 3 + .../debug/event/VMDisconnectEventSet.java | 3 + .../example/debug/event/VMStartEventSet.java | 3 + .../debug/event/WatchpointEventSet.java | 2 + .../example/debug/expr/ExpressionParser.java | 2476 ++++++++++++----- .../expr/ExpressionParserTokenManager.java | 602 ++-- .../sun/tools/example/debug/expr/LValue.java | 19 + .../example/debug/expr/ParseException.java | 19 +- .../sun/tools/example/debug/expr/Token.java | 1 + .../example/debug/expr/TokenMgrError.java | 3 + .../example/debug/gui/ApplicationTool.java | 6 +- .../example/debug/gui/ClassTreeTool.java | 15 +- .../example/debug/gui/CommandInterpreter.java | 16 +- .../tools/example/debug/gui/CommandTool.java | 37 +- .../example/debug/gui/ContextManager.java | 12 +- .../debug/gui/CurrentFrameChangedEvent.java | 1 + .../tools/example/debug/gui/Environment.java | 2 - .../com/sun/tools/example/debug/gui/GUI.java | 11 +- .../example/debug/gui/JDBFileFilter.java | 19 +- .../tools/example/debug/gui/JDBMenuBar.java | 6 +- .../tools/example/debug/gui/JDBToolBar.java | 3 +- .../tools/example/debug/gui/LaunchTool.java | 19 +- .../example/debug/gui/MonitorListModel.java | 7 +- .../tools/example/debug/gui/MonitorTool.java | 10 +- .../tools/example/debug/gui/SearchPath.java | 8 +- .../gui/SingleLeafTreeSelectionModel.java | 7 +- .../example/debug/gui/SourceManager.java | 13 +- .../tools/example/debug/gui/SourceModel.java | 4 +- .../tools/example/debug/gui/SourceTool.java | 29 +- .../example/debug/gui/SourceTreeTool.java | 20 +- .../debug/gui/SourcepathChangedEvent.java | 2 + .../example/debug/gui/StackTraceTool.java | 14 +- .../example/debug/gui/ThreadTreeTool.java | 13 +- .../tools/example/debug/gui/TypeScript.java | 3 +- .../debug/gui/TypeScriptOutputListener.java | 5 +- .../example/debug/gui/TypeScriptWriter.java | 3 + .../debug/tty/AccessWatchpointSpec.java | 2 + .../debug/tty/AmbiguousMethodException.java | 2 + .../example/debug/tty/BreakpointSpec.java | 6 +- .../sun/tools/example/debug/tty/Commands.java | 10 +- .../com/sun/tools/example/debug/tty/Env.java | 1 - .../tools/example/debug/tty/EventHandler.java | 7 +- .../example/debug/tty/EventRequestSpec.java | 2 - .../debug/tty/EventRequestSpecList.java | 3 - .../example/debug/tty/ExceptionSpec.java | 8 +- .../debug/tty/LineNotFoundException.java | 2 + .../tty/MalformedMemberNameException.java | 2 + .../debug/tty/ModificationWatchpointSpec.java | 2 + .../debug/tty/PatternReferenceTypeSpec.java | 5 + .../example/debug/tty/ReferenceTypeSpec.java | 2 + .../tools/example/debug/tty/SourceMapper.java | 3 - .../com/sun/tools/example/debug/tty/TTY.java | 32 +- .../tools/example/debug/tty/TTYResources.java | 1 + .../example/debug/tty/TTYResources_ja.java | 1 + .../example/debug/tty/TTYResources_zh_CN.java | 1 + .../debug/tty/ThreadGroupIterator.java | 4 +- .../tools/example/debug/tty/ThreadInfo.java | 2 - .../example/debug/tty/ThreadIterator.java | 3 + .../tools/example/debug/tty/VMConnection.java | 2 +- .../debug/tty/VMNotConnectedException.java | 2 + .../example/debug/tty/WatchpointSpec.java | 5 +- .../sun/tools/example/trace/EventThread.java | 15 +- .../example/trace/StreamRedirectThread.java | 1 + .../com/sun/tools/example/trace/Trace.java | 14 +- jdk/src/share/demo/jvmti/minst/Minst.java | 2 +- .../management/FullThreadDump/Deadlock.java | 3 +- .../FullThreadDump/ThreadMonitor.java | 5 +- jdk/src/share/demo/management/JTop/JTop.java | 21 +- .../demo/management/JTop/JTopPlugin.java | 8 +- .../MemoryMonitor/MemoryMonitor.java | 36 +- .../management/VerboseGC/PrintGCStat.java | 14 +- .../demo/management/VerboseGC/VerboseGC.java | 5 +- jdk/src/share/demo/nio/zipfs/Demo.java | 21 +- .../jconsole/EditableAtEndDocument.java | 4 + .../jconsole/ScriptJConsolePlugin.java | 9 +- .../scripting/jconsole/ScriptShellPanel.java | 11 + 118 files changed, 2842 insertions(+), 1150 deletions(-) diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/AccessWatchpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/AccessWatchpointSpec.java index 9ffd9148827..09e3f7e6814 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/AccessWatchpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/AccessWatchpointSpec.java @@ -26,7 +26,6 @@ package com.sun.tools.example.debug.bdi; import com.sun.jdi.*; -import com.sun.jdi.request.*; public class AccessWatchpointSpec extends WatchpointSpec { @@ -38,6 +37,7 @@ public class AccessWatchpointSpec extends WatchpointSpec { /** * The 'refType' is known to match. */ + @Override void resolve(ReferenceType refType) throws InvalidTypeException, NoSuchFieldException { if (!(refType instanceof ClassType)) { @@ -51,6 +51,7 @@ public class AccessWatchpointSpec extends WatchpointSpec { .createAccessWatchpointRequest(field)); } + @Override public boolean equals(Object obj) { return (obj instanceof AccessWatchpointSpec) && super.equals(obj); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/AmbiguousMethodException.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/AmbiguousMethodException.java index 0e3d7668d2e..667cbb22593 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/AmbiguousMethodException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/AmbiguousMethodException.java @@ -27,6 +27,9 @@ package com.sun.tools.example.debug.bdi; public class AmbiguousMethodException extends Exception { + + private static final long serialVersionUID = 7793370943251707514L; + public AmbiguousMethodException() { super(); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/BreakpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/BreakpointSpec.java index 798e5907063..541582ef89a 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/BreakpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/BreakpointSpec.java @@ -25,30 +25,33 @@ package com.sun.tools.example.debug.bdi; -import com.sun.jdi.request.*; - public abstract class BreakpointSpec extends EventRequestSpec { BreakpointSpec(EventRequestSpecList specs, ReferenceTypeSpec refSpec) { super(specs, refSpec); } + @Override void notifySet(SpecListener listener, SpecEvent evt) { listener.breakpointSet(evt); } + @Override void notifyDeferred(SpecListener listener, SpecEvent evt) { listener.breakpointDeferred(evt); } + @Override void notifyResolved(SpecListener listener, SpecEvent evt) { listener.breakpointResolved(evt); } + @Override void notifyDeleted(SpecListener listener, SpecEvent evt) { listener.breakpointDeleted(evt); } + @Override void notifyError(SpecListener listener, SpecErrorEvent evt) { listener.breakpointError(evt); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ChildSession.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ChildSession.java index 5d5613c228a..917b0d8803a 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ChildSession.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ChildSession.java @@ -43,10 +43,6 @@ class ChildSession extends Session { private BufferedReader out; private BufferedReader err; - private InputWriter inputWriter; - private OutputReader outputReader; - private OutputReader errorReader; - private InputListener input; private OutputListener output; private OutputListener error; @@ -84,6 +80,7 @@ class ChildSession extends Session { this.error = error; } + @Override public boolean attach() { if (!connectToVMProcess()) { @@ -131,6 +128,7 @@ class ChildSession extends Session { return true; } + @Override public void detach() { //### debug @@ -242,10 +240,7 @@ class ChildSession extends Session { this.diagnostics = diagnostics; } - public void quit() { - running = false; - } - + @Override public void run() { try { int count; @@ -254,6 +249,7 @@ class ChildSession extends Session { // Run in Swing event dispatcher thread. final String chars = new String(buffer, 0, count); SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { output.putString(chars); } @@ -264,6 +260,7 @@ class ChildSession extends Session { } catch (IOException e) { // Run in Swing event dispatcher thread. SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { diagnostics.putString("IO error reading " + streamName + @@ -288,11 +285,7 @@ class ChildSession extends Session { this.input = input; } - public void quit() { - //### Won't have much effect if blocked on input! - running = false; - } - + @Override public void run() { String line; while (running) { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/EvaluationException.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/EvaluationException.java index 211bb5331b3..0e0a6b0b484 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/EvaluationException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/EvaluationException.java @@ -25,4 +25,7 @@ package com.sun.tools.example.debug.bdi; -public class EvaluationException extends Exception {} +public class EvaluationException extends Exception { + + private static final long serialVersionUID = 4947109680354951694L; +} diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/EventRequestSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/EventRequestSpec.java index 28412756264..796d5803b9c 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/EventRequestSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/EventRequestSpec.java @@ -25,8 +25,6 @@ package com.sun.tools.example.debug.bdi; -import java.util.*; - import com.sun.jdi.*; import com.sun.jdi.request.EventRequest; diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExceptionSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExceptionSpec.java index 8be23905e3c..fa3fcb3de28 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExceptionSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExceptionSpec.java @@ -26,11 +26,6 @@ package com.sun.tools.example.debug.bdi; import com.sun.jdi.ReferenceType; -import com.sun.jdi.request.*; - -import java.util.ArrayList; -import java.util.List; -import java.util.Iterator; public class ExceptionSpec extends EventRequestSpec { @@ -45,22 +40,27 @@ public class ExceptionSpec extends EventRequestSpec { this.notifyUncaught = notifyUncaught; } + @Override void notifySet(SpecListener listener, SpecEvent evt) { listener.exceptionInterceptSet(evt); } + @Override void notifyDeferred(SpecListener listener, SpecEvent evt) { listener.exceptionInterceptDeferred(evt); } + @Override void notifyResolved(SpecListener listener, SpecEvent evt) { listener.exceptionInterceptResolved(evt); } + @Override void notifyDeleted(SpecListener listener, SpecEvent evt) { listener.exceptionInterceptDeleted(evt); } + @Override void notifyError(SpecListener listener, SpecErrorEvent evt) { listener.exceptionInterceptError(evt); } @@ -68,16 +68,19 @@ public class ExceptionSpec extends EventRequestSpec { /** * The 'refType' is known to match. */ + @Override void resolve(ReferenceType refType) { setRequest(refType.virtualMachine().eventRequestManager() .createExceptionRequest(refType, notifyCaught, notifyUncaught)); } + @Override public int hashCode() { return refSpec.hashCode(); } + @Override public boolean equals(Object obj) { if (obj instanceof ExceptionSpec) { ExceptionSpec es = (ExceptionSpec)obj; @@ -88,6 +91,7 @@ public class ExceptionSpec extends EventRequestSpec { } } + @Override public String toString() { StringBuffer buffer = new StringBuffer("exception catch "); buffer.append(refSpec.toString()); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExecutionManager.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExecutionManager.java index 7dc60f5d625..35f2075daa9 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExecutionManager.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExecutionManager.java @@ -26,7 +26,6 @@ package com.sun.tools.example.debug.bdi; import com.sun.jdi.*; -import com.sun.jdi.event.*; import com.sun.jdi.request.*; import com.sun.jdi.connect.*; import com.sun.tools.example.debug.expr.ExpressionParser; @@ -56,7 +55,7 @@ public class ExecutionManager { // Session Listeners - Vector sessionListeners = new Vector(); + ArrayList sessionListeners = new ArrayList(); public void addSessionListener(SessionListener listener) { sessionListeners.add(listener); @@ -68,7 +67,7 @@ public class ExecutionManager { // Spec Listeners - Vector specListeners = new Vector(); + ArrayList specListeners = new ArrayList(); public void addSpecListener(SpecListener cl) { specListeners.add(cl); @@ -80,7 +79,7 @@ public class ExecutionManager { // JDI Listeners - Vector jdiListeners = new Vector(); + ArrayList jdiListeners = new ArrayList(); /** * Adds a JDIListener @@ -105,50 +104,50 @@ public class ExecutionManager { // App Echo Listeners - private Vector appEchoListeners = new Vector(); + private ArrayList appEchoListeners = new ArrayList(); public void addApplicationEchoListener(OutputListener l) { - appEchoListeners.addElement(l); + appEchoListeners.add(l); } public void removeApplicationEchoListener(OutputListener l) { - appEchoListeners.removeElement(l); + appEchoListeners.remove(l); } // App Output Listeners - private Vector appOutputListeners = new Vector(); + private ArrayList appOutputListeners = new ArrayList(); public void addApplicationOutputListener(OutputListener l) { - appOutputListeners.addElement(l); + appOutputListeners.add(l); } public void removeApplicationOutputListener(OutputListener l) { - appOutputListeners.removeElement(l); + appOutputListeners.remove(l); } // App Error Listeners - private Vector appErrorListeners = new Vector(); + private ArrayList appErrorListeners = new ArrayList(); public void addApplicationErrorListener(OutputListener l) { - appErrorListeners.addElement(l); + appErrorListeners.add(l); } public void removeApplicationErrorListener(OutputListener l) { - appErrorListeners.removeElement(l); + appErrorListeners.remove(l); } // Diagnostic Listeners - private Vector diagnosticsListeners = new Vector(); + private ArrayList diagnosticsListeners = new ArrayList(); public void addDiagnosticsListener(OutputListener l) { - diagnosticsListeners.addElement(l); + diagnosticsListeners.add(l); } public void removeDiagnosticsListener(OutputListener l) { - diagnosticsListeners.removeElement(l); + diagnosticsListeners.remove(l); } /////////// End Listener Registration ////////////// @@ -159,7 +158,9 @@ public class ExecutionManager { } void ensureActiveSession() throws NoSessionException { - if (session == null) throw new NoSessionException(); + if (session == null) { + throw new NoSessionException(); + } } public EventRequestManager eventRequestManager() { @@ -293,6 +294,7 @@ public class ExecutionManager { ensureActiveSession(); if (f != null) { frameGetter = new ExpressionParser.GetFrame() { + @Override public StackFrame get() /* throws IncompatibleThreadStateException */ { return f; } @@ -628,35 +630,35 @@ public class ExecutionManager { */ private void notifyInterrupted() { - Vector l = (Vector)sessionListeners.clone(); + ArrayList l = new ArrayList(sessionListeners); EventObject evt = new EventObject(this); for (int i = 0; i < l.size(); i++) { - ((SessionListener)l.elementAt(i)).sessionInterrupt(evt); + l.get(i).sessionInterrupt(evt); } } private void notifyContinued() { - Vector l = (Vector)sessionListeners.clone(); + ArrayList l = new ArrayList(sessionListeners); EventObject evt = new EventObject(this); for (int i = 0; i < l.size(); i++) { - ((SessionListener)l.elementAt(i)).sessionContinue(evt); + l.get(i).sessionContinue(evt); } } private void notifySessionStart() { - Vector l = (Vector)sessionListeners.clone(); + ArrayList l = new ArrayList(sessionListeners); EventObject evt = new EventObject(this); for (int i = 0; i < l.size(); i++) { - ((SessionListener)l.elementAt(i)).sessionStart(evt); + l.get(i).sessionStart(evt); } } private void notifySessionDeath() { /*** noop for now - Vector l = (Vector)sessionListeners.clone(); + ArrayList l = new ArrayList(sessionListeners); EventObject evt = new EventObject(this); for (int i = 0; i < l.size(); i++) { - ((SessionListener)l.elementAt(i)).sessionDeath(evt); + ((SessionListener)l.get(i)).sessionDeath(evt); } ****/ } @@ -684,6 +686,7 @@ public class ExecutionManager { } private InputListener appInput = new InputListener() { + @Override public String getLine() { // Don't allow reader to be interrupted -- catch and retry. String line = null; @@ -703,6 +706,7 @@ public class ExecutionManager { // Run in Swing event dispatcher thread. final String input = line; SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { echoInputLine(input); } @@ -714,37 +718,40 @@ public class ExecutionManager { private static String newline = System.getProperty("line.separator"); private void echoInputLine(String line) { - Vector l = (Vector)appEchoListeners.clone(); + ArrayList l = new ArrayList(appEchoListeners); for (int i = 0; i < l.size(); i++) { - OutputListener ol = (OutputListener)l.elementAt(i); + OutputListener ol = l.get(i); ol.putString(line); ol.putString(newline); } } private OutputListener appOutput = new OutputListener() { + @Override public void putString(String string) { - Vector l = (Vector)appOutputListeners.clone(); + ArrayList l = new ArrayList(appEchoListeners); for (int i = 0; i < l.size(); i++) { - ((OutputListener)l.elementAt(i)).putString(string); + l.get(i).putString(string); } } }; private OutputListener appError = new OutputListener() { + @Override public void putString(String string) { - Vector l = (Vector)appErrorListeners.clone(); + ArrayList l = new ArrayList(appEchoListeners); for (int i = 0; i < l.size(); i++) { - ((OutputListener)l.elementAt(i)).putString(string); + l.get(i).putString(string); } } }; private OutputListener diagnostics = new OutputListener() { + @Override public void putString(String string) { - Vector l = (Vector)diagnosticsListeners.clone(); + ArrayList l = new ArrayList(diagnosticsListeners); for (int i = 0; i < l.size(); i++) { - ((OutputListener)l.elementAt(i)).putString(string); + l.get(i).putString(string); } } }; diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/FrameIndexOutOfBoundsException.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/FrameIndexOutOfBoundsException.java index 5f5db5e4206..5d70918cb3b 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/FrameIndexOutOfBoundsException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/FrameIndexOutOfBoundsException.java @@ -25,4 +25,7 @@ package com.sun.tools.example.debug.bdi; -public class FrameIndexOutOfBoundsException extends IndexOutOfBoundsException {} +public class FrameIndexOutOfBoundsException extends IndexOutOfBoundsException { + + private static final long serialVersionUID = -4870148107027371437L; +} diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/JDIEventSource.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/JDIEventSource.java index 5b1a9b0bd8b..dedc2477e0c 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/JDIEventSource.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/JDIEventSource.java @@ -28,8 +28,6 @@ package com.sun.tools.example.debug.bdi; import com.sun.jdi.*; import com.sun.jdi.event.*; -import java.util.*; - import com.sun.tools.example.debug.event.*; import javax.swing.SwingUtilities; @@ -55,6 +53,7 @@ class JDIEventSource extends Thread { this.queue = session.vm.eventQueue(); } + @Override public void run() { try { runLoop(); @@ -78,6 +77,7 @@ class JDIEventSource extends Thread { //### Gross foul hackery! private void dispatchEventSet(final AbstractEventSet es) { SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { boolean interrupted = es.suspendedAll(); es.notify(firstListener); @@ -117,54 +117,65 @@ class JDIEventSource extends Thread { //### This is a Hack, deal with it private class FirstListener implements JDIListener { + @Override public void accessWatchpoint(AccessWatchpointEventSet e) { session.runtime.validateThreadInfo(); wantInterrupt = true; } + @Override public void classPrepare(ClassPrepareEventSet e) { wantInterrupt = false; runtime.resolve(e.getReferenceType()); } + @Override public void classUnload(ClassUnloadEventSet e) { wantInterrupt = false; } + @Override public void exception(ExceptionEventSet e) { wantInterrupt = true; } + @Override public void locationTrigger(LocationTriggerEventSet e) { session.runtime.validateThreadInfo(); wantInterrupt = true; } + @Override public void modificationWatchpoint(ModificationWatchpointEventSet e) { session.runtime.validateThreadInfo(); wantInterrupt = true; } + @Override public void threadDeath(ThreadDeathEventSet e) { wantInterrupt = false; } + @Override public void threadStart(ThreadStartEventSet e) { wantInterrupt = false; } + @Override public void vmDeath(VMDeathEventSet e) { //### Should have some way to notify user //### that VM died before the session ended. wantInterrupt = false; } + @Override public void vmDisconnect(VMDisconnectEventSet e) { //### Notify user? wantInterrupt = false; session.runtime.endSession(); } + @Override public void vmStart(VMStartEventSet e) { //### Do we need to do anything with it? wantInterrupt = false; diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineBreakpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineBreakpointSpec.java index b82b386043e..0a1e0b1cb3d 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineBreakpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineBreakpointSpec.java @@ -26,11 +26,7 @@ package com.sun.tools.example.debug.bdi; import com.sun.jdi.*; -import com.sun.jdi.request.*; - -import java.util.ArrayList; import java.util.List; -import java.util.Iterator; public class LineBreakpointSpec extends BreakpointSpec { int lineNumber; @@ -44,6 +40,7 @@ public class LineBreakpointSpec extends BreakpointSpec { /** * The 'refType' is known to match. */ + @Override void resolve(ReferenceType refType) throws InvalidTypeException, LineNotFoundException { if (!(refType instanceof ClassType)) { @@ -81,10 +78,12 @@ public class LineBreakpointSpec extends BreakpointSpec { return lineNumber; } + @Override public int hashCode() { return refSpec.hashCode() + lineNumber; } + @Override public boolean equals(Object obj) { if (obj instanceof LineBreakpointSpec) { LineBreakpointSpec breakpoint = (LineBreakpointSpec)obj; @@ -96,6 +95,7 @@ public class LineBreakpointSpec extends BreakpointSpec { } } + @Override public String errorMessageFor(Exception e) { if (e instanceof LineNotFoundException) { return ("No code at line " + lineNumber() + " in " + refSpec); @@ -107,6 +107,7 @@ public class LineBreakpointSpec extends BreakpointSpec { } } + @Override public String toString() { StringBuffer buffer = new StringBuffer("breakpoint "); buffer.append(refSpec.toString()); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineNotFoundException.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineNotFoundException.java index 00ad8d8f7ea..6d906a8b65c 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineNotFoundException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineNotFoundException.java @@ -27,6 +27,9 @@ package com.sun.tools.example.debug.bdi; public class LineNotFoundException extends Exception { + + private static final long serialVersionUID = -5630418117861587582L; + public LineNotFoundException() { super(); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MalformedMemberNameException.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MalformedMemberNameException.java index 5c6be5d092f..c73e685f503 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MalformedMemberNameException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MalformedMemberNameException.java @@ -26,6 +26,9 @@ package com.sun.tools.example.debug.bdi; class MalformedMemberNameException extends Exception { + + private static final long serialVersionUID = -7726664097374844485L; + public MalformedMemberNameException() { super(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodBreakpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodBreakpointSpec.java index 9e265bd08db..7a9748af102 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodBreakpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodBreakpointSpec.java @@ -26,11 +26,8 @@ package com.sun.tools.example.debug.bdi; import com.sun.jdi.*; -import com.sun.jdi.request.*; - import java.util.ArrayList; import java.util.List; -import java.util.Iterator; public class MethodBreakpointSpec extends BreakpointSpec { String methodId; @@ -47,6 +44,7 @@ public class MethodBreakpointSpec extends BreakpointSpec { /** * The 'refType' is known to match. */ + @Override void resolve(ReferenceType refType) throws MalformedMemberNameException, AmbiguousMethodException, InvalidTypeException, @@ -80,12 +78,14 @@ public class MethodBreakpointSpec extends BreakpointSpec { return methodArgs; } + @Override public int hashCode() { return refSpec.hashCode() + ((methodId != null) ? methodId.hashCode() : 0) + ((methodArgs != null) ? methodArgs.hashCode() : 0); } + @Override public boolean equals(Object obj) { if (obj instanceof MethodBreakpointSpec) { MethodBreakpointSpec breakpoint = (MethodBreakpointSpec)obj; @@ -98,6 +98,7 @@ public class MethodBreakpointSpec extends BreakpointSpec { } } + @Override public String errorMessageFor(Exception e) { if (e instanceof AmbiguousMethodException) { return ("Method " + methodName() + " is overloaded; specify arguments"); @@ -114,6 +115,7 @@ public class MethodBreakpointSpec extends BreakpointSpec { } } + @Override public String toString() { StringBuffer buffer = new StringBuffer("breakpoint "); buffer.append(refSpec.toString()); @@ -257,7 +259,7 @@ public class MethodBreakpointSpec extends BreakpointSpec { */ if ((name.indexOf('.') == -1) || name.startsWith("*.")) { try { - List refs = specs.runtime.findClassesMatchingPattern(name); + List refs = specs.runtime.findClassesMatchingPattern(name); if (refs.size() > 0) { //### ambiguity??? name = ((ReferenceType)(refs.get(0))).name(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodNotFoundException.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodNotFoundException.java index 8fa2e60b79f..9fd3aa9efc7 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodNotFoundException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodNotFoundException.java @@ -27,6 +27,8 @@ package com.sun.tools.example.debug.bdi; public class MethodNotFoundException extends Exception { + private static final long serialVersionUID = -2064968107599632609L; + public MethodNotFoundException() { super(); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ModificationWatchpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ModificationWatchpointSpec.java index 7816ce698d2..7043d666ec8 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ModificationWatchpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ModificationWatchpointSpec.java @@ -26,7 +26,6 @@ package com.sun.tools.example.debug.bdi; import com.sun.jdi.*; -import com.sun.jdi.request.*; public class ModificationWatchpointSpec extends WatchpointSpec { @@ -38,6 +37,7 @@ public class ModificationWatchpointSpec extends WatchpointSpec { /** * The 'refType' is known to match. */ + @Override void resolve(ReferenceType refType) throws InvalidTypeException, NoSuchFieldException { if (!(refType instanceof ClassType)) { @@ -51,6 +51,7 @@ public class ModificationWatchpointSpec extends WatchpointSpec { .createModificationWatchpointRequest(field)); } + @Override public boolean equals(Object obj) { return (obj instanceof ModificationWatchpointSpec) && super.equals(obj); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/NoSessionException.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/NoSessionException.java index 9a40b413846..32988ab140b 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/NoSessionException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/NoSessionException.java @@ -25,4 +25,7 @@ package com.sun.tools.example.debug.bdi; -public class NoSessionException extends Exception {} +public class NoSessionException extends Exception { + + private static final long serialVersionUID = -7324357828115128603L; +} diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/NoThreadException.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/NoThreadException.java index aa36d667ee0..460b1a4ba4c 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/NoThreadException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/NoThreadException.java @@ -25,4 +25,8 @@ package com.sun.tools.example.debug.bdi; -public class NoThreadException extends Exception {} +public class NoThreadException extends Exception { + + private static final long serialVersionUID = 1846613539928921998L; + +} diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/PatternReferenceTypeSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/PatternReferenceTypeSpec.java index e9bd3f93793..4f6d73e8e71 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/PatternReferenceTypeSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/PatternReferenceTypeSpec.java @@ -47,6 +47,7 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec { /** * Does the specified ReferenceType match this spec. */ + @Override public boolean matches(ReferenceType refType) { if (isWild) { return refType.name().endsWith(classId); @@ -55,10 +56,12 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec { } } + @Override public int hashCode() { return classId.hashCode(); } + @Override public boolean equals(Object obj) { if (obj instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec spec = (PatternReferenceTypeSpec)obj; @@ -89,6 +92,7 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec { } } + @Override public String toString() { return isWild? "*" + classId : classId; } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ReferenceTypeSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ReferenceTypeSpec.java index e3282b747f1..fc478060aaa 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ReferenceTypeSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ReferenceTypeSpec.java @@ -33,7 +33,9 @@ interface ReferenceTypeSpec { */ boolean matches(ReferenceType refType); + @Override int hashCode(); + @Override boolean equals(Object obj); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/Session.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/Session.java index 61790af7b32..4599cb1ba10 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/Session.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/Session.java @@ -27,7 +27,6 @@ package com.sun.tools.example.debug.bdi; import com.sun.jdi.VirtualMachine; import com.sun.jdi.VMDisconnectedException; -import com.sun.jdi.event.EventSet; /** * Our repository of what we know about the state of one diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SourceNameReferenceTypeSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SourceNameReferenceTypeSpec.java index 2b8a1e158db..c788f5d0c53 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SourceNameReferenceTypeSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SourceNameReferenceTypeSpec.java @@ -39,6 +39,7 @@ class SourceNameReferenceTypeSpec implements ReferenceTypeSpec { /** * Does the specified ReferenceType match this spec. */ + @Override public boolean matches(ReferenceType refType) { try { if (refType.sourceName().equals(sourceName)) { @@ -48,9 +49,6 @@ class SourceNameReferenceTypeSpec implements ReferenceTypeSpec { return true; } catch(AbsentInformationException exc) { } catch(ObjectCollectedException exc) { - } catch(InvalidLineNumberException exc) { -// } catch(ClassNotPreparedException exc) { -// -- should not happen, so don't catch this --- } } } catch(AbsentInformationException exc) { @@ -59,10 +57,12 @@ class SourceNameReferenceTypeSpec implements ReferenceTypeSpec { return false; } + @Override public int hashCode() { return sourceName.hashCode() + linenumber; } + @Override public boolean equals(Object obj) { if (obj instanceof SourceNameReferenceTypeSpec) { SourceNameReferenceTypeSpec spec = (SourceNameReferenceTypeSpec)obj; @@ -74,6 +74,7 @@ class SourceNameReferenceTypeSpec implements ReferenceTypeSpec { } } + @Override public String toString() { return sourceName + "@" + linenumber; } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SpecErrorEvent.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SpecErrorEvent.java index 86a7575bafa..c6b9f4e78d3 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SpecErrorEvent.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SpecErrorEvent.java @@ -25,10 +25,9 @@ package com.sun.tools.example.debug.bdi; -import java.util.EventObject; - public class SpecErrorEvent extends SpecEvent { + private static final long serialVersionUID = 8162634387866409578L; private Exception reason; public SpecErrorEvent(EventRequestSpec eventRequestSpec, diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SpecEvent.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SpecEvent.java index 6cc1d3a1bfc..625a263fcef 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SpecEvent.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/SpecEvent.java @@ -31,6 +31,7 @@ import com.sun.jdi.request.EventRequest; public class SpecEvent extends EventObject { + private static final long serialVersionUID = 4820735456787276230L; private EventRequestSpec eventRequestSpec; public SpecEvent(EventRequestSpec eventRequestSpec) { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadGroupIterator.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadGroupIterator.java index 419a466f70b..c6ec121d808 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadGroupIterator.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadGroupIterator.java @@ -26,7 +26,6 @@ package com.sun.tools.example.debug.bdi; import com.sun.jdi.ThreadGroupReference; -import com.sun.jdi.ThreadReference; import java.util.List; import java.util.Stack; import java.util.ArrayList; @@ -73,10 +72,12 @@ public class ThreadGroupIterator implements Iterator { } } + @Override public boolean hasNext() { return !stack.isEmpty(); } + @Override public ThreadGroupReference next() { return nextThreadGroup(); } @@ -87,6 +88,7 @@ public class ThreadGroupIterator implements Iterator { return tg; } + @Override public void remove() { throw new UnsupportedOperationException(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadInfo.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadInfo.java index 7ced75a40f4..b9516c4313f 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadInfo.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadInfo.java @@ -26,9 +26,6 @@ package com.sun.tools.example.debug.bdi; import com.sun.jdi.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Iterator; //### Should handle target VM death or connection failure cleanly. diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadIterator.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadIterator.java index c6b2ce6efd2..6fafd71cd80 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadIterator.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ThreadIterator.java @@ -43,6 +43,7 @@ public class ThreadIterator implements Iterator { tgi = new ThreadGroupIterator(tgl); } + @Override public boolean hasNext() { while (it == null || !it.hasNext()) { if (!tgi.hasNext()) { @@ -53,6 +54,7 @@ public class ThreadIterator implements Iterator { return true; } + @Override public ThreadReference next() { return it.next(); } @@ -61,6 +63,7 @@ public class ThreadIterator implements Iterator { return next(); } + @Override public void remove() { throw new UnsupportedOperationException(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/Utils.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/Utils.java index 81993bf05e8..d3e0173dc9b 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/Utils.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/Utils.java @@ -26,9 +26,6 @@ package com.sun.tools.example.debug.bdi; //### does it belong here? import com.sun.jdi.*; -import com.sun.tools.jdi.*; -import java.util.*; -import java.io.*; public class Utils { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/VMLaunchFailureException.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/VMLaunchFailureException.java index fcbe82b332c..d0c482c50e0 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/VMLaunchFailureException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/VMLaunchFailureException.java @@ -25,4 +25,7 @@ package com.sun.tools.example.debug.bdi; -public class VMLaunchFailureException extends Exception {} +public class VMLaunchFailureException extends Exception { + + private static final long serialVersionUID = -2439646729274310108L; +} diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/VMNotInterruptedException.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/VMNotInterruptedException.java index 4ddc5a9fc86..ef12d6d2446 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/VMNotInterruptedException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/VMNotInterruptedException.java @@ -25,4 +25,7 @@ package com.sun.tools.example.debug.bdi; -public class VMNotInterruptedException extends Exception {} +public class VMNotInterruptedException extends Exception { + + private static final long serialVersionUID = 8111074582188765600L; +} diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/WatchpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/WatchpointSpec.java index 8414a17340a..469b4230a9a 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/WatchpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/WatchpointSpec.java @@ -25,9 +25,6 @@ package com.sun.tools.example.debug.bdi; -import com.sun.jdi.*; -import com.sun.jdi.request.*; - public abstract class WatchpointSpec extends EventRequestSpec { final String fieldId; @@ -40,31 +37,38 @@ public abstract class WatchpointSpec extends EventRequestSpec { // } } + @Override void notifySet(SpecListener listener, SpecEvent evt) { listener.watchpointSet(evt); } + @Override void notifyDeferred(SpecListener listener, SpecEvent evt) { listener.watchpointDeferred(evt); } + @Override void notifyResolved(SpecListener listener, SpecEvent evt) { listener.watchpointResolved(evt); } + @Override void notifyDeleted(SpecListener listener, SpecEvent evt) { listener.watchpointDeleted(evt); } + @Override void notifyError(SpecListener listener, SpecErrorEvent evt) { listener.watchpointError(evt); } + @Override public int hashCode() { return refSpec.hashCode() + fieldId.hashCode() + getClass().hashCode(); } + @Override public boolean equals(Object obj) { if (obj instanceof WatchpointSpec) { WatchpointSpec watchpoint = (WatchpointSpec)obj; @@ -77,6 +81,7 @@ public abstract class WatchpointSpec extends EventRequestSpec { } } + @Override public String errorMessageFor(Exception e) { if (e instanceof NoSuchFieldException) { return ("No field " + fieldId + " in " + refSpec); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/AbstractEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/AbstractEventSet.java index 3dedd034638..80cbd9a0da8 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/AbstractEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/AbstractEventSet.java @@ -33,6 +33,7 @@ import java.util.*; public abstract class AbstractEventSet extends EventObject implements EventSet { + private static final long serialVersionUID = 2772717574222076977L; private final EventSet jdiEventSet; final Event oneEvent; @@ -81,6 +82,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { // Implement Mirror + @Override public VirtualMachine virtualMachine() { return jdiEventSet.virtualMachine(); } @@ -105,10 +107,12 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { return jdiEventSet.suspendPolicy(); } + @Override public void resume() { jdiEventSet.resume(); } + @Override public int suspendPolicy() { return jdiEventSet.suspendPolicy(); } @@ -128,6 +132,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { /** * Return an iterator specific to {@link Event} objects. */ + @Override public EventIterator eventIterator() { return jdiEventSet.eventIterator(); } @@ -142,6 +147,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { * * @return the number of elements in this set (its cardinality). */ + @Override public int size() { return jdiEventSet.size(); } @@ -151,6 +157,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { * * @return true if this set contains no elements. */ + @Override public boolean isEmpty() { return jdiEventSet.isEmpty(); } @@ -163,6 +170,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { * * @return true if this set contains the specified element. */ + @Override public boolean contains(Object o) { return jdiEventSet.contains(o); } @@ -174,6 +182,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { * * @return an iterator over the elements in this set. */ + @Override public Iterator iterator() { return jdiEventSet.iterator(); } @@ -184,6 +193,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { * * @return an array containing all of the elements in this set. */ + @Override public Object[] toArray() { return jdiEventSet.toArray(); } @@ -202,6 +212,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { * @throws ArrayStoreException the runtime type of a is not a supertype * of the runtime type of every element in this set. */ + @Override public T[] toArray(T a[]) { return jdiEventSet.toArray(a); } @@ -217,6 +228,7 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { * @return true if this set contains all of the elements of the * specified collection. */ + @Override public boolean containsAll(Collection c) { return jdiEventSet.containsAll(c); } @@ -224,21 +236,27 @@ public abstract class AbstractEventSet extends EventObject implements EventSet { // Make the rest of Set unmodifiable + @Override public boolean add(Event e){ throw new UnsupportedOperationException(); } + @Override public boolean remove(Object o) { throw new UnsupportedOperationException(); } + @Override public boolean addAll(Collection coll) { throw new UnsupportedOperationException(); } + @Override public boolean removeAll(Collection coll) { throw new UnsupportedOperationException(); } + @Override public boolean retainAll(Collection coll) { throw new UnsupportedOperationException(); } + @Override public void clear() { throw new UnsupportedOperationException(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/AccessWatchpointEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/AccessWatchpointEventSet.java index 52894615e2b..37b73e5c4a2 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/AccessWatchpointEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/AccessWatchpointEventSet.java @@ -25,15 +25,17 @@ package com.sun.tools.example.debug.event; -import com.sun.jdi.*; import com.sun.jdi.event.*; public class AccessWatchpointEventSet extends WatchpointEventSet { + private static final long serialVersionUID = -2620394219156607673L; + AccessWatchpointEventSet(EventSet jdiEventSet) { super(jdiEventSet); } + @Override public void notify(JDIListener listener) { listener.accessWatchpoint(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/ClassPrepareEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/ClassPrepareEventSet.java index 763e5426eec..69050d3f53a 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/ClassPrepareEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/ClassPrepareEventSet.java @@ -30,6 +30,8 @@ import com.sun.jdi.event.*; public class ClassPrepareEventSet extends AbstractEventSet { + private static final long serialVersionUID = 5958493423581010491L; + ClassPrepareEventSet(EventSet jdiEventSet) { super(jdiEventSet); } @@ -55,6 +57,7 @@ public class ClassPrepareEventSet extends AbstractEventSet { return ((ClassPrepareEvent)oneEvent).referenceType(); } + @Override public void notify(JDIListener listener) { listener.classPrepare(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/ClassUnloadEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/ClassUnloadEventSet.java index b7f996a5a2b..c043b23b29a 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/ClassUnloadEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/ClassUnloadEventSet.java @@ -25,11 +25,12 @@ package com.sun.tools.example.debug.event; -import com.sun.jdi.*; import com.sun.jdi.event.*; public class ClassUnloadEventSet extends AbstractEventSet { + private static final long serialVersionUID = 8370341450345835866L; + ClassUnloadEventSet(EventSet jdiEventSet) { super(jdiEventSet); } @@ -48,6 +49,7 @@ public class ClassUnloadEventSet extends AbstractEventSet { return ((ClassUnloadEvent)oneEvent).classSignature(); } + @Override public void notify(JDIListener listener) { listener.classUnload(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/ExceptionEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/ExceptionEventSet.java index d55aab6121f..c94fa284ae6 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/ExceptionEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/ExceptionEventSet.java @@ -30,6 +30,8 @@ import com.sun.jdi.event.*; public class ExceptionEventSet extends LocatableEventSet { + private static final long serialVersionUID = 5328140167954640711L; + ExceptionEventSet(EventSet jdiEventSet) { super(jdiEventSet); } @@ -75,6 +77,7 @@ public class ExceptionEventSet extends LocatableEventSet { return ((ExceptionEvent)oneEvent).catchLocation(); } + @Override public void notify(JDIListener listener) { listener.exception(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/JDIAdapter.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/JDIAdapter.java index 3d310604240..fb3e7a859aa 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/JDIAdapter.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/JDIAdapter.java @@ -33,36 +33,47 @@ package com.sun.tools.example.debug.event; */ public class JDIAdapter implements JDIListener { + @Override public void accessWatchpoint(AccessWatchpointEventSet e) { } + @Override public void classPrepare(ClassPrepareEventSet e) { } + @Override public void classUnload(ClassUnloadEventSet e) { } + @Override public void exception(ExceptionEventSet e) { } + @Override public void locationTrigger(LocationTriggerEventSet e) { } + @Override public void modificationWatchpoint(ModificationWatchpointEventSet e) { } + @Override public void threadDeath(ThreadDeathEventSet e) { } + @Override public void threadStart(ThreadStartEventSet e) { } + @Override public void vmDeath(VMDeathEventSet e) { } + @Override public void vmDisconnect(VMDisconnectEventSet e) { } + @Override public void vmStart(VMStartEventSet e) { } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/LocatableEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/LocatableEventSet.java index 6e557c419e8..303af121e4e 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/LocatableEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/LocatableEventSet.java @@ -33,6 +33,8 @@ import com.sun.jdi.event.*; */ public abstract class LocatableEventSet extends AbstractEventSet { + private static final long serialVersionUID = 1027131209997915620L; + LocatableEventSet(EventSet jdiEventSet) { super(jdiEventSet); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/LocationTriggerEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/LocationTriggerEventSet.java index 6e5366eae61..b30bea52bef 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/LocationTriggerEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/LocationTriggerEventSet.java @@ -25,15 +25,17 @@ package com.sun.tools.example.debug.event; -import com.sun.jdi.*; import com.sun.jdi.event.*; public class LocationTriggerEventSet extends LocatableEventSet { + private static final long serialVersionUID = -3674631710485872487L; + LocationTriggerEventSet(EventSet jdiEventSet) { super(jdiEventSet); } + @Override public void notify(JDIListener listener) { listener.locationTrigger(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/ModificationWatchpointEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/ModificationWatchpointEventSet.java index d7824b7abf9..382a8f31b7c 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/ModificationWatchpointEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/ModificationWatchpointEventSet.java @@ -30,6 +30,8 @@ import com.sun.jdi.event.*; public class ModificationWatchpointEventSet extends WatchpointEventSet { + private static final long serialVersionUID = -680889300856154719L; + ModificationWatchpointEventSet(EventSet jdiEventSet) { super(jdiEventSet); } @@ -42,6 +44,7 @@ public class ModificationWatchpointEventSet extends WatchpointEventSet { return ((ModificationWatchpointEvent)oneEvent).valueToBe(); } + @Override public void notify(JDIListener listener) { listener.modificationWatchpoint(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/ThreadDeathEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/ThreadDeathEventSet.java index 2e2cc00eea1..ad432f77842 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/ThreadDeathEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/ThreadDeathEventSet.java @@ -30,6 +30,8 @@ import com.sun.jdi.event.*; public class ThreadDeathEventSet extends AbstractEventSet { + private static final long serialVersionUID = -8801604712308151331L; + ThreadDeathEventSet(EventSet jdiEventSet) { super(jdiEventSet); } @@ -44,6 +46,7 @@ public class ThreadDeathEventSet extends AbstractEventSet { return ((ThreadDeathEvent)oneEvent).thread(); } + @Override public void notify(JDIListener listener) { listener.threadDeath(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/ThreadStartEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/ThreadStartEventSet.java index 8f7ccc6fe39..63b1fb42603 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/ThreadStartEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/ThreadStartEventSet.java @@ -30,6 +30,8 @@ import com.sun.jdi.event.*; public class ThreadStartEventSet extends AbstractEventSet { + private static final long serialVersionUID = -3802096132294933502L; + ThreadStartEventSet(EventSet jdiEventSet) { super(jdiEventSet); } @@ -44,6 +46,7 @@ public class ThreadStartEventSet extends AbstractEventSet { return ((ThreadStartEvent)oneEvent).thread(); } + @Override public void notify(JDIListener listener) { listener.threadStart(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/VMDeathEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/VMDeathEventSet.java index 963eb8e8e82..017f11ff5ae 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/VMDeathEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/VMDeathEventSet.java @@ -29,10 +29,13 @@ import com.sun.jdi.event.*; public class VMDeathEventSet extends AbstractEventSet { + private static final long serialVersionUID = 1163097303940092229L; + VMDeathEventSet(EventSet jdiEventSet) { super(jdiEventSet); } + @Override public void notify(JDIListener listener) { listener.vmDeath(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/VMDisconnectEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/VMDisconnectEventSet.java index d8555309555..4edf4b872c9 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/VMDisconnectEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/VMDisconnectEventSet.java @@ -29,10 +29,13 @@ import com.sun.jdi.event.*; public class VMDisconnectEventSet extends AbstractEventSet { + private static final long serialVersionUID = 7968123152344675342L; + VMDisconnectEventSet(EventSet jdiEventSet) { super(jdiEventSet); } + @Override public void notify(JDIListener listener) { listener.vmDisconnect(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/VMStartEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/VMStartEventSet.java index d04116a44af..896fa78c369 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/VMStartEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/VMStartEventSet.java @@ -30,6 +30,8 @@ import com.sun.jdi.event.*; public class VMStartEventSet extends AbstractEventSet { + private static final long serialVersionUID = -3384957227835478191L; + VMStartEventSet(EventSet jdiEventSet) { super(jdiEventSet); } @@ -44,6 +46,7 @@ public class VMStartEventSet extends AbstractEventSet { return ((VMStartEvent)oneEvent).thread(); } + @Override public void notify(JDIListener listener) { listener.vmStart(this); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/event/WatchpointEventSet.java b/jdk/src/share/classes/com/sun/tools/example/debug/event/WatchpointEventSet.java index 5c4de701001..628f21cb92d 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/event/WatchpointEventSet.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/event/WatchpointEventSet.java @@ -30,6 +30,8 @@ import com.sun.jdi.event.*; public abstract class WatchpointEventSet extends LocatableEventSet { + private static final long serialVersionUID = 5606285209703845409L; + WatchpointEventSet(EventSet jdiEventSet) { super(jdiEventSet); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java index 3f8d0001a74..c2c79010c6b 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java @@ -27,25 +27,25 @@ package com.sun.tools.example.debug.expr; import com.sun.jdi.*; + import java.util.Stack; import java.util.List; import java.util.ArrayList; -@SuppressWarnings("unchecked") public class ExpressionParser implements ExpressionParserConstants { - Stack stack = new Stack(); + Stack stack = new Stack(); VirtualMachine vm = null; GetFrame frameGetter = null; private static GetFrame lastFrameGetter; private static LValue lastLValue; LValue peek() { - return (LValue)stack.peek(); + return stack.peek(); } LValue pop() { - return (LValue)stack.pop(); + return stack.pop(); } void push(LValue lval) { @@ -61,17 +61,14 @@ public class ExpressionParser implements ExpressionParserConstants { } public static Value evaluate(String expr, VirtualMachine vm, - GetFrame frameGetter) throws ParseException, - InvocationException, - InvalidTypeException, - ClassNotLoadedException, + GetFrame frameGetter) throws ParseException, InvocationException, + InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException { // TODO StringBufferInputStream is deprecated. java.io.InputStream in = new java.io.StringBufferInputStream(expr); ExpressionParser parser = new ExpressionParser(in); parser.vm = vm; parser.frameGetter = frameGetter; - Value value = null; parser.Expression(); lastFrameGetter = frameGetter; lastLValue = parser.pop(); @@ -89,8 +86,8 @@ public class ExpressionParser implements ExpressionParserConstants { try { parser = new ExpressionParser(new java.io.FileInputStream(args[0])); } catch (java.io.FileNotFoundException e) { - System.out.println("Java Parser Version 1.0.2: File " + - args[0] + " not found."); + System.out.println("Java Parser Version 1.0.2: File " + args[0] + + " not found."); return; } } else { @@ -137,8 +134,7 @@ public class ExpressionParser implements ExpressionParserConstants { jj_consume_token(-1); throw new ParseException(); } - label_1: - while (true) { + label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: ; @@ -189,8 +185,7 @@ public class ExpressionParser implements ExpressionParserConstants { StringBuffer sb = new StringBuffer(); jj_consume_token(IDENTIFIER); sb.append(token); - label_2: - while (true) { + label_2: while (true) { if (jj_2_1(2)) { ; } else { @@ -198,16 +193,18 @@ public class ExpressionParser implements ExpressionParserConstants { } jj_consume_token(DOT); jj_consume_token(IDENTIFIER); - sb.append('.'); sb.append(token); - } - {if (true) return sb.toString();} + sb.append('.'); + sb.append(token); + } + if (true) { + return sb.toString(); + } throw new Error("Missing return statement in function"); } final public void NameList() throws ParseException { Name(); - label_3: - while (true) { + label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; @@ -261,7 +258,9 @@ public class ExpressionParser implements ExpressionParserConstants { PrimaryExpression(); AssignmentOperator(); Expression(); - LValue exprVal = pop(); pop().setValue(exprVal); push(exprVal); + LValue exprVal = pop(); + pop().setValue(exprVal); + push(exprVal); } final public void AssignmentOperator() throws ParseException { @@ -317,13 +316,18 @@ public class ExpressionParser implements ExpressionParserConstants { Expression(); jj_consume_token(COLON); ConditionalExpression(); - LValue falseBranch = pop(); LValue trueBranch = pop(); + LValue falseBranch = pop(); + LValue trueBranch = pop(); Value cond = pop().interiorGetValue(); if (cond instanceof BooleanValue) { - push(((BooleanValue)cond).booleanValue()? - trueBranch : falseBranch); + push(((BooleanValue) cond).booleanValue() ? trueBranch + : falseBranch); } else { - {if (true) throw new ParseException("Condition must be boolean");} + { + if (true) { + throw new ParseException("Condition must be boolean"); + } + } } break; default: @@ -334,8 +338,7 @@ public class ExpressionParser implements ExpressionParserConstants { final public void ConditionalOrExpression() throws ParseException { ConditionalAndExpression(); - label_4: - while (true) { + label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SC_OR: ; @@ -346,14 +349,17 @@ public class ExpressionParser implements ExpressionParserConstants { } jj_consume_token(SC_OR); ConditionalAndExpression(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } } } final public void ConditionalAndExpression() throws ParseException { InclusiveOrExpression(); - label_5: - while (true) { + label_5: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SC_AND: ; @@ -364,14 +370,17 @@ public class ExpressionParser implements ExpressionParserConstants { } jj_consume_token(SC_AND); InclusiveOrExpression(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } } } final public void InclusiveOrExpression() throws ParseException { ExclusiveOrExpression(); - label_6: - while (true) { + label_6: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BIT_OR: ; @@ -382,14 +391,17 @@ public class ExpressionParser implements ExpressionParserConstants { } jj_consume_token(BIT_OR); ExclusiveOrExpression(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } } } final public void ExclusiveOrExpression() throws ParseException { AndExpression(); - label_7: - while (true) { + label_7: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case XOR: ; @@ -400,14 +412,17 @@ public class ExpressionParser implements ExpressionParserConstants { } jj_consume_token(XOR); AndExpression(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } } } final public void AndExpression() throws ParseException { EqualityExpression(); - label_8: - while (true) { + label_8: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BIT_AND: ; @@ -418,15 +433,18 @@ public class ExpressionParser implements ExpressionParserConstants { } jj_consume_token(BIT_AND); EqualityExpression(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } } } final public void EqualityExpression() throws ParseException { Token tok; InstanceOfExpression(); - label_9: - while (true) { + label_9: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EQ: case NE: @@ -460,7 +478,11 @@ public class ExpressionParser implements ExpressionParserConstants { case INSTANCEOF: jj_consume_token(INSTANCEOF); Type(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } break; default: jj_la1[14] = jj_gen; @@ -471,8 +493,7 @@ public class ExpressionParser implements ExpressionParserConstants { final public void RelationalExpression() throws ParseException { Token tok; ShiftExpression(); - label_10: - while (true) { + label_10: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case GT: case LT: @@ -510,8 +531,7 @@ public class ExpressionParser implements ExpressionParserConstants { final public void ShiftExpression() throws ParseException { AdditiveExpression(); - label_11: - while (true) { + label_11: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LSHIFT: case RSIGNEDSHIFT: @@ -538,15 +558,18 @@ public class ExpressionParser implements ExpressionParserConstants { throw new ParseException(); } AdditiveExpression(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } } } final public void AdditiveExpression() throws ParseException { Token tok; MultiplicativeExpression(); - label_12: - while (true) { + label_12: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: case MINUS: @@ -577,8 +600,7 @@ public class ExpressionParser implements ExpressionParserConstants { final public void MultiplicativeExpression() throws ParseException { Token tok; UnaryExpression(); - label_13: - while (true) { + label_13: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STAR: case SLASH: @@ -627,7 +649,11 @@ public class ExpressionParser implements ExpressionParserConstants { throw new ParseException(); } UnaryExpression(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } break; case INCR: PreIncrementExpression(); @@ -661,13 +687,21 @@ public class ExpressionParser implements ExpressionParserConstants { final public void PreIncrementExpression() throws ParseException { jj_consume_token(INCR); PrimaryExpression(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } } final public void PreDecrementExpression() throws ParseException { jj_consume_token(DECR); PrimaryExpression(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } } final public void UnaryExpressionNotPlusMinus() throws ParseException { @@ -687,7 +721,11 @@ public class ExpressionParser implements ExpressionParserConstants { throw new ParseException(); } UnaryExpression(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } break; default: jj_la1[26] = jj_gen; @@ -718,8 +756,10 @@ public class ExpressionParser implements ExpressionParserConstants { } } -// This production is to determine lookahead only. The LOOKAHEAD specifications -// below are not used, but they are there just to indicate that we know about + // This production is to determine lookahead only. The LOOKAHEAD + // specifications + // below are not used, but they are there just to indicate that we know + // about // this. final public void CastLookahead() throws ParseException { if (jj_2_4(2)) { @@ -792,7 +832,11 @@ public class ExpressionParser implements ExpressionParserConstants { break; case DECR: jj_consume_token(DECR); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } break; default: jj_la1[30] = jj_gen; @@ -810,8 +854,7 @@ public class ExpressionParser implements ExpressionParserConstants { if (jj_2_6(2)) { jj_consume_token(LPAREN); PrimitiveType(); - label_14: - while (true) { + label_14: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: ; @@ -830,8 +873,7 @@ public class ExpressionParser implements ExpressionParserConstants { case LPAREN: jj_consume_token(LPAREN); Name(); - label_15: - while (true) { + label_15: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: ; @@ -856,8 +898,7 @@ public class ExpressionParser implements ExpressionParserConstants { final public void PrimaryExpression() throws ParseException { PrimaryPrefix(); - label_16: - while (true) { + label_16: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: case LBRACKET: @@ -896,7 +937,11 @@ public class ExpressionParser implements ExpressionParserConstants { jj_consume_token(SUPER); jj_consume_token(DOT); jj_consume_token(IDENTIFIER); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } break; case LPAREN: jj_consume_token(LPAREN); @@ -914,7 +959,7 @@ public class ExpressionParser implements ExpressionParserConstants { } final public void PrimarySuffix() throws ParseException { - List argList; + List argList; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACKET: jj_consume_token(LBRACKET); @@ -992,8 +1037,8 @@ public class ExpressionParser implements ExpressionParserConstants { jj_consume_token(NULL); } - final public List Arguments() throws ParseException { - List argList = new ArrayList(); + final public List Arguments() throws ParseException { + List argList = new ArrayList(); jj_consume_token(LPAREN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case FALSE: @@ -1021,15 +1066,18 @@ public class ExpressionParser implements ExpressionParserConstants { ; } jj_consume_token(RPAREN); - {if (true) return argList;} + { + if (true) { + return argList; + } + } throw new Error("Missing return statement in function"); } - final public void ArgumentList(List argList) throws ParseException { + final public void ArgumentList(List argList) throws ParseException { Expression(); argList.add(pop().interiorGetValue()); - label_17: - while (true) { + label_17: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; @@ -1045,7 +1093,8 @@ public class ExpressionParser implements ExpressionParserConstants { } final public void AllocationExpression() throws ParseException { - List argList; String className; + List argList; + String className; if (jj_2_7(2)) { jj_consume_token(NEW); PrimitiveType(); @@ -1062,7 +1111,11 @@ public class ExpressionParser implements ExpressionParserConstants { break; case LBRACKET: ArrayDimensions(); - {if (true) throw new ParseException("operation not yet supported");} + { + if (true) { + throw new ParseException("operation not yet supported"); + } + } break; default: jj_la1[42] = jj_gen; @@ -1079,12 +1132,11 @@ public class ExpressionParser implements ExpressionParserConstants { } /* - * The second LOOKAHEAD specification below is to parse to PrimarySuffix - * if there is an expression between the "[...]". + * The second LOOKAHEAD specification below is to parse to PrimarySuffix if + * there is an expression between the "[...]". */ final public void ArrayDimensions() throws ParseException { - label_18: - while (true) { + label_18: while (true) { jj_consume_token(LBRACKET); Expression(); jj_consume_token(RBRACKET); @@ -1094,8 +1146,7 @@ public class ExpressionParser implements ExpressionParserConstants { break label_18; } } - label_19: - while (true) { + label_19: while (true) { if (jj_2_9(2)) { ; } else { @@ -1107,71 +1158,84 @@ public class ExpressionParser implements ExpressionParserConstants { } final private boolean jj_2_1(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; + jj_la = xla; + jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_1(); jj_save(0, xla); return retval; } final private boolean jj_2_2(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; + jj_la = xla; + jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_2(); jj_save(1, xla); return retval; } final private boolean jj_2_3(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; + jj_la = xla; + jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_3(); jj_save(2, xla); return retval; } final private boolean jj_2_4(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; + jj_la = xla; + jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_4(); jj_save(3, xla); return retval; } final private boolean jj_2_5(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; + jj_la = xla; + jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_5(); jj_save(4, xla); return retval; } final private boolean jj_2_6(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; + jj_la = xla; + jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_6(); jj_save(5, xla); return retval; } final private boolean jj_2_7(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; + jj_la = xla; + jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_7(); jj_save(6, xla); return retval; } final private boolean jj_2_8(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; + jj_la = xla; + jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_8(); jj_save(7, xla); return retval; } final private boolean jj_2_9(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; + jj_la = xla; + jj_lastpos = jj_scanpos = token; boolean retval = !jj_3_9(); jj_save(8, xla); return retval; } final private boolean jj_3R_154() { - if (jj_scan_token(INCR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(INCR)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1180,9 +1244,15 @@ public class ExpressionParser implements ExpressionParserConstants { xsp = jj_scanpos; if (jj_3R_154()) { jj_scanpos = xsp; - if (jj_3R_155()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_155()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1191,27 +1261,54 @@ public class ExpressionParser implements ExpressionParserConstants { xsp = jj_scanpos; if (jj_3_6()) { jj_scanpos = xsp; - if (jj_3R_150()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_150()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3_6() { - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_23()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_23()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_152()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } - if (jj_scan_token(RPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_115()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_152()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } + if (jj_scan_token(RPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_115()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1220,45 +1317,86 @@ public class ExpressionParser implements ExpressionParserConstants { xsp = jj_scanpos; if (jj_3R_50()) { jj_scanpos = xsp; - if (jj_3R_51()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_51()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_50() { - if (jj_3R_67()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_67()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3_5() { - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_24()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(LBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_24()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(LBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_149() { - if (jj_3R_20()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_20()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; xsp = jj_scanpos; - if (jj_3R_151()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_151()) { + jj_scanpos = xsp; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_41() { - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_24()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_24()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(RPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; xsp = jj_scanpos; if (jj_3R_59()) { @@ -1275,51 +1413,109 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_65()) { jj_scanpos = xsp; - if (jj_3R_66()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_66()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_40() { - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_24()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(LBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_24()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(LBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(RBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_123() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(RBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3_1() { - if (jj_scan_token(DOT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(DOT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(IDENTIFIER)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3_4() { - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_23()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_23()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1330,76 +1526,129 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_40()) { jj_scanpos = xsp; - if (jj_3R_41()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_41()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3_3() { - if (jj_3R_22()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_22()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_24() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(IDENTIFIER)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3_1()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3_1()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_147() { - if (jj_scan_token(BANG)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(BANG)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_142() { - if (jj_3R_149()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_149()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_122() { - if (jj_3R_24()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_24()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_49() { - if (jj_scan_token(DOUBLE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(DOUBLE)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_141() { - if (jj_3R_148()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_148()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_48() { - if (jj_scan_token(FLOAT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(FLOAT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_146() { - if (jj_scan_token(TILDE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(TILDE)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_47() { - if (jj_scan_token(LONG)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LONG)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1408,11 +1657,21 @@ public class ExpressionParser implements ExpressionParserConstants { xsp = jj_scanpos; if (jj_3R_146()) { jj_scanpos = xsp; - if (jj_3R_147()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_115()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_147()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_115()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1423,48 +1682,84 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_141()) { jj_scanpos = xsp; - if (jj_3R_142()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_142()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_46() { - if (jj_scan_token(INT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(INT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_145() { - if (jj_scan_token(REM)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(REM)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_45() { - if (jj_scan_token(SHORT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(SHORT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_44() { - if (jj_scan_token(BYTE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(BYTE)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_135() { - if (jj_scan_token(DECR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_20()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(DECR)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_20()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_43() { - if (jj_scan_token(CHAR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(CHAR)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1485,49 +1780,95 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_48()) { jj_scanpos = xsp; - if (jj_3R_49()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_49()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_42() { - if (jj_scan_token(BOOLEAN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(BOOLEAN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3_9() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(RBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_121() { - if (jj_3R_23()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_23()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_144() { - if (jj_scan_token(SLASH)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(SLASH)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_134() { - if (jj_scan_token(INCR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_20()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(INCR)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_20()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1536,62 +1877,105 @@ public class ExpressionParser implements ExpressionParserConstants { xsp = jj_scanpos; if (jj_3R_121()) { jj_scanpos = xsp; - if (jj_3R_122()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_122()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } while (true) { xsp = jj_scanpos; - if (jj_3R_123()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_123()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_120() { - if (jj_scan_token(GE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(GE)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_133() { - if (jj_scan_token(MINUS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(MINUS)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_127() { - if (jj_3R_136()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_136()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_126() { - if (jj_3R_135()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_135()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_139() { - if (jj_scan_token(MINUS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(MINUS)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_125() { - if (jj_3R_134()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_134()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_132() { - if (jj_scan_token(PLUS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(PLUS)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_143() { - if (jj_scan_token(STAR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(STAR)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1600,11 +1984,21 @@ public class ExpressionParser implements ExpressionParserConstants { xsp = jj_scanpos; if (jj_3R_132()) { jj_scanpos = xsp; - if (jj_3R_133()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_115()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_133()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_115()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1617,11 +2011,21 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_126()) { jj_scanpos = xsp; - if (jj_3R_127()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_127()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1632,54 +2036,95 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_144()) { jj_scanpos = xsp; - if (jj_3R_145()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_115()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_145()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_115()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_131() { - if (jj_scan_token(RUNSIGNEDSHIFT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RUNSIGNEDSHIFT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_119() { - if (jj_scan_token(LE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LE)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_138() { - if (jj_scan_token(PLUS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(PLUS)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_112() { - if (jj_3R_115()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_115()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_137()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_137()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_88() { - if (jj_3R_86()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_86()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_130() { - if (jj_scan_token(RSIGNEDSHIFT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RSIGNEDSHIFT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1688,29 +2133,51 @@ public class ExpressionParser implements ExpressionParserConstants { xsp = jj_scanpos; if (jj_3R_138()) { jj_scanpos = xsp; - if (jj_3R_139()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_112()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_139()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_112()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_87() { - if (jj_3R_82()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_82()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_118() { - if (jj_scan_token(GT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(GT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_129() { - if (jj_scan_token(LSHIFT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LSHIFT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1721,68 +2188,128 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_130()) { jj_scanpos = xsp; - if (jj_3R_131()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_108()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_131()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_108()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_108() { - if (jj_3R_112()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_112()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_128()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_128()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3_8() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_25()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_25()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(RBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_86() { Token xsp; - if (jj_3_8()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3_8()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } while (true) { xsp = jj_scanpos; - if (jj_3_8()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3_8()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } while (true) { xsp = jj_scanpos; - if (jj_3_9()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3_9()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_117() { - if (jj_scan_token(LT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_106() { - if (jj_3R_108()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_108()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_116()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_116()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } @@ -1796,64 +2323,125 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_119()) { jj_scanpos = xsp; - if (jj_3R_120()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_106()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_120()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_106()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_111() { - if (jj_scan_token(NE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(NE)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_109() { - if (jj_scan_token(INSTANCEOF)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_114()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(INSTANCEOF)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_114()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_104() { - if (jj_3R_106()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_106()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_113()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_113()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_81() { - if (jj_scan_token(NEW)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_24()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(NEW)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_24()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; xsp = jj_scanpos; if (jj_3R_87()) { jj_scanpos = xsp; - if (jj_3R_88()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_88()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3_7() { - if (jj_scan_token(NEW)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_23()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_86()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(NEW)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_23()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_86()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1862,39 +2450,68 @@ public class ExpressionParser implements ExpressionParserConstants { xsp = jj_scanpos; if (jj_3_7()) { jj_scanpos = xsp; - if (jj_3R_81()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_81()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_97() { - if (jj_scan_token(COMMA)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_25()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(COMMA)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_25()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_39() { - if (jj_scan_token(ORASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(ORASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_110() { - if (jj_scan_token(EQ)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(EQ)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_102() { - if (jj_3R_104()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_104()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; xsp = jj_scanpos; - if (jj_3R_109()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_109()) { + jj_scanpos = xsp; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -1903,117 +2520,209 @@ public class ExpressionParser implements ExpressionParserConstants { xsp = jj_scanpos; if (jj_3R_110()) { jj_scanpos = xsp; - if (jj_3R_111()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_102()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_111()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_102()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_94() { - if (jj_3R_25()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_25()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_97()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_97()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_89() { - if (jj_3R_94()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_94()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_38() { - if (jj_scan_token(XORASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(XORASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_82() { - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; xsp = jj_scanpos; - if (jj_3R_89()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_89()) { + jj_scanpos = xsp; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(RPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_105() { - if (jj_scan_token(BIT_AND)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_100()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(BIT_AND)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_100()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_100() { - if (jj_3R_102()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_102()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_107()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_107()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_37() { - if (jj_scan_token(ANDASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(ANDASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_85() { - if (jj_scan_token(NULL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(NULL)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_103() { - if (jj_scan_token(XOR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_98()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(XOR)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_98()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_98() { - if (jj_3R_100()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_100()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_105()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_105()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_92() { - if (jj_scan_token(FALSE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(FALSE)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_36() { - if (jj_scan_token(RUNSIGNEDSHIFTASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RUNSIGNEDSHIFTASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_91() { - if (jj_scan_token(TRUE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(TRUE)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -2022,109 +2731,189 @@ public class ExpressionParser implements ExpressionParserConstants { xsp = jj_scanpos; if (jj_3R_91()) { jj_scanpos = xsp; - if (jj_3R_92()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_92()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_101() { - if (jj_scan_token(BIT_OR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_95()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(BIT_OR)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_95()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_95() { - if (jj_3R_98()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_98()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_103()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_103()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_35() { - if (jj_scan_token(RSIGNEDSHIFTASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RSIGNEDSHIFTASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_80() { - if (jj_3R_85()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_85()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_66() { - if (jj_3R_69()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_69()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_79() { - if (jj_3R_84()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_84()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_78() { - if (jj_scan_token(STRING_LITERAL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(STRING_LITERAL)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_99() { - if (jj_scan_token(SC_AND)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_90()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(SC_AND)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_90()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_90() { - if (jj_3R_95()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_95()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_101()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_101()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_34() { - if (jj_scan_token(LSHIFTASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LSHIFTASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_65() { - if (jj_scan_token(NEW)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(NEW)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_77() { - if (jj_scan_token(CHARACTER_LITERAL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(CHARACTER_LITERAL)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_76() { - if (jj_scan_token(FLOATING_POINT_LITERAL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(FLOATING_POINT_LITERAL)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_33() { - if (jj_scan_token(MINUSASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(MINUSASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -2141,89 +2930,161 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_79()) { jj_scanpos = xsp; - if (jj_3R_80()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_80()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_75() { - if (jj_scan_token(INTEGER_LITERAL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(INTEGER_LITERAL)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_96() { - if (jj_scan_token(SC_OR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_83()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(SC_OR)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_83()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_83() { - if (jj_3R_90()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_90()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_99()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_99()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_64() { - if (jj_scan_token(SUPER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(SUPER)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_32() { - if (jj_scan_token(PLUSASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(PLUSASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_73() { - if (jj_3R_82()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_82()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_72() { - if (jj_scan_token(DOT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(DOT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(IDENTIFIER)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_74() { - if (jj_3R_83()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_83()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_96()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_96()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_63() { - if (jj_scan_token(THIS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(THIS)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_31() { - if (jj_scan_token(REMASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(REMASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -2234,120 +3095,231 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_72()) { jj_scanpos = xsp; - if (jj_3R_73()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_73()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_71() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_25()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_25()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(RBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_93() { - if (jj_scan_token(HOOK)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_25()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(COLON)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_68()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(HOOK)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_25()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(COLON)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_68()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_57() { - if (jj_3R_70()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_70()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_30() { - if (jj_scan_token(SLASHASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(SLASHASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_27() { - if (jj_3R_58()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_58()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_56() { - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_25()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_25()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(RPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_152() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(RBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_55() { - if (jj_scan_token(SUPER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(DOT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(SUPER)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(DOT)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(IDENTIFIER)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_29() { - if (jj_scan_token(STARASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(STARASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_68() { - if (jj_3R_74()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_74()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; xsp = jj_scanpos; - if (jj_3R_93()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_93()) { + jj_scanpos = xsp; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_54() { - if (jj_scan_token(THIS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(THIS)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_62() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(IDENTIFIER)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_53() { - if (jj_3R_24()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_24()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_153() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_scan_token(RBRACKET)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -2364,19 +3336,37 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_56()) { jj_scanpos = xsp; - if (jj_3R_57()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_57()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_52() { - if (jj_3R_69()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_69()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -2405,103 +3395,206 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = xsp; if (jj_3R_38()) { jj_scanpos = xsp; - if (jj_3R_39()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_39()) { + return true; + } + if (jj_la == 0 + && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 + && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 + && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_28() { - if (jj_scan_token(ASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(ASSIGN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_61() { - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3_2() { - if (jj_3R_20()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_21()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_20()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_21()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_20() { - if (jj_3R_26()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_26()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_27()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_27()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } } return false; } final private boolean jj_3R_60() { - if (jj_scan_token(BANG)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(BANG)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_155() { - if (jj_scan_token(DECR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(DECR)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_67() { - if (jj_3R_20()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_21()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_25()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_20()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_21()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_25()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_150() { - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_24()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_24()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_153()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } - if (jj_scan_token(RPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_136()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_153()) { + jj_scanpos = xsp; + break; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + } + if (jj_scan_token(RPAREN)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } + if (jj_3R_136()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_59() { - if (jj_scan_token(TILDE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(TILDE)) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } final private boolean jj_3R_51() { - if (jj_3R_68()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_68()) { + return true; + } + if (jj_la == 0 && jj_scanpos == jj_lastpos) { + return false; + } return false; } @@ -2512,13 +3605,28 @@ public class ExpressionParser implements ExpressionParserConstants { private Token jj_scanpos, jj_lastpos; private int jj_la; public boolean lookingAhead = false; - private boolean jj_semLA; private int jj_gen; final private int[] jj_la1 = new int[44]; - final private int[] jj_la1_0 = {0x8209400,0x0,0x8209400,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x1000000,0x1000000,0x0,0x0,0x0,}; - final private int[] jj_la1_1 = {0x2014,0x0,0x2014,0x0,0x884480c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x884480c0,0x0,0x0,0x884480c0,0x884480c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x884480c0,0x0,0x88400080,0x400000,0x884480c0,0x0,0x0,0x40,}; - final private int[] jj_la1_2 = {0x8,0x400,0x0,0x2000,0xf00c004e,0x8000,0x100000,0x4000000,0x8000000,0x0,0x0,0x0,0x2400000,0x2400000,0x0,0x1830000,0x1830000,0x0,0x0,0xc0000000,0xc0000000,0x0,0x0,0xc0000000,0xf00c004e,0xc0000,0xc0000,0x4e,0xc004e,0x40,0x30000000,0x30000000,0x400,0x400,0x40,0x4440,0x4e,0x4440,0x6,0x0,0xf00c004e,0x2000,0x440,0x0,}; - final private int[] jj_la1_3 = {0x0,0x0,0x0,0x0,0x0,0xffe00,0x0,0x0,0x0,0x8,0x10,0x4,0x0,0x0,0x0,0x0,0x0,0x1c0,0x1c0,0x0,0x0,0x23,0x23,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + final private int[] jj_la1_0 = { 0x8209400, 0x0, 0x8209400, 0x0, 0x1000000, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000000, 0x0, 0x0, 0x1000000, 0x1000000, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000000, 0x0, 0x1000000, + 0x1000000, 0x1000000, 0x0, 0x0, 0x0, }; + final private int[] jj_la1_1 = { 0x2014, 0x0, 0x2014, 0x0, 0x884480c0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x884480c0, 0x0, 0x0, 0x884480c0, 0x884480c0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x884480c0, 0x0, 0x88400080, 0x400000, + 0x884480c0, 0x0, 0x0, 0x40, }; + final private int[] jj_la1_2 = { 0x8, 0x400, 0x0, 0x2000, 0xf00c004e, + 0x8000, 0x100000, 0x4000000, 0x8000000, 0x0, 0x0, 0x0, 0x2400000, + 0x2400000, 0x0, 0x1830000, 0x1830000, 0x0, 0x0, 0xc0000000, + 0xc0000000, 0x0, 0x0, 0xc0000000, 0xf00c004e, 0xc0000, 0xc0000, 0x4e, + 0xc004e, 0x40, 0x30000000, 0x30000000, 0x400, 0x400, 0x40, 0x4440, + 0x4e, 0x4440, 0x6, 0x0, 0xf00c004e, 0x2000, 0x440, 0x0, }; + final private int[] jj_la1_3 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0xffe00, 0x0, 0x0, + 0x0, 0x8, 0x10, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c0, 0x1c0, 0x0, 0x0, + 0x23, 0x23, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; final private JJExpressionParserCalls[] jj_2_rtns = new JJExpressionParserCalls[9]; private boolean jj_rescan = false; private int jj_gc = 0; @@ -2529,8 +3637,12 @@ public class ExpressionParser implements ExpressionParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 44; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJExpressionParserCalls(); + for (int i = 0; i < 44; i++) { + jj_la1[i] = -1; + } + for (int i = 0; i < jj_2_rtns.length; i++) { + jj_2_rtns[i] = new JJExpressionParserCalls(); + } } public void ReInit(java.io.InputStream stream) { @@ -2539,8 +3651,12 @@ public class ExpressionParser implements ExpressionParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 44; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJExpressionParserCalls(); + for (int i = 0; i < 44; i++) { + jj_la1[i] = -1; + } + for (int i = 0; i < jj_2_rtns.length; i++) { + jj_2_rtns[i] = new JJExpressionParserCalls(); + } } public ExpressionParser(ExpressionParserTokenManager tm) { @@ -2548,8 +3664,12 @@ public class ExpressionParser implements ExpressionParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 44; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJExpressionParserCalls(); + for (int i = 0; i < 44; i++) { + jj_la1[i] = -1; + } + for (int i = 0; i < jj_2_rtns.length; i++) { + jj_2_rtns[i] = new JJExpressionParserCalls(); + } } public void ReInit(ExpressionParserTokenManager tm) { @@ -2557,23 +3677,32 @@ public class ExpressionParser implements ExpressionParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 44; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJExpressionParserCalls(); + for (int i = 0; i < 44; i++) { + jj_la1[i] = -1; + } + for (int i = 0; i < jj_2_rtns.length; i++) { + jj_2_rtns[i] = new JJExpressionParserCalls(); + } } final private Token jj_consume_token(int kind) throws ParseException { Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); + if ((oldToken = token).next != null) { + token = token.next; + } else { + token = token.next = token_source.getNextToken(); + } jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; - for (int i = 0; i < jj_2_rtns.length; i++) { - JJExpressionParserCalls c = jj_2_rtns[i]; + for (JJExpressionParserCalls jj_2_rtn : jj_2_rtns) { + JJExpressionParserCalls c = jj_2_rtn; while (c != null) { - if (c.gen < jj_gen) c.first = null; + if (c.gen < jj_gen) { + c.first = null; + } c = c.next; } } @@ -2589,7 +3718,8 @@ public class ExpressionParser implements ExpressionParserConstants { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source + .getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } @@ -2597,16 +3727,25 @@ public class ExpressionParser implements ExpressionParserConstants { jj_scanpos = jj_scanpos.next; } if (jj_rescan) { - int i = 0; Token tok = token; - while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } - if (tok != null) jj_add_error_token(kind, i); + int i = 0; + Token tok = token; + while (tok != null && tok != jj_scanpos) { + i++; + tok = tok.next; + } + if (tok != null) { + jj_add_error_token(kind, i); + } } return (jj_scanpos.kind != kind); } final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); + if (token.next != null) { + token = token.next; + } else { + token = token.next = token_source.getNextToken(); + } jj_ntk = -1; jj_gen++; return token; @@ -2615,27 +3754,33 @@ public class ExpressionParser implements ExpressionParserConstants { final public Token getToken(int index) { Token t = lookingAhead ? jj_scanpos : token; for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); + if (t.next != null) { + t = t.next; + } else { + t = t.next = token_source.getNextToken(); + } } return t; } final private int jj_ntk() { - if ((jj_nt=token.next) == null) + if ((jj_nt = token.next) == null) { return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else + } else { return (jj_ntk = jj_nt.kind); } + } - private java.util.Vector jj_expentries = new java.util.Vector(); + private java.util.Vector jj_expentries = new java.util.Vector(); private int[] jj_expentry; private int jj_kind = -1; private int[] jj_lasttokens = new int[100]; private int jj_endpos; private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) return; + if (pos >= 100) { + return; + } if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { @@ -2644,8 +3789,9 @@ public class ExpressionParser implements ExpressionParserConstants { jj_expentry[i] = jj_lasttokens[i]; } boolean exists = false; - for (java.util.Enumeration enum_ = jj_expentries.elements(); enum_.hasMoreElements();) { - int[] oldentry = (int[])(enum_.nextElement()); + for (java.util.Enumeration enum_ = jj_expentries.elements(); enum_ + .hasMoreElements();) { + int[] oldentry = (enum_.nextElement()); if (oldentry.length == jj_expentry.length) { exists = true; for (int i = 0; i < jj_expentry.length; i++) { @@ -2654,11 +3800,17 @@ public class ExpressionParser implements ExpressionParserConstants { break; } } - if (exists) break; - } - } - if (!exists) jj_expentries.addElement(jj_expentry); - if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + if (exists) { + break; + } + } + } + if (!exists) { + jj_expentries.addElement(jj_expentry); + } + if (pos != 0) { + jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } } } @@ -2702,7 +3854,7 @@ public class ExpressionParser implements ExpressionParserConstants { jj_add_error_token(0, 0); int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { - exptokseq[i] = (int[])jj_expentries.elementAt(i); + exptokseq[i] = jj_expentries.elementAt(i); } return new ParseException(token, exptokseq, tokenImage); } @@ -2719,17 +3871,36 @@ public class ExpressionParser implements ExpressionParserConstants { JJExpressionParserCalls p = jj_2_rtns[i]; do { if (p.gen > jj_gen) { - jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; + jj_la = p.arg; + jj_lastpos = jj_scanpos = p.first; switch (i) { - case 0: jj_3_1(); break; - case 1: jj_3_2(); break; - case 2: jj_3_3(); break; - case 3: jj_3_4(); break; - case 4: jj_3_5(); break; - case 5: jj_3_6(); break; - case 6: jj_3_7(); break; - case 7: jj_3_8(); break; - case 8: jj_3_9(); break; + case 0: + jj_3_1(); + break; + case 1: + jj_3_2(); + break; + case 2: + jj_3_3(); + break; + case 3: + jj_3_4(); + break; + case 4: + jj_3_5(); + break; + case 5: + jj_3_6(); + break; + case 6: + jj_3_7(); + break; + case 7: + jj_3_8(); + break; + case 8: + jj_3_9(); + break; } } p = p.next; @@ -2741,10 +3912,15 @@ public class ExpressionParser implements ExpressionParserConstants { final private void jj_save(int index, int xla) { JJExpressionParserCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { - if (p.next == null) { p = p.next = new JJExpressionParserCalls(); break; } + if (p.next == null) { + p = p.next = new JJExpressionParserCalls(); + break; + } p = p.next; } - p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; + p.gen = jj_gen + xla - jj_la; + p.first = token; + p.arg = xla; } } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParserTokenManager.java b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParserTokenManager.java index 28472858050..9787d5de554 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParserTokenManager.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParserTokenManager.java @@ -25,10 +25,6 @@ /* Generated By:JavaCC: Do not edit this line. ExpressionParserTokenManager.java */ package com.sun.tools.example.debug.expr; -import com.sun.jdi.*; -import java.util.Stack; -import java.util.List; -import java.util.ArrayList; public class ExpressionParserTokenManager implements ExpressionParserConstants { @@ -37,15 +33,17 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) switch (pos) { case 0: - if ((active1 & 0x4000L) != 0L) + if ((active1 & 0x4000L) != 0L) { return 4; + } if ((active0 & 0x7fffffffffffe00L) != 0L) { jjmatchedKind = 67; return 28; } - if ((active1 & 0x100200000000L) != 0L) + if ((active1 & 0x100200000000L) != 0L) { return 49; + } return -1; case 1: if ((active0 & 0x7ffffffbfcffe00L) != 0L) @@ -57,8 +55,9 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) } return 28; } - if ((active0 & 0x40300000L) != 0L) + if ((active0 & 0x40300000L) != 0L) { return 28; + } return -1; case 2: if ((active0 & 0x77fffb3afeffe00L) != 0L) @@ -70,8 +69,9 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) } return 28; } - if ((active0 & 0x80004c10000000L) != 0L) + if ((active0 & 0x80004c10000000L) != 0L) { return 28; + } return -1; case 3: if ((active0 & 0x63bff2b8faf4e00L) != 0L) @@ -80,8 +80,9 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) jjmatchedPos = 3; return 28; } - if ((active0 & 0x14400902040b000L) != 0L) + if ((active0 & 0x14400902040b000L) != 0L) { return 28; + } return -1; case 4: if ((active0 & 0x2235f2b80ac0600L) != 0L) @@ -93,8 +94,9 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) } return 28; } - if ((active0 & 0x418a0000f034800L) != 0L) + if ((active0 & 0x418a0000f034800L) != 0L) { return 28; + } return -1; case 5: if ((active0 & 0x222070a848c0600L) != 0L) @@ -103,8 +105,9 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) jjmatchedPos = 5; return 28; } - if ((active0 & 0x11582100200000L) != 0L) + if ((active0 & 0x11582100200000L) != 0L) { return 28; + } return -1; case 6: if ((active0 & 0x222040a80040200L) != 0L) @@ -113,8 +116,9 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) jjmatchedPos = 6; return 28; } - if ((active0 & 0x30004880400L) != 0L) + if ((active0 & 0x30004880400L) != 0L) { return 28; + } return -1; case 7: if ((active0 & 0x22040a80000000L) != 0L) @@ -123,8 +127,9 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) jjmatchedPos = 7; return 28; } - if ((active0 & 0x200000000040200L) != 0L) + if ((active0 & 0x200000000040200L) != 0L) { return 28; + } return -1; case 8: if ((active0 & 0x2000280000000L) != 0L) @@ -133,8 +138,9 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) jjmatchedPos = 8; return 28; } - if ((active0 & 0x20040800000000L) != 0L) + if ((active0 & 0x20040800000000L) != 0L) { return 28; + } return -1; case 9: if ((active0 & 0x2000000000000L) != 0L) @@ -143,8 +149,9 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) jjmatchedPos = 9; return 28; } - if ((active0 & 0x280000000L) != 0L) + if ((active0 & 0x280000000L) != 0L) { return 28; + } return -1; case 10: if ((active0 & 0x2000000000000L) != 0L) @@ -286,16 +293,19 @@ private final int jjMoveStringLiteralDfa1_0(long active0, long active1) switch(curChar) { case 38: - if ((active1 & 0x8000000L) != 0L) + if ((active1 & 0x8000000L) != 0L) { return jjStopAtPos(1, 91); + } break; case 43: - if ((active1 & 0x10000000L) != 0L) + if ((active1 & 0x10000000L) != 0L) { return jjStopAtPos(1, 92); + } break; case 45: - if ((active1 & 0x20000000L) != 0L) + if ((active1 & 0x20000000L) != 0L) { return jjStopAtPos(1, 93); + } break; case 60: if ((active1 & 0x4000000000L) != 0L) @@ -305,30 +315,31 @@ private final int jjMoveStringLiteralDfa1_0(long active0, long active1) } return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2000000000000L); case 61: - if ((active1 & 0x400000L) != 0L) + if ((active1 & 0x400000L) != 0L) { return jjStopAtPos(1, 86); - else if ((active1 & 0x800000L) != 0L) + } else if ((active1 & 0x800000L) != 0L) { return jjStopAtPos(1, 87); - else if ((active1 & 0x1000000L) != 0L) + } else if ((active1 & 0x1000000L) != 0L) { return jjStopAtPos(1, 88); - else if ((active1 & 0x2000000L) != 0L) + } else if ((active1 & 0x2000000L) != 0L) { return jjStopAtPos(1, 89); - else if ((active1 & 0x20000000000L) != 0L) + } else if ((active1 & 0x20000000000L) != 0L) { return jjStopAtPos(1, 105); - else if ((active1 & 0x40000000000L) != 0L) + } else if ((active1 & 0x40000000000L) != 0L) { return jjStopAtPos(1, 106); - else if ((active1 & 0x80000000000L) != 0L) + } else if ((active1 & 0x80000000000L) != 0L) { return jjStopAtPos(1, 107); - else if ((active1 & 0x100000000000L) != 0L) + } else if ((active1 & 0x100000000000L) != 0L) { return jjStopAtPos(1, 108); - else if ((active1 & 0x200000000000L) != 0L) + } else if ((active1 & 0x200000000000L) != 0L) { return jjStopAtPos(1, 109); - else if ((active1 & 0x400000000000L) != 0L) + } else if ((active1 & 0x400000000000L) != 0L) { return jjStopAtPos(1, 110); - else if ((active1 & 0x800000000000L) != 0L) + } else if ((active1 & 0x800000000000L) != 0L) { return jjStopAtPos(1, 111); - else if ((active1 & 0x1000000000000L) != 0L) + } else if ((active1 & 0x1000000000000L) != 0L) { return jjStopAtPos(1, 112); + } break; case 62: if ((active1 & 0x8000000000L) != 0L) @@ -344,8 +355,9 @@ private final int jjMoveStringLiteralDfa1_0(long active0, long active1) case 101: return jjMoveStringLiteralDfa2_0(active0, 0x104000080000L, active1, 0L); case 102: - if ((active0 & 0x40000000L) != 0L) + if ((active0 & 0x40000000L) != 0L) { return jjStartNfaWithStates_0(1, 30, 28); + } break; case 104: return jjMoveStringLiteralDfa2_0(active0, 0x41c200000008000L, active1, 0L); @@ -377,8 +389,9 @@ private final int jjMoveStringLiteralDfa1_0(long active0, long active1) case 121: return jjMoveStringLiteralDfa2_0(active0, 0x2000000001000L, active1, 0L); case 124: - if ((active1 & 0x4000000L) != 0L) + if ((active1 & 0x4000000L) != 0L) { return jjStopAtPos(1, 90); + } break; default : break; @@ -387,8 +400,9 @@ private final int jjMoveStringLiteralDfa1_0(long active0, long active1) } private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) { - if (((active0 &= old0) | (active1 &= old1)) == 0L) + if (((active0 &= old0) | (active1 &= old1)) == 0L) { return jjStartNfa_0(0, old0, old1); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0, active1); @@ -397,10 +411,11 @@ private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, switch(curChar) { case 61: - if ((active1 & 0x2000000000000L) != 0L) + if ((active1 & 0x2000000000000L) != 0L) { return jjStopAtPos(2, 113); - else if ((active1 & 0x4000000000000L) != 0L) + } else if ((active1 & 0x4000000000000L) != 0L) { return jjStopAtPos(2, 114); + } break; case 62: if ((active1 & 0x10000000000L) != 0L) @@ -430,8 +445,9 @@ private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, case 112: return jjMoveStringLiteralDfa3_0(active0, 0x800180000000L, active1, 0L); case 114: - if ((active0 & 0x10000000L) != 0L) + if ((active0 & 0x10000000L) != 0L) { return jjStartNfaWithStates_0(2, 28, 28); + } return jjMoveStringLiteralDfa3_0(active0, 0x18000000000000L, active1, 0L); case 115: return jjMoveStringLiteralDfa3_0(active0, 0x200402200L, active1, 0L); @@ -445,12 +461,14 @@ private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, case 117: return jjMoveStringLiteralDfa3_0(active0, 0x40000000200000L, active1, 0L); case 119: - if ((active0 & 0x4000000000L) != 0L) + if ((active0 & 0x4000000000L) != 0L) { return jjStartNfaWithStates_0(2, 38, 28); + } break; case 121: - if ((active0 & 0x80000000000000L) != 0L) + if ((active0 & 0x80000000000000L) != 0L) { return jjStartNfaWithStates_0(2, 55, 28); + } break; default : break; @@ -459,8 +477,9 @@ private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, } private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) { - if (((active0 &= old0) | (active1 &= old1)) == 0L) + if (((active0 &= old0) | (active1 &= old1)) == 0L) { return jjStartNfa_0(1, old0, old1); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0, active1); @@ -469,8 +488,9 @@ private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, switch(curChar) { case 61: - if ((active1 & 0x8000000000000L) != 0L) + if ((active1 & 0x8000000000000L) != 0L) { return jjStopAtPos(3, 115); + } break; case 97: return jjMoveStringLiteralDfa4_0(active0, 0x20000000e080800L, active1, 0L); @@ -479,44 +499,51 @@ private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, case 99: return jjMoveStringLiteralDfa4_0(active0, 0x2000000004000L, active1, 0L); case 100: - if ((active0 & 0x100000000000000L) != 0L) + if ((active0 & 0x100000000000000L) != 0L) { return jjStartNfaWithStates_0(3, 56, 28); + } break; case 101: - if ((active0 & 0x1000L) != 0L) + if ((active0 & 0x1000L) != 0L) { return jjStartNfaWithStates_0(3, 12, 28); - else if ((active0 & 0x2000L) != 0L) + } else if ((active0 & 0x2000L) != 0L) { return jjStartNfaWithStates_0(3, 13, 28); - else if ((active0 & 0x400000L) != 0L) + } else if ((active0 & 0x400000L) != 0L) { return jjStartNfaWithStates_0(3, 22, 28); - else if ((active0 & 0x40000000000000L) != 0L) + } else if ((active0 & 0x40000000000000L) != 0L) { return jjStartNfaWithStates_0(3, 54, 28); + } return jjMoveStringLiteralDfa4_0(active0, 0x800800800000L, active1, 0L); case 103: - if ((active0 & 0x1000000000L) != 0L) + if ((active0 & 0x1000000000L) != 0L) { return jjStartNfaWithStates_0(3, 36, 28); + } break; case 105: return jjMoveStringLiteralDfa4_0(active0, 0x2000000000L, active1, 0L); case 107: return jjMoveStringLiteralDfa4_0(active0, 0x10000000000L, active1, 0L); case 108: - if ((active0 & 0x8000000000L) != 0L) + if ((active0 & 0x8000000000L) != 0L) { return jjStartNfaWithStates_0(3, 39, 28); + } return jjMoveStringLiteralDfa4_0(active0, 0x400080080000400L, active1, 0L); case 110: return jjMoveStringLiteralDfa4_0(active0, 0x20000000000000L, active1, 0L); case 111: - if ((active0 & 0x20000000L) != 0L) + if ((active0 & 0x20000000L) != 0L) { return jjStartNfaWithStates_0(3, 29, 28); + } return jjMoveStringLiteralDfa4_0(active0, 0x18000100000000L, active1, 0L); case 114: - if ((active0 & 0x8000L) != 0L) + if ((active0 & 0x8000L) != 0L) { return jjStartNfaWithStates_0(3, 15, 28); + } return jjMoveStringLiteralDfa4_0(active0, 0x200000000000L, active1, 0L); case 115: - if ((active0 & 0x4000000000000L) != 0L) + if ((active0 & 0x4000000000000L) != 0L) { return jjStartNfaWithStates_0(3, 50, 28); + } return jjMoveStringLiteralDfa4_0(active0, 0x1030000L, active1, 0L); case 116: return jjMoveStringLiteralDfa4_0(active0, 0x1440200040200L, active1, 0L); @@ -531,8 +558,9 @@ private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, } private final int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1) { - if (((active0 &= old0) | (active1 &= old1)) == 0L) + if (((active0 &= old0) | (active1 &= old1)) == 0L) { return jjStartNfa_0(2, old0, old1); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0, 0L); @@ -545,20 +573,23 @@ private final int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, case 99: return jjMoveStringLiteralDfa5_0(active0, 0x1000000000000L); case 101: - if ((active0 & 0x1000000L) != 0L) + if ((active0 & 0x1000000L) != 0L) { return jjStartNfaWithStates_0(4, 24, 28); - else if ((active0 & 0x400000000000000L) != 0L) + } else if ((active0 & 0x400000000000000L) != 0L) { return jjStartNfaWithStates_0(4, 58, 28); + } return jjMoveStringLiteralDfa5_0(active0, 0x40080000400L); case 104: - if ((active0 & 0x4000L) != 0L) + if ((active0 & 0x4000L) != 0L) { return jjStartNfaWithStates_0(4, 14, 28); + } return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000L); case 105: return jjMoveStringLiteralDfa5_0(active0, 0x480000040000L); case 107: - if ((active0 & 0x800L) != 0L) + if ((active0 & 0x800L) != 0L) { return jjStartNfaWithStates_0(4, 11, 28); + } break; case 108: if ((active0 & 0x2000000L) != 0L) @@ -570,20 +601,23 @@ private final int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, case 110: return jjMoveStringLiteralDfa5_0(active0, 0x800000L); case 114: - if ((active0 & 0x800000000000L) != 0L) + if ((active0 & 0x800000000000L) != 0L) { return jjStartNfaWithStates_0(4, 47, 28); + } return jjMoveStringLiteralDfa5_0(active0, 0x100900000200L); case 115: - if ((active0 & 0x10000L) != 0L) + if ((active0 & 0x10000L) != 0L) { return jjStartNfaWithStates_0(4, 16, 28); + } return jjMoveStringLiteralDfa5_0(active0, 0x20000000000000L); case 116: - if ((active0 & 0x20000L) != 0L) + if ((active0 & 0x20000L) != 0L) { return jjStartNfaWithStates_0(4, 17, 28); - else if ((active0 & 0x8000000L) != 0L) + } else if ((active0 & 0x8000000L) != 0L) { return jjStartNfaWithStates_0(4, 27, 28); - else if ((active0 & 0x200000000000L) != 0L) + } else if ((active0 & 0x200000000000L) != 0L) { return jjStartNfaWithStates_0(4, 45, 28); + } return jjMoveStringLiteralDfa5_0(active0, 0x200000000000000L); case 117: return jjMoveStringLiteralDfa5_0(active0, 0x80000L); @@ -603,8 +637,9 @@ private final int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, } private final int jjMoveStringLiteralDfa5_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) + if (((active0 &= old0)) == 0L) { return jjStartNfa_0(3, old0, 0L); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0, 0L); @@ -615,26 +650,29 @@ private final int jjMoveStringLiteralDfa5_0(long old0, long active0) case 97: return jjMoveStringLiteralDfa6_0(active0, 0x600L); case 99: - if ((active0 & 0x80000000000L) != 0L) + if ((active0 & 0x80000000000L) != 0L) { return jjStartNfaWithStates_0(5, 43, 28); - else if ((active0 & 0x400000000000L) != 0L) + } else if ((active0 & 0x400000000000L) != 0L) { return jjStartNfaWithStates_0(5, 46, 28); + } return jjMoveStringLiteralDfa6_0(active0, 0x40000000000L); case 100: return jjMoveStringLiteralDfa6_0(active0, 0x800000L); case 101: - if ((active0 & 0x200000L) != 0L) + if ((active0 & 0x200000L) != 0L) { return jjStartNfaWithStates_0(5, 21, 28); - else if ((active0 & 0x2000000000L) != 0L) + } else if ((active0 & 0x2000000000L) != 0L) { return jjStartNfaWithStates_0(5, 37, 28); + } break; case 102: return jjMoveStringLiteralDfa6_0(active0, 0x800000000L); case 103: return jjMoveStringLiteralDfa6_0(active0, 0x10000000000L); case 104: - if ((active0 & 0x1000000000000L) != 0L) + if ((active0 & 0x1000000000000L) != 0L) { return jjStartNfaWithStates_0(5, 48, 28); + } break; case 105: return jjMoveStringLiteralDfa6_0(active0, 0x220000000000000L); @@ -643,18 +681,21 @@ private final int jjMoveStringLiteralDfa5_0(long old0, long active0) case 109: return jjMoveStringLiteralDfa6_0(active0, 0x80000000L); case 110: - if ((active0 & 0x100000000000L) != 0L) + if ((active0 & 0x100000000000L) != 0L) { return jjStartNfaWithStates_0(5, 44, 28); + } return jjMoveStringLiteralDfa6_0(active0, 0x200040000L); case 114: return jjMoveStringLiteralDfa6_0(active0, 0x2000000000000L); case 115: - if ((active0 & 0x10000000000000L) != 0L) + if ((active0 & 0x10000000000000L) != 0L) { return jjStartNfaWithStates_0(5, 52, 28); + } break; case 116: - if ((active0 & 0x100000000L) != 0L) + if ((active0 & 0x100000000L) != 0L) { return jjStartNfaWithStates_0(5, 32, 28); + } return jjMoveStringLiteralDfa6_0(active0, 0x20000000000L); default : break; @@ -663,8 +704,9 @@ private final int jjMoveStringLiteralDfa5_0(long old0, long active0) } private final int jjMoveStringLiteralDfa6_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) + if (((active0 &= old0)) == 0L) { return jjStartNfa_0(4, old0, 0L); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0, 0L); @@ -677,32 +719,37 @@ private final int jjMoveStringLiteralDfa6_0(long old0, long active0) case 99: return jjMoveStringLiteralDfa7_0(active0, 0x200000200L); case 101: - if ((active0 & 0x10000000000L) != 0L) + if ((active0 & 0x10000000000L) != 0L) { return jjStartNfaWithStates_0(6, 40, 28); - else if ((active0 & 0x20000000000L) != 0L) + } else if ((active0 & 0x20000000000L) != 0L) { return jjStartNfaWithStates_0(6, 41, 28); + } return jjMoveStringLiteralDfa7_0(active0, 0x20000080000000L); case 108: return jjMoveStringLiteralDfa7_0(active0, 0x200000000000000L); case 110: - if ((active0 & 0x400L) != 0L) + if ((active0 & 0x400L) != 0L) { return jjStartNfaWithStates_0(6, 10, 28); + } break; case 111: return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000L); case 115: - if ((active0 & 0x800000L) != 0L) + if ((active0 & 0x800000L) != 0L) { return jjStartNfaWithStates_0(6, 23, 28); + } break; case 116: - if ((active0 & 0x80000L) != 0L) + if ((active0 & 0x80000L) != 0L) { return jjStartNfaWithStates_0(6, 19, 28); + } return jjMoveStringLiteralDfa7_0(active0, 0x40000000000L); case 117: return jjMoveStringLiteralDfa7_0(active0, 0x40000L); case 121: - if ((active0 & 0x4000000L) != 0L) + if ((active0 & 0x4000000L) != 0L) { return jjStartNfaWithStates_0(6, 26, 28); + } break; default : break; @@ -711,8 +758,9 @@ private final int jjMoveStringLiteralDfa6_0(long old0, long active0) } private final int jjMoveStringLiteralDfa7_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) + if (((active0 &= old0)) == 0L) { return jjStartNfa_0(5, old0, 0L); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0, 0L); @@ -723,16 +771,18 @@ private final int jjMoveStringLiteralDfa7_0(long old0, long active0) case 99: return jjMoveStringLiteralDfa8_0(active0, 0x800000000L); case 101: - if ((active0 & 0x40000L) != 0L) + if ((active0 & 0x40000L) != 0L) { return jjStartNfaWithStates_0(7, 18, 28); - else if ((active0 & 0x200000000000000L) != 0L) + } else if ((active0 & 0x200000000000000L) != 0L) { return jjStartNfaWithStates_0(7, 57, 28); + } return jjMoveStringLiteralDfa8_0(active0, 0x40200000000L); case 110: return jjMoveStringLiteralDfa8_0(active0, 0x22000080000000L); case 116: - if ((active0 & 0x200L) != 0L) + if ((active0 & 0x200L) != 0L) { return jjStartNfaWithStates_0(7, 9, 28); + } break; default : break; @@ -741,8 +791,9 @@ private final int jjMoveStringLiteralDfa7_0(long old0, long active0) } private final int jjMoveStringLiteralDfa8_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) + if (((active0 &= old0)) == 0L) { return jjStartNfa_0(6, old0, 0L); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(7, active0, 0L); @@ -751,20 +802,23 @@ private final int jjMoveStringLiteralDfa8_0(long old0, long active0) switch(curChar) { case 100: - if ((active0 & 0x40000000000L) != 0L) + if ((active0 & 0x40000000000L) != 0L) { return jjStartNfaWithStates_0(8, 42, 28); + } break; case 101: - if ((active0 & 0x800000000L) != 0L) + if ((active0 & 0x800000000L) != 0L) { return jjStartNfaWithStates_0(8, 35, 28); + } break; case 105: return jjMoveStringLiteralDfa9_0(active0, 0x2000000000000L); case 111: return jjMoveStringLiteralDfa9_0(active0, 0x200000000L); case 116: - if ((active0 & 0x20000000000000L) != 0L) + if ((active0 & 0x20000000000000L) != 0L) { return jjStartNfaWithStates_0(8, 53, 28); + } return jjMoveStringLiteralDfa9_0(active0, 0x80000000L); default : break; @@ -773,8 +827,9 @@ private final int jjMoveStringLiteralDfa8_0(long old0, long active0) } private final int jjMoveStringLiteralDfa9_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) + if (((active0 &= old0)) == 0L) { return jjStartNfa_0(7, old0, 0L); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(8, active0, 0L); @@ -783,12 +838,14 @@ private final int jjMoveStringLiteralDfa9_0(long old0, long active0) switch(curChar) { case 102: - if ((active0 & 0x200000000L) != 0L) + if ((active0 & 0x200000000L) != 0L) { return jjStartNfaWithStates_0(9, 33, 28); + } break; case 115: - if ((active0 & 0x80000000L) != 0L) + if ((active0 & 0x80000000L) != 0L) { return jjStartNfaWithStates_0(9, 31, 28); + } break; case 122: return jjMoveStringLiteralDfa10_0(active0, 0x2000000000000L); @@ -799,8 +856,9 @@ private final int jjMoveStringLiteralDfa9_0(long old0, long active0) } private final int jjMoveStringLiteralDfa10_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) + if (((active0 &= old0)) == 0L) { return jjStartNfa_0(8, old0, 0L); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(9, active0, 0L); @@ -817,8 +875,9 @@ private final int jjMoveStringLiteralDfa10_0(long old0, long active0) } private final int jjMoveStringLiteralDfa11_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) + if (((active0 &= old0)) == 0L) { return jjStartNfa_0(9, old0, 0L); + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(10, active0, 0L); @@ -827,8 +886,9 @@ private final int jjMoveStringLiteralDfa11_0(long old0, long active0) switch(curChar) { case 100: - if ((active0 & 0x2000000000000L) != 0L) + if ((active0 & 0x2000000000000L) != 0L) { return jjStartNfaWithStates_0(11, 49, 28); + } break; default : break; @@ -891,320 +951,395 @@ static final long[] jjbitVec8 = { }; private final int jjMoveNfa_0(int startState, int curPos) { - int[] nextStates; int startsAt = 0; jjnewStateCnt = 67; int i = 1; jjstateSet[0] = startState; - int j, kind = 0x7fffffff; + int kind = 0x7fffffff; for (;;) { - if (++jjround == 0x7fffffff) + if (++jjround == 0x7fffffff) { ReInitRounds(); + } if (curChar < 64) { long l = 1L << curChar; - MatchLoop: do + //MatchLoop + do { switch(jjstateSet[--i]) { case 0: - if ((0x3ff000000000000L & l) != 0L) + if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddStates(0, 6); - else if (curChar == 47) + } else if (curChar == 47) { jjAddStates(7, 9); - else if (curChar == 36) + } else if (curChar == 36) { - if (kind > 67) + if (kind > 67) { kind = 67; + } jjCheckNAdd(28); } - else if (curChar == 34) + else if (curChar == 34) { jjCheckNAddStates(10, 12); - else if (curChar == 39) + } else if (curChar == 39) { jjAddStates(13, 14); - else if (curChar == 46) + } else if (curChar == 46) { jjCheckNAdd(4); + } if ((0x3fe000000000000L & l) != 0L) { - if (kind > 59) + if (kind > 59) { kind = 59; + } jjCheckNAddTwoStates(1, 2); } else if (curChar == 48) { - if (kind > 59) + if (kind > 59) { kind = 59; + } jjCheckNAddStates(15, 17); } break; case 49: - if (curChar == 42) + if (curChar == 42) { jjCheckNAddTwoStates(62, 63); - else if (curChar == 47) + } else if (curChar == 47) { jjCheckNAddStates(18, 20); - if (curChar == 42) + } + if (curChar == 42) { jjstateSet[jjnewStateCnt++] = 54; + } break; case 1: - if ((0x3ff000000000000L & l) == 0L) + if ((0x3ff000000000000L & l) == 0L) { break; - if (kind > 59) + } + if (kind > 59) { kind = 59; + } jjCheckNAddTwoStates(1, 2); break; case 3: - if (curChar == 46) + if (curChar == 46) { jjCheckNAdd(4); + } break; case 4: - if ((0x3ff000000000000L & l) == 0L) + if ((0x3ff000000000000L & l) == 0L) { break; - if (kind > 63) + } + if (kind > 63) { kind = 63; + } jjCheckNAddStates(21, 23); break; case 6: - if ((0x280000000000L & l) != 0L) + if ((0x280000000000L & l) != 0L) { jjCheckNAdd(7); + } break; case 7: - if ((0x3ff000000000000L & l) == 0L) + if ((0x3ff000000000000L & l) == 0L) { break; - if (kind > 63) + } + if (kind > 63) { kind = 63; + } jjCheckNAddTwoStates(7, 8); break; case 9: - if (curChar == 39) + if (curChar == 39) { jjAddStates(13, 14); + } break; case 10: - if ((0xffffff7fffffdbffL & l) != 0L) + if ((0xffffff7fffffdbffL & l) != 0L) { jjCheckNAdd(11); + } break; case 11: - if (curChar == 39 && kind > 65) + if (curChar == 39 && kind > 65) { kind = 65; + } break; case 13: - if ((0x8400000000L & l) != 0L) + if ((0x8400000000L & l) != 0L) { jjCheckNAdd(11); + } break; case 14: - if ((0xff000000000000L & l) != 0L) + if ((0xff000000000000L & l) != 0L) { jjCheckNAddTwoStates(15, 11); + } break; case 15: - if ((0xff000000000000L & l) != 0L) + if ((0xff000000000000L & l) != 0L) { jjCheckNAdd(11); + } break; case 16: - if ((0xf000000000000L & l) != 0L) + if ((0xf000000000000L & l) != 0L) { jjstateSet[jjnewStateCnt++] = 17; + } break; case 17: - if ((0xff000000000000L & l) != 0L) + if ((0xff000000000000L & l) != 0L) { jjCheckNAdd(15); + } break; case 18: - if (curChar == 34) + if (curChar == 34) { jjCheckNAddStates(10, 12); + } break; case 19: - if ((0xfffffffbffffdbffL & l) != 0L) + if ((0xfffffffbffffdbffL & l) != 0L) { jjCheckNAddStates(10, 12); + } break; case 21: - if ((0x8400000000L & l) != 0L) + if ((0x8400000000L & l) != 0L) { jjCheckNAddStates(10, 12); + } break; case 22: - if (curChar == 34 && kind > 66) + if (curChar == 34 && kind > 66) { kind = 66; + } break; case 23: - if ((0xff000000000000L & l) != 0L) + if ((0xff000000000000L & l) != 0L) { jjCheckNAddStates(24, 27); + } break; case 24: - if ((0xff000000000000L & l) != 0L) + if ((0xff000000000000L & l) != 0L) { jjCheckNAddStates(10, 12); + } break; case 25: - if ((0xf000000000000L & l) != 0L) + if ((0xf000000000000L & l) != 0L) { jjstateSet[jjnewStateCnt++] = 26; + } break; case 26: - if ((0xff000000000000L & l) != 0L) + if ((0xff000000000000L & l) != 0L) { jjCheckNAdd(24); + } break; case 27: - if (curChar != 36) + if (curChar != 36) { break; - if (kind > 67) + } + if (kind > 67) { kind = 67; + } jjCheckNAdd(28); break; case 28: - if ((0x3ff001000000000L & l) == 0L) + if ((0x3ff001000000000L & l) == 0L) { break; - if (kind > 67) + } + if (kind > 67) { kind = 67; + } jjCheckNAdd(28); break; case 29: - if ((0x3ff000000000000L & l) != 0L) + if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddStates(0, 6); + } break; case 30: - if ((0x3ff000000000000L & l) != 0L) + if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddTwoStates(30, 31); + } break; case 31: - if (curChar != 46) + if (curChar != 46) { break; - if (kind > 63) + } + if (kind > 63) { kind = 63; + } jjCheckNAddStates(28, 30); break; case 32: - if ((0x3ff000000000000L & l) == 0L) + if ((0x3ff000000000000L & l) == 0L) { break; - if (kind > 63) + } + if (kind > 63) { kind = 63; + } jjCheckNAddStates(28, 30); break; case 34: - if ((0x280000000000L & l) != 0L) + if ((0x280000000000L & l) != 0L) { jjCheckNAdd(35); + } break; case 35: - if ((0x3ff000000000000L & l) == 0L) + if ((0x3ff000000000000L & l) == 0L) { break; - if (kind > 63) + } + if (kind > 63) { kind = 63; + } jjCheckNAddTwoStates(35, 8); break; case 36: - if ((0x3ff000000000000L & l) != 0L) + if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddTwoStates(36, 37); + } break; case 38: - if ((0x280000000000L & l) != 0L) + if ((0x280000000000L & l) != 0L) { jjCheckNAdd(39); + } break; case 39: - if ((0x3ff000000000000L & l) == 0L) + if ((0x3ff000000000000L & l) == 0L) { break; - if (kind > 63) + } + if (kind > 63) { kind = 63; + } jjCheckNAddTwoStates(39, 8); break; case 40: - if ((0x3ff000000000000L & l) != 0L) + if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddStates(31, 33); + } break; case 42: - if ((0x280000000000L & l) != 0L) + if ((0x280000000000L & l) != 0L) { jjCheckNAdd(43); + } break; case 43: - if ((0x3ff000000000000L & l) != 0L) + if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddTwoStates(43, 8); + } break; case 44: - if (curChar != 48) + if (curChar != 48) { break; - if (kind > 59) + } + if (kind > 59) { kind = 59; + } jjCheckNAddStates(15, 17); break; case 46: - if ((0x3ff000000000000L & l) == 0L) + if ((0x3ff000000000000L & l) == 0L) { break; - if (kind > 59) + } + if (kind > 59) { kind = 59; + } jjCheckNAddTwoStates(46, 2); break; case 47: - if ((0xff000000000000L & l) == 0L) + if ((0xff000000000000L & l) == 0L) { break; - if (kind > 59) + } + if (kind > 59) { kind = 59; + } jjCheckNAddTwoStates(47, 2); break; case 48: - if (curChar == 47) + if (curChar == 47) { jjAddStates(7, 9); + } break; case 50: - if ((0xffffffffffffdbffL & l) != 0L) + if ((0xffffffffffffdbffL & l) != 0L) { jjCheckNAddStates(18, 20); + } break; case 51: - if ((0x2400L & l) != 0L && kind > 6) + if ((0x2400L & l) != 0L && kind > 6) { kind = 6; + } break; case 52: - if (curChar == 10 && kind > 6) + if (curChar == 10 && kind > 6) { kind = 6; + } break; case 53: - if (curChar == 13) + if (curChar == 13) { jjstateSet[jjnewStateCnt++] = 52; + } break; case 54: - if (curChar == 42) + if (curChar == 42) { jjCheckNAddTwoStates(55, 56); + } break; case 55: - if ((0xfffffbffffffffffL & l) != 0L) + if ((0xfffffbffffffffffL & l) != 0L) { jjCheckNAddTwoStates(55, 56); + } break; case 56: - if (curChar == 42) + if (curChar == 42) { jjCheckNAddStates(34, 36); + } break; case 57: - if ((0xffff7bffffffffffL & l) != 0L) + if ((0xffff7bffffffffffL & l) != 0L) { jjCheckNAddTwoStates(58, 56); + } break; case 58: - if ((0xfffffbffffffffffL & l) != 0L) + if ((0xfffffbffffffffffL & l) != 0L) { jjCheckNAddTwoStates(58, 56); + } break; case 59: - if (curChar == 47 && kind > 7) + if (curChar == 47 && kind > 7) { kind = 7; + } break; case 60: - if (curChar == 42) + if (curChar == 42) { jjstateSet[jjnewStateCnt++] = 54; + } break; case 61: - if (curChar == 42) + if (curChar == 42) { jjCheckNAddTwoStates(62, 63); + } break; case 62: - if ((0xfffffbffffffffffL & l) != 0L) + if ((0xfffffbffffffffffL & l) != 0L) { jjCheckNAddTwoStates(62, 63); + } break; case 63: - if (curChar == 42) + if (curChar == 42) { jjCheckNAddStates(37, 39); + } break; case 64: - if ((0xffff7bffffffffffL & l) != 0L) + if ((0xffff7bffffffffffL & l) != 0L) { jjCheckNAddTwoStates(65, 63); + } break; case 65: - if ((0xfffffbffffffffffL & l) != 0L) + if ((0xfffffbffffffffffL & l) != 0L) { jjCheckNAddTwoStates(65, 63); + } break; case 66: - if (curChar == 47 && kind > 8) + if (curChar == 47 && kind > 8) { kind = 8; + } break; default : break; } @@ -1213,75 +1348,93 @@ private final int jjMoveNfa_0(int startState, int curPos) else if (curChar < 128) { long l = 1L << (curChar & 077); - MatchLoop: do + //MatchLoop + do { switch(jjstateSet[--i]) { case 0: case 28: - if ((0x7fffffe87fffffeL & l) == 0L) + if ((0x7fffffe87fffffeL & l) == 0L) { break; - if (kind > 67) + } + if (kind > 67) { kind = 67; + } jjCheckNAdd(28); break; case 2: - if ((0x100000001000L & l) != 0L && kind > 59) + if ((0x100000001000L & l) != 0L && kind > 59) { kind = 59; + } break; case 5: - if ((0x2000000020L & l) != 0L) + if ((0x2000000020L & l) != 0L) { jjAddStates(40, 41); + } break; case 8: - if ((0x5000000050L & l) != 0L && kind > 63) + if ((0x5000000050L & l) != 0L && kind > 63) { kind = 63; + } break; case 10: - if ((0xffffffffefffffffL & l) != 0L) + if ((0xffffffffefffffffL & l) != 0L) { jjCheckNAdd(11); + } break; case 12: - if (curChar == 92) + if (curChar == 92) { jjAddStates(42, 44); + } break; case 13: - if ((0x14404410000000L & l) != 0L) + if ((0x14404410000000L & l) != 0L) { jjCheckNAdd(11); + } break; case 19: - if ((0xffffffffefffffffL & l) != 0L) + if ((0xffffffffefffffffL & l) != 0L) { jjCheckNAddStates(10, 12); + } break; case 20: - if (curChar == 92) + if (curChar == 92) { jjAddStates(45, 47); + } break; case 21: - if ((0x14404410000000L & l) != 0L) + if ((0x14404410000000L & l) != 0L) { jjCheckNAddStates(10, 12); + } break; case 33: - if ((0x2000000020L & l) != 0L) + if ((0x2000000020L & l) != 0L) { jjAddStates(48, 49); + } break; case 37: - if ((0x2000000020L & l) != 0L) + if ((0x2000000020L & l) != 0L) { jjAddStates(50, 51); + } break; case 41: - if ((0x2000000020L & l) != 0L) + if ((0x2000000020L & l) != 0L) { jjAddStates(52, 53); + } break; case 45: - if ((0x100000001000000L & l) != 0L) + if ((0x100000001000000L & l) != 0L) { jjCheckNAdd(46); + } break; case 46: - if ((0x7e0000007eL & l) == 0L) + if ((0x7e0000007eL & l) == 0L) { break; - if (kind > 59) + } + if (kind > 59) { kind = 59; + } jjCheckNAddTwoStates(46, 2); break; case 50: @@ -1312,47 +1465,57 @@ private final int jjMoveNfa_0(int startState, int curPos) long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); - MatchLoop: do + //MatchLoop + do { switch(jjstateSet[--i]) { case 0: case 28: - if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) { break; - if (kind > 67) + } + if (kind > 67) { kind = 67; + } jjCheckNAdd(28); break; case 10: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { jjstateSet[jjnewStateCnt++] = 11; + } break; case 19: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { jjAddStates(10, 12); + } break; case 50: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { jjAddStates(18, 20); + } break; case 55: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { jjCheckNAddTwoStates(55, 56); + } break; case 57: case 58: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { jjCheckNAddTwoStates(58, 56); + } break; case 62: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { jjCheckNAddTwoStates(62, 63); + } break; case 64: case 65: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) { jjCheckNAddTwoStates(65, 63); + } break; default : break; } @@ -1365,8 +1528,9 @@ private final int jjMoveNfa_0(int startState, int curPos) kind = 0x7fffffff; } ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 67 - (jjnewStateCnt = startsAt))) + if ((i = jjnewStateCnt) == (startsAt = 67 - (jjnewStateCnt = startsAt))) { return curPos; + } try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } @@ -1384,8 +1548,9 @@ private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, lo case 0: return ((jjbitVec2[i2] & l2) != 0L); default : - if ((jjbitVec0[i1] & l1) != 0L) + if ((jjbitVec0[i1] & l1) != 0L) { return true; + } return false; } } @@ -1404,8 +1569,9 @@ private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, lo case 61: return ((jjbitVec8[i2] & l2) != 0L); default : - if ((jjbitVec3[i1] & l1) != 0L) + if ((jjbitVec3[i1] & l1) != 0L) { return true; + } return false; } } @@ -1449,8 +1615,9 @@ private final int[] jjstateSet = new int[134]; protected char curChar; public ExpressionParserTokenManager(ASCII_UCodeESC_CharStream stream) { - if (ASCII_UCodeESC_CharStream.staticFlag) + if (ASCII_UCodeESC_CharStream.staticFlag) { throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + } input_stream = stream; } public ExpressionParserTokenManager(ASCII_UCodeESC_CharStream stream, int lexState) @@ -1469,9 +1636,10 @@ private final void ReInitRounds() { int i; jjround = 0x80000001; - for (i = 67; i-- > 0;) + for (i = 67; i-- > 0;) { jjrounds[i] = 0x80000000; } +} public void ReInit(ASCII_UCodeESC_CharStream stream, int lexState) { ReInit(stream); @@ -1479,11 +1647,12 @@ public void ReInit(ASCII_UCodeESC_CharStream stream, int lexState) } public void SwitchTo(int lexState) { - if (lexState >= 1 || lexState < 0) + if (lexState >= 1 || lexState < 0) { throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else + } else { curLexState = lexState; } +} private final Token jjFillToken() { @@ -1507,7 +1676,6 @@ int jjmatchedKind; public final Token getNextToken() { - int kind; Token specialToken = null; Token matchedToken; int curPos = 0; @@ -1528,17 +1696,19 @@ public final Token getNextToken() } try { - while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L) + while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L) { curChar = input_stream.BeginToken(); } + } catch (java.io.IOException e1) { continue EOFLoop; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); if (jjmatchedKind != 0x7fffffff) { - if (jjmatchedPos + 1 < curPos) + if (jjmatchedPos + 1 < curPos) { input_stream.backup(curPos - jjmatchedPos - 1); + } if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); @@ -1550,9 +1720,9 @@ public final Token getNextToken() if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); - if (specialToken == null) + if (specialToken == null) { specialToken = matchedToken; - else + } else { matchedToken.specialToken = specialToken; specialToken = (specialToken.next = matchedToken); @@ -1572,9 +1742,9 @@ public final Token getNextToken() if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; - } - else + } else { error_column++; + } } if (!EOFSeen) { input_stream.backup(1); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/expr/LValue.java b/jdk/src/share/classes/com/sun/tools/example/debug/expr/LValue.java index 5dd8cf43d10..42ef2963e0b 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/LValue.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/LValue.java @@ -156,6 +156,7 @@ abstract class LValue { return new LValueArrayElement(interiorGetValue(), index); } + @Override public String toString() { try { return interiorGetValue().toString(); @@ -419,6 +420,7 @@ abstract class LValue { this.var = var; } + @Override Value getValue() { if (jdiValue == null) { jdiValue = frame.getValue(var); @@ -426,12 +428,14 @@ abstract class LValue { return jdiValue; } + @Override void setValue0(Value val) throws InvalidTypeException, ClassNotLoadedException { frame.setValue(var, val); jdiValue = val; } + @Override void invokeWith(List arguments) throws ParseException { throw new ParseException(var.name() + " is not a method"); } @@ -469,6 +473,7 @@ abstract class LValue { } } + @Override Value getValue() throws InvocationException, InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, ParseException { @@ -485,6 +490,7 @@ abstract class LValue { } } + @Override void setValue0(Value val) throws ParseException, InvalidTypeException, ClassNotLoadedException { @@ -495,6 +501,7 @@ abstract class LValue { jdiValue = val; } + @Override void invokeWith(List arguments) throws ParseException { if (matchingMethod != null) { throw new ParseException("Invalid consecutive invocations"); @@ -531,6 +538,7 @@ abstract class LValue { } } + @Override Value getValue() throws InvocationException, InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, ParseException { @@ -548,6 +556,7 @@ abstract class LValue { } } + @Override void setValue0(Value val) throws ParseException, InvalidTypeException, ClassNotLoadedException { @@ -562,6 +571,7 @@ abstract class LValue { jdiValue = val; } + @Override void invokeWith(List arguments) throws ParseException { if (matchingMethod != null) { throw new ParseException("Invalid consecutive invocations"); @@ -589,6 +599,7 @@ abstract class LValue { this.arrayRef = value; } + @Override Value getValue() { if (jdiValue == null) { jdiValue = arrayRef.virtualMachine().mirrorOf(arrayRef.length()); @@ -596,10 +607,12 @@ abstract class LValue { return jdiValue; } + @Override void setValue0(Value value) throws ParseException { throw new ParseException("Cannot set constant: " + value); } + @Override void invokeWith(List arguments) throws ParseException { throw new ParseException("Array element is not a method"); } @@ -618,6 +631,7 @@ abstract class LValue { this.index = index; } + @Override Value getValue() { if (jdiValue == null) { jdiValue = array.getValue(index); @@ -625,12 +639,14 @@ abstract class LValue { return jdiValue; } + @Override void setValue0(Value val) throws InvalidTypeException, ClassNotLoadedException { array.setValue(index, val); jdiValue = val; } + @Override void invokeWith(List arguments) throws ParseException { throw new ParseException("Array element is not a method"); } @@ -643,6 +659,7 @@ abstract class LValue { this.value = value; } + @Override Value getValue() { if (jdiValue == null) { jdiValue = value; @@ -650,10 +667,12 @@ abstract class LValue { return jdiValue; } + @Override void setValue0(Value val) throws ParseException { throw new ParseException("Cannot set constant: " + value); } + @Override void invokeWith(List arguments) throws ParseException { throw new ParseException("Constant is not a method"); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java index bf615935604..8ee53728f02 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java @@ -37,6 +37,8 @@ package com.sun.tools.example.debug.expr; */ public class ParseException extends Exception { + private static final long serialVersionUID = 7978489144303647901L; + /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates @@ -119,20 +121,21 @@ public class ParseException extends Exception { * of the final stack trace, and hence the correct error message * gets displayed. */ + @Override public String getMessage() { if (!specialConstructor) { return super.getMessage(); } String expected = ""; int maxSize = 0; - for (int i = 0; i < expectedTokenSequences.length; i++) { - if (maxSize < expectedTokenSequences[i].length) { - maxSize = expectedTokenSequences[i].length; + for (int[] expectedTokenSequence : expectedTokenSequences) { + if (maxSize < expectedTokenSequence.length) { + maxSize = expectedTokenSequence.length; } - for (int j = 0; j < expectedTokenSequences[i].length; j++) { - expected += tokenImage[expectedTokenSequences[i][j]] + " "; + for (int j = 0; j < expectedTokenSequence.length; j++) { + expected += tokenImage[expectedTokenSequence[j]] + " "; } - if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) { expected += "..."; } expected += eol + " "; @@ -140,7 +143,9 @@ public class ParseException extends Exception { String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { - if (i != 0) retval += " "; + if (i != 0) { + retval += " "; + } if (tok.kind == 0) { retval += tokenImage[0]; break; diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/expr/Token.java b/jdk/src/share/classes/com/sun/tools/example/debug/expr/Token.java index ea0a9ef33d7..534120014f3 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/Token.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/Token.java @@ -78,6 +78,7 @@ public class Token { /** * Returns the image. */ + @Override public final String toString() { return image; diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java b/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java index 2f4365018fe..16a40df286e 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java @@ -32,6 +32,8 @@ public class TokenMgrError extends Error * Ordinals for various reasons why an Error of this type can be thrown. */ + private static final long serialVersionUID = -6236440836177601522L; + /** * Lexical error occured. */ @@ -136,6 +138,7 @@ public class TokenMgrError extends Error * * from this method for such cases in the release version of your parser. */ + @Override public String getMessage() { return super.getMessage(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ApplicationTool.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ApplicationTool.java index 8eee7c76418..e9a4c0b7808 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ApplicationTool.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ApplicationTool.java @@ -29,12 +29,12 @@ import javax.swing.*; import java.awt.*; import java.awt.event.*; -import com.sun.jdi.*; import com.sun.tools.example.debug.bdi.*; public class ApplicationTool extends JPanel { - private Environment env; + private static final long serialVersionUID = 310966063293205714L; + private ExecutionManager runtime; private TypeScript script; @@ -45,13 +45,13 @@ public class ApplicationTool extends JPanel { super(new BorderLayout()); - this.env = env; this.runtime = env.getExecutionManager(); this.script = new TypeScript(PROMPT, false); // No implicit echo. this.add(script); script.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { runtime.sendLineToApplication(script.readln()); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ClassTreeTool.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ClassTreeTool.java index abfc86a810b..945243458bf 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ClassTreeTool.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ClassTreeTool.java @@ -25,12 +25,10 @@ package com.sun.tools.example.debug.gui; -import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.tree.*; -import javax.swing.event.*; import java.awt.*; import java.awt.event.*; @@ -40,6 +38,8 @@ import com.sun.tools.example.debug.bdi.*; public class ClassTreeTool extends JPanel { + private static final long serialVersionUID = 526178912591739259L; + private Environment env; private ExecutionManager runtime; @@ -49,7 +49,7 @@ public class ClassTreeTool extends JPanel { private JTree tree; private DefaultTreeModel treeModel; private ClassTreeNode root; - private SearchPath sourcePath; +// private SearchPath sourcePath; private CommandInterpreter interpreter; @@ -87,6 +87,7 @@ public class ClassTreeTool extends JPanel { ******/ MouseListener ml = new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { int selRow = tree.getRowForLocation(e.getX(), e.getY()); TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); @@ -121,6 +122,7 @@ public class ClassTreeTool extends JPanel { // SessionListener + @Override public void sessionStart(EventObject e) { // Get system classes and any others loaded before attaching. try { @@ -134,19 +136,24 @@ public class ClassTreeTool extends JPanel { } } + @Override public void sessionInterrupt(EventObject e) {} + @Override public void sessionContinue(EventObject e) {} // JDIListener + @Override public void classPrepare(ClassPrepareEventSet e) { root.addClass(e.getReferenceType()); } + @Override public void classUnload(ClassUnloadEventSet e) { root.removeClass(e.getClassName()); } + @Override public void vmDisconnect(VMDisconnectEventSet e) { // Clear contents of this view. root = createClassTree(HEADING); @@ -169,6 +176,7 @@ public class ClassTreeTool extends JPanel { this.refTy = refTy; } + @Override public String toString() { return name; } @@ -185,6 +193,7 @@ public class ClassTreeTool extends JPanel { return (refTy == null); } + @Override public boolean isLeaf() { return !isPackage(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandInterpreter.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandInterpreter.java index 1ff8163b683..97ab320bf8b 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandInterpreter.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandInterpreter.java @@ -29,8 +29,6 @@ import java.io.*; import java.util.*; import com.sun.jdi.*; -import com.sun.jdi.request.*; - import com.sun.tools.example.debug.bdi.*; public class CommandInterpreter { @@ -93,9 +91,9 @@ public class CommandInterpreter { try { ThreadReference[] threads = threads(); long threadID = Long.parseLong(id, 16); - for (int i = 0; i < threads.length; i++) { - if (threads[i].uniqueID() == threadID) { - thread = threads[i]; + for (ThreadReference thread2 : threads) { + if (thread2.uniqueID() == threadID) { + thread = thread2; break; } } @@ -239,16 +237,18 @@ public class CommandInterpreter { for (int i = 0 ; i < tlist.size() ; i++) { ThreadReference thr = tlist.get(i); int len = Utils.description(thr).length(); - if (len > maxId) + if (len > maxId) { maxId = len; + } String name = thr.name(); int iDot = name.lastIndexOf('.'); if (iDot >= 0 && name.length() > iDot) { name = name.substring(iDot + 1); } - if (name.length() > maxName) + if (name.length() > maxName) { maxName = name.length(); } + } String maxNumString = String.valueOf(iThread + tlist.size()); int maxNumDigits = maxNumString.length(); for (int i = 0 ; i < tlist.size() ; i++) { @@ -616,7 +616,6 @@ public class CommandInterpreter { int cnt = 1; if (t.hasMoreTokens()) { String idToken = t.nextToken(); - int n; try { cnt = Integer.valueOf(idToken).intValue(); } catch (NumberFormatException e) { @@ -885,7 +884,6 @@ public class CommandInterpreter { } private void commandStop(StringTokenizer t) throws NoSessionException { - Location bploc; String token; if (!t.hasMoreTokens()) { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandTool.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandTool.java index 1f47adfcf97..42157e4423e 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandTool.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandTool.java @@ -40,6 +40,8 @@ import com.sun.tools.example.debug.event.*; public class CommandTool extends JPanel { + private static final long serialVersionUID = 8613516856378346415L; + private Environment env; private ContextManager context; @@ -68,6 +70,7 @@ public class CommandTool extends JPanel { // Establish handler for incoming commands. script.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { interpreter.executeCommand(script.readln()); } @@ -107,15 +110,17 @@ public class CommandTool extends JPanel { // JDIListener + @Override public void accessWatchpoint(AccessWatchpointEventSet e) { setThread(e); for (EventIterator it = e.eventIterator(); it.hasNext(); ) { - Event evt = it.nextEvent(); + it.nextEvent(); diagnostics.putString("Watchpoint hit: " + locationString(e)); } } + @Override public void classPrepare(ClassPrepareEventSet e) { if (context.getVerboseFlag()) { String name = e.getReferenceType().name(); @@ -123,6 +128,7 @@ public class CommandTool extends JPanel { } } + @Override public void classUnload(ClassUnloadEventSet e) { if (context.getVerboseFlag()) { diagnostics.putString("Class " + e.getClassName() + @@ -130,12 +136,14 @@ public class CommandTool extends JPanel { } } + @Override public void exception(ExceptionEventSet e) { setThread(e); String name = e.getException().referenceType().name(); diagnostics.putString("Exception: " + name); } + @Override public void locationTrigger(LocationTriggerEventSet e) { String locString = locationString(e); setThread(e); @@ -155,15 +163,17 @@ public class CommandTool extends JPanel { } } + @Override public void modificationWatchpoint(ModificationWatchpointEventSet e) { setThread(e); for (EventIterator it = e.eventIterator(); it.hasNext(); ) { - Event evt = it.nextEvent(); + it.nextEvent(); diagnostics.putString("Watchpoint hit: " + locationString(e)); } } + @Override public void threadDeath(ThreadDeathEventSet e) { if (context.getVerboseFlag()) { diagnostics.putString("Thread " + e.getThread() + @@ -171,6 +181,7 @@ public class CommandTool extends JPanel { } } + @Override public void threadStart(ThreadStartEventSet e) { if (context.getVerboseFlag()) { diagnostics.putString("Thread " + e.getThread() + @@ -178,16 +189,19 @@ public class CommandTool extends JPanel { } } + @Override public void vmDeath(VMDeathEventSet e) { script.setPrompt(DEFAULT_CMD_PROMPT); diagnostics.putString("VM exited"); } + @Override public void vmDisconnect(VMDisconnectEventSet e) { script.setPrompt(DEFAULT_CMD_PROMPT); diagnostics.putString("Disconnected from VM"); } + @Override public void vmStart(VMStartEventSet e) { script.setPrompt(DEFAULT_CMD_PROMPT); diagnostics.putString("VM started"); @@ -195,14 +209,17 @@ public class CommandTool extends JPanel { // SessionListener + @Override public void sessionStart(EventObject e) {} + @Override public void sessionInterrupt(EventObject e) { Thread.yield(); // fetch output diagnostics.putString("VM interrupted by user."); script.setPrompt(DEFAULT_CMD_PROMPT); } + @Override public void sessionContinue(EventObject e) { diagnostics.putString("Execution resumed."); script.setPrompt(DEFAULT_CMD_PROMPT); @@ -210,23 +227,28 @@ public class CommandTool extends JPanel { // SpecListener + @Override public void breakpointSet(SpecEvent e) { EventRequestSpec spec = e.getEventRequestSpec(); diagnostics.putString("Breakpoint set at " + spec + "."); } + @Override public void breakpointDeferred(SpecEvent e) { EventRequestSpec spec = e.getEventRequestSpec(); diagnostics.putString("Breakpoint will be set at " + spec + " when its class is loaded."); } + @Override public void breakpointDeleted(SpecEvent e) { EventRequestSpec spec = e.getEventRequestSpec(); diagnostics.putString("Breakpoint at " + spec.toString() + " deleted."); } + @Override public void breakpointResolved(SpecEvent e) { EventRequestSpec spec = e.getEventRequestSpec(); diagnostics.putString("Breakpoint resolved to " + spec.toString() + "."); } + @Override public void breakpointError(SpecErrorEvent e) { EventRequestSpec spec = e.getEventRequestSpec(); diagnostics.putString("Deferred breakpoint at " + @@ -236,25 +258,35 @@ public class CommandTool extends JPanel { //### Add info for watchpoints and exceptions + @Override public void watchpointSet(SpecEvent e) { } + @Override public void watchpointDeferred(SpecEvent e) { } + @Override public void watchpointDeleted(SpecEvent e) { } + @Override public void watchpointResolved(SpecEvent e) { } + @Override public void watchpointError(SpecErrorEvent e) { } + @Override public void exceptionInterceptSet(SpecEvent e) { } + @Override public void exceptionInterceptDeferred(SpecEvent e) { } + @Override public void exceptionInterceptDeleted(SpecEvent e) { } + @Override public void exceptionInterceptResolved(SpecEvent e) { } + @Override public void exceptionInterceptError(SpecErrorEvent e) { } @@ -263,6 +295,7 @@ public class CommandTool extends JPanel { // If the user selects a new current thread or frame, update prompt. + @Override public void currentFrameChanged(CurrentFrameChangedEvent e) { // Update prompt only if affect thread is current. ThreadReference thread = e.getThread(); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java index 3765cd76969..2ce04907ab2 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java @@ -46,7 +46,7 @@ public class ContextManager { private boolean verbose; - private Vector contextListeners = new Vector(); + private ArrayList contextListeners = new ArrayList(); public ContextManager(Environment env) { classManager = env.getClassManager(); @@ -264,11 +264,11 @@ public class ContextManager { private void notifyCurrentFrameChanged(ThreadInfo tinfo, int index, boolean invalidate) { - Vector l = (Vector)contextListeners.clone(); + ArrayList l = new ArrayList(contextListeners); CurrentFrameChangedEvent evt = new CurrentFrameChangedEvent(this, tinfo, index, invalidate); for (int i = 0; i < l.size(); i++) { - ((ContextListener)l.elementAt(i)).currentFrameChanged(evt); + l.get(i).currentFrameChanged(evt); } } @@ -277,28 +277,34 @@ public class ContextManager { // SessionListener + @Override public void sessionStart(EventObject e) { invalidateCurrentThread(); } + @Override public void sessionInterrupt(EventObject e) { setCurrentThreadInvalidate(currentThread); } + @Override public void sessionContinue(EventObject e) { invalidateCurrentThread(); } // JDIListener + @Override public void locationTrigger(LocationTriggerEventSet e) { setCurrentThreadInvalidate(e.getThread()); } + @Override public void exception(ExceptionEventSet e) { setCurrentThreadInvalidate(e.getThread()); } + @Override public void vmDisconnect(VMDisconnectEventSet e) { invalidateCurrentThread(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/CurrentFrameChangedEvent.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/CurrentFrameChangedEvent.java index 5470d0b8e73..00c827fd3c9 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/CurrentFrameChangedEvent.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/CurrentFrameChangedEvent.java @@ -31,6 +31,7 @@ import java.util.EventObject; public class CurrentFrameChangedEvent extends EventObject { + private static final long serialVersionUID = 4214479486546762179L; private ThreadInfo tinfo; private int index; private boolean invalidate; diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/Environment.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/Environment.java index d82c4999721..f9884c7d53d 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/Environment.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/Environment.java @@ -26,8 +26,6 @@ package com.sun.tools.example.debug.gui; import java.io.*; -import java.util.*; - import com.sun.jdi.*; import com.sun.tools.example.debug.bdi.*; diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/GUI.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/GUI.java index 5744c5b9d0b..1fa88bb28a9 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/GUI.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/GUI.java @@ -26,8 +26,6 @@ package com.sun.tools.example.debug.gui; import java.io.*; -import java.util.*; - import javax.swing.*; import javax.swing.border.*; import java.awt.*; @@ -38,6 +36,7 @@ import com.sun.tools.example.debug.bdi.*; public class GUI extends JPanel { + private static final long serialVersionUID = 3292463234530679091L; private CommandTool cmdTool; private ApplicationTool appTool; //###HACK## @@ -87,7 +86,7 @@ public class GUI extends JPanel { threadTreeTool = new ThreadTreeTool(env); threadTreeTool.setPreferredSize(new java.awt.Dimension(200, 450)); - JTabbedPane treePane = new JTabbedPane(JTabbedPane.BOTTOM); + JTabbedPane treePane = new JTabbedPane(SwingConstants.BOTTOM); treePane.addTab("Source", null, sourceTreeTool); treePane.addTab("Classes", null, classTreeTool); treePane.addTab("Threads", null, threadTreeTool); @@ -139,12 +138,9 @@ public class GUI extends JPanel { } public static void main(String argv[]) { - String remote = null; String clsName = ""; String progArgs = ""; String javaArgs = ""; - boolean verbose = false; //### Not implemented. - final Environment env = new Environment(); JPanel mainPanel = new GUI(env); @@ -246,13 +242,14 @@ public class GUI extends JPanel { frame.setContentPane(mainPanel); frame.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent e) { env.terminate(); } }); frame.pack(); - frame.show(); + frame.setVisible(true); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBFileFilter.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBFileFilter.java index 577f8d8b1f9..3a6f107bbbc 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBFileFilter.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBFileFilter.java @@ -28,7 +28,6 @@ package com.sun.tools.example.debug.gui; import java.io.File; import java.util.Hashtable; import java.util.Enumeration; -import javax.swing.*; import javax.swing.filechooser.*; //### Renamed from 'ExampleFileFilter.java' provided with Swing demos. @@ -93,8 +92,12 @@ public class JDBFileFilter extends FileFilter { */ public JDBFileFilter(String extension, String description) { this(); - if(extension!=null) addExtension(extension); - if(description!=null) setDescription(description); + if(extension!=null) { + addExtension(extension); + } + if(description!=null) { + setDescription(description); + } } /** @@ -120,11 +123,13 @@ public class JDBFileFilter extends FileFilter { */ public JDBFileFilter(String[] filters, String description) { this(); - for (int i = 0; i < filters.length; i++) { + for (String filter : filters) { // add filters one by one - addExtension(filters[i]); + addExtension(filter); } - if(description!=null) setDescription(description); + if(description!=null) { + setDescription(description); + } } /** @@ -136,6 +141,7 @@ public class JDBFileFilter extends FileFilter { * @see #getExtension * @see FileFilter#accepts */ + @Override public boolean accept(File f) { if(f != null) { if(f.isDirectory()) { @@ -196,6 +202,7 @@ public class JDBFileFilter extends FileFilter { * @see isExtensionListInDescription * @see FileFilter#getDescription */ + @Override public String getDescription() { if(fullDescription == null) { if(description == null || isExtensionListInDescription()) { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBMenuBar.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBMenuBar.java index ee8378386b8..c224b57c4f8 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBMenuBar.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBMenuBar.java @@ -31,7 +31,6 @@ import java.awt.event.*; import java.util.Vector; import java.util.List; -import com.sun.jdi.*; import com.sun.tools.example.debug.bdi.*; //### This is currently just a placeholder! @@ -57,6 +56,7 @@ class JDBMenuBar extends JMenuBar { JMenuItem openItem = new JMenuItem("Open...", 'O'); openItem.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { openCommand(); } @@ -93,6 +93,7 @@ class JDBMenuBar extends JMenuBar { JMenuItem monitorItem = new JMenuItem("Monitor Expression...", 'M'); monitorItem.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { monitorCommand(); } @@ -101,6 +102,7 @@ class JDBMenuBar extends JMenuBar { JMenuItem unmonitorItem = new JMenuItem("Unmonitor Expression..."); unmonitorItem.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { unmonitorCommand(); } @@ -110,6 +112,7 @@ class JDBMenuBar extends JMenuBar { JMenu breakpointMenu = new JMenu("Breakpoint"); JMenuItem stopItem = new JMenuItem("Stop in...", 'S'); stopItem.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { buildBreakpoint(); } @@ -176,6 +179,7 @@ class JDBMenuBar extends JMenuBar { mi.setToolTipText(toolTip); final String cmd = command; mi.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { interpreter.executeCommand(cmd); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBToolBar.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBToolBar.java index f73a12d081d..02982b9f70b 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBToolBar.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBToolBar.java @@ -26,10 +26,8 @@ package com.sun.tools.example.debug.gui; import javax.swing.*; -import java.awt.*; import java.awt.event.*; -import com.sun.jdi.*; import com.sun.tools.example.debug.bdi.*; class JDBToolBar extends JToolBar { @@ -92,6 +90,7 @@ class JDBToolBar extends JToolBar { button.setToolTipText(toolTip); final String cmd = command; button.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { interpreter.executeCommand(cmd); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/LaunchTool.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/LaunchTool.java index f6456a44960..cb1d77b22fe 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/LaunchTool.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/LaunchTool.java @@ -29,18 +29,10 @@ import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; -import java.util.Iterator; - -import java.io.IOException; - import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - import javax.swing.*; import javax.swing.border.Border; import javax.swing.border.TitledBorder; @@ -98,6 +90,7 @@ class LaunchTool { comp.add(panel); } + @Override String getText() { return textField.getText(); } @@ -114,6 +107,7 @@ class LaunchTool { comp.add(panel); } + @Override String getText() { return ((Connector.BooleanArgument)arg) .stringValueOf(check.getModel().isSelected()); @@ -147,6 +141,7 @@ class LaunchTool { final boolean[] oked = {false}; JPanel buttonPanel = okCancel( dialog, new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { if (radioGroup.getSelection() == null) { JOptionPane.showMessageDialog(dialog, @@ -162,7 +157,7 @@ class LaunchTool { } ); content.add(BorderLayout.SOUTH, buttonPanel); dialog.pack(); - dialog.show(); + dialog.setVisible(true); return oked[0] ? modelToConnector.get(radioGroup.getSelection()) : @@ -178,7 +173,7 @@ class LaunchTool { Container content = dialog.getContentPane(); JPanel guts = new JPanel(); Border etched = BorderFactory.createEtchedBorder(); - Border titled = BorderFactory.createTitledBorder(etched, + BorderFactory.createTitledBorder(etched, connector.description(), TitledBorder.LEFT, TitledBorder.TOP); guts.setBorder(etched); @@ -199,6 +194,7 @@ class LaunchTool { content.add(guts); JPanel buttonPanel = okCancel( dialog, new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { for (ArgRep ar : argReps) { if (!ar.isSpecified()) { @@ -236,7 +232,7 @@ class LaunchTool { } ); content.add(BorderLayout.SOUTH, buttonPanel); dialog.pack(); - dialog.show(); + dialog.setVisible(true); } private JPanel okCancel(final JDialog dialog, ActionListener okListener) { @@ -247,6 +243,7 @@ class LaunchTool { buttonPanel.add(cancel); ok.addActionListener(okListener); cancel.addActionListener( new ActionListener() { + @Override public void actionPerformed(ActionEvent event) { dialog.setVisible(false); dialog.dispose(); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/MonitorListModel.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/MonitorListModel.java index 91c87a4d74c..c46219f4720 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/MonitorListModel.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/MonitorListModel.java @@ -42,10 +42,12 @@ public class MonitorListModel extends AbstractListModel { //### remove listeners on exit! } + @Override public Object getElementAt(int index) { return monitors.get(index); } + @Override public int getSize() { return monitors.size(); } @@ -70,7 +72,7 @@ public class MonitorListModel extends AbstractListModel { return Collections.unmodifiableList(monitors); } - public Iterator iterator() { + public Iterator iterator() { return monitors().iterator(); } @@ -80,7 +82,8 @@ public class MonitorListModel extends AbstractListModel { private class MonitorListListener implements ContextListener { - public void currentFrameChanged(CurrentFrameChangedEvent e) { + @Override + public void currentFrameChanged(final CurrentFrameChangedEvent e) { invalidate(); } } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/MonitorTool.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/MonitorTool.java index 21d0fc19bbd..cf7c10c51c2 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/MonitorTool.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/MonitorTool.java @@ -25,15 +25,9 @@ package com.sun.tools.example.debug.gui; -import java.io.*; -import java.util.*; - import javax.swing.*; -import javax.swing.tree.*; import javax.swing.event.*; import java.awt.*; -import java.awt.event.*; - import com.sun.jdi.*; import com.sun.tools.example.debug.bdi.*; import com.sun.tools.example.debug.expr.ExpressionParser; @@ -41,6 +35,7 @@ import com.sun.tools.example.debug.expr.ParseException; public class MonitorTool extends JPanel { + private static final long serialVersionUID = -645235951031726647L; private ExecutionManager runtime; private ContextManager context; @@ -64,6 +59,7 @@ public class MonitorTool extends JPanel { } private class MonitorToolListener implements ListSelectionListener { + @Override public void valueChanged(ListSelectionEvent e) { int index = list.getSelectedIndex(); if (index != -1) { @@ -78,6 +74,7 @@ public class MonitorTool extends JPanel { IncompatibleThreadStateException { ExpressionParser.GetFrame frameGetter = new ExpressionParser.GetFrame() { + @Override public StackFrame get() throws IncompatibleThreadStateException { @@ -93,6 +90,7 @@ public class MonitorTool extends JPanel { private class MonitorRenderer extends DefaultListCellRenderer { + @Override public Component getListCellRendererComponent(JList list, Object value, int index, diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SearchPath.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SearchPath.java index e02b8400276..30905696660 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SearchPath.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SearchPath.java @@ -58,8 +58,8 @@ public class SearchPath { } public File resolve(String relativeFileName) { - for (int i = 0; i < pathArray.length; i++) { - File path = new File(pathArray[i], relativeFileName); + for (String element : pathArray) { + File path = new File(element, relativeFileName); if (path.exists()) { return path; } @@ -76,8 +76,8 @@ public class SearchPath { // classpath is retained. This is the one that will be // found if we later do a 'resolve'. SortedSet s = new TreeSet(); // sorted, no duplicates - for (int i = 0; i < pathArray.length; i++) { - File path = new File(pathArray[i], relativeDirName); + for (String element : pathArray) { + File path = new File(element, relativeDirName); if (path.exists()) { String[] childArray = path.list(filter); if (childArray != null) { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SingleLeafTreeSelectionModel.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SingleLeafTreeSelectionModel.java index 2d1b2aa07a8..47df28d1168 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SingleLeafTreeSelectionModel.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SingleLeafTreeSelectionModel.java @@ -25,22 +25,25 @@ package com.sun.tools.example.debug.gui; -import javax.swing.*; import javax.swing.tree.*; public class SingleLeafTreeSelectionModel extends DefaultTreeSelectionModel { + private static final long serialVersionUID = -7849105107888117679L; + SingleLeafTreeSelectionModel() { super(); selectionMode = SINGLE_TREE_SELECTION; } + @Override public void setSelectionPath(TreePath path) { if(((TreeNode)(path.getLastPathComponent())).isLeaf()) { super.setSelectionPath(path); } } + @Override public void setSelectionPaths(TreePath[] paths) { // Only look at first path, as all others will be // ignored anyway in single tree selection mode. @@ -49,12 +52,14 @@ public class SingleLeafTreeSelectionModel extends DefaultTreeSelectionModel { } } + @Override public void addSelectionPath(TreePath path) { if(((TreeNode)(path.getLastPathComponent())).isLeaf()) { super.setSelectionPath(path); } } + @Override public void addSelectionPaths(TreePath[] paths) { // Only look at first path, as all others will be // ignored anyway in single tree selection mode. diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceManager.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceManager.java index 6e8ae7a292e..eda83460e83 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceManager.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceManager.java @@ -31,7 +31,6 @@ import java.util.*; import com.sun.jdi.*; import com.sun.tools.example.debug.event.*; -import com.sun.tools.example.debug.bdi.*; /** * Manage the list of source files. @@ -45,7 +44,7 @@ public class SourceManager { private List sourceList; private SearchPath sourcePath; - private Vector sourceListeners = new Vector(); + private ArrayList sourceListeners = new ArrayList(); private Map classToSource = new HashMap(); @@ -79,18 +78,18 @@ public class SourceManager { } public void addSourceListener(SourceListener l) { - sourceListeners.addElement(l); + sourceListeners.add(l); } public void removeSourceListener(SourceListener l) { - sourceListeners.removeElement(l); + sourceListeners.remove(l); } private void notifySourcepathChanged() { - Vector l = (Vector)sourceListeners.clone(); + ArrayList l = new ArrayList(sourceListeners); SourcepathChangedEvent evt = new SourcepathChangedEvent(this); for (int i = 0; i < l.size(); i++) { - ((SourceListener)l.elementAt(i)).sourcepathChanged(evt); + l.get(i).sourcepathChanged(evt); } } @@ -163,6 +162,7 @@ public class SourceManager { private class SMClassListener extends JDIAdapter implements JDIListener { + @Override public void classPrepare(ClassPrepareEventSet e) { ReferenceType refType = e.getReferenceType(); SourceModel sm = sourceForClass(refType); @@ -171,6 +171,7 @@ public class SourceManager { } } + @Override public void classUnload(ClassUnloadEventSet e) { //### iterate through looking for (e.getTypeName()). //### then remove it. diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceModel.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceModel.java index 4ad47069589..b65be0b5a2d 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceModel.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceModel.java @@ -31,8 +31,6 @@ import java.util.*; import com.sun.jdi.*; import com.sun.jdi.request.*; -import com.sun.tools.example.debug.bdi.*; - import javax.swing.*; /** @@ -101,6 +99,7 @@ public class SourceModel extends AbstractListModel { // **** Implement ListModel ***** + @Override public Object getElementAt(int index) { if (sourceLines == null) { initialize(); @@ -108,6 +107,7 @@ public class SourceModel extends AbstractListModel { return sourceLines.get(index); } + @Override public int getSize() { if (sourceLines == null) { initialize(); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceTool.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceTool.java index 0f0c24d83e5..cecbeaf2479 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceTool.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceTool.java @@ -26,8 +26,6 @@ package com.sun.tools.example.debug.gui; import java.io.*; -import java.util.*; - import java.awt.*; import java.awt.event.*; import javax.swing.*; @@ -35,13 +33,12 @@ import javax.swing.*; import com.sun.jdi.*; import com.sun.jdi.request.*; -import com.sun.tools.example.debug.event.*; import com.sun.tools.example.debug.bdi.*; -import java.util.List; - public class SourceTool extends JPanel { + private static final long serialVersionUID = -5461299294186395257L; + private Environment env; private ExecutionManager runtime; @@ -99,6 +96,7 @@ public class SourceTool extends JPanel { // ContextListener + @Override public void currentFrameChanged(CurrentFrameChangedEvent e) { showSourceContext(e.getThread(), e.getIndex()); } @@ -108,6 +106,7 @@ public class SourceTool extends JPanel { // SourceListener + @Override public void sourcepathChanged(SourcepathChangedEvent e) { // Reload source view if its contents depend // on the source path. @@ -120,12 +119,15 @@ public class SourceTool extends JPanel { // SpecListener + @Override public void breakpointSet(SpecEvent e) { breakpointResolved(e); } + @Override public void breakpointDeferred(SpecEvent e) { } + @Override public void breakpointDeleted(SpecEvent e) { BreakpointRequest req = (BreakpointRequest)e.getEventRequest(); Location loc = req.location(); @@ -139,6 +141,7 @@ public class SourceTool extends JPanel { } } + @Override public void breakpointResolved(SpecEvent e) { BreakpointRequest req = (BreakpointRequest)e.getEventRequest(); Location loc = req.location(); @@ -150,29 +153,40 @@ public class SourceTool extends JPanel { } } + @Override public void breakpointError(SpecErrorEvent e) { breakpointDeleted(e); } + @Override public void watchpointSet(SpecEvent e) { } + @Override public void watchpointDeferred(SpecEvent e) { } + @Override public void watchpointDeleted(SpecEvent e) { } + @Override public void watchpointResolved(SpecEvent e) { } + @Override public void watchpointError(SpecErrorEvent e) { } + @Override public void exceptionInterceptSet(SpecEvent e) { } + @Override public void exceptionInterceptDeferred(SpecEvent e) { } + @Override public void exceptionInterceptDeleted(SpecEvent e) { } + @Override public void exceptionInterceptResolved(SpecEvent e) { } + @Override public void exceptionInterceptError(SpecErrorEvent e) { } } @@ -269,6 +283,7 @@ public class SourceTool extends JPanel { private class SourceLineRenderer extends DefaultListCellRenderer { + @Override public Component getListCellRendererComponent(JList list, Object value, int index, @@ -301,6 +316,7 @@ public class SourceTool extends JPanel { return this; } + @Override public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); return new Dimension(dim.width, dim.height-5); @@ -309,6 +325,7 @@ public class SourceTool extends JPanel { } private class STMouseListener extends MouseAdapter implements MouseListener { + @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { showPopupMenu((Component)e.getSource(), @@ -316,6 +333,7 @@ public class SourceTool extends JPanel { } } + @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { showPopupMenu((Component)e.getSource(), @@ -354,6 +372,7 @@ public class SourceTool extends JPanel { private JMenuItem commandItem(String label, final String cmd) { JMenuItem item = new JMenuItem(label); item.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { interpreter.executeCommand(cmd); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceTreeTool.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceTreeTool.java index e6837e29d5e..5f572c70896 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceTreeTool.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceTreeTool.java @@ -30,15 +30,15 @@ import java.util.*; import javax.swing.*; import javax.swing.tree.*; -import javax.swing.event.*; import java.awt.*; import java.awt.event.*; -import com.sun.jdi.*; import com.sun.tools.example.debug.bdi.*; public class SourceTreeTool extends JPanel { + private static final long serialVersionUID = 3336680912107956419L; + private Environment env; private ExecutionManager runtime; @@ -81,6 +81,7 @@ public class SourceTreeTool extends JPanel { ******/ MouseListener ml = new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { int selRow = tree.getRowForLocation(e.getX(), e.getY()); TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); @@ -112,6 +113,7 @@ public class SourceTreeTool extends JPanel { private class SourceTreeToolListener implements SourceListener { + @Override public void sourcepathChanged(SourcepathChangedEvent e) { sourcePath = sourceManager.getSourcePath(); root = createDirectoryTree(HEADING); @@ -121,6 +123,7 @@ public class SourceTreeTool extends JPanel { } private static class SourceOrDirectoryFilter implements FilenameFilter { + @Override public boolean accept(File dir, String name) { return (name.endsWith(".java") || new File(dir, name).isDirectory()); @@ -158,6 +161,7 @@ public class SourceTreeTool extends JPanel { this.isDirectory = isDirectory; } + @Override public String toString() { return name; } @@ -195,6 +199,7 @@ public class SourceTreeTool extends JPanel { * Returns the child TreeNode at index * childIndex. */ + @Override public TreeNode getChildAt(int childIndex) { expandIfNeeded(); return children[childIndex]; @@ -204,6 +209,7 @@ public class SourceTreeTool extends JPanel { * Returns the number of children TreeNodes the receiver * contains. */ + @Override public int getChildCount() { expandIfNeeded(); return children.length; @@ -212,6 +218,7 @@ public class SourceTreeTool extends JPanel { /** * Returns the parent TreeNode of the receiver. */ + @Override public TreeNode getParent() { return parent; } @@ -221,18 +228,21 @@ public class SourceTreeTool extends JPanel { * If the receiver does not contain node, -1 will be * returned. */ + @Override public int getIndex(TreeNode node) { expandIfNeeded(); for (int i = 0; i < children.length; i++) { - if (children[i] == node) + if (children[i] == node) { return i; } + } return -1; } /** * Returns true if the receiver allows children. */ + @Override public boolean getAllowsChildren() { return isDirectory; } @@ -240,6 +250,7 @@ public class SourceTreeTool extends JPanel { /** * Returns true if the receiver is a leaf. */ + @Override public boolean isLeaf() { expandIfNeeded(); return !isDirectory; @@ -248,13 +259,16 @@ public class SourceTreeTool extends JPanel { /** * Returns the children of the receiver as an Enumeration. */ + @Override public Enumeration children() { expandIfNeeded(); return new Enumeration() { int i = 0; + @Override public boolean hasMoreElements() { return (i < children.length); } + @Override public Object nextElement() throws NoSuchElementException { if (i >= children.length) { throw new NoSuchElementException(); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourcepathChangedEvent.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourcepathChangedEvent.java index 53b3f0382f2..975571b0dad 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourcepathChangedEvent.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourcepathChangedEvent.java @@ -29,6 +29,8 @@ import java.util.EventObject; public class SourcepathChangedEvent extends EventObject { + private static final long serialVersionUID = 8762169481005804121L; + public SourcepathChangedEvent(Object source) { super(source); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/StackTraceTool.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/StackTraceTool.java index 8d287557783..1e3b68eabc6 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/StackTraceTool.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/StackTraceTool.java @@ -25,21 +25,16 @@ package com.sun.tools.example.debug.gui; -import java.io.*; -import java.util.*; -import java.util.List; // Must import explicitly due to conflict with javax.awt.List - import javax.swing.*; -import javax.swing.tree.*; import javax.swing.event.*; import java.awt.*; -import java.awt.event.*; - import com.sun.jdi.*; import com.sun.tools.example.debug.bdi.*; public class StackTraceTool extends JPanel { + private static final long serialVersionUID = 9140041989427965718L; + private Environment env; private ExecutionManager runtime; @@ -85,6 +80,7 @@ public class StackTraceTool extends JPanel { //### I suspect we handle the case badly that the VM is not interrupted. + @Override public void currentFrameChanged(CurrentFrameChangedEvent e) { // If the current frame of the thread appearing in this // view is changed, move the selection to track it. @@ -103,6 +99,7 @@ public class StackTraceTool extends JPanel { // ListSelectionListener + @Override public void valueChanged(ListSelectionEvent e) { int index = list.getSelectedIndex(); if (index != -1) { @@ -117,6 +114,7 @@ public class StackTraceTool extends JPanel { private class StackFrameRenderer extends DefaultListCellRenderer { + @Override public Component getListCellRendererComponent(JList list, Object value, int index, @@ -174,6 +172,7 @@ public class StackTraceTool extends JPanel { this.tinfo = tinfo; } + @Override public Object getElementAt(int index) { try { return tinfo == null? null : tinfo.getFrame(index); @@ -186,6 +185,7 @@ public class StackTraceTool extends JPanel { } } + @Override public int getSize() { try { return tinfo == null? 1 : tinfo.getFrameCount(); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ThreadTreeTool.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ThreadTreeTool.java index 2aefdc309e6..02cf374f027 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ThreadTreeTool.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ThreadTreeTool.java @@ -25,13 +25,11 @@ package com.sun.tools.example.debug.gui; -import java.io.*; import java.util.*; import java.util.List; // Must import explicitly due to conflict with javax.awt.List import javax.swing.*; import javax.swing.tree.*; -import javax.swing.event.*; import java.awt.*; import java.awt.event.*; @@ -45,6 +43,8 @@ import com.sun.tools.example.debug.bdi.*; public class ThreadTreeTool extends JPanel { + private static final long serialVersionUID = 4168599992853038878L; + private Environment env; private ExecutionManager runtime; @@ -79,6 +79,7 @@ public class ThreadTreeTool extends JPanel { tree.setSelectionModel(new SingleLeafTreeSelectionModel()); MouseListener ml = new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { int selRow = tree.getRowForLocation(e.getX(), e.getY()); TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); @@ -131,6 +132,7 @@ public class ThreadTreeTool extends JPanel { // SessionListener + @Override public void sessionStart(EventObject e) { try { for (ThreadReference thread : runtime.allThreads()) { @@ -143,20 +145,25 @@ public class ThreadTreeTool extends JPanel { } } + @Override public void sessionInterrupt(EventObject e) {} + @Override public void sessionContinue(EventObject e) {} // JDIListener + @Override public void threadStart(ThreadStartEventSet e) { root.addThread(e.getThread()); } + @Override public void threadDeath(ThreadDeathEventSet e) { root.removeThread(e.getThread()); } + @Override public void vmDisconnect(VMDisconnectEventSet e) { // Clear the contents of this view. root = createThreadTree(HEADING); @@ -193,6 +200,7 @@ public class ThreadTreeTool extends JPanel { } } + @Override public String toString() { return description; } @@ -213,6 +221,7 @@ public class ThreadTreeTool extends JPanel { return (thread == null); } + @Override public boolean isLeaf() { return !isThreadGroup(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScript.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScript.java index 84c3262e25e..c99a4cd9e27 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScript.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScript.java @@ -28,10 +28,10 @@ package com.sun.tools.example.debug.gui; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.border.*; public class TypeScript extends JPanel { + private static final long serialVersionUID = -983704841363534885L; private JTextArea history; private JTextField entry; @@ -41,7 +41,6 @@ public class TypeScript extends JPanel { private JScrollBar historyHScrollBar; private boolean echoInput = false; - private boolean nlPending = false; private static String newline = System.getProperty("line.separator"); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScriptOutputListener.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScriptOutputListener.java index 6731023760d..bb3cda6921d 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScriptOutputListener.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScriptOutputListener.java @@ -25,7 +25,6 @@ package com.sun.tools.example.debug.gui; -import javax.swing.*; import com.sun.tools.example.debug.bdi.OutputListener; public class TypeScriptOutputListener implements OutputListener { @@ -42,10 +41,12 @@ public class TypeScriptOutputListener implements OutputListener { this.appendNewline = appendNewline; } + @Override public void putString(String s) { script.append(s); - if (appendNewline) + if (appendNewline) { script.newline(); } + } } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScriptWriter.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScriptWriter.java index 89ca4c32aac..64b5ec2b443 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScriptWriter.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/TypeScriptWriter.java @@ -35,14 +35,17 @@ public class TypeScriptWriter extends Writer { this.script = script; } + @Override public void write(char[] cbuf, int off, int len) throws IOException { script.append(String.valueOf(cbuf, off, len)); } + @Override public void flush() { script.flush(); } + @Override public void close() { script.flush(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/AccessWatchpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/AccessWatchpointSpec.java index 1eedd7af593..1b83363d171 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/AccessWatchpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/AccessWatchpointSpec.java @@ -38,6 +38,7 @@ class AccessWatchpointSpec extends WatchpointSpec { /** * The 'refType' is known to match, return the EventRequest. */ + @Override EventRequest resolveEventRequest(ReferenceType refType) throws NoSuchFieldException { Field field = refType.fieldByName(fieldId); @@ -48,6 +49,7 @@ class AccessWatchpointSpec extends WatchpointSpec { return wp; } + @Override public String toString() { return MessageOutput.format("watch accesses of", new Object [] {refSpec.toString(), diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/AmbiguousMethodException.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/AmbiguousMethodException.java index 9975fa54e61..eb210dd4588 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/AmbiguousMethodException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/AmbiguousMethodException.java @@ -27,6 +27,8 @@ package com.sun.tools.example.debug.tty; public class AmbiguousMethodException extends Exception { + private static final long serialVersionUID = -5372629264936918654L; + public AmbiguousMethodException() { super(); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java index 1105c9e6d37..ed6c2a10fc5 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java @@ -30,7 +30,6 @@ import com.sun.jdi.request.*; import java.util.ArrayList; import java.util.List; -import java.util.Iterator; class BreakpointSpec extends EventRequestSpec { String methodId; @@ -58,6 +57,7 @@ class BreakpointSpec extends EventRequestSpec { /** * The 'refType' is known to match, return the EventRequest. */ + @Override EventRequest resolveEventRequest(ReferenceType refType) throws AmbiguousMethodException, AbsentInformationException, @@ -91,12 +91,14 @@ class BreakpointSpec extends EventRequestSpec { return (methodId != null); } + @Override public int hashCode() { return refSpec.hashCode() + lineNumber + ((methodId != null) ? methodId.hashCode() : 0) + ((methodArgs != null) ? methodArgs.hashCode() : 0); } + @Override public boolean equals(Object obj) { if (obj instanceof BreakpointSpec) { BreakpointSpec breakpoint = (BreakpointSpec)obj; @@ -114,6 +116,7 @@ class BreakpointSpec extends EventRequestSpec { } } + @Override String errorMessageFor(Exception e) { if (e instanceof AmbiguousMethodException) { return (MessageOutput.format("Method is overloaded; specify arguments", @@ -140,6 +143,7 @@ class BreakpointSpec extends EventRequestSpec { } } + @Override public String toString() { StringBuffer buffer = new StringBuffer(refSpec.toString()); if (isMethodBreakpoint()) { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java index 48436c9cc96..14a88267fe6 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java @@ -51,6 +51,7 @@ class Commands { final ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo(); final int stackFrame = threadInfo == null? 0 : threadInfo.getCurrentFrameIndex(); Thread thread = new Thread("asynchronous jdb command") { + @Override public void run() { try { action(); @@ -95,6 +96,7 @@ class Commands { final ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo(); if ((threadInfo != null) && (threadInfo.getCurrentFrame() != null)) { frameGetter = new ExpressionParser.GetFrame() { + @Override public StackFrame get() throws IncompatibleThreadStateException { return threadInfo.getCurrentFrame(); } @@ -224,7 +226,6 @@ class Commands { } void commandClass(StringTokenizer t) { - List list = Env.vm().allClasses(); if (!t.hasMoreTokens()) { MessageOutput.println("No class specified."); @@ -709,6 +710,7 @@ class Commands { void doKillThread(final ThreadReference threadToKill, final StringTokenizer tokenizer) { new AsyncExecution() { + @Override void action() { doKill(threadToKill, tokenizer); } @@ -1118,7 +1120,6 @@ class Commands { } void commandStop(StringTokenizer t) { - Location bploc; String atIn; byte suspendPolicy = EventRequest.SUSPEND_ALL; @@ -1665,6 +1666,7 @@ class Commands { void commandPrint(final StringTokenizer t, final boolean dumpObject) { new AsyncExecution() { + @Override void action() { doPrint(t, dumpObject); } @@ -1734,6 +1736,7 @@ class Commands { void commandLock(final StringTokenizer t) { new AsyncExecution() { + @Override void action() { doLock(t); } @@ -1809,6 +1812,7 @@ class Commands { void commandDisableGC(final StringTokenizer t) { new AsyncExecution() { + @Override void action() { doDisableGC(t); } @@ -1837,6 +1841,7 @@ class Commands { void commandEnableGC(final StringTokenizer t) { new AsyncExecution() { + @Override void action() { doEnableGC(t); } @@ -1892,6 +1897,7 @@ class Commands { } } else { new AsyncExecution() { + @Override void action() { doSave(t); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Env.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Env.java index b664d094dd6..e39732692cc 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Env.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Env.java @@ -29,7 +29,6 @@ import com.sun.jdi.*; import com.sun.jdi.request.StepRequest; import com.sun.jdi.request.MethodEntryRequest; import com.sun.jdi.request.MethodExitRequest; -import com.sun.tools.jdi.*; import java.util.*; import java.io.*; diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventHandler.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventHandler.java index 0147666d9be..31e5035fe8e 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventHandler.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventHandler.java @@ -27,14 +27,8 @@ package com.sun.tools.example.debug.tty; import com.sun.jdi.*; import com.sun.jdi.event.*; -import com.sun.jdi.request.EventRequestManager; import com.sun.jdi.request.EventRequest; -import java.io.PrintStream; -import java.util.StringTokenizer; -import java.util.Collection; -import java.util.Iterator; - public class EventHandler implements Runnable { EventNotifier notifier; @@ -59,6 +53,7 @@ public class EventHandler implements Runnable { } } + @Override public void run() { EventQueue queue = Env.vm().eventQueue(); while (connected) { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventRequestSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventRequestSpec.java index 47ae8b4667a..5c0177b4548 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventRequestSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventRequestSpec.java @@ -30,9 +30,7 @@ import com.sun.jdi.request.EventRequest; import com.sun.jdi.request.ExceptionRequest; import com.sun.jdi.request.ClassPrepareRequest; import com.sun.jdi.event.ClassPrepareEvent; -import java.util.List; import java.util.ArrayList; -import java.util.Iterator; abstract class EventRequestSpec { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventRequestSpecList.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventRequestSpecList.java index 0816b74a0ce..58dc664f0ed 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventRequestSpecList.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/EventRequestSpecList.java @@ -25,15 +25,12 @@ package com.sun.tools.example.debug.tty; -import com.sun.jdi.*; import com.sun.jdi.request.EventRequest; import com.sun.jdi.event.ClassPrepareEvent; import java.util.ArrayList; import java.util.Collections; -import java.util.Iterator; import java.util.List; -import java.util.StringTokenizer; class EventRequestSpecList { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ExceptionSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ExceptionSpec.java index b0075061e3d..f1a3c272724 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ExceptionSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ExceptionSpec.java @@ -28,10 +28,6 @@ package com.sun.tools.example.debug.tty; import com.sun.jdi.ReferenceType; import com.sun.jdi.request.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Iterator; - class ExceptionSpec extends EventRequestSpec { private boolean notifyCaught; private boolean notifyUncaught; @@ -51,6 +47,7 @@ class ExceptionSpec extends EventRequestSpec { /** * The 'refType' is known to match, return the EventRequest. */ + @Override EventRequest resolveEventRequest(ReferenceType refType) { EventRequestManager em = refType.virtualMachine().eventRequestManager(); ExceptionRequest excReq = em.createExceptionRequest(refType, @@ -68,6 +65,7 @@ class ExceptionSpec extends EventRequestSpec { return notifyUncaught; } + @Override public int hashCode() { //Reference: Effective Java[tm] (Bloch, 2001), Item 8 int result = 17; @@ -77,6 +75,7 @@ class ExceptionSpec extends EventRequestSpec { return result; } + @Override public boolean equals(Object obj) { if (obj instanceof ExceptionSpec) { ExceptionSpec es = (ExceptionSpec)obj; @@ -90,6 +89,7 @@ class ExceptionSpec extends EventRequestSpec { return false; } + @Override public String toString() { String s; if (notifyCaught && !notifyUncaught) { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/LineNotFoundException.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/LineNotFoundException.java index 5fb6a0ea5fa..442b798aaae 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/LineNotFoundException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/LineNotFoundException.java @@ -27,6 +27,8 @@ package com.sun.tools.example.debug.tty; public class LineNotFoundException extends Exception { + private static final long serialVersionUID = 3748297722519448995L; + public LineNotFoundException() { super(); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/MalformedMemberNameException.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/MalformedMemberNameException.java index dacf7aca78a..3f2bf46c627 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/MalformedMemberNameException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/MalformedMemberNameException.java @@ -26,6 +26,8 @@ package com.sun.tools.example.debug.tty; class MalformedMemberNameException extends Exception { + private static final long serialVersionUID = 7759071468833196630L; + public MalformedMemberNameException() { super(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ModificationWatchpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ModificationWatchpointSpec.java index 05436c7a614..ee3a63e9694 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ModificationWatchpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ModificationWatchpointSpec.java @@ -38,6 +38,7 @@ class ModificationWatchpointSpec extends WatchpointSpec { /** * The 'refType' is known to match, return the EventRequest. */ + @Override EventRequest resolveEventRequest(ReferenceType refType) throws NoSuchFieldException { Field field = refType.fieldByName(fieldId); @@ -48,6 +49,7 @@ class ModificationWatchpointSpec extends WatchpointSpec { return wp; } + @Override public String toString() { return MessageOutput.format("watch modification of", new Object [] {refSpec.toString(), diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/PatternReferenceTypeSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/PatternReferenceTypeSpec.java index b6c01774df4..cc4473cefd8 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/PatternReferenceTypeSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/PatternReferenceTypeSpec.java @@ -55,6 +55,7 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec { /** * Does the specified ReferenceType match this spec. */ + @Override public boolean matches(ReferenceType refType) { if (classId.startsWith("*")) { return refType.name().endsWith(stem); @@ -65,6 +66,7 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec { } } + @Override public ClassPrepareRequest createPrepareRequest() { ClassPrepareRequest request = Env.vm().eventRequestManager().createClassPrepareRequest(); @@ -73,10 +75,12 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec { return request; } + @Override public int hashCode() { return classId.hashCode(); } + @Override public boolean equals(Object obj) { if (obj instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec spec = (PatternReferenceTypeSpec)obj; @@ -125,6 +129,7 @@ class PatternReferenceTypeSpec implements ReferenceTypeSpec { return true; } + @Override public String toString() { return classId; } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ReferenceTypeSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ReferenceTypeSpec.java index 6f085b93d1b..0e76be0cb4c 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ReferenceTypeSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ReferenceTypeSpec.java @@ -35,7 +35,9 @@ interface ReferenceTypeSpec { boolean matches(ReferenceType refType); ClassPrepareRequest createPrepareRequest(); + @Override int hashCode(); + @Override boolean equals(Object obj); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/SourceMapper.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/SourceMapper.java index 95f82b53956..941f6c24722 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/SourceMapper.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/SourceMapper.java @@ -27,11 +27,8 @@ package com.sun.tools.example.debug.tty; import com.sun.jdi.Location; import com.sun.jdi.AbsentInformationException; -import java.util.Map; -import java.util.HashMap; import java.util.List; import java.util.ArrayList; -import java.util.Iterator; import java.util.StringTokenizer; import java.io.*; diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java index c717b6ca4b7..6514592d67d 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java @@ -47,34 +47,43 @@ public class TTY implements EventNotifier { */ private static final String progname = "jdb"; + @Override public void vmStartEvent(VMStartEvent se) { Thread.yield(); // fetch output MessageOutput.lnprint("VM Started:"); } + @Override public void vmDeathEvent(VMDeathEvent e) { } + @Override public void vmDisconnectEvent(VMDisconnectEvent e) { } + @Override public void threadStartEvent(ThreadStartEvent e) { } + @Override public void threadDeathEvent(ThreadDeathEvent e) { } + @Override public void classPrepareEvent(ClassPrepareEvent e) { } + @Override public void classUnloadEvent(ClassUnloadEvent e) { } + @Override public void breakpointEvent(BreakpointEvent be) { Thread.yield(); // fetch output MessageOutput.lnprint("Breakpoint hit:"); } + @Override public void fieldWatchEvent(WatchpointEvent fwe) { Field field = fwe.field(); ObjectReference obj = fwe.object(); @@ -90,11 +99,13 @@ public class TTY implements EventNotifier { } } + @Override public void stepEvent(StepEvent se) { Thread.yield(); // fetch output MessageOutput.lnprint("Step completed:"); } + @Override public void exceptionEvent(ExceptionEvent ee) { Thread.yield(); // fetch output Location catchLocation = ee.catchLocation(); @@ -108,6 +119,7 @@ public class TTY implements EventNotifier { } } + @Override public void methodEntryEvent(MethodEntryEvent me) { Thread.yield(); // fetch output /* @@ -125,6 +137,7 @@ public class TTY implements EventNotifier { } } + @Override public boolean methodExitEvent(MethodExitEvent me) { Thread.yield(); // fetch output /* @@ -173,6 +186,7 @@ public class TTY implements EventNotifier { return false; } + @Override public void vmInterrupted() { Thread.yield(); // fetch output printCurrentLocation(); @@ -184,6 +198,7 @@ public class TTY implements EventNotifier { MessageOutput.printPrompt(); } + @Override public void receivedEvent(Event event) { } @@ -317,18 +332,19 @@ public class TTY implements EventNotifier { // Adapted for use with String[][0]. int low = 0; int high = commandList.length - 1; - long i = 0; while (low <= high) { int mid = (low + high) >>> 1; String midVal = commandList[mid][0]; int compare = midVal.compareTo(key); - if (compare < 0) + if (compare < 0) { low = mid + 1; - else if (compare > 0) + } else if (compare > 0) { high = mid - 1; - else + } + else { return mid; // key found } + } return -(low + 1); // key not found. }; @@ -336,7 +352,9 @@ public class TTY implements EventNotifier { * Return true if the command is OK when disconnected. */ private boolean isDisconnectCmd(int ii) { - if (ii < 0 || ii >= commandList.length) return false; + if (ii < 0 || ii >= commandList.length) { + return false; + } return (commandList[ii][1].equals("y")); } @@ -344,7 +362,9 @@ public class TTY implements EventNotifier { * Return true if the command is OK when readonly. */ private boolean isReadOnlyCmd(int ii) { - if (ii < 0 || ii >= commandList.length) return false; + if (ii < 0 || ii >= commandList.length) { + return false; + } return (commandList[ii][2].equals("y")); }; diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources.java index 6193d9ba4c8..f6ba9d74ca7 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources.java @@ -44,6 +44,7 @@ public class TTYResources extends java.util.ListResourceBundle { * * @return the contents of this ResourceBundle. */ + @Override public Object[][] getContents() { Object[][] temp = new Object[][] { // NOTE: The value strings in this file containing "{0}" are diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java index 55441459815..2dcace1c486 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java @@ -44,6 +44,7 @@ public class TTYResources_ja extends java.util.ListResourceBundle { * * @return the contents of this ResourceBundle. */ + @Override public Object[][] getContents() { Object[][] temp = new Object[][] { // NOTE: The value strings in this file containing "{0}" are diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java index ac948fb9950..dc84bdf4f9c 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java @@ -44,6 +44,7 @@ public class TTYResources_zh_CN extends java.util.ListResourceBundle { * * @return the contents of this ResourceBundle. */ + @Override public Object[][] getContents() { Object[][] temp = new Object[][] { // NOTE: The value strings in this file containing "{0}" are diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadGroupIterator.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadGroupIterator.java index 1190c33b423..dd3ad08106c 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadGroupIterator.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadGroupIterator.java @@ -26,7 +26,6 @@ package com.sun.tools.example.debug.tty; import com.sun.jdi.ThreadGroupReference; -import com.sun.jdi.ThreadReference; import java.util.List; import java.util.Stack; import java.util.ArrayList; @@ -70,10 +69,12 @@ class ThreadGroupIterator implements Iterator { } } + @Override public boolean hasNext() { return !stack.isEmpty(); } + @Override public ThreadGroupReference next() { return nextThreadGroup(); } @@ -84,6 +85,7 @@ class ThreadGroupIterator implements Iterator { return tg; } + @Override public void remove() { throw new UnsupportedOperationException(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadInfo.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadInfo.java index 1432239f648..8ac294fbcaf 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadInfo.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadInfo.java @@ -32,8 +32,6 @@ import com.sun.jdi.StackFrame; import java.util.List; import java.util.ArrayList; import java.util.Collections; -import java.util.Iterator; -import java.io.*; class ThreadInfo { // This is a list of all known ThreadInfo objects. It survives diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadIterator.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadIterator.java index 58ec98495e0..6acb2ea9d09 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadIterator.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/ThreadIterator.java @@ -46,6 +46,7 @@ class ThreadIterator implements Iterator { tgi = new ThreadGroupIterator(); } + @Override public boolean hasNext() { while (it == null || !it.hasNext()) { if (!tgi.hasNext()) { @@ -56,6 +57,7 @@ class ThreadIterator implements Iterator { return true; } + @Override public ThreadReference next() { return it.next(); } @@ -64,6 +66,7 @@ class ThreadIterator implements Iterator { return next(); } + @Override public void remove() { throw new UnsupportedOperationException(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/VMConnection.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/VMConnection.java index fead3f79788..0b77f9824a2 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/VMConnection.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/VMConnection.java @@ -28,7 +28,6 @@ package com.sun.tools.example.debug.tty; import com.sun.jdi.*; import com.sun.jdi.connect.*; import com.sun.jdi.request.EventRequestManager; -import com.sun.jdi.request.ExceptionRequest; import com.sun.jdi.request.ThreadStartRequest; import com.sun.jdi.request.ThreadDeathRequest; @@ -292,6 +291,7 @@ class VMConnection { */ private void displayRemoteOutput(final InputStream stream) { Thread thr = new Thread("output reader") { + @Override public void run() { try { dumpStream(stream); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/VMNotConnectedException.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/VMNotConnectedException.java index 448561d04d5..780301ca607 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/VMNotConnectedException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/VMNotConnectedException.java @@ -27,6 +27,8 @@ package com.sun.tools.example.debug.tty; public class VMNotConnectedException extends RuntimeException { + private static final long serialVersionUID = -7433430494903950165L; + public VMNotConnectedException() { super(); } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/WatchpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/WatchpointSpec.java index e424c40d62a..6c7da78f485 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/WatchpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/WatchpointSpec.java @@ -25,8 +25,6 @@ package com.sun.tools.example.debug.tty; -import com.sun.jdi.*; - abstract class WatchpointSpec extends EventRequestSpec { final String fieldId; @@ -39,11 +37,13 @@ abstract class WatchpointSpec extends EventRequestSpec { } } + @Override public int hashCode() { return refSpec.hashCode() + fieldId.hashCode() + getClass().hashCode(); } + @Override public boolean equals(Object obj) { if (obj instanceof WatchpointSpec) { WatchpointSpec watchpoint = (WatchpointSpec)obj; @@ -56,6 +56,7 @@ abstract class WatchpointSpec extends EventRequestSpec { } } + @Override String errorMessageFor(Exception e) { if (e instanceof NoSuchFieldException) { return (MessageOutput.format("No field in", diff --git a/jdk/src/share/classes/com/sun/tools/example/trace/EventThread.java b/jdk/src/share/classes/com/sun/tools/example/trace/EventThread.java index 7e729a16b07..229a4168989 100644 --- a/jdk/src/share/classes/com/sun/tools/example/trace/EventThread.java +++ b/jdk/src/share/classes/com/sun/tools/example/trace/EventThread.java @@ -49,7 +49,8 @@ public class EventThread extends Thread { private boolean vmDied = true; // VMDeath occurred // Maps ThreadReference to ThreadTrace instances - private Map traceMap = new HashMap(); + private Map traceMap = + new HashMap<>(); EventThread(VirtualMachine vm, String[] excludes, PrintWriter writer) { super("event-handler"); @@ -63,6 +64,7 @@ public class EventThread extends Thread { * As long as we are connected, get event sets off * the queue and dispatch the events within them. */ + @Override public void run() { EventQueue queue = vm.eventQueue(); while (connected) { @@ -208,7 +210,7 @@ public class EventThread extends Thread { * creating one if needed. */ ThreadTrace threadTrace(ThreadReference thread) { - ThreadTrace trace = (ThreadTrace)traceMap.get(thread); + ThreadTrace trace = traceMap.get(thread); if (trace == null) { trace = new ThreadTrace(thread); traceMap.put(thread, trace); @@ -297,7 +299,7 @@ public class EventThread extends Thread { } void threadDeathEvent(ThreadDeathEvent event) { - ThreadTrace trace = (ThreadTrace)traceMap.get(event.thread()); + ThreadTrace trace = traceMap.get(event.thread()); if (trace != null) { // only want threads we care about trace.threadDeathEvent(event); // Forward event } @@ -309,9 +311,8 @@ public class EventThread extends Thread { */ private void classPrepareEvent(ClassPrepareEvent event) { EventRequestManager mgr = vm.eventRequestManager(); - List fields = event.referenceType().visibleFields(); - for (Iterator it = fields.iterator(); it.hasNext(); ) { - Field field = (Field)it.next(); + List fields = event.referenceType().visibleFields(); + for (Field field : fields) { ModificationWatchpointRequest req = mgr.createModificationWatchpointRequest(field); for (int i=0; i arguments = + connectorArguments(connector, mainArgs); try { return connector.launch(arguments); } catch (IOException exc) { @@ -186,10 +186,8 @@ public class Trace { * Find a com.sun.jdi.CommandLineLaunch connector */ LaunchingConnector findLaunchingConnector() { - List connectors = Bootstrap.virtualMachineManager().allConnectors(); - Iterator iter = connectors.iterator(); - while (iter.hasNext()) { - Connector connector = (Connector)iter.next(); + List connectors = Bootstrap.virtualMachineManager().allConnectors(); + for (Connector connector : connectors) { if (connector.name().equals("com.sun.jdi.CommandLineLaunch")) { return (LaunchingConnector)connector; } @@ -200,8 +198,8 @@ public class Trace { /** * Return the launching connector's arguments. */ - Map connectorArguments(LaunchingConnector connector, String mainArgs) { - Map arguments = connector.defaultArguments(); + Map connectorArguments(LaunchingConnector connector, String mainArgs) { + Map arguments = connector.defaultArguments(); Connector.Argument mainArg = (Connector.Argument)arguments.get("main"); if (mainArg == null) { diff --git a/jdk/src/share/demo/jvmti/minst/Minst.java b/jdk/src/share/demo/jvmti/minst/Minst.java index 6e21926f7d8..04504c79f66 100644 --- a/jdk/src/share/demo/jvmti/minst/Minst.java +++ b/jdk/src/share/demo/jvmti/minst/Minst.java @@ -45,7 +45,7 @@ public class Minst { */ public static void method_entry(int cnum, int mnum) { - Class x = Minst.class; + Class x = Minst.class; synchronized ( x ) { if ( engaged > 0 ) { engaged = 0; diff --git a/jdk/src/share/demo/management/FullThreadDump/Deadlock.java b/jdk/src/share/demo/management/FullThreadDump/Deadlock.java index 0a92427f3bb..2cc2d3e518d 100644 --- a/jdk/src/share/demo/management/FullThreadDump/Deadlock.java +++ b/jdk/src/share/demo/management/FullThreadDump/Deadlock.java @@ -48,7 +48,7 @@ import java.io.IOException; */ public class Deadlock { public static void main(String[] argv) { - Deadlock dl = new Deadlock(); + new Deadlock(); // Now find deadlock ThreadMonitor monitor = new ThreadMonitor(); @@ -112,6 +112,7 @@ public class Deadlock { this.mon2 = mon2; this.useSync = false; } + @Override public void run() { if (useSync) { syncLock(); diff --git a/jdk/src/share/demo/management/FullThreadDump/ThreadMonitor.java b/jdk/src/share/demo/management/FullThreadDump/ThreadMonitor.java index 8b9360c81c7..eb4ed7803d2 100644 --- a/jdk/src/share/demo/management/FullThreadDump/ThreadMonitor.java +++ b/jdk/src/share/demo/management/FullThreadDump/ThreadMonitor.java @@ -39,7 +39,6 @@ import java.lang.management.LockInfo; import java.lang.management.MonitorInfo; import javax.management.*; import java.io.*; -import java.util.*; /** * Example of using the java.lang.management API to dump stack trace @@ -167,7 +166,8 @@ public class ThreadMonitor { } } - private void printMonitorInfo(ThreadInfo ti, MonitorInfo[] monitors) { + private void printMonitorInfo(ThreadInfo ti) { + MonitorInfo[] monitors = ti.getLockedMonitors(); System.out.println(INDENT + "Locked monitors: count = " + monitors.length); for (MonitorInfo mi : monitors) { System.out.println(INDENT + " - " + mi + " locked at "); @@ -201,6 +201,7 @@ public class ThreadMonitor { ThreadInfo[] infos = tmbean.getThreadInfo(tids, true, true); for (ThreadInfo ti : infos) { printThreadInfo(ti); + printMonitorInfo(ti); printLockInfo(ti.getLockedSynchronizers()); System.out.println(); } diff --git a/jdk/src/share/demo/management/JTop/JTop.java b/jdk/src/share/demo/management/JTop/JTop.java index 3ec7eedbfd1..39f4cab133a 100644 --- a/jdk/src/share/demo/management/JTop/JTop.java +++ b/jdk/src/share/demo/management/JTop/JTop.java @@ -57,7 +57,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import java.util.SortedMap; import java.util.Timer; @@ -69,10 +68,8 @@ import java.net.MalformedURLException; import static java.lang.management.ManagementFactory.*; import java.awt.*; -import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; -import javax.swing.event.*; import javax.swing.table.*; /** @@ -80,6 +77,8 @@ import javax.swing.table.*; * in a table. */ public class JTop extends JPanel { + + private static final long serialVersionUID = -1499762160973870696L; private MBeanServerConnection server; private ThreadMXBean tmbean; private MyTableModel tmodel; @@ -122,29 +121,34 @@ public class JTop extends JPanel { } class MyTableModel extends AbstractTableModel { + private static final long serialVersionUID = -7877310288576779514L; private String[] columnNames = {"ThreadName", "CPU(sec)", "State"}; // List of all threads. The key of each entry is the CPU time // and its value is the ThreadInfo object with no stack trace. private List> threadList = - Collections.EMPTY_LIST; + Collections.emptyList(); public MyTableModel() { } + @Override public int getColumnCount() { return columnNames.length; } + @Override public int getRowCount() { return threadList.size(); } + @Override public String getColumnName(int col) { return columnNames[col]; } + @Override public Object getValueAt(int row, int col) { Map.Entry me = threadList.get(row); switch (col) { @@ -164,7 +168,8 @@ public class JTop extends JPanel { } } - public Class getColumnClass(int c) { + @Override + public Class getColumnClass(int c) { return getValueAt(0, c).getClass(); } @@ -207,12 +212,14 @@ public class JTop extends JPanel { * Format Double with 4 fraction digits */ class DoubleRenderer extends DefaultTableCellRenderer { + private static final long serialVersionUID = 1704639497162584382L; NumberFormat formatter; public DoubleRenderer() { super(); setHorizontalAlignment(JLabel.RIGHT); } + @Override public void setValue(Object value) { if (formatter==null) { formatter = NumberFormat.getInstance(); @@ -238,12 +245,14 @@ public class JTop extends JPanel { } // Get the current thread info and CPU time + @Override public List> doInBackground() { return getThreadList(); } // fire table data changed to trigger GUI update // when doInBackground() is finished + @Override protected void done() { try { // Set table model with the new thread list @@ -290,6 +299,7 @@ public class JTop extends JPanel { // A timer task to update GUI per each interval TimerTask timerTask = new TimerTask() { + @Override public void run() { // Schedule the SwingWorker to update the GUI jtop.newSwingWorker().execute(); @@ -299,6 +309,7 @@ public class JTop extends JPanel { // Create the standalone window with JTop panel // by the event dispatcher thread SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { createAndShowGUI(jtop); } diff --git a/jdk/src/share/demo/management/JTop/JTopPlugin.java b/jdk/src/share/demo/management/JTop/JTopPlugin.java index 03352f5d90b..9586f9ad48d 100644 --- a/jdk/src/share/demo/management/JTop/JTopPlugin.java +++ b/jdk/src/share/demo/management/JTop/JTopPlugin.java @@ -40,13 +40,13 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.LinkedHashMap; import java.util.Map; -import javax.management.MBeanServerConnection; + import javax.swing.JPanel; import javax.swing.SwingWorker; -import com.sun.tools.jconsole.JConsolePlugin; import com.sun.tools.jconsole.JConsoleContext; import com.sun.tools.jconsole.JConsoleContext.ConnectionState; +import com.sun.tools.jconsole.JConsolePlugin; /** * JTopPlugin is a subclass to com.sun.tools.jconsole.JConsolePlugin @@ -70,6 +70,7 @@ public class JTopPlugin extends JConsolePlugin implements PropertyChangeListener /* * Returns a JTop tab to be added in JConsole. */ + @Override public synchronized Map getTabs() { if (tabs == null) { jtop = new JTop(); @@ -86,6 +87,7 @@ public class JTopPlugin extends JConsolePlugin implements PropertyChangeListener /* * Returns a SwingWorker which is responsible for updating the JTop tab. */ + @Override public SwingWorker newSwingWorker() { return jtop.newSwingWorker(); } @@ -101,10 +103,10 @@ public class JTopPlugin extends JConsolePlugin implements PropertyChangeListener * Property listener to reset the MBeanServerConnection * at reconnection time. */ + @Override public void propertyChange(PropertyChangeEvent ev) { String prop = ev.getPropertyName(); if (prop == JConsoleContext.CONNECTION_STATE_PROPERTY) { - ConnectionState oldState = (ConnectionState)ev.getOldValue(); ConnectionState newState = (ConnectionState)ev.getNewValue(); // JConsole supports disconnection and reconnection // The MBeanServerConnection will become invalid when diff --git a/jdk/src/share/demo/management/MemoryMonitor/MemoryMonitor.java b/jdk/src/share/demo/management/MemoryMonitor/MemoryMonitor.java index d43c4a7f3dd..676b698f3fb 100644 --- a/jdk/src/share/demo/management/MemoryMonitor/MemoryMonitor.java +++ b/jdk/src/share/demo/management/MemoryMonitor/MemoryMonitor.java @@ -42,9 +42,6 @@ import javax.swing.*; import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; import java.lang.management.*; -import java.util.*; - - /** * Demo code which plots the memory usage by all memory pools. * The memory usage is sampled at some time interval using @@ -53,6 +50,7 @@ import java.util.*; */ public class MemoryMonitor extends JPanel { + private static final long serialVersionUID = -3463003810776195761L; static JCheckBox dateStampCB = new JCheckBox("Output Date Stamp"); public Surface surf; JPanel controls; @@ -84,6 +82,7 @@ public class MemoryMonitor extends JPanel { controls.add(dateStampCB); dateStampCB.setFont(font); addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { removeAll(); if ((doControls = !doControls)) { @@ -128,28 +127,32 @@ public class MemoryMonitor extends JPanel { public Surface() { setBackground(Color.black); addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { if (thread == null) start(); else stop(); } }); - int i = 0; usedMem = new float[numPools][]; ptNum = new int[numPools]; } + @Override public Dimension getMinimumSize() { return getPreferredSize(); } + @Override public Dimension getMaximumSize() { return getPreferredSize(); } + @Override public Dimension getPreferredSize() { return new Dimension(135,80); } + @Override public void paint(Graphics g) { if (big == null) { @@ -315,13 +318,14 @@ public class MemoryMonitor extends JPanel { notify(); } + @Override public void run() { Thread me = Thread.currentThread(); while (thread == me && !isShowing() || getSize().width == 0) { try { - thread.sleep(500); + Thread.sleep(500); } catch (InterruptedException e) { return; } } @@ -339,7 +343,7 @@ public class MemoryMonitor extends JPanel { } repaint(); try { - thread.sleep(sleepAmount); + Thread.sleep(sleepAmount); } catch (InterruptedException e) { break; } if (MemoryMonitor.dateStampCB.isSelected()) { System.out.println(new Date().toString() + " " + usedStr); @@ -354,6 +358,7 @@ public class MemoryMonitor extends JPanel { static class Memeater extends ClassLoader implements Runnable { Object y[]; public Memeater() {} + @Override public void run() { y = new Object[10000000]; int k =0; @@ -378,7 +383,7 @@ public class MemoryMonitor extends JPanel { } - Class loadNext() throws ClassNotFoundException { + Class loadNext() throws ClassNotFoundException { // public class TestNNNNNN extends java.lang.Object{ // public TestNNNNNN(); @@ -424,15 +429,15 @@ public class MemoryMonitor extends JPanel { int len = begin.length + value.length + end.length; byte b[] = new byte[len]; - int i, pos=0; - for (i=0; i mbeans = server.queryNames(poolName, null); if (mbeans != null) { pools = new ArrayList(); - Iterator iterator = mbeans.iterator(); - while (iterator.hasNext()) { - ObjectName objName = (ObjectName) iterator.next(); + for (ObjectName objName : mbeans) { MemoryPoolMXBean p = newPlatformMXBeanProxy(server, objName.getCanonicalName(), @@ -88,9 +86,7 @@ public class PrintGCStat { mbeans = server.queryNames(gcName, null); if (mbeans != null) { gcmbeans = new ArrayList(); - Iterator iterator = mbeans.iterator(); - while (iterator.hasNext()) { - ObjectName objName = (ObjectName) iterator.next(); + for (ObjectName objName : mbeans) { GarbageCollectorMXBean gc = newPlatformMXBeanProxy(server, objName.getCanonicalName(), @@ -116,7 +112,9 @@ public class PrintGCStat { * of all memory pools as well as the GC statistics. */ public void printVerboseGc() { - System.out.print("Uptime: " + formatMillis(rmbean.getUptime())); + System.out.println("Uptime: " + formatMillis(rmbean.getUptime())); + System.out.println("Heap usage: " + mmbean.getHeapMemoryUsage()); + System.out.println("Non-Heap memory usage: " + mmbean.getNonHeapMemoryUsage()); for (GarbageCollectorMXBean gc : gcmbeans) { System.out.print(" [" + gc.getName() + ": "); System.out.print("Count=" + gc.getCollectionCount()); diff --git a/jdk/src/share/demo/management/VerboseGC/VerboseGC.java b/jdk/src/share/demo/management/VerboseGC/VerboseGC.java index 9ba2415e7fb..963389423ba 100644 --- a/jdk/src/share/demo/management/VerboseGC/VerboseGC.java +++ b/jdk/src/share/demo/management/VerboseGC/VerboseGC.java @@ -95,9 +95,8 @@ public class VerboseGC { int port = -1; long interval = 5000; // default is 5 second interval long mins = 5; - for (int argIndex = 0; argIndex < args.length; argIndex++) { - String arg = args[argIndex]; - if (args[argIndex].startsWith("-")) { + for (String arg: args) { + if (arg.startsWith("-")) { if (arg.equals("-h") || arg.equals("-help") || arg.equals("-?")) { diff --git a/jdk/src/share/demo/nio/zipfs/Demo.java b/jdk/src/share/demo/nio/zipfs/Demo.java index dfe77b877ed..394a5f7d013 100644 --- a/jdk/src/share/demo/nio/zipfs/Demo.java +++ b/jdk/src/share/demo/nio/zipfs/Demo.java @@ -42,7 +42,6 @@ import java.util.*; import static java.nio.file.StandardOpenOption.*; import static java.nio.file.StandardCopyOption.*; - /* * ZipFileSystem usage demo * @@ -157,7 +156,6 @@ public class Demo { env.put("create", "true"); try (FileSystem fs = provider.newFileSystem(Paths.get(args[1]), env)) { Path path, src, dst; - boolean isRename = false; switch (action) { case rename: src = fs.getPath(args[2]); @@ -303,6 +301,7 @@ public class Demo { final String fStr = (args.length > 3)?args[3]:""; try (DirectoryStream ds = Files.newDirectoryStream(path, new DirectoryStream.Filter() { + @Override public boolean accept(Path path) { return path.toString().contains(fStr); } @@ -358,10 +357,18 @@ public class Demo { return null; } + @SuppressWarnings("unused") + /** + * Not used in demo, but included for demonstrational purposes. + */ private static byte[] getBytes(String name) { return name.getBytes(); } + @SuppressWarnings("unused") + /** + * Not used in demo, but included for demonstrational purposes. + */ private static String getString(byte[] name) { return new String(name); } @@ -534,6 +541,10 @@ public class Demo { Files.createDirectory(path); } + @SuppressWarnings("unused") + /** + * Not used in demo, but included for demonstrational purposes. + */ private static void rmdirs(Path path) throws IOException { while (path != null && path.getNameCount() != 0) { Files.delete(path); @@ -557,7 +568,11 @@ public class Demo { } } - // check the content of two paths are equal + @SuppressWarnings("unused") + /** + * Checks that the content of two paths are equal. + * Not used in demo, but included for demonstrational purposes. + */ private static void checkEqual(Path src, Path dst) throws IOException { //System.out.printf("checking <%s> vs <%s>...%n", diff --git a/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/EditableAtEndDocument.java b/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/EditableAtEndDocument.java index 8ed93f7900e..fa9bf1d5480 100644 --- a/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/EditableAtEndDocument.java +++ b/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/EditableAtEndDocument.java @@ -38,14 +38,18 @@ import javax.swing.text.*; * document. This is used in ScriptShellPanel class as document for editor. */ public class EditableAtEndDocument extends PlainDocument { + + private static final long serialVersionUID = 5358116444851502167L; private int mark; + @Override public void insertString(int offset, String text, AttributeSet a) throws BadLocationException { int len = getLength(); super.insertString(len, text, a); } + @Override public void remove(int offs, int len) throws BadLocationException { int start = offs; int end = offs + len; diff --git a/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/ScriptJConsolePlugin.java b/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/ScriptJConsolePlugin.java index bcc6f77dd5a..6bae2c80f8b 100644 --- a/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/ScriptJConsolePlugin.java +++ b/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/ScriptJConsolePlugin.java @@ -32,14 +32,10 @@ package com.sun.demo.scripting.jconsole; import com.sun.tools.jconsole.*; -import java.awt.*; -import java.awt.event.*; import java.io.*; -import java.lang.reflect.*; import java.util.concurrent.CountDownLatch; import javax.script.*; import javax.swing.*; -import javax.swing.event.*; import java.util.*; /** @@ -86,6 +82,7 @@ public class ScriptJConsolePlugin extends JConsolePlugin tabs.put("Script Shell", window); new Thread(new Runnable() { + @Override public void run() { // initialize the script engine initScriptEngine(); @@ -103,10 +100,12 @@ public class ScriptJConsolePlugin extends JConsolePlugin window.dispose(); } + @Override public String getPrompt() { return prompt; } + @Override public String executeCommand(String cmd) { String res; try { @@ -176,7 +175,7 @@ public class ScriptJConsolePlugin extends JConsolePlugin String oldFilename = (String) engine.get(ScriptEngine.FILENAME); engine.put(ScriptEngine.FILENAME, ""); try { - Class myClass = this.getClass(); + Class myClass = this.getClass(); InputStream stream = myClass.getResourceAsStream("/resources/jconsole." + extension); if (stream != null) { diff --git a/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/ScriptShellPanel.java b/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/ScriptShellPanel.java index b36c679c516..54731af539f 100644 --- a/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/ScriptShellPanel.java +++ b/jdk/src/share/demo/scripting/jconsole-plugin/src/com/sun/demo/scripting/jconsole/ScriptShellPanel.java @@ -44,8 +44,11 @@ import javax.swing.text.*; * A JPanel subclass containing a scrollable text area displaying the * jconsole's script console. */ + class ScriptShellPanel extends JPanel { + private static final long serialVersionUID = 4116273141148726319L; + // interface to evaluate script command and script prompt interface CommandProcessor { // execute given String as script and return the result @@ -75,9 +78,11 @@ class ScriptShellPanel extends JPanel { add(scroller, BorderLayout.CENTER); editor.getDocument().addDocumentListener(new DocumentListener() { + @Override public void changedUpdate(DocumentEvent e) { } + @Override public void insertUpdate(DocumentEvent e) { if (updating) return; beginUpdate(); @@ -90,10 +95,12 @@ class ScriptShellPanel extends JPanel { // Trim "\\n" combinations final String cmd1 = trimContinuations(cmd); commandExecutor.execute(new Runnable() { + @Override public void run() { final String result = executeCommand(cmd1); SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { if (result != null) { print(result + "\n"); @@ -113,6 +120,7 @@ class ScriptShellPanel extends JPanel { } } + @Override public void removeUpdate(DocumentEvent e) { } }); @@ -121,6 +129,7 @@ class ScriptShellPanel extends JPanel { // the JEditorPane to update the caret's position precisely the // size of the insertion editor.addCaretListener(new CaretListener() { + @Override public void caretUpdate(CaretEvent e) { int len = editor.getDocument().getLength(); if (e.getDot() > len) { @@ -133,6 +142,7 @@ class ScriptShellPanel extends JPanel { hbox.add(Box.createGlue()); JButton button = new JButton("Clear"); // FIXME: i18n? button.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { clear(); } @@ -148,6 +158,7 @@ class ScriptShellPanel extends JPanel { commandExecutor.shutdown(); } + @Override public void requestFocus() { editor.requestFocus(); } From 30bdc40c81916863c217b1675837c1427d755178 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 26 Apr 2011 10:35:06 -0700 Subject: [PATCH 043/117] 7039369: Limit range of strictfp in FloatingDecimal Additional reviews by sergey.kuksenko@oracle.com Reviewed-by: alanb --- jdk/src/share/classes/sun/misc/FloatingDecimal.java | 11 ++++------- .../classes/sun/misc/FormattedFloatingDecimal.java | 11 ++++------- jdk/test/java/lang/Double/ParseDouble.java | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/jdk/src/share/classes/sun/misc/FloatingDecimal.java b/jdk/src/share/classes/sun/misc/FloatingDecimal.java index 7c621f91a97..1e3a25e84af 100644 --- a/jdk/src/share/classes/sun/misc/FloatingDecimal.java +++ b/jdk/src/share/classes/sun/misc/FloatingDecimal.java @@ -30,7 +30,7 @@ import sun.misc.DoubleConsts; import sun.misc.FloatConsts; import java.util.regex.*; -public strictfp class FloatingDecimal{ +public class FloatingDecimal{ boolean isExceptional; boolean isNegative; int decExponent; @@ -239,8 +239,7 @@ public strictfp class FloatingDecimal{ * More difficult if subtracting and the argument * is a normalized a power of 2, as the ULP changes at these points. */ - private static double - ulp( double dval, boolean subtracting ){ + private static double ulp( double dval, boolean subtracting ){ long lbits = Double.doubleToLongBits( dval ) & ~signMask; int binexp = (int)(lbits >>> expShift); double ulpval; @@ -1251,8 +1250,7 @@ public strictfp class FloatingDecimal{ * for a single-precision float. */ - public double - doubleValue(){ + public strictfp double doubleValue(){ int kDigits = Math.min( nDigits, maxDecimalDigits+1 ); long lValue; double dValue; @@ -1611,8 +1609,7 @@ public strictfp class FloatingDecimal{ * ( because of the preference to a zero low-order bit ). */ - public float - floatValue(){ + public strictfp float floatValue(){ int kDigits = Math.min( nDigits, singleMaxDecimalDigits+1 ); int iValue; float fValue; diff --git a/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java b/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java index 9d54b098252..0b6dd85051f 100644 --- a/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java +++ b/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java @@ -30,7 +30,7 @@ import sun.misc.DoubleConsts; import sun.misc.FloatConsts; import java.util.regex.*; -public strictfp class FormattedFloatingDecimal{ +public class FormattedFloatingDecimal{ boolean isExceptional; boolean isNegative; int decExponent; // value set at construction, then immutable @@ -247,8 +247,7 @@ public strictfp class FormattedFloatingDecimal{ * More difficult if subtracting and the argument * is a normalized a power of 2, as the ULP changes at these points. */ - private static double - ulp( double dval, boolean subtracting ){ + private static double ulp( double dval, boolean subtracting ){ long lbits = Double.doubleToLongBits( dval ) & ~signMask; int binexp = (int)(lbits >>> expShift); double ulpval; @@ -1157,8 +1156,7 @@ public strictfp class FormattedFloatingDecimal{ * for a single-precision float. */ - public double - doubleValue(){ + public strictfp double doubleValue(){ int kDigits = Math.min( nDigits, maxDecimalDigits+1 ); long lValue; double dValue; @@ -1517,8 +1515,7 @@ public strictfp class FormattedFloatingDecimal{ * ( because of the preference to a zero low-order bit ). */ - public float - floatValue(){ + public strictfp float floatValue(){ int kDigits = Math.min( nDigits, singleMaxDecimalDigits+1 ); int iValue; float fValue; diff --git a/jdk/test/java/lang/Double/ParseDouble.java b/jdk/test/java/lang/Double/ParseDouble.java index e67c3d86bea..504f5bc3dc0 100644 --- a/jdk/test/java/lang/Double/ParseDouble.java +++ b/jdk/test/java/lang/Double/ParseDouble.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4160406 4705734 4707389 4826774 4895911 4421494 7021568 + * @bug 4160406 4705734 4707389 4826774 4895911 4421494 7021568 7039369 * @summary Test for Double.parseDouble method and acceptance regex */ From ab86f12c440160ec5332208de68494552183dba1 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Tue, 26 Apr 2011 14:04:43 -0400 Subject: [PATCH 044/117] 7009923: JSR 292: VM crash in JavaThread::last_frame Handle stack overflow before the first frame is called, by printing out the called method and not walking the stack. Reviewed-by: dholmes, phh, dsamersoff --- hotspot/src/share/vm/classfile/javaClasses.cpp | 16 +++++++++++++--- hotspot/src/share/vm/classfile/javaClasses.hpp | 4 ++-- hotspot/src/share/vm/runtime/javaCalls.cpp | 2 +- hotspot/src/share/vm/utilities/exceptions.cpp | 6 +++--- hotspot/src/share/vm/utilities/exceptions.hpp | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 81b3e65d4ee..fa422673d48 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -1357,7 +1357,7 @@ class BacktraceBuilder: public StackObj { }; -void java_lang_Throwable::fill_in_stack_trace(Handle throwable, TRAPS) { +void java_lang_Throwable::fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS) { if (!StackTraceInThrowable) return; ResourceMark rm(THREAD); @@ -1374,6 +1374,16 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, TRAPS) { JavaThread* thread = (JavaThread*)THREAD; BacktraceBuilder bt(CHECK); + // If there is no Java frame just return the method that was being called + // with bci 0 + if (!thread->has_last_Java_frame()) { + if (max_depth >= 1 && method() != NULL) { + bt.push(method(), 0, CHECK); + set_backtrace(throwable(), bt.backtrace()); + } + return; + } + // Instead of using vframe directly, this version of fill_in_stack_trace // basically handles everything by hand. This significantly improved the // speed of this method call up to 28.5% on Solaris sparc. 27.1% on Windows. @@ -1477,7 +1487,7 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, TRAPS) { set_backtrace(throwable(), bt.backtrace()); } -void java_lang_Throwable::fill_in_stack_trace(Handle throwable) { +void java_lang_Throwable::fill_in_stack_trace(Handle throwable, methodHandle method) { // No-op if stack trace is disabled if (!StackTraceInThrowable) { return; @@ -1491,7 +1501,7 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable) { PRESERVE_EXCEPTION_MARK; JavaThread* thread = JavaThread::active(); - fill_in_stack_trace(throwable, thread); + fill_in_stack_trace(throwable, method, thread); // ignore exceptions thrown during stack trace filling CLEAR_PENDING_EXCEPTION; } diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index bed2ad46ac2..5701bc3893c 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -440,8 +440,8 @@ class java_lang_Throwable: AllStatic { static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable); // Fill in current stack trace, can cause GC - static void fill_in_stack_trace(Handle throwable, TRAPS); - static void fill_in_stack_trace(Handle throwable); + static void fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS); + static void fill_in_stack_trace(Handle throwable, methodHandle method = methodHandle()); // Programmatic access to stack trace static oop get_stack_trace_element(oop throwable, int index, TRAPS); static int get_stack_trace_depth(oop throwable, TRAPS); diff --git a/hotspot/src/share/vm/runtime/javaCalls.cpp b/hotspot/src/share/vm/runtime/javaCalls.cpp index aaa2805e7e7..eca02a49629 100644 --- a/hotspot/src/share/vm/runtime/javaCalls.cpp +++ b/hotspot/src/share/vm/runtime/javaCalls.cpp @@ -389,7 +389,7 @@ void JavaCalls::call_helper(JavaValue* result, methodHandle* m, JavaCallArgument // to Java if (!os::stack_shadow_pages_available(THREAD, method)) { // Throw stack overflow exception with preinitialized exception. - Exceptions::throw_stack_overflow_exception(THREAD, __FILE__, __LINE__); + Exceptions::throw_stack_overflow_exception(THREAD, __FILE__, __LINE__, method); return; } else { // Touch pages checked if the OS needs them to be touched to be mapped. diff --git a/hotspot/src/share/vm/utilities/exceptions.cpp b/hotspot/src/share/vm/utilities/exceptions.cpp index 5d8a33b4d2e..3d2f3cfea64 100644 --- a/hotspot/src/share/vm/utilities/exceptions.cpp +++ b/hotspot/src/share/vm/utilities/exceptions.cpp @@ -207,7 +207,7 @@ void Exceptions::_throw_args(Thread* thread, const char* file, int line, Symbol* } -void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file, int line) { +void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file, int line, methodHandle method) { Handle exception; if (!THREAD->has_pending_exception()) { klassOop k = SystemDictionary::StackOverflowError_klass(); @@ -215,13 +215,13 @@ void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file exception = Handle(THREAD, e); // fill_in_stack trace does gc assert(instanceKlass::cast(k)->is_initialized(), "need to increase min_stack_allowed calculation"); if (StackTraceInThrowable) { - java_lang_Throwable::fill_in_stack_trace(exception); + java_lang_Throwable::fill_in_stack_trace(exception, method()); } } else { // if prior exception, throw that one instead exception = Handle(THREAD, THREAD->pending_exception()); } - _throw_oop(THREAD, file, line, exception()); + _throw(THREAD, file, line, exception); } void Exceptions::fthrow(Thread* thread, const char* file, int line, Symbol* h_name, const char* format, ...) { diff --git a/hotspot/src/share/vm/utilities/exceptions.hpp b/hotspot/src/share/vm/utilities/exceptions.hpp index 5649f4e600d..52540f31f65 100644 --- a/hotspot/src/share/vm/utilities/exceptions.hpp +++ b/hotspot/src/share/vm/utilities/exceptions.hpp @@ -144,7 +144,7 @@ class Exceptions { const char* message, ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8); - static void throw_stack_overflow_exception(Thread* thread, const char* file, int line); + static void throw_stack_overflow_exception(Thread* thread, const char* file, int line, methodHandle method); // for AbortVMOnException flag NOT_PRODUCT(static void debug_check_abort(Handle exception, const char* message = NULL);) From e3121a5a43b52af20efb1e4017bf805f682f2d6a Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Tue, 26 Apr 2011 11:46:34 -0700 Subject: [PATCH 045/117] 7037939: NUMA: Disable adaptive resizing if SHM large pages are used Make the NUMA allocator behave properly with SHM and ISM large pages. Reviewed-by: ysr --- hotspot/src/os/linux/vm/os_linux.cpp | 17 +++++++++++++++++ hotspot/src/os/solaris/vm/os_solaris.cpp | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 0c6213d1a56..aea9c8f9da3 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -4170,6 +4170,23 @@ jint os::init_2(void) UseNUMA = false; } } + // With SHM large pages we cannot uncommit a page, so there's not way + // we can make the adaptive lgrp chunk resizing work. If the user specified + // both UseNUMA and UseLargePages (or UseSHM) on the command line - warn and + // disable adaptive resizing. + if (UseNUMA && UseLargePages && UseSHM) { + if (!FLAG_IS_DEFAULT(UseNUMA)) { + if (FLAG_IS_DEFAULT(UseLargePages) && FLAG_IS_DEFAULT(UseSHM)) { + UseLargePages = false; + } else { + warning("UseNUMA is not fully compatible with SHM large pages, disabling adaptive resizing"); + UseAdaptiveSizePolicy = false; + UseAdaptiveNUMAChunkSizing = false; + } + } else { + UseNUMA = false; + } + } if (!UseNUMA && ForceNUMA) { UseNUMA = true; } diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index ca49264dc6c..7c8fa0af6cf 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -2826,7 +2826,9 @@ bool os::remove_stack_guard_pages(char* addr, size_t size) { void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned."); assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned."); - Solaris::set_mpss_range(addr, bytes, alignment_hint); + if (UseLargePages && UseMPSS) { + Solaris::set_mpss_range(addr, bytes, alignment_hint); + } } // Tell the OS to make the range local to the first-touching LWP @@ -5044,6 +5046,20 @@ jint os::init_2(void) { UseNUMA = false; } } + // ISM is not compatible with the NUMA allocator - it always allocates + // pages round-robin across the lgroups. + if (UseNUMA && UseLargePages && UseISM) { + if (!FLAG_IS_DEFAULT(UseNUMA)) { + if (FLAG_IS_DEFAULT(UseLargePages) && FLAG_IS_DEFAULT(UseISM)) { + UseLargePages = false; + } else { + warning("UseNUMA is not compatible with ISM large pages, disabling NUMA allocator"); + UseNUMA = false; + } + } else { + UseNUMA = false; + } + } if (!UseNUMA && ForceNUMA) { UseNUMA = true; } From 6c8fc4b347befd35f9be7c9802d49c2f647ca4c3 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Tue, 26 Apr 2011 12:14:22 -0700 Subject: [PATCH 046/117] 7039586: test/java/util/Collections/Rotate.java failing with hs21-b09 A predicate should not be moved in partial peel optimization since it will invalidate jvm state of its uncommon trap. Reviewed-by: never --- hotspot/src/share/vm/opto/loopopts.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp index 1be37420607..6498d3c679b 100644 --- a/hotspot/src/share/vm/opto/loopopts.cpp +++ b/hotspot/src/share/vm/opto/loopopts.cpp @@ -2262,6 +2262,9 @@ bool PhaseIdealLoop::is_valid_clone_loop_form( IdealLoopTree *loop, Node_List& p // stmt1 // | // v +// loop predicate +// | +// v // stmt2 clone // | // v @@ -2272,9 +2275,6 @@ bool PhaseIdealLoop::is_valid_clone_loop_form( IdealLoopTree *loop, Node_List& p // : false true // : | | // : | v -// : | loop predicate -// : | | -// : | v // : | newloop<-----+ // : | | | // : | stmt3 clone | @@ -2330,7 +2330,6 @@ bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) { } } - Node* entry = head->in(LoopNode::EntryControl); int dd = dom_depth(head); // Step 1: find cut point @@ -2627,8 +2626,6 @@ bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) { // Backedge of the surviving new_head (the clone) is original last_peel _igvn.hash_delete(new_head_clone); - Node* new_entry = move_loop_predicates(entry, new_head_clone->in(LoopNode::EntryControl)); - new_head_clone->set_req(LoopNode::EntryControl, new_entry); new_head_clone->set_req(LoopNode::LoopBackControl, last_peel); _igvn._worklist.push(new_head_clone); From a5e37c937740e4918e1bbe85bd78c8bcc8a52a89 Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Tue, 26 Apr 2011 14:25:42 -0700 Subject: [PATCH 047/117] 4884238: Adds java.nio.charset.StandardCharset to provide static final constants for the standard charsets Reviewed-by: alanb, sherman, darcy --- .../classes/java/nio/charset/Charset.java | 4 + .../java/nio/charset/StandardCharset.java | 66 ++++++++++++++ jdk/src/share/classes/java/nio/file/Path.java | 2 +- .../share/classes/java/util/zip/ZipCoder.java | 7 +- .../share/classes/java/util/zip/ZipFile.java | 3 +- .../classes/java/util/zip/ZipInputStream.java | 3 +- .../java/util/zip/ZipOutputStream.java | 3 +- .../share/classes/sun/awt/FontDescriptor.java | 5 +- .../nio/charset/StandardCharset/Standard.java | 91 +++++++++++++++++++ 9 files changed, 175 insertions(+), 9 deletions(-) create mode 100644 jdk/src/share/classes/java/nio/charset/StandardCharset.java create mode 100644 jdk/test/java/nio/charset/StandardCharset/Standard.java diff --git a/jdk/src/share/classes/java/nio/charset/Charset.java b/jdk/src/share/classes/java/nio/charset/Charset.java index 51e21c39b6b..51dbe1504dc 100644 --- a/jdk/src/share/classes/java/nio/charset/Charset.java +++ b/jdk/src/share/classes/java/nio/charset/Charset.java @@ -143,6 +143,8 @@ import sun.security.action.GetPropertyAction; * *

    Standard charsets

    * + * + * *

    Every implementation of the Java platform is required to support the * following standard charsets. Consult the release documentation for your * implementation to see if any other charsets are supported. The behavior @@ -213,6 +215,8 @@ import sun.security.action.GetPropertyAction; * determined during virtual-machine startup and typically depends upon the * locale and charset being used by the underlying operating system.

    * + *

    The {@link StandardCharset} class defines constants for each of the + * standard charsets. * *

    Terminology

    * diff --git a/jdk/src/share/classes/java/nio/charset/StandardCharset.java b/jdk/src/share/classes/java/nio/charset/StandardCharset.java new file mode 100644 index 00000000000..edec058bc45 --- /dev/null +++ b/jdk/src/share/classes/java/nio/charset/StandardCharset.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.nio.charset; + +/** + * Constant definitions for the standard {@link Charset Charsets}. These + * charsets are guaranteed to be available on every implementation of the Java + * platform. + * + * @see
    Standard Charsets + * @since 1.7 + */ +public final class StandardCharset { + + private StandardCharset() { + throw new AssertionError("No java.nio.charset.StandardCharset instances for you!"); + } + /** + * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the + * Unicode character set + */ + public static final Charset US_ASCII = Charset.forName("US-ASCII"); + /** + * ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1 + */ + public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1"); + /** + * Eight-bit UCS Transformation Format + */ + public static final Charset UTF_8 = Charset.forName("UTF-8"); + /** + * Sixteen-bit UCS Transformation Format, big-endian byte order + */ + public static final Charset UTF_16BE = Charset.forName("UTF-16BE"); + /** + * Sixteen-bit UCS Transformation Format, little-endian byte order + */ + public static final Charset UTF_16LE = Charset.forName("UTF-16LE"); + /** + * Sixteen-bit UCS Transformation Format, byte order identified by an + * optional byte-order mark + */ + public static final Charset UTF_16 = Charset.forName("UTF-16"); +} diff --git a/jdk/src/share/classes/java/nio/file/Path.java b/jdk/src/share/classes/java/nio/file/Path.java index ccf0c808d61..2d2e977d49d 100644 --- a/jdk/src/share/classes/java/nio/file/Path.java +++ b/jdk/src/share/classes/java/nio/file/Path.java @@ -72,7 +72,7 @@ import java.util.Iterator; * directory and is UTF-8 encoded. *
      *     Path path = FileSystems.getDefault().getPath("logs", "access.log");
    - *     BufferReader reader = Files.newBufferedReader(path, Charset.forName("UTF-8"));
    + *     BufferReader reader = Files.newBufferedReader(path, StandardCharset.UTF_8);
      * 
    * *

    Interoperability

    diff --git a/jdk/src/share/classes/java/util/zip/ZipCoder.java b/jdk/src/share/classes/java/util/zip/ZipCoder.java index 8e30fe5c8d7..a649c7056a3 100644 --- a/jdk/src/share/classes/java/util/zip/ZipCoder.java +++ b/jdk/src/share/classes/java/util/zip/ZipCoder.java @@ -28,6 +28,7 @@ package java.util.zip; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; +import java.nio.charset.StandardCharset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; @@ -87,7 +88,7 @@ final class ZipCoder { if (isutf8) return getBytes(s); if (utf8 == null) - utf8 = new ZipCoder(Charset.forName("UTF-8")); + utf8 = new ZipCoder(StandardCharset.UTF_8); return utf8.getBytes(s); } @@ -96,7 +97,7 @@ final class ZipCoder { if (isutf8) return toString(ba, len); if (utf8 == null) - utf8 = new ZipCoder(Charset.forName("UTF-8")); + utf8 = new ZipCoder(StandardCharset.UTF_8); return utf8.toString(ba, len); } @@ -112,7 +113,7 @@ final class ZipCoder { private ZipCoder(Charset cs) { this.cs = cs; - this.isutf8 = cs.name().equals("UTF-8"); + this.isutf8 = cs.name().equals(StandardCharset.UTF_8.name()); } static ZipCoder get(Charset charset) { diff --git a/jdk/src/share/classes/java/util/zip/ZipFile.java b/jdk/src/share/classes/java/util/zip/ZipFile.java index 9cfbe826629..d1861ad732c 100644 --- a/jdk/src/share/classes/java/util/zip/ZipFile.java +++ b/jdk/src/share/classes/java/util/zip/ZipFile.java @@ -31,6 +31,7 @@ import java.io.IOException; import java.io.EOFException; import java.io.File; import java.nio.charset.Charset; +import java.nio.charset.StandardCharset; import java.util.ArrayDeque; import java.util.Deque; import java.util.Enumeration; @@ -140,7 +141,7 @@ class ZipFile implements ZipConstants, Closeable { * @since 1.3 */ public ZipFile(File file, int mode) throws IOException { - this(file, mode, Charset.forName("UTF-8")); + this(file, mode, StandardCharset.UTF_8); } /** diff --git a/jdk/src/share/classes/java/util/zip/ZipInputStream.java b/jdk/src/share/classes/java/util/zip/ZipInputStream.java index 77d353a9a7a..ebfcce146cc 100644 --- a/jdk/src/share/classes/java/util/zip/ZipInputStream.java +++ b/jdk/src/share/classes/java/util/zip/ZipInputStream.java @@ -30,6 +30,7 @@ import java.io.IOException; import java.io.EOFException; import java.io.PushbackInputStream; import java.nio.charset.Charset; +import java.nio.charset.StandardCharset; import static java.util.zip.ZipConstants64.*; /** @@ -75,7 +76,7 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants { * @param in the actual input stream */ public ZipInputStream(InputStream in) { - this(in, Charset.forName("UTF-8")); + this(in, StandardCharset.UTF_8); } /** diff --git a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java index fa7b96d9e1c..c0b59488002 100644 --- a/jdk/src/share/classes/java/util/zip/ZipOutputStream.java +++ b/jdk/src/share/classes/java/util/zip/ZipOutputStream.java @@ -28,6 +28,7 @@ package java.util.zip; import java.io.OutputStream; import java.io.IOException; import java.nio.charset.Charset; +import java.nio.charset.StandardCharset; import java.util.Vector; import java.util.HashSet; import static java.util.zip.ZipConstants64.*; @@ -100,7 +101,7 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants { * @param out the actual output stream */ public ZipOutputStream(OutputStream out) { - this(out, Charset.forName("UTF-8")); + this(out, StandardCharset.UTF_8); } /** diff --git a/jdk/src/share/classes/sun/awt/FontDescriptor.java b/jdk/src/share/classes/sun/awt/FontDescriptor.java index 704fbecb8ee..e98ec65e029 100644 --- a/jdk/src/share/classes/sun/awt/FontDescriptor.java +++ b/jdk/src/share/classes/sun/awt/FontDescriptor.java @@ -26,6 +26,7 @@ package sun.awt; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; +import java.nio.charset.StandardCharset; import sun.nio.cs.HistoricallyNamedCharset; public class FontDescriptor implements Cloneable { @@ -104,8 +105,8 @@ public class FontDescriptor implements Cloneable { if (useUnicode && unicodeEncoder == null) { try { this.unicodeEncoder = isLE? - Charset.forName("UTF_16LE").newEncoder(): - Charset.forName("UTF_16BE").newEncoder(); + StandardCharset.UTF_16LE.newEncoder(): + StandardCharset.UTF_16BE.newEncoder(); } catch (IllegalArgumentException x) {} } return useUnicode; diff --git a/jdk/test/java/nio/charset/StandardCharset/Standard.java b/jdk/test/java/nio/charset/StandardCharset/Standard.java new file mode 100644 index 00000000000..a1b71a39c90 --- /dev/null +++ b/jdk/test/java/nio/charset/StandardCharset/Standard.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 4884238 + * @summary Test standard charset name constants. + * @author Mike Duigou + * @run main Standard + */ + +import java.nio.charset.*; + +public class Standard { + + public static void realMain(String[] args) { + check(StandardCharset.US_ASCII instanceof Charset); + check(StandardCharset.ISO_8859_1 instanceof Charset); + check(StandardCharset.UTF_8 instanceof Charset); + check(StandardCharset.UTF_16BE instanceof Charset); + check(StandardCharset.UTF_16LE instanceof Charset); + check(StandardCharset.UTF_16 instanceof Charset); + + check("US-ASCII".equals(StandardCharset.US_ASCII.name()); + check("ISO-8859-1".equals(StandardCharset.ISO_8859_1.name()); + check("UTF-8".equals(StandardCharset.UTF_8.name()); + check("UTF-16BE".equals(StandardCharset.UTF_16BE.name()); + check("UTF-16LE".equals(StandardCharset.UTF_16LE.name()); + check("UTF-16".equals(StandardCharset.UTF_16.name()); + } + + //--------------------- Infrastructure --------------------------- + static volatile int passed = 0, failed = 0; + static void pass() { passed++; } + static void fail() { failed++; Thread.dumpStack(); } + static void fail(String msg) { System.out.println(msg); fail(); } + static void unexpected(Throwable t) { failed++; t.printStackTrace(); } + static void check(boolean cond) { if (cond) pass(); else fail(); } + static void equal(Object x, Object y) { + if (x == null ? y == null : x.equals(y)) pass(); + else {System.out.println(x + " not equal to " + y); fail();}} + static void equal2(Object x, Object y) {equal(x, y); equal(y, x);} + public static void main(String[] args) throws Throwable { + try { realMain(args); } catch (Throwable t) { unexpected(t); } + + System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); + if (failed > 0) throw new Exception("Some tests failed"); + } + private static abstract class Fun {abstract void f() throws Throwable;} + private static void THROWS(Class k, Fun... fs) { + for (Fun f : fs) + try { f.f(); fail("Expected " + k.getName() + " not thrown"); } + catch (Throwable t) { + if (k.isAssignableFrom(t.getClass())) pass(); + else unexpected(t);}} + static byte[] serializedForm(Object obj) { + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + new ObjectOutputStream(baos).writeObject(obj); + return baos.toByteArray(); + } catch (IOException e) { throw new Error(e); }} + static Object readObject(byte[] bytes) + throws IOException, ClassNotFoundException { + InputStream is = new ByteArrayInputStream(bytes); + return new ObjectInputStream(is).readObject();} + @SuppressWarnings("unchecked") + static T serialClone(T obj) { + try { return (T) readObject(serializedForm(obj)); } + catch (Exception e) { throw new Error(e); }} + +} From 74225e1f348d38e278a9e1d7cc63cf80b030328e Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Tue, 26 Apr 2011 16:20:22 -0700 Subject: [PATCH 048/117] 6631003: Add hg tip changeset to build image Reviewed-by: mduigou --- hotspot/.hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgignore b/hotspot/.hgignore index 9818ff1af6e..482470820ef 100644 --- a/hotspot/.hgignore +++ b/hotspot/.hgignore @@ -5,3 +5,4 @@ ^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/ ^src/share/tools/IdealGraphVisualizer/build/ ^src/share/tools/IdealGraphVisualizer/dist/ +^.hgtip From c2bdfcee053972c4255c9eb8f6163651d928afa6 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Tue, 26 Apr 2011 16:22:41 -0700 Subject: [PATCH 049/117] 6631003: Add hg tip changeset to build image Reviewed-by: mduigou --- langtools/.hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgignore b/langtools/.hgignore index 0092bd4ff5a..83cef213d48 100644 --- a/langtools/.hgignore +++ b/langtools/.hgignore @@ -1,3 +1,4 @@ ^build/ ^dist/ /nbproject/private/ +^.hgtip From 5c45b515379778f70fca3088f3d33c1a52c3a703 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Tue, 26 Apr 2011 16:28:05 -0700 Subject: [PATCH 050/117] 6631003: Add hg tip changeset to build image Reviewed-by: mduigou --- jaxws/.hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgignore b/jaxws/.hgignore index 32df842b67c..970fc82946b 100644 --- a/jaxws/.hgignore +++ b/jaxws/.hgignore @@ -4,3 +4,4 @@ ^drop_included/ ^webrev/ /nbproject/private/ +^.hgtip From a6c3e8087800a58415b027d3261077aa72e9483b Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Tue, 26 Apr 2011 16:28:22 -0700 Subject: [PATCH 051/117] 6631003: Add hg tip changeset to build image Reviewed-by: mduigou --- jaxp/.hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgignore b/jaxp/.hgignore index 32df842b67c..970fc82946b 100644 --- a/jaxp/.hgignore +++ b/jaxp/.hgignore @@ -4,3 +4,4 @@ ^drop_included/ ^webrev/ /nbproject/private/ +^.hgtip From d2dbecb06ba630ec1886f93e0c63225c562b584c Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Tue, 26 Apr 2011 16:29:35 -0700 Subject: [PATCH 052/117] 6631003: Add hg tip changeset to build image Reviewed-by: mduigou --- corba/.hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgignore b/corba/.hgignore index 0092bd4ff5a..83cef213d48 100644 --- a/corba/.hgignore +++ b/corba/.hgignore @@ -1,3 +1,4 @@ ^build/ ^dist/ /nbproject/private/ +^.hgtip From 4231fbb3e6cc58de5fa54e0b085e5e37b4198529 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Tue, 26 Apr 2011 16:30:00 -0700 Subject: [PATCH 053/117] 6631003: Add hg tip changeset to build image Reviewed-by: mduigou --- .hgignore | 1 + Makefile | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.hgignore b/.hgignore index 2d339f9988c..8fde2caf08d 100644 --- a/.hgignore +++ b/.hgignore @@ -2,3 +2,4 @@ ^dist/ /nbproject/private/ ^webrev +^.hgtip diff --git a/Makefile b/Makefile index 1d20f79bf83..c8598161cec 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ define StopTimer endef # Generic build of basic repo series -generic_build_repo_series:: +generic_build_repo_series:: $(SOURCE_TIPS) $(MKDIR) -p $(OUTPUTDIR) $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image @$(call StartTimer) @@ -243,6 +243,14 @@ product_build:: build_product_image debug_build:: build_debug_image fastdebug_build:: build_fastdebug_image +# The source tips are stored with the relative path to the repo. +# This file will be used when constructing the jdk image. +source_tips: $(SOURCE_TIPS) + $(CAT) $< +$(SOURCE_TIPS): FRC + @$(prep-target) + @$(call GetSourceTips) + clobber:: REPORT_BUILD_TIMES= clobber:: $(RM) -r $(OUTPUTDIR)/* From d86311b13c33ae4598c029cfe4e7ec1714ce0a84 Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Tue, 26 Apr 2011 21:17:24 -0700 Subject: [PATCH 054/117] 7039089: G1: changeset for 7037276 broke heap verification, and related cleanups In G1 heap verification, we no longer scan perm to G1-collected heap refs as part of process_strong_roots() but rather in a separate explicit oop iteration over the perm gen. This preserves the original perm card-marks. Added a new assertion in younger_refs_iterate() to catch a simple subcase where the user may have forgotten a prior save_marks() call, as happened in the case of G1's attempt to iterate perm to G1 refs when verifying the heap before exit. The assert was deliberately weakened for ParNew+CMS and will be fixed for that combination in a future CR. Also made some (non-G1) cleanups related to code and comments obsoleted by the migration of Symbols to the native heap. Reviewed-by: iveresov, jmasa, tonyp --- .../compactibleFreeListSpace.cpp | 13 ++++++++- .../concurrentMarkSweepGeneration.cpp | 5 ++-- .../gc_implementation/g1/g1CollectedHeap.cpp | 19 ++++++++---- hotspot/src/share/vm/memory/cardTableRS.cpp | 29 ++++++++++++++++++- .../src/share/vm/memory/genCollectedHeap.hpp | 6 ++-- hotspot/src/share/vm/memory/sharedHeap.cpp | 11 ++----- hotspot/src/share/vm/memory/sharedHeap.hpp | 10 +++---- hotspot/src/share/vm/runtime/vmThread.cpp | 4 ++- 8 files changed, 69 insertions(+), 28 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index 50e073d24aa..482aa15752a 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -1963,10 +1963,21 @@ CompactibleFreeListSpace::gc_epilogue() { // Iteration support, mostly delegated from a CMS generation void CompactibleFreeListSpace::save_marks() { - // mark the "end" of the used space at the time of this call; + assert(Thread::current()->is_VM_thread(), + "Global variable should only be set when single-threaded"); + // Mark the "end" of the used space at the time of this call; // note, however, that promoted objects from this point // on are tracked in the _promoInfo below. set_saved_mark_word(unallocated_block()); +#ifdef ASSERT + // Check the sanity of save_marks() etc. + MemRegion ur = used_region(); + MemRegion urasm = used_region_at_save_marks(); + assert(ur.contains(urasm), + err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")" + " should contain [" PTR_FORMAT "," PTR_FORMAT ")", + ur.start(), ur.end(), urasm.start(), urasm.end())); +#endif // inform allocator that promotions should be tracked. assert(_promoInfo.noPromotions(), "_promoInfo inconsistency"); _promoInfo.startTrackingPromotions(); diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 307a8500ca6..bd49b0f9fc6 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -3189,10 +3189,9 @@ bool ConcurrentMarkSweepGeneration::is_too_full() const { } void CMSCollector::setup_cms_unloading_and_verification_state() { - const bool should_verify = VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC + const bool should_verify = VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC || VerifyBeforeExit; - const int rso = SharedHeap::SO_Symbols | SharedHeap::SO_Strings - | SharedHeap::SO_CodeCache; + const int rso = SharedHeap::SO_Strings | SharedHeap::SO_CodeCache; if (should_unload_classes()) { // Should unload classes this cycle remove_root_scanning_option(rso); // Shrink the root set appropriately diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index d8a9c07f522..642c7acb74e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2805,17 +2805,26 @@ void G1CollectedHeap::verify(bool allow_dirty, bool silent, bool use_prev_marking) { if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) { - if (!silent) { gclog_or_tty->print("roots "); } + if (!silent) { gclog_or_tty->print("Roots (excluding permgen) "); } VerifyRootsClosure rootsCl(use_prev_marking); CodeBlobToOopClosure blobsCl(&rootsCl, /*do_marking=*/ false); - process_strong_roots(true, // activate StrongRootsScope - false, - SharedHeap::SO_AllClasses, + // We apply the relevant closures to all the oops in the + // system dictionary, the string table and the code cache. + const int so = SharedHeap::SO_AllClasses | SharedHeap::SO_Strings | SharedHeap::SO_CodeCache; + process_strong_roots(true, // activate StrongRootsScope + true, // we set "collecting perm gen" to true, + // so we don't reset the dirty cards in the perm gen. + SharedHeap::ScanningOption(so), // roots scanning options &rootsCl, &blobsCl, &rootsCl); + // Since we used "collecting_perm_gen" == true above, we will not have + // checked the refs from perm into the G1-collected heap. We check those + // references explicitly below. Whether the relevant cards are dirty + // is checked further below in the rem set verification. + if (!silent) { gclog_or_tty->print("Permgen roots "); } + perm_gen()->oop_iterate(&rootsCl); bool failures = rootsCl.failures(); - rem_set()->invalidate(perm_gen()->used_region(), false); if (!silent) { gclog_or_tty->print("HeapRegionSets "); } verify_region_sets(); if (!silent) { gclog_or_tty->print("HeapRegions "); } diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp index 4a22ba73a21..551ba7eb8a4 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.cpp +++ b/hotspot/src/share/vm/memory/cardTableRS.cpp @@ -250,7 +250,34 @@ void CardTableRS::younger_refs_in_space_iterate(Space* sp, cl->gen_boundary()); ClearNoncleanCardWrapper clear_cl(dcto_cl, this); - _ct_bs->non_clean_card_iterate_possibly_parallel(sp, sp->used_region_at_save_marks(), + const MemRegion urasm = sp->used_region_at_save_marks(); +#ifdef ASSERT + // Convert the assertion check to a warning if we are running + // CMS+ParNew until related bug is fixed. + MemRegion ur = sp->used_region(); + assert(ur.contains(urasm) || (UseConcMarkSweepGC && UseParNewGC), + err_msg("Did you forget to call save_marks()? " + "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in " + "[" PTR_FORMAT ", " PTR_FORMAT ")", + urasm.start(), urasm.end(), ur.start(), ur.end())); + // In the case of CMS+ParNew, issue a warning + if (!ur.contains(urasm)) { + assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above"); + warning("CMS+ParNew: Did you forget to call save_marks()? " + "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in " + "[" PTR_FORMAT ", " PTR_FORMAT ")", + urasm.start(), urasm.end(), ur.start(), ur.end()); + MemRegion ur2 = sp->used_region(); + MemRegion urasm2 = sp->used_region_at_save_marks(); + if (!ur.equals(ur2)) { + warning("CMS+ParNew: Flickering used_region()!!"); + } + if (!urasm.equals(urasm2)) { + warning("CMS+ParNew: Flickering used_region_at_save_marks()!!"); + } + } +#endif + _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, dcto_cl, &clear_cl); } diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp index de8070b81c7..383936699d6 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp @@ -427,13 +427,13 @@ public: // explicitly mark reachable objects in younger generations, to avoid // excess storage retention.) If "collecting_perm_gen" is false, then // roots that may only contain references to permGen objects are not - // scanned. The "so" argument determines which of the roots + // scanned; instead, the older_gens closure is applied to all outgoing + // references in the perm gen. The "so" argument determines which of the roots // the closure is applied to: // "SO_None" does none; // "SO_AllClasses" applies the closure to all entries in the SystemDictionary; // "SO_SystemClasses" to all the "system" classes and loaders; - // "SO_Symbols_and_Strings" applies the closure to all entries in - // SymbolsTable and StringTable. + // "SO_Strings" applies the closure to all entries in the StringTable. void gen_process_strong_roots(int level, bool younger_gens_as_roots, // The remaining arguments are in an order diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index 37c17b03861..24a2373acec 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -46,7 +46,6 @@ enum SH_process_strong_roots_tasks { SH_PS_Management_oops_do, SH_PS_SystemDictionary_oops_do, SH_PS_jvmti_oops_do, - SH_PS_SymbolTable_oops_do, SH_PS_StringTable_oops_do, SH_PS_CodeCache_oops_do, // Leave this one last. @@ -161,13 +160,9 @@ void SharedHeap::process_strong_roots(bool activate_scope, if (!_process_strong_tasks->is_task_claimed(SH_PS_SystemDictionary_oops_do)) { if (so & SO_AllClasses) { SystemDictionary::oops_do(roots); - } else - if (so & SO_SystemClasses) { - SystemDictionary::always_strong_oops_do(roots); - } - } - - if (!_process_strong_tasks->is_task_claimed(SH_PS_SymbolTable_oops_do)) { + } else if (so & SO_SystemClasses) { + SystemDictionary::always_strong_oops_do(roots); + } } if (!_process_strong_tasks->is_task_claimed(SH_PS_StringTable_oops_do)) { diff --git a/hotspot/src/share/vm/memory/sharedHeap.hpp b/hotspot/src/share/vm/memory/sharedHeap.hpp index 54af68a421f..55a9b569d9c 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.hpp +++ b/hotspot/src/share/vm/memory/sharedHeap.hpp @@ -192,9 +192,8 @@ public: SO_None = 0x0, SO_AllClasses = 0x1, SO_SystemClasses = 0x2, - SO_Symbols = 0x4, - SO_Strings = 0x8, - SO_CodeCache = 0x10 + SO_Strings = 0x4, + SO_CodeCache = 0x8 }; FlexibleWorkGang* workers() const { return _workers; } @@ -208,14 +207,13 @@ public: // Invoke the "do_oop" method the closure "roots" on all root locations. // If "collecting_perm_gen" is false, then roots that may only contain - // references to permGen objects are not scanned. If true, the - // "perm_gen" closure is applied to all older-to-younger refs in the + // references to permGen objects are not scanned; instead, in that case, + // the "perm_blk" closure is applied to all outgoing refs in the // permanent generation. The "so" argument determines which of roots // the closure is applied to: // "SO_None" does none; // "SO_AllClasses" applies the closure to all entries in the SystemDictionary; // "SO_SystemClasses" to all the "system" classes and loaders; - // "SO_Symbols" applies the closure to all entries in SymbolsTable; // "SO_Strings" applies the closure to all entries in StringTable; // "SO_CodeCache" applies the closure to all elements of the CodeCache. void process_strong_roots(bool activate_scope, diff --git a/hotspot/src/share/vm/runtime/vmThread.cpp b/hotspot/src/share/vm/runtime/vmThread.cpp index 68890c7d9de..c50e0a1d7a7 100644 --- a/hotspot/src/share/vm/runtime/vmThread.cpp +++ b/hotspot/src/share/vm/runtime/vmThread.cpp @@ -291,7 +291,9 @@ void VMThread::run() { // Among other things, this ensures that Eden top is correct. Universe::heap()->prepare_for_verify(); os::check_heap(); - Universe::verify(true, true); // Silent verification to not polute normal output + // Silent verification so as not to pollute normal output, + // unless we really asked for it. + Universe::verify(true, !(PrintGCDetails || Verbose)); } CompileBroker::set_should_block(); From 1037728a0377bb71fe0fc6e96374004c34527271 Mon Sep 17 00:00:00 2001 From: Shinya Ogino Date: Tue, 26 Apr 2011 21:46:20 -0700 Subject: [PATCH 055/117] 7036955: Japanese man pages in linux should be in utf-8 encoding Reviewed-by: ohair, mfang --- jdk/make/common/Defs-linux.gmk | 2 +- jdk/make/common/Release.gmk | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/jdk/make/common/Defs-linux.gmk b/jdk/make/common/Defs-linux.gmk index fcaad70af32..ee2f8ca43a4 100644 --- a/jdk/make/common/Defs-linux.gmk +++ b/jdk/make/common/Defs-linux.gmk @@ -355,7 +355,7 @@ HAVE_DPS = no # Japanese manpages # JA_SOURCE_ENCODING = eucJP -JA_TARGET_ENCODINGS = eucJP +JA_TARGET_ENCODINGS = UTF-8 # Settings for the JDI - Serviceability Agent binding. HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH) diff --git a/jdk/make/common/Release.gmk b/jdk/make/common/Release.gmk index 17297d573b0..defc1453018 100644 --- a/jdk/make/common/Release.gmk +++ b/jdk/make/common/Release.gmk @@ -164,7 +164,7 @@ endif # solaris ifeq ($(PLATFORM), linux) MANBASEDIRS=$(JDK_TOPDIR)/src/linux/doc $(IMPORTDOCDIR) MAN1SUBDIR=man - JA_DIRNAME=ja_JP.$(JA_SOURCE_ENCODING) + JA_DIRNAME=ja_JP.UTF-8 endif # linux define copy-man-pages @@ -190,8 +190,7 @@ for manbase in $(MANBASEDIRS:%=%/$(MAN1SUBDIR)) ; do \ done $(java-vm-cleanup) if [ "$(JA_DIRNAME)" != "" ] ; then \ - $(MV) $1/man/ja $1/man/$(JA_DIRNAME); \ - $(CD) $1/man && $(LN) -s $(JA_DIRNAME) ja; \ + $(CD) $1/man && $(RM) ja && $(LN) -s $(JA_DIRNAME) ja; \ fi endef From d21b9aa7bfc5ac29b551a95466d4e8576f9703e2 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Wed, 27 Apr 2011 12:15:34 +0400 Subject: [PATCH 056/117] 7037091: sun/java2d/pipe/Test7027667.java test is not executed Reviewed-by: prr --- jdk/test/sun/java2d/pipe/Test7027667.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/sun/java2d/pipe/Test7027667.java b/jdk/test/sun/java2d/pipe/Test7027667.java index 08f478f60b1..e30c72c0504 100644 --- a/jdk/test/sun/java2d/pipe/Test7027667.java +++ b/jdk/test/sun/java2d/pipe/Test7027667.java @@ -23,7 +23,7 @@ /** * @test - * @bug 7027667, 7023591 + * @bug 7027667 7023591 7037091 * * @summary Verifies that aa clipped rectangles are drawn, not filled. * From a9a765fdfc0e0db1da7669b03b795acb7475ee84 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 27 Apr 2011 17:11:06 +0800 Subject: [PATCH 057/117] 6950929: Failures on Solaris sparc 64bit sun/security/krb5/auto/BadKdc4.java (and linux?) Reviewed-by: xuelei --- jdk/test/sun/security/krb5/auto/BadKdc.java | 80 +++++++++++++++++++-- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/jdk/test/sun/security/krb5/auto/BadKdc.java b/jdk/test/sun/security/krb5/auto/BadKdc.java index 0b175129d1f..55a4d9926f2 100644 --- a/jdk/test/sun/security/krb5/auto/BadKdc.java +++ b/jdk/test/sun/security/krb5/auto/BadKdc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,8 +22,14 @@ */ import java.io.*; +import java.net.BindException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.security.auth.login.LoginException; +import sun.security.krb5.Asn1Exception; import sun.security.krb5.Config; public class BadKdc { @@ -34,8 +40,51 @@ public class BadKdc { static final Pattern re = Pattern.compile( ">>> KDCCommunication: kdc=kdc.rabbit.hole UDP:(\\d)...., " + "timeout=(\\d)000,"); + + /* + * There are several cases this test fails: + * + * 1. The random selected port is used by another process. No good way to + * prevent this happening, coz krb5.conf must be written before KDC starts. + * There are two different outcomes: + * + * a. Cannot start the KDC. A BindException thrown. + * b. When trying to access a non-existing KDC, a response is received! + * Most likely a Asn1Exception thrown + * + * 2. Even if a KDC is started, and more than 20 seconds pass by, a timeout + * can still happens for the first UDP request. In fact, the KDC did not + * received it at all. This happens on almost all platforms, especially + * solaris-i586 and solaris-x64. + * + * To avoid them: + * + * 1. Catch those exceptions and ignore + * + * 2. a. Make the timeout longer? useless + * b. Read the output carefully, if there is a timeout, it's OK. + * Just make sure the retries times and KDCs are correct. + * This is tough. + * c. Feed the KDC a UDP packet first. The current "solution". + */ public static void go(int[]... expected) throws Exception { + try { + go0(expected); + } catch (BindException be) { + System.out.println("The random port is used by another process"); + } catch (LoginException le) { + Throwable cause = le.getCause(); + if (cause instanceof Asn1Exception) { + System.out.println("Bad packet possibly from another process"); + return; + } + throw le; + } + } + + public static void go0(int[]... expected) + throws Exception { System.setProperty("sun.security.krb5.debug", "true"); // Make sure KDCs' ports starts with 1 and 2 and 3, @@ -78,20 +127,39 @@ public class BadKdc { KDC k = new KDC(OneKDC.REALM, OneKDC.KDCHOST, p, true); k.addPrincipal(OneKDC.USER, OneKDC.PASS); k.addPrincipalRandKey("krbtgt/" + OneKDC.REALM); + // Feed a packet to newly started KDC to warm it up + System.err.println("-------- IGNORE THIS ERROR MESSAGE --------"); + new DatagramSocket().send( + new DatagramPacket("Hello".getBytes(), 5, + InetAddress.getByName(OneKDC.KDCHOST), p)); return k; } + private static void test(int... expected) throws Exception { + ByteArrayOutputStream bo = new ByteArrayOutputStream(); + try { + test0(bo, expected); + } catch (Exception e) { + System.out.println("----------------- ERROR -----------------"); + System.out.println(new String(bo.toByteArray())); + System.out.println("--------------- ERROR END ---------------"); + throw e; + } + } + /** * One round of test for max_retries and timeout. - * @param timeout the expected timeout * @param expected the expected kdc# timeout kdc# timeout... */ - private static void test(int... expected) throws Exception { - ByteArrayOutputStream bo = new ByteArrayOutputStream(); + private static void test0(ByteArrayOutputStream bo, int... expected) + throws Exception { PrintStream oldout = System.out; System.setOut(new PrintStream(bo)); - Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); - System.setOut(oldout); + try { + Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + } finally { + System.setOut(oldout); + } String[] lines = new String(bo.toByteArray()).split("\n"); System.out.println("----------------- TEST -----------------"); From aa161ffe8d9b643893b13bed12468f399f71e66d Mon Sep 17 00:00:00 2001 From: Pavel Porvatov Date: Wed, 27 Apr 2011 13:43:22 +0400 Subject: [PATCH 058/117] 7039403: Could not compile test/javax/swing/JLabel/6596966/bug6596966.java Reviewed-by: malenkov --- jdk/test/javax/swing/JLabel/6596966/bug6596966.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jdk/test/javax/swing/JLabel/6596966/bug6596966.java b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java index 5cf0110f700..5e94459bcb7 100644 --- a/jdk/test/javax/swing/JLabel/6596966/bug6596966.java +++ b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java @@ -24,13 +24,13 @@ /* @test @bug 6596966 @summary Some JFileChooser mnemonics do not work with sticky keys - * @library ../../regtesthelpers - * @build Util @run main bug6596966 @author Pavel Porvatov */ +import sun.awt.SunToolkit; + import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; @@ -44,6 +44,7 @@ public class bug6596966 { public static void main(String[] args) throws Exception { Robot robot = new Robot(); + SunToolkit toolkit = (SunToolkit) SunToolkit.getDefaultToolkit(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -68,17 +69,17 @@ public class bug6596966 { } }); - Util.blockTillDisplayed(frame); + toolkit.realSync(); robot.keyPress(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_L); - robot.waitForIdle(); + toolkit.realSync(); - Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED, + toolkit.getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_L, 'L')); - robot.waitForIdle(); + toolkit.realSync(); try { SwingUtilities.invokeAndWait(new Runnable() { From f5afc05e608009a6805b59072f44a983c1b81350 Mon Sep 17 00:00:00 2001 From: Denis Fokin Date: Wed, 27 Apr 2011 14:58:40 +0400 Subject: [PATCH 059/117] 7020922: java.awt.Toolkit.getPropertyChangeListeners() should mention that it returns proxies Reviewed-by: malenkov --- jdk/src/share/classes/java/awt/Toolkit.java | 40 ++++++++++++++------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Toolkit.java b/jdk/src/share/classes/java/awt/Toolkit.java index 58a4ddc7b4f..6e00e6afdbf 100644 --- a/jdk/src/share/classes/java/awt/Toolkit.java +++ b/jdk/src/share/classes/java/awt/Toolkit.java @@ -1870,11 +1870,15 @@ public abstract class Toolkit { /** * Adds the specified property change listener for the named desktop - * property. - * If pcl is null, no exception is thrown and no action is performed. + * property. When a {@link PropertyChangeListenerProxy} object is added, + * its property name is ignored, and the wrapped listener is added. + * If {@code name} is {@code null} or {@code pcl} is {@code null}, + * no exception is thrown and no action is performed. * * @param name The name of the property to listen for * @param pcl The property change listener + * @see PropertyChangeSupport#addPropertyChangeListener(String, + PropertyChangeListener) * @since 1.2 */ public void addPropertyChangeListener(String name, PropertyChangeListener pcl) { @@ -1883,11 +1887,16 @@ public abstract class Toolkit { /** * Removes the specified property change listener for the named - * desktop property. - * If pcl is null, no exception is thrown and no action is performed. + * desktop property. When a {@link PropertyChangeListenerProxy} object + * is removed, its property name is ignored, and + * the wrapped listener is removed. + * If {@code name} is {@code null} or {@code pcl} is {@code null}, + * no exception is thrown and no action is performed. * * @param name The name of the property to remove * @param pcl The property change listener + * @see PropertyChangeSupport#removePropertyChangeListener(String, + PropertyChangeListener) * @since 1.2 */ public void removePropertyChangeListener(String name, PropertyChangeListener pcl) { @@ -1896,12 +1905,15 @@ public abstract class Toolkit { /** * Returns an array of all the property change listeners - * registered on this toolkit. + * registered on this toolkit. The returned array + * contains {@code PropertyChangeListenerProxy} objects + * that associate listeners with the names of desktop properties. * - * @return all of this toolkit's PropertyChangeListeners - * or an empty array if no property change - * listeners are currently registered + * @return all of this toolkit's {@ code PropertyChangeListener} + * objects wrapped in {@code PropertyChangeListenerProxy} objects + * or an empty array if no listeners are added * + * @see PropertyChangeSupport#getPropertyChangeListeners() * @since 1.4 */ public PropertyChangeListener[] getPropertyChangeListeners() { @@ -1909,13 +1921,15 @@ public abstract class Toolkit { } /** - * Returns an array of all the PropertyChangeListeners - * associated with the named property. + * Returns an array of all property change listeners + * associated with the specified name of a desktop property. * * @param propertyName the named property - * @return all of the PropertyChangeListeners associated with - * the named property or an empty array if no such listeners have - * been added + * @return all of the {@code PropertyChangeListener} objects + * associated with the specified name of a desktop property + * or an empty array if no such listeners are added + * + * @see PropertyChangeSupport#getPropertyChangeListeners(String) * @since 1.4 */ public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) { From 57f34d2482bcdc2c4636cc64b5072af3e03e930f Mon Sep 17 00:00:00 2001 From: Oleg Pekhovskiy Date: Wed, 27 Apr 2011 15:26:38 +0400 Subject: [PATCH 060/117] 7035209: 6u26 ea b01 - running an applet with old plugin crashes in awt.dll Reviewed-by: art, amenkov --- jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp b/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp index a7da3f3b38c..a563c78802b 100644 --- a/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp +++ b/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp @@ -187,6 +187,7 @@ void D3DPipelineManager::NotifyAdapterEventListeners(UINT adapter, } JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + RETURN_IF_NULL(env); pMgr = D3DPipelineManager::GetInstance(); RETURN_IF_NULL(pMgr); From bbadc1bb04c299aa5a6a7d94f615069c532b0a41 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Wed, 27 Apr 2011 13:46:22 +0100 Subject: [PATCH 061/117] 7039186: (ch) EPoll based asynchronous I/O implementation should be portable to linux-arm and linux-ppc Reviewed-by: dholmes --- jdk/make/java/nio/mapfile-linux | 2 - jdk/src/solaris/classes/sun/nio/ch/EPoll.java | 3 - .../classes/sun/nio/fs/LinuxWatchService.java | 3 - jdk/src/solaris/native/sun/nio/ch/EPoll.c | 56 ++----------------- .../native/sun/nio/fs/LinuxWatchService.c | 50 ++--------------- 5 files changed, 8 insertions(+), 106 deletions(-) diff --git a/jdk/make/java/nio/mapfile-linux b/jdk/make/java/nio/mapfile-linux index 7af5388de96..d72244170b9 100644 --- a/jdk/make/java/nio/mapfile-linux +++ b/jdk/make/java/nio/mapfile-linux @@ -44,7 +44,6 @@ SUNWprivate_1.1 { Java_sun_nio_ch_EPollArrayWrapper_interrupt; Java_sun_nio_ch_EPollArrayWrapper_offsetofData; Java_sun_nio_ch_EPollArrayWrapper_sizeofEPollEvent; - Java_sun_nio_ch_EPoll_init; Java_sun_nio_ch_EPoll_eventSize; Java_sun_nio_ch_EPoll_eventsOffset; Java_sun_nio_ch_EPoll_dataOffset; @@ -129,7 +128,6 @@ SUNWprivate_1.1 { Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio; Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs; Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs; - Java_sun_nio_fs_LinuxWatchService_init; Java_sun_nio_fs_LinuxWatchService_eventSize; Java_sun_nio_fs_LinuxWatchService_eventOffsets; Java_sun_nio_fs_LinuxWatchService_inotifyInit; diff --git a/jdk/src/solaris/classes/sun/nio/ch/EPoll.java b/jdk/src/solaris/classes/sun/nio/ch/EPoll.java index 8af24f8c793..78bc83c8549 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/EPoll.java +++ b/jdk/src/solaris/classes/sun/nio/ch/EPoll.java @@ -99,8 +99,6 @@ class EPoll { // -- Native methods -- - private static native void init(); - private static native int eventSize(); private static native int eventsOffset(); @@ -116,6 +114,5 @@ class EPoll { static { Util.load(); - init(); } } diff --git a/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java b/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java index 31d3bf0770f..5726fe317ab 100644 --- a/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java +++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxWatchService.java @@ -432,8 +432,6 @@ class LinuxWatchService // -- native methods -- - private static native void init(); - // sizeof inotify_event private static native int eventSize(); @@ -461,6 +459,5 @@ class LinuxWatchService System.loadLibrary("nio"); return null; }}); - init(); } } diff --git a/jdk/src/solaris/native/sun/nio/ch/EPoll.c b/jdk/src/solaris/native/sun/nio/ch/EPoll.c index 43efe372ad0..667270491c4 100644 --- a/jdk/src/solaris/native/sun/nio/ch/EPoll.c +++ b/jdk/src/solaris/native/sun/nio/ch/EPoll.c @@ -34,55 +34,7 @@ #include #include #include - -#ifdef __cplusplus -extern "C" { -#endif - -/* epoll_wait(2) man page */ - -typedef union epoll_data { - void *ptr; - int fd; - __uint32_t u32; - __uint64_t u64; -} epoll_data_t; - -struct epoll_event { - __uint32_t events; /* Epoll events */ - epoll_data_t data; /* User data variable */ -} __attribute__ ((__packed__)); - -#ifdef __cplusplus -} -#endif - -/* - * epoll event notification is new in 2.6 kernel. As the offical build - * platform for the JDK is on a 2.4-based distribution then we must - * obtain the addresses of the epoll functions dynamically. - */ -typedef int (*epoll_create_t)(int size); -typedef int (*epoll_ctl_t) (int epfd, int op, int fd, struct epoll_event *event); -typedef int (*epoll_wait_t) (int epfd, struct epoll_event *events, int maxevents, int timeout); - -static epoll_create_t epoll_create_func; -static epoll_ctl_t epoll_ctl_func; -static epoll_wait_t epoll_wait_func; - - -JNIEXPORT void JNICALL -Java_sun_nio_ch_EPoll_init(JNIEnv *env, jclass this) -{ - epoll_create_func = (epoll_create_t) dlsym(RTLD_DEFAULT, "epoll_create"); - epoll_ctl_func = (epoll_ctl_t) dlsym(RTLD_DEFAULT, "epoll_ctl"); - epoll_wait_func = (epoll_wait_t) dlsym(RTLD_DEFAULT, "epoll_wait"); - - if ((epoll_create_func == NULL) || (epoll_ctl_func == NULL) || - (epoll_wait_func == NULL)) { - JNU_ThrowInternalError(env, "unable to get address of epoll functions, pre-2.6 kernel?"); - } -} +#include JNIEXPORT jint JNICALL Java_sun_nio_ch_EPoll_eventSize(JNIEnv* env, jclass this) @@ -108,7 +60,7 @@ Java_sun_nio_ch_EPoll_epollCreate(JNIEnv *env, jclass c) { * epoll_create expects a size as a hint to the kernel about how to * dimension internal structures. We can't predict the size in advance. */ - int epfd = (*epoll_create_func)(256); + int epfd = epoll_create(256); if (epfd < 0) { JNU_ThrowIOExceptionWithLastError(env, "epoll_create failed"); } @@ -125,7 +77,7 @@ Java_sun_nio_ch_EPoll_epollCtl(JNIEnv *env, jclass c, jint epfd, event.events = events; event.data.fd = fd; - RESTARTABLE((*epoll_ctl_func)(epfd, (int)opcode, (int)fd, &event), res); + RESTARTABLE(epoll_ctl(epfd, (int)opcode, (int)fd, &event), res); return (res == 0) ? 0 : errno; } @@ -137,7 +89,7 @@ Java_sun_nio_ch_EPoll_epollWait(JNIEnv *env, jclass c, struct epoll_event *events = jlong_to_ptr(address); int res; - RESTARTABLE((*epoll_wait_func)(epfd, events, numfds, -1), res); + RESTARTABLE(epoll_wait(epfd, events, numfds, -1), res); if (res < 0) { JNU_ThrowIOExceptionWithLastError(env, "epoll_wait failed"); } diff --git a/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c b/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c index 0b48180cd70..ca4ce5e6f62 100644 --- a/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c +++ b/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c @@ -33,33 +33,10 @@ #include #include #include +#include #include "sun_nio_fs_LinuxWatchService.h" -/* inotify.h may not be available at build time */ -#ifdef __cplusplus -extern "C" { -#endif -struct inotify_event -{ - int wd; - uint32_t mask; - uint32_t cookie; - uint32_t len; - char name __flexarr; -}; -#ifdef __cplusplus -} -#endif - -typedef int inotify_init_func(void); -typedef int inotify_add_watch_func(int fd, const char* path, uint32_t mask); -typedef int inotify_rm_watch_func(int fd, uint32_t wd); - -inotify_init_func* my_inotify_init_func = NULL; -inotify_add_watch_func* my_inotify_add_watch_func = NULL; -inotify_rm_watch_func* my_inotify_rm_watch_func = NULL; - static void throwUnixException(JNIEnv* env, int errnum) { jobject x = JNU_NewObjectByName(env, "sun/nio/fs/UnixException", "(I)V", errnum); @@ -68,22 +45,6 @@ static void throwUnixException(JNIEnv* env, int errnum) { } } -JNIEXPORT void JNICALL -Java_sun_nio_fs_LinuxWatchService_init(JNIEnv *env, jclass clazz) -{ - my_inotify_init_func = (inotify_init_func*) - dlsym(RTLD_DEFAULT, "inotify_init"); - my_inotify_add_watch_func = - (inotify_add_watch_func*) dlsym(RTLD_DEFAULT, "inotify_add_watch"); - my_inotify_rm_watch_func = - (inotify_rm_watch_func*) dlsym(RTLD_DEFAULT, "inotify_rm_watch"); - - if ((my_inotify_init_func == NULL) || (my_inotify_add_watch_func == NULL) || - (my_inotify_rm_watch_func == NULL)) { - JNU_ThrowInternalError(env, "unable to get address of inotify functions"); - } -} - JNIEXPORT jint JNICALL Java_sun_nio_fs_LinuxWatchService_eventSize(JNIEnv *env, jclass clazz) { @@ -111,7 +72,7 @@ JNIEXPORT jint JNICALL Java_sun_nio_fs_LinuxWatchService_inotifyInit (JNIEnv* env, jclass clazz) { - int ifd = (*my_inotify_init_func)(); + int ifd = inotify_init(); if (ifd == -1) { throwUnixException(env, errno); } @@ -125,7 +86,7 @@ Java_sun_nio_fs_LinuxWatchService_inotifyAddWatch int wfd = -1; const char* path = (const char*)jlong_to_ptr(address); - wfd = (*my_inotify_add_watch_func)((int)fd, path, mask); + wfd = inotify_add_watch((int)fd, path, mask); if (wfd == -1) { throwUnixException(env, errno); } @@ -136,7 +97,7 @@ JNIEXPORT void JNICALL Java_sun_nio_fs_LinuxWatchService_inotifyRmWatch (JNIEnv* env, jclass clazz, jint fd, jint wd) { - int err = (*my_inotify_rm_watch_func)((int)fd, (int)wd); + int err = inotify_rm_watch((int)fd, (int)wd); if (err == -1) throwUnixException(env, errno); } @@ -166,7 +127,6 @@ Java_sun_nio_fs_LinuxWatchService_socketpair res[1] = (jint)sp[1]; (*env)->SetIntArrayRegion(env, sv, 0, 2, &res[0]); } - } JNIEXPORT jint JNICALL @@ -190,6 +150,4 @@ Java_sun_nio_fs_LinuxWatchService_poll } } return (jint)n; - - } From ed12b2ab1870adf1e80c6c9d03b6ce77f29b2f4d Mon Sep 17 00:00:00 2001 From: Denis Fokin Date: Wed, 27 Apr 2011 17:18:38 +0400 Subject: [PATCH 062/117] 6998716: client vm crashes making browser fails to respond under some scenarios Reviewed-by: art, denis, uta --- .../windows/native/sun/windows/ObjectList.cpp | 7 +++-- .../windows/native/sun/windows/ObjectList.h | 2 +- .../native/sun/windows/awt_Component.cpp | 7 ++--- .../native/sun/windows/awt_MenuItem.cpp | 3 +-- .../windows/native/sun/windows/awt_Object.cpp | 19 +++++++++----- .../windows/native/sun/windows/awt_Object.h | 4 +++ .../windows/native/sun/windows/awt_Robot.cpp | 3 +-- .../native/sun/windows/awt_Toolkit.cpp | 26 +++++++++++++++---- .../native/sun/windows/awt_TrayIcon.cpp | 3 +-- jdk/src/windows/native/sun/windows/awtmsg.h | 1 + 10 files changed, 51 insertions(+), 24 deletions(-) diff --git a/jdk/src/windows/native/sun/windows/ObjectList.cpp b/jdk/src/windows/native/sun/windows/ObjectList.cpp index b0614e6b97f..601c42ce2e3 100644 --- a/jdk/src/windows/native/sun/windows/ObjectList.cpp +++ b/jdk/src/windows/native/sun/windows/ObjectList.cpp @@ -48,7 +48,7 @@ void AwtObjectList::Add(AwtObject* obj) m_head = item; } -void AwtObjectList::Remove(AwtObject* obj) +BOOL AwtObjectList::Remove(AwtObject* obj) { CriticalSection::Lock l(m_lock); @@ -64,11 +64,14 @@ void AwtObjectList::Remove(AwtObject* obj) } DASSERT(item != NULL); delete item; - return; + return TRUE; } lastItem = item; item = item->next; } + + return FALSE; + // DASSERT(FALSE); // should never get here... // even if it does it shouldn't be fatal. } diff --git a/jdk/src/windows/native/sun/windows/ObjectList.h b/jdk/src/windows/native/sun/windows/ObjectList.h index 9775d0c9f1e..1e80732ca39 100644 --- a/jdk/src/windows/native/sun/windows/ObjectList.h +++ b/jdk/src/windows/native/sun/windows/ObjectList.h @@ -46,7 +46,7 @@ public: AwtObjectList(); void Add(AwtObject* obj); - void Remove(AwtObject* obj); + BOOL Remove(AwtObject* obj); #ifdef DEBUG /* Used for sanity checks only. */ AwtObject* LookUp(AwtObject* obj); diff --git a/jdk/src/windows/native/sun/windows/awt_Component.cpp b/jdk/src/windows/native/sun/windows/awt_Component.cpp index fd75b8d52ee..592a9b434b2 100644 --- a/jdk/src/windows/native/sun/windows/awt_Component.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp @@ -1969,7 +1969,9 @@ MsgRouting AwtComponent::WmDestroy() { // fix for 6259348: we should enter the SyncCall critical section before // disposing the native object, that is value 1 of lParam is intended for - AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)this, (LPARAM)1); + if(m_peerObject != NULL) { // is not being terminating + AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)m_peerObject, (LPARAM)1); + } return mrConsume; } @@ -6534,8 +6536,7 @@ Java_sun_awt_windows_WComponentPeer__1dispose(JNIEnv *env, jobject self) { TRY_NO_HANG; - PDATA pData = JNI_GET_PDATA(self); - AwtObject::_Dispose(pData); + AwtObject::_Dispose(self); CATCH_BAD_ALLOC; } diff --git a/jdk/src/windows/native/sun/windows/awt_MenuItem.cpp b/jdk/src/windows/native/sun/windows/awt_MenuItem.cpp index aeb1021262a..97f3e2a7a21 100644 --- a/jdk/src/windows/native/sun/windows/awt_MenuItem.cpp +++ b/jdk/src/windows/native/sun/windows/awt_MenuItem.cpp @@ -974,8 +974,7 @@ Java_sun_awt_windows_WMenuItemPeer__1dispose(JNIEnv *env, jobject self) { TRY_NO_HANG; - PDATA pData = JNI_GET_PDATA(self); - AwtObject::_Dispose(pData); + AwtObject::_Dispose(self); CATCH_BAD_ALLOC; } diff --git a/jdk/src/windows/native/sun/windows/awt_Object.cpp b/jdk/src/windows/native/sun/windows/awt_Object.cpp index b7afe1aa510..54ec69a9a19 100644 --- a/jdk/src/windows/native/sun/windows/awt_Object.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Object.cpp @@ -60,11 +60,20 @@ AwtObject::~AwtObject() void AwtObject::Dispose() { - theAwtObjectList.Remove(this); + AwtToolkit::GetInstance().PostMessage(WM_AWT_DELETEOBJECT, (WPARAM)this, (LPARAM)0); +} + +void AwtObject::_Dispose(jobject self) +{ + TRY_NO_VERIFY; + + CriticalSection::Lock l(AwtToolkit::GetInstance().GetSyncCS()); // value 0 of lParam means that we should not attempt to enter the // SyncCall critical section, as it was entered someshere earlier - AwtToolkit::GetInstance().PostMessage(WM_AWT_DELETEOBJECT, (WPARAM)this, (LPARAM)0); + AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)self, (LPARAM)0); + + CATCH_BAD_ALLOC; } void AwtObject::_Dispose(PDATA pData) @@ -73,14 +82,10 @@ void AwtObject::_Dispose(PDATA pData) CriticalSection::Lock l(AwtToolkit::GetInstance().GetSyncCS()); - if (pData != NULL) { - AwtObject *o = (AwtObject *)pData; - AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)o, (LPARAM)0); - } + AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSEPDATA, (WPARAM)pData, (LPARAM)0); CATCH_BAD_ALLOC; } - /* * Return the peer associated with some target. This information is * maintained in a hashtable at the java level. diff --git a/jdk/src/windows/native/sun/windows/awt_Object.h b/jdk/src/windows/native/sun/windows/awt_Object.h index 6cfb83ebcc5..918e95d1c18 100644 --- a/jdk/src/windows/native/sun/windows/awt_Object.h +++ b/jdk/src/windows/native/sun/windows/awt_Object.h @@ -66,6 +66,10 @@ public: // After this method has been called, this object must not be used in any way. virtual void Dispose(); + // Static method to be called from JNI methods to dispose AwtObject + // specified by jobject + static void _Dispose(jobject self); + // Static method to be called from JNI methods to dispose AwtObject // specified by pData static void _Dispose(PDATA pData); diff --git a/jdk/src/windows/native/sun/windows/awt_Robot.cpp b/jdk/src/windows/native/sun/windows/awt_Robot.cpp index cdee9cf6001..09e12debf38 100644 --- a/jdk/src/windows/native/sun/windows/awt_Robot.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Robot.cpp @@ -353,8 +353,7 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_WRobotPeer__1dispose( { TRY_NO_VERIFY; - PDATA pData = JNI_GET_PDATA(self); - AwtObject::_Dispose(pData); + AwtObject::_Dispose(self); CATCH_BAD_ALLOC; } diff --git a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp index ca2bae8325a..d010d6b130c 100644 --- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp @@ -740,18 +740,34 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message, canDispose = syncCS.TryEnter(); } if (canDispose) { - AwtObject *o = (AwtObject *)wParam; - o->Dispose(); - if (shouldEnterCriticalSection) { - syncCS.Leave(); + if(wParam != NULL) { + AwtObject *o = (AwtObject *) JNI_GET_PDATA((jobject)wParam); + if(o != NULL && theAwtObjectList.Remove(o)) { + o->Dispose(); + } + if (shouldEnterCriticalSection) { + syncCS.Leave(); + } } } else { AwtToolkit::GetInstance().PostMessage(WM_AWT_DISPOSE, wParam, lParam); } return 0; } + case WM_AWT_DISPOSEPDATA: { + /* + * NOTE: synchronization routine (like in WM_AWT_DISPOSE) was omitted because + * this handler is called ONLY while disposing Cursor and Font objects where + * synchronization takes place. + */ + AwtObject *o = (AwtObject *) wParam; + if(o != NULL && theAwtObjectList.Remove(o)) { + o->Dispose(); + } + return 0; + } case WM_AWT_DELETEOBJECT: { - AwtObject *p = (AwtObject *)wParam; + AwtObject *p = (AwtObject *) wParam; if (p->CanBeDeleted()) { // all the messages for this component are processed, so // it can be deleted diff --git a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp index 4156c9cfec1..c2682b3b113 100644 --- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp +++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp @@ -926,8 +926,7 @@ Java_sun_awt_windows_WTrayIconPeer__1dispose(JNIEnv *env, jobject self) { TRY; - PDATA pData = JNI_GET_PDATA(self); - AwtObject::_Dispose(pData); + AwtObject::_Dispose(self); CATCH_BAD_ALLOC; } diff --git a/jdk/src/windows/native/sun/windows/awtmsg.h b/jdk/src/windows/native/sun/windows/awtmsg.h index 898471b4923..05733c7a6f0 100644 --- a/jdk/src/windows/native/sun/windows/awtmsg.h +++ b/jdk/src/windows/native/sun/windows/awtmsg.h @@ -219,6 +219,7 @@ enum { WM_AWT_ENDCOMPOSITION, WM_AWT_DISPOSE, + WM_AWT_DISPOSEPDATA, WM_AWT_DELETEOBJECT, WM_AWT_SETCONVERSIONSTATUS, WM_AWT_GETCONVERSIONSTATUS, From 1f4f92b81d50cfdd03dbfa9263ad55808a547139 Mon Sep 17 00:00:00 2001 From: Andrei Dmitriev Date: Wed, 27 Apr 2011 17:46:59 +0400 Subject: [PATCH 063/117] 6888633: test/closed/javax/swing/JPopupMenu/4786415/bug4786415.java fails Reviewed-by: rupashka, alexp --- jdk/src/share/classes/javax/swing/JPopupMenu.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/JPopupMenu.java b/jdk/src/share/classes/javax/swing/JPopupMenu.java index 24a9d4cf6c5..53926e4a744 100644 --- a/jdk/src/share/classes/javax/swing/JPopupMenu.java +++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java @@ -342,8 +342,8 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { // Calculate the screen size that popup should fit Dimension popupSize = JPopupMenu.this.getPreferredSize(); - int popupRightX = popupLocation.x + popupSize.width; - int popupBottomY = popupLocation.y + popupSize.height; + long popupRightX = (long)popupLocation.x + (long)popupSize.width; + long popupBottomY = (long)popupLocation.y + (long)popupSize.height; int scrWidth = scrBounds.width; int scrHeight = scrBounds.height; if (!canPopupOverlapTaskBar()) { @@ -358,13 +358,13 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { int scrBottomY = scrBounds.y + scrHeight; // Ensure that popup menu fits the screen - if (popupRightX > scrRightX) { + if (popupRightX > (long)scrRightX) { popupLocation.x = scrRightX - popupSize.width; if( popupLocation.x < scrBounds.x ) { popupLocation.x = scrBounds.x ; } } - if (popupBottomY > scrBottomY) { + if (popupBottomY > (long)scrBottomY) { popupLocation.y = scrBottomY - popupSize.height; if( popupLocation.y < scrBounds.y ) { popupLocation.y = scrBounds.y; From b44f91dc52db004e35fcce686f8c45181220b5cc Mon Sep 17 00:00:00 2001 From: Andrei Dmitriev Date: Wed, 27 Apr 2011 18:15:27 +0400 Subject: [PATCH 064/117] 6979551: closed/javax/swing/plaf/basic/BasicLabelUI/4798542/bug4798542.java fails Reviewed-by: art, yan, alexp --- .../classes/sun/awt/ExtendedKeyCodes.java | 17 +++++- .../keyboard/EqualKeyCode/EqualKeyCode.java | 61 +++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java diff --git a/jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java b/jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java index d6d72ac4ad7..fc004ba2a28 100644 --- a/jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java +++ b/jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java @@ -13,7 +13,7 @@ public class ExtendedKeyCodes { */ // Keycodes declared in KeyEvent.java with corresponding Unicode values. private final static HashMap regularKeyCodesMap = - new HashMap(83, 1.0f); + new HashMap(98, 1.0f); // Keycodes derived from Unicode values. Here should be collected codes // for characters appearing on the primary layer of at least one @@ -108,6 +108,21 @@ public class ExtendedKeyCodes { regularKeyCodesMap.put(0x5E, KeyEvent.VK_CIRCUMFLEX); regularKeyCodesMap.put(0x5F, KeyEvent.VK_UNDERSCORE); regularKeyCodesMap.put(0x60, KeyEvent.VK_BACK_QUOTE); + regularKeyCodesMap.put(0x61, KeyEvent.VK_A); + regularKeyCodesMap.put(0x62, KeyEvent.VK_B); + regularKeyCodesMap.put(0x63, KeyEvent.VK_C); + regularKeyCodesMap.put(0x64, KeyEvent.VK_D); + regularKeyCodesMap.put(0x65, KeyEvent.VK_E); + regularKeyCodesMap.put(0x66, KeyEvent.VK_F); + regularKeyCodesMap.put(0x67, KeyEvent.VK_G); + regularKeyCodesMap.put(0x68, KeyEvent.VK_H); + regularKeyCodesMap.put(0x69, KeyEvent.VK_I); + regularKeyCodesMap.put(0x6A, KeyEvent.VK_J); + regularKeyCodesMap.put(0x6B, KeyEvent.VK_K); + regularKeyCodesMap.put(0x6C, KeyEvent.VK_L); + regularKeyCodesMap.put(0x6D, KeyEvent.VK_M); + regularKeyCodesMap.put(0x6E, KeyEvent.VK_N); + regularKeyCodesMap.put(0x6F, KeyEvent.VK_O); regularKeyCodesMap.put(0x70, KeyEvent.VK_P); regularKeyCodesMap.put(0x71, KeyEvent.VK_Q); regularKeyCodesMap.put(0x72, KeyEvent.VK_R); diff --git a/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java b/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java new file mode 100644 index 00000000000..d4acc95ef2b --- /dev/null +++ b/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 6799551 + @library ../../regtesthelpers + @build Util Sysout + @summary Extended key codes for small letters undefined + @author Andrei Dmitriev: area=awt.keyboard + @run main EqualKeyCode +*/ + + +import sun.awt.*; +import java.awt.*; +import test.java.awt.regtesthelpers.Util; +import test.java.awt.regtesthelpers.Sysout; + +public class EqualKeyCode { + + final static String LETTERS = "abcdefghijklmnopqrstuvwxyz"; + + public static void main(String []s) { + for (int i = 0; i < LETTERS.length(); i++){ + char cSmall = LETTERS.charAt(i); + char cLarge = Character.toUpperCase(cSmall); + + int iSmall = ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall); + int iLarge = ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge); + + System.out.print(" " + cSmall + ":" + iSmall + " ---- "); + System.out.println(" " + cLarge + " : " + iLarge); + if (ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall) != + ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge)) + { + throw new RuntimeException("ExtendedKeyCode doesn't exist or doesn't match between capital and small letters."); + } + } + } +} From 8c88165312e2bd5497f5f3489173300a3a6362f2 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Wed, 27 Apr 2011 20:21:32 +0100 Subject: [PATCH 065/117] 6753664: Support SHA256 (and higher) in SunMSCAPI Reviewed-by: mullan --- .../sun/security/mscapi/RSASignature.java | 85 ++++++---- .../sun/security/mscapi/SunMSCAPI.java | 16 +- .../native/sun/security/mscapi/security.cpp | 100 ++++++++++-- .../security/mscapi/SignUsingSHA2withRSA.java | 153 ++++++++++++++++++ .../security/mscapi/SignUsingSHA2withRSA.sh | 83 ++++++++++ 5 files changed, 391 insertions(+), 46 deletions(-) create mode 100644 jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.java create mode 100644 jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.sh diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java index 7e80490e652..9a735d5fd89 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java @@ -50,6 +50,9 @@ import sun.security.rsa.RSAKeyFactory; * following algorithm names: * * . "SHA1withRSA" + * . "SHA256withRSA" + * . "SHA384withRSA" + * . "SHA512withRSA" * . "MD5withRSA" * . "MD2withRSA" * @@ -63,7 +66,10 @@ abstract class RSASignature extends java.security.SignatureSpi // message digest implementation we use private final MessageDigest messageDigest; - // flag indicating whether the digest is reset + // message digest name + private final String messageDigestAlgorithm; + + // flag indicating whether the digest has been reset private boolean needsReset; // the signing key @@ -73,10 +79,15 @@ abstract class RSASignature extends java.security.SignatureSpi private Key publicKey = null; + /** + * Constructs a new RSASignature. Used by subclasses. + */ RSASignature(String digestName) { try { messageDigest = MessageDigest.getInstance(digestName); + // Get the digest's canonical name + messageDigestAlgorithm = messageDigest.getAlgorithm(); } catch (NoSuchAlgorithmException e) { throw new ProviderException(e); @@ -91,6 +102,24 @@ abstract class RSASignature extends java.security.SignatureSpi } } + public static final class SHA256 extends RSASignature { + public SHA256() { + super("SHA-256"); + } + } + + public static final class SHA384 extends RSASignature { + public SHA384() { + super("SHA-384"); + } + } + + public static final class SHA512 extends RSASignature { + public SHA512() { + super("SHA-512"); + } + } + public static final class MD5 extends RSASignature { public MD5() { super("MD5"); @@ -103,16 +132,7 @@ abstract class RSASignature extends java.security.SignatureSpi } } - /** - * Initializes this signature object with the specified - * public key for verification operations. - * - * @param publicKey the public key of the identity whose signature is - * going to be verified. - * - * @exception InvalidKeyException if the key is improperly - * encoded, parameters are missing, and so on. - */ + // initialize for signing. See JCA doc protected void engineInitVerify(PublicKey key) throws InvalidKeyException { @@ -158,24 +178,12 @@ abstract class RSASignature extends java.security.SignatureSpi publicKey = (sun.security.mscapi.RSAPublicKey) key; } - if (needsReset) { - messageDigest.reset(); - needsReset = false; - } + this.privateKey = null; + resetDigest(); } - /** - * Initializes this signature object with the specified - * private key for signing operations. - * - * @param privateKey the private key of the identity whose signature - * will be generated. - * - * @exception InvalidKeyException if the key is improperly - * encoded, parameters are missing, and so on. - */ - protected void engineInitSign(PrivateKey key) - throws InvalidKeyException + // initialize for signing. See JCA doc + protected void engineInitSign(PrivateKey key) throws InvalidKeyException { // This signature accepts only RSAPrivateKey if ((key instanceof sun.security.mscapi.RSAPrivateKey) == false) { @@ -189,12 +197,25 @@ abstract class RSASignature extends java.security.SignatureSpi null, RSAKeyPairGenerator.KEY_SIZE_MIN, RSAKeyPairGenerator.KEY_SIZE_MAX); + this.publicKey = null; + resetDigest(); + } + + /** + * Resets the message digest if needed. + */ + private void resetDigest() { if (needsReset) { messageDigest.reset(); needsReset = false; } } + private byte[] getDigestValue() { + needsReset = false; + return messageDigest.digest(); + } + /** * Updates the data to be signed or verified * using the specified byte. @@ -254,13 +275,12 @@ abstract class RSASignature extends java.security.SignatureSpi */ protected byte[] engineSign() throws SignatureException { - byte[] hash = messageDigest.digest(); - needsReset = false; + byte[] hash = getDigestValue(); // Sign hash using MS Crypto APIs byte[] result = signHash(hash, hash.length, - messageDigest.getAlgorithm(), privateKey.getHCryptProvider(), + messageDigestAlgorithm, privateKey.getHCryptProvider(), privateKey.getHCryptKey()); // Convert signature array from little endian to big endian @@ -314,11 +334,10 @@ abstract class RSASignature extends java.security.SignatureSpi protected boolean engineVerify(byte[] sigBytes) throws SignatureException { - byte[] hash = messageDigest.digest(); - needsReset = false; + byte[] hash = getDigestValue(); return verifySignedHash(hash, hash.length, - messageDigest.getAlgorithm(), convertEndianArray(sigBytes), + messageDigestAlgorithm, convertEndianArray(sigBytes), sigBytes.length, publicKey.getHCryptProvider(), publicKey.getHCryptKey()); } diff --git a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java index 55feb7e1d84..b101e5b09a5 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java +++ b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,6 +81,12 @@ public final class SunMSCAPI extends Provider { */ map.put("Signature.SHA1withRSA", "sun.security.mscapi.RSASignature$SHA1"); + map.put("Signature.SHA256withRSA", + "sun.security.mscapi.RSASignature$SHA256"); + map.put("Signature.SHA384withRSA", + "sun.security.mscapi.RSASignature$SHA384"); + map.put("Signature.SHA512withRSA", + "sun.security.mscapi.RSASignature$SHA512"); map.put("Signature.MD5withRSA", "sun.security.mscapi.RSASignature$MD5"); map.put("Signature.MD2withRSA", @@ -89,12 +95,16 @@ public final class SunMSCAPI extends Provider { // supported key classes map.put("Signature.SHA1withRSA SupportedKeyClasses", "sun.security.mscapi.Key"); + map.put("Signature.SHA256withRSA SupportedKeyClasses", + "sun.security.mscapi.Key"); + map.put("Signature.SHA384withRSA SupportedKeyClasses", + "sun.security.mscapi.Key"); + map.put("Signature.SHA512withRSA SupportedKeyClasses", + "sun.security.mscapi.Key"); map.put("Signature.MD5withRSA SupportedKeyClasses", "sun.security.mscapi.Key"); map.put("Signature.MD2withRSA SupportedKeyClasses", "sun.security.mscapi.Key"); - map.put("Signature.NONEwithRSA SupportedKeyClasses", - "sun.security.mscapi.Key"); /* * Key Pair Generator engines diff --git a/jdk/src/windows/native/sun/security/mscapi/security.cpp b/jdk/src/windows/native/sun/security/mscapi/security.cpp index f92cc9a9e9e..3b0421576c9 100644 --- a/jdk/src/windows/native/sun/security/mscapi/security.cpp +++ b/jdk/src/windows/native/sun/security/mscapi/security.cpp @@ -483,6 +483,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_RSASignature_signHash jbyte* pHashBuffer = NULL; jbyte* pSignedHashBuffer = NULL; jbyteArray jSignedHash = NULL; + HCRYPTPROV hCryptProvAlt = NULL; __try { @@ -492,8 +493,32 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_RSASignature_signHash // Acquire a hash object handle. if (::CryptCreateHash(HCRYPTPROV(hCryptProv), algId, 0, 0, &hHash) == FALSE) { - ThrowException(env, SIGNATURE_EXCEPTION, GetLastError()); - __leave; + // Failover to using the PROV_RSA_AES CSP + + DWORD cbData = 256; + BYTE pbData[256]; + pbData[0] = '\0'; + + // Get name of the key container + ::CryptGetProvParam((HCRYPTPROV)hCryptProv, PP_CONTAINER, + (BYTE *)pbData, &cbData, 0); + + // Acquire an alternative CSP handle + if (::CryptAcquireContext(&hCryptProvAlt, LPCSTR(pbData), NULL, + PROV_RSA_AES, 0) == FALSE) + { + + ThrowException(env, SIGNATURE_EXCEPTION, GetLastError()); + __leave; + } + + // Acquire a hash object handle. + if (::CryptCreateHash(HCRYPTPROV(hCryptProvAlt), algId, 0, 0, + &hHash) == FALSE) + { + ThrowException(env, SIGNATURE_EXCEPTION, GetLastError()); + __leave; + } } // Copy hash from Java to native buffer @@ -546,6 +571,9 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_RSASignature_signHash } __finally { + if (hCryptProvAlt) + ::CryptReleaseContext(hCryptProvAlt, 0); + if (pSignedHashBuffer) delete [] pSignedHashBuffer; @@ -574,6 +602,7 @@ JNIEXPORT jboolean JNICALL Java_sun_security_mscapi_RSASignature_verifySignedHas jbyte* pSignedHashBuffer = NULL; DWORD dwSignedHashBufferLen = jSignedHashSize; jboolean result = JNI_FALSE; + HCRYPTPROV hCryptProvAlt = NULL; __try { @@ -584,8 +613,32 @@ JNIEXPORT jboolean JNICALL Java_sun_security_mscapi_RSASignature_verifySignedHas if (::CryptCreateHash(HCRYPTPROV(hCryptProv), algId, 0, 0, &hHash) == FALSE) { - ThrowException(env, SIGNATURE_EXCEPTION, GetLastError()); - __leave; + // Failover to using the PROV_RSA_AES CSP + + DWORD cbData = 256; + BYTE pbData[256]; + pbData[0] = '\0'; + + // Get name of the key container + ::CryptGetProvParam((HCRYPTPROV)hCryptProv, PP_CONTAINER, + (BYTE *)pbData, &cbData, 0); + + // Acquire an alternative CSP handle + if (::CryptAcquireContext(&hCryptProvAlt, LPCSTR(pbData), NULL, + PROV_RSA_AES, 0) == FALSE) + { + + ThrowException(env, SIGNATURE_EXCEPTION, GetLastError()); + __leave; + } + + // Acquire a hash object handle. + if (::CryptCreateHash(HCRYPTPROV(hCryptProvAlt), algId, 0, 0, + &hHash) == FALSE) + { + ThrowException(env, SIGNATURE_EXCEPTION, GetLastError()); + __leave; + } } // Copy hash and signedHash from Java to native buffer @@ -616,6 +669,9 @@ JNIEXPORT jboolean JNICALL Java_sun_security_mscapi_RSASignature_verifySignedHas __finally { + if (hCryptProvAlt) + ::CryptReleaseContext(hCryptProvAlt, 0); + if (pSignedHashBuffer) delete [] pSignedHashBuffer; @@ -648,15 +704,27 @@ JNIEXPORT jobject JNICALL Java_sun_security_mscapi_RSAKeyPairGenerator_generateR pszKeyContainerName = env->GetStringUTFChars(keyContainerName, NULL); // Acquire a CSP context (create a new key container). + // Prefer a PROV_RSA_AES CSP, when available, due to its support + // for SHA-2-based signatures. if (::CryptAcquireContext( &hCryptProv, pszKeyContainerName, NULL, - PROV_RSA_FULL, + PROV_RSA_AES, CRYPT_NEWKEYSET) == FALSE) { - ThrowException(env, KEY_EXCEPTION, GetLastError()); - __leave; + // Failover to using the default CSP (PROV_RSA_FULL) + + if (::CryptAcquireContext( + &hCryptProv, + pszKeyContainerName, + NULL, + PROV_RSA_FULL, + CRYPT_NEWKEYSET) == FALSE) + { + ThrowException(env, KEY_EXCEPTION, GetLastError()); + __leave; + } } // Generate an RSA keypair @@ -1849,15 +1917,27 @@ JNIEXPORT jobject JNICALL Java_sun_security_mscapi_RSASignature_importPublicKey pbKeyBlob = (BYTE *) env->GetByteArrayElements(keyBlob, 0); // Acquire a CSP context (create a new key container). + // Prefer a PROV_RSA_AES CSP, when available, due to its support + // for SHA-2-based signatures. if (::CryptAcquireContext( &hCryptProv, NULL, NULL, - PROV_RSA_FULL, + PROV_RSA_AES, CRYPT_VERIFYCONTEXT) == FALSE) { - ThrowException(env, KEYSTORE_EXCEPTION, GetLastError()); - __leave; + // Failover to using the default CSP (PROV_RSA_FULL) + + if (::CryptAcquireContext( + &hCryptProv, + NULL, + NULL, + PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT) == FALSE) + { + ThrowException(env, KEYSTORE_EXCEPTION, GetLastError()); + __leave; + } } // Import the public key diff --git a/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.java b/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.java new file mode 100644 index 00000000000..e2bd06b1905 --- /dev/null +++ b/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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. + */ + +/** + * @see SignUsingSHA2withRSA.sh + */ + +import java.security.*; +import java.util.*; + +public class SignUsingSHA2withRSA { + + private static final byte[] toBeSigned = new byte[] { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10 + }; + + private static List generatedSignatures = new ArrayList<>(); + + public static void main(String[] args) throws Exception { + + Provider[] providers = Security.getProviders("Signature.SHA256withRSA"); + if (providers == null) { + System.out.println("No JCE providers support the " + + "'Signature.SHA256withRSA' algorithm"); + System.out.println("Skipping this test..."); + return; + + } else { + System.out.println("The following JCE providers support the " + + "'Signature.SHA256withRSA' algorithm: "); + for (Provider provider : providers) { + System.out.println(" " + provider.getName()); + } + } + System.out.println("-------------------------------------------------"); + + KeyStore ks = KeyStore.getInstance("Windows-MY", "SunMSCAPI"); + ks.load(null, null); + System.out.println("Loaded keystore: Windows-MY"); + + Enumeration e = ks.aliases(); + PrivateKey privateKey = null; + PublicKey publicKey = null; + + while (e.hasMoreElements()) { + String alias = (String) e.nextElement(); + if (alias.equals("6753664")) { + System.out.println("Loaded entry: " + alias); + privateKey = (PrivateKey) ks.getKey(alias, null); + publicKey = (PublicKey) ks.getCertificate(alias).getPublicKey(); + } + } + if (privateKey == null || publicKey == null) { + throw new Exception("Cannot load the keys need to run this test"); + } + System.out.println("-------------------------------------------------"); + + generatedSignatures.add(signUsing("SHA256withRSA", privateKey)); + generatedSignatures.add(signUsing("SHA384withRSA", privateKey)); + generatedSignatures.add(signUsing("SHA512withRSA", privateKey)); + + System.out.println("-------------------------------------------------"); + + verifyUsing("SHA256withRSA", publicKey, generatedSignatures.get(0)); + verifyUsing("SHA384withRSA", publicKey, generatedSignatures.get(1)); + verifyUsing("SHA512withRSA", publicKey, generatedSignatures.get(2)); + + System.out.println("-------------------------------------------------"); + } + + private static byte[] signUsing(String signAlgorithm, + PrivateKey privateKey) throws Exception { + + // Must explicitly specify the SunMSCAPI JCE provider + // (otherwise SunJCE is chosen because it appears earlier in the list) + Signature sig1 = Signature.getInstance(signAlgorithm, "SunMSCAPI"); + if (sig1 == null) { + throw new Exception("'" + signAlgorithm + "' is not supported"); + } + System.out.println("Using " + signAlgorithm + " signer from the " + + sig1.getProvider().getName() + " JCE provider"); + + System.out.println("Using key: " + privateKey); + sig1.initSign(privateKey); + sig1.update(toBeSigned); + byte [] sigBytes = null; + + try { + sigBytes = sig1.sign(); + System.out.println("Generated RSA signature over a " + + toBeSigned.length + "-byte data (signature length: " + + sigBytes.length * 8 + " bits)"); + System.out.println(String.format("0x%0" + + (sigBytes.length * 2) + "x", + new java.math.BigInteger(1, sigBytes))); + + } catch (SignatureException se) { + System.out.println("Error generating RSA signature: " + se); + } + + return sigBytes; + } + + private static void verifyUsing(String signAlgorithm, PublicKey publicKey, + byte[] signature) throws Exception { + + // Must explicitly specify the SunMSCAPI JCE provider + // (otherwise SunJCE is chosen because it appears earlier in the list) + Signature sig1 = Signature.getInstance(signAlgorithm, "SunMSCAPI"); + if (sig1 == null) { + throw new Exception("'" + signAlgorithm + "' is not supported"); + } + System.out.println("Using " + signAlgorithm + " verifier from the " + + sig1.getProvider().getName() + " JCE provider"); + + System.out.println("Using key: " + publicKey); + + System.out.println("\nVerifying RSA Signature over a " + + toBeSigned.length + "-byte data (signature length: " + + signature.length * 8 + " bits)"); + System.out.println(String.format("0x%0" + (signature.length * 2) + + "x", new java.math.BigInteger(1, signature))); + + sig1.initVerify(publicKey); + sig1.update(toBeSigned); + + if (sig1.verify(signature)) { + System.out.println("Verify PASSED\n"); + } else { + throw new Exception("Verify FAILED"); + } + } +} diff --git a/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.sh b/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.sh new file mode 100644 index 00000000000..c939fb39e3f --- /dev/null +++ b/jdk/test/sun/security/mscapi/SignUsingSHA2withRSA.sh @@ -0,0 +1,83 @@ +#!/bin/sh + +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# 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 6753664 +# @run shell SignUsingSHA2withRSA.sh +# @summary Support SHA256 (and higher) in SunMSCAPI + +# set a few environment variables so that the shell-script can run stand-alone +# in the source directory +if [ "${TESTSRC}" = "" ] ; then + TESTSRC="." +fi + +if [ "${TESTCLASSES}" = "" ] ; then + TESTCLASSES="." +fi + +if [ "${TESTJAVA}" = "" ] ; then + echo "TESTJAVA not set. Test cannot execute." + echo "FAILED!!!" + exit 1 +fi + +OS=`uname -s` +case "$OS" in + Windows* | CYGWIN* ) + + echo "Creating a temporary RSA keypair in the Windows-My store..." + ${TESTJAVA}/bin/keytool \ + -genkeypair \ + -storetype Windows-My \ + -keyalg RSA \ + -alias 6753664 \ + -dname "cn=6753664,c=US" \ + -noprompt + + echo + echo "Running the test..." + ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\SignUsingSHA2withRSA.java + ${TESTJAVA}/bin/java SignUsingSHA2withRSA + + rc=$? + + echo + echo "Removing the temporary RSA keypair from the Windows-My store..." + ${TESTJAVA}/bin/keytool \ + -delete \ + -storetype Windows-My \ + -alias 6753664 + + echo done. + exit $rc + ;; + + * ) + echo "This test is not intended for '$OS' - passing test" + exit 0 + ;; +esac From b777d36af8690ab82115c32091c22a04fe61af4e Mon Sep 17 00:00:00 2001 From: John Cuthbertson Date: Wed, 27 Apr 2011 14:40:41 -0700 Subject: [PATCH 066/117] 7037756: Deadlock in compiler thread similiar to 6789220 Avoid blocking in CompileBroker::compile_method_base() if the current thread holds the pending list lock. Reviewed-by: never, brutisso, ysr --- .../src/share/vm/compiler/compileBroker.cpp | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index 6c2a9683d5c..9626d444645 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -976,6 +976,15 @@ void CompileBroker::compile_method_base(methodHandle method, return; } + // If the requesting thread is holding the pending list lock + // then we just return. We can't risk blocking while holding + // the pending list lock or a 3-way deadlock may occur + // between the reference handler thread, a GC (instigated + // by a compiler thread), and compiled method registration. + if (instanceRefKlass::owns_pending_list_lock(JavaThread::current())) { + return; + } + // Outputs from the following MutexLocker block: CompileTask* task = NULL; bool blocking = false; @@ -1304,17 +1313,8 @@ uint CompileBroker::assign_compile_id(methodHandle method, int osr_bci) { // Should the current thread be blocked until this compilation request // has been fulfilled? bool CompileBroker::is_compile_blocking(methodHandle method, int osr_bci) { - if (!BackgroundCompilation) { - Symbol* class_name = method->method_holder()->klass_part()->name(); - if (class_name->starts_with("java/lang/ref/Reference", 23)) { - // The reference handler thread can dead lock with the GC if compilation is blocking, - // so we avoid blocking compiles for anything in the java.lang.ref.Reference class, - // including inner classes such as ReferenceHandler. - return false; - } - return true; - } - return false; + assert(!instanceRefKlass::owns_pending_list_lock(JavaThread::current()), "possible deadlock"); + return !BackgroundCompilation; } From 2126589fd09161d68dcb2b6946f8a4349e47ddd3 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Wed, 27 Apr 2011 15:40:36 -0700 Subject: [PATCH 067/117] 7029167: add support for conditional card marks Reviewed-by: iveresov, kvn --- hotspot/src/share/vm/opto/graphKit.cpp | 21 +++++++++++++++++++-- hotspot/src/share/vm/opto/macro.cpp | 13 ++++++++++--- hotspot/src/share/vm/runtime/globals.hpp | 3 +++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index e1612b843dc..4df08199075 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -3447,9 +3447,22 @@ void GraphKit::write_barrier_post(Node* oop_store, // Get the alias_index for raw card-mark memory int adr_type = Compile::AliasIdxRaw; - // Smash zero into card - Node* zero = __ ConI(0); + Node* zero = __ ConI(0); // Dirty card value BasicType bt = T_BYTE; + + if (UseCondCardMark) { + // The classic GC reference write barrier is typically implemented + // as a store into the global card mark table. Unfortunately + // unconditional stores can result in false sharing and excessive + // coherence traffic as well as false transactional aborts. + // UseCondCardMark enables MP "polite" conditional card mark + // stores. In theory we could relax the load from ctrl() to + // no_ctrl, but that doesn't buy much latitude. + Node* card_val = __ load( __ ctrl(), card_adr, TypeInt::BYTE, bt, adr_type); + __ if_then(card_val, BoolTest::ne, zero); + } + + // Smash zero into card if( !UseConcMarkSweepGC ) { __ store(__ ctrl(), card_adr, zero, bt, adr_type); } else { @@ -3457,6 +3470,10 @@ void GraphKit::write_barrier_post(Node* oop_store, __ storeCM(__ ctrl(), card_adr, zero, oop_store, adr_idx, bt, adr_type); } + if (UseCondCardMark) { + __ end_if(); + } + // Final sync IdealKit and GraphKit. final_sync(ideal); } diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index 465c8babdd5..a35f3342ba4 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -221,9 +221,16 @@ void PhaseMacroExpand::eliminate_card_mark(Node* p2x) { Node *shift = p2x->unique_out(); Node *addp = shift->unique_out(); for (DUIterator_Last jmin, j = addp->last_outs(jmin); j >= jmin; --j) { - Node *st = addp->last_out(j); - assert(st->is_Store(), "store required"); - _igvn.replace_node(st, st->in(MemNode::Memory)); + Node *mem = addp->last_out(j); + if (UseCondCardMark && mem->is_Load()) { + assert(mem->Opcode() == Op_LoadB, "unexpected code shape"); + // The load is checking if the card has been written so + // replace it with zero to fold the test. + _igvn.replace_node(mem, intcon(0)); + continue; + } + assert(mem->is_Store(), "store required"); + _igvn.replace_node(mem, mem->in(MemNode::Memory)); } } else { // G1 pre/post barriers diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 96f0abbb061..eb5bec20015 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -620,6 +620,9 @@ class CommandLineFlags { product(bool, UseSSE42Intrinsics, false, \ "SSE4.2 versions of intrinsics") \ \ + product(bool, UseCondCardMark, false, \ + "Check for already marked card before updating card table") \ + \ develop(bool, TraceCallFixup, false, \ "traces all call fixups") \ \ From 00ac2f30b88a8376835135beae6bf1d9ab6ce46d Mon Sep 17 00:00:00 2001 From: Michael Fang Date: Wed, 27 Apr 2011 23:11:48 -0700 Subject: [PATCH 068/117] 6501385: ColorChooser demo - two elemets have same mnemonic in it locale, GTK L&F Reviewed-by: yhuang --- .../com/sun/java/swing/plaf/gtk/resources/gtk_de.properties | 2 +- .../com/sun/java/swing/plaf/gtk/resources/gtk_es.properties | 2 +- .../com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties | 2 +- .../com/sun/java/swing/plaf/gtk/resources/gtk_it.properties | 2 +- .../com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties | 2 +- .../com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties | 2 +- .../sun/swing/internal/plaf/basic/resources/basic_sv.properties | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties index 571bc0afae3..3edb256c427 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties @@ -24,7 +24,7 @@ GTKColorChooserPanel.hueText=Farbton: GTKColorChooserPanel.hueMnemonic=70 GTKColorChooserPanel.redText=Rot: -GTKColorChooserPanel.redMnemonic=79 +GTKColorChooserPanel.redMnemonic=82 GTKColorChooserPanel.saturationText=S\u00E4ttigung: GTKColorChooserPanel.saturationMnemonic=83 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties index 6daa4d9b441..4766de9167e 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties @@ -30,7 +30,7 @@ GTKColorChooserPanel.saturationText=Saturaci\u00F3n: GTKColorChooserPanel.saturationMnemonic=83 GTKColorChooserPanel.greenText=Verde: -GTKColorChooserPanel.greenMnemonic=86 +GTKColorChooserPanel.greenMnemonic=69 GTKColorChooserPanel.valueText=Valor: GTKColorChooserPanel.valueMnemonic=86 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties index 9f4e0e559f7..68f07d2e469 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties @@ -30,7 +30,7 @@ GTKColorChooserPanel.saturationText=Saturation : GTKColorChooserPanel.saturationMnemonic=83 GTKColorChooserPanel.greenText=Vert : -GTKColorChooserPanel.greenMnemonic=86 +GTKColorChooserPanel.greenMnemonic=69 GTKColorChooserPanel.valueText=Valeur : GTKColorChooserPanel.valueMnemonic=86 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties index 21cd8f77826..70146898dac 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties @@ -30,7 +30,7 @@ GTKColorChooserPanel.saturationText=Saturazione: GTKColorChooserPanel.saturationMnemonic=83 GTKColorChooserPanel.greenText=Verde: -GTKColorChooserPanel.greenMnemonic=86 +GTKColorChooserPanel.greenMnemonic=69 GTKColorChooserPanel.valueText=Valore: GTKColorChooserPanel.valueMnemonic=86 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties index 6fb63b6764f..35a510d9947 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties @@ -30,7 +30,7 @@ GTKColorChooserPanel.saturationText=Satura\u00E7\u00E3o: GTKColorChooserPanel.saturationMnemonic=83 GTKColorChooserPanel.greenText=Verde: -GTKColorChooserPanel.greenMnemonic=86 +GTKColorChooserPanel.greenMnemonic=68 GTKColorChooserPanel.valueText=Valor: GTKColorChooserPanel.valueMnemonic=86 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties index cfde4686b9b..9dda1e0a50f 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties @@ -39,7 +39,7 @@ GTKColorChooserPanel.blueText=Bl\u00E5: GTKColorChooserPanel.blueMnemonic=66 GTKColorChooserPanel.colorNameText=F\u00E4rgnamn: -GTKColorChooserPanel.colorNameMnemonic=78 +GTKColorChooserPanel.colorNameMnemonic=70 diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties index fef16139cf4..c28dfbd7ca8 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties @@ -96,7 +96,7 @@ ColorChooser.okText=OK ColorChooser.cancelText=Avbryt ColorChooser.resetText=\u00C5terst\u00E4ll # VK_XXX constant for 'ColorChooser.resetText' button to make mnemonic -ColorChooser.resetMnemonic=82 +ColorChooser.resetMnemonic=84 ColorChooser.sampleText=Exempeltext Exempeltext ColorChooser.swatchesNameText=Prov ColorChooser.swatchesMnemonic=80 From 7d2260eaa5bd1b081046617687ad4a56ed218dd7 Mon Sep 17 00:00:00 2001 From: Michael Fang Date: Wed, 27 Apr 2011 23:18:20 -0700 Subject: [PATCH 069/117] 7038803: [CCJK] Incorrect mnemonic key (0) is displayed on cancel button on messagedialog of JOptionPane Reviewed-by: yhuang --- .../sun/swing/internal/plaf/basic/resources/basic.properties | 4 ++-- .../swing/internal/plaf/basic/resources/basic_ja.properties | 2 +- .../swing/internal/plaf/basic/resources/basic_ko.properties | 2 +- .../internal/plaf/basic/resources/basic_zh_CN.properties | 2 +- .../internal/plaf/basic/resources/basic_zh_TW.properties | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties index 87e3bde708e..549e5cfc853 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties @@ -146,9 +146,9 @@ OptionPane.yesButtonMnemonic=89 OptionPane.noButtonText=No OptionPane.noButtonMnemonic=78 OptionPane.okButtonText=OK -OptionPane.okButtonMnemonic=0 +#OptionPane.okButtonMnemonic=0 OptionPane.cancelButtonText=Cancel -OptionPane.cancelButtonMnemonic=0 +#OptionPane.cancelButtonMnemonic=0 OptionPane.titleText=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. diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties index 9382e0abc04..6a01a4ae528 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties @@ -146,7 +146,7 @@ OptionPane.noButtonText=\u3044\u3044\u3048(N) OptionPane.noButtonMnemonic=78 OptionPane.okButtonText=OK OptionPane.okButtonMnemonic=O -OptionPane.cancelButtonText=\u53D6\u6D88(0) +OptionPane.cancelButtonText=\u53D6\u6D88 OptionPane.cancelButtonMnemonic=0 OptionPane.titleText=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u9078\u629E # Title for the dialog for the showInputDialog methods. Only used if diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties index b8f70de37ff..970e57bf375 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties @@ -146,7 +146,7 @@ OptionPane.noButtonText=\uC544\uB2C8\uC624(N) OptionPane.noButtonMnemonic=78 OptionPane.okButtonText=OK OptionPane.okButtonMnemonic=O -OptionPane.cancelButtonText=\uCDE8\uC18C(0) +OptionPane.cancelButtonText=\uCDE8\uC18C OptionPane.cancelButtonMnemonic=0 OptionPane.titleText=\uC635\uC158 \uC120\uD0DD # Title for the dialog for the showInputDialog methods. Only used if diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties index 212b1753539..0714ac53c35 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties @@ -146,7 +146,7 @@ OptionPane.noButtonText=\u5426(N) OptionPane.noButtonMnemonic=78 OptionPane.okButtonText=OK OptionPane.okButtonMnemonic=O -OptionPane.cancelButtonText=\u53D6\u6D88(0) +OptionPane.cancelButtonText=\u53D6\u6D88 OptionPane.cancelButtonMnemonic=0 OptionPane.titleText=\u9009\u62E9\u4E00\u4E2A\u9009\u9879 # Title for the dialog for the showInputDialog methods. Only used if diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties index ef267aaf8c5..141938565c9 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties @@ -146,7 +146,7 @@ OptionPane.noButtonText=\u5426(N) OptionPane.noButtonMnemonic=78 OptionPane.okButtonText=OK OptionPane.okButtonMnemonic=O -OptionPane.cancelButtonText=\u53D6\u6D88(0) +OptionPane.cancelButtonText=\u53D6\u6D88 OptionPane.cancelButtonMnemonic=0 OptionPane.titleText=\u9078\u53D6\u4E00\u500B\u9078\u9805 # Title for the dialog for the showInputDialog methods. Only used if From 88ddcf5e65d080f143e57965f8171241db96624d Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Thu, 28 Apr 2011 13:26:18 +0400 Subject: [PATCH 070/117] 7032830: GraphicsDevice.setFullScreenWindow() works strange for decorated windows on OEL 7016382: GraphicsDevice.setFullScreenWindow() - spec clarification for exclusive mode for dec/undec Frames Reviewed-by: art --- jdk/src/share/classes/java/awt/GraphicsDevice.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jdk/src/share/classes/java/awt/GraphicsDevice.java b/jdk/src/share/classes/java/awt/GraphicsDevice.java index f3b7cd390a6..b99d7ef8def 100644 --- a/jdk/src/share/classes/java/awt/GraphicsDevice.java +++ b/jdk/src/share/classes/java/awt/GraphicsDevice.java @@ -257,6 +257,11 @@ public abstract class GraphicsDevice { * 1.0f, and the background color alpha is set to 255 (completely opaque). * These values are not restored when returning to windowed mode. *

    + * It is unspecified and platform-dependent how decorated windows operate + * in full-screen mode. For this reason, it is recommended to turn off + * the decorations in a {@code Frame} or {@code Dialog} object by using the + * {@code setUndecorated} method. + *

    * When returning to windowed mode from an exclusive full-screen window, * any display changes made by calling {@code setDisplayMode} are * automatically restored to their original state. @@ -272,6 +277,8 @@ public abstract class GraphicsDevice { * @see #setDisplayMode * @see Component#enableInputMethods * @see Component#setVisible + * @see Frame#setUndecorated + * @see Dialog#setUndecorated * * @since 1.4 */ From f32a89adb040b4a8912a21861a4fdec104867c0e Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Thu, 28 Apr 2011 20:34:53 +0800 Subject: [PATCH 071/117] 7037201: regression: invalid signed jar file not detected Reviewed-by: mullan --- .../share/classes/java/util/jar/JarFile.java | 22 +- .../classes/java/util/jar/JarInputStream.java | 2 +- .../classes/java/util/jar/JarVerifier.java | 224 ++++++++++++---- .../classes/sun/security/pkcs/PKCS7.java | 176 +----------- .../classes/sun/security/pkcs/SignerInfo.java | 136 +++++++++- .../security/util/ManifestEntryVerifier.java | 4 +- .../security/util/SignatureFileManifest.java | 251 ------------------ .../security/util/SignatureFileVerifier.java | 172 ++++-------- .../jar/JarInputStream/ScanSignedJar.java | 7 +- .../TestIndexedJarWithBadSignature.java | 4 +- 10 files changed, 377 insertions(+), 621 deletions(-) delete mode 100644 jdk/src/share/classes/sun/security/util/SignatureFileManifest.java diff --git a/jdk/src/share/classes/java/util/jar/JarFile.java b/jdk/src/share/classes/java/util/jar/JarFile.java index 20d0363f57a..79d0f84b7e1 100644 --- a/jdk/src/share/classes/java/util/jar/JarFile.java +++ b/jdk/src/share/classes/java/util/jar/JarFile.java @@ -37,7 +37,6 @@ import java.security.CodeSource; import sun.security.action.GetPropertyAction; import sun.security.util.ManifestEntryVerifier; import sun.misc.SharedSecrets; -import sun.security.util.SignatureFileVerifier; /** * The JarFile class is used to read the contents of a jar file @@ -179,7 +178,7 @@ class JarFile extends ZipFile { byte[] b = getBytes(manEntry); man = new Manifest(new ByteArrayInputStream(b)); if (!jvInitialized) { - jv = new JarVerifier(b, man); + jv = new JarVerifier(b); } } else { man = new Manifest(super.getInputStream(manEntry)); @@ -298,7 +297,10 @@ class JarFile extends ZipFile { if (names != null) { for (int i = 0; i < names.length; i++) { String name = names[i].toUpperCase(Locale.ENGLISH); - if (SignatureFileVerifier.isBlockOrSF(name)) { + if (name.endsWith(".DSA") || + name.endsWith(".RSA") || + name.endsWith(".EC") || + name.endsWith(".SF")) { // Assume since we found a signature-related file // that the jar is signed and that we therefore // need a JarVerifier and Manifest @@ -327,17 +329,17 @@ class JarFile extends ZipFile { if (names != null) { for (int i = 0; i < names.length; i++) { JarEntry e = getJarEntry(names[i]); - if (!e.isDirectory() && - SignatureFileVerifier.isBlock(names[i])) { + if (!e.isDirectory()) { if (mev == null) { mev = new ManifestEntryVerifier (getManifestFromReference()); } - String key = names[i].substring( - 0, names[i].lastIndexOf(".")); - jv.verifyBlock(names[i], - getBytes(e), - super.getInputStream(getJarEntry(key + ".SF"))); + byte[] b = getBytes(e); + if (b != null && b.length > 0) { + jv.beginEntry(e, mev); + jv.update(b.length, b, 0, b.length, mev); + jv.update(-1, null, 0, 0, mev); + } } } } diff --git a/jdk/src/share/classes/java/util/jar/JarInputStream.java b/jdk/src/share/classes/java/util/jar/JarInputStream.java index b84219ea87a..67f27be2975 100644 --- a/jdk/src/share/classes/java/util/jar/JarInputStream.java +++ b/jdk/src/share/classes/java/util/jar/JarInputStream.java @@ -95,7 +95,7 @@ class JarInputStream extends ZipInputStream { man.read(new ByteArrayInputStream(bytes)); closeEntry(); if (doVerify) { - jv = new JarVerifier(bytes, man); + jv = new JarVerifier(bytes); mev = new ManifestEntryVerifier(man); } return (JarEntry)super.getNextEntry(); diff --git a/jdk/src/share/classes/java/util/jar/JarVerifier.java b/jdk/src/share/classes/java/util/jar/JarVerifier.java index 8c69ff5c583..4f84ac28eff 100644 --- a/jdk/src/share/classes/java/util/jar/JarVerifier.java +++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java @@ -48,18 +48,35 @@ class JarVerifier { /* a table mapping names to code signers, for jar entries that have had their actual hashes verified */ - private Map verifiedSigners; + private Hashtable verifiedSigners; /* a table mapping names to code signers, for jar entries that have passed the .SF/.DSA/.EC -> MANIFEST check */ - private Map sigFileSigners; + private Hashtable sigFileSigners; + + /* a hash table to hold .SF bytes */ + private Hashtable sigFileData; + + /** "queue" of pending PKCS7 blocks that we couldn't parse + * until we parsed the .SF file */ + private ArrayList pendingBlocks; /* cache of CodeSigner objects */ private ArrayList signerCache; + /* Are we parsing a block? */ + private boolean parsingBlockOrSF = false; + + /* Are we done parsing META-INF entries? */ + private boolean parsingMeta = true; + /* Are there are files to verify? */ private boolean anyToVerify = true; + /* The output stream to use when keeping track of files we are interested + in */ + private ByteArrayOutputStream baos; + /** The ManifestDigester object */ private volatile ManifestDigester manDig; @@ -75,20 +92,20 @@ class JarVerifier { /** collect -DIGEST-MANIFEST values for blacklist */ private List manifestDigests; - /** The manifest object */ - Manifest man = null; - - public JarVerifier(byte rawBytes[], Manifest man) { - this.man = man; + public JarVerifier(byte rawBytes[]) { manifestRawBytes = rawBytes; - sigFileSigners = new HashMap(); - verifiedSigners = new HashMap(); + sigFileSigners = new Hashtable(); + verifiedSigners = new Hashtable(); + sigFileData = new Hashtable(11); + pendingBlocks = new ArrayList(); + baos = new ByteArrayOutputStream(); manifestDigests = new ArrayList(); } /** - * This method scans to see which entry we're parsing and keeps - * various state information depending on the file being parsed. + * This method scans to see which entry we're parsing and + * keeps various state information depending on what type of + * file is being parsed. */ public void beginEntry(JarEntry je, ManifestEntryVerifier mev) throws IOException @@ -112,6 +129,30 @@ class JarVerifier { * b. digest mismatch between the actual jar entry and the manifest */ + if (parsingMeta) { + String uname = name.toUpperCase(Locale.ENGLISH); + if ((uname.startsWith("META-INF/") || + uname.startsWith("/META-INF/"))) { + + if (je.isDirectory()) { + mev.setEntry(null, je); + return; + } + + if (SignatureFileVerifier.isBlockOrSF(uname)) { + /* We parse only DSA, RSA or EC PKCS7 blocks. */ + parsingBlockOrSF = true; + baos.reset(); + mev.setEntry(null, je); + } + return; + } + } + + if (parsingMeta) { + doneWithMeta(); + } + if (je.isDirectory()) { mev.setEntry(null, je); return; @@ -147,7 +188,11 @@ class JarVerifier { throws IOException { if (b != -1) { - mev.update((byte)b); + if (parsingBlockOrSF) { + baos.write(b); + } else { + mev.update((byte)b); + } } else { processEntry(mev); } @@ -162,7 +207,11 @@ class JarVerifier { throws IOException { if (n != -1) { - mev.update(b, off, n); + if (parsingBlockOrSF) { + baos.write(b, off, n); + } else { + mev.update(b, off, n); + } } else { processEntry(mev); } @@ -174,10 +223,101 @@ class JarVerifier { private void processEntry(ManifestEntryVerifier mev) throws IOException { - JarEntry je = mev.getEntry(); - if ((je != null) && (je.signers == null)) { - je.signers = mev.verify(verifiedSigners, sigFileSigners); - je.certs = mapSignersToCertArray(je.signers); + if (!parsingBlockOrSF) { + JarEntry je = mev.getEntry(); + if ((je != null) && (je.signers == null)) { + je.signers = mev.verify(verifiedSigners, sigFileSigners); + je.certs = mapSignersToCertArray(je.signers); + } + } else { + + try { + parsingBlockOrSF = false; + + if (debug != null) { + debug.println("processEntry: processing block"); + } + + String uname = mev.getEntry().getName() + .toUpperCase(Locale.ENGLISH); + + if (uname.endsWith(".SF")) { + String key = uname.substring(0, uname.length()-3); + byte bytes[] = baos.toByteArray(); + // add to sigFileData in case future blocks need it + sigFileData.put(key, bytes); + // check pending blocks, we can now process + // anyone waiting for this .SF file + Iterator it = pendingBlocks.iterator(); + while (it.hasNext()) { + SignatureFileVerifier sfv = + (SignatureFileVerifier) it.next(); + if (sfv.needSignatureFile(key)) { + if (debug != null) { + debug.println( + "processEntry: processing pending block"); + } + + sfv.setSignatureFile(bytes); + sfv.process(sigFileSigners, manifestDigests); + } + } + return; + } + + // now we are parsing a signature block file + + String key = uname.substring(0, uname.lastIndexOf(".")); + + if (signerCache == null) + signerCache = new ArrayList(); + + if (manDig == null) { + synchronized(manifestRawBytes) { + if (manDig == null) { + manDig = new ManifestDigester(manifestRawBytes); + manifestRawBytes = null; + } + } + } + + SignatureFileVerifier sfv = + new SignatureFileVerifier(signerCache, + manDig, uname, baos.toByteArray()); + + if (sfv.needSignatureFileBytes()) { + // see if we have already parsed an external .SF file + byte[] bytes = (byte[]) sigFileData.get(key); + + if (bytes == null) { + // put this block on queue for later processing + // since we don't have the .SF bytes yet + // (uname, block); + if (debug != null) { + debug.println("adding pending block"); + } + pendingBlocks.add(sfv); + return; + } else { + sfv.setSignatureFile(bytes); + } + } + sfv.process(sigFileSigners, manifestDigests); + + } catch (IOException ioe) { + // e.g. sun.security.pkcs.ParsingException + if (debug != null) debug.println("processEntry caught: "+ioe); + // ignore and treat as unsigned + } catch (SignatureException se) { + if (debug != null) debug.println("processEntry caught: "+se); + // ignore and treat as unsigned + } catch (NoSuchAlgorithmException nsae) { + if (debug != null) debug.println("processEntry caught: "+nsae); + // ignore and treat as unsigned + } catch (CertificateException ce) { + if (debug != null) debug.println("processEntry caught: "+ce); + // ignore and treat as unsigned + } } } @@ -214,15 +354,15 @@ class JarVerifier { * Force a read of the entry data to generate the * verification hash. */ - try (InputStream s = jar.getInputStream(entry)) { + try { + InputStream s = jar.getInputStream(entry); byte[] buffer = new byte[1024]; int n = buffer.length; while (n != -1) { n = s.read(buffer, 0, buffer.length); } + s.close(); } catch (IOException e) { - // Ignore. When an exception is thrown, code signer - // will not be assigned. } } return getCodeSigners(name); @@ -268,7 +408,11 @@ class JarVerifier { */ void doneWithMeta() { + parsingMeta = false; anyToVerify = !sigFileSigners.isEmpty(); + baos = null; + sigFileData = null; + pendingBlocks = null; signerCache = null; manDig = null; // MANIFEST.MF is always treated as signed and verified, @@ -279,41 +423,6 @@ class JarVerifier { } } - /** - * Verifies a PKCS7 SignedData block - * @param key name of block - * @param block the pkcs7 file - * @param ins the clear data - */ - void verifyBlock(String key, byte[] block, InputStream ins) { - try { - if (signerCache == null) - signerCache = new ArrayList(); - - if (manDig == null) { - synchronized(manifestRawBytes) { - if (manDig == null) { - manDig = new ManifestDigester(manifestRawBytes); - manifestRawBytes = null; - } - } - } - SignatureFileVerifier sfv = - new SignatureFileVerifier(signerCache, man, - manDig, key, block); - - if (sfv.needSignatureFile()) { - // see if we have already parsed an external .SF file - sfv.setSignatureFile(ins); - } - sfv.process(sigFileSigners, manifestDigests); - } catch (Exception e) { - if (debug != null) { - e.printStackTrace(); - } - } - } - static class VerifierStream extends java.io.InputStream { private InputStream is; @@ -444,7 +553,10 @@ class JarVerifier { * but this handles a CodeSource of any type, just in case. */ CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true); - List sourceList = Arrays.asList(sources); + List sourceList = new ArrayList(); + for (int i = 0; i < sources.length; i++) { + sourceList.add(sources[i]); + } int j = sourceList.indexOf(cs); if (j != -1) { CodeSigner[] match; diff --git a/jdk/src/share/classes/sun/security/pkcs/PKCS7.java b/jdk/src/share/classes/sun/security/pkcs/PKCS7.java index 72a2e5f9f3e..54e52151256 100644 --- a/jdk/src/share/classes/sun/security/pkcs/PKCS7.java +++ b/jdk/src/share/classes/sun/security/pkcs/PKCS7.java @@ -38,7 +38,6 @@ import java.security.*; import sun.security.util.*; import sun.security.x509.AlgorithmId; import sun.security.x509.CertificateIssuerName; -import sun.security.x509.KeyUsageExtension; import sun.security.x509.X509CertImpl; import sun.security.x509.X509CertInfo; import sun.security.x509.X509CRLImpl; @@ -493,7 +492,7 @@ public class PKCS7 { // CRLs (optional) if (crls != null && crls.length != 0) { // cast to X509CRLImpl[] since X509CRLImpl implements DerEncoder - Set implCRLs = new HashSet<>(crls.length); + Set implCRLs = new HashSet(crls.length); for (X509CRL crl: crls) { if (crl instanceof X509CRLImpl) implCRLs.add((X509CRLImpl) crl); @@ -530,168 +529,6 @@ public class PKCS7 { block.encode(out); } - /** - * Verifying signed data using an external chunked data source. - */ - public static class PKCS7Verifier { - - private final SignerInfo si; // Signer to verify - private final MessageDigest md; // MessageDigest object for chunks - private final Signature sig; // Signature object for chunks - - private PKCS7Verifier(SignerInfo si, MessageDigest md, Signature sig) { - this.si = si; - this.md = md; - this.sig = sig; - } - - public static PKCS7Verifier from(PKCS7 block, SignerInfo si) throws - SignatureException, NoSuchAlgorithmException { - - try { - MessageDigest md = null; - Signature sig; - - ContentInfo content = block.getContentInfo(); - String digestAlgname = si.getDigestAlgorithmId().getName(); - - // if there are authenticate attributes, feed data chunks to - // the message digest. In this case, pv.md is not null - if (si.authenticatedAttributes != null) { - // first, check content type - ObjectIdentifier contentType = (ObjectIdentifier) - si.authenticatedAttributes.getAttributeValue( - PKCS9Attribute.CONTENT_TYPE_OID); - if (contentType == null || - !contentType.equals(content.contentType)) - return null; // contentType does not match, bad SignerInfo - - // now, check message digest - byte[] messageDigest = (byte[]) - si.authenticatedAttributes.getAttributeValue( - PKCS9Attribute.MESSAGE_DIGEST_OID); - - if (messageDigest == null) // fail if there is no message digest - return null; - - md = MessageDigest.getInstance(digestAlgname); - } - - // put together digest algorithm and encryption algorithm - // to form signing algorithm - String encryptionAlgname = - si.getDigestEncryptionAlgorithmId().getName(); - - // Workaround: sometimes the encryptionAlgname is actually - // a signature name - String tmp = AlgorithmId.getEncAlgFromSigAlg(encryptionAlgname); - if (tmp != null) encryptionAlgname = tmp; - String algname = AlgorithmId.makeSigAlg( - digestAlgname, encryptionAlgname); - - sig = Signature.getInstance(algname); - X509Certificate cert = si.getCertificate(block); - - if (cert == null) { - return null; - } - if (cert.hasUnsupportedCriticalExtension()) { - throw new SignatureException("Certificate has unsupported " - + "critical extension(s)"); - } - - // Make sure that if the usage of the key in the certificate is - // restricted, it can be used for digital signatures. - // XXX We may want to check for additional extensions in the - // future. - boolean[] keyUsageBits = cert.getKeyUsage(); - if (keyUsageBits != null) { - KeyUsageExtension keyUsage; - try { - // We don't care whether or not this extension was marked - // critical in the certificate. - // We're interested only in its value (i.e., the bits set) - // and treat the extension as critical. - keyUsage = new KeyUsageExtension(keyUsageBits); - } catch (IOException ioe) { - throw new SignatureException("Failed to parse keyUsage " - + "extension"); - } - - boolean digSigAllowed = ((Boolean)keyUsage.get( - KeyUsageExtension.DIGITAL_SIGNATURE)).booleanValue(); - - boolean nonRepuAllowed = ((Boolean)keyUsage.get( - KeyUsageExtension.NON_REPUDIATION)).booleanValue(); - - if (!digSigAllowed && !nonRepuAllowed) { - throw new SignatureException("Key usage restricted: " - + "cannot be used for " - + "digital signatures"); - } - } - - PublicKey key = cert.getPublicKey(); - sig.initVerify(key); - return new PKCS7Verifier(si, md, sig); - } catch (IOException e) { - throw new SignatureException("IO error verifying signature:\n" + - e.getMessage()); - - } catch (InvalidKeyException e) { - throw new SignatureException("InvalidKey: " + e.getMessage()); - - } - } - - public void update(byte[] data, int off, int end) - throws SignatureException { - if (md != null) { - md.update(data, off, end-off); - } else { - sig.update(data, off, end-off); - } - } - - public SignerInfo verify() throws SignatureException { - try { - // if there are authenticate attributes, get the message - // digest and compare it with the digest of data - if (md != null) { - // now, check message digest - byte[] messageDigest = (byte[]) - si.authenticatedAttributes.getAttributeValue( - PKCS9Attribute.MESSAGE_DIGEST_OID); - - byte[] computedMessageDigest = md.digest(); - - if (!MessageDigest.isEqual( - messageDigest, computedMessageDigest)) { - return null; - } - - // message digest attribute matched - // digest of original data - - // the data actually signed is the DER encoding of - // the authenticated attributes (tagged with - // the "SET OF" tag, not 0xA0). - byte[] dataSigned = si.authenticatedAttributes.getDerEncoding(); - sig.update(dataSigned); - } - - if (sig.verify(si.getEncryptedDigest())) { - return si; - } - - } catch (IOException e) { - throw new SignatureException("IO error verifying signature:\n" + - e.getMessage()); - } - return null; - } - } - /** * This verifies a given SignerInfo. * @@ -717,16 +554,19 @@ public class PKCS7 { public SignerInfo[] verify(byte[] bytes) throws NoSuchAlgorithmException, SignatureException { - List intResult = new ArrayList<>(); + Vector intResult = new Vector(); for (int i = 0; i < signerInfos.length; i++) { SignerInfo signerInfo = verify(signerInfos[i], bytes); if (signerInfo != null) { - intResult.add(signerInfo); + intResult.addElement(signerInfo); } } - if (!intResult.isEmpty()) { - return intResult.toArray(new SignerInfo[intResult.size()]); + if (intResult.size() != 0) { + + SignerInfo[] result = new SignerInfo[intResult.size()]; + intResult.copyInto(result); + return result; } return null; } diff --git a/jdk/src/share/classes/sun/security/pkcs/SignerInfo.java b/jdk/src/share/classes/sun/security/pkcs/SignerInfo.java index 6addf69e416..93fab9df4e0 100644 --- a/jdk/src/share/classes/sun/security/pkcs/SignerInfo.java +++ b/jdk/src/share/classes/sun/security/pkcs/SignerInfo.java @@ -230,7 +230,7 @@ public class SignerInfo implements DerEncoder { if (userCert == null) return null; - ArrayList certList = new ArrayList<>(); + ArrayList certList = new ArrayList(); certList.add(userCert); X509Certificate[] pkcsCerts = block.getCertificates(); @@ -276,20 +276,132 @@ public class SignerInfo implements DerEncoder { /* Returns null if verify fails, this signerInfo if verify succeeds. */ SignerInfo verify(PKCS7 block, byte[] data) - throws NoSuchAlgorithmException, SignatureException { + throws NoSuchAlgorithmException, SignatureException { - PKCS7.PKCS7Verifier p7v = PKCS7.PKCS7Verifier.from(block, this); - if (p7v == null) return null; - if (data == null) { - try { - data = block.getContentInfo().getContentBytes(); - } catch (IOException e) { - throw new SignatureException("IO error verifying signature:\n" + - e.getMessage()); + try { + + ContentInfo content = block.getContentInfo(); + if (data == null) { + data = content.getContentBytes(); } + + String digestAlgname = getDigestAlgorithmId().getName(); + + byte[] dataSigned; + + // if there are authenticate attributes, get the message + // digest and compare it with the digest of data + if (authenticatedAttributes == null) { + dataSigned = data; + } else { + + // first, check content type + ObjectIdentifier contentType = (ObjectIdentifier) + authenticatedAttributes.getAttributeValue( + PKCS9Attribute.CONTENT_TYPE_OID); + if (contentType == null || + !contentType.equals(content.contentType)) + return null; // contentType does not match, bad SignerInfo + + // now, check message digest + byte[] messageDigest = (byte[]) + authenticatedAttributes.getAttributeValue( + PKCS9Attribute.MESSAGE_DIGEST_OID); + + if (messageDigest == null) // fail if there is no message digest + return null; + + MessageDigest md = MessageDigest.getInstance(digestAlgname); + byte[] computedMessageDigest = md.digest(data); + + if (messageDigest.length != computedMessageDigest.length) + return null; + for (int i = 0; i < messageDigest.length; i++) { + if (messageDigest[i] != computedMessageDigest[i]) + return null; + } + + // message digest attribute matched + // digest of original data + + // the data actually signed is the DER encoding of + // the authenticated attributes (tagged with + // the "SET OF" tag, not 0xA0). + dataSigned = authenticatedAttributes.getDerEncoding(); + } + + // put together digest algorithm and encryption algorithm + // to form signing algorithm + String encryptionAlgname = + getDigestEncryptionAlgorithmId().getName(); + + // Workaround: sometimes the encryptionAlgname is actually + // a signature name + String tmp = AlgorithmId.getEncAlgFromSigAlg(encryptionAlgname); + if (tmp != null) encryptionAlgname = tmp; + String algname = AlgorithmId.makeSigAlg( + digestAlgname, encryptionAlgname); + + Signature sig = Signature.getInstance(algname); + X509Certificate cert = getCertificate(block); + + if (cert == null) { + return null; + } + if (cert.hasUnsupportedCriticalExtension()) { + throw new SignatureException("Certificate has unsupported " + + "critical extension(s)"); + } + + // Make sure that if the usage of the key in the certificate is + // restricted, it can be used for digital signatures. + // XXX We may want to check for additional extensions in the + // future. + boolean[] keyUsageBits = cert.getKeyUsage(); + if (keyUsageBits != null) { + KeyUsageExtension keyUsage; + try { + // We don't care whether or not this extension was marked + // critical in the certificate. + // We're interested only in its value (i.e., the bits set) + // and treat the extension as critical. + keyUsage = new KeyUsageExtension(keyUsageBits); + } catch (IOException ioe) { + throw new SignatureException("Failed to parse keyUsage " + + "extension"); + } + + boolean digSigAllowed = ((Boolean)keyUsage.get( + KeyUsageExtension.DIGITAL_SIGNATURE)).booleanValue(); + + boolean nonRepuAllowed = ((Boolean)keyUsage.get( + KeyUsageExtension.NON_REPUDIATION)).booleanValue(); + + if (!digSigAllowed && !nonRepuAllowed) { + throw new SignatureException("Key usage restricted: " + + "cannot be used for " + + "digital signatures"); + } + } + + PublicKey key = cert.getPublicKey(); + sig.initVerify(key); + + sig.update(dataSigned); + + if (sig.verify(encryptedDigest)) { + return this; + } + + } catch (IOException e) { + throw new SignatureException("IO error verifying signature:\n" + + e.getMessage()); + + } catch (InvalidKeyException e) { + throw new SignatureException("InvalidKey: " + e.getMessage()); + } - p7v.update(data, 0, data.length); - return p7v.verify(); + return null; } /* Verify the content of the pkcs7 block. */ diff --git a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java index 4fa1826cb37..3d1b4733c30 100644 --- a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java +++ b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java @@ -191,8 +191,8 @@ public class ManifestEntryVerifier { * * */ - public CodeSigner[] verify(Map verifiedSigners, - Map sigFileSigners) + public CodeSigner[] verify(Hashtable verifiedSigners, + Hashtable sigFileSigners) throws JarException { if (skip) { diff --git a/jdk/src/share/classes/sun/security/util/SignatureFileManifest.java b/jdk/src/share/classes/sun/security/util/SignatureFileManifest.java deleted file mode 100644 index fd00c1299a3..00000000000 --- a/jdk/src/share/classes/sun/security/util/SignatureFileManifest.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.security.util; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; -import java.util.jar.Attributes; -import java.util.jar.Manifest; - -/** - * This class provides streaming mode reading of manifest files. - * Used by {@link SignatureFileVerifier}. - */ -class SignatureFileManifest extends Manifest { - - /* - * Reading a manifest into this object by calling update(byte[]) on chunks. - * During the reading, the bytes are saved in (@code current} until a line - * is complete and the key-value pair is saved in {@code currentAttr}. When - * a section is complete, {@code consumeAttr} is called to merge - * {@code currentAttr} into main attributes or a named entry. - */ - - // Internal state during update() style reading - // 0. not in update mode - // 1, in update mode but main attributes not completed yet - // 2. main attributes completed, still reading the entries - private int state = 0; - - // The partial line read - private byte[] current; - - // Number of bytes in current - private int currentPos = 0; - - // The current Attribute - private Attributes currentAttr; - - /** - * Reads a manifest in chunks. - *

    - * This method must be called in a row, reading chunks from a single - * manifest file by order. After all chunks are read, caller must call - * {@code update(null)} to fully consume the manifest. - *

    - * The entry names and attributes read will be merged in with the current - * manifest entries. The {@link #read} method cannot be called inside a - * row of update calls. - *

    - * Along with the calls, caller can call {@link #getMainAttributes()}, - * {@link #getAttributes(java.lang.String)} or {@link #getEntries()} - * to get already available contents. However, in order not to return - * partial result, when the main attributes in the new manifest is not - * consumed completely, {@link #getMainAttributes()} throws an - * {@code IllegalStateException}. When a certain named entry is not - * consumed completely, {@link #getAttributes(java.lang.String)} - * returns the old {@code Attributes} for the name (if it exists). - * - * @param data null for last call, otherwise, feeding chunks - * @param offset offset into data to begin read - * @param length length of data after offset to read - * @exception IOException if an I/O error has occurred - * @exception IllegalStateException if {@code update(null)} is called - * without any previous {@code update(non-null)} call - */ - public void update(byte[] data, int offset, int length) throws IOException { - - // The last call - if (data == null) { - if (state == 0) { - throw new IllegalStateException("No data to update"); - } - // We accept manifest not ended with \n or \n\n - if (hasLastByte()) { - consumeCurrent(); - } - // We accept empty lines at the end - if (!currentAttr.isEmpty()) { - consumeAttr(); - } - state = 0; // back to non-update state - current = null; - currentAttr = null; - return; - } - - // The first call - if (state == 0) { - current = new byte[1024]; - currentAttr = super.getMainAttributes(); // the main attribute - state = 1; - } - - int end = offset + length; - - while (offset < end) { - switch (data[offset]) { - case '\r': - break; // always skip - case '\n': - if (hasLastByte() && lastByte() == '\n') { // new section - consumeCurrent(); - consumeAttr(); - if (state == 1) { - state = 2; - } - currentAttr = new Attributes(2); - } else { - if (hasLastByte()) { - // save \n into current but do not parse, - // there might be a continuation later - ensureCapacity(); - current[currentPos++] = data[offset]; - } else if (state == 1) { - // there can be multiple empty lines between - // sections, but cannot be at the beginning - throw new IOException("invalid manifest format"); - } - } - break; - case ' ': - if (!hasLastByte()) { - throw new IOException("invalid manifest format"); - } else if (lastByte() == '\n') { - currentPos--; // continuation, remove last \n - } else { // a very normal ' ' - ensureCapacity(); - current[currentPos++] = data[offset]; - } - break; - default: - if (hasLastByte() && lastByte() == '\n') { - // The start of a new pair, not continuation - consumeCurrent(); // the last line read - } - ensureCapacity(); - current[currentPos++] = data[offset]; - break; - } - offset++; - } - } - - /** - * Returns the main Attributes for the Manifest. - * @exception IllegalStateException the main attributes is being read - * @return the main Attributes for the Manifest - */ - public Attributes getMainAttributes() { - if (state == 1) { - throw new IllegalStateException(); - } - return super.getMainAttributes(); - } - - /** - * Reads the Manifest from the specified InputStream. The entry - * names and attributes read will be merged in with the current - * manifest entries. - * - * @param is the input stream - * @exception IOException if an I/O error has occurred - * @exception IllegalStateException if called between two {@link #update} - * calls - */ - public void read(InputStream is) throws IOException { - if (state != 0) { - throw new IllegalStateException("Cannot call read between updates"); - } - super.read(is); - } - - /* - * ---------- Helper methods ----------------- - */ - - private void ensureCapacity() { - if (currentPos >= current.length-1) { - current = Arrays.copyOf(current, current.length*2); - } - } - - private boolean hasLastByte() { - return currentPos > 0; - } - - private byte lastByte() { - return current[currentPos-1]; - } - - // Parse current as key:value and save into currentAttr. - // There MUST be something inside current. - private void consumeCurrent() throws IOException { - // current normally has a \n end, except for the last line - if (current[currentPos-1] == '\n') currentPos--; - for (int i=0; i createdDigests; @@ -86,7 +83,6 @@ public class SignatureFileVerifier { * @param rawBytes the raw bytes of the signature block file */ public SignatureFileVerifier(ArrayList signerCache, - Manifest man, ManifestDigester md, String name, byte rawBytes[]) @@ -98,18 +94,13 @@ public class SignatureFileVerifier { try { obj = Providers.startJarVerification(); block = new PKCS7(rawBytes); - byte[] contentData = block.getContentInfo().getData(); - if (contentData != null) { - sfStream = new ByteArrayInputStream(contentData); - } + sfBytes = block.getContentInfo().getData(); certificateFactory = CertificateFactory.getInstance("X509"); } finally { Providers.stopJarVerification(obj); } this.name = name.substring(0, name.lastIndexOf(".")) .toUpperCase(Locale.ENGLISH); - - this.man = man; this.md = md; this.signerCache = signerCache; } @@ -117,13 +108,31 @@ public class SignatureFileVerifier { /** * returns true if we need the .SF file */ - public boolean needSignatureFile() + public boolean needSignatureFileBytes() { - return sfStream == null; + + return sfBytes == null; } - public void setSignatureFile(InputStream ins) { - this.sfStream = ins; + + /** + * returns true if we need this .SF file. + * + * @param name the name of the .SF file without the extension + * + */ + public boolean needSignatureFile(String name) + { + return this.name.equalsIgnoreCase(name); + } + + /** + * used to set the raw bytes of the .SF file when it + * is external to the signature block file. + */ + public void setSignatureFile(byte sfBytes[]) + { + this.sfBytes = sfBytes; } /** @@ -136,18 +145,12 @@ public class SignatureFileVerifier { * Signature File or PKCS7 block file name */ public static boolean isBlockOrSF(String s) { - return s.endsWith(".SF") || isBlock(s); - } - - /** - * Utility method used by JarVerifier to determine PKCS7 block - * files names that are supported - * - * @param s file name - * @return true if the input file name is a PKCS7 block file name - */ - public static boolean isBlock(String s) { - return s.endsWith(".DSA") || s.endsWith(".RSA") || s.endsWith(".EC"); + // we currently only support DSA and RSA PKCS7 blocks + if (s.endsWith(".SF") || s.endsWith(".DSA") || + s.endsWith(".RSA") || s.endsWith(".EC")) { + return true; + } + return false; } /** get digest from cache */ @@ -177,7 +180,7 @@ public class SignatureFileVerifier { * * */ - public void process(Map signers, + public void process(Hashtable signers, List manifestDigests) throws IOException, SignatureException, NoSuchAlgorithmException, JarException, CertificateException @@ -194,86 +197,31 @@ public class SignatureFileVerifier { } - private void processImpl(Map signers, + private void processImpl(Hashtable signers, List manifestDigests) throws IOException, SignatureException, NoSuchAlgorithmException, JarException, CertificateException { - SignatureFileManifest sf = new SignatureFileManifest(); - InputStream ins = sfStream; + Manifest sf = new Manifest(); + sf.read(new ByteArrayInputStream(sfBytes)); - byte[] buffer = new byte[4096]; - int sLen = block.getSignerInfos().length; - boolean mainOK = false; // main attributes of SF is available... - boolean manifestSigned = false; // and it matches MANIFEST.MF - BASE64Decoder decoder = new BASE64Decoder(); + String version = + sf.getMainAttributes().getValue(Attributes.Name.SIGNATURE_VERSION); - PKCS7.PKCS7Verifier[] pvs = new PKCS7.PKCS7Verifier[sLen]; - for (int i=0; i intResult = new ArrayList<>(sLen); - for (int i = 0; i < sLen; i++) { - if (pvs[i] != null) { - SignerInfo signerInfo = pvs[i].verify(); - if (signerInfo != null) { - intResult.add(signerInfo); - } - } - } - if (intResult.isEmpty()) { + if (infos == null) { throw new SecurityException("cannot verify signature block file " + name); } - SignerInfo[] infos = - intResult.toArray(new SignerInfo[intResult.size()]); + BASE64Decoder decoder = new BASE64Decoder(); CodeSigner[] newSigners = getSigners(infos, block); @@ -281,37 +229,26 @@ public class SignatureFileVerifier { if (newSigners == null) return; + Iterator> entries = + sf.getEntries().entrySet().iterator(); + + // see if we can verify the whole manifest first + boolean manifestSigned = verifyManifestHash(sf, md, decoder, manifestDigests); + // verify manifest main attributes if (!manifestSigned && !verifyManifestMainAttrs(sf, md, decoder)) { throw new SecurityException ("Invalid signature file digest for Manifest main attributes"); } - Iterator> entries; - - if (manifestSigned) { - if (debug != null) { - debug.println("full manifest signature match, " - + "update signer info from MANIFEST.MF"); - } - entries = man.getEntries().entrySet().iterator(); - } else { - if (debug != null) { - debug.println("full manifest signature unmatch, " - + "update signer info from SF file"); - } - entries = sf.getEntries().entrySet().iterator(); - } - - // go through each section - + // go through each section in the signature file while(entries.hasNext()) { Map.Entry e = entries.next(); String name = e.getKey(); if (manifestSigned || - (verifySection(e.getValue(), name, md, decoder))) { + (verifySection(e.getValue(), name, md, decoder))) { if (name.startsWith("./")) name = name.substring(2); @@ -656,6 +593,7 @@ public class SignatureFileVerifier { if (set == subset) return true; + boolean match; for (int i = 0; i < subset.length; i++) { if (!contains(set, subset[i])) return false; @@ -675,6 +613,8 @@ public class SignatureFileVerifier { if ((oldSigners == null) && (signers == newSigners)) return true; + boolean match; + // make sure all oldSigners are in signers if ((oldSigners != null) && !isSubSet(oldSigners, signers)) return false; @@ -698,7 +638,7 @@ public class SignatureFileVerifier { } void updateSigners(CodeSigner[] newSigners, - Map signers, String name) { + Hashtable signers, String name) { CodeSigner[] oldSigners = signers.get(name); diff --git a/jdk/test/java/util/jar/JarInputStream/ScanSignedJar.java b/jdk/test/java/util/jar/JarInputStream/ScanSignedJar.java index 425e5659715..86dbf793e74 100644 --- a/jdk/test/java/util/jar/JarInputStream/ScanSignedJar.java +++ b/jdk/test/java/util/jar/JarInputStream/ScanSignedJar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,11 +27,9 @@ * @summary Confirm that JarEntry.getCertificates identifies signed entries. */ -import java.io.*; import java.net.URL; import java.security.CodeSigner; import java.security.cert.Certificate; -import java.util.Enumeration; import java.util.jar.*; /* @@ -72,6 +70,9 @@ public class ScanSignedJar { if (signers == null && certificates == null) { System.out.println("[unsigned]\t" + name + "\t(" + size + " bytes)"); + if (name.equals("Count.class")) { + throw new Exception("Count.class should be signed"); + } } else if (signers != null && certificates != null) { System.out.println("[" + signers.length + (signers.length == 1 ? " signer" : " signers") + "]\t" + diff --git a/jdk/test/java/util/jar/JarInputStream/TestIndexedJarWithBadSignature.java b/jdk/test/java/util/jar/JarInputStream/TestIndexedJarWithBadSignature.java index 977c10121da..2e74eb10069 100644 --- a/jdk/test/java/util/jar/JarInputStream/TestIndexedJarWithBadSignature.java +++ b/jdk/test/java/util/jar/JarInputStream/TestIndexedJarWithBadSignature.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ public class TestIndexedJarWithBadSignature { public static void main(String...args) throws Throwable { try (JarInputStream jis = new JarInputStream( - new FileInputStream(System.getProperty("tst.src", ".") + + new FileInputStream(System.getProperty("test.src", ".") + System.getProperty("file.separator") + "BadSignedJar.jar"))) { From cf97b67aa29b33791b466ba7bbdce81cb14d512d Mon Sep 17 00:00:00 2001 From: Denis Lila Date: Thu, 28 Apr 2011 08:55:19 -0400 Subject: [PATCH 072/117] 7036754: NaNs in stroked quadratics Check for them and remove them. Reviewed-by: flar --- .../classes/sun/java2d/pisces/Stroker.java | 252 +++++++++--------- jdk/test/sun/java2d/pisces/Test7036754.java | 58 ++++ 2 files changed, 185 insertions(+), 125 deletions(-) create mode 100644 jdk/test/sun/java2d/pisces/Test7036754.java diff --git a/jdk/src/share/classes/sun/java2d/pisces/Stroker.java b/jdk/src/share/classes/sun/java2d/pisces/Stroker.java index dc270c194c8..6d4a4c75ac5 100644 --- a/jdk/src/share/classes/sun/java2d/pisces/Stroker.java +++ b/jdk/src/share/classes/sun/java2d/pisces/Stroker.java @@ -27,6 +27,8 @@ package sun.java2d.pisces; import java.util.Arrays; import java.util.Iterator; +import static java.lang.Math.ulp; +import static java.lang.Math.sqrt; import sun.awt.geom.PathConsumer2D; @@ -130,7 +132,7 @@ final class Stroker implements PathConsumer2D { private static void computeOffset(final float lx, final float ly, final float w, final float[] m) { - final float len = (float)Math.sqrt(lx*lx + ly*ly); + final float len = (float) sqrt(lx*lx + ly*ly); if (len == 0) { m[0] = m[1] = 0; } else { @@ -217,7 +219,7 @@ final class Stroker implements PathConsumer2D { // this normal's length is at least 0.5 and at most sqrt(2)/2 (because // we know the angle of the arc is > 90 degrees). float nx = my - omy, ny = omx - mx; - float nlen = (float)Math.sqrt(nx*nx + ny*ny); + float nlen = (float) sqrt(nx*nx + ny*ny); float scale = lineWidth2/nlen; float mmx = nx * scale, mmy = ny * scale; @@ -246,8 +248,8 @@ final class Stroker implements PathConsumer2D { // define the bezier curve we're computing. // It is computed using the constraints that P1-P0 and P3-P2 are parallel // to the arc tangents at the endpoints, and that |P1-P0|=|P3-P2|. - float cv = (float)((4.0 / 3.0) * Math.sqrt(0.5-cosext2) / - (1.0 + Math.sqrt(cosext2+0.5))); + float cv = (float) ((4.0 / 3.0) * sqrt(0.5-cosext2) / + (1.0 + sqrt(cosext2+0.5))); // if clockwise, we need to negate cv. if (rev) { // rev is equivalent to isCW(omx, omy, mx, my) cv = -cv; @@ -284,28 +286,20 @@ final class Stroker implements PathConsumer2D { false); } - // Return the intersection point of the lines (x0, y0) -> (x1, y1) - // and (x0p, y0p) -> (x1p, y1p) in m[0] and m[1] - private void computeMiter(final float x0, final float y0, - final float x1, final float y1, - final float x0p, final float y0p, - final float x1p, final float y1p, - final float[] m, int off) + // Put the intersection point of the lines (x0, y0) -> (x1, y1) + // and (x0p, y0p) -> (x1p, y1p) in m[off] and m[off+1]. + // If the lines are parallel, it will put a non finite number in m. + private void computeIntersection(final float x0, final float y0, + final float x1, final float y1, + final float x0p, final float y0p, + final float x1p, final float y1p, + final float[] m, int off) { float x10 = x1 - x0; float y10 = y1 - y0; float x10p = x1p - x0p; float y10p = y1p - y0p; - // if this is 0, the lines are parallel. If they go in the - // same direction, there is no intersection so m[off] and - // m[off+1] will contain infinity, so no miter will be drawn. - // If they go in the same direction that means that the start of the - // current segment and the end of the previous segment have the same - // tangent, in which case this method won't even be involved in - // miter drawing because it won't be called by drawMiter (because - // (mx == omx && my == omy) will be true, and drawMiter will return - // immediately). float den = x10*y10p - x10p*y10; float t = x10p*(y0-y0p) - y10p*(x0-x0p); t /= den; @@ -321,7 +315,8 @@ final class Stroker implements PathConsumer2D { { if ((mx == omx && my == omy) || (pdx == 0 && pdy == 0) || - (dx == 0 && dy == 0)) { + (dx == 0 && dy == 0)) + { return; } @@ -332,12 +327,17 @@ final class Stroker implements PathConsumer2D { my = -my; } - computeMiter((x0 - pdx) + omx, (y0 - pdy) + omy, x0 + omx, y0 + omy, - (dx + x0) + mx, (dy + y0) + my, x0 + mx, y0 + my, - miter, 0); + computeIntersection((x0 - pdx) + omx, (y0 - pdy) + omy, x0 + omx, y0 + omy, + (dx + x0) + mx, (dy + y0) + my, x0 + mx, y0 + my, + miter, 0); float lenSq = (miter[0]-x0)*(miter[0]-x0) + (miter[1]-y0)*(miter[1]-y0); + // If the lines are parallel, lenSq will be either NaN or +inf + // (actually, I'm not sure if the latter is possible. The important + // thing is that -inf is not possible, because lenSq is a square). + // For both of those values, the comparison below will fail and + // no miter will be drawn, which is correct. if (lenSq < miterLimitSq) { emitLineTo(miter[0], miter[1], rev); } @@ -566,8 +566,8 @@ final class Stroker implements PathConsumer2D { // if p1 == p2 && p3 == p4: draw line from p1->p4, unless p1 == p4, // in which case ignore if p1 == p2 - final boolean p1eqp2 = within(x1,y1,x2,y2, 6 * Math.ulp(y2)); - final boolean p3eqp4 = within(x3,y3,x4,y4, 6 * Math.ulp(y4)); + final boolean p1eqp2 = within(x1,y1,x2,y2, 6 * ulp(y2)); + final boolean p3eqp4 = within(x3,y3,x4,y4, 6 * ulp(y4)); if (p1eqp2 && p3eqp4) { getLineOffsets(x1, y1, x4, y4, leftOff, rightOff); return 4; @@ -583,7 +583,7 @@ final class Stroker implements PathConsumer2D { float dotsq = (dx1 * dx4 + dy1 * dy4); dotsq = dotsq * dotsq; float l1sq = dx1 * dx1 + dy1 * dy1, l4sq = dx4 * dx4 + dy4 * dy4; - if (Helpers.within(dotsq, l1sq * l4sq, 4 * Math.ulp(dotsq))) { + if (Helpers.within(dotsq, l1sq * l4sq, 4 * ulp(dotsq))) { getLineOffsets(x1, y1, x4, y4, leftOff, rightOff); return 4; } @@ -693,8 +693,6 @@ final class Stroker implements PathConsumer2D { return 8; } - // compute offset curves using bezier spline through t=0.5 (i.e. - // ComputedCurve(0.5) == IdealParallelCurve(0.5)) // return the kind of curve in the right and left arrays. private int computeOffsetQuad(float[] pts, final int off, float[] leftOff, float[] rightOff) @@ -703,58 +701,69 @@ final class Stroker implements PathConsumer2D { final float x2 = pts[off + 2], y2 = pts[off + 3]; final float x3 = pts[off + 4], y3 = pts[off + 5]; - float dx3 = x3 - x2; - float dy3 = y3 - y2; - float dx1 = x2 - x1; - float dy1 = y2 - y1; + final float dx3 = x3 - x2; + final float dy3 = y3 - y2; + final float dx1 = x2 - x1; + final float dy1 = y2 - y1; - // if p1=p2 or p3=p4 it means that the derivative at the endpoint - // vanishes, which creates problems with computeOffset. Usually - // this happens when this stroker object is trying to winden - // a curve with a cusp. What happens is that curveTo splits - // the input curve at the cusp, and passes it to this function. - // because of inaccuracies in the splitting, we consider points - // equal if they're very close to each other. - - // if p1 == p2 && p3 == p4: draw line from p1->p4, unless p1 == p4, - // in which case ignore. - final boolean p1eqp2 = within(x1,y1,x2,y2, 6 * Math.ulp(y2)); - final boolean p2eqp3 = within(x2,y2,x3,y3, 6 * Math.ulp(y3)); - if (p1eqp2 || p2eqp3) { - getLineOffsets(x1, y1, x3, y3, leftOff, rightOff); - return 4; - } - - // if p2-p1 and p4-p3 are parallel, that must mean this curve is a line - float dotsq = (dx1 * dx3 + dy1 * dy3); - dotsq = dotsq * dotsq; - float l1sq = dx1 * dx1 + dy1 * dy1, l3sq = dx3 * dx3 + dy3 * dy3; - if (Helpers.within(dotsq, l1sq * l3sq, 4 * Math.ulp(dotsq))) { - getLineOffsets(x1, y1, x3, y3, leftOff, rightOff); - return 4; - } - - // this computes the offsets at t=0, 0.5, 1, using the property that - // for any bezier curve the vectors p2-p1 and p4-p3 are parallel to - // the (dx/dt, dy/dt) vectors at the endpoints. + // this computes the offsets at t = 0, 1 computeOffset(dx1, dy1, lineWidth2, offset[0]); computeOffset(dx3, dy3, lineWidth2, offset[1]); - float x1p = x1 + offset[0][0]; // start - float y1p = y1 + offset[0][1]; // point - float x3p = x3 + offset[1][0]; // end - float y3p = y3 + offset[1][1]; // point - computeMiter(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, leftOff, 2); - leftOff[0] = x1p; leftOff[1] = y1p; - leftOff[4] = x3p; leftOff[5] = y3p; - x1p = x1 - offset[0][0]; y1p = y1 - offset[0][1]; - x3p = x3 - offset[1][0]; y3p = y3 - offset[1][1]; - computeMiter(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, rightOff, 2); - rightOff[0] = x1p; rightOff[1] = y1p; - rightOff[4] = x3p; rightOff[5] = y3p; + leftOff[0] = x1 + offset[0][0]; leftOff[1] = y1 + offset[0][1]; + leftOff[4] = x3 + offset[1][0]; leftOff[5] = y3 + offset[1][1]; + rightOff[0] = x1 - offset[0][0]; rightOff[1] = y1 - offset[0][1]; + rightOff[4] = x3 - offset[1][0]; rightOff[5] = y3 - offset[1][1]; + + float x1p = leftOff[0]; // start + float y1p = leftOff[1]; // point + float x3p = leftOff[4]; // end + float y3p = leftOff[5]; // point + + // Corner cases: + // 1. If the two control vectors are parallel, we'll end up with NaN's + // in leftOff (and rightOff in the body of the if below), so we'll + // do getLineOffsets, which is right. + // 2. If the first or second two points are equal, then (dx1,dy1)==(0,0) + // or (dx3,dy3)==(0,0), so (x1p, y1p)==(x1p+dx1, y1p+dy1) + // or (x3p, y3p)==(x3p-dx3, y3p-dy3), which means that + // computeIntersection will put NaN's in leftOff and right off, and + // we will do getLineOffsets, which is right. + computeIntersection(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, leftOff, 2); + float cx = leftOff[2]; + float cy = leftOff[3]; + + if (!(isFinite(cx) && isFinite(cy))) { + // maybe the right path is not degenerate. + x1p = rightOff[0]; + y1p = rightOff[1]; + x3p = rightOff[4]; + y3p = rightOff[5]; + computeIntersection(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, rightOff, 2); + cx = rightOff[2]; + cy = rightOff[3]; + if (!(isFinite(cx) && isFinite(cy))) { + // both are degenerate. This curve is a line. + getLineOffsets(x1, y1, x3, y3, leftOff, rightOff); + return 4; + } + // {left,right}Off[0,1,4,5] are already set to the correct values. + leftOff[2] = 2*x2 - cx; + leftOff[3] = 2*y2 - cy; + return 6; + } + + // rightOff[2,3] = (x2,y2) - ((left_x2, left_y2) - (x2, y2)) + // == 2*(x2, y2) - (left_x2, left_y2) + rightOff[2] = 2*x2 - cx; + rightOff[3] = 2*y2 - cy; return 6; } + private static boolean isFinite(float x) { + return (Float.NEGATIVE_INFINITY < x && x < Float.POSITIVE_INFINITY); + } + // This is where the curve to be processed is put. We give it // enough room to store 2 curves: one for the current subdivision, the // other for the rest of the curve. @@ -812,12 +821,12 @@ final class Stroker implements PathConsumer2D { // if these vectors are too small, normalize them, to avoid future // precision problems. if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) { - float len = (float)Math.sqrt(dxs*dxs + dys*dys); + float len = (float) sqrt(dxs*dxs + dys*dys); dxs /= len; dys /= len; } if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) { - float len = (float)Math.sqrt(dxf*dxf + dyf*dyf); + float len = (float) sqrt(dxf*dxf + dyf*dyf); dxf /= len; dyf /= len; } @@ -834,7 +843,6 @@ final class Stroker implements PathConsumer2D { while(it.hasNext()) { int curCurveOff = it.next(); - kind = 0; switch (type) { case 8: kind = computeOffsetCubic(middle, curCurveOff, lp, rp); @@ -843,24 +851,22 @@ final class Stroker implements PathConsumer2D { kind = computeOffsetQuad(middle, curCurveOff, lp, rp); break; } - if (kind != 0) { - emitLineTo(lp[0], lp[1]); - switch(kind) { - case 8: - emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false); - emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true); - break; - case 6: - emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false); - emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true); - break; - case 4: - emitLineTo(lp[2], lp[3]); - emitLineTo(rp[0], rp[1], true); - break; - } - emitLineTo(rp[kind - 2], rp[kind - 1], true); + emitLineTo(lp[0], lp[1]); + switch(kind) { + case 8: + emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false); + emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true); + break; + case 6: + emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false); + emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true); + break; + case 4: + emitLineTo(lp[2], lp[3]); + emitLineTo(rp[0], rp[1], true); + break; } + emitLineTo(rp[kind - 2], rp[kind - 1], true); } this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2; @@ -887,7 +893,7 @@ final class Stroker implements PathConsumer2D { // we rotate it so that the first vector in the control polygon is // parallel to the x-axis. This will ensure that rotated quarter // circles won't be subdivided. - final float hypot = (float)Math.sqrt(x12 * x12 + y12 * y12); + final float hypot = (float) sqrt(x12 * x12 + y12 * y12); final float cos = x12 / hypot; final float sin = y12 / hypot; final float x1 = cos * pts[0] + sin * pts[1]; @@ -976,12 +982,12 @@ final class Stroker implements PathConsumer2D { // if these vectors are too small, normalize them, to avoid future // precision problems. if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) { - float len = (float)Math.sqrt(dxs*dxs + dys*dys); + float len = (float) sqrt(dxs*dxs + dys*dys); dxs /= len; dys /= len; } if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) { - float len = (float)Math.sqrt(dxf*dxf + dyf*dyf); + float len = (float) sqrt(dxf*dxf + dyf*dyf); dxf /= len; dyf /= len; } @@ -999,20 +1005,18 @@ final class Stroker implements PathConsumer2D { int curCurveOff = it.next(); kind = computeOffsetCubic(middle, curCurveOff, lp, rp); - if (kind != 0) { - emitLineTo(lp[0], lp[1]); - switch(kind) { - case 8: - emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false); - emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true); - break; - case 4: - emitLineTo(lp[2], lp[3]); - emitLineTo(rp[0], rp[1], true); - break; - } - emitLineTo(rp[kind - 2], rp[kind - 1], true); + emitLineTo(lp[0], lp[1]); + switch(kind) { + case 8: + emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false); + emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true); + break; + case 4: + emitLineTo(lp[2], lp[3]); + emitLineTo(rp[0], rp[1], true); + break; } + emitLineTo(rp[kind - 2], rp[kind - 1], true); } this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2; @@ -1050,12 +1054,12 @@ final class Stroker implements PathConsumer2D { // if these vectors are too small, normalize them, to avoid future // precision problems. if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) { - float len = (float)Math.sqrt(dxs*dxs + dys*dys); + float len = (float) sqrt(dxs*dxs + dys*dys); dxs /= len; dys /= len; } if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) { - float len = (float)Math.sqrt(dxf*dxf + dyf*dyf); + float len = (float) sqrt(dxf*dxf + dyf*dyf); dxf /= len; dyf /= len; } @@ -1073,20 +1077,18 @@ final class Stroker implements PathConsumer2D { int curCurveOff = it.next(); kind = computeOffsetQuad(middle, curCurveOff, lp, rp); - if (kind != 0) { - emitLineTo(lp[0], lp[1]); - switch(kind) { - case 6: - emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false); - emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true); - break; - case 4: - emitLineTo(lp[2], lp[3]); - emitLineTo(rp[0], rp[1], true); - break; - } - emitLineTo(rp[kind - 2], rp[kind - 1], true); + emitLineTo(lp[0], lp[1]); + switch(kind) { + case 6: + emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false); + emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true); + break; + case 4: + emitLineTo(lp[2], lp[3]); + emitLineTo(rp[0], rp[1], true); + break; } + emitLineTo(rp[kind - 2], rp[kind - 1], true); } this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2; diff --git a/jdk/test/sun/java2d/pisces/Test7036754.java b/jdk/test/sun/java2d/pisces/Test7036754.java new file mode 100644 index 00000000000..1dd39ddc8b9 --- /dev/null +++ b/jdk/test/sun/java2d/pisces/Test7036754.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 7036754 + * + * @summary Verifies that there are no non-finite numbers when stroking + * certain quadratic curves. + * + * @author Jim Graham + * @run main Test7036754 + */ + +import java.awt.*; +import java.awt.geom.*; + +public class Test7036754 { + public static void main(String argv[]) { + Shape s = new QuadCurve2D.Float(839.24677f, 508.97888f, + 839.2953f, 508.97122f, + 839.3438f, 508.96353f); + s = new BasicStroke(10f).createStrokedShape(s); + float nsegs[] = {2, 2, 4, 6, 0}; + float coords[] = new float[6]; + PathIterator pi = s.getPathIterator(null); + while (!pi.isDone()) { + int type = pi.currentSegment(coords); + for (int i = 0; i < nsegs[type]; i++) { + float c = coords[i]; + if (Float.isNaN(c) || Float.isInfinite(c)) { + throw new RuntimeException("bad value in stroke"); + } + } + pi.next(); + } + } +} From 6ab11e169ddeb6da803cb589a8b77fa49ca97df7 Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Thu, 28 Apr 2011 09:46:12 -0400 Subject: [PATCH 073/117] 7038565: address Findbugs issue in BatchUpdateException Reviewed-by: alanb, forax --- .../java/sql/BatchUpdateException.java | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/jdk/src/share/classes/java/sql/BatchUpdateException.java b/jdk/src/share/classes/java/sql/BatchUpdateException.java index a95e2bfa419..4fa6241169f 100644 --- a/jdk/src/share/classes/java/sql/BatchUpdateException.java +++ b/jdk/src/share/classes/java/sql/BatchUpdateException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ package java.sql; +import java.util.Arrays; + /** * The subclass of {@link SQLException} thrown when an error * occurs during a batch update operation. In addition to the @@ -77,8 +79,7 @@ public class BatchUpdateException extends SQLException { */ public BatchUpdateException( String reason, String SQLState, int vendorCode, int[] updateCounts ) { - super(reason, SQLState, vendorCode); - this.updateCounts = updateCounts; + this(reason, SQLState, vendorCode, updateCounts, null); } /** @@ -105,8 +106,7 @@ public class BatchUpdateException extends SQLException { */ public BatchUpdateException(String reason, String SQLState, int[] updateCounts) { - super(reason, SQLState); - this.updateCounts = updateCounts; + this(reason, SQLState, 0, updateCounts, null); } /** @@ -132,8 +132,7 @@ public class BatchUpdateException extends SQLException { * @since 1.2 */ public BatchUpdateException(String reason, int[] updateCounts) { - super(reason); - this.updateCounts = updateCounts; + this(reason, null, 0, updateCounts, null); } /** @@ -156,8 +155,7 @@ public class BatchUpdateException extends SQLException { * @since 1.2 */ public BatchUpdateException(int[] updateCounts) { - super(); - this.updateCounts = updateCounts; + this(null, null, 0, updateCounts, null); } /** @@ -172,8 +170,7 @@ public class BatchUpdateException extends SQLException { * @since 1.2 */ public BatchUpdateException() { - super(); - this.updateCounts = null; + this(null, null, 0, null, null); } /** @@ -191,8 +188,7 @@ public class BatchUpdateException extends SQLException { * @since 1.6 */ public BatchUpdateException(Throwable cause) { - super(cause); - this.updateCounts = null; + this(null, null, 0, null, cause); } /** @@ -218,8 +214,7 @@ public class BatchUpdateException extends SQLException { * @since 1.6 */ public BatchUpdateException(int []updateCounts , Throwable cause) { - super(cause); - this.updateCounts = updateCounts; + this(null, null, 0, updateCounts, cause); } /** @@ -243,8 +238,7 @@ public class BatchUpdateException extends SQLException { * @since 1.6 */ public BatchUpdateException(String reason, int []updateCounts, Throwable cause) { - super(reason,cause); - this.updateCounts = updateCounts; + this(reason, null, 0, updateCounts, cause); } /** @@ -269,8 +263,7 @@ public class BatchUpdateException extends SQLException { */ public BatchUpdateException(String reason, String SQLState, int []updateCounts, Throwable cause) { - super(reason,SQLState,cause); - this.updateCounts = updateCounts; + this(reason, SQLState, 0, updateCounts, cause); } /** @@ -297,8 +290,8 @@ public class BatchUpdateException extends SQLException { */ public BatchUpdateException(String reason, String SQLState, int vendorCode, int []updateCounts,Throwable cause) { - super(reason,SQLState,vendorCode,cause); - this.updateCounts = updateCounts; + super(reason, SQLState, vendorCode, cause); + this.updateCounts = (updateCounts == null) ? null : Arrays.copyOf(updateCounts, updateCounts.length); } /** @@ -332,7 +325,7 @@ public class BatchUpdateException extends SQLException { * @since 1.3 */ public int[] getUpdateCounts() { - return updateCounts; + return (updateCounts == null) ? null : Arrays.copyOf(updateCounts, updateCounts.length); } /** @@ -340,7 +333,7 @@ public class BatchUpdateException extends SQLException { * @serial * @since 1.2 */ - private int[] updateCounts; + private final int[] updateCounts; private static final long serialVersionUID = 5977529877145521757L; } From c9f3d958ec3d62c02f19ec1e34c601c276fe7f25 Mon Sep 17 00:00:00 2001 From: Andrei Dmitriev Date: Thu, 28 Apr 2011 20:14:30 +0400 Subject: [PATCH 074/117] 6956646: Test: MouseWheelEvent/InfiniteRecursion test receives more MouseWheelEvents than expected Reviewed-by: serb, dcherepanov --- .../InfiniteRecursion/InfiniteRecursion.java | 13 ++++++++++--- .../InfiniteRecursion/InfiniteRecursion_1.java | 11 ++++++++--- .../InfiniteRecursion/InfiniteRecursion_2.java | 11 ++++++++--- .../InfiniteRecursion/InfiniteRecursion_3.java | 11 ++++++++--- .../InfiniteRecursion/InfiniteRecursion_4.java | 10 +++++++--- 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java index 6ec02ffbf45..e5533b41891 100644 --- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java +++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,6 +50,11 @@ import test.java.awt.regtesthelpers.Sysout; public class InfiniteRecursion { final static Robot robot = Util.createRobot(); final static int MOVE_COUNT = 5; + + //*2 for both rotation directions, + //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor + final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2; + static int actualEvents = 0; public static void main(String []s) @@ -96,8 +101,10 @@ public class InfiniteRecursion { Util.waitForIdle(robot); - if (actualEvents != MOVE_COUNT * 2) { - AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents); + //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents + //result in a single wheel rotation. + if (actualEvents != EXPECTED_COUNT) { + AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents); } } } diff --git a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java index 3ed18f0e4a2..733af38731d 100644 --- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java +++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,6 +50,9 @@ import test.java.awt.regtesthelpers.Sysout; public class InfiniteRecursion_1 { final static Robot robot = Util.createRobot(); final static int MOVE_COUNT = 5; + //*2 for both rotation directions, + //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor + final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2; static int actualEvents = 0; public static void main(String []s) @@ -95,8 +98,10 @@ public class InfiniteRecursion_1 { } Util.waitForIdle(robot); - if (actualEvents != MOVE_COUNT * 2) { - AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents); + //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents + //result in a single wheel rotation. + if (actualEvents != EXPECTED_COUNT) { + AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents); } } } diff --git a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java index 4aecedeb833..94444088671 100644 --- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java +++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,6 +56,9 @@ import java.applet.Applet; public class InfiniteRecursion_2 extends Applet { final static Robot robot = Util.createRobot(); final static int MOVE_COUNT = 5; + //*2 for both rotation directions, + //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor + final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2; static int actualEvents = 0; public void init() @@ -107,8 +110,10 @@ public class InfiniteRecursion_2 extends Applet { } Util.waitForIdle(robot); - if (actualEvents != MOVE_COUNT * 2) { - AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents); + //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents + //result in a single wheel rotation. + if (actualEvents != EXPECTED_COUNT) { + AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents); } }// start() } diff --git a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java index 2804b14ce7e..c12636acdc5 100644 --- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java +++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,6 +50,9 @@ import java.applet.Applet; public class InfiniteRecursion_3 extends Applet { final static Robot robot = Util.createRobot(); final static int MOVE_COUNT = 5; + //*2 for both rotation directions, + //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor + final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2; static int actualEvents = 0; public void init() @@ -91,8 +94,10 @@ public class InfiniteRecursion_3 extends Applet { } Util.waitForIdle(robot); - if (actualEvents != MOVE_COUNT * 2) { - AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents); + //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents + //result in a single wheel rotation. + if (actualEvents != EXPECTED_COUNT) { + AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents); } }// start() } diff --git a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java index 600e0fa5af3..2fbb3d2e2b0 100644 --- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java +++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,8 @@ import test.java.awt.regtesthelpers.Sysout; public class InfiniteRecursion_4 { final static Robot robot = Util.createRobot(); final static int MOVE_COUNT = 5; + //*2 for both rotation directions over a single frame without any siblings + final static int EXPECTED_COUNT = MOVE_COUNT * 2; static int actualEvents = 0; public static void main(String []s) @@ -80,8 +82,10 @@ public class InfiniteRecursion_4 { } Util.waitForIdle(robot); - if (actualEvents != MOVE_COUNT * 2) { - AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents); + //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents + //result in a single wheel rotation. + if (actualEvents != EXPECTED_COUNT) { + AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents); } } } From 1e3fce0242fc651d74d060f0817f2761a862aae9 Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Thu, 28 Apr 2011 19:23:44 +0400 Subject: [PATCH 075/117] 6853146: Regression: on-the-spot input is broken in AWT Peered components Reviewed-by: art, ant, naoto --- jdk/src/windows/native/sun/windows/awt_TextComponent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp b/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp index c1fc17826b0..5e9a08f46ee 100644 --- a/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp +++ b/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp @@ -191,8 +191,11 @@ void AwtTextComponent::SetCompositionWindow(RECT& rc) { HIMC hIMC = ImmGetContext(); // rc is not used for text component. - COMPOSITIONFORM cf = { CFS_POINT, {0,0}, {0,0,0,0} }; + COMPOSITIONFORM cf = { CFS_FORCE_POSITION, {0,0}, {0,0,0,0} }; GetCaretPos(&(cf.ptCurrentPos)); + // the proxy is the native focus owner and it contains the composition window + // let's convert the position to a coordinate space relative to proxy + ::MapWindowPoints(GetHWnd(), GetProxyFocusOwner(), (LPPOINT)&cf.ptCurrentPos, 1); ImmSetCompositionWindow(hIMC, &cf); LOGFONT lf; From ac156aab263ec8a9597dcc20807b27776ad18ccd Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Thu, 28 Apr 2011 19:39:47 +0400 Subject: [PATCH 076/117] 7034766: closed/java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java failed on jdk7 b134 Reviewed-by: art, ant --- jdk/src/windows/native/sun/windows/awt_Frame.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.cpp b/jdk/src/windows/native/sun/windows/awt_Frame.cpp index 4d3374e5734..398aea6db67 100644 --- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp +++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp @@ -340,12 +340,16 @@ LRESULT AwtFrame::ProxyWindowProc(UINT message, WPARAM wParam, LPARAM lParam, Ms } break; case WM_SETFOCUS: + if (sm_inSynthesizeFocus) break; // pass it up the WindowProc chain + if (!sm_suppressFocusAndActivation && IsEmbeddedFrame()) { AwtSetActiveWindow(); } mr = mrConsume; break; case WM_KILLFOCUS: + if (sm_inSynthesizeFocus) break; // pass it up the WindowProc chain + if (!sm_suppressFocusAndActivation && IsEmbeddedFrame()) { AwtWindow::SynthesizeWmActivate(FALSE, GetHWnd(), NULL); From d97d48b225b1282a9fef99c1c41e96791c7ef62a Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Thu, 28 Apr 2011 08:51:43 -0700 Subject: [PATCH 077/117] 7037081: Remove com.sun.tracing from NON_CORE_PKGS Reviewed-by: ohair, jjg, jmasa --- jdk/make/docs/Makefile | 50 --------------------------------- jdk/make/docs/NON_CORE_PKGS.gmk | 4 --- 2 files changed, 54 deletions(-) diff --git a/jdk/make/docs/Makefile b/jdk/make/docs/Makefile index 567f796bbce..f2ed1a8fae1 100644 --- a/jdk/make/docs/Makefile +++ b/jdk/make/docs/Makefile @@ -1142,56 +1142,6 @@ $(SCTPAPI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(SCTPAP $(prep-target) $(call PackageFilter,$(SCTPAPI_PKGS)) -############################################################# -# -# tracingdocs -# - -ALL_OTHER_TARGETS += tracingdocs - -TRACING_DOCDIR := $(JRE_API_DOCSDIR)/tracing -TRACING2COREAPI := ../$(JDKJRE2COREAPI) -TRACING_DOCTITLE := Java$(TRADEMARK) Platform Tracing -TRACING_WINDOWTITLE := Platform Tracing -TRACING_HEADER := Platform Tracing -TRACING_BOTTOM := $(call CommonBottom,$(TRACING_FIRST_COPYRIGHT_YEAR)) -# TRACING_PKGS is located in NON_CORE_PKGS.gmk - -TRACING_INDEX_HTML = $(TRACING_DOCDIR)/index.html -TRACING_OPTIONS_FILE = $(DOCSTMPDIR)/tracing.options -TRACING_PACKAGES_FILE = $(DOCSTMPDIR)/tracing.packages - -tracingdocs: $(TRACING_INDEX_HTML) - -# Set relative location to core api document root -$(TRACING_INDEX_HTML): GET2DOCSDIR=$(TRACING2COREAPI)/.. - -# Run javadoc if the index file is out of date or missing -$(TRACING_INDEX_HTML): $(TRACING_OPTIONS_FILE) $(TRACING_PACKAGES_FILE) - $(prep-javadoc) - $(call JavadocSummary,$(TRACING_OPTIONS_FILE),$(TRACING_PACKAGES_FILE)) - $(JAVADOC_CMD) $(JAVADOC_VM_MEMORY_FLAGS) -d $(@D) \ - @$(TRACING_OPTIONS_FILE) @$(TRACING_PACKAGES_FILE) - -# Create file with javadoc options in it -$(TRACING_OPTIONS_FILE): - $(prep-target) - @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \ - $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \ - $(call OptionPair,-encoding,ascii) ; \ - $(call OptionOnly,-nodeprecatedlist) ; \ - $(call OptionPair,-doctitle,$(TRACING_DOCTITLE)) ; \ - $(call OptionPair,-windowtitle,$(TRACING_WINDOWTITLE) $(DRAFT_WINTITLE));\ - $(call OptionPair,-header,$(TRACING_HEADER)$(DRAFT_HEADER)) ; \ - $(call OptionPair,-bottom,$(TRACING_BOTTOM)$(DRAFT_BOTTOM)) ; \ - $(call OptionTrip,-linkoffline,$(TRACING2COREAPI),$(COREAPI_DOCSDIR)/); \ - ) >> $@ - -# Create a file with the package names in it -$(TRACING_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(TRACING_PKGS)) - $(prep-target) - $(call PackageFilter,$(TRACING_PKGS)) - ############################################################# # # Get a cache of all the directories diff --git a/jdk/make/docs/NON_CORE_PKGS.gmk b/jdk/make/docs/NON_CORE_PKGS.gmk index 25c79408bdb..e8eda9dfd92 100644 --- a/jdk/make/docs/NON_CORE_PKGS.gmk +++ b/jdk/make/docs/NON_CORE_PKGS.gmk @@ -88,9 +88,6 @@ SMARTCARDIO_PKGS = javax.smartcardio SCTPAPI_PKGS = com.sun.nio.sctp -TRACING_PKGS = com.sun.tracing \ - com.sun.tracing.dtrace - # non-core packages in rt.jar NON_CORE_PKGS = $(DOMAPI_PKGS) \ $(MGMT_PKGS) \ @@ -100,6 +97,5 @@ NON_CORE_PKGS = $(DOMAPI_PKGS) \ $(OLD_JSSE_PKGS) \ $(HTTPSERVER_PKGS) \ $(SMARTCARDIO_PKGS) \ - $(TRACING_PKGS) \ $(SCTPAPI_PKGS) From 972c4e25d6753470ef4c021f9ec0d4a0cac5b321 Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Thu, 28 Apr 2011 10:12:02 -0700 Subject: [PATCH 078/117] 7040381: Add StandardCharset.java to FILES_java.gmk Reviewed-by: alanb --- jdk/make/java/nio/FILES_java.gmk | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/make/java/nio/FILES_java.gmk b/jdk/make/java/nio/FILES_java.gmk index 34b41d5db38..d09a966db38 100644 --- a/jdk/make/java/nio/FILES_java.gmk +++ b/jdk/make/java/nio/FILES_java.gmk @@ -71,6 +71,7 @@ FILES_src = \ java/nio/charset/CoderMalfunctionError.java \ java/nio/charset/CodingErrorAction.java \ java/nio/charset/MalformedInputException.java \ + java/nio/charset/StandardCharset.java \ java/nio/charset/UnmappableCharacterException.java \ \ java/nio/charset/spi/CharsetProvider.java \ From eb8db400924b6a83a98b395aa3ecf58c834b39cc Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Thu, 28 Apr 2011 14:00:13 -0700 Subject: [PATCH 079/117] 7032162: assert(flat != TypePtr::BOTTOM) failed: cannot alias-analyze an untyped ptr Reviewed-by: kvn --- hotspot/src/share/vm/ci/ciObject.cpp | 10 ++++++++++ hotspot/src/share/vm/opto/stringopts.cpp | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/ci/ciObject.cpp b/hotspot/src/share/vm/ci/ciObject.cpp index a4eb9439e1f..031f584d22c 100644 --- a/hotspot/src/share/vm/ci/ciObject.cpp +++ b/hotspot/src/share/vm/ci/ciObject.cpp @@ -194,6 +194,16 @@ bool ciObject::can_be_constant() { // ciObject::should_be_constant() bool ciObject::should_be_constant() { if (ScavengeRootsInCode >= 2) return true; // force everybody to be a constant + if (!JavaObjectsInPerm && !is_null_object()) { + // We want Strings and Classes to be embeddable by default since + // they used to be in the perm world. Not all Strings used to be + // embeddable but there's no easy way to distinguish the interned + // from the regulars ones so just treat them all that way. + ciEnv* env = CURRENT_ENV; + if (klass() == env->String_klass() || klass() == env->Class_klass()) { + return true; + } + } return handle() == NULL || !is_scavengable(); } diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp index 7f5f318dbf7..e85ba982c75 100644 --- a/hotspot/src/share/vm/opto/stringopts.cpp +++ b/hotspot/src/share/vm/opto/stringopts.cpp @@ -1172,16 +1172,16 @@ 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(NULL, + 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(NULL, + 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(NULL, + 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); @@ -1342,7 +1342,7 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) { } // 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(NULL, kit.basic_plus_adr(arg, arg, java_lang_String::count_offset_in_bytes()), + 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); length = __ AddI(length, count); string_sizes->init_req(argi, NULL); From f20239694406a9b44ee7d0f1ed85f85fba79bc82 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Fri, 29 Apr 2011 00:21:54 +0100 Subject: [PATCH 080/117] 6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI Reviewed-by: wetmore --- .../sun/security/mscapi/RSASignature.java | 122 +++++++++- .../sun/security/mscapi/SunMSCAPI.java | 8 + .../native/sun/security/mscapi/security.cpp | 19 +- .../security/mscapi/SignUsingNONEwithRSA.java | 225 ++++++++++++++++++ .../security/mscapi/SignUsingNONEwithRSA.sh | 83 +++++++ 5 files changed, 445 insertions(+), 12 deletions(-) create mode 100644 jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.java create mode 100644 jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.sh diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java index 9a735d5fd89..f9419f9ccfc 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java +++ b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java @@ -49,6 +49,7 @@ import sun.security.rsa.RSAKeyFactory; * Objects should be instantiated by calling Signature.getInstance() using the * following algorithm names: * + * . "NONEwithRSA" * . "SHA1withRSA" * . "SHA256withRSA" * . "SHA384withRSA" @@ -56,7 +57,12 @@ import sun.security.rsa.RSAKeyFactory; * . "MD5withRSA" * . "MD2withRSA" * - * Note: RSA keys must be at least 512 bits long + * NOTE: RSA keys must be at least 512 bits long. + * + * NOTE: NONEwithRSA must be supplied with a pre-computed message digest. + * Only the following digest algorithms are supported: MD5, SHA-1, + * SHA-256, SHA-384, SHA-512 and a special-purpose digest algorithm + * which is a concatenation of SHA-1 and MD5 digests. * * @since 1.6 * @author Stanley Man-Kit Ho @@ -67,7 +73,7 @@ abstract class RSASignature extends java.security.SignatureSpi private final MessageDigest messageDigest; // message digest name - private final String messageDigestAlgorithm; + private String messageDigestAlgorithm; // flag indicating whether the digest has been reset private boolean needsReset; @@ -78,6 +84,13 @@ abstract class RSASignature extends java.security.SignatureSpi // the verification key private Key publicKey = null; + /** + * Constructs a new RSASignature. Used by Raw subclass. + */ + RSASignature() { + messageDigest = null; + messageDigestAlgorithm = null; + } /** * Constructs a new RSASignature. Used by subclasses. @@ -96,6 +109,94 @@ abstract class RSASignature extends java.security.SignatureSpi needsReset = false; } + // Nested class for NONEwithRSA signatures + public static final class Raw extends RSASignature { + + // the longest supported digest is 512 bits (SHA-512) + private static final int RAW_RSA_MAX = 64; + + private final byte[] precomputedDigest; + private int offset = 0; + + public Raw() { + precomputedDigest = new byte[RAW_RSA_MAX]; + } + + // Stores the precomputed message digest value. + @Override + protected void engineUpdate(byte b) throws SignatureException { + if (offset >= precomputedDigest.length) { + offset = RAW_RSA_MAX + 1; + return; + } + precomputedDigest[offset++] = b; + } + + // Stores the precomputed message digest value. + @Override + protected void engineUpdate(byte[] b, int off, int len) + throws SignatureException { + if (offset + len > precomputedDigest.length) { + offset = RAW_RSA_MAX + 1; + return; + } + System.arraycopy(b, off, precomputedDigest, offset, len); + offset += len; + } + + // Stores the precomputed message digest value. + @Override + protected void engineUpdate(ByteBuffer byteBuffer) { + int len = byteBuffer.remaining(); + if (len <= 0) { + return; + } + if (offset + len > precomputedDigest.length) { + offset = RAW_RSA_MAX + 1; + return; + } + byteBuffer.get(precomputedDigest, offset, len); + offset += len; + } + + @Override + protected void resetDigest(){ + offset = 0; + } + + // Returns the precomputed message digest value. + @Override + protected byte[] getDigestValue() throws SignatureException { + if (offset > RAW_RSA_MAX) { + throw new SignatureException("Message digest is too long"); + } + + // Determine the digest algorithm from the digest length + if (offset == 20) { + setDigestName("SHA1"); + } else if (offset == 36) { + setDigestName("SHA1+MD5"); + } else if (offset == 32) { + setDigestName("SHA-256"); + } else if (offset == 48) { + setDigestName("SHA-384"); + } else if (offset == 64) { + setDigestName("SHA-512"); + } else if (offset == 16) { + setDigestName("MD5"); + } else { + throw new SignatureException( + "Message digest length is not supported"); + } + + byte[] result = new byte[offset]; + System.arraycopy(precomputedDigest, 0, result, 0, offset); + offset = 0; + + return result; + } + } + public static final class SHA1 extends RSASignature { public SHA1() { super("SHA1"); @@ -204,18 +305,22 @@ abstract class RSASignature extends java.security.SignatureSpi /** * Resets the message digest if needed. */ - private void resetDigest() { + protected void resetDigest() { if (needsReset) { messageDigest.reset(); needsReset = false; } } - private byte[] getDigestValue() { + protected byte[] getDigestValue() throws SignatureException { needsReset = false; return messageDigest.digest(); } + protected void setDigestName(String name) { + messageDigestAlgorithm = name; + } + /** * Updates the data to be signed or verified * using the specified byte. @@ -277,9 +382,12 @@ abstract class RSASignature extends java.security.SignatureSpi byte[] hash = getDigestValue(); + // Omit the hash OID when generating a Raw signature + boolean noHashOID = this instanceof Raw; + // Sign hash using MS Crypto APIs - byte[] result = signHash(hash, hash.length, + byte[] result = signHash(noHashOID, hash, hash.length, messageDigestAlgorithm, privateKey.getHCryptProvider(), privateKey.getHCryptKey()); @@ -308,8 +416,8 @@ abstract class RSASignature extends java.security.SignatureSpi * Sign hash using Microsoft Crypto API with HCRYPTKEY. * The returned data is in little-endian. */ - private native static byte[] signHash(byte[] hash, int hashSize, - String hashAlgorithm, long hCryptProv, long hCryptKey) + private native static byte[] signHash(boolean noHashOID, byte[] hash, + int hashSize, String hashAlgorithm, long hCryptProv, long hCryptKey) throws SignatureException; /** diff --git a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java index b101e5b09a5..db8b3175c01 100644 --- a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java +++ b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java @@ -79,6 +79,12 @@ public final class SunMSCAPI extends Provider { /* * Signature engines */ + // NONEwithRSA must be supplied with a pre-computed message digest. + // Only the following digest algorithms are supported: MD5, SHA-1, + // SHA-256, SHA-384, SHA-512 and a special-purpose digest algorithm + // which is a concatenation of SHA-1 and MD5 digests. + map.put("Signature.NONEwithRSA", + "sun.security.mscapi.RSASignature$Raw"); map.put("Signature.SHA1withRSA", "sun.security.mscapi.RSASignature$SHA1"); map.put("Signature.SHA256withRSA", @@ -93,6 +99,8 @@ public final class SunMSCAPI extends Provider { "sun.security.mscapi.RSASignature$MD2"); // supported key classes + map.put("Signature.NONEwithRSA SupportedKeyClasses", + "sun.security.mscapi.Key"); map.put("Signature.SHA1withRSA SupportedKeyClasses", "sun.security.mscapi.Key"); map.put("Signature.SHA256withRSA SupportedKeyClasses", diff --git a/jdk/src/windows/native/sun/security/mscapi/security.cpp b/jdk/src/windows/native/sun/security/mscapi/security.cpp index 3b0421576c9..1a489d70eca 100644 --- a/jdk/src/windows/native/sun/security/mscapi/security.cpp +++ b/jdk/src/windows/native/sun/security/mscapi/security.cpp @@ -81,6 +81,8 @@ ALG_ID MapHashAlgorithm(JNIEnv *env, jstring jHashAlgorithm) { (strcmp("SHA-1", pszHashAlgorithm) == 0)) { algId = CALG_SHA1; + } else if (strcmp("SHA1+MD5", pszHashAlgorithm) == 0) { + algId = CALG_SSL3_SHAMD5; // a 36-byte concatenation of SHA-1 and MD5 } else if (strcmp("SHA-256", pszHashAlgorithm) == 0) { algId = CALG_SHA_256; } else if (strcmp("SHA-384", pszHashAlgorithm) == 0) { @@ -473,11 +475,12 @@ JNIEXPORT void JNICALL Java_sun_security_mscapi_Key_cleanUp /* * Class: sun_security_mscapi_RSASignature * Method: signHash - * Signature: ([BILjava/lang/String;JJ)[B + * Signature: (Z[BILjava/lang/String;JJ)[B */ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_RSASignature_signHash - (JNIEnv *env, jclass clazz, jbyteArray jHash, jint jHashSize, - jstring jHashAlgorithm, jlong hCryptProv, jlong hCryptKey) + (JNIEnv *env, jclass clazz, jboolean noHashOID, jbyteArray jHash, + jint jHashSize, jstring jHashAlgorithm, jlong hCryptProv, + jlong hCryptKey) { HCRYPTHASH hHash = NULL; jbyte* pHashBuffer = NULL; @@ -548,14 +551,20 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_RSASignature_signHash // Determine size of buffer DWORD dwBufLen = 0; - if (::CryptSignHash(hHash, dwKeySpec, NULL, NULL, NULL, &dwBufLen) == FALSE) + DWORD dwFlags = 0; + + if (noHashOID == JNI_TRUE) { + dwFlags = CRYPT_NOHASHOID; // omit hash OID in NONEwithRSA signature + } + + if (::CryptSignHash(hHash, dwKeySpec, NULL, dwFlags, NULL, &dwBufLen) == FALSE) { ThrowException(env, SIGNATURE_EXCEPTION, GetLastError()); __leave; } pSignedHashBuffer = new jbyte[dwBufLen]; - if (::CryptSignHash(hHash, dwKeySpec, NULL, NULL, (BYTE*)pSignedHashBuffer, &dwBufLen) == FALSE) + if (::CryptSignHash(hHash, dwKeySpec, NULL, dwFlags, (BYTE*)pSignedHashBuffer, &dwBufLen) == FALSE) { ThrowException(env, SIGNATURE_EXCEPTION, GetLastError()); __leave; diff --git a/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.java b/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.java new file mode 100644 index 00000000000..58934767cd8 --- /dev/null +++ b/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.java @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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. + */ + +/** + * @see SignUsingNONEwithRSA.sh + */ + +import java.security.*; +import java.util.*; + +public class SignUsingNONEwithRSA { + + private static final List precomputedHashes = Arrays.asList( + // A MD5 hash + new byte[] { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 + }, + // A SHA-1 hash + new byte[] { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20 + }, + // A concatenation of SHA-1 and MD5 hashes (used during SSL handshake) + new byte[] { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, + 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, + 0x31, 0x32, 0x33, 0x34, 0x35, 0x36 + }, + // A SHA-256 hash + new byte[] { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, + 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, + 0x31, 0x32 + }, + // A SHA-384 hash + new byte[] { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, + 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, + 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x40, + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48 + }, + // A SHA-512 hash + new byte[] { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, + 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, + 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x40, + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x50, + 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x60, + 0x61, 0x62, 0x63, 0x64 + }); + + private static List generatedSignatures = new ArrayList<>(); + + public static void main(String[] args) throws Exception { + + Provider[] providers = Security.getProviders("Signature.NONEwithRSA"); + if (providers == null) { + System.out.println("No JCE providers support the " + + "'Signature.NONEwithRSA' algorithm"); + System.out.println("Skipping this test..."); + return; + + } else { + System.out.println("The following JCE providers support the " + + "'Signature.NONEwithRSA' algorithm: "); + for (Provider provider : providers) { + System.out.println(" " + provider.getName()); + } + } + System.out.println("-------------------------------------------------"); + + KeyPair keys = getKeysFromKeyStore(); + signAllUsing("SunMSCAPI", keys.getPrivate()); + System.out.println("-------------------------------------------------"); + + verifyAllUsing("SunMSCAPI", keys.getPublic()); + System.out.println("-------------------------------------------------"); + + verifyAllUsing("SunJCE", keys.getPublic()); + System.out.println("-------------------------------------------------"); + + keys = generateKeys(); + signAllUsing("SunJCE", keys.getPrivate()); + System.out.println("-------------------------------------------------"); + + verifyAllUsing("SunMSCAPI", keys.getPublic()); + System.out.println("-------------------------------------------------"); + + } + + private static KeyPair getKeysFromKeyStore() throws Exception { + KeyStore ks = KeyStore.getInstance("Windows-MY", "SunMSCAPI"); + ks.load(null, null); + System.out.println("Loaded keystore: Windows-MY"); + + Enumeration e = ks.aliases(); + PrivateKey privateKey = null; + PublicKey publicKey = null; + + while (e.hasMoreElements()) { + String alias = (String) e.nextElement(); + if (alias.equals("6578658")) { + System.out.println("Loaded entry: " + alias); + privateKey = (PrivateKey) ks.getKey(alias, null); + publicKey = (PublicKey) ks.getCertificate(alias).getPublicKey(); + } + } + if (privateKey == null || publicKey == null) { + throw new Exception("Cannot load the keys need to run this test"); + } + + return new KeyPair(publicKey, privateKey); + } + + + private static KeyPair generateKeys() throws Exception { + KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); + keyGen.initialize(1024, null); + KeyPair pair = keyGen.generateKeyPair(); + PrivateKey privateKey = pair.getPrivate(); + PublicKey publicKey = pair.getPublic(); + + if (privateKey == null || publicKey == null) { + throw new Exception("Cannot load the keys need to run this test"); + } + + return new KeyPair(publicKey, privateKey); + } + + private static void signAllUsing(String providerName, PrivateKey privateKey) + throws Exception { + Signature sig1 = Signature.getInstance("NONEwithRSA", providerName); + if (sig1 == null) { + throw new Exception("'NONEwithRSA' is not supported"); + } + if (sig1.getProvider() != null) { + System.out.println("Using NONEwithRSA signer from the " + + sig1.getProvider().getName() + " JCE provider"); + } else { + System.out.println( + "Using NONEwithRSA signer from the internal JCE provider"); + } + + System.out.println("Using key: " + privateKey); + generatedSignatures.clear(); + for (byte[] hash : precomputedHashes) { + sig1.initSign(privateKey); + sig1.update(hash); + + try { + + byte [] sigBytes = sig1.sign(); + System.out.println("\nGenerated RSA signature over a " + + hash.length + "-byte hash (signature length: " + + sigBytes.length * 8 + " bits)"); + System.out.println(String.format("0x%0" + + (sigBytes.length * 2) + "x", + new java.math.BigInteger(1, sigBytes))); + generatedSignatures.add(sigBytes); + + } catch (SignatureException se) { + System.out.println("Error generating RSA signature: " + se); + } + } + } + + private static void verifyAllUsing(String providerName, PublicKey publicKey) + throws Exception { + Signature sig1 = Signature.getInstance("NONEwithRSA", providerName); + if (sig1.getProvider() != null) { + System.out.println("\nUsing NONEwithRSA verifier from the " + + sig1.getProvider().getName() + " JCE provider"); + } else { + System.out.println( + "\nUsing NONEwithRSA verifier from the internal JCE provider"); + } + + System.out.println("Using key: " + publicKey); + + int i = 0; + for (byte[] hash : precomputedHashes) { + + byte[] sigBytes = generatedSignatures.get(i++); + System.out.println("\nVerifying RSA Signature over a " + + hash.length + "-byte hash (signature length: " + + sigBytes.length * 8 + " bits)"); + System.out.println(String.format("0x%0" + + (sigBytes.length * 2) + "x", + new java.math.BigInteger(1, sigBytes))); + + sig1.initVerify(publicKey); + sig1.update(hash); + if (sig1.verify(sigBytes)) { + System.out.println("Verify PASSED"); + } else { + throw new Exception("Verify FAILED"); + } + } + } +} diff --git a/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.sh b/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.sh new file mode 100644 index 00000000000..c89a8687877 --- /dev/null +++ b/jdk/test/sun/security/mscapi/SignUsingNONEwithRSA.sh @@ -0,0 +1,83 @@ +#!/bin/sh + +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# 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 6578658 +# @run shell SignUsingNONEwithRSA.sh +# @summary Sign using the NONEwithRSA signature algorithm from SunMSCAPI + +# set a few environment variables so that the shell-script can run stand-alone +# in the source directory +if [ "${TESTSRC}" = "" ] ; then + TESTSRC="." +fi + +if [ "${TESTCLASSES}" = "" ] ; then + TESTCLASSES="." +fi + +if [ "${TESTJAVA}" = "" ] ; then + echo "TESTJAVA not set. Test cannot execute." + echo "FAILED!!!" + exit 1 +fi + +OS=`uname -s` +case "$OS" in + Windows* | CYGWIN* ) + + echo "Creating a temporary RSA keypair in the Windows-My store..." + ${TESTJAVA}/bin/keytool \ + -genkeypair \ + -storetype Windows-My \ + -keyalg RSA \ + -alias 6578658 \ + -dname "cn=6578658,c=US" \ + -noprompt + + echo + echo "Running the test..." + ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\SignUsingNONEwithRSA.java + ${TESTJAVA}/bin/java SignUsingNONEwithRSA + + rc=$? + + echo + echo "Removing the temporary RSA keypair from the Windows-My store..." + ${TESTJAVA}/bin/keytool \ + -delete \ + -storetype Windows-My \ + -alias 6578658 + + echo done. + exit $rc + ;; + + * ) + echo "This test is not intended for '$OS' - passing test" + exit 0 + ;; +esac From 13cf1a72777057c4043efa4c8ab714e7432db3af Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 28 Apr 2011 17:44:13 -0700 Subject: [PATCH 081/117] Added tag jdk7-b140 for changeset 90e228752038 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 0c499488b3e..3bdb4f112e3 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -114,3 +114,4 @@ ddc2fcb3682ffd27f44354db666128827be7e3c3 jdk7-b134 7654afc6a29e43cb0a1343ce7f1287bf690d5e5f jdk7-b137 fc47c97bbbd91b1f774d855c48a7e285eb1a351a jdk7-b138 7ed6d0b9aaa12320832a7ddadb88d6d8d0dda4c1 jdk7-b139 +dcfe74f1c6553c556e7d361c30b0b614eb5e40f6 jdk7-b140 From 6ae3e039ab0336fffae8501fabbc44954a4d6a81 Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 28 Apr 2011 17:44:18 -0700 Subject: [PATCH 082/117] Added tag jdk7-b140 for changeset 837037533544 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 4e2aad7b7fe..0cc360827c3 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -114,3 +114,4 @@ e0b72ae5dc5e824b342801c8d1d336a55eb54e2c jdk7-b135 a66c01d8bf895261715955df0b95545c000ed6a8 jdk7-b137 78d8cf04697e9df54f7f11e195b7da29b8e345a2 jdk7-b138 60b074ec6fcf5cdf9efce22fdfb02326ed8fa2d3 jdk7-b139 +cdf5d19ec142424489549025e9c42e51f32cf688 jdk7-b140 From 874944e5bc5615b73ce05869589a60daa3e17a20 Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 28 Apr 2011 17:44:24 -0700 Subject: [PATCH 083/117] Added tag jdk7-b140 for changeset 33e592b5ff17 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 145ab668bff..5478ecfeaf9 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -166,3 +166,4 @@ bd586e392d93b7ed7a1636dcc8da2b6a4203a102 hs21-b06 0930dc920c185afbf40fed9a655290b8e5b16783 hs21-b08 611e19a16519d6fb5deea9ab565336e6e6ee475d jdk7-b139 611e19a16519d6fb5deea9ab565336e6e6ee475d hs21-b09 +d283b82966712b353fa307845a1316da42a355f4 jdk7-b140 From 36230d8a9031d03e9233f41a19f0f9852db1a5ce Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 28 Apr 2011 17:44:28 -0700 Subject: [PATCH 084/117] Added tag jdk7-b140 for changeset 2c31217f748a --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index b8136de0b51..78d0d9f5a94 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -114,3 +114,4 @@ d56b326ae0544fc16c3e0d0285876f3c82054db2 jdk7-b134 1d87f7460cde7f8f30af668490f82b52b879bfd8 jdk7-b137 be3758943770a0a3dd4be6a1cb4063507c4d7062 jdk7-b138 28c7c0ed2444607829ba11ad827f8d52197a2830 jdk7-b139 +c8136fd161c83917f87e93b14fa2ba3483f9be83 jdk7-b140 From 12324e11fb1e0c0dec6746877b486bda31ad54e1 Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 28 Apr 2011 17:44:29 -0700 Subject: [PATCH 085/117] Added tag jdk7-b140 for changeset 3202e475f9d9 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 0ef77285c96..2cfc85038bf 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -114,3 +114,4 @@ c81d289c9a532d6e94af3c09d856a2a20529040f jdk7-b136 ccea3282991ce8b678e188cf32a8239f76ff3bfa jdk7-b137 cc956c8a8255583535597e9a63db23c510e9a063 jdk7-b138 c025078c8362076503bb83b8e4da14ba7b347940 jdk7-b139 +82a9022c4f21b1313023c8303b557a17c4106701 jdk7-b140 From a4dd2f32d7913230248862ba031d798bbbeb7ce9 Mon Sep 17 00:00:00 2001 From: Suchen Chien Date: Thu, 28 Apr 2011 17:44:47 -0700 Subject: [PATCH 086/117] Added tag jdk7-b140 for changeset c0c0f0374f67 --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 8ea0912e659..2ce033497a0 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -114,3 +114,4 @@ ed0f7f1f9511db4f9615b1426d22f8b961629275 jdk7-b136 a15c9b058ae007d4ccb7e35ce44e4dfa977f090b jdk7-b137 53f212bed4f4304dce7f0bf0fa01c998c65bacd6 jdk7-b138 853b6bb99f9b58eb7cf8211c67d3b6e4f1228a3e jdk7-b139 +258e6654aba25aab91c9ba3b4c53d05bc895a86c jdk7-b140 From faa5e45f7a62b013c7b56e105333dff64a306f01 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 28 Apr 2011 17:51:25 -0700 Subject: [PATCH 087/117] 7038843: IIOP serialization fails with NullPointerException when serializing Throwable Reviewed-by: dholmes, mchung --- .../share/classes/java/lang/Throwable.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/jdk/src/share/classes/java/lang/Throwable.java b/jdk/src/share/classes/java/lang/Throwable.java index fdfa2525b5f..d70fe26841a 100644 --- a/jdk/src/share/classes/java/lang/Throwable.java +++ b/jdk/src/share/classes/java/lang/Throwable.java @@ -848,10 +848,9 @@ public class Throwable implements Serializable { throw new NullPointerException("stackTrace[" + i + "]"); } - if (this.stackTrace == null) // Immutable stack - return; - synchronized (this) { + if (this.stackTrace == null) // Immutable stack + return; this.stackTrace = defensiveCopy; } } @@ -958,18 +957,15 @@ public class Throwable implements Serializable { // trace field is a valid value indicating the stack trace // should not be set. getOurStackTrace(); - ObjectOutputStream.PutField fields = s.putFields(); - fields.put("detailMessage", detailMessage); - fields.put("cause", cause); - // Serialize a null stacktrace using the stack trace sentinel. - if (stackTrace == null) - fields.put("stackTrace", SentinelHolder.STACK_TRACE_SENTINEL); - else - fields.put("stackTrace", stackTrace); - fields.put("suppressedExceptions", suppressedExceptions); - - s.writeFields(); + StackTraceElement[] oldStackTrace = stackTrace; + try { + if (stackTrace == null) + stackTrace = SentinelHolder.STACK_TRACE_SENTINEL; + s.defaultWriteObject(); + } finally { + stackTrace = oldStackTrace; + } } /** From ce5fc02a16957194b2658206746c922990bb2859 Mon Sep 17 00:00:00 2001 From: Michael Fang Date: Thu, 28 Apr 2011 20:15:11 -0700 Subject: [PATCH 088/117] 7040228: [zh_TW] extra (C) on cancel button on File Chooser dialog Reviewed-by: yhuang --- .../java/swing/plaf/gtk/resources/gtk.properties | 12 ++++-------- .../swing/plaf/gtk/resources/gtk_ja.properties | 14 +++++--------- .../swing/plaf/gtk/resources/gtk_ko.properties | 14 +++++--------- .../swing/plaf/gtk/resources/gtk_zh_CN.properties | 14 +++++--------- .../swing/plaf/gtk/resources/gtk_zh_TW.properties | 14 +++++--------- .../internal/plaf/basic/resources/basic.properties | 2 +- .../plaf/basic/resources/basic_ja.properties | 2 +- .../plaf/basic/resources/basic_ko.properties | 2 +- .../plaf/basic/resources/basic_zh_CN.properties | 2 +- .../plaf/basic/resources/basic_zh_TW.properties | 2 +- 10 files changed, 29 insertions(+), 49 deletions(-) diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties index 904a49352eb..45f4a4dc7a6 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties @@ -56,9 +56,9 @@ FileChooser.deleteFileButtonMnemonic=76 FileChooser.renameFileButtonText=Rename File FileChooser.renameFileButtonMnemonic=82 FileChooser.cancelButtonText=Cancel -FileChooser.cancelButtonMnemonic=67 +#FileChooser.cancelButtonMnemonic=67 FileChooser.saveButtonText=OK -FileChooser.saveButtonMnemonic=79 +#FileChooser.saveButtonMnemonic=79 FileChooser.openButtonText=OK FileChooser.openButtonMnemonic=79 FileChooser.saveDialogTitleText=Save @@ -79,9 +79,5 @@ FileChooser.renameFileDialogText=Rename file "{0}" to FileChooser.renameFileErrorTitle=Error FileChooser.renameFileErrorText=Error renaming file "{0}" to "{1}" -# dummy resource added for translation automation -OptionPane.okButtonText=OK -OptionPane.okButtonMnemonic=79 -# dummy resource added for translation automation -OptionPane.cancelButtonText=Cancel -OptionPane.cancelButtonMnemonic=67 +#OptionPane.okButtonMnemonic=79 +#OptionPane.cancelButtonMnemonic=67 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties index c7ff0bb97a2..30560e91620 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties @@ -55,11 +55,11 @@ FileChooser.deleteFileButtonText=\u30D5\u30A1\u30A4\u30EB\u306E\u524A\u9664(L) FileChooser.deleteFileButtonMnemonic=76 FileChooser.renameFileButtonText=\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u5909\u66F4(R) FileChooser.renameFileButtonMnemonic=82 -FileChooser.cancelButtonText=\u53D6\u6D88(C) +FileChooser.cancelButtonText=\u53D6\u6D88 FileChooser.cancelButtonMnemonic=67 -FileChooser.saveButtonText=OK(O) +FileChooser.saveButtonText=OK FileChooser.saveButtonMnemonic=79 -FileChooser.openButtonText=OK(O) +FileChooser.openButtonText=OK FileChooser.openButtonMnemonic=79 FileChooser.saveDialogTitleText=\u4FDD\u5B58 FileChooser.openDialogTitleText=\u958B\u304F @@ -79,10 +79,6 @@ FileChooser.renameFileDialogText=\u30D5\u30A1\u30A4\u30EB"{0}"\u3092\u6B21\u306E FileChooser.renameFileErrorTitle=\u30A8\u30E9\u30FC FileChooser.renameFileErrorText=\u30D5\u30A1\u30A4\u30EB"{0}"\u306E"{1}"\u3078\u306E\u5909\u66F4\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F -# dummy resource added for translation automation -OptionPane.okButtonText=OK(O) -OptionPane.okButtonMnemonic=79 -# dummy resource added for translation automation -OptionPane.cancelButtonText=\u53D6\u6D88(C) -OptionPane.cancelButtonMnemonic=67 +#OptionPane.okButtonMnemonic=79 +#OptionPane.cancelButtonMnemonic=67 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties index cb029e7b025..27802636b7c 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties @@ -55,11 +55,11 @@ FileChooser.deleteFileButtonText=\uD30C\uC77C \uC0AD\uC81C(L) FileChooser.deleteFileButtonMnemonic=76 FileChooser.renameFileButtonText=\uD30C\uC77C \uC774\uB984 \uBC14\uAFB8\uAE30(R) FileChooser.renameFileButtonMnemonic=82 -FileChooser.cancelButtonText=\uCDE8\uC18C(C) +FileChooser.cancelButtonText=\uCDE8\uC18C FileChooser.cancelButtonMnemonic=67 -FileChooser.saveButtonText=\uD655\uC778(O) +FileChooser.saveButtonText=\uD655\uC778 FileChooser.saveButtonMnemonic=79 -FileChooser.openButtonText=\uD655\uC778(O) +FileChooser.openButtonText=\uD655\uC778 FileChooser.openButtonMnemonic=79 FileChooser.saveDialogTitleText=\uC800\uC7A5 FileChooser.openDialogTitleText=\uC5F4\uAE30 @@ -79,10 +79,6 @@ FileChooser.renameFileDialogText="{0}" \uD30C\uC77C\uC758 \uC774\uB984 \uBC14\uA FileChooser.renameFileErrorTitle=\uC624\uB958 FileChooser.renameFileErrorText="{0}" \uD30C\uC77C\uC758 \uC774\uB984\uC744 "{1}"(\uC73C)\uB85C \uBC14\uAFB8\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. -# dummy resource added for translation automation -OptionPane.okButtonText=\uD655\uC778(O) -OptionPane.okButtonMnemonic=79 -# dummy resource added for translation automation -OptionPane.cancelButtonText=\uCDE8\uC18C(C) -OptionPane.cancelButtonMnemonic=67 +#OptionPane.okButtonMnemonic=79 +#OptionPane.cancelButtonMnemonic=67 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties index 58506b0107d..9c7793c62ff 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties @@ -55,11 +55,11 @@ FileChooser.deleteFileButtonText=\u5220\u9664\u6587\u4EF6(L) FileChooser.deleteFileButtonMnemonic=76 FileChooser.renameFileButtonText=\u91CD\u547D\u540D\u6587\u4EF6(R) FileChooser.renameFileButtonMnemonic=82 -FileChooser.cancelButtonText=\u53D6\u6D88(C) +FileChooser.cancelButtonText=\u53D6\u6D88 FileChooser.cancelButtonMnemonic=67 -FileChooser.saveButtonText=\u786E\u5B9A(O) +FileChooser.saveButtonText=\u786E\u5B9A FileChooser.saveButtonMnemonic=79 -FileChooser.openButtonText=\u786E\u5B9A(O) +FileChooser.openButtonText=\u786E\u5B9A FileChooser.openButtonMnemonic=79 FileChooser.saveDialogTitleText=\u4FDD\u5B58 FileChooser.openDialogTitleText=\u6253\u5F00 @@ -79,10 +79,6 @@ FileChooser.renameFileDialogText=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E FileChooser.renameFileErrorTitle=\u9519\u8BEF FileChooser.renameFileErrorText=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E3A "{1}" \u65F6\u51FA\u9519 -# dummy resource added for translation automation -OptionPane.okButtonText=\u786E\u5B9A(O) -OptionPane.okButtonMnemonic=79 -# dummy resource added for translation automation -OptionPane.cancelButtonText=\u53D6\u6D88(C) -OptionPane.cancelButtonMnemonic=67 +#OptionPane.okButtonMnemonic=79 +#OptionPane.cancelButtonMnemonic=67 diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties index ac8c732dc6d..68fdd917034 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties @@ -55,11 +55,11 @@ FileChooser.deleteFileButtonText=\u522A\u9664\u6A94\u6848(L) FileChooser.deleteFileButtonMnemonic=76 FileChooser.renameFileButtonText=\u91CD\u65B0\u547D\u540D\u6A94\u6848(R) FileChooser.renameFileButtonMnemonic=82 -FileChooser.cancelButtonText=\u53D6\u6D88(C) +FileChooser.cancelButtonText=\u53D6\u6D88 FileChooser.cancelButtonMnemonic=67 -FileChooser.saveButtonText=\u78BA\u5B9A(O) +FileChooser.saveButtonText=\u78BA\u5B9A FileChooser.saveButtonMnemonic=79 -FileChooser.openButtonText=\u78BA\u5B9A(O) +FileChooser.openButtonText=\u78BA\u5B9A FileChooser.openButtonMnemonic=79 FileChooser.saveDialogTitleText=\u5132\u5B58 FileChooser.openDialogTitleText=\u958B\u555F @@ -79,10 +79,6 @@ FileChooser.renameFileDialogText=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u54 FileChooser.renameFileErrorTitle=\u932F\u8AA4 FileChooser.renameFileErrorText=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u540D\u70BA "{1}" \u6642\u51FA\u73FE\u932F\u8AA4 -# dummy resource added for translation automation -OptionPane.okButtonText=\u78BA\u5B9A(O) -OptionPane.okButtonMnemonic=79 -# dummy resource added for translation automation -OptionPane.cancelButtonText=\u53D6\u6D88(C) -OptionPane.cancelButtonMnemonic=67 +#OptionPane.okButtonMnemonic=79 +#OptionPane.cancelButtonMnemonic=67 diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties index 549e5cfc853..109538ac90e 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties @@ -57,7 +57,7 @@ FileChooser.renameErrorFileExistsText=Cannot rename {0}: A file with the name yo Specify a different file name. FileChooser.acceptAllFileFilterText=All Files FileChooser.cancelButtonText=Cancel -FileChooser.cancelButtonMnemonic=67 +#FileChooser.cancelButtonMnemonic=67 // not needed? FileChooser.saveButtonText=Save FileChooser.saveButtonMnemonic=83 // not needed? FileChooser.openButtonText=Open diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties index 6a01a4ae528..7b946411855 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties @@ -55,7 +55,7 @@ FileChooser.renameErrorTitleText=\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30D FileChooser.renameErrorText={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093 FileChooser.renameErrorFileExistsText={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093: \u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u5225\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002 FileChooser.acceptAllFileFilterText=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB -FileChooser.cancelButtonText=\u53D6\u6D88(C) +FileChooser.cancelButtonText=\u53D6\u6D88 FileChooser.cancelButtonMnemonic=67 FileChooser.saveButtonText=\u4FDD\u5B58 FileChooser.saveButtonMnemonic=83 diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties index 970e57bf375..592d4672442 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties @@ -55,7 +55,7 @@ FileChooser.renameErrorTitleText=\uD30C\uC77C \uB610\uB294 \uD3F4\uB354 \uC774\u FileChooser.renameErrorText={0}\uC758 \uC774\uB984\uC744 \uBC14\uAFC0 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. FileChooser.renameErrorFileExistsText={0}\uC758 \uC774\uB984\uC744 \uBC14\uAFC0 \uC218 \uC5C6\uC74C: \uC9C0\uC815\uD55C \uC774\uB984\uC744 \uC0AC\uC6A9\uD558\uB294 \uD30C\uC77C\uC774 \uC874\uC7AC\uD569\uB2C8\uB2E4. \uB2E4\uB978 \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD558\uC2ED\uC2DC\uC624. FileChooser.acceptAllFileFilterText=\uBAA8\uB4E0 \uD30C\uC77C -FileChooser.cancelButtonText=\uCDE8\uC18C(C) +FileChooser.cancelButtonText=\uCDE8\uC18C FileChooser.cancelButtonMnemonic=67 FileChooser.saveButtonText=\uC800\uC7A5 FileChooser.saveButtonMnemonic=83 diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties index 0714ac53c35..10cecd846d9 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties @@ -55,7 +55,7 @@ FileChooser.renameErrorTitleText=\u91CD\u547D\u540D\u6587\u4EF6\u6216\u6587\u4EF FileChooser.renameErrorText=\u65E0\u6CD5\u91CD\u547D\u540D{0} FileChooser.renameErrorFileExistsText=\u65E0\u6CD5\u91CD\u547D\u540D{0}: \u5DF2\u5B58\u5728\u5177\u6709\u6240\u6307\u5B9A\u540D\u79F0\u7684\u6587\u4EF6\u3002\u8BF7\u6307\u5B9A\u5176\u4ED6\u6587\u4EF6\u540D\u3002 FileChooser.acceptAllFileFilterText=\u6240\u6709\u6587\u4EF6 -FileChooser.cancelButtonText=\u53D6\u6D88(C) +FileChooser.cancelButtonText=\u53D6\u6D88 FileChooser.cancelButtonMnemonic=67 FileChooser.saveButtonText=\u4FDD\u5B58 FileChooser.saveButtonMnemonic=83 diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties index 141938565c9..53a4bfb989b 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties @@ -55,7 +55,7 @@ FileChooser.renameErrorTitleText=\u91CD\u65B0\u547D\u540D\u6A94\u6848\u6216\u8CC FileChooser.renameErrorText=\u7121\u6CD5\u91CD\u65B0\u547D\u540D {0} FileChooser.renameErrorFileExistsText=\u7121\u6CD5\u91CD\u65B0\u547D\u540D {0}: \u5DF2\u7D93\u5B58\u5728\u60A8\u6240\u6307\u5B9A\u540D\u7A31\u7684\u6A94\u6848\u3002\u8ACB\u6307\u5B9A\u4E0D\u540C\u7684\u540D\u7A31\u3002 FileChooser.acceptAllFileFilterText=\u6240\u6709\u6A94\u6848 -FileChooser.cancelButtonText=\u53D6\u6D88(C) +FileChooser.cancelButtonText=\u53D6\u6D88 FileChooser.cancelButtonMnemonic=67 FileChooser.saveButtonText=\u5132\u5B58 FileChooser.saveButtonMnemonic=83 From 4463efaf617b30eb9ac7e4a121c3876db3c30fd4 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Thu, 28 Apr 2011 20:18:57 -0700 Subject: [PATCH 089/117] 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard Updated j.l.c.lsLowerCase/isUpperCase Reviewed-by: okutsu --- jdk/make/java/java/FILES_java.gmk | 1 + jdk/make/java/java/Makefile | 5 + .../CharacterData00.java.template | 26 + .../CharacterData01.java.template | 26 + .../CharacterData02.java.template | 28 +- .../CharacterData0E.java.template | 28 +- .../CharacterDataLatin1.java.template | 28 +- jdk/make/tools/UnicodeData/PropList.txt | 1296 +++++++++++++++++ .../generatecharacter/GenerateCharacter.java | 166 ++- .../tools/generatecharacter/PropList.java | 102 ++ .../share/classes/java/lang/Character.java | 74 +- .../classes/java/lang/CharacterData.java | 17 + jdk/test/java/lang/Character/CheckProp.java | 117 ++ jdk/test/java/lang/Character/PropList.txt | 1296 +++++++++++++++++ 14 files changed, 3147 insertions(+), 63 deletions(-) create mode 100644 jdk/make/tools/UnicodeData/PropList.txt create mode 100644 jdk/make/tools/src/build/tools/generatecharacter/PropList.java create mode 100644 jdk/test/java/lang/Character/CheckProp.java create mode 100644 jdk/test/java/lang/Character/PropList.txt diff --git a/jdk/make/java/java/FILES_java.gmk b/jdk/make/java/java/FILES_java.gmk index d07efda0aa1..abb63cec2e6 100644 --- a/jdk/make/java/java/FILES_java.gmk +++ b/jdk/make/java/java/FILES_java.gmk @@ -356,6 +356,7 @@ JAVA_JAVA_java = \ java/util/regex/Matcher.java \ java/util/regex/MatchResult.java \ java/util/regex/ASCII.java \ + java/util/regex/UnicodeProp.java \ java/util/regex/PatternSyntaxException.java \ java/util/prefs/Preferences.java \ java/util/prefs/AbstractPreferences.java \ diff --git a/jdk/make/java/java/Makefile b/jdk/make/java/java/Makefile index a51082614d3..787d881b6ee 100644 --- a/jdk/make/java/java/Makefile +++ b/jdk/make/java/java/Makefile @@ -345,30 +345,35 @@ $(GENSRCDIR)/java/lang/CharacterDataLatin1.java \ -template $(CHARACTERDATA)/CharacterDataLatin1.java.template \ -spec $(UNICODEDATA)/UnicodeData.txt \ -specialcasing $(UNICODEDATA)/SpecialCasing.txt \ + -proplist $(UNICODEDATA)/PropList.txt \ -o $(GENSRCDIR)/java/lang/CharacterDataLatin1.java -string \ -usecharforbyte -latin1 8 $(BOOT_JAVA_CMD) -jar $(GENERATECHARACTER_JARFILE) -plane 0 \ -template $(CHARACTERDATA)/CharacterData00.java.template \ -spec $(UNICODEDATA)/UnicodeData.txt \ -specialcasing $(UNICODEDATA)/SpecialCasing.txt \ + -proplist $(UNICODEDATA)/PropList.txt \ -o $(GENSRCDIR)/java/lang/CharacterData00.java -string \ -usecharforbyte 11 4 1 $(BOOT_JAVA_CMD) -jar $(GENERATECHARACTER_JARFILE) -plane 1 \ -template $(CHARACTERDATA)/CharacterData01.java.template \ -spec $(UNICODEDATA)/UnicodeData.txt \ -specialcasing $(UNICODEDATA)/SpecialCasing.txt \ + -proplist $(UNICODEDATA)/PropList.txt \ -o $(GENSRCDIR)/java/lang/CharacterData01.java -string \ -usecharforbyte 11 4 1 $(BOOT_JAVA_CMD) -jar $(GENERATECHARACTER_JARFILE) -plane 2 \ -template $(CHARACTERDATA)/CharacterData02.java.template \ -spec $(UNICODEDATA)/UnicodeData.txt \ -specialcasing $(UNICODEDATA)/SpecialCasing.txt \ + -proplist $(UNICODEDATA)/PropList.txt \ -o $(GENSRCDIR)/java/lang/CharacterData02.java -string \ -usecharforbyte 11 4 1 $(BOOT_JAVA_CMD) -jar $(GENERATECHARACTER_JARFILE) -plane 14 \ -template $(CHARACTERDATA)/CharacterData0E.java.template \ -spec $(UNICODEDATA)/UnicodeData.txt \ -specialcasing $(UNICODEDATA)/SpecialCasing.txt \ + -proplist $(UNICODEDATA)/PropList.txt \ -o $(GENSRCDIR)/java/lang/CharacterData0E.java -string \ -usecharforbyte 11 4 1 diff --git a/jdk/make/tools/GenerateCharacter/CharacterData00.java.template b/jdk/make/tools/GenerateCharacter/CharacterData00.java.template index 5a1fd5a6364..8de328869af 100644 --- a/jdk/make/tools/GenerateCharacter/CharacterData00.java.template +++ b/jdk/make/tools/GenerateCharacter/CharacterData00.java.template @@ -73,11 +73,37 @@ class CharacterData00 extends CharacterData { return props; } + int getPropertiesEx(int ch) { + char offset = (char)ch; + int props = $$LookupEx(offset); + return props; + } + int getType(int ch) { int props = getProperties(ch); return (props & $$maskType); } + boolean isOtherLowercase(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherLowercase) != 0; + } + + boolean isOtherUppercase(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherUppercase) != 0; + } + + boolean isOtherAlphabetic(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherAlphabetic) != 0; + } + + boolean isIdeographic(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskIdeographic) != 0; + } + boolean isJavaIdentifierStart(int ch) { int props = getProperties(ch); return ((props & $$maskIdentifierInfo) >= $$lowJavaStart); diff --git a/jdk/make/tools/GenerateCharacter/CharacterData01.java.template b/jdk/make/tools/GenerateCharacter/CharacterData01.java.template index fef710002ca..1245eb13c07 100644 --- a/jdk/make/tools/GenerateCharacter/CharacterData01.java.template +++ b/jdk/make/tools/GenerateCharacter/CharacterData01.java.template @@ -72,11 +72,37 @@ class CharacterData01 extends CharacterData { return props; } + int getPropertiesEx(int ch) { + char offset = (char)ch; + int props = $$LookupEx(offset); + return props; + } + int getType(int ch) { int props = getProperties(ch); return (props & $$maskType); } + boolean isOtherLowercase(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherLowercase) != 0; + } + + boolean isOtherUppercase(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherUppercase) != 0; + } + + boolean isOtherAlphabetic(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherAlphabetic) != 0; + } + + boolean isIdeographic(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskIdeographic) != 0; + } + boolean isJavaIdentifierStart(int ch) { int props = getProperties(ch); return ((props & $$maskIdentifierInfo) >= $$lowJavaStart); diff --git a/jdk/make/tools/GenerateCharacter/CharacterData02.java.template b/jdk/make/tools/GenerateCharacter/CharacterData02.java.template index 845decc3d1a..7719e4a6295 100644 --- a/jdk/make/tools/GenerateCharacter/CharacterData02.java.template +++ b/jdk/make/tools/GenerateCharacter/CharacterData02.java.template @@ -66,11 +66,37 @@ class CharacterData02 extends CharacterData { */ int getProperties(int ch) { - char offset = (char)ch; + char offset = (char)ch; int props = $$Lookup(offset); return props; } + int getPropertiesEx(int ch) { + char offset = (char)ch; + int props = $$LookupEx(offset); + return props; + } + + boolean isOtherLowercase(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherLowercase) != 0; + } + + boolean isOtherUppercase(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherUppercase) != 0; + } + + boolean isOtherAlphabetic(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherAlphabetic) != 0; + } + + boolean isIdeographic(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskIdeographic) != 0; + } + int getType(int ch) { int props = getProperties(ch); return (props & $$maskType); diff --git a/jdk/make/tools/GenerateCharacter/CharacterData0E.java.template b/jdk/make/tools/GenerateCharacter/CharacterData0E.java.template index 12abce182d2..15416ffc7ad 100644 --- a/jdk/make/tools/GenerateCharacter/CharacterData0E.java.template +++ b/jdk/make/tools/GenerateCharacter/CharacterData0E.java.template @@ -66,11 +66,37 @@ class CharacterData0E extends CharacterData { */ int getProperties(int ch) { - char offset = (char)ch; + char offset = (char)ch; int props = $$Lookup(offset); return props; } + int getPropertiesEx(int ch) { + char offset = (char)ch; + int props = $$LookupEx(offset); + return props; + } + + boolean isOtherLowercase(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherLowercase) != 0; + } + + boolean isOtherUppercase(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherUppercase) != 0; + } + + boolean isOtherAlphabetic(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherAlphabetic) != 0; + } + + boolean isIdeographic(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskIdeographic) != 0; + } + int getType(int ch) { int props = getProperties(ch); return (props & $$maskType); diff --git a/jdk/make/tools/GenerateCharacter/CharacterDataLatin1.java.template b/jdk/make/tools/GenerateCharacter/CharacterDataLatin1.java.template index e4646d16bbe..ed2e38e6aa6 100644 --- a/jdk/make/tools/GenerateCharacter/CharacterDataLatin1.java.template +++ b/jdk/make/tools/GenerateCharacter/CharacterDataLatin1.java.template @@ -67,11 +67,37 @@ class CharacterDataLatin1 extends CharacterData { */ int getProperties(int ch) { - char offset = (char)ch; + char offset = (char)ch; int props = $$Lookup(offset); return props; } + int getPropertiesEx(int ch) { + char offset = (char)ch; + int props = $$LookupEx(offset); + return props; + } + + boolean isOtherLowercase(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherLowercase) != 0; + } + + boolean isOtherUppercase(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherUppercase) != 0; + } + + boolean isOtherAlphabetic(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskOtherAlphabetic) != 0; + } + + boolean isIdeographic(int ch) { + int props = getPropertiesEx(ch); + return (props & $$maskIdeographic) != 0; + } + int getType(int ch) { int props = getProperties(ch); return (props & $$maskType); diff --git a/jdk/make/tools/UnicodeData/PropList.txt b/jdk/make/tools/UnicodeData/PropList.txt new file mode 100644 index 00000000000..eeeb81845e3 --- /dev/null +++ b/jdk/make/tools/UnicodeData/PropList.txt @@ -0,0 +1,1296 @@ +# PropList-6.0.0.txt +# Date: 2010-08-19, 00:48:28 GMT [MD] +# +# Unicode Character Database +# Copyright (c) 1991-2010 Unicode, Inc. +# For terms of use, see http://www.unicode.org/terms_of_use.html +# For documentation, see http://www.unicode.org/reports/tr44/ + +# ================================================ + +0009..000D ; White_Space # Cc [5] .. +0020 ; White_Space # Zs SPACE +0085 ; White_Space # Cc +00A0 ; White_Space # Zs NO-BREAK SPACE +1680 ; White_Space # Zs OGHAM SPACE MARK +180E ; White_Space # Zs MONGOLIAN VOWEL SEPARATOR +2000..200A ; White_Space # Zs [11] EN QUAD..HAIR SPACE +2028 ; White_Space # Zl LINE SEPARATOR +2029 ; White_Space # Zp PARAGRAPH SEPARATOR +202F ; White_Space # Zs NARROW NO-BREAK SPACE +205F ; White_Space # Zs MEDIUM MATHEMATICAL SPACE +3000 ; White_Space # Zs IDEOGRAPHIC SPACE + +# Total code points: 26 + +# ================================================ + +200E..200F ; Bidi_Control # Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK +202A..202E ; Bidi_Control # Cf [5] LEFT-TO-RIGHT EMBEDDING..RIGHT-TO-LEFT OVERRIDE + +# Total code points: 7 + +# ================================================ + +200C..200D ; Join_Control # Cf [2] ZERO WIDTH NON-JOINER..ZERO WIDTH JOINER + +# Total code points: 2 + +# ================================================ + +002D ; Dash # Pd HYPHEN-MINUS +058A ; Dash # Pd ARMENIAN HYPHEN +05BE ; Dash # Pd HEBREW PUNCTUATION MAQAF +1400 ; Dash # Pd CANADIAN SYLLABICS HYPHEN +1806 ; Dash # Pd MONGOLIAN TODO SOFT HYPHEN +2010..2015 ; Dash # Pd [6] HYPHEN..HORIZONTAL BAR +2053 ; Dash # Po SWUNG DASH +207B ; Dash # Sm SUPERSCRIPT MINUS +208B ; Dash # Sm SUBSCRIPT MINUS +2212 ; Dash # Sm MINUS SIGN +2E17 ; Dash # Pd DOUBLE OBLIQUE HYPHEN +2E1A ; Dash # Pd HYPHEN WITH DIAERESIS +301C ; Dash # Pd WAVE DASH +3030 ; Dash # Pd WAVY DASH +30A0 ; Dash # Pd KATAKANA-HIRAGANA DOUBLE HYPHEN +FE31..FE32 ; Dash # Pd [2] PRESENTATION FORM FOR VERTICAL EM DASH..PRESENTATION FORM FOR VERTICAL EN DASH +FE58 ; Dash # Pd SMALL EM DASH +FE63 ; Dash # Pd SMALL HYPHEN-MINUS +FF0D ; Dash # Pd FULLWIDTH HYPHEN-MINUS + +# Total code points: 25 + +# ================================================ + +002D ; Hyphen # Pd HYPHEN-MINUS +00AD ; Hyphen # Cf SOFT HYPHEN +058A ; Hyphen # Pd ARMENIAN HYPHEN +1806 ; Hyphen # Pd MONGOLIAN TODO SOFT HYPHEN +2010..2011 ; Hyphen # Pd [2] HYPHEN..NON-BREAKING HYPHEN +2E17 ; Hyphen # Pd DOUBLE OBLIQUE HYPHEN +30FB ; Hyphen # Po KATAKANA MIDDLE DOT +FE63 ; Hyphen # Pd SMALL HYPHEN-MINUS +FF0D ; Hyphen # Pd FULLWIDTH HYPHEN-MINUS +FF65 ; Hyphen # Po HALFWIDTH KATAKANA MIDDLE DOT + +# Total code points: 11 + +# ================================================ + +0022 ; Quotation_Mark # Po QUOTATION MARK +0027 ; Quotation_Mark # Po APOSTROPHE +00AB ; Quotation_Mark # Pi LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +00BB ; Quotation_Mark # Pf RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +2018 ; Quotation_Mark # Pi LEFT SINGLE QUOTATION MARK +2019 ; Quotation_Mark # Pf RIGHT SINGLE QUOTATION MARK +201A ; Quotation_Mark # Ps SINGLE LOW-9 QUOTATION MARK +201B..201C ; Quotation_Mark # Pi [2] SINGLE HIGH-REVERSED-9 QUOTATION MARK..LEFT DOUBLE QUOTATION MARK +201D ; Quotation_Mark # Pf RIGHT DOUBLE QUOTATION MARK +201E ; Quotation_Mark # Ps DOUBLE LOW-9 QUOTATION MARK +201F ; Quotation_Mark # Pi DOUBLE HIGH-REVERSED-9 QUOTATION MARK +2039 ; Quotation_Mark # Pi SINGLE LEFT-POINTING ANGLE QUOTATION MARK +203A ; Quotation_Mark # Pf SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +300C ; Quotation_Mark # Ps LEFT CORNER BRACKET +300D ; Quotation_Mark # Pe RIGHT CORNER BRACKET +300E ; Quotation_Mark # Ps LEFT WHITE CORNER BRACKET +300F ; Quotation_Mark # Pe RIGHT WHITE CORNER BRACKET +301D ; Quotation_Mark # Ps REVERSED DOUBLE PRIME QUOTATION MARK +301E..301F ; Quotation_Mark # Pe [2] DOUBLE PRIME QUOTATION MARK..LOW DOUBLE PRIME QUOTATION MARK +FE41 ; Quotation_Mark # Ps PRESENTATION FORM FOR VERTICAL LEFT CORNER BRACKET +FE42 ; Quotation_Mark # Pe PRESENTATION FORM FOR VERTICAL RIGHT CORNER BRACKET +FE43 ; Quotation_Mark # Ps PRESENTATION FORM FOR VERTICAL LEFT WHITE CORNER BRACKET +FE44 ; Quotation_Mark # Pe PRESENTATION FORM FOR VERTICAL RIGHT WHITE CORNER BRACKET +FF02 ; Quotation_Mark # Po FULLWIDTH QUOTATION MARK +FF07 ; Quotation_Mark # Po FULLWIDTH APOSTROPHE +FF62 ; Quotation_Mark # Ps HALFWIDTH LEFT CORNER BRACKET +FF63 ; Quotation_Mark # Pe HALFWIDTH RIGHT CORNER BRACKET + +# Total code points: 29 + +# ================================================ + +0021 ; Terminal_Punctuation # Po EXCLAMATION MARK +002C ; Terminal_Punctuation # Po COMMA +002E ; Terminal_Punctuation # Po FULL STOP +003A..003B ; Terminal_Punctuation # Po [2] COLON..SEMICOLON +003F ; Terminal_Punctuation # Po QUESTION MARK +037E ; Terminal_Punctuation # Po GREEK QUESTION MARK +0387 ; Terminal_Punctuation # Po GREEK ANO TELEIA +0589 ; Terminal_Punctuation # Po ARMENIAN FULL STOP +05C3 ; Terminal_Punctuation # Po HEBREW PUNCTUATION SOF PASUQ +060C ; Terminal_Punctuation # Po ARABIC COMMA +061B ; Terminal_Punctuation # Po ARABIC SEMICOLON +061F ; Terminal_Punctuation # Po ARABIC QUESTION MARK +06D4 ; Terminal_Punctuation # Po ARABIC FULL STOP +0700..070A ; Terminal_Punctuation # Po [11] SYRIAC END OF PARAGRAPH..SYRIAC CONTRACTION +070C ; Terminal_Punctuation # Po SYRIAC HARKLEAN METOBELUS +07F8..07F9 ; Terminal_Punctuation # Po [2] NKO COMMA..NKO EXCLAMATION MARK +0830..083E ; Terminal_Punctuation # Po [15] SAMARITAN PUNCTUATION NEQUDAA..SAMARITAN PUNCTUATION ANNAAU +085E ; Terminal_Punctuation # Po MANDAIC PUNCTUATION +0964..0965 ; Terminal_Punctuation # Po [2] DEVANAGARI DANDA..DEVANAGARI DOUBLE DANDA +0E5A..0E5B ; Terminal_Punctuation # Po [2] THAI CHARACTER ANGKHANKHU..THAI CHARACTER KHOMUT +0F08 ; Terminal_Punctuation # Po TIBETAN MARK SBRUL SHAD +0F0D..0F12 ; Terminal_Punctuation # Po [6] TIBETAN MARK SHAD..TIBETAN MARK RGYA GRAM SHAD +104A..104B ; Terminal_Punctuation # Po [2] MYANMAR SIGN LITTLE SECTION..MYANMAR SIGN SECTION +1361..1368 ; Terminal_Punctuation # Po [8] ETHIOPIC WORDSPACE..ETHIOPIC PARAGRAPH SEPARATOR +166D..166E ; Terminal_Punctuation # Po [2] CANADIAN SYLLABICS CHI SIGN..CANADIAN SYLLABICS FULL STOP +16EB..16ED ; Terminal_Punctuation # Po [3] RUNIC SINGLE PUNCTUATION..RUNIC CROSS PUNCTUATION +17D4..17D6 ; Terminal_Punctuation # Po [3] KHMER SIGN KHAN..KHMER SIGN CAMNUC PII KUUH +17DA ; Terminal_Punctuation # Po KHMER SIGN KOOMUUT +1802..1805 ; Terminal_Punctuation # Po [4] MONGOLIAN COMMA..MONGOLIAN FOUR DOTS +1808..1809 ; Terminal_Punctuation # Po [2] MONGOLIAN MANCHU COMMA..MONGOLIAN MANCHU FULL STOP +1944..1945 ; Terminal_Punctuation # Po [2] LIMBU EXCLAMATION MARK..LIMBU QUESTION MARK +1AA8..1AAB ; Terminal_Punctuation # Po [4] TAI THAM SIGN KAAN..TAI THAM SIGN SATKAANKUU +1B5A..1B5B ; Terminal_Punctuation # Po [2] BALINESE PANTI..BALINESE PAMADA +1B5D..1B5F ; Terminal_Punctuation # Po [3] BALINESE CARIK PAMUNGKAH..BALINESE CARIK PAREREN +1C3B..1C3F ; Terminal_Punctuation # Po [5] LEPCHA PUNCTUATION TA-ROL..LEPCHA PUNCTUATION TSHOOK +1C7E..1C7F ; Terminal_Punctuation # Po [2] OL CHIKI PUNCTUATION MUCAAD..OL CHIKI PUNCTUATION DOUBLE MUCAAD +203C..203D ; Terminal_Punctuation # Po [2] DOUBLE EXCLAMATION MARK..INTERROBANG +2047..2049 ; Terminal_Punctuation # Po [3] DOUBLE QUESTION MARK..EXCLAMATION QUESTION MARK +2E2E ; Terminal_Punctuation # Po REVERSED QUESTION MARK +3001..3002 ; Terminal_Punctuation # Po [2] IDEOGRAPHIC COMMA..IDEOGRAPHIC FULL STOP +A4FE..A4FF ; Terminal_Punctuation # Po [2] LISU PUNCTUATION COMMA..LISU PUNCTUATION FULL STOP +A60D..A60F ; Terminal_Punctuation # Po [3] VAI COMMA..VAI QUESTION MARK +A6F3..A6F7 ; Terminal_Punctuation # Po [5] BAMUM FULL STOP..BAMUM QUESTION MARK +A876..A877 ; Terminal_Punctuation # Po [2] PHAGS-PA MARK SHAD..PHAGS-PA MARK DOUBLE SHAD +A8CE..A8CF ; Terminal_Punctuation # Po [2] SAURASHTRA DANDA..SAURASHTRA DOUBLE DANDA +A92F ; Terminal_Punctuation # Po KAYAH LI SIGN SHYA +A9C7..A9C9 ; Terminal_Punctuation # Po [3] JAVANESE PADA PANGKAT..JAVANESE PADA LUNGSI +AA5D..AA5F ; Terminal_Punctuation # Po [3] CHAM PUNCTUATION DANDA..CHAM PUNCTUATION TRIPLE DANDA +AADF ; Terminal_Punctuation # Po TAI VIET SYMBOL KOI KOI +ABEB ; Terminal_Punctuation # Po MEETEI MAYEK CHEIKHEI +FE50..FE52 ; Terminal_Punctuation # Po [3] SMALL COMMA..SMALL FULL STOP +FE54..FE57 ; Terminal_Punctuation # Po [4] SMALL SEMICOLON..SMALL EXCLAMATION MARK +FF01 ; Terminal_Punctuation # Po FULLWIDTH EXCLAMATION MARK +FF0C ; Terminal_Punctuation # Po FULLWIDTH COMMA +FF0E ; Terminal_Punctuation # Po FULLWIDTH FULL STOP +FF1A..FF1B ; Terminal_Punctuation # Po [2] FULLWIDTH COLON..FULLWIDTH SEMICOLON +FF1F ; Terminal_Punctuation # Po FULLWIDTH QUESTION MARK +FF61 ; Terminal_Punctuation # Po HALFWIDTH IDEOGRAPHIC FULL STOP +FF64 ; Terminal_Punctuation # Po HALFWIDTH IDEOGRAPHIC COMMA +1039F ; Terminal_Punctuation # Po UGARITIC WORD DIVIDER +103D0 ; Terminal_Punctuation # Po OLD PERSIAN WORD DIVIDER +10857 ; Terminal_Punctuation # Po IMPERIAL ARAMAIC SECTION SIGN +1091F ; Terminal_Punctuation # Po PHOENICIAN WORD SEPARATOR +10B3A..10B3F ; Terminal_Punctuation # Po [6] TINY TWO DOTS OVER ONE DOT PUNCTUATION..LARGE ONE RING OVER TWO RINGS PUNCTUATION +11047..1104D ; Terminal_Punctuation # Po [7] BRAHMI DANDA..BRAHMI PUNCTUATION LOTUS +110BE..110C1 ; Terminal_Punctuation # Po [4] KAITHI SECTION MARK..KAITHI DOUBLE DANDA +12470..12473 ; Terminal_Punctuation # Po [4] CUNEIFORM PUNCTUATION SIGN OLD ASSYRIAN WORD DIVIDER..CUNEIFORM PUNCTUATION SIGN DIAGONAL TRICOLON + +# Total code points: 169 + +# ================================================ + +005E ; Other_Math # Sk CIRCUMFLEX ACCENT +03D0..03D2 ; Other_Math # L& [3] GREEK BETA SYMBOL..GREEK UPSILON WITH HOOK SYMBOL +03D5 ; Other_Math # L& GREEK PHI SYMBOL +03F0..03F1 ; Other_Math # L& [2] GREEK KAPPA SYMBOL..GREEK RHO SYMBOL +03F4..03F5 ; Other_Math # L& [2] GREEK CAPITAL THETA SYMBOL..GREEK LUNATE EPSILON SYMBOL +2016 ; Other_Math # Po DOUBLE VERTICAL LINE +2032..2034 ; Other_Math # Po [3] PRIME..TRIPLE PRIME +2040 ; Other_Math # Pc CHARACTER TIE +2061..2064 ; Other_Math # Cf [4] FUNCTION APPLICATION..INVISIBLE PLUS +207D ; Other_Math # Ps SUPERSCRIPT LEFT PARENTHESIS +207E ; Other_Math # Pe SUPERSCRIPT RIGHT PARENTHESIS +208D ; Other_Math # Ps SUBSCRIPT LEFT PARENTHESIS +208E ; Other_Math # Pe SUBSCRIPT RIGHT PARENTHESIS +20D0..20DC ; Other_Math # Mn [13] COMBINING LEFT HARPOON ABOVE..COMBINING FOUR DOTS ABOVE +20E1 ; Other_Math # Mn COMBINING LEFT RIGHT ARROW ABOVE +20E5..20E6 ; Other_Math # Mn [2] COMBINING REVERSE SOLIDUS OVERLAY..COMBINING DOUBLE VERTICAL STROKE OVERLAY +20EB..20EF ; Other_Math # Mn [5] COMBINING LONG DOUBLE SOLIDUS OVERLAY..COMBINING RIGHT ARROW BELOW +2102 ; Other_Math # L& DOUBLE-STRUCK CAPITAL C +2107 ; Other_Math # L& EULER CONSTANT +210A..2113 ; Other_Math # L& [10] SCRIPT SMALL G..SCRIPT SMALL L +2115 ; Other_Math # L& DOUBLE-STRUCK CAPITAL N +2119..211D ; Other_Math # L& [5] DOUBLE-STRUCK CAPITAL P..DOUBLE-STRUCK CAPITAL R +2124 ; Other_Math # L& DOUBLE-STRUCK CAPITAL Z +2128 ; Other_Math # L& BLACK-LETTER CAPITAL Z +2129 ; Other_Math # So TURNED GREEK SMALL LETTER IOTA +212C..212D ; Other_Math # L& [2] SCRIPT CAPITAL B..BLACK-LETTER CAPITAL C +212F..2131 ; Other_Math # L& [3] SCRIPT SMALL E..SCRIPT CAPITAL F +2133..2134 ; Other_Math # L& [2] SCRIPT CAPITAL M..SCRIPT SMALL O +2135..2138 ; Other_Math # Lo [4] ALEF SYMBOL..DALET SYMBOL +213C..213F ; Other_Math # L& [4] DOUBLE-STRUCK SMALL PI..DOUBLE-STRUCK CAPITAL PI +2145..2149 ; Other_Math # L& [5] DOUBLE-STRUCK ITALIC CAPITAL D..DOUBLE-STRUCK ITALIC SMALL J +2195..2199 ; Other_Math # So [5] UP DOWN ARROW..SOUTH WEST ARROW +219C..219F ; Other_Math # So [4] LEFTWARDS WAVE ARROW..UPWARDS TWO HEADED ARROW +21A1..21A2 ; Other_Math # So [2] DOWNWARDS TWO HEADED ARROW..LEFTWARDS ARROW WITH TAIL +21A4..21A5 ; Other_Math # So [2] LEFTWARDS ARROW FROM BAR..UPWARDS ARROW FROM BAR +21A7 ; Other_Math # So DOWNWARDS ARROW FROM BAR +21A9..21AD ; Other_Math # So [5] LEFTWARDS ARROW WITH HOOK..LEFT RIGHT WAVE ARROW +21B0..21B1 ; Other_Math # So [2] UPWARDS ARROW WITH TIP LEFTWARDS..UPWARDS ARROW WITH TIP RIGHTWARDS +21B6..21B7 ; Other_Math # So [2] ANTICLOCKWISE TOP SEMICIRCLE ARROW..CLOCKWISE TOP SEMICIRCLE ARROW +21BC..21CD ; Other_Math # So [18] LEFTWARDS HARPOON WITH BARB UPWARDS..LEFTWARDS DOUBLE ARROW WITH STROKE +21D0..21D1 ; Other_Math # So [2] LEFTWARDS DOUBLE ARROW..UPWARDS DOUBLE ARROW +21D3 ; Other_Math # So DOWNWARDS DOUBLE ARROW +21D5..21DB ; Other_Math # So [7] UP DOWN DOUBLE ARROW..RIGHTWARDS TRIPLE ARROW +21DD ; Other_Math # So RIGHTWARDS SQUIGGLE ARROW +21E4..21E5 ; Other_Math # So [2] LEFTWARDS ARROW TO BAR..RIGHTWARDS ARROW TO BAR +23B4..23B5 ; Other_Math # So [2] TOP SQUARE BRACKET..BOTTOM SQUARE BRACKET +23B7 ; Other_Math # So RADICAL SYMBOL BOTTOM +23D0 ; Other_Math # So VERTICAL LINE EXTENSION +23E2 ; Other_Math # So WHITE TRAPEZIUM +25A0..25A1 ; Other_Math # So [2] BLACK SQUARE..WHITE SQUARE +25AE..25B6 ; Other_Math # So [9] BLACK VERTICAL RECTANGLE..BLACK RIGHT-POINTING TRIANGLE +25BC..25C0 ; Other_Math # So [5] BLACK DOWN-POINTING TRIANGLE..BLACK LEFT-POINTING TRIANGLE +25C6..25C7 ; Other_Math # So [2] BLACK DIAMOND..WHITE DIAMOND +25CA..25CB ; Other_Math # So [2] LOZENGE..WHITE CIRCLE +25CF..25D3 ; Other_Math # So [5] BLACK CIRCLE..CIRCLE WITH UPPER HALF BLACK +25E2 ; Other_Math # So BLACK LOWER RIGHT TRIANGLE +25E4 ; Other_Math # So BLACK UPPER LEFT TRIANGLE +25E7..25EC ; Other_Math # So [6] SQUARE WITH LEFT HALF BLACK..WHITE UP-POINTING TRIANGLE WITH DOT +2605..2606 ; Other_Math # So [2] BLACK STAR..WHITE STAR +2640 ; Other_Math # So FEMALE SIGN +2642 ; Other_Math # So MALE SIGN +2660..2663 ; Other_Math # So [4] BLACK SPADE SUIT..BLACK CLUB SUIT +266D..266E ; Other_Math # So [2] MUSIC FLAT SIGN..MUSIC NATURAL SIGN +27C5 ; Other_Math # Ps LEFT S-SHAPED BAG DELIMITER +27C6 ; Other_Math # Pe RIGHT S-SHAPED BAG DELIMITER +27E6 ; Other_Math # Ps MATHEMATICAL LEFT WHITE SQUARE BRACKET +27E7 ; Other_Math # Pe MATHEMATICAL RIGHT WHITE SQUARE BRACKET +27E8 ; Other_Math # Ps MATHEMATICAL LEFT ANGLE BRACKET +27E9 ; Other_Math # Pe MATHEMATICAL RIGHT ANGLE BRACKET +27EA ; Other_Math # Ps MATHEMATICAL LEFT DOUBLE ANGLE BRACKET +27EB ; Other_Math # Pe MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET +27EC ; Other_Math # Ps MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET +27ED ; Other_Math # Pe MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET +27EE ; Other_Math # Ps MATHEMATICAL LEFT FLATTENED PARENTHESIS +27EF ; Other_Math # Pe MATHEMATICAL RIGHT FLATTENED PARENTHESIS +2983 ; Other_Math # Ps LEFT WHITE CURLY BRACKET +2984 ; Other_Math # Pe RIGHT WHITE CURLY BRACKET +2985 ; Other_Math # Ps LEFT WHITE PARENTHESIS +2986 ; Other_Math # Pe RIGHT WHITE PARENTHESIS +2987 ; Other_Math # Ps Z NOTATION LEFT IMAGE BRACKET +2988 ; Other_Math # Pe Z NOTATION RIGHT IMAGE BRACKET +2989 ; Other_Math # Ps Z NOTATION LEFT BINDING BRACKET +298A ; Other_Math # Pe Z NOTATION RIGHT BINDING BRACKET +298B ; Other_Math # Ps LEFT SQUARE BRACKET WITH UNDERBAR +298C ; Other_Math # Pe RIGHT SQUARE BRACKET WITH UNDERBAR +298D ; Other_Math # Ps LEFT SQUARE BRACKET WITH TICK IN TOP CORNER +298E ; Other_Math # Pe RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER +298F ; Other_Math # Ps LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER +2990 ; Other_Math # Pe RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER +2991 ; Other_Math # Ps LEFT ANGLE BRACKET WITH DOT +2992 ; Other_Math # Pe RIGHT ANGLE BRACKET WITH DOT +2993 ; Other_Math # Ps LEFT ARC LESS-THAN BRACKET +2994 ; Other_Math # Pe RIGHT ARC GREATER-THAN BRACKET +2995 ; Other_Math # Ps DOUBLE LEFT ARC GREATER-THAN BRACKET +2996 ; Other_Math # Pe DOUBLE RIGHT ARC LESS-THAN BRACKET +2997 ; Other_Math # Ps LEFT BLACK TORTOISE SHELL BRACKET +2998 ; Other_Math # Pe RIGHT BLACK TORTOISE SHELL BRACKET +29D8 ; Other_Math # Ps LEFT WIGGLY FENCE +29D9 ; Other_Math # Pe RIGHT WIGGLY FENCE +29DA ; Other_Math # Ps LEFT DOUBLE WIGGLY FENCE +29DB ; Other_Math # Pe RIGHT DOUBLE WIGGLY FENCE +29FC ; Other_Math # Ps LEFT-POINTING CURVED ANGLE BRACKET +29FD ; Other_Math # Pe RIGHT-POINTING CURVED ANGLE BRACKET +FE61 ; Other_Math # Po SMALL ASTERISK +FE63 ; Other_Math # Pd SMALL HYPHEN-MINUS +FE68 ; Other_Math # Po SMALL REVERSE SOLIDUS +FF3C ; Other_Math # Po FULLWIDTH REVERSE SOLIDUS +FF3E ; Other_Math # Sk FULLWIDTH CIRCUMFLEX ACCENT +1D400..1D454 ; Other_Math # L& [85] MATHEMATICAL BOLD CAPITAL A..MATHEMATICAL ITALIC SMALL G +1D456..1D49C ; Other_Math # L& [71] MATHEMATICAL ITALIC SMALL I..MATHEMATICAL SCRIPT CAPITAL A +1D49E..1D49F ; Other_Math # L& [2] MATHEMATICAL SCRIPT CAPITAL C..MATHEMATICAL SCRIPT CAPITAL D +1D4A2 ; Other_Math # L& MATHEMATICAL SCRIPT CAPITAL G +1D4A5..1D4A6 ; Other_Math # L& [2] MATHEMATICAL SCRIPT CAPITAL J..MATHEMATICAL SCRIPT CAPITAL K +1D4A9..1D4AC ; Other_Math # L& [4] MATHEMATICAL SCRIPT CAPITAL N..MATHEMATICAL SCRIPT CAPITAL Q +1D4AE..1D4B9 ; Other_Math # L& [12] MATHEMATICAL SCRIPT CAPITAL S..MATHEMATICAL SCRIPT SMALL D +1D4BB ; Other_Math # L& MATHEMATICAL SCRIPT SMALL F +1D4BD..1D4C3 ; Other_Math # L& [7] MATHEMATICAL SCRIPT SMALL H..MATHEMATICAL SCRIPT SMALL N +1D4C5..1D505 ; Other_Math # L& [65] MATHEMATICAL SCRIPT SMALL P..MATHEMATICAL FRAKTUR CAPITAL B +1D507..1D50A ; Other_Math # L& [4] MATHEMATICAL FRAKTUR CAPITAL D..MATHEMATICAL FRAKTUR CAPITAL G +1D50D..1D514 ; Other_Math # L& [8] MATHEMATICAL FRAKTUR CAPITAL J..MATHEMATICAL FRAKTUR CAPITAL Q +1D516..1D51C ; Other_Math # L& [7] MATHEMATICAL FRAKTUR CAPITAL S..MATHEMATICAL FRAKTUR CAPITAL Y +1D51E..1D539 ; Other_Math # L& [28] MATHEMATICAL FRAKTUR SMALL A..MATHEMATICAL DOUBLE-STRUCK CAPITAL B +1D53B..1D53E ; Other_Math # L& [4] MATHEMATICAL DOUBLE-STRUCK CAPITAL D..MATHEMATICAL DOUBLE-STRUCK CAPITAL G +1D540..1D544 ; Other_Math # L& [5] MATHEMATICAL DOUBLE-STRUCK CAPITAL I..MATHEMATICAL DOUBLE-STRUCK CAPITAL M +1D546 ; Other_Math # L& MATHEMATICAL DOUBLE-STRUCK CAPITAL O +1D54A..1D550 ; Other_Math # L& [7] MATHEMATICAL DOUBLE-STRUCK CAPITAL S..MATHEMATICAL DOUBLE-STRUCK CAPITAL Y +1D552..1D6A5 ; Other_Math # L& [340] MATHEMATICAL DOUBLE-STRUCK SMALL A..MATHEMATICAL ITALIC SMALL DOTLESS J +1D6A8..1D6C0 ; Other_Math # L& [25] MATHEMATICAL BOLD CAPITAL ALPHA..MATHEMATICAL BOLD CAPITAL OMEGA +1D6C2..1D6DA ; Other_Math # L& [25] MATHEMATICAL BOLD SMALL ALPHA..MATHEMATICAL BOLD SMALL OMEGA +1D6DC..1D6FA ; Other_Math # L& [31] MATHEMATICAL BOLD EPSILON SYMBOL..MATHEMATICAL ITALIC CAPITAL OMEGA +1D6FC..1D714 ; Other_Math # L& [25] MATHEMATICAL ITALIC SMALL ALPHA..MATHEMATICAL ITALIC SMALL OMEGA +1D716..1D734 ; Other_Math # L& [31] MATHEMATICAL ITALIC EPSILON SYMBOL..MATHEMATICAL BOLD ITALIC CAPITAL OMEGA +1D736..1D74E ; Other_Math # L& [25] MATHEMATICAL BOLD ITALIC SMALL ALPHA..MATHEMATICAL BOLD ITALIC SMALL OMEGA +1D750..1D76E ; Other_Math # L& [31] MATHEMATICAL BOLD ITALIC EPSILON SYMBOL..MATHEMATICAL SANS-SERIF BOLD CAPITAL OMEGA +1D770..1D788 ; Other_Math # L& [25] MATHEMATICAL SANS-SERIF BOLD SMALL ALPHA..MATHEMATICAL SANS-SERIF BOLD SMALL OMEGA +1D78A..1D7A8 ; Other_Math # L& [31] MATHEMATICAL SANS-SERIF BOLD EPSILON SYMBOL..MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL OMEGA +1D7AA..1D7C2 ; Other_Math # L& [25] MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL ALPHA..MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL OMEGA +1D7C4..1D7CB ; Other_Math # L& [8] MATHEMATICAL SANS-SERIF BOLD ITALIC EPSILON SYMBOL..MATHEMATICAL BOLD SMALL DIGAMMA +1D7CE..1D7FF ; Other_Math # Nd [50] MATHEMATICAL BOLD DIGIT ZERO..MATHEMATICAL MONOSPACE DIGIT NINE + +# Total code points: 1217 + +# ================================================ + +0030..0039 ; Hex_Digit # Nd [10] DIGIT ZERO..DIGIT NINE +0041..0046 ; Hex_Digit # L& [6] LATIN CAPITAL LETTER A..LATIN CAPITAL LETTER F +0061..0066 ; Hex_Digit # L& [6] LATIN SMALL LETTER A..LATIN SMALL LETTER F +FF10..FF19 ; Hex_Digit # Nd [10] FULLWIDTH DIGIT ZERO..FULLWIDTH DIGIT NINE +FF21..FF26 ; Hex_Digit # L& [6] FULLWIDTH LATIN CAPITAL LETTER A..FULLWIDTH LATIN CAPITAL LETTER F +FF41..FF46 ; Hex_Digit # L& [6] FULLWIDTH LATIN SMALL LETTER A..FULLWIDTH LATIN SMALL LETTER F + +# Total code points: 44 + +# ================================================ + +0030..0039 ; ASCII_Hex_Digit # Nd [10] DIGIT ZERO..DIGIT NINE +0041..0046 ; ASCII_Hex_Digit # L& [6] LATIN CAPITAL LETTER A..LATIN CAPITAL LETTER F +0061..0066 ; ASCII_Hex_Digit # L& [6] LATIN SMALL LETTER A..LATIN SMALL LETTER F + +# Total code points: 22 + +# ================================================ + +0345 ; Other_Alphabetic # Mn COMBINING GREEK YPOGEGRAMMENI +05B0..05BD ; Other_Alphabetic # Mn [14] HEBREW POINT SHEVA..HEBREW POINT METEG +05BF ; Other_Alphabetic # Mn HEBREW POINT RAFE +05C1..05C2 ; Other_Alphabetic # Mn [2] HEBREW POINT SHIN DOT..HEBREW POINT SIN DOT +05C4..05C5 ; Other_Alphabetic # Mn [2] HEBREW MARK UPPER DOT..HEBREW MARK LOWER DOT +05C7 ; Other_Alphabetic # Mn HEBREW POINT QAMATS QATAN +0610..061A ; Other_Alphabetic # Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA +064B..0657 ; Other_Alphabetic # Mn [13] ARABIC FATHATAN..ARABIC INVERTED DAMMA +0659..065F ; Other_Alphabetic # Mn [7] ARABIC ZWARAKAY..ARABIC WAVY HAMZA BELOW +0670 ; Other_Alphabetic # Mn ARABIC LETTER SUPERSCRIPT ALEF +06D6..06DC ; Other_Alphabetic # Mn [7] ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA..ARABIC SMALL HIGH SEEN +06E1..06E4 ; Other_Alphabetic # Mn [4] ARABIC SMALL HIGH DOTLESS HEAD OF KHAH..ARABIC SMALL HIGH MADDA +06E7..06E8 ; Other_Alphabetic # Mn [2] ARABIC SMALL HIGH YEH..ARABIC SMALL HIGH NOON +06ED ; Other_Alphabetic # Mn ARABIC SMALL LOW MEEM +0711 ; Other_Alphabetic # Mn SYRIAC LETTER SUPERSCRIPT ALAPH +0730..073F ; Other_Alphabetic # Mn [16] SYRIAC PTHAHA ABOVE..SYRIAC RWAHA +07A6..07B0 ; Other_Alphabetic # Mn [11] THAANA ABAFILI..THAANA SUKUN +0816..0817 ; Other_Alphabetic # Mn [2] SAMARITAN MARK IN..SAMARITAN MARK IN-ALAF +081B..0823 ; Other_Alphabetic # Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A +0825..0827 ; Other_Alphabetic # Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U +0829..082C ; Other_Alphabetic # Mn [4] SAMARITAN VOWEL SIGN LONG I..SAMARITAN VOWEL SIGN SUKUN +0900..0902 ; Other_Alphabetic # Mn [3] DEVANAGARI SIGN INVERTED CANDRABINDU..DEVANAGARI SIGN ANUSVARA +0903 ; Other_Alphabetic # Mc DEVANAGARI SIGN VISARGA +093A ; Other_Alphabetic # Mn DEVANAGARI VOWEL SIGN OE +093B ; Other_Alphabetic # Mc DEVANAGARI VOWEL SIGN OOE +093E..0940 ; Other_Alphabetic # Mc [3] DEVANAGARI VOWEL SIGN AA..DEVANAGARI VOWEL SIGN II +0941..0948 ; Other_Alphabetic # Mn [8] DEVANAGARI VOWEL SIGN U..DEVANAGARI VOWEL SIGN AI +0949..094C ; Other_Alphabetic # Mc [4] DEVANAGARI VOWEL SIGN CANDRA O..DEVANAGARI VOWEL SIGN AU +094E..094F ; Other_Alphabetic # Mc [2] DEVANAGARI VOWEL SIGN PRISHTHAMATRA E..DEVANAGARI VOWEL SIGN AW +0955..0957 ; Other_Alphabetic # Mn [3] DEVANAGARI VOWEL SIGN CANDRA LONG E..DEVANAGARI VOWEL SIGN UUE +0962..0963 ; Other_Alphabetic # Mn [2] DEVANAGARI VOWEL SIGN VOCALIC L..DEVANAGARI VOWEL SIGN VOCALIC LL +0981 ; Other_Alphabetic # Mn BENGALI SIGN CANDRABINDU +0982..0983 ; Other_Alphabetic # Mc [2] BENGALI SIGN ANUSVARA..BENGALI SIGN VISARGA +09BE..09C0 ; Other_Alphabetic # Mc [3] BENGALI VOWEL SIGN AA..BENGALI VOWEL SIGN II +09C1..09C4 ; Other_Alphabetic # Mn [4] BENGALI VOWEL SIGN U..BENGALI VOWEL SIGN VOCALIC RR +09C7..09C8 ; Other_Alphabetic # Mc [2] BENGALI VOWEL SIGN E..BENGALI VOWEL SIGN AI +09CB..09CC ; Other_Alphabetic # Mc [2] BENGALI VOWEL SIGN O..BENGALI VOWEL SIGN AU +09D7 ; Other_Alphabetic # Mc BENGALI AU LENGTH MARK +09E2..09E3 ; Other_Alphabetic # Mn [2] BENGALI VOWEL SIGN VOCALIC L..BENGALI VOWEL SIGN VOCALIC LL +0A01..0A02 ; Other_Alphabetic # Mn [2] GURMUKHI SIGN ADAK BINDI..GURMUKHI SIGN BINDI +0A03 ; Other_Alphabetic # Mc GURMUKHI SIGN VISARGA +0A3E..0A40 ; Other_Alphabetic # Mc [3] GURMUKHI VOWEL SIGN AA..GURMUKHI VOWEL SIGN II +0A41..0A42 ; Other_Alphabetic # Mn [2] GURMUKHI VOWEL SIGN U..GURMUKHI VOWEL SIGN UU +0A47..0A48 ; Other_Alphabetic # Mn [2] GURMUKHI VOWEL SIGN EE..GURMUKHI VOWEL SIGN AI +0A4B..0A4C ; Other_Alphabetic # Mn [2] GURMUKHI VOWEL SIGN OO..GURMUKHI VOWEL SIGN AU +0A51 ; Other_Alphabetic # Mn GURMUKHI SIGN UDAAT +0A70..0A71 ; Other_Alphabetic # Mn [2] GURMUKHI TIPPI..GURMUKHI ADDAK +0A75 ; Other_Alphabetic # Mn GURMUKHI SIGN YAKASH +0A81..0A82 ; Other_Alphabetic # Mn [2] GUJARATI SIGN CANDRABINDU..GUJARATI SIGN ANUSVARA +0A83 ; Other_Alphabetic # Mc GUJARATI SIGN VISARGA +0ABE..0AC0 ; Other_Alphabetic # Mc [3] GUJARATI VOWEL SIGN AA..GUJARATI VOWEL SIGN II +0AC1..0AC5 ; Other_Alphabetic # Mn [5] GUJARATI VOWEL SIGN U..GUJARATI VOWEL SIGN CANDRA E +0AC7..0AC8 ; Other_Alphabetic # Mn [2] GUJARATI VOWEL SIGN E..GUJARATI VOWEL SIGN AI +0AC9 ; Other_Alphabetic # Mc GUJARATI VOWEL SIGN CANDRA O +0ACB..0ACC ; Other_Alphabetic # Mc [2] GUJARATI VOWEL SIGN O..GUJARATI VOWEL SIGN AU +0AE2..0AE3 ; Other_Alphabetic # Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJARATI VOWEL SIGN VOCALIC LL +0B01 ; Other_Alphabetic # Mn ORIYA SIGN CANDRABINDU +0B02..0B03 ; Other_Alphabetic # Mc [2] ORIYA SIGN ANUSVARA..ORIYA SIGN VISARGA +0B3E ; Other_Alphabetic # Mc ORIYA VOWEL SIGN AA +0B3F ; Other_Alphabetic # Mn ORIYA VOWEL SIGN I +0B40 ; Other_Alphabetic # Mc ORIYA VOWEL SIGN II +0B41..0B44 ; Other_Alphabetic # Mn [4] ORIYA VOWEL SIGN U..ORIYA VOWEL SIGN VOCALIC RR +0B47..0B48 ; Other_Alphabetic # Mc [2] ORIYA VOWEL SIGN E..ORIYA VOWEL SIGN AI +0B4B..0B4C ; Other_Alphabetic # Mc [2] ORIYA VOWEL SIGN O..ORIYA VOWEL SIGN AU +0B56 ; Other_Alphabetic # Mn ORIYA AI LENGTH MARK +0B57 ; Other_Alphabetic # Mc ORIYA AU LENGTH MARK +0B62..0B63 ; Other_Alphabetic # Mn [2] ORIYA VOWEL SIGN VOCALIC L..ORIYA VOWEL SIGN VOCALIC LL +0B82 ; Other_Alphabetic # Mn TAMIL SIGN ANUSVARA +0BBE..0BBF ; Other_Alphabetic # Mc [2] TAMIL VOWEL SIGN AA..TAMIL VOWEL SIGN I +0BC0 ; Other_Alphabetic # Mn TAMIL VOWEL SIGN II +0BC1..0BC2 ; Other_Alphabetic # Mc [2] TAMIL VOWEL SIGN U..TAMIL VOWEL SIGN UU +0BC6..0BC8 ; Other_Alphabetic # Mc [3] TAMIL VOWEL SIGN E..TAMIL VOWEL SIGN AI +0BCA..0BCC ; Other_Alphabetic # Mc [3] TAMIL VOWEL SIGN O..TAMIL VOWEL SIGN AU +0BD7 ; Other_Alphabetic # Mc TAMIL AU LENGTH MARK +0C01..0C03 ; Other_Alphabetic # Mc [3] TELUGU SIGN CANDRABINDU..TELUGU SIGN VISARGA +0C3E..0C40 ; Other_Alphabetic # Mn [3] TELUGU VOWEL SIGN AA..TELUGU VOWEL SIGN II +0C41..0C44 ; Other_Alphabetic # Mc [4] TELUGU VOWEL SIGN U..TELUGU VOWEL SIGN VOCALIC RR +0C46..0C48 ; Other_Alphabetic # Mn [3] TELUGU VOWEL SIGN E..TELUGU VOWEL SIGN AI +0C4A..0C4C ; Other_Alphabetic # Mn [3] TELUGU VOWEL SIGN O..TELUGU VOWEL SIGN AU +0C55..0C56 ; Other_Alphabetic # Mn [2] TELUGU LENGTH MARK..TELUGU AI LENGTH MARK +0C62..0C63 ; Other_Alphabetic # Mn [2] TELUGU VOWEL SIGN VOCALIC L..TELUGU VOWEL SIGN VOCALIC LL +0C82..0C83 ; Other_Alphabetic # Mc [2] KANNADA SIGN ANUSVARA..KANNADA SIGN VISARGA +0CBE ; Other_Alphabetic # Mc KANNADA VOWEL SIGN AA +0CBF ; Other_Alphabetic # Mn KANNADA VOWEL SIGN I +0CC0..0CC4 ; Other_Alphabetic # Mc [5] KANNADA VOWEL SIGN II..KANNADA VOWEL SIGN VOCALIC RR +0CC6 ; Other_Alphabetic # Mn KANNADA VOWEL SIGN E +0CC7..0CC8 ; Other_Alphabetic # Mc [2] KANNADA VOWEL SIGN EE..KANNADA VOWEL SIGN AI +0CCA..0CCB ; Other_Alphabetic # Mc [2] KANNADA VOWEL SIGN O..KANNADA VOWEL SIGN OO +0CCC ; Other_Alphabetic # Mn KANNADA VOWEL SIGN AU +0CD5..0CD6 ; Other_Alphabetic # Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK +0CE2..0CE3 ; Other_Alphabetic # Mn [2] KANNADA VOWEL SIGN VOCALIC L..KANNADA VOWEL SIGN VOCALIC LL +0D02..0D03 ; Other_Alphabetic # Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA +0D3E..0D40 ; Other_Alphabetic # Mc [3] MALAYALAM VOWEL SIGN AA..MALAYALAM VOWEL SIGN II +0D41..0D44 ; Other_Alphabetic # Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR +0D46..0D48 ; Other_Alphabetic # Mc [3] MALAYALAM VOWEL SIGN E..MALAYALAM VOWEL SIGN AI +0D4A..0D4C ; Other_Alphabetic # Mc [3] MALAYALAM VOWEL SIGN O..MALAYALAM VOWEL SIGN AU +0D57 ; Other_Alphabetic # Mc MALAYALAM AU LENGTH MARK +0D62..0D63 ; Other_Alphabetic # Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL +0D82..0D83 ; Other_Alphabetic # Mc [2] SINHALA SIGN ANUSVARAYA..SINHALA SIGN VISARGAYA +0DCF..0DD1 ; Other_Alphabetic # Mc [3] SINHALA VOWEL SIGN AELA-PILLA..SINHALA VOWEL SIGN DIGA AEDA-PILLA +0DD2..0DD4 ; Other_Alphabetic # Mn [3] SINHALA VOWEL SIGN KETTI IS-PILLA..SINHALA VOWEL SIGN KETTI PAA-PILLA +0DD6 ; Other_Alphabetic # Mn SINHALA VOWEL SIGN DIGA PAA-PILLA +0DD8..0DDF ; Other_Alphabetic # Mc [8] SINHALA VOWEL SIGN GAETTA-PILLA..SINHALA VOWEL SIGN GAYANUKITTA +0DF2..0DF3 ; Other_Alphabetic # Mc [2] SINHALA VOWEL SIGN DIGA GAETTA-PILLA..SINHALA VOWEL SIGN DIGA GAYANUKITTA +0E31 ; Other_Alphabetic # Mn THAI CHARACTER MAI HAN-AKAT +0E34..0E3A ; Other_Alphabetic # Mn [7] THAI CHARACTER SARA I..THAI CHARACTER PHINTHU +0E4D ; Other_Alphabetic # Mn THAI CHARACTER NIKHAHIT +0EB1 ; Other_Alphabetic # Mn LAO VOWEL SIGN MAI KAN +0EB4..0EB9 ; Other_Alphabetic # Mn [6] LAO VOWEL SIGN I..LAO VOWEL SIGN UU +0EBB..0EBC ; Other_Alphabetic # Mn [2] LAO VOWEL SIGN MAI KON..LAO SEMIVOWEL SIGN LO +0ECD ; Other_Alphabetic # Mn LAO NIGGAHITA +0F71..0F7E ; Other_Alphabetic # Mn [14] TIBETAN VOWEL SIGN AA..TIBETAN SIGN RJES SU NGA RO +0F7F ; Other_Alphabetic # Mc TIBETAN SIGN RNAM BCAD +0F80..0F81 ; Other_Alphabetic # Mn [2] TIBETAN VOWEL SIGN REVERSED I..TIBETAN VOWEL SIGN REVERSED II +0F8D..0F97 ; Other_Alphabetic # Mn [11] TIBETAN SUBJOINED SIGN LCE TSA CAN..TIBETAN SUBJOINED LETTER JA +0F99..0FBC ; Other_Alphabetic # Mn [36] TIBETAN SUBJOINED LETTER NYA..TIBETAN SUBJOINED LETTER FIXED-FORM RA +102B..102C ; Other_Alphabetic # Mc [2] MYANMAR VOWEL SIGN TALL AA..MYANMAR VOWEL SIGN AA +102D..1030 ; Other_Alphabetic # Mn [4] MYANMAR VOWEL SIGN I..MYANMAR VOWEL SIGN UU +1031 ; Other_Alphabetic # Mc MYANMAR VOWEL SIGN E +1032..1036 ; Other_Alphabetic # Mn [5] MYANMAR VOWEL SIGN AI..MYANMAR SIGN ANUSVARA +1038 ; Other_Alphabetic # Mc MYANMAR SIGN VISARGA +103B..103C ; Other_Alphabetic # Mc [2] MYANMAR CONSONANT SIGN MEDIAL YA..MYANMAR CONSONANT SIGN MEDIAL RA +103D..103E ; Other_Alphabetic # Mn [2] MYANMAR CONSONANT SIGN MEDIAL WA..MYANMAR CONSONANT SIGN MEDIAL HA +1056..1057 ; Other_Alphabetic # Mc [2] MYANMAR VOWEL SIGN VOCALIC R..MYANMAR VOWEL SIGN VOCALIC RR +1058..1059 ; Other_Alphabetic # Mn [2] MYANMAR VOWEL SIGN VOCALIC L..MYANMAR VOWEL SIGN VOCALIC LL +105E..1060 ; Other_Alphabetic # Mn [3] MYANMAR CONSONANT SIGN MON MEDIAL NA..MYANMAR CONSONANT SIGN MON MEDIAL LA +1062 ; Other_Alphabetic # Mc MYANMAR VOWEL SIGN SGAW KAREN EU +1067..1068 ; Other_Alphabetic # Mc [2] MYANMAR VOWEL SIGN WESTERN PWO KAREN EU..MYANMAR VOWEL SIGN WESTERN PWO KAREN UE +1071..1074 ; Other_Alphabetic # Mn [4] MYANMAR VOWEL SIGN GEBA KAREN I..MYANMAR VOWEL SIGN KAYAH EE +1082 ; Other_Alphabetic # Mn MYANMAR CONSONANT SIGN SHAN MEDIAL WA +1083..1084 ; Other_Alphabetic # Mc [2] MYANMAR VOWEL SIGN SHAN AA..MYANMAR VOWEL SIGN SHAN E +1085..1086 ; Other_Alphabetic # Mn [2] MYANMAR VOWEL SIGN SHAN E ABOVE..MYANMAR VOWEL SIGN SHAN FINAL Y +109C ; Other_Alphabetic # Mc MYANMAR VOWEL SIGN AITON A +109D ; Other_Alphabetic # Mn MYANMAR VOWEL SIGN AITON AI +135F ; Other_Alphabetic # Mn ETHIOPIC COMBINING GEMINATION MARK +1712..1713 ; Other_Alphabetic # Mn [2] TAGALOG VOWEL SIGN I..TAGALOG VOWEL SIGN U +1732..1733 ; Other_Alphabetic # Mn [2] HANUNOO VOWEL SIGN I..HANUNOO VOWEL SIGN U +1752..1753 ; Other_Alphabetic # Mn [2] BUHID VOWEL SIGN I..BUHID VOWEL SIGN U +1772..1773 ; Other_Alphabetic # Mn [2] TAGBANWA VOWEL SIGN I..TAGBANWA VOWEL SIGN U +17B6 ; Other_Alphabetic # Mc KHMER VOWEL SIGN AA +17B7..17BD ; Other_Alphabetic # Mn [7] KHMER VOWEL SIGN I..KHMER VOWEL SIGN UA +17BE..17C5 ; Other_Alphabetic # Mc [8] KHMER VOWEL SIGN OE..KHMER VOWEL SIGN AU +17C6 ; Other_Alphabetic # Mn KHMER SIGN NIKAHIT +17C7..17C8 ; Other_Alphabetic # Mc [2] KHMER SIGN REAHMUK..KHMER SIGN YUUKALEAPINTU +18A9 ; Other_Alphabetic # Mn MONGOLIAN LETTER ALI GALI DAGALGA +1920..1922 ; Other_Alphabetic # Mn [3] LIMBU VOWEL SIGN A..LIMBU VOWEL SIGN U +1923..1926 ; Other_Alphabetic # Mc [4] LIMBU VOWEL SIGN EE..LIMBU VOWEL SIGN AU +1927..1928 ; Other_Alphabetic # Mn [2] LIMBU VOWEL SIGN E..LIMBU VOWEL SIGN O +1929..192B ; Other_Alphabetic # Mc [3] LIMBU SUBJOINED LETTER YA..LIMBU SUBJOINED LETTER WA +1930..1931 ; Other_Alphabetic # Mc [2] LIMBU SMALL LETTER KA..LIMBU SMALL LETTER NGA +1932 ; Other_Alphabetic # Mn LIMBU SMALL LETTER ANUSVARA +1933..1938 ; Other_Alphabetic # Mc [6] LIMBU SMALL LETTER TA..LIMBU SMALL LETTER LA +19B0..19C0 ; Other_Alphabetic # Mc [17] NEW TAI LUE VOWEL SIGN VOWEL SHORTENER..NEW TAI LUE VOWEL SIGN IY +19C8..19C9 ; Other_Alphabetic # Mc [2] NEW TAI LUE TONE MARK-1..NEW TAI LUE TONE MARK-2 +1A17..1A18 ; Other_Alphabetic # Mn [2] BUGINESE VOWEL SIGN I..BUGINESE VOWEL SIGN U +1A19..1A1B ; Other_Alphabetic # Mc [3] BUGINESE VOWEL SIGN E..BUGINESE VOWEL SIGN AE +1A55 ; Other_Alphabetic # Mc TAI THAM CONSONANT SIGN MEDIAL RA +1A56 ; Other_Alphabetic # Mn TAI THAM CONSONANT SIGN MEDIAL LA +1A57 ; Other_Alphabetic # Mc TAI THAM CONSONANT SIGN LA TANG LAI +1A58..1A5E ; Other_Alphabetic # Mn [7] TAI THAM SIGN MAI KANG LAI..TAI THAM CONSONANT SIGN SA +1A61 ; Other_Alphabetic # Mc TAI THAM VOWEL SIGN A +1A62 ; Other_Alphabetic # Mn TAI THAM VOWEL SIGN MAI SAT +1A63..1A64 ; Other_Alphabetic # Mc [2] TAI THAM VOWEL SIGN AA..TAI THAM VOWEL SIGN TALL AA +1A65..1A6C ; Other_Alphabetic # Mn [8] TAI THAM VOWEL SIGN I..TAI THAM VOWEL SIGN OA BELOW +1A6D..1A72 ; Other_Alphabetic # Mc [6] TAI THAM VOWEL SIGN OY..TAI THAM VOWEL SIGN THAM AI +1A73..1A74 ; Other_Alphabetic # Mn [2] TAI THAM VOWEL SIGN OA ABOVE..TAI THAM SIGN MAI KANG +1B00..1B03 ; Other_Alphabetic # Mn [4] BALINESE SIGN ULU RICEM..BALINESE SIGN SURANG +1B04 ; Other_Alphabetic # Mc BALINESE SIGN BISAH +1B35 ; Other_Alphabetic # Mc BALINESE VOWEL SIGN TEDUNG +1B36..1B3A ; Other_Alphabetic # Mn [5] BALINESE VOWEL SIGN ULU..BALINESE VOWEL SIGN RA REPA +1B3B ; Other_Alphabetic # Mc BALINESE VOWEL SIGN RA REPA TEDUNG +1B3C ; Other_Alphabetic # Mn BALINESE VOWEL SIGN LA LENGA +1B3D..1B41 ; Other_Alphabetic # Mc [5] BALINESE VOWEL SIGN LA LENGA TEDUNG..BALINESE VOWEL SIGN TALING REPA TEDUNG +1B42 ; Other_Alphabetic # Mn BALINESE VOWEL SIGN PEPET +1B43 ; Other_Alphabetic # Mc BALINESE VOWEL SIGN PEPET TEDUNG +1B80..1B81 ; Other_Alphabetic # Mn [2] SUNDANESE SIGN PANYECEK..SUNDANESE SIGN PANGLAYAR +1B82 ; Other_Alphabetic # Mc SUNDANESE SIGN PANGWISAD +1BA1 ; Other_Alphabetic # Mc SUNDANESE CONSONANT SIGN PAMINGKAL +1BA2..1BA5 ; Other_Alphabetic # Mn [4] SUNDANESE CONSONANT SIGN PANYAKRA..SUNDANESE VOWEL SIGN PANYUKU +1BA6..1BA7 ; Other_Alphabetic # Mc [2] SUNDANESE VOWEL SIGN PANAELAENG..SUNDANESE VOWEL SIGN PANOLONG +1BA8..1BA9 ; Other_Alphabetic # Mn [2] SUNDANESE VOWEL SIGN PAMEPET..SUNDANESE VOWEL SIGN PANEULEUNG +1BE7 ; Other_Alphabetic # Mc BATAK VOWEL SIGN E +1BE8..1BE9 ; Other_Alphabetic # Mn [2] BATAK VOWEL SIGN PAKPAK E..BATAK VOWEL SIGN EE +1BEA..1BEC ; Other_Alphabetic # Mc [3] BATAK VOWEL SIGN I..BATAK VOWEL SIGN O +1BED ; Other_Alphabetic # Mn BATAK VOWEL SIGN KARO O +1BEE ; Other_Alphabetic # Mc BATAK VOWEL SIGN U +1BEF..1BF1 ; Other_Alphabetic # Mn [3] BATAK VOWEL SIGN U FOR SIMALUNGUN SA..BATAK CONSONANT SIGN H +1C24..1C2B ; Other_Alphabetic # Mc [8] LEPCHA SUBJOINED LETTER YA..LEPCHA VOWEL SIGN UU +1C2C..1C33 ; Other_Alphabetic # Mn [8] LEPCHA VOWEL SIGN E..LEPCHA CONSONANT SIGN T +1C34..1C35 ; Other_Alphabetic # Mc [2] LEPCHA CONSONANT SIGN NYIN-DO..LEPCHA CONSONANT SIGN KANG +1CF2 ; Other_Alphabetic # Mc VEDIC SIGN ARDHAVISARGA +24B6..24E9 ; Other_Alphabetic # So [52] CIRCLED LATIN CAPITAL LETTER A..CIRCLED LATIN SMALL LETTER Z +2DE0..2DFF ; Other_Alphabetic # Mn [32] COMBINING CYRILLIC LETTER BE..COMBINING CYRILLIC LETTER IOTIFIED BIG YUS +A823..A824 ; Other_Alphabetic # Mc [2] SYLOTI NAGRI VOWEL SIGN A..SYLOTI NAGRI VOWEL SIGN I +A825..A826 ; Other_Alphabetic # Mn [2] SYLOTI NAGRI VOWEL SIGN U..SYLOTI NAGRI VOWEL SIGN E +A827 ; Other_Alphabetic # Mc SYLOTI NAGRI VOWEL SIGN OO +A880..A881 ; Other_Alphabetic # Mc [2] SAURASHTRA SIGN ANUSVARA..SAURASHTRA SIGN VISARGA +A8B4..A8C3 ; Other_Alphabetic # Mc [16] SAURASHTRA CONSONANT SIGN HAARU..SAURASHTRA VOWEL SIGN AU +A926..A92A ; Other_Alphabetic # Mn [5] KAYAH LI VOWEL UE..KAYAH LI VOWEL O +A947..A951 ; Other_Alphabetic # Mn [11] REJANG VOWEL SIGN I..REJANG CONSONANT SIGN R +A952 ; Other_Alphabetic # Mc REJANG CONSONANT SIGN H +A980..A982 ; Other_Alphabetic # Mn [3] JAVANESE SIGN PANYANGGA..JAVANESE SIGN LAYAR +A983 ; Other_Alphabetic # Mc JAVANESE SIGN WIGNYAN +A9B4..A9B5 ; Other_Alphabetic # Mc [2] JAVANESE VOWEL SIGN TARUNG..JAVANESE VOWEL SIGN TOLONG +A9B6..A9B9 ; Other_Alphabetic # Mn [4] JAVANESE VOWEL SIGN WULU..JAVANESE VOWEL SIGN SUKU MENDUT +A9BA..A9BB ; Other_Alphabetic # Mc [2] JAVANESE VOWEL SIGN TALING..JAVANESE VOWEL SIGN DIRGA MURE +A9BC ; Other_Alphabetic # Mn JAVANESE VOWEL SIGN PEPET +A9BD..A9BF ; Other_Alphabetic # Mc [3] JAVANESE CONSONANT SIGN KERET..JAVANESE CONSONANT SIGN CAKRA +AA29..AA2E ; Other_Alphabetic # Mn [6] CHAM VOWEL SIGN AA..CHAM VOWEL SIGN OE +AA2F..AA30 ; Other_Alphabetic # Mc [2] CHAM VOWEL SIGN O..CHAM VOWEL SIGN AI +AA31..AA32 ; Other_Alphabetic # Mn [2] CHAM VOWEL SIGN AU..CHAM VOWEL SIGN UE +AA33..AA34 ; Other_Alphabetic # Mc [2] CHAM CONSONANT SIGN YA..CHAM CONSONANT SIGN RA +AA35..AA36 ; Other_Alphabetic # Mn [2] CHAM CONSONANT SIGN LA..CHAM CONSONANT SIGN WA +AA43 ; Other_Alphabetic # Mn CHAM CONSONANT SIGN FINAL NG +AA4C ; Other_Alphabetic # Mn CHAM CONSONANT SIGN FINAL M +AA4D ; Other_Alphabetic # Mc CHAM CONSONANT SIGN FINAL H +AAB0 ; Other_Alphabetic # Mn TAI VIET MAI KANG +AAB2..AAB4 ; Other_Alphabetic # Mn [3] TAI VIET VOWEL I..TAI VIET VOWEL U +AAB7..AAB8 ; Other_Alphabetic # Mn [2] TAI VIET MAI KHIT..TAI VIET VOWEL IA +AABE ; Other_Alphabetic # Mn TAI VIET VOWEL AM +ABE3..ABE4 ; Other_Alphabetic # Mc [2] MEETEI MAYEK VOWEL SIGN ONAP..MEETEI MAYEK VOWEL SIGN INAP +ABE5 ; Other_Alphabetic # Mn MEETEI MAYEK VOWEL SIGN ANAP +ABE6..ABE7 ; Other_Alphabetic # Mc [2] MEETEI MAYEK VOWEL SIGN YENAP..MEETEI MAYEK VOWEL SIGN SOUNAP +ABE8 ; Other_Alphabetic # Mn MEETEI MAYEK VOWEL SIGN UNAP +ABE9..ABEA ; Other_Alphabetic # Mc [2] MEETEI MAYEK VOWEL SIGN CHEINAP..MEETEI MAYEK VOWEL SIGN NUNG +FB1E ; Other_Alphabetic # Mn HEBREW POINT JUDEO-SPANISH VARIKA +10A01..10A03 ; Other_Alphabetic # Mn [3] KHAROSHTHI VOWEL SIGN I..KHAROSHTHI VOWEL SIGN VOCALIC R +10A05..10A06 ; Other_Alphabetic # Mn [2] KHAROSHTHI VOWEL SIGN E..KHAROSHTHI VOWEL SIGN O +10A0C..10A0F ; Other_Alphabetic # Mn [4] KHAROSHTHI VOWEL LENGTH MARK..KHAROSHTHI SIGN VISARGA +11000 ; Other_Alphabetic # Mc BRAHMI SIGN CANDRABINDU +11001 ; Other_Alphabetic # Mn BRAHMI SIGN ANUSVARA +11002 ; Other_Alphabetic # Mc BRAHMI SIGN VISARGA +11038..11045 ; Other_Alphabetic # Mn [14] BRAHMI VOWEL SIGN AA..BRAHMI VOWEL SIGN AU +11082 ; Other_Alphabetic # Mc KAITHI SIGN VISARGA +110B0..110B2 ; Other_Alphabetic # Mc [3] KAITHI VOWEL SIGN AA..KAITHI VOWEL SIGN II +110B3..110B6 ; Other_Alphabetic # Mn [4] KAITHI VOWEL SIGN U..KAITHI VOWEL SIGN AI +110B7..110B8 ; Other_Alphabetic # Mc [2] KAITHI VOWEL SIGN O..KAITHI VOWEL SIGN AU + +# Total code points: 795 + +# ================================================ + +3006 ; Ideographic # Lo IDEOGRAPHIC CLOSING MARK +3007 ; Ideographic # Nl IDEOGRAPHIC NUMBER ZERO +3021..3029 ; Ideographic # Nl [9] HANGZHOU NUMERAL ONE..HANGZHOU NUMERAL NINE +3038..303A ; Ideographic # Nl [3] HANGZHOU NUMERAL TEN..HANGZHOU NUMERAL THIRTY +3400..4DB5 ; Ideographic # Lo [6582] CJK UNIFIED IDEOGRAPH-3400..CJK UNIFIED IDEOGRAPH-4DB5 +4E00..9FCB ; Ideographic # Lo [20940] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FCB +F900..FA2D ; Ideographic # Lo [302] CJK COMPATIBILITY IDEOGRAPH-F900..CJK COMPATIBILITY IDEOGRAPH-FA2D +FA30..FA6D ; Ideographic # Lo [62] CJK COMPATIBILITY IDEOGRAPH-FA30..CJK COMPATIBILITY IDEOGRAPH-FA6D +FA70..FAD9 ; Ideographic # Lo [106] CJK COMPATIBILITY IDEOGRAPH-FA70..CJK COMPATIBILITY IDEOGRAPH-FAD9 +20000..2A6D6 ; Ideographic # Lo [42711] CJK UNIFIED IDEOGRAPH-20000..CJK UNIFIED IDEOGRAPH-2A6D6 +2A700..2B734 ; Ideographic # Lo [4149] CJK UNIFIED IDEOGRAPH-2A700..CJK UNIFIED IDEOGRAPH-2B734 +2B740..2B81D ; Ideographic # Lo [222] CJK UNIFIED IDEOGRAPH-2B740..CJK UNIFIED IDEOGRAPH-2B81D +2F800..2FA1D ; Ideographic # Lo [542] CJK COMPATIBILITY IDEOGRAPH-2F800..CJK COMPATIBILITY IDEOGRAPH-2FA1D + +# Total code points: 75630 + +# ================================================ + +005E ; Diacritic # Sk CIRCUMFLEX ACCENT +0060 ; Diacritic # Sk GRAVE ACCENT +00A8 ; Diacritic # Sk DIAERESIS +00AF ; Diacritic # Sk MACRON +00B4 ; Diacritic # Sk ACUTE ACCENT +00B7 ; Diacritic # Po MIDDLE DOT +00B8 ; Diacritic # Sk CEDILLA +02B0..02C1 ; Diacritic # Lm [18] MODIFIER LETTER SMALL H..MODIFIER LETTER REVERSED GLOTTAL STOP +02C2..02C5 ; Diacritic # Sk [4] MODIFIER LETTER LEFT ARROWHEAD..MODIFIER LETTER DOWN ARROWHEAD +02C6..02D1 ; Diacritic # Lm [12] MODIFIER LETTER CIRCUMFLEX ACCENT..MODIFIER LETTER HALF TRIANGULAR COLON +02D2..02DF ; Diacritic # Sk [14] MODIFIER LETTER CENTRED RIGHT HALF RING..MODIFIER LETTER CROSS ACCENT +02E0..02E4 ; Diacritic # Lm [5] MODIFIER LETTER SMALL GAMMA..MODIFIER LETTER SMALL REVERSED GLOTTAL STOP +02E5..02EB ; Diacritic # Sk [7] MODIFIER LETTER EXTRA-HIGH TONE BAR..MODIFIER LETTER YANG DEPARTING TONE MARK +02EC ; Diacritic # Lm MODIFIER LETTER VOICING +02ED ; Diacritic # Sk MODIFIER LETTER UNASPIRATED +02EE ; Diacritic # Lm MODIFIER LETTER DOUBLE APOSTROPHE +02EF..02FF ; Diacritic # Sk [17] MODIFIER LETTER LOW DOWN ARROWHEAD..MODIFIER LETTER LOW LEFT ARROW +0300..034E ; Diacritic # Mn [79] COMBINING GRAVE ACCENT..COMBINING UPWARDS ARROW BELOW +0350..0357 ; Diacritic # Mn [8] COMBINING RIGHT ARROWHEAD ABOVE..COMBINING RIGHT HALF RING ABOVE +035D..0362 ; Diacritic # Mn [6] COMBINING DOUBLE BREVE..COMBINING DOUBLE RIGHTWARDS ARROW BELOW +0374 ; Diacritic # Lm GREEK NUMERAL SIGN +0375 ; Diacritic # Sk GREEK LOWER NUMERAL SIGN +037A ; Diacritic # Lm GREEK YPOGEGRAMMENI +0384..0385 ; Diacritic # Sk [2] GREEK TONOS..GREEK DIALYTIKA TONOS +0483..0487 ; Diacritic # Mn [5] COMBINING CYRILLIC TITLO..COMBINING CYRILLIC POKRYTIE +0559 ; Diacritic # Lm ARMENIAN MODIFIER LETTER LEFT HALF RING +0591..05A1 ; Diacritic # Mn [17] HEBREW ACCENT ETNAHTA..HEBREW ACCENT PAZER +05A3..05BD ; Diacritic # Mn [27] HEBREW ACCENT MUNAH..HEBREW POINT METEG +05BF ; Diacritic # Mn HEBREW POINT RAFE +05C1..05C2 ; Diacritic # Mn [2] HEBREW POINT SHIN DOT..HEBREW POINT SIN DOT +05C4 ; Diacritic # Mn HEBREW MARK UPPER DOT +064B..0652 ; Diacritic # Mn [8] ARABIC FATHATAN..ARABIC SUKUN +0657..0658 ; Diacritic # Mn [2] ARABIC INVERTED DAMMA..ARABIC MARK NOON GHUNNA +06DF..06E0 ; Diacritic # Mn [2] ARABIC SMALL HIGH ROUNDED ZERO..ARABIC SMALL HIGH UPRIGHT RECTANGULAR ZERO +06E5..06E6 ; Diacritic # Lm [2] ARABIC SMALL WAW..ARABIC SMALL YEH +06EA..06EC ; Diacritic # Mn [3] ARABIC EMPTY CENTRE LOW STOP..ARABIC ROUNDED HIGH STOP WITH FILLED CENTRE +0730..074A ; Diacritic # Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH +07A6..07B0 ; Diacritic # Mn [11] THAANA ABAFILI..THAANA SUKUN +07EB..07F3 ; Diacritic # Mn [9] NKO COMBINING SHORT HIGH TONE..NKO COMBINING DOUBLE DOT ABOVE +07F4..07F5 ; Diacritic # Lm [2] NKO HIGH TONE APOSTROPHE..NKO LOW TONE APOSTROPHE +0818..0819 ; Diacritic # Mn [2] SAMARITAN MARK OCCLUSION..SAMARITAN MARK DAGESH +093C ; Diacritic # Mn DEVANAGARI SIGN NUKTA +094D ; Diacritic # Mn DEVANAGARI SIGN VIRAMA +0951..0954 ; Diacritic # Mn [4] DEVANAGARI STRESS SIGN UDATTA..DEVANAGARI ACUTE ACCENT +0971 ; Diacritic # Lm DEVANAGARI SIGN HIGH SPACING DOT +09BC ; Diacritic # Mn BENGALI SIGN NUKTA +09CD ; Diacritic # Mn BENGALI SIGN VIRAMA +0A3C ; Diacritic # Mn GURMUKHI SIGN NUKTA +0A4D ; Diacritic # Mn GURMUKHI SIGN VIRAMA +0ABC ; Diacritic # Mn GUJARATI SIGN NUKTA +0ACD ; Diacritic # Mn GUJARATI SIGN VIRAMA +0B3C ; Diacritic # Mn ORIYA SIGN NUKTA +0B4D ; Diacritic # Mn ORIYA SIGN VIRAMA +0BCD ; Diacritic # Mn TAMIL SIGN VIRAMA +0C4D ; Diacritic # Mn TELUGU SIGN VIRAMA +0CBC ; Diacritic # Mn KANNADA SIGN NUKTA +0CCD ; Diacritic # Mn KANNADA SIGN VIRAMA +0D4D ; Diacritic # Mn MALAYALAM SIGN VIRAMA +0DCA ; Diacritic # Mn SINHALA SIGN AL-LAKUNA +0E47..0E4C ; Diacritic # Mn [6] THAI CHARACTER MAITAIKHU..THAI CHARACTER THANTHAKHAT +0E4E ; Diacritic # Mn THAI CHARACTER YAMAKKAN +0EC8..0ECC ; Diacritic # Mn [5] LAO TONE MAI EK..LAO CANCELLATION MARK +0F18..0F19 ; Diacritic # Mn [2] TIBETAN ASTROLOGICAL SIGN -KHYUD PA..TIBETAN ASTROLOGICAL SIGN SDONG TSHUGS +0F35 ; Diacritic # Mn TIBETAN MARK NGAS BZUNG NYI ZLA +0F37 ; Diacritic # Mn TIBETAN MARK NGAS BZUNG SGOR RTAGS +0F39 ; Diacritic # Mn TIBETAN MARK TSA -PHRU +0F3E..0F3F ; Diacritic # Mc [2] TIBETAN SIGN YAR TSHES..TIBETAN SIGN MAR TSHES +0F82..0F84 ; Diacritic # Mn [3] TIBETAN SIGN NYI ZLA NAA DA..TIBETAN MARK HALANTA +0F86..0F87 ; Diacritic # Mn [2] TIBETAN SIGN LCI RTAGS..TIBETAN SIGN YANG RTAGS +0FC6 ; Diacritic # Mn TIBETAN SYMBOL PADMA GDAN +1037 ; Diacritic # Mn MYANMAR SIGN DOT BELOW +1039..103A ; Diacritic # Mn [2] MYANMAR SIGN VIRAMA..MYANMAR SIGN ASAT +1087..108C ; Diacritic # Mc [6] MYANMAR SIGN SHAN TONE-2..MYANMAR SIGN SHAN COUNCIL TONE-3 +108D ; Diacritic # Mn MYANMAR SIGN SHAN COUNCIL EMPHATIC TONE +108F ; Diacritic # Mc MYANMAR SIGN RUMAI PALAUNG TONE-5 +109A..109B ; Diacritic # Mc [2] MYANMAR SIGN KHAMTI TONE-1..MYANMAR SIGN KHAMTI TONE-3 +17C9..17D3 ; Diacritic # Mn [11] KHMER SIGN MUUSIKATOAN..KHMER SIGN BATHAMASAT +17DD ; Diacritic # Mn KHMER SIGN ATTHACAN +1939..193B ; Diacritic # Mn [3] LIMBU SIGN MUKPHRENG..LIMBU SIGN SA-I +1A75..1A7C ; Diacritic # Mn [8] TAI THAM SIGN TONE-1..TAI THAM SIGN KHUEN-LUE KARAN +1A7F ; Diacritic # Mn TAI THAM COMBINING CRYPTOGRAMMIC DOT +1B34 ; Diacritic # Mn BALINESE SIGN REREKAN +1B44 ; Diacritic # Mc BALINESE ADEG ADEG +1B6B..1B73 ; Diacritic # Mn [9] BALINESE MUSICAL SYMBOL COMBINING TEGEH..BALINESE MUSICAL SYMBOL COMBINING GONG +1BAA ; Diacritic # Mc SUNDANESE SIGN PAMAAEH +1C36..1C37 ; Diacritic # Mn [2] LEPCHA SIGN RAN..LEPCHA SIGN NUKTA +1C78..1C7D ; Diacritic # Lm [6] OL CHIKI MU TTUDDAG..OL CHIKI AHAD +1CD0..1CD2 ; Diacritic # Mn [3] VEDIC TONE KARSHANA..VEDIC TONE PRENKHA +1CD3 ; Diacritic # Po VEDIC SIGN NIHSHVASA +1CD4..1CE0 ; Diacritic # Mn [13] VEDIC SIGN YAJURVEDIC MIDLINE SVARITA..VEDIC TONE RIGVEDIC KASHMIRI INDEPENDENT SVARITA +1CE1 ; Diacritic # Mc VEDIC TONE ATHARVAVEDIC INDEPENDENT SVARITA +1CE2..1CE8 ; Diacritic # Mn [7] VEDIC SIGN VISARGA SVARITA..VEDIC SIGN VISARGA ANUDATTA WITH TAIL +1CED ; Diacritic # Mn VEDIC SIGN TIRYAK +1D2C..1D61 ; Diacritic # Lm [54] MODIFIER LETTER CAPITAL A..MODIFIER LETTER SMALL CHI +1D62..1D6A ; Diacritic # L& [9] LATIN SUBSCRIPT SMALL LETTER I..GREEK SUBSCRIPT SMALL LETTER CHI +1DC4..1DCF ; Diacritic # Mn [12] COMBINING MACRON-ACUTE..COMBINING ZIGZAG BELOW +1DFD..1DFF ; Diacritic # Mn [3] COMBINING ALMOST EQUAL TO BELOW..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW +1FBD ; Diacritic # Sk GREEK KORONIS +1FBF..1FC1 ; Diacritic # Sk [3] GREEK PSILI..GREEK DIALYTIKA AND PERISPOMENI +1FCD..1FCF ; Diacritic # Sk [3] GREEK PSILI AND VARIA..GREEK PSILI AND PERISPOMENI +1FDD..1FDF ; Diacritic # Sk [3] GREEK DASIA AND VARIA..GREEK DASIA AND PERISPOMENI +1FED..1FEF ; Diacritic # Sk [3] GREEK DIALYTIKA AND VARIA..GREEK VARIA +1FFD..1FFE ; Diacritic # Sk [2] GREEK OXIA..GREEK DASIA +2CEF..2CF1 ; Diacritic # Mn [3] COPTIC COMBINING NI ABOVE..COPTIC COMBINING SPIRITUS LENIS +2E2F ; Diacritic # Lm VERTICAL TILDE +302A..302F ; Diacritic # Mn [6] IDEOGRAPHIC LEVEL TONE MARK..HANGUL DOUBLE DOT TONE MARK +3099..309A ; Diacritic # Mn [2] COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK..COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK +309B..309C ; Diacritic # Sk [2] KATAKANA-HIRAGANA VOICED SOUND MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK +30FC ; Diacritic # Lm KATAKANA-HIRAGANA PROLONGED SOUND MARK +A66F ; Diacritic # Mn COMBINING CYRILLIC VZMET +A67C..A67D ; Diacritic # Mn [2] COMBINING CYRILLIC KAVYKA..COMBINING CYRILLIC PAYEROK +A67F ; Diacritic # Lm CYRILLIC PAYEROK +A6F0..A6F1 ; Diacritic # Mn [2] BAMUM COMBINING MARK KOQNDON..BAMUM COMBINING MARK TUKWENTIS +A717..A71F ; Diacritic # Lm [9] MODIFIER LETTER DOT VERTICAL BAR..MODIFIER LETTER LOW INVERTED EXCLAMATION MARK +A720..A721 ; Diacritic # Sk [2] MODIFIER LETTER STRESS AND HIGH TONE..MODIFIER LETTER STRESS AND LOW TONE +A788 ; Diacritic # Lm MODIFIER LETTER LOW CIRCUMFLEX ACCENT +A8C4 ; Diacritic # Mn SAURASHTRA SIGN VIRAMA +A8E0..A8F1 ; Diacritic # Mn [18] COMBINING DEVANAGARI DIGIT ZERO..COMBINING DEVANAGARI SIGN AVAGRAHA +A92B..A92D ; Diacritic # Mn [3] KAYAH LI TONE PLOPHU..KAYAH LI TONE CALYA PLOPHU +A92E ; Diacritic # Po KAYAH LI SIGN CWI +A953 ; Diacritic # Mc REJANG VIRAMA +A9B3 ; Diacritic # Mn JAVANESE SIGN CECAK TELU +A9C0 ; Diacritic # Mc JAVANESE PANGKON +AA7B ; Diacritic # Mc MYANMAR SIGN PAO KAREN TONE +AABF ; Diacritic # Mn TAI VIET TONE MAI EK +AAC0 ; Diacritic # Lo TAI VIET TONE MAI NUENG +AAC1 ; Diacritic # Mn TAI VIET TONE MAI THO +AAC2 ; Diacritic # Lo TAI VIET TONE MAI SONG +ABEC ; Diacritic # Mc MEETEI MAYEK LUM IYEK +ABED ; Diacritic # Mn MEETEI MAYEK APUN IYEK +FB1E ; Diacritic # Mn HEBREW POINT JUDEO-SPANISH VARIKA +FE20..FE26 ; Diacritic # Mn [7] COMBINING LIGATURE LEFT HALF..COMBINING CONJOINING MACRON +FF3E ; Diacritic # Sk FULLWIDTH CIRCUMFLEX ACCENT +FF40 ; Diacritic # Sk FULLWIDTH GRAVE ACCENT +FF70 ; Diacritic # Lm HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK +FF9E..FF9F ; Diacritic # Lm [2] HALFWIDTH KATAKANA VOICED SOUND MARK..HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK +FFE3 ; Diacritic # Sk FULLWIDTH MACRON +110B9..110BA ; Diacritic # Mn [2] KAITHI SIGN VIRAMA..KAITHI SIGN NUKTA +1D167..1D169 ; Diacritic # Mn [3] MUSICAL SYMBOL COMBINING TREMOLO-1..MUSICAL SYMBOL COMBINING TREMOLO-3 +1D16D..1D172 ; Diacritic # Mc [6] MUSICAL SYMBOL COMBINING AUGMENTATION DOT..MUSICAL SYMBOL COMBINING FLAG-5 +1D17B..1D182 ; Diacritic # Mn [8] MUSICAL SYMBOL COMBINING ACCENT..MUSICAL SYMBOL COMBINING LOURE +1D185..1D18B ; Diacritic # Mn [7] MUSICAL SYMBOL COMBINING DOIT..MUSICAL SYMBOL COMBINING TRIPLE TONGUE +1D1AA..1D1AD ; Diacritic # Mn [4] MUSICAL SYMBOL COMBINING DOWN BOW..MUSICAL SYMBOL COMBINING SNAP PIZZICATO + +# Total code points: 639 + +# ================================================ + +00B7 ; Extender # Po MIDDLE DOT +02D0..02D1 ; Extender # Lm [2] MODIFIER LETTER TRIANGULAR COLON..MODIFIER LETTER HALF TRIANGULAR COLON +0640 ; Extender # Lm ARABIC TATWEEL +07FA ; Extender # Lm NKO LAJANYALAN +0E46 ; Extender # Lm THAI CHARACTER MAIYAMOK +0EC6 ; Extender # Lm LAO KO LA +1843 ; Extender # Lm MONGOLIAN LETTER TODO LONG VOWEL SIGN +1AA7 ; Extender # Lm TAI THAM SIGN MAI YAMOK +1C36 ; Extender # Mn LEPCHA SIGN RAN +1C7B ; Extender # Lm OL CHIKI RELAA +3005 ; Extender # Lm IDEOGRAPHIC ITERATION MARK +3031..3035 ; Extender # Lm [5] VERTICAL KANA REPEAT MARK..VERTICAL KANA REPEAT MARK LOWER HALF +309D..309E ; Extender # Lm [2] HIRAGANA ITERATION MARK..HIRAGANA VOICED ITERATION MARK +30FC..30FE ; Extender # Lm [3] KATAKANA-HIRAGANA PROLONGED SOUND MARK..KATAKANA VOICED ITERATION MARK +A015 ; Extender # Lm YI SYLLABLE WU +A60C ; Extender # Lm VAI SYLLABLE LENGTHENER +A9CF ; Extender # Lm JAVANESE PANGRANGKEP +AA70 ; Extender # Lm MYANMAR MODIFIER LETTER KHAMTI REDUPLICATION +AADD ; Extender # Lm TAI VIET SYMBOL SAM +FF70 ; Extender # Lm HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK + +# Total code points: 28 + +# ================================================ + +02B0..02B8 ; Other_Lowercase # Lm [9] MODIFIER LETTER SMALL H..MODIFIER LETTER SMALL Y +02C0..02C1 ; Other_Lowercase # Lm [2] MODIFIER LETTER GLOTTAL STOP..MODIFIER LETTER REVERSED GLOTTAL STOP +02E0..02E4 ; Other_Lowercase # Lm [5] MODIFIER LETTER SMALL GAMMA..MODIFIER LETTER SMALL REVERSED GLOTTAL STOP +0345 ; Other_Lowercase # Mn COMBINING GREEK YPOGEGRAMMENI +037A ; Other_Lowercase # Lm GREEK YPOGEGRAMMENI +1D2C..1D61 ; Other_Lowercase # Lm [54] MODIFIER LETTER CAPITAL A..MODIFIER LETTER SMALL CHI +1D78 ; Other_Lowercase # Lm MODIFIER LETTER CYRILLIC EN +1D9B..1DBF ; Other_Lowercase # Lm [37] MODIFIER LETTER SMALL TURNED ALPHA..MODIFIER LETTER SMALL THETA +2090..2094 ; Other_Lowercase # Lm [5] LATIN SUBSCRIPT SMALL LETTER A..LATIN SUBSCRIPT SMALL LETTER SCHWA +2170..217F ; Other_Lowercase # Nl [16] SMALL ROMAN NUMERAL ONE..SMALL ROMAN NUMERAL ONE THOUSAND +24D0..24E9 ; Other_Lowercase # So [26] CIRCLED LATIN SMALL LETTER A..CIRCLED LATIN SMALL LETTER Z +2C7D ; Other_Lowercase # Lm MODIFIER LETTER CAPITAL V +A770 ; Other_Lowercase # Lm MODIFIER LETTER US + +# Total code points: 159 + +# ================================================ + +2160..216F ; Other_Uppercase # Nl [16] ROMAN NUMERAL ONE..ROMAN NUMERAL ONE THOUSAND +24B6..24CF ; Other_Uppercase # So [26] CIRCLED LATIN CAPITAL LETTER A..CIRCLED LATIN CAPITAL LETTER Z + +# Total code points: 42 + +# ================================================ + +FDD0..FDEF ; Noncharacter_Code_Point # Cn [32] .. +FFFE..FFFF ; Noncharacter_Code_Point # Cn [2] .. +1FFFE..1FFFF ; Noncharacter_Code_Point # Cn [2] .. +2FFFE..2FFFF ; Noncharacter_Code_Point # Cn [2] .. +3FFFE..3FFFF ; Noncharacter_Code_Point # Cn [2] .. +4FFFE..4FFFF ; Noncharacter_Code_Point # Cn [2] .. +5FFFE..5FFFF ; Noncharacter_Code_Point # Cn [2] .. +6FFFE..6FFFF ; Noncharacter_Code_Point # Cn [2] .. +7FFFE..7FFFF ; Noncharacter_Code_Point # Cn [2] .. +8FFFE..8FFFF ; Noncharacter_Code_Point # Cn [2] .. +9FFFE..9FFFF ; Noncharacter_Code_Point # Cn [2] .. +AFFFE..AFFFF ; Noncharacter_Code_Point # Cn [2] .. +BFFFE..BFFFF ; Noncharacter_Code_Point # Cn [2] .. +CFFFE..CFFFF ; Noncharacter_Code_Point # Cn [2] .. +DFFFE..DFFFF ; Noncharacter_Code_Point # Cn [2] .. +EFFFE..EFFFF ; Noncharacter_Code_Point # Cn [2] .. +FFFFE..FFFFF ; Noncharacter_Code_Point # Cn [2] .. +10FFFE..10FFFF; Noncharacter_Code_Point # Cn [2] .. + +# Total code points: 66 + +# ================================================ + +09BE ; Other_Grapheme_Extend # Mc BENGALI VOWEL SIGN AA +09D7 ; Other_Grapheme_Extend # Mc BENGALI AU LENGTH MARK +0B3E ; Other_Grapheme_Extend # Mc ORIYA VOWEL SIGN AA +0B57 ; Other_Grapheme_Extend # Mc ORIYA AU LENGTH MARK +0BBE ; Other_Grapheme_Extend # Mc TAMIL VOWEL SIGN AA +0BD7 ; Other_Grapheme_Extend # Mc TAMIL AU LENGTH MARK +0CC2 ; Other_Grapheme_Extend # Mc KANNADA VOWEL SIGN UU +0CD5..0CD6 ; Other_Grapheme_Extend # Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK +0D3E ; Other_Grapheme_Extend # Mc MALAYALAM VOWEL SIGN AA +0D57 ; Other_Grapheme_Extend # Mc MALAYALAM AU LENGTH MARK +0DCF ; Other_Grapheme_Extend # Mc SINHALA VOWEL SIGN AELA-PILLA +0DDF ; Other_Grapheme_Extend # Mc SINHALA VOWEL SIGN GAYANUKITTA +200C..200D ; Other_Grapheme_Extend # Cf [2] ZERO WIDTH NON-JOINER..ZERO WIDTH JOINER +FF9E..FF9F ; Other_Grapheme_Extend # Lm [2] HALFWIDTH KATAKANA VOICED SOUND MARK..HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK +1D165 ; Other_Grapheme_Extend # Mc MUSICAL SYMBOL COMBINING STEM +1D16E..1D172 ; Other_Grapheme_Extend # Mc [5] MUSICAL SYMBOL COMBINING FLAG-1..MUSICAL SYMBOL COMBINING FLAG-5 + +# Total code points: 23 + +# ================================================ + +2FF0..2FF1 ; IDS_Binary_Operator # So [2] IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO RIGHT..IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO BELOW +2FF4..2FFB ; IDS_Binary_Operator # So [8] IDEOGRAPHIC DESCRIPTION CHARACTER FULL SURROUND..IDEOGRAPHIC DESCRIPTION CHARACTER OVERLAID + +# Total code points: 10 + +# ================================================ + +2FF2..2FF3 ; IDS_Trinary_Operator # So [2] IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO MIDDLE AND RIGHT..IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO MIDDLE AND BELOW + +# Total code points: 2 + +# ================================================ + +2E80..2E99 ; Radical # So [26] CJK RADICAL REPEAT..CJK RADICAL RAP +2E9B..2EF3 ; Radical # So [89] CJK RADICAL CHOKE..CJK RADICAL C-SIMPLIFIED TURTLE +2F00..2FD5 ; Radical # So [214] KANGXI RADICAL ONE..KANGXI RADICAL FLUTE + +# Total code points: 329 + +# ================================================ + +3400..4DB5 ; Unified_Ideograph # Lo [6582] CJK UNIFIED IDEOGRAPH-3400..CJK UNIFIED IDEOGRAPH-4DB5 +4E00..9FCB ; Unified_Ideograph # Lo [20940] CJK UNIFIED IDEOGRAPH-4E00..CJK UNIFIED IDEOGRAPH-9FCB +FA0E..FA0F ; Unified_Ideograph # Lo [2] CJK COMPATIBILITY IDEOGRAPH-FA0E..CJK COMPATIBILITY IDEOGRAPH-FA0F +FA11 ; Unified_Ideograph # Lo CJK COMPATIBILITY IDEOGRAPH-FA11 +FA13..FA14 ; Unified_Ideograph # Lo [2] CJK COMPATIBILITY IDEOGRAPH-FA13..CJK COMPATIBILITY IDEOGRAPH-FA14 +FA1F ; Unified_Ideograph # Lo CJK COMPATIBILITY IDEOGRAPH-FA1F +FA21 ; Unified_Ideograph # Lo CJK COMPATIBILITY IDEOGRAPH-FA21 +FA23..FA24 ; Unified_Ideograph # Lo [2] CJK COMPATIBILITY IDEOGRAPH-FA23..CJK COMPATIBILITY IDEOGRAPH-FA24 +FA27..FA29 ; Unified_Ideograph # Lo [3] CJK COMPATIBILITY IDEOGRAPH-FA27..CJK COMPATIBILITY IDEOGRAPH-FA29 +20000..2A6D6 ; Unified_Ideograph # Lo [42711] CJK UNIFIED IDEOGRAPH-20000..CJK UNIFIED IDEOGRAPH-2A6D6 +2A700..2B734 ; Unified_Ideograph # Lo [4149] CJK UNIFIED IDEOGRAPH-2A700..CJK UNIFIED IDEOGRAPH-2B734 +2B740..2B81D ; Unified_Ideograph # Lo [222] CJK UNIFIED IDEOGRAPH-2B740..CJK UNIFIED IDEOGRAPH-2B81D + +# Total code points: 74616 + +# ================================================ + +034F ; Other_Default_Ignorable_Code_Point # Mn COMBINING GRAPHEME JOINER +115F..1160 ; Other_Default_Ignorable_Code_Point # Lo [2] HANGUL CHOSEONG FILLER..HANGUL JUNGSEONG FILLER +2065..2069 ; Other_Default_Ignorable_Code_Point # Cn [5] .. +3164 ; Other_Default_Ignorable_Code_Point # Lo HANGUL FILLER +FFA0 ; Other_Default_Ignorable_Code_Point # Lo HALFWIDTH HANGUL FILLER +FFF0..FFF8 ; Other_Default_Ignorable_Code_Point # Cn [9] .. +E0000 ; Other_Default_Ignorable_Code_Point # Cn +E0002..E001F ; Other_Default_Ignorable_Code_Point # Cn [30] .. +E0080..E00FF ; Other_Default_Ignorable_Code_Point # Cn [128] .. +E01F0..E0FFF ; Other_Default_Ignorable_Code_Point # Cn [3600] .. + +# Total code points: 3778 + +# ================================================ + +0149 ; Deprecated # L& LATIN SMALL LETTER N PRECEDED BY APOSTROPHE +0673 ; Deprecated # Lo ARABIC LETTER ALEF WITH WAVY HAMZA BELOW +0F77 ; Deprecated # Mn TIBETAN VOWEL SIGN VOCALIC RR +0F79 ; Deprecated # Mn TIBETAN VOWEL SIGN VOCALIC LL +17A3..17A4 ; Deprecated # Lo [2] KHMER INDEPENDENT VOWEL QAQ..KHMER INDEPENDENT VOWEL QAA +206A..206F ; Deprecated # Cf [6] INHIBIT SYMMETRIC SWAPPING..NOMINAL DIGIT SHAPES +2329 ; Deprecated # Ps LEFT-POINTING ANGLE BRACKET +232A ; Deprecated # Pe RIGHT-POINTING ANGLE BRACKET +E0001 ; Deprecated # Cf LANGUAGE TAG +E0020..E007F ; Deprecated # Cf [96] TAG SPACE..CANCEL TAG + +# Total code points: 111 + +# ================================================ + +0069..006A ; Soft_Dotted # L& [2] LATIN SMALL LETTER I..LATIN SMALL LETTER J +012F ; Soft_Dotted # L& LATIN SMALL LETTER I WITH OGONEK +0249 ; Soft_Dotted # L& LATIN SMALL LETTER J WITH STROKE +0268 ; Soft_Dotted # L& LATIN SMALL LETTER I WITH STROKE +029D ; Soft_Dotted # L& LATIN SMALL LETTER J WITH CROSSED-TAIL +02B2 ; Soft_Dotted # Lm MODIFIER LETTER SMALL J +03F3 ; Soft_Dotted # L& GREEK LETTER YOT +0456 ; Soft_Dotted # L& CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I +0458 ; Soft_Dotted # L& CYRILLIC SMALL LETTER JE +1D62 ; Soft_Dotted # L& LATIN SUBSCRIPT SMALL LETTER I +1D96 ; Soft_Dotted # L& LATIN SMALL LETTER I WITH RETROFLEX HOOK +1DA4 ; Soft_Dotted # Lm MODIFIER LETTER SMALL I WITH STROKE +1DA8 ; Soft_Dotted # Lm MODIFIER LETTER SMALL J WITH CROSSED-TAIL +1E2D ; Soft_Dotted # L& LATIN SMALL LETTER I WITH TILDE BELOW +1ECB ; Soft_Dotted # L& LATIN SMALL LETTER I WITH DOT BELOW +2071 ; Soft_Dotted # Lm SUPERSCRIPT LATIN SMALL LETTER I +2148..2149 ; Soft_Dotted # L& [2] DOUBLE-STRUCK ITALIC SMALL I..DOUBLE-STRUCK ITALIC SMALL J +2C7C ; Soft_Dotted # L& LATIN SUBSCRIPT SMALL LETTER J +1D422..1D423 ; Soft_Dotted # L& [2] MATHEMATICAL BOLD SMALL I..MATHEMATICAL BOLD SMALL J +1D456..1D457 ; Soft_Dotted # L& [2] MATHEMATICAL ITALIC SMALL I..MATHEMATICAL ITALIC SMALL J +1D48A..1D48B ; Soft_Dotted # L& [2] MATHEMATICAL BOLD ITALIC SMALL I..MATHEMATICAL BOLD ITALIC SMALL J +1D4BE..1D4BF ; Soft_Dotted # L& [2] MATHEMATICAL SCRIPT SMALL I..MATHEMATICAL SCRIPT SMALL J +1D4F2..1D4F3 ; Soft_Dotted # L& [2] MATHEMATICAL BOLD SCRIPT SMALL I..MATHEMATICAL BOLD SCRIPT SMALL J +1D526..1D527 ; Soft_Dotted # L& [2] MATHEMATICAL FRAKTUR SMALL I..MATHEMATICAL FRAKTUR SMALL J +1D55A..1D55B ; Soft_Dotted # L& [2] MATHEMATICAL DOUBLE-STRUCK SMALL I..MATHEMATICAL DOUBLE-STRUCK SMALL J +1D58E..1D58F ; Soft_Dotted # L& [2] MATHEMATICAL BOLD FRAKTUR SMALL I..MATHEMATICAL BOLD FRAKTUR SMALL J +1D5C2..1D5C3 ; Soft_Dotted # L& [2] MATHEMATICAL SANS-SERIF SMALL I..MATHEMATICAL SANS-SERIF SMALL J +1D5F6..1D5F7 ; Soft_Dotted # L& [2] MATHEMATICAL SANS-SERIF BOLD SMALL I..MATHEMATICAL SANS-SERIF BOLD SMALL J +1D62A..1D62B ; Soft_Dotted # L& [2] MATHEMATICAL SANS-SERIF ITALIC SMALL I..MATHEMATICAL SANS-SERIF ITALIC SMALL J +1D65E..1D65F ; Soft_Dotted # L& [2] MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL I..MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL J +1D692..1D693 ; Soft_Dotted # L& [2] MATHEMATICAL MONOSPACE SMALL I..MATHEMATICAL MONOSPACE SMALL J + +# Total code points: 46 + +# ================================================ + +0E40..0E44 ; Logical_Order_Exception # Lo [5] THAI CHARACTER SARA E..THAI CHARACTER SARA AI MAIMALAI +0EC0..0EC4 ; Logical_Order_Exception # Lo [5] LAO VOWEL SIGN E..LAO VOWEL SIGN AI +AAB5..AAB6 ; Logical_Order_Exception # Lo [2] TAI VIET VOWEL E..TAI VIET VOWEL O +AAB9 ; Logical_Order_Exception # Lo TAI VIET VOWEL UEA +AABB..AABC ; Logical_Order_Exception # Lo [2] TAI VIET VOWEL AUE..TAI VIET VOWEL AY + +# Total code points: 15 + +# ================================================ + +2118 ; Other_ID_Start # Sm SCRIPT CAPITAL P +212E ; Other_ID_Start # So ESTIMATED SYMBOL +309B..309C ; Other_ID_Start # Sk [2] KATAKANA-HIRAGANA VOICED SOUND MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK + +# Total code points: 4 + +# ================================================ + +00B7 ; Other_ID_Continue # Po MIDDLE DOT +0387 ; Other_ID_Continue # Po GREEK ANO TELEIA +1369..1371 ; Other_ID_Continue # No [9] ETHIOPIC DIGIT ONE..ETHIOPIC DIGIT NINE +19DA ; Other_ID_Continue # No NEW TAI LUE THAM DIGIT ONE + +# Total code points: 12 + +# ================================================ + +0021 ; STerm # Po EXCLAMATION MARK +002E ; STerm # Po FULL STOP +003F ; STerm # Po QUESTION MARK +055C ; STerm # Po ARMENIAN EXCLAMATION MARK +055E ; STerm # Po ARMENIAN QUESTION MARK +0589 ; STerm # Po ARMENIAN FULL STOP +061F ; STerm # Po ARABIC QUESTION MARK +06D4 ; STerm # Po ARABIC FULL STOP +0700..0702 ; STerm # Po [3] SYRIAC END OF PARAGRAPH..SYRIAC SUBLINEAR FULL STOP +07F9 ; STerm # Po NKO EXCLAMATION MARK +0964..0965 ; STerm # Po [2] DEVANAGARI DANDA..DEVANAGARI DOUBLE DANDA +104A..104B ; STerm # Po [2] MYANMAR SIGN LITTLE SECTION..MYANMAR SIGN SECTION +1362 ; STerm # Po ETHIOPIC FULL STOP +1367..1368 ; STerm # Po [2] ETHIOPIC QUESTION MARK..ETHIOPIC PARAGRAPH SEPARATOR +166E ; STerm # Po CANADIAN SYLLABICS FULL STOP +1735..1736 ; STerm # Po [2] PHILIPPINE SINGLE PUNCTUATION..PHILIPPINE DOUBLE PUNCTUATION +1803 ; STerm # Po MONGOLIAN FULL STOP +1809 ; STerm # Po MONGOLIAN MANCHU FULL STOP +1944..1945 ; STerm # Po [2] LIMBU EXCLAMATION MARK..LIMBU QUESTION MARK +1AA8..1AAB ; STerm # Po [4] TAI THAM SIGN KAAN..TAI THAM SIGN SATKAANKUU +1B5A..1B5B ; STerm # Po [2] BALINESE PANTI..BALINESE PAMADA +1B5E..1B5F ; STerm # Po [2] BALINESE CARIK SIKI..BALINESE CARIK PAREREN +1C3B..1C3C ; STerm # Po [2] LEPCHA PUNCTUATION TA-ROL..LEPCHA PUNCTUATION NYET THYOOM TA-ROL +1C7E..1C7F ; STerm # Po [2] OL CHIKI PUNCTUATION MUCAAD..OL CHIKI PUNCTUATION DOUBLE MUCAAD +203C..203D ; STerm # Po [2] DOUBLE EXCLAMATION MARK..INTERROBANG +2047..2049 ; STerm # Po [3] DOUBLE QUESTION MARK..EXCLAMATION QUESTION MARK +2E2E ; STerm # Po REVERSED QUESTION MARK +3002 ; STerm # Po IDEOGRAPHIC FULL STOP +A4FF ; STerm # Po LISU PUNCTUATION FULL STOP +A60E..A60F ; STerm # Po [2] VAI FULL STOP..VAI QUESTION MARK +A6F3 ; STerm # Po BAMUM FULL STOP +A6F7 ; STerm # Po BAMUM QUESTION MARK +A876..A877 ; STerm # Po [2] PHAGS-PA MARK SHAD..PHAGS-PA MARK DOUBLE SHAD +A8CE..A8CF ; STerm # Po [2] SAURASHTRA DANDA..SAURASHTRA DOUBLE DANDA +A92F ; STerm # Po KAYAH LI SIGN SHYA +A9C8..A9C9 ; STerm # Po [2] JAVANESE PADA LINGSA..JAVANESE PADA LUNGSI +AA5D..AA5F ; STerm # Po [3] CHAM PUNCTUATION DANDA..CHAM PUNCTUATION TRIPLE DANDA +ABEB ; STerm # Po MEETEI MAYEK CHEIKHEI +FE52 ; STerm # Po SMALL FULL STOP +FE56..FE57 ; STerm # Po [2] SMALL QUESTION MARK..SMALL EXCLAMATION MARK +FF01 ; STerm # Po FULLWIDTH EXCLAMATION MARK +FF0E ; STerm # Po FULLWIDTH FULL STOP +FF1F ; STerm # Po FULLWIDTH QUESTION MARK +FF61 ; STerm # Po HALFWIDTH IDEOGRAPHIC FULL STOP +10A56..10A57 ; STerm # Po [2] KHAROSHTHI PUNCTUATION DANDA..KHAROSHTHI PUNCTUATION DOUBLE DANDA +11047..11048 ; STerm # Po [2] BRAHMI DANDA..BRAHMI DOUBLE DANDA +110BE..110C1 ; STerm # Po [4] KAITHI SECTION MARK..KAITHI DOUBLE DANDA + +# Total code points: 76 + +# ================================================ + +180B..180D ; Variation_Selector # Mn [3] MONGOLIAN FREE VARIATION SELECTOR ONE..MONGOLIAN FREE VARIATION SELECTOR THREE +FE00..FE0F ; Variation_Selector # Mn [16] VARIATION SELECTOR-1..VARIATION SELECTOR-16 +E0100..E01EF ; Variation_Selector # Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256 + +# Total code points: 259 + +# ================================================ + +0009..000D ; Pattern_White_Space # Cc [5] .. +0020 ; Pattern_White_Space # Zs SPACE +0085 ; Pattern_White_Space # Cc +200E..200F ; Pattern_White_Space # Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK +2028 ; Pattern_White_Space # Zl LINE SEPARATOR +2029 ; Pattern_White_Space # Zp PARAGRAPH SEPARATOR + +# Total code points: 11 + +# ================================================ + +0021..0023 ; Pattern_Syntax # Po [3] EXCLAMATION MARK..NUMBER SIGN +0024 ; Pattern_Syntax # Sc DOLLAR SIGN +0025..0027 ; Pattern_Syntax # Po [3] PERCENT SIGN..APOSTROPHE +0028 ; Pattern_Syntax # Ps LEFT PARENTHESIS +0029 ; Pattern_Syntax # Pe RIGHT PARENTHESIS +002A ; Pattern_Syntax # Po ASTERISK +002B ; Pattern_Syntax # Sm PLUS SIGN +002C ; Pattern_Syntax # Po COMMA +002D ; Pattern_Syntax # Pd HYPHEN-MINUS +002E..002F ; Pattern_Syntax # Po [2] FULL STOP..SOLIDUS +003A..003B ; Pattern_Syntax # Po [2] COLON..SEMICOLON +003C..003E ; Pattern_Syntax # Sm [3] LESS-THAN SIGN..GREATER-THAN SIGN +003F..0040 ; Pattern_Syntax # Po [2] QUESTION MARK..COMMERCIAL AT +005B ; Pattern_Syntax # Ps LEFT SQUARE BRACKET +005C ; Pattern_Syntax # Po REVERSE SOLIDUS +005D ; Pattern_Syntax # Pe RIGHT SQUARE BRACKET +005E ; Pattern_Syntax # Sk CIRCUMFLEX ACCENT +0060 ; Pattern_Syntax # Sk GRAVE ACCENT +007B ; Pattern_Syntax # Ps LEFT CURLY BRACKET +007C ; Pattern_Syntax # Sm VERTICAL LINE +007D ; Pattern_Syntax # Pe RIGHT CURLY BRACKET +007E ; Pattern_Syntax # Sm TILDE +00A1 ; Pattern_Syntax # Po INVERTED EXCLAMATION MARK +00A2..00A5 ; Pattern_Syntax # Sc [4] CENT SIGN..YEN SIGN +00A6..00A7 ; Pattern_Syntax # So [2] BROKEN BAR..SECTION SIGN +00A9 ; Pattern_Syntax # So COPYRIGHT SIGN +00AB ; Pattern_Syntax # Pi LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +00AC ; Pattern_Syntax # Sm NOT SIGN +00AE ; Pattern_Syntax # So REGISTERED SIGN +00B0 ; Pattern_Syntax # So DEGREE SIGN +00B1 ; Pattern_Syntax # Sm PLUS-MINUS SIGN +00B6 ; Pattern_Syntax # So PILCROW SIGN +00BB ; Pattern_Syntax # Pf RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +00BF ; Pattern_Syntax # Po INVERTED QUESTION MARK +00D7 ; Pattern_Syntax # Sm MULTIPLICATION SIGN +00F7 ; Pattern_Syntax # Sm DIVISION SIGN +2010..2015 ; Pattern_Syntax # Pd [6] HYPHEN..HORIZONTAL BAR +2016..2017 ; Pattern_Syntax # Po [2] DOUBLE VERTICAL LINE..DOUBLE LOW LINE +2018 ; Pattern_Syntax # Pi LEFT SINGLE QUOTATION MARK +2019 ; Pattern_Syntax # Pf RIGHT SINGLE QUOTATION MARK +201A ; Pattern_Syntax # Ps SINGLE LOW-9 QUOTATION MARK +201B..201C ; Pattern_Syntax # Pi [2] SINGLE HIGH-REVERSED-9 QUOTATION MARK..LEFT DOUBLE QUOTATION MARK +201D ; Pattern_Syntax # Pf RIGHT DOUBLE QUOTATION MARK +201E ; Pattern_Syntax # Ps DOUBLE LOW-9 QUOTATION MARK +201F ; Pattern_Syntax # Pi DOUBLE HIGH-REVERSED-9 QUOTATION MARK +2020..2027 ; Pattern_Syntax # Po [8] DAGGER..HYPHENATION POINT +2030..2038 ; Pattern_Syntax # Po [9] PER MILLE SIGN..CARET +2039 ; Pattern_Syntax # Pi SINGLE LEFT-POINTING ANGLE QUOTATION MARK +203A ; Pattern_Syntax # Pf SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +203B..203E ; Pattern_Syntax # Po [4] REFERENCE MARK..OVERLINE +2041..2043 ; Pattern_Syntax # Po [3] CARET INSERTION POINT..HYPHEN BULLET +2044 ; Pattern_Syntax # Sm FRACTION SLASH +2045 ; Pattern_Syntax # Ps LEFT SQUARE BRACKET WITH QUILL +2046 ; Pattern_Syntax # Pe RIGHT SQUARE BRACKET WITH QUILL +2047..2051 ; Pattern_Syntax # Po [11] DOUBLE QUESTION MARK..TWO ASTERISKS ALIGNED VERTICALLY +2052 ; Pattern_Syntax # Sm COMMERCIAL MINUS SIGN +2053 ; Pattern_Syntax # Po SWUNG DASH +2055..205E ; Pattern_Syntax # Po [10] FLOWER PUNCTUATION MARK..VERTICAL FOUR DOTS +2190..2194 ; Pattern_Syntax # Sm [5] LEFTWARDS ARROW..LEFT RIGHT ARROW +2195..2199 ; Pattern_Syntax # So [5] UP DOWN ARROW..SOUTH WEST ARROW +219A..219B ; Pattern_Syntax # Sm [2] LEFTWARDS ARROW WITH STROKE..RIGHTWARDS ARROW WITH STROKE +219C..219F ; Pattern_Syntax # So [4] LEFTWARDS WAVE ARROW..UPWARDS TWO HEADED ARROW +21A0 ; Pattern_Syntax # Sm RIGHTWARDS TWO HEADED ARROW +21A1..21A2 ; Pattern_Syntax # So [2] DOWNWARDS TWO HEADED ARROW..LEFTWARDS ARROW WITH TAIL +21A3 ; Pattern_Syntax # Sm RIGHTWARDS ARROW WITH TAIL +21A4..21A5 ; Pattern_Syntax # So [2] LEFTWARDS ARROW FROM BAR..UPWARDS ARROW FROM BAR +21A6 ; Pattern_Syntax # Sm RIGHTWARDS ARROW FROM BAR +21A7..21AD ; Pattern_Syntax # So [7] DOWNWARDS ARROW FROM BAR..LEFT RIGHT WAVE ARROW +21AE ; Pattern_Syntax # Sm LEFT RIGHT ARROW WITH STROKE +21AF..21CD ; Pattern_Syntax # So [31] DOWNWARDS ZIGZAG ARROW..LEFTWARDS DOUBLE ARROW WITH STROKE +21CE..21CF ; Pattern_Syntax # Sm [2] LEFT RIGHT DOUBLE ARROW WITH STROKE..RIGHTWARDS DOUBLE ARROW WITH STROKE +21D0..21D1 ; Pattern_Syntax # So [2] LEFTWARDS DOUBLE ARROW..UPWARDS DOUBLE ARROW +21D2 ; Pattern_Syntax # Sm RIGHTWARDS DOUBLE ARROW +21D3 ; Pattern_Syntax # So DOWNWARDS DOUBLE ARROW +21D4 ; Pattern_Syntax # Sm LEFT RIGHT DOUBLE ARROW +21D5..21F3 ; Pattern_Syntax # So [31] UP DOWN DOUBLE ARROW..UP DOWN WHITE ARROW +21F4..22FF ; Pattern_Syntax # Sm [268] RIGHT ARROW WITH SMALL CIRCLE..Z NOTATION BAG MEMBERSHIP +2300..2307 ; Pattern_Syntax # So [8] DIAMETER SIGN..WAVY LINE +2308..230B ; Pattern_Syntax # Sm [4] LEFT CEILING..RIGHT FLOOR +230C..231F ; Pattern_Syntax # So [20] BOTTOM RIGHT CROP..BOTTOM RIGHT CORNER +2320..2321 ; Pattern_Syntax # Sm [2] TOP HALF INTEGRAL..BOTTOM HALF INTEGRAL +2322..2328 ; Pattern_Syntax # So [7] FROWN..KEYBOARD +2329 ; Pattern_Syntax # Ps LEFT-POINTING ANGLE BRACKET +232A ; Pattern_Syntax # Pe RIGHT-POINTING ANGLE BRACKET +232B..237B ; Pattern_Syntax # So [81] ERASE TO THE LEFT..NOT CHECK MARK +237C ; Pattern_Syntax # Sm RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW +237D..239A ; Pattern_Syntax # So [30] SHOULDERED OPEN BOX..CLEAR SCREEN SYMBOL +239B..23B3 ; Pattern_Syntax # Sm [25] LEFT PARENTHESIS UPPER HOOK..SUMMATION BOTTOM +23B4..23DB ; Pattern_Syntax # So [40] TOP SQUARE BRACKET..FUSE +23DC..23E1 ; Pattern_Syntax # Sm [6] TOP PARENTHESIS..BOTTOM TORTOISE SHELL BRACKET +23E2..23F3 ; Pattern_Syntax # So [18] WHITE TRAPEZIUM..HOURGLASS WITH FLOWING SAND +23F4..23FF ; Pattern_Syntax # Cn [12] .. +2400..2426 ; Pattern_Syntax # So [39] SYMBOL FOR NULL..SYMBOL FOR SUBSTITUTE FORM TWO +2427..243F ; Pattern_Syntax # Cn [25] .. +2440..244A ; Pattern_Syntax # So [11] OCR HOOK..OCR DOUBLE BACKSLASH +244B..245F ; Pattern_Syntax # Cn [21] .. +2500..25B6 ; Pattern_Syntax # So [183] BOX DRAWINGS LIGHT HORIZONTAL..BLACK RIGHT-POINTING TRIANGLE +25B7 ; Pattern_Syntax # Sm WHITE RIGHT-POINTING TRIANGLE +25B8..25C0 ; Pattern_Syntax # So [9] BLACK RIGHT-POINTING SMALL TRIANGLE..BLACK LEFT-POINTING TRIANGLE +25C1 ; Pattern_Syntax # Sm WHITE LEFT-POINTING TRIANGLE +25C2..25F7 ; Pattern_Syntax # So [54] BLACK LEFT-POINTING SMALL TRIANGLE..WHITE CIRCLE WITH UPPER RIGHT QUADRANT +25F8..25FF ; Pattern_Syntax # Sm [8] UPPER LEFT TRIANGLE..LOWER RIGHT TRIANGLE +2600..266E ; Pattern_Syntax # So [111] BLACK SUN WITH RAYS..MUSIC NATURAL SIGN +266F ; Pattern_Syntax # Sm MUSIC SHARP SIGN +2670..26FF ; Pattern_Syntax # So [144] WEST SYRIAC CROSS..WHITE FLAG WITH HORIZONTAL MIDDLE BLACK STRIPE +2700 ; Pattern_Syntax # Cn +2701..2767 ; Pattern_Syntax # So [103] UPPER BLADE SCISSORS..ROTATED FLORAL HEART BULLET +2768 ; Pattern_Syntax # Ps MEDIUM LEFT PARENTHESIS ORNAMENT +2769 ; Pattern_Syntax # Pe MEDIUM RIGHT PARENTHESIS ORNAMENT +276A ; Pattern_Syntax # Ps MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT +276B ; Pattern_Syntax # Pe MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT +276C ; Pattern_Syntax # Ps MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT +276D ; Pattern_Syntax # Pe MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT +276E ; Pattern_Syntax # Ps HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT +276F ; Pattern_Syntax # Pe HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT +2770 ; Pattern_Syntax # Ps HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT +2771 ; Pattern_Syntax # Pe HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT +2772 ; Pattern_Syntax # Ps LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT +2773 ; Pattern_Syntax # Pe LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT +2774 ; Pattern_Syntax # Ps MEDIUM LEFT CURLY BRACKET ORNAMENT +2775 ; Pattern_Syntax # Pe MEDIUM RIGHT CURLY BRACKET ORNAMENT +2794..27BF ; Pattern_Syntax # So [44] HEAVY WIDE-HEADED RIGHTWARDS ARROW..DOUBLE CURLY LOOP +27C0..27C4 ; Pattern_Syntax # Sm [5] THREE DIMENSIONAL ANGLE..OPEN SUPERSET +27C5 ; Pattern_Syntax # Ps LEFT S-SHAPED BAG DELIMITER +27C6 ; Pattern_Syntax # Pe RIGHT S-SHAPED BAG DELIMITER +27C7..27CA ; Pattern_Syntax # Sm [4] OR WITH DOT INSIDE..VERTICAL BAR WITH HORIZONTAL STROKE +27CB ; Pattern_Syntax # Cn +27CC ; Pattern_Syntax # Sm LONG DIVISION +27CD ; Pattern_Syntax # Cn +27CE..27E5 ; Pattern_Syntax # Sm [24] SQUARED LOGICAL AND..WHITE SQUARE WITH RIGHTWARDS TICK +27E6 ; Pattern_Syntax # Ps MATHEMATICAL LEFT WHITE SQUARE BRACKET +27E7 ; Pattern_Syntax # Pe MATHEMATICAL RIGHT WHITE SQUARE BRACKET +27E8 ; Pattern_Syntax # Ps MATHEMATICAL LEFT ANGLE BRACKET +27E9 ; Pattern_Syntax # Pe MATHEMATICAL RIGHT ANGLE BRACKET +27EA ; Pattern_Syntax # Ps MATHEMATICAL LEFT DOUBLE ANGLE BRACKET +27EB ; Pattern_Syntax # Pe MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET +27EC ; Pattern_Syntax # Ps MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET +27ED ; Pattern_Syntax # Pe MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET +27EE ; Pattern_Syntax # Ps MATHEMATICAL LEFT FLATTENED PARENTHESIS +27EF ; Pattern_Syntax # Pe MATHEMATICAL RIGHT FLATTENED PARENTHESIS +27F0..27FF ; Pattern_Syntax # Sm [16] UPWARDS QUADRUPLE ARROW..LONG RIGHTWARDS SQUIGGLE ARROW +2800..28FF ; Pattern_Syntax # So [256] BRAILLE PATTERN BLANK..BRAILLE PATTERN DOTS-12345678 +2900..2982 ; Pattern_Syntax # Sm [131] RIGHTWARDS TWO-HEADED ARROW WITH VERTICAL STROKE..Z NOTATION TYPE COLON +2983 ; Pattern_Syntax # Ps LEFT WHITE CURLY BRACKET +2984 ; Pattern_Syntax # Pe RIGHT WHITE CURLY BRACKET +2985 ; Pattern_Syntax # Ps LEFT WHITE PARENTHESIS +2986 ; Pattern_Syntax # Pe RIGHT WHITE PARENTHESIS +2987 ; Pattern_Syntax # Ps Z NOTATION LEFT IMAGE BRACKET +2988 ; Pattern_Syntax # Pe Z NOTATION RIGHT IMAGE BRACKET +2989 ; Pattern_Syntax # Ps Z NOTATION LEFT BINDING BRACKET +298A ; Pattern_Syntax # Pe Z NOTATION RIGHT BINDING BRACKET +298B ; Pattern_Syntax # Ps LEFT SQUARE BRACKET WITH UNDERBAR +298C ; Pattern_Syntax # Pe RIGHT SQUARE BRACKET WITH UNDERBAR +298D ; Pattern_Syntax # Ps LEFT SQUARE BRACKET WITH TICK IN TOP CORNER +298E ; Pattern_Syntax # Pe RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER +298F ; Pattern_Syntax # Ps LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER +2990 ; Pattern_Syntax # Pe RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER +2991 ; Pattern_Syntax # Ps LEFT ANGLE BRACKET WITH DOT +2992 ; Pattern_Syntax # Pe RIGHT ANGLE BRACKET WITH DOT +2993 ; Pattern_Syntax # Ps LEFT ARC LESS-THAN BRACKET +2994 ; Pattern_Syntax # Pe RIGHT ARC GREATER-THAN BRACKET +2995 ; Pattern_Syntax # Ps DOUBLE LEFT ARC GREATER-THAN BRACKET +2996 ; Pattern_Syntax # Pe DOUBLE RIGHT ARC LESS-THAN BRACKET +2997 ; Pattern_Syntax # Ps LEFT BLACK TORTOISE SHELL BRACKET +2998 ; Pattern_Syntax # Pe RIGHT BLACK TORTOISE SHELL BRACKET +2999..29D7 ; Pattern_Syntax # Sm [63] DOTTED FENCE..BLACK HOURGLASS +29D8 ; Pattern_Syntax # Ps LEFT WIGGLY FENCE +29D9 ; Pattern_Syntax # Pe RIGHT WIGGLY FENCE +29DA ; Pattern_Syntax # Ps LEFT DOUBLE WIGGLY FENCE +29DB ; Pattern_Syntax # Pe RIGHT DOUBLE WIGGLY FENCE +29DC..29FB ; Pattern_Syntax # Sm [32] INCOMPLETE INFINITY..TRIPLE PLUS +29FC ; Pattern_Syntax # Ps LEFT-POINTING CURVED ANGLE BRACKET +29FD ; Pattern_Syntax # Pe RIGHT-POINTING CURVED ANGLE BRACKET +29FE..2AFF ; Pattern_Syntax # Sm [258] TINY..N-ARY WHITE VERTICAL BAR +2B00..2B2F ; Pattern_Syntax # So [48] NORTH EAST WHITE ARROW..WHITE VERTICAL ELLIPSE +2B30..2B44 ; Pattern_Syntax # Sm [21] LEFT ARROW WITH SMALL CIRCLE..RIGHTWARDS ARROW THROUGH SUPERSET +2B45..2B46 ; Pattern_Syntax # So [2] LEFTWARDS QUADRUPLE ARROW..RIGHTWARDS QUADRUPLE ARROW +2B47..2B4C ; Pattern_Syntax # Sm [6] REVERSE TILDE OPERATOR ABOVE RIGHTWARDS ARROW..RIGHTWARDS ARROW ABOVE REVERSE TILDE OPERATOR +2B4D..2B4F ; Pattern_Syntax # Cn [3] .. +2B50..2B59 ; Pattern_Syntax # So [10] WHITE MEDIUM STAR..HEAVY CIRCLED SALTIRE +2B5A..2BFF ; Pattern_Syntax # Cn [166] .. +2E00..2E01 ; Pattern_Syntax # Po [2] RIGHT ANGLE SUBSTITUTION MARKER..RIGHT ANGLE DOTTED SUBSTITUTION MARKER +2E02 ; Pattern_Syntax # Pi LEFT SUBSTITUTION BRACKET +2E03 ; Pattern_Syntax # Pf RIGHT SUBSTITUTION BRACKET +2E04 ; Pattern_Syntax # Pi LEFT DOTTED SUBSTITUTION BRACKET +2E05 ; Pattern_Syntax # Pf RIGHT DOTTED SUBSTITUTION BRACKET +2E06..2E08 ; Pattern_Syntax # Po [3] RAISED INTERPOLATION MARKER..DOTTED TRANSPOSITION MARKER +2E09 ; Pattern_Syntax # Pi LEFT TRANSPOSITION BRACKET +2E0A ; Pattern_Syntax # Pf RIGHT TRANSPOSITION BRACKET +2E0B ; Pattern_Syntax # Po RAISED SQUARE +2E0C ; Pattern_Syntax # Pi LEFT RAISED OMISSION BRACKET +2E0D ; Pattern_Syntax # Pf RIGHT RAISED OMISSION BRACKET +2E0E..2E16 ; Pattern_Syntax # Po [9] EDITORIAL CORONIS..DOTTED RIGHT-POINTING ANGLE +2E17 ; Pattern_Syntax # Pd DOUBLE OBLIQUE HYPHEN +2E18..2E19 ; Pattern_Syntax # Po [2] INVERTED INTERROBANG..PALM BRANCH +2E1A ; Pattern_Syntax # Pd HYPHEN WITH DIAERESIS +2E1B ; Pattern_Syntax # Po TILDE WITH RING ABOVE +2E1C ; Pattern_Syntax # Pi LEFT LOW PARAPHRASE BRACKET +2E1D ; Pattern_Syntax # Pf RIGHT LOW PARAPHRASE BRACKET +2E1E..2E1F ; Pattern_Syntax # Po [2] TILDE WITH DOT ABOVE..TILDE WITH DOT BELOW +2E20 ; Pattern_Syntax # Pi LEFT VERTICAL BAR WITH QUILL +2E21 ; Pattern_Syntax # Pf RIGHT VERTICAL BAR WITH QUILL +2E22 ; Pattern_Syntax # Ps TOP LEFT HALF BRACKET +2E23 ; Pattern_Syntax # Pe TOP RIGHT HALF BRACKET +2E24 ; Pattern_Syntax # Ps BOTTOM LEFT HALF BRACKET +2E25 ; Pattern_Syntax # Pe BOTTOM RIGHT HALF BRACKET +2E26 ; Pattern_Syntax # Ps LEFT SIDEWAYS U BRACKET +2E27 ; Pattern_Syntax # Pe RIGHT SIDEWAYS U BRACKET +2E28 ; Pattern_Syntax # Ps LEFT DOUBLE PARENTHESIS +2E29 ; Pattern_Syntax # Pe RIGHT DOUBLE PARENTHESIS +2E2A..2E2E ; Pattern_Syntax # Po [5] TWO DOTS OVER ONE DOT PUNCTUATION..REVERSED QUESTION MARK +2E2F ; Pattern_Syntax # Lm VERTICAL TILDE +2E30..2E31 ; Pattern_Syntax # Po [2] RING POINT..WORD SEPARATOR MIDDLE DOT +2E32..2E7F ; Pattern_Syntax # Cn [78] .. +3001..3003 ; Pattern_Syntax # Po [3] IDEOGRAPHIC COMMA..DITTO MARK +3008 ; Pattern_Syntax # Ps LEFT ANGLE BRACKET +3009 ; Pattern_Syntax # Pe RIGHT ANGLE BRACKET +300A ; Pattern_Syntax # Ps LEFT DOUBLE ANGLE BRACKET +300B ; Pattern_Syntax # Pe RIGHT DOUBLE ANGLE BRACKET +300C ; Pattern_Syntax # Ps LEFT CORNER BRACKET +300D ; Pattern_Syntax # Pe RIGHT CORNER BRACKET +300E ; Pattern_Syntax # Ps LEFT WHITE CORNER BRACKET +300F ; Pattern_Syntax # Pe RIGHT WHITE CORNER BRACKET +3010 ; Pattern_Syntax # Ps LEFT BLACK LENTICULAR BRACKET +3011 ; Pattern_Syntax # Pe RIGHT BLACK LENTICULAR BRACKET +3012..3013 ; Pattern_Syntax # So [2] POSTAL MARK..GETA MARK +3014 ; Pattern_Syntax # Ps LEFT TORTOISE SHELL BRACKET +3015 ; Pattern_Syntax # Pe RIGHT TORTOISE SHELL BRACKET +3016 ; Pattern_Syntax # Ps LEFT WHITE LENTICULAR BRACKET +3017 ; Pattern_Syntax # Pe RIGHT WHITE LENTICULAR BRACKET +3018 ; Pattern_Syntax # Ps LEFT WHITE TORTOISE SHELL BRACKET +3019 ; Pattern_Syntax # Pe RIGHT WHITE TORTOISE SHELL BRACKET +301A ; Pattern_Syntax # Ps LEFT WHITE SQUARE BRACKET +301B ; Pattern_Syntax # Pe RIGHT WHITE SQUARE BRACKET +301C ; Pattern_Syntax # Pd WAVE DASH +301D ; Pattern_Syntax # Ps REVERSED DOUBLE PRIME QUOTATION MARK +301E..301F ; Pattern_Syntax # Pe [2] DOUBLE PRIME QUOTATION MARK..LOW DOUBLE PRIME QUOTATION MARK +3020 ; Pattern_Syntax # So POSTAL MARK FACE +3030 ; Pattern_Syntax # Pd WAVY DASH +FD3E ; Pattern_Syntax # Ps ORNATE LEFT PARENTHESIS +FD3F ; Pattern_Syntax # Pe ORNATE RIGHT PARENTHESIS +FE45..FE46 ; Pattern_Syntax # Po [2] SESAME DOT..WHITE SESAME DOT + +# Total code points: 2760 + +# EOF diff --git a/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java b/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java index c898259925b..2f7828b6c10 100644 --- a/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java +++ b/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java @@ -1,4 +1,3 @@ - /* * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,6 +33,7 @@ import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.File; +import java.util.List; import build.tools.generatecharacter.CharacterName; @@ -68,18 +68,17 @@ public class GenerateCharacter { final static boolean DEBUG = false; - final static int MAX_UNICODE_VALUE = 0xFFFF; final static String commandMarker = "$$"; static String ROOT = ""; static String DefaultUnicodeSpecFileName = ROOT + "UnicodeData.txt"; static String DefaultSpecialCasingFileName = ROOT + "SpecialCasing.txt"; + static String DefaultPropListFileName = ROOT + "PropList.txt"; static String DefaultJavaTemplateFileName = ROOT + "Character.java.template"; static String DefaultJavaOutputFileName = ROOT + "Character.java"; static String DefaultCTemplateFileName = ROOT + "Character.c.template"; static String DefaultCOutputFileName = ROOT + "Character.c"; - static String CharacterDataClassName = "CharacterData"; - static int plane = 0; + static int plane = 0; /* The overall idea is that, in the generated Character class source code, most character property data is stored in a special multi-level table whose @@ -105,7 +104,11 @@ public class GenerateCharacter { entries are short rather than byte). */ - /* The character properties are currently encoded into 32 bits in the following manner: + /* The character properties are currently encoded into A (32 bits)and B (16 bits) + two parts. + + A: the low 32 bits are defined in the following manner: + 1 bit Mirrored property. 4 bits Bidirectional category (see below) (unused if -nobidi switch specified) 9 bits A signed offset used for converting case . @@ -148,6 +151,14 @@ public class GenerateCharacter { will produce the desired numeric value. 5 bits The digit offset (see description of previous field) 5 bits Character type (see below) + + B: the high 16 bits are defined as: + 1 bit Other_Lowercase property + 1 bit Other_Uppercase property + 1 bit Other_Alphabetic property + 1 bit Other_Math property + 1 bit Ideographic property + 1 bit Noncharacter codepoint property */ @@ -173,9 +184,22 @@ public class GenerateCharacter { // case offset are 9 bits maskCase = 0x01FF, shiftBidi = 27, maskBidi = 0x78000000, - shiftMirrored = 31, maskMirrored = 0x80000000, + shiftMirrored = 31, //maskMirrored = 0x80000000, shiftPlane = 16, maskPlane = 0xFF0000; + // maskMirrored needs to be long, if up 16-bit + private static final long maskMirrored = 0x80000000L; + + // bit masks identify the 16-bit priperty field described above, in B + // table + private static final long + maskOtherLowercase = 0x100000000L, + maskOtherUppercase = 0x200000000L, + maskOtherAlphabetic = 0x400000000L, + maskOtherMath = 0x800000000L, + maskIdeographic = 0x1000000000L, + maskNoncharacterCP = 0x2000000000L; + // Can compare masked values with these to determine // numeric or lexical types. public static int @@ -258,7 +282,7 @@ public class GenerateCharacter { * The specification file is assumed to contain its data in sorted order by * character code; as a result, the array passed as an argument to this method * has its components in the same sorted order, with one entry for each defined - * Unicode character or character range. (A range is indicated by two consecutive + * Unicode character or character range. (A range is indicated by two consecutive * entries, such that the name of the first entry begins with "<" and ends with * "First>" and the second entry begins with "<" and ends with "Last>".) This is * therefore a sparse representation of the character property data. @@ -282,7 +306,8 @@ public class GenerateCharacter { * @see GenerateCharacter#buildOne */ - static long[] buildMap(UnicodeSpec[] data, SpecialCaseMap[] specialMaps) { + static long[] buildMap(UnicodeSpec[] data, SpecialCaseMap[] specialMaps, PropList propList) + { long[] result; if (bLatin1 == true) { result = new long[256]; @@ -290,13 +315,13 @@ public class GenerateCharacter { result = new long[1<<16]; } int k=0; - int codePoint = plane<<16; + int codePoint = plane<<16; UnicodeSpec nonCharSpec = new UnicodeSpec(); for (int j = 0; j < data.length && k < result.length; j++) { if (data[j].codePoint == codePoint) { result[k] = buildOne(codePoint, data[j], specialMaps); ++k; - ++codePoint; + ++codePoint; } else if(data[j].codePoint > codePoint) { if (data[j].name.endsWith("Last>")) { @@ -304,7 +329,7 @@ public class GenerateCharacter { while (codePoint < data[j].codePoint && k < result.length) { result[k] = buildOne(codePoint, data[j], specialMaps); ++k; - ++codePoint; + ++codePoint; } } else { @@ -312,15 +337,14 @@ public class GenerateCharacter { while (codePoint < data[j].codePoint && k < result.length) { result[k] = buildOne(codePoint, nonCharSpec, specialMaps); ++k; - ++codePoint; + ++codePoint; } } k = data[j].codePoint & 0xFFFF; - codePoint = data[j].codePoint; + codePoint = data[j].codePoint; result[k] = buildOne(codePoint, data[j], specialMaps); ++k; - ++codePoint; - + ++codePoint; } else { System.out.println("An error has occured during spec mapping."); @@ -333,8 +357,17 @@ public class GenerateCharacter { while (k < result.length) { result[k] = buildOne(codePoint, nonCharSpec, specialMaps); ++k; - ++codePoint; + ++codePoint; } + // now add all extra supported properties from PropList, to the + // upper 16-bit + addExProp(result, propList, "Other_Lowercase", maskOtherLowercase); + addExProp(result, propList, "Other_Uppercase", maskOtherUppercase); + addExProp(result, propList, "Other_Alphabetic", maskOtherAlphabetic); + addExProp(result, propList, "Ideographic", maskIdeographic); + //addExProp(result, propList, "Other_Math", maskOtherMath); + //addExProp(result, propList, "Noncharacter_CodePoint", maskNoncharacterCP); + return result; } @@ -381,15 +414,15 @@ public class GenerateCharacter { // record the general category resultA |= us.generalCategory; - // record the numeric properties - NUMERIC: { + // record the numeric properties + NUMERIC: { STRANGE: { int val = 0; - // c is A-Z + // c is A-Z if ((c >= 0x0041) && (c <= 0x005A)) { val = c - 0x0041; resultA |= valueJavaSupradecimal; - // c is a-z + // c is a-z } else if ((c >= 0x0061) && (c <= 0x007A)) { val = c - 0x0061; resultA |= valueJavaSupradecimal; @@ -428,7 +461,7 @@ public class GenerateCharacter { resultA |= valueStrangeNumeric; } // end NUMERIC - // record case mapping + // record case mapping int offset = 0; // might have a 1:M mapping int specialMap = SpecialCaseMap.find(c, specialCaseMaps); @@ -458,12 +491,12 @@ public class GenerateCharacter { } } if ((us.hasTitleMap() && us.titleMap != us.upperMap) || - (bHasUpper && us.hasLowerMap())) { + (bHasUpper && us.hasLowerMap())) { resultA |= maskTitleCase; } if (bHasUpper && !us.hasLowerMap() && !us.hasTitleMap() && verbose) { - System.out.println("Warning: Character " + hex4(c) + " has upper but " + - "no title case; Java won't know this"); + System.out.println("Warning: Character " + hex4(c) + " has upper but " + + "no title case; Java won't know this"); } if (offset < minOffsetSeen) minOffsetSeen = offset; if (offset > maxOffsetSeen) maxOffsetSeen = offset; @@ -475,8 +508,7 @@ public class GenerateCharacter { } resultA |= ((offset & maskCase) << shiftCaseOffset); - - // record lexical info about this character + // record lexical info about this character if (us.generalCategory == UnicodeSpec.LOWERCASE_LETTER || us.generalCategory == UnicodeSpec.UPPERCASE_LETTER || us.generalCategory == UnicodeSpec.TITLECASE_LETTER @@ -539,6 +571,16 @@ public class GenerateCharacter { return resultA; } + static void addExProp(long[] map, PropList propList, String prop, long mask) { + List cps = propList.codepoints(prop); + if (cps != null) { + for (Integer cp : cps) { + if (cp < map.length) + map[cp] |= mask; + } + } + } + /** * This is the heart of the table compression strategy. The inputs are a map * and a number of bits (size). The map is simply an array of long integer values; @@ -645,8 +687,8 @@ OUTER: for (int i = 0; i < n; i += m) { */ static void generateCharacterClass(String theTemplateFileName, - String theOutputFileName) - throws FileNotFoundException, IOException { + String theOutputFileName) + throws FileNotFoundException, IOException { BufferedReader in = new BufferedReader(new FileReader(theTemplateFileName)); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(theOutputFileName))); out.println(commentStart + @@ -719,6 +761,9 @@ OUTER: for (int i = 0; i < n; i += m) { if (x.length() >= 9 && x.substring(0, 7).equals("Lookup(") && x.substring(x.length()-1).equals(")") ) return genAccess("A", x.substring(7, x.length()-1), (identifiers ? 2 : 32)); + if (x.length() >= 11 && x.substring(0, 9).equals("LookupEx(") && + x.substring(x.length()-1).equals(")") ) + return genAccess("B", x.substring(9, x.length()-1), 16); if (x.equals("shiftType")) return Long.toString(shiftType); if (x.equals("shiftIdentifierInfo")) return Long.toString(shiftIdentifierInfo); if (x.equals("maskIdentifierInfo")) return "0x" + hex8(maskIdentifierInfo); @@ -731,6 +776,10 @@ OUTER: for (int i = 0; i < n; i += m) { if (x.equals("maskLowerCase")) return "0x" + hex8(maskLowerCase); if (x.equals("maskUpperCase")) return "0x" + hex8(maskUpperCase); if (x.equals("maskTitleCase")) return "0x" + hex8(maskTitleCase); + if (x.equals("maskOtherLowercase")) return "0x" + hex4(maskOtherLowercase >> 32); + if (x.equals("maskOtherUppercase")) return "0x" + hex4(maskOtherUppercase >> 32); + if (x.equals("maskOtherAlphabetic")) return "0x" + hex4(maskOtherAlphabetic >> 32); + if (x.equals("maskIdeographic")) return "0x" + hex4(maskIdeographic >> 32); if (x.equals("valueIgnorable")) return "0x" + hex8(valueIgnorable); if (x.equals("valueJavaUnicodeStart")) return "0x" + hex8(valueJavaUnicodeStart); if (x.equals("valueJavaOnlyStart")) return "0x" + hex8(valueJavaOnlyStart); @@ -899,7 +948,7 @@ OUTER: for (int i = 0; i < n; i += m) { // If we ever need more than 32 bits to represent the character properties, // then a table "B" may be needed as well. - // genTable(result, "B", tables[n - 1], 32, 16, sizes[n - 1], false, 0, true, true, false); + genTable(result, "B", tables[n - 1], 32, 16, sizes[n - 1], false, 0, true, true, false); totalBytes += ((((tables[n - 1].length * (identifiers ? 2 : 32)) + 31) >> 5) << 2); result.append(commentStart); @@ -1080,9 +1129,9 @@ OUTER: for (int i = 0; i < n; i += m) { */ static void genTable(StringBuffer result, String name, - long[] table, int extract, int bits, int size, - boolean preshifted, int shift, boolean hexFormat, - boolean properties, boolean hexComment) { + long[] table, int extract, int bits, int size, + boolean preshifted, int shift, boolean hexFormat, + boolean properties, boolean hexComment) { String atype = bits == 1 ? (Csyntax ? "unsigned long" : "int") : bits == 2 ? (Csyntax ? "unsigned long" : "int") : @@ -1137,7 +1186,12 @@ OUTER: for (int i = 0; i < n; i += m) { char ch = '\u0000'; int charsPerEntry = -entriesPerChar; for (int j=0; j> extract; + //long entry = table[j] >> extract; + long entry; + if ("A".equals(name)) + entry = (table[j] & 0xffffffffL) >> extract; + else + entry = (table[j] >> extract); if (shiftEntries) entry <<= shift; if (entry >= (1L << bits)) { FAIL("Entry too big"); @@ -1549,6 +1603,7 @@ OUTER: for (int i = 0; i < n; i += m) { static String OutputFileName = null; static String UnicodeSpecFileName = null; // liu static String SpecialCasingFileName = null; + static String PropListFileName = null; static boolean useCharForByte = false; static int[] sizes; static int bins = 0; // liu; if > 0, then perform search @@ -1668,20 +1723,28 @@ OUTER: for (int i = 0; i < n; i += m) { SpecialCasingFileName = args[++j]; } } - else if (args[j].equals("-plane")) { - if (j == args.length -1) { - FAIL("Plane number missing after -plane"); - } - else { - plane = Integer.parseInt(args[++j]); - } - if (plane > 0) { - bLatin1 = false; - } - } - else if ("-usecharforbyte".equals(args[j])) { - useCharForByte = true; - } + else if (args[j].equals("-proplist")) { + if (j == args.length -1) { + FAIL("File name missing after -proplist"); + } + else { + PropListFileName = args[++j]; + } + } + else if (args[j].equals("-plane")) { + if (j == args.length -1) { + FAIL("Plane number missing after -plane"); + } + else { + plane = Integer.parseInt(args[++j]); + } + if (plane > 0) { + bLatin1 = false; + } + } + else if ("-usecharforbyte".equals(args[j])) { + useCharForByte = true; + } else if (args[j].equals("-latin1")) { bLatin1 = true; plane = 0; @@ -1728,6 +1791,10 @@ OUTER: for (int i = 0; i < n; i += m) { SpecialCasingFileName = DefaultSpecialCasingFileName; desc.append(" [-specialcasing " + SpecialCasingFileName + ']'); } + if (PropListFileName == null) { + PropListFileName = DefaultPropListFileName; + desc.append(" [-proplist " + PropListFileName + ']'); + } if (TemplateFileName == null) { TemplateFileName = (Csyntax ? DefaultCTemplateFileName : DefaultJavaTemplateFileName); @@ -1877,12 +1944,13 @@ OUTER: for (int i = 0; i < n; i += m) { try { UnicodeSpec[] data = UnicodeSpec.readSpecFile(new File(UnicodeSpecFileName), plane); - specialCaseMaps = SpecialCaseMap.readSpecFile(new File(SpecialCasingFileName), plane); + PropList propList = PropList.readSpecFile(new File(PropListFileName), plane); + if (verbose) { System.out.println(data.length + " items read from Unicode spec file " + UnicodeSpecFileName); // liu } - long[] map = buildMap(data, specialCaseMaps); + long[] map = buildMap(data, specialCaseMaps, propList); if (verbose) { System.err.println("Completed building of initial map"); } diff --git a/jdk/make/tools/src/build/tools/generatecharacter/PropList.java b/jdk/make/tools/src/build/tools/generatecharacter/PropList.java new file mode 100644 index 00000000000..4591d5d6678 --- /dev/null +++ b/jdk/make/tools/src/build/tools/generatecharacter/PropList.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package build.tools.generatecharacter; + +import java.util.regex.*; +import java.util.*; +import java.io.*; + +/** + * A PropList object contains the lists of code points that have + * the same Unicode property defined in PropList.txt + * + * @author Xueming Shen + */ +public class PropList { + + public static PropList readSpecFile(File file, int plane) + throws IOException + { + return new PropList(file, plane); + } + + public List codepoints(String name) { + return propMap.get(name); + } + + public Set names() { + return propMap.keySet(); + } + + private Map> propMap = + new LinkedHashMap>(); + + private PropList(File file, int plane) throws IOException { + + int i, j; + BufferedReader sbfr = new BufferedReader(new FileReader(file)); + Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s*;\\s+(\\w+)\\s+#.*").matcher(""); + String line = null; + int lineNo = 0; + while ((line = sbfr.readLine()) != null) { + lineNo++; + if (line.length() <= 1 || line.charAt(0) == '#') { + continue; + } + m.reset(line); + if (m.matches()) { + int start = Integer.parseInt(m.group(1), 16); + if ((start >> 16) != plane) + continue; + int end = (m.group(2)==null)?start + :Integer.parseInt(m.group(2), 16); + String name = m.group(3); + + start &= 0xffff; + end &= 0xffff; + + ArrayList list = propMap.get(name); + if (list == null) { + list = new ArrayList(); + propMap.put(name, list); + } + while (start <= end) + list.add(start++); + } else { + System.out.printf("Warning: Unrecognized line %d <%s>%n", lineNo, line); + } + } + sbfr.close(); + + //for (String name: propMap.keySet()) { + // System.out.printf("%s %d%n", name, propMap.get(name).size()); + //} + } + + public static void main(String[] args) throws IOException { + readSpecFile(new File(args[0]), Integer.decode(args[1])); + } +} diff --git a/jdk/src/share/classes/java/lang/Character.java b/jdk/src/share/classes/java/lang/Character.java index e52a83a84b1..216098bd533 100644 --- a/jdk/src/share/classes/java/lang/Character.java +++ b/jdk/src/share/classes/java/lang/Character.java @@ -59,14 +59,14 @@ import java.util.Locale; *

    The {@code char} data type (and therefore the value that a * {@code Character} object encapsulates) are based on the * original Unicode specification, which defined characters as - * fixed-width 16-bit entities. The Unicode standard has since been + * fixed-width 16-bit entities. The Unicode Standard has since been * changed to allow for characters whose representation requires more * than 16 bits. The range of legal code points is now * U+0000 to U+10FFFF, known as Unicode scalar value. * (Refer to the * definition of the U+n notation in the Unicode - * standard.) + * Standard.) * *

    The set of characters from U+0000 to U+FFFF is * sometimes referred to as the Basic Multilingual Plane (BMP). @@ -5200,7 +5200,8 @@ class Character implements java.io.Serializable, Comparable { *

    * A character is lowercase if its general category type, provided * by {@code Character.getType(ch)}, is - * {@code LOWERCASE_LETTER}. + * {@code LOWERCASE_LETTER}, or it has contributory property + * Other_Lowercase as defined by the Unicode Standard. *

    * The following are examples of lowercase characters: *

    @@ -5235,7 +5236,8 @@ class Character implements java.io.Serializable, Comparable {
          * 

    * A character is lowercase if its general category type, provided * by {@link Character#getType getType(codePoint)}, is - * {@code LOWERCASE_LETTER}. + * {@code LOWERCASE_LETTER}, or it has contributory property + * Other_Lowercase as defined by the Unicode Standard. *

    * The following are examples of lowercase characters: *

    @@ -5257,7 +5259,8 @@ class Character implements java.io.Serializable, Comparable {
          * @since   1.5
          */
         public static boolean isLowerCase(int codePoint) {
    -        return getType(codePoint) == Character.LOWERCASE_LETTER;
    +        return getType(codePoint) == Character.LOWERCASE_LETTER ||
    +               CharacterData.of(codePoint).isOtherLowercase(codePoint);
         }
     
         /**
    @@ -5265,6 +5268,7 @@ class Character implements java.io.Serializable, Comparable {
          * 

    * A character is uppercase if its general category type, provided by * {@code Character.getType(ch)}, is {@code UPPERCASE_LETTER}. + * or it has contributory property Other_Uppercase as defined by the Unicode Standard. *

    * The following are examples of uppercase characters: *

    @@ -5298,7 +5302,8 @@ class Character implements java.io.Serializable, Comparable {
          * Determines if the specified character (Unicode code point) is an uppercase character.
          * 

    * A character is uppercase if its general category type, provided by - * {@link Character#getType(int) getType(codePoint)}, is {@code UPPERCASE_LETTER}. + * {@link Character#getType(int) getType(codePoint)}, is {@code UPPERCASE_LETTER}, + * or it has contributory property Other_Uppercase as defined by the Unicode Standard. *

    * The following are examples of uppercase characters: *

    @@ -5320,7 +5325,8 @@ class Character implements java.io.Serializable, Comparable {
          * @since   1.5
          */
         public static boolean isUpperCase(int codePoint) {
    -        return getType(codePoint) == Character.UPPERCASE_LETTER;
    +        return getType(codePoint) == Character.UPPERCASE_LETTER ||
    +               CharacterData.of(codePoint).isOtherUppercase(codePoint);
         }
     
         /**
    @@ -5724,6 +5730,52 @@ class Character implements java.io.Serializable, Comparable {
             return isJavaIdentifierPart(ch);
         }
     
    +    /**
    +     * Determines if the specified character (Unicode code point) is an alphabet.
    +     * 

    + * A character is considered to be alphabetic if its general category type, + * provided by {@link Character#getType(int) getType(codePoint)}, is any of + * the following: + *

      + *
    • UPPERCASE_LETTER + *
    • LOWERCASE_LETTER + *
    • TITLECASE_LETTER + *
    • MODIFIER_LETTER + *
    • OTHER_LETTER + *
    • LETTER_NUMBER + *
    + * or it has contributory property Other_Alphabetic as defined by the + * Unicode Standard. + * + * @param codePoint the character (Unicode code point) to be tested. + * @return true if the character is a Unicode alphabet + * character, false otherwise. + * @since 1.7 + */ + public static boolean isAlphabetic(int codePoint) { + return (((((1 << Character.UPPERCASE_LETTER) | + (1 << Character.LOWERCASE_LETTER) | + (1 << Character.TITLECASE_LETTER) | + (1 << Character.MODIFIER_LETTER) | + (1 << Character.OTHER_LETTER) | + (1 << Character.LETTER_NUMBER)) >> getType(codePoint)) & 1) != 0) || + CharacterData.of(codePoint).isOtherAlphabetic(codePoint); + } + + /** + * Determines if the specified character (Unicode code point) is a CJKV + * (Chinese, Japanese, Korean and Vietnamese) ideograph, as defined by + * the Unicode Standard. + * + * @param codePoint the character (Unicode code point) to be tested. + * @return true if the character is a Unicode ideograph + * character, false otherwise. + * @since 1.7 + */ + public static boolean isIdeographic(int codePoint) { + return CharacterData.of(codePoint).isIdeographic(codePoint); + } + /** * Determines if the specified character is * permissible as the first character in a Java identifier. @@ -6430,7 +6482,7 @@ class Character implements java.io.Serializable, Comparable { /** * Determines if the specified character is a Unicode space character. * A character is considered to be a space character if and only if - * it is specified to be a space character by the Unicode standard. This + * it is specified to be a space character by the Unicode Standard. This * method returns true if the character's general category type is any of * the following: *