Merge
This commit is contained in:
commit
def1ac3acc
@ -327,7 +327,7 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
|
||||
|
||||
# Only enable Shenandoah on supported arches
|
||||
AC_MSG_CHECKING([if shenandoah can be built])
|
||||
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86" || test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
|
||||
if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
DISABLED_JVM_FEATURES="$DISABLED_JVM_FEATURES shenandoahgc"
|
||||
|
@ -539,6 +539,12 @@ class Assembler : public AbstractAssembler {
|
||||
XVSUBDP_OPCODE = (60u << OPCODE_SHIFT | 104u << 3),
|
||||
XVMULSP_OPCODE = (60u << OPCODE_SHIFT | 80u << 3),
|
||||
XVMULDP_OPCODE = (60u << OPCODE_SHIFT | 112u << 3),
|
||||
XVMADDASP_OPCODE=(60u << OPCODE_SHIFT | 65u << 3),
|
||||
XVMADDADP_OPCODE=(60u << OPCODE_SHIFT | 97u << 3),
|
||||
XVMSUBASP_OPCODE=(60u << OPCODE_SHIFT | 81u << 3),
|
||||
XVMSUBADP_OPCODE=(60u << OPCODE_SHIFT | 113u << 3),
|
||||
XVNMSUBASP_OPCODE=(60u<< OPCODE_SHIFT | 209u << 3),
|
||||
XVNMSUBADP_OPCODE=(60u<< OPCODE_SHIFT | 241u << 3),
|
||||
|
||||
// Deliver A Random Number (introduced with POWER9)
|
||||
DARN_OPCODE = (31u << OPCODE_SHIFT | 755u << 1),
|
||||
@ -2227,6 +2233,12 @@ class Assembler : public AbstractAssembler {
|
||||
inline void xvsubdp( VectorSRegister d, VectorSRegister a, VectorSRegister b);
|
||||
inline void xvmulsp( VectorSRegister d, VectorSRegister a, VectorSRegister b);
|
||||
inline void xvmuldp( VectorSRegister d, VectorSRegister a, VectorSRegister b);
|
||||
inline void xvmaddasp(VectorSRegister d, VectorSRegister a, VectorSRegister b);
|
||||
inline void xvmaddadp(VectorSRegister d, VectorSRegister a, VectorSRegister b);
|
||||
inline void xvmsubasp(VectorSRegister d, VectorSRegister a, VectorSRegister b);
|
||||
inline void xvmsubadp(VectorSRegister d, VectorSRegister a, VectorSRegister b);
|
||||
inline void xvnmsubasp(VectorSRegister d, VectorSRegister a, VectorSRegister b);
|
||||
inline void xvnmsubadp(VectorSRegister d, VectorSRegister a, VectorSRegister b);
|
||||
|
||||
// VSX Extended Mnemonics
|
||||
inline void xxspltd( VectorSRegister d, VectorSRegister a, int x);
|
||||
|
@ -790,6 +790,12 @@ inline void Assembler::xvadddp( VectorSRegister d, VectorSRegister a, VectorSReg
|
||||
inline void Assembler::xvsubdp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVSUBDP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
|
||||
inline void Assembler::xvmulsp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVMULSP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
|
||||
inline void Assembler::xvmuldp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVMULDP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
|
||||
inline void Assembler::xvmaddasp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVMADDASP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
|
||||
inline void Assembler::xvmaddadp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVMADDADP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
|
||||
inline void Assembler::xvmsubasp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVMSUBASP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
|
||||
inline void Assembler::xvmsubadp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVMSUBADP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
|
||||
inline void Assembler::xvnmsubasp(VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVNMSUBASP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
|
||||
inline void Assembler::xvnmsubadp(VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVNMSUBADP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
|
||||
inline void Assembler::mtvrd( VectorRegister d, Register a) { emit_int32( MTVSRD_OPCODE | vsrt(d->to_vsr()) | ra(a)); }
|
||||
inline void Assembler::mfvrd( Register a, VectorRegister d) { emit_int32( MFVSRD_OPCODE | vsrt(d->to_vsr()) | ra(a)); }
|
||||
inline void Assembler::mtvrwz( VectorRegister d, Register a) { emit_int32( MTVSRWZ_OPCODE | vsrt(d->to_vsr()) | ra(a)); }
|
||||
|
@ -2257,6 +2257,9 @@ const bool Matcher::match_rule_supported(int opcode) {
|
||||
return SuperwordUseVSX;
|
||||
case Op_PopCountVI:
|
||||
return (SuperwordUseVSX && UsePopCountInstruction);
|
||||
case Op_FmaVF:
|
||||
case Op_FmaVD:
|
||||
return (SuperwordUseVSX && UseFMA);
|
||||
case Op_Digit:
|
||||
case Op_LowerCase:
|
||||
case Op_UpperCase:
|
||||
@ -14475,6 +14478,92 @@ instruct vpopcnt4I_reg(vecX dst, vecX src) %{
|
||||
ins_pipe(pipe_class_default);
|
||||
%}
|
||||
|
||||
// --------------------------------- FMA --------------------------------------
|
||||
// dst + src1 * src2
|
||||
instruct vfma4F(vecX dst, vecX src1, vecX src2) %{
|
||||
match(Set dst (FmaVF dst (Binary src1 src2)));
|
||||
predicate(n->as_Vector()->length() == 4);
|
||||
|
||||
format %{ "XVMADDASP $dst, $src1, $src2" %}
|
||||
|
||||
size(4);
|
||||
ins_encode %{
|
||||
__ xvmaddasp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
|
||||
%}
|
||||
ins_pipe(pipe_class_default);
|
||||
%}
|
||||
|
||||
// dst - src1 * src2
|
||||
instruct vfma4F_neg1(vecX dst, vecX src1, vecX src2) %{
|
||||
match(Set dst (FmaVF dst (Binary (NegVF src1) src2)));
|
||||
match(Set dst (FmaVF dst (Binary src1 (NegVF src2))));
|
||||
predicate(n->as_Vector()->length() == 4);
|
||||
|
||||
format %{ "XVNMSUBASP $dst, $src1, $src2" %}
|
||||
|
||||
size(4);
|
||||
ins_encode %{
|
||||
__ xvnmsubasp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
|
||||
%}
|
||||
ins_pipe(pipe_class_default);
|
||||
%}
|
||||
|
||||
// - dst + src1 * src2
|
||||
instruct vfma4F_neg2(vecX dst, vecX src1, vecX src2) %{
|
||||
match(Set dst (FmaVF (NegVF dst) (Binary src1 src2)));
|
||||
predicate(n->as_Vector()->length() == 4);
|
||||
|
||||
format %{ "XVMSUBASP $dst, $src1, $src2" %}
|
||||
|
||||
size(4);
|
||||
ins_encode %{
|
||||
__ xvmsubasp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
|
||||
%}
|
||||
ins_pipe(pipe_class_default);
|
||||
%}
|
||||
|
||||
// dst + src1 * src2
|
||||
instruct vfma2D(vecX dst, vecX src1, vecX src2) %{
|
||||
match(Set dst (FmaVD dst (Binary src1 src2)));
|
||||
predicate(n->as_Vector()->length() == 2);
|
||||
|
||||
format %{ "XVMADDADP $dst, $src1, $src2" %}
|
||||
|
||||
size(4);
|
||||
ins_encode %{
|
||||
__ xvmaddadp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
|
||||
%}
|
||||
ins_pipe(pipe_class_default);
|
||||
%}
|
||||
|
||||
// dst - src1 * src2
|
||||
instruct vfma2D_neg1(vecX dst, vecX src1, vecX src2) %{
|
||||
match(Set dst (FmaVD dst (Binary (NegVD src1) src2)));
|
||||
match(Set dst (FmaVD dst (Binary src1 (NegVD src2))));
|
||||
predicate(n->as_Vector()->length() == 2);
|
||||
|
||||
format %{ "XVNMSUBADP $dst, $src1, $src2" %}
|
||||
|
||||
size(4);
|
||||
ins_encode %{
|
||||
__ xvnmsubadp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
|
||||
%}
|
||||
ins_pipe(pipe_class_default);
|
||||
%}
|
||||
|
||||
// - dst + src1 * src2
|
||||
instruct vfma2D_neg2(vecX dst, vecX src1, vecX src2) %{
|
||||
match(Set dst (FmaVD (NegVD dst) (Binary src1 src2)));
|
||||
predicate(n->as_Vector()->length() == 2);
|
||||
|
||||
format %{ "XVMSUBADP $dst, $src1, $src2" %}
|
||||
|
||||
size(4);
|
||||
ins_encode %{
|
||||
__ xvmsubadp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
|
||||
%}
|
||||
ins_pipe(pipe_class_default);
|
||||
%}
|
||||
|
||||
//----------Overflow Math Instructions-----------------------------------------
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "runtime/stubRoutines.hpp"
|
||||
#include "macroAssembler_x86.hpp"
|
||||
|
||||
#ifdef _LP64
|
||||
// Multiply 128 x 128 bits, using 4 pclmulqdq operations
|
||||
void MacroAssembler::schoolbookAAD(int i, Register htbl, XMMRegister data,
|
||||
XMMRegister tmp0, XMMRegister tmp1, XMMRegister tmp2, XMMRegister tmp3) {
|
||||
@ -319,4 +320,5 @@ void MacroAssembler::avx_ghash(Register input_state, Register htbl,
|
||||
vpxor(xmm1, xmm1, xmm1, Assembler::AVX_128bit);
|
||||
vpxor(xmm3, xmm3, xmm3, Assembler::AVX_128bit);
|
||||
vpxor(xmm15, xmm15, xmm15, Assembler::AVX_128bit);
|
||||
}
|
||||
}
|
||||
#endif // _LP64
|
||||
|
@ -1354,9 +1354,11 @@ void os::shutdown() {
|
||||
void os::abort(bool dump_core, void* siginfo, const void* context) {
|
||||
os::shutdown();
|
||||
if (dump_core) {
|
||||
#if INCLUDE_CDS
|
||||
if (UseSharedSpaces && DumpPrivateMappingsInCore) {
|
||||
ClassLoader::close_jrt_image();
|
||||
}
|
||||
#endif
|
||||
#ifndef PRODUCT
|
||||
fdStream out(defaultStream::output_fd());
|
||||
out.print_raw("Current thread is ");
|
||||
@ -5075,9 +5077,11 @@ jint os::init_2(void) {
|
||||
set_coredump_filter(DAX_SHARED_BIT);
|
||||
}
|
||||
|
||||
#if INCLUDE_CDS
|
||||
if (UseSharedSpaces && DumpPrivateMappingsInCore) {
|
||||
set_coredump_filter(FILE_BACKED_PVT_BIT);
|
||||
}
|
||||
#endif
|
||||
|
||||
return JNI_OK;
|
||||
}
|
||||
|
@ -939,9 +939,6 @@ void ShenandoahConcurrentMark::mark_loop_work(T* cl, jushort* live_data, uint wo
|
||||
q = queues->claim_next();
|
||||
while (q != NULL) {
|
||||
if (CANCELLABLE && heap->check_cancelled_gc_and_yield()) {
|
||||
ShenandoahCancelledTerminatorTerminator tt;
|
||||
ShenandoahSuspendibleThreadSetLeaver stsl(ShenandoahSuspendibleWorkers);
|
||||
while (!terminator->offer_termination(&tt));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -965,9 +962,6 @@ void ShenandoahConcurrentMark::mark_loop_work(T* cl, jushort* live_data, uint wo
|
||||
*/
|
||||
while (true) {
|
||||
if (CANCELLABLE && heap->check_cancelled_gc_and_yield()) {
|
||||
ShenandoahCancelledTerminatorTerminator tt;
|
||||
ShenandoahSuspendibleThreadSetLeaver stsl(ShenandoahSuspendibleWorkers);
|
||||
while (!terminator->offer_termination(&tt));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -991,7 +985,8 @@ void ShenandoahConcurrentMark::mark_loop_work(T* cl, jushort* live_data, uint wo
|
||||
// Need to leave the STS here otherwise it might block safepoints.
|
||||
ShenandoahSuspendibleThreadSetLeaver stsl(CANCELLABLE && ShenandoahSuspendibleWorkers);
|
||||
ShenandoahTerminationTimingsTracker term_tracker(worker_id);
|
||||
if (terminator->offer_termination()) return;
|
||||
ShenandoahTerminatorTerminator tt(heap);
|
||||
if (terminator->offer_termination(&tt)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,28 +49,8 @@ bool ShenandoahObjToScanQueueSet::is_empty() {
|
||||
return true;
|
||||
}
|
||||
|
||||
class ShenandoahOWSTTerminator: public OWSTTaskTerminator {
|
||||
public:
|
||||
ShenandoahOWSTTerminator(uint n_threads, TaskQueueSetSuper* queue_set) :
|
||||
OWSTTaskTerminator(n_threads, queue_set){ }
|
||||
|
||||
protected:
|
||||
bool exit_termination(size_t tasks, TerminatorTerminator* terminator);
|
||||
};
|
||||
|
||||
bool ShenandoahOWSTTerminator::exit_termination(size_t tasks, TerminatorTerminator* terminator) {
|
||||
ShenandoahTerminatorTerminator* t = (ShenandoahTerminatorTerminator*)terminator;
|
||||
bool force = (t != NULL) && t->should_force_termination();
|
||||
if (force) {
|
||||
// Force termination : continue termination, even there are remaining tasks.
|
||||
return false;
|
||||
} else {
|
||||
return OWSTTaskTerminator::exit_termination(tasks, terminator);
|
||||
}
|
||||
}
|
||||
|
||||
ShenandoahTaskTerminator::ShenandoahTaskTerminator(uint n_threads, TaskQueueSetSuper* queue_set) :
|
||||
_terminator(new ShenandoahOWSTTerminator(n_threads, queue_set)) { }
|
||||
_terminator(new OWSTTaskTerminator(n_threads, queue_set)) { }
|
||||
|
||||
ShenandoahTaskTerminator::~ShenandoahTaskTerminator() {
|
||||
assert(_terminator != NULL, "Invariant");
|
||||
|
@ -306,18 +306,12 @@ public:
|
||||
};
|
||||
|
||||
class ShenandoahTerminatorTerminator : public TerminatorTerminator {
|
||||
private:
|
||||
ShenandoahHeap* _heap;
|
||||
public:
|
||||
ShenandoahTerminatorTerminator(ShenandoahHeap* const heap) : _heap(heap) { }
|
||||
// return true, terminates immediately, even if there's remaining work left
|
||||
virtual bool should_force_termination() { return false; }
|
||||
};
|
||||
|
||||
class ShenandoahCancelledTerminatorTerminator : public ShenandoahTerminatorTerminator {
|
||||
virtual bool should_exit_termination() {
|
||||
return false;
|
||||
}
|
||||
virtual bool should_force_termination() {
|
||||
return true;
|
||||
}
|
||||
virtual bool should_exit_termination() { return _heap->cancelled_gc(); }
|
||||
};
|
||||
|
||||
class ShenandoahTaskTerminator : public StackObj {
|
||||
|
@ -498,10 +498,6 @@ void ShenandoahTraversalGC::main_loop_work(T* cl, jushort* live_data, uint worke
|
||||
q = queues->claim_next();
|
||||
while (q != NULL) {
|
||||
if (_heap->check_cancelled_gc_and_yield(sts_yield)) {
|
||||
ShenandoahCancelledTerminatorTerminator tt;
|
||||
ShenandoahEvacOOMScopeLeaver oom_scope_leaver;
|
||||
ShenandoahSuspendibleThreadSetLeaver stsl(sts_yield && ShenandoahSuspendibleWorkers);
|
||||
while (!terminator->offer_termination(&tt));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -547,17 +543,15 @@ void ShenandoahTraversalGC::main_loop_work(T* cl, jushort* live_data, uint worke
|
||||
ShenandoahEvacOOMScopeLeaver oom_scope_leaver;
|
||||
ShenandoahSuspendibleThreadSetLeaver stsl(sts_yield && ShenandoahSuspendibleWorkers);
|
||||
ShenandoahTerminationTimingsTracker term_tracker(worker_id);
|
||||
if (terminator->offer_termination()) return;
|
||||
ShenandoahTerminatorTerminator tt(_heap);
|
||||
|
||||
if (terminator->offer_termination(&tt)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ShenandoahTraversalGC::check_and_handle_cancelled_gc(ShenandoahTaskTerminator* terminator, bool sts_yield) {
|
||||
if (_heap->cancelled_gc()) {
|
||||
ShenandoahCancelledTerminatorTerminator tt;
|
||||
ShenandoahEvacOOMScopeLeaver oom_scope_leaver;
|
||||
ShenandoahSuspendibleThreadSetLeaver stsl(sts_yield && ShenandoahSuspendibleWorkers);
|
||||
while (! terminator->offer_termination(&tt));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "jfr/recorder/checkpoint/jfrMetadataEvent.hpp"
|
||||
#include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp"
|
||||
#include "jfr/recorder/repository/jfrRepository.hpp"
|
||||
#include "jfr/recorder/repository/jfrChunkSizeNotifier.hpp"
|
||||
#include "jfr/recorder/repository/jfrChunkRotation.hpp"
|
||||
#include "jfr/recorder/repository/jfrChunkWriter.hpp"
|
||||
#include "jfr/recorder/service/jfrOptionSet.hpp"
|
||||
#include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
|
||||
@ -114,7 +114,7 @@ NO_TRANSITION(void, jfr_set_enabled(JNIEnv* env, jobject jvm, jlong event_type_i
|
||||
NO_TRANSITION_END
|
||||
|
||||
NO_TRANSITION(void, jfr_set_file_notification(JNIEnv* env, jobject jvm, jlong threshold))
|
||||
JfrChunkSizeNotifier::set_chunk_size_threshold((size_t)threshold);
|
||||
JfrChunkRotation::set_threshold((intptr_t)threshold);
|
||||
NO_TRANSITION_END
|
||||
|
||||
NO_TRANSITION(void, jfr_set_sample_threads(JNIEnv* env, jobject jvm, jboolean sampleThreads))
|
||||
@ -173,6 +173,9 @@ NO_TRANSITION(jboolean, jfr_set_cutoff(JNIEnv* env, jobject jvm, jlong event_typ
|
||||
return JfrEventSetting::set_cutoff(event_type_id, cutoff_ticks) ? JNI_TRUE : JNI_FALSE;
|
||||
NO_TRANSITION_END
|
||||
|
||||
NO_TRANSITION(jboolean, jfr_should_rotate_disk(JNIEnv* env, jobject jvm))
|
||||
return JfrChunkRotation::should_rotate() ? JNI_TRUE : JNI_FALSE;
|
||||
NO_TRANSITION_END
|
||||
|
||||
/*
|
||||
* JVM_ENTRY_NO_ENV entries
|
||||
|
@ -129,6 +129,9 @@ jboolean JNICALL jfr_set_cutoff(JNIEnv* env, jobject jvm, jlong event_type_id, j
|
||||
|
||||
void JNICALL jfr_emit_old_object_samples(JNIEnv* env, jobject jvm, jlong cutoff_ticks, jboolean);
|
||||
|
||||
jboolean JNICALL jfr_should_rotate_disk(JNIEnv* env, jobject jvm);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -78,7 +78,8 @@ JfrJniMethodRegistration::JfrJniMethodRegistration(JNIEnv* env) {
|
||||
(char*)"setForceInstrumentation", (char*)"(Z)V", (void*)jfr_set_force_instrumentation,
|
||||
(char*)"getUnloadedEventClassCount", (char*)"()J", (void*)jfr_get_unloaded_event_classes_count,
|
||||
(char*)"setCutoff", (char*)"(JJ)Z", (void*)jfr_set_cutoff,
|
||||
(char*)"emitOldObjectSamples", (char*)"(JZ)V", (void*)jfr_emit_old_object_samples
|
||||
(char*)"emitOldObjectSamples", (char*)"(JZ)V", (void*)jfr_emit_old_object_samples,
|
||||
(char*)"shouldRotateDisk", (char*)"()Z", (void*)jfr_should_rotate_disk
|
||||
};
|
||||
|
||||
const size_t method_array_length = sizeof(method) / sizeof(JNINativeMethod);
|
||||
|
@ -185,7 +185,7 @@ static int array_size(const oop object) {
|
||||
if (object->is_array()) {
|
||||
return arrayOop(object)->length();
|
||||
}
|
||||
return -1;
|
||||
return min_jint;
|
||||
}
|
||||
|
||||
void EmitEventOperation::write_event(const ObjectSample* sample, EdgeStore* edge_store) {
|
||||
|
@ -65,19 +65,19 @@
|
||||
<Field type="InflateCause" name="cause" label="Monitor Inflation Cause" description="Cause of inflation" />
|
||||
</Event>
|
||||
|
||||
<Event name="BiasedLockRevocation" category="Java Application" label="Biased Lock Revocation" description="Revoked bias of object" thread="true"
|
||||
<Event name="BiasedLockRevocation" category="Java Virtual Machine, Runtime" label="Biased Lock Revocation" description="Revoked bias of object" thread="true"
|
||||
stackTrace="true">
|
||||
<Field type="Class" name="lockClass" label="Lock Class" description="Class of object whose biased lock was revoked" />
|
||||
<Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
|
||||
<Field type="Thread" name="previousOwner" label="Previous Owner" description="Thread owning the bias before revocation" />
|
||||
</Event>
|
||||
|
||||
<Event name="BiasedLockSelfRevocation" category="Java Application" label="Biased Lock Self Revocation" description="Revoked bias of object biased towards own thread"
|
||||
<Event name="BiasedLockSelfRevocation" category="Java Virtual Machine, Runtime" label="Biased Lock Self Revocation" description="Revoked bias of object biased towards own thread"
|
||||
thread="true" stackTrace="true">
|
||||
<Field type="Class" name="lockClass" label="Lock Class" description="Class of object whose biased lock was revoked" />
|
||||
</Event>
|
||||
|
||||
<Event name="BiasedLockClassRevocation" category="Java Application" label="Biased Lock Class Revocation" description="Revoked biases for all instances of a class"
|
||||
<Event name="BiasedLockClassRevocation" category="Java Virtual Machine, Runtime" label="Biased Lock Class Revocation" description="Revoked biases for all instances of a class"
|
||||
thread="true" stackTrace="true">
|
||||
<Field type="Class" name="revokedClass" label="Revoked Class" description="Class whose biased locks were revoked" />
|
||||
<Field type="boolean" name="disableBiasing" label="Disable Further Biasing" description="Whether further biasing for instances of this class will be allowed" />
|
||||
@ -350,7 +350,7 @@
|
||||
<Field type="ulong" contentType="bytes" name="recentMutatorAllocationSize" label="Recent Mutator Allocation Size"
|
||||
description="Mutator allocation during mutator operation in the most recent interval" />
|
||||
<Field type="long" contentType="millis" name="recentMutatorDuration" label="Recent Mutator Duration" description="Time the mutator ran in the most recent interval" />
|
||||
<Field type="double" name="recentAllocationRate" label="Recent Allocation Rate" description="Allocation rate of the mutator in the most recent interval in bytes/second" />
|
||||
<Field type="double" contentType="bytes-per-second" name="recentAllocationRate" label="Recent Allocation Rate" description="Allocation rate of the mutator in the most recent interval in bytes/second" />
|
||||
<Field type="long" contentType="millis" name="lastMarkingDuration" label="Last Marking Duration" description="Last time from the end of the last initial mark to the first mixed GC" />
|
||||
</Event>
|
||||
|
||||
@ -362,7 +362,7 @@
|
||||
<Field type="ulong" contentType="bytes" name="ihopTargetOccupancy" label="IHOP Target Occupancy" description="Internal target old generation occupancy to reach at the start of mixed GC" />
|
||||
<Field type="ulong" contentType="bytes" name="currentOccupancy" label="Current Occupancy" description="Current old generation occupancy" />
|
||||
<Field type="ulong" contentType="bytes" name="additionalBufferSize" label="Additional Buffer" description="Additional buffer size" experimental="true" />
|
||||
<Field type="double" name="predictedAllocationRate" label="Predicted Allocation Rate" description="Current predicted allocation rate for the mutator in bytes/second" />
|
||||
<Field type="double" contentType="bytes-per-second" name="predictedAllocationRate" label="Predicted Allocation Rate" description="Current predicted allocation rate for the mutator in bytes/second" />
|
||||
<Field type="long" contentType="millis" name="predictedMarkingDuration" label="Predicted Marking Duration"
|
||||
description="Current predicted time from the end of the last initial mark to the first mixed GC" />
|
||||
<Field type="boolean" name="predictionActive" label="Prediction Active" description="Indicates whether the adaptive IHOP prediction is active" />
|
||||
@ -564,9 +564,9 @@
|
||||
relation="SafepointId" />
|
||||
</Event>
|
||||
|
||||
<Event name="Shutdown" category="Java Virtual Machine, Runtime" label="VM Shutdown" description="VM shutting down" thread="true" stackTrace="true"
|
||||
<Event name="Shutdown" category="Java Virtual Machine, Runtime" label="JVM Shutdown" description="JVM shutting down" thread="true" stackTrace="true"
|
||||
startTime="false">
|
||||
<Field type="string" name="reason" label="Reason" description="Reason for VM shutdown" />
|
||||
<Field type="string" name="reason" label="Reason" description="Reason for JVM shutdown" />
|
||||
</Event>
|
||||
|
||||
<Event name="ObjectAllocationInNewTLAB" category="Java Application" label="Allocation in new TLAB" description="Allocation in new Thread Local Allocation Buffer"
|
||||
@ -582,7 +582,7 @@
|
||||
<Field type="ulong" contentType="bytes" name="allocationSize" label="Allocation Size" />
|
||||
</Event>
|
||||
|
||||
<Event name="OldObjectSample" category="Java Application" label="Old Object Sample" description="A potential memory leak" stackTrace="true" thread="true"
|
||||
<Event name="OldObjectSample" category="Java Virtual Machine, Profiling" label="Old Object Sample" description="A potential memory leak" stackTrace="true" thread="true"
|
||||
startTime="false" cutoff="true">
|
||||
<Field type="Ticks" name="allocationTime" label="Allocation Time" />
|
||||
<Field type="ulong" contentType="bytes" name="lastKnownHeapUsage" label="Last Known Heap Usage" />
|
||||
@ -647,8 +647,8 @@
|
||||
<Event name="CPUTimeStampCounter" category="Operating System, Processor" label="CPU Time Stamp Counter" period="endChunk">
|
||||
<Field type="boolean" name="fastTimeEnabled" label="Fast Time" />
|
||||
<Field type="boolean" name="fastTimeAutoEnabled" label="Trusted Platform" />
|
||||
<Field type="long" name="osFrequency" label="OS Frequency Per Second" />
|
||||
<Field type="long" name="fastTimeFrequency" label="Fast Time Frequency per Second" />
|
||||
<Field type="long" contentType="hertz" name="osFrequency" label="OS Frequency" />
|
||||
<Field type="long" contentType="hertz" name="fastTimeFrequency" label="Fast Time Frequency" />
|
||||
</Event>
|
||||
|
||||
<Event name="CPULoad" category="Operating System, Processor" label="CPU Load" description="OS CPU Load" period="everyChunk">
|
||||
@ -663,13 +663,13 @@
|
||||
</Event>
|
||||
|
||||
<Event name="ThreadContextSwitchRate" category="Operating System, Processor" label="Thread Context Switch Rate" period="everyChunk">
|
||||
<Field type="float" name="switchRate" label="Switch Rate" description="Number of context switches per second" />
|
||||
<Field type="float" contentType="hertz" name="switchRate" label="Switch Rate" description="Number of context switches per second" />
|
||||
</Event>
|
||||
|
||||
<Event name="NetworkUtilization" category="Operating System, Network" label="Network Utilization" period="everyChunk">
|
||||
<Field type="NetworkInterfaceName" name="networkInterface" label="Network Interface" description="Network Interface Name"/>
|
||||
<Field type="long" contentType="bytes" name="readRate" label="Read Rate" description="Number of incoming bytes per second"/>
|
||||
<Field type="long" contentType="bytes" name="writeRate" label="Write Rate" description="Number of outgoing bytes per second"/>
|
||||
<Field type="long" contentType="bits-per-second" name="readRate" label="Read Rate" description="Number of incoming bits per second"/>
|
||||
<Field type="long" contentType="bits-per-second" name="writeRate" label="Write Rate" description="Number of outgoing bits per second"/>
|
||||
</Event>
|
||||
|
||||
<Event name="JavaThreadStatistics" category="Java Application, Statistics" label="Java Thread Statistics" period="everyChunk">
|
||||
@ -687,7 +687,7 @@
|
||||
<Event name="ClassLoaderStatistics" category="Java Application, Statistics" label="Class Loader Statistics" period="everyChunk">
|
||||
<Field type="ClassLoader" name="classLoader" label="Class Loader" />
|
||||
<Field type="ClassLoader" name="parentClassLoader" label="Parent Class Loader" />
|
||||
<Field type="ulong" contentType="address" name="classLoaderData" label="ClassLoaderData pointer" description="Pointer to the ClassLoaderData structure in the JVM" />
|
||||
<Field type="ulong" contentType="address" name="classLoaderData" label="ClassLoaderData Pointer" description="Pointer to the ClassLoaderData structure in the JVM" />
|
||||
<Field type="long" name="classCount" label="Classes" description="Number of loaded classes" />
|
||||
<Field type="ulong" contentType="bytes" name="chunkSize" label="Total Chunk Size" description="Total size of all allocated metaspace chunks (each chunk has several blocks)" />
|
||||
<Field type="ulong" contentType="bytes" name="blockSize" label="Total Block Size" description="Total size of all allocated metaspace blocks (each chunk has several blocks)" />
|
||||
@ -741,8 +741,7 @@
|
||||
<Event name="ModuleExport" category="Java Virtual Machine, Runtime, Modules" label="Module Export" thread="false" period="everyChunk">
|
||||
<Field type="Package" name="exportedPackage" label="Exported Package" />
|
||||
<Field type="Module" name="targetModule" label="Target Module"
|
||||
description="Module to which the package is qualifiedly exported.
|
||||
If null, the package is unqualifiedly exported" />
|
||||
description="Module to which the package is qualifiedly exported. If null or N/A, the package is unqualifiedly exported" />
|
||||
</Event>
|
||||
|
||||
<Event name="CompilerStatistics" category="Java Virtual Machine, Compiler" label="Compiler Statistics" thread="false" period="everyChunk" startTime="false">
|
||||
@ -1096,7 +1095,7 @@
|
||||
<Field type="OldObjectArray" name="array" label="Array Information" description="Array or null if it is not an array" />
|
||||
<Field type="OldObjectField" name="field" label="Field Information" description="Field or null if it is an array" />
|
||||
<Field type="OldObject" name="object" label="Object" description="Object holder for this reference" />
|
||||
<Field type="int" name="skip" label="Skip value" description="The object is this many hops away" />
|
||||
<Field type="int" name="skip" label="Skip Value" description="The object is this many hops away" />
|
||||
</Type>
|
||||
|
||||
<Type name="StackFrame">
|
||||
@ -1134,13 +1133,16 @@
|
||||
<XmlType name="char" javaType="char" parameterType="char" fieldType="char"/>
|
||||
<XmlType name="string" javaType="java.lang.String" parameterType="const char*" fieldType="const char*"/>
|
||||
|
||||
<XmlContentType name="bytes" annotationType="jdk.jfr.DataAmount" annotationValue="BYTES" />
|
||||
<XmlContentType name="tickstamp" annotationType="jdk.jfr.Timestamp" annotationValue="TICKS" />
|
||||
<XmlContentType name="epochmillis" annotationType="jdk.jfr.Timestamp" annotationValue="MILLISECONDS_SINCE_EPOCH" />
|
||||
<XmlContentType name="tickspan" annotationType="jdk.jfr.Timespan" annotationValue="TICKS" />
|
||||
<XmlContentType name="address" annotationType="jdk.jfr.MemoryAddress" />
|
||||
<XmlContentType name="percentage" annotationType="jdk.jfr.Percentage" />
|
||||
<XmlContentType name="millis" annotationType="jdk.jfr.Timespan" annotationValue="MILLISECONDS" />
|
||||
<XmlContentType name="nanos" annotationType="jdk.jfr.Timespan" annotationValue="NANOSECONDS" />
|
||||
|
||||
<XmlContentType name="bytes" annotation="jdk.jfr.DataAmount(BYTES)" />
|
||||
<XmlContentType name="tickstamp" annotation="jdk.jfr.Timestamp(TICKS)" />
|
||||
<XmlContentType name="epochmillis" annotation="jdk.jfr.Timestamp(MILLISECONDS_SINCE_EPOCH)" />
|
||||
<XmlContentType name="tickspan" annotation="jdk.jfr.Timespan(TICKS)" />
|
||||
<XmlContentType name="address" annotation="jdk.jfr.MemoryAddress" />
|
||||
<XmlContentType name="percentage" annotation="jdk.jfr.Percentage" />
|
||||
<XmlContentType name="millis" annotation="jdk.jfr.Timespan(MILLISECONDS)" />
|
||||
<XmlContentType name="nanos" annotation="jdk.jfr.Timespan(NANOSECONDS)" />
|
||||
<XmlContentType name="hertz" annotation="jdk.jfr.Frequency" />
|
||||
<XmlContentType name="bytes-per-second" annotation="jdk.jfr.DataAmount(BYTES), jdk.jfr.Frequency" />
|
||||
<XmlContentType name="bits-per-second" annotation="jdk.jfr.DataAmount(BITS), jdk.jfr.Frequency" />
|
||||
|
||||
</Metadata>
|
||||
|
@ -107,8 +107,7 @@
|
||||
<xs:element name="XmlContentType">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="name" type="xs:NMTOKEN" use="required" />
|
||||
<xs:attribute name="annotationType" type="xs:NMTOKEN" use="required" />
|
||||
<xs:attribute name="annotationValue" type="xs:string" use="optional" />
|
||||
<xs:attribute name="annotation" type="xs:string" use="required" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="Relation">
|
||||
|
@ -174,8 +174,8 @@ void JfrNetworkUtilization::send_events() {
|
||||
event.set_starttime(cur_time);
|
||||
event.set_endtime(cur_time);
|
||||
event.set_networkInterface(entry.id);
|
||||
event.set_readRate(read_rate);
|
||||
event.set_writeRate(write_rate);
|
||||
event.set_readRate(8 * read_rate);
|
||||
event.set_writeRate(8 * write_rate);
|
||||
event.commit();
|
||||
}
|
||||
// update existing entry with new values
|
||||
|
@ -24,29 +24,15 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "jfr/jni/jfrJavaSupport.hpp"
|
||||
#include "jfr/recorder/repository/jfrChunkRotation.hpp"
|
||||
#include "jfr/recorder/repository/jfrChunkWriter.hpp"
|
||||
#include "jfr/recorder/repository/jfrChunkSizeNotifier.hpp"
|
||||
|
||||
size_t JfrChunkSizeNotifier::_chunk_size_threshold = 0;
|
||||
static jobject chunk_monitor = NULL;
|
||||
static intptr_t threshold = 0;
|
||||
static bool rotate = false;
|
||||
|
||||
void JfrChunkSizeNotifier::set_chunk_size_threshold(size_t bytes) {
|
||||
_chunk_size_threshold = bytes;
|
||||
}
|
||||
|
||||
size_t JfrChunkSizeNotifier::chunk_size_threshold() {
|
||||
return _chunk_size_threshold;
|
||||
}
|
||||
|
||||
static jobject new_chunk_monitor = NULL;
|
||||
|
||||
// lazy install
|
||||
static jobject get_new_chunk_monitor(Thread* thread) {
|
||||
static bool initialized = false;
|
||||
if (initialized) {
|
||||
assert(new_chunk_monitor != NULL, "invariant");
|
||||
return new_chunk_monitor;
|
||||
}
|
||||
assert(new_chunk_monitor == NULL, "invariant");
|
||||
static jobject install_chunk_monitor(Thread* thread) {
|
||||
assert(chunk_monitor == NULL, "invariant");
|
||||
// read static field
|
||||
HandleMark hm(thread);
|
||||
static const char klass[] = "jdk/jfr/internal/JVM";
|
||||
@ -55,19 +41,41 @@ static jobject get_new_chunk_monitor(Thread* thread) {
|
||||
JavaValue result(T_OBJECT);
|
||||
JfrJavaArguments field_args(&result, klass, field, signature, thread);
|
||||
JfrJavaSupport::get_field_global_ref(&field_args, thread);
|
||||
new_chunk_monitor = result.get_jobject();
|
||||
initialized = new_chunk_monitor != NULL;
|
||||
return new_chunk_monitor;
|
||||
chunk_monitor = result.get_jobject();
|
||||
return chunk_monitor;
|
||||
}
|
||||
|
||||
void JfrChunkSizeNotifier::notify() {
|
||||
// lazy install
|
||||
static jobject get_chunk_monitor(Thread* thread) {
|
||||
return chunk_monitor != NULL ? chunk_monitor : install_chunk_monitor(thread);
|
||||
}
|
||||
|
||||
static void notify() {
|
||||
Thread* const thread = Thread::current();
|
||||
JfrJavaSupport::notify_all(get_new_chunk_monitor(thread), thread);
|
||||
JfrJavaSupport::notify_all(get_chunk_monitor(thread), thread);
|
||||
}
|
||||
|
||||
void JfrChunkSizeNotifier::release_monitor() {
|
||||
if (new_chunk_monitor != NULL) {
|
||||
JfrJavaSupport::destroy_global_jni_handle(new_chunk_monitor);
|
||||
new_chunk_monitor = NULL;
|
||||
void JfrChunkRotation::evaluate(const JfrChunkWriter& writer) {
|
||||
assert(threshold > 0, "invariant");
|
||||
if (rotate) {
|
||||
// already in progress
|
||||
return;
|
||||
}
|
||||
assert(!rotate, "invariant");
|
||||
if (writer.size_written() > threshold) {
|
||||
rotate = true;
|
||||
notify();
|
||||
}
|
||||
}
|
||||
|
||||
bool JfrChunkRotation::should_rotate() {
|
||||
return rotate;
|
||||
}
|
||||
|
||||
void JfrChunkRotation::on_rotation() {
|
||||
rotate = false;
|
||||
}
|
||||
|
||||
void JfrChunkRotation::set_threshold(intptr_t bytes) {
|
||||
threshold = bytes;
|
||||
}
|
@ -22,24 +22,23 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNKSIZENOTIFIER_HPP
|
||||
#define SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNKSIZENOTIFIER_HPP
|
||||
#ifndef SHARE_VM_JFR_RECORDER_REPOSITORY_JFRCHUNKROTATION_HPP
|
||||
#define SHARE_VM_JFR_RECORDER_REPOSITORY_JFRCHUNKROTATION_HPP
|
||||
|
||||
#include "memory/allocation.hpp"
|
||||
|
||||
class JfrChunkWriter;
|
||||
|
||||
//
|
||||
// Responsible for notifications about current chunk size now exceeding threshold.
|
||||
// This is a means to initiate a chunk rotation on the basis of size written.
|
||||
// This is a means to initiate a chunk rotation on the basis of the size written.
|
||||
//
|
||||
class JfrChunkSizeNotifier : AllStatic {
|
||||
friend class JfrRecorder;
|
||||
private:
|
||||
static size_t _chunk_size_threshold;
|
||||
static void release_monitor();
|
||||
class JfrChunkRotation : AllStatic {
|
||||
public:
|
||||
static void set_chunk_size_threshold(size_t bytes);
|
||||
static size_t chunk_size_threshold();
|
||||
static void notify();
|
||||
static void evaluate(const JfrChunkWriter& writer);
|
||||
static void set_threshold(intptr_t bytes);
|
||||
static bool should_rotate();
|
||||
static void on_rotation();
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNKSIZENOTIFIER_HPP
|
||||
#endif // SHARE_VM_JFR_RECORDER_REPOSITORY_JFRCHUNKROTATION_HPP
|
@ -28,7 +28,7 @@
|
||||
#include "jfr/recorder/jfrRecorder.hpp"
|
||||
#include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp"
|
||||
#include "jfr/recorder/checkpoint/jfrMetadataEvent.hpp"
|
||||
#include "jfr/recorder/repository/jfrChunkSizeNotifier.hpp"
|
||||
#include "jfr/recorder/repository/jfrChunkRotation.hpp"
|
||||
#include "jfr/recorder/repository/jfrChunkWriter.hpp"
|
||||
#include "jfr/recorder/repository/jfrRepository.hpp"
|
||||
#include "jfr/recorder/service/jfrPostBox.hpp"
|
||||
@ -340,6 +340,7 @@ void JfrRecorderService::prepare_for_vm_error_rotation() {
|
||||
void JfrRecorderService::open_new_chunk(bool vm_error) {
|
||||
assert(!_chunkwriter.is_valid(), "invariant");
|
||||
assert(!JfrStream_lock->owned_by_self(), "invariant");
|
||||
JfrChunkRotation::on_rotation();
|
||||
MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (!_repository.open_chunk(vm_error)) {
|
||||
assert(!_chunkwriter.is_valid(), "invariant");
|
||||
@ -535,8 +536,5 @@ void JfrRecorderService::scavenge() {
|
||||
}
|
||||
|
||||
void JfrRecorderService::evaluate_chunk_size_for_rotation() {
|
||||
const size_t size_written = _chunkwriter.size_written();
|
||||
if (size_written > JfrChunkSizeNotifier::chunk_size_threshold()) {
|
||||
JfrChunkSizeNotifier::notify();
|
||||
}
|
||||
JfrChunkRotation::evaluate(_chunkwriter);
|
||||
}
|
||||
|
@ -501,6 +501,13 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
|
||||
diagnostic(bool, AbortVMOnSafepointTimeout, false, \
|
||||
"Abort upon failure to reach safepoint (see SafepointTimeout)") \
|
||||
\
|
||||
diagnostic(bool, AbortVMOnVMOperationTimeout, false, \
|
||||
"Abort upon failure to complete VM operation promptly") \
|
||||
\
|
||||
diagnostic(intx, AbortVMOnVMOperationTimeoutDelay, 1000, \
|
||||
"Delay in milliseconds for option AbortVMOnVMOperationTimeout") \
|
||||
range(0, max_intx) \
|
||||
\
|
||||
/* 50 retries * (5 * current_retry_count) millis = ~6.375 seconds */ \
|
||||
/* typically, at most a few retries are needed */ \
|
||||
product(intx, SuspendRetryCount, 50, \
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "jfr/jfrEvents.hpp"
|
||||
#include "jfr/support/jfrThreadId.hpp"
|
||||
#include "logging/log.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
#include "logging/logConfiguration.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/method.hpp"
|
||||
@ -197,6 +198,32 @@ void VMOperationQueue::oops_do(OopClosure* f) {
|
||||
drain_list_oops_do(f);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Timeout machinery
|
||||
|
||||
void VMOperationTimeoutTask::task() {
|
||||
assert(AbortVMOnVMOperationTimeout, "only if enabled");
|
||||
if (is_armed()) {
|
||||
jlong delay = (os::javaTimeMillis() - _arm_time);
|
||||
if (delay > AbortVMOnVMOperationTimeoutDelay) {
|
||||
fatal("VM operation took too long: " SIZE_FORMAT " ms (timeout: " SIZE_FORMAT " ms)",
|
||||
delay, AbortVMOnVMOperationTimeoutDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool VMOperationTimeoutTask::is_armed() {
|
||||
return OrderAccess::load_acquire(&_armed) != 0;
|
||||
}
|
||||
|
||||
void VMOperationTimeoutTask::arm() {
|
||||
_arm_time = os::javaTimeMillis();
|
||||
OrderAccess::release_store_fence(&_armed, 1);
|
||||
}
|
||||
|
||||
void VMOperationTimeoutTask::disarm() {
|
||||
OrderAccess::release_store_fence(&_armed, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Implementation of VMThread stuff
|
||||
@ -209,12 +236,28 @@ VM_Operation* VMThread::_cur_vm_operation = NULL;
|
||||
VMOperationQueue* VMThread::_vm_queue = NULL;
|
||||
PerfCounter* VMThread::_perf_accumulated_vm_operation_time = NULL;
|
||||
const char* VMThread::_no_op_reason = NULL;
|
||||
VMOperationTimeoutTask* VMThread::_timeout_task = NULL;
|
||||
|
||||
|
||||
void VMThread::create() {
|
||||
assert(vm_thread() == NULL, "we can only allocate one VMThread");
|
||||
_vm_thread = new VMThread();
|
||||
|
||||
if (AbortVMOnVMOperationTimeout) {
|
||||
// Make sure we call the timeout task frequently enough, but not too frequent.
|
||||
// Try to make the interval 10% of the timeout delay, so that we miss the timeout
|
||||
// by those 10% at max. Periodic task also expects it to fit min/max intervals.
|
||||
size_t interval = (size_t)AbortVMOnVMOperationTimeoutDelay / 10;
|
||||
interval = interval / PeriodicTask::interval_gran * PeriodicTask::interval_gran;
|
||||
interval = MAX2<size_t>(interval, PeriodicTask::min_interval);
|
||||
interval = MIN2<size_t>(interval, PeriodicTask::max_interval);
|
||||
|
||||
_timeout_task = new VMOperationTimeoutTask(interval);
|
||||
_timeout_task->enroll();
|
||||
} else {
|
||||
assert(_timeout_task == NULL, "sanity");
|
||||
}
|
||||
|
||||
// Create VM operation queue
|
||||
_vm_queue = new VMOperationQueue();
|
||||
guarantee(_vm_queue != NULL, "just checking");
|
||||
@ -492,6 +535,11 @@ void VMThread::loop() {
|
||||
_vm_queue->set_drain_list(safepoint_ops); // ensure ops can be scanned
|
||||
|
||||
SafepointSynchronize::begin();
|
||||
|
||||
if (_timeout_task != NULL) {
|
||||
_timeout_task->arm();
|
||||
}
|
||||
|
||||
evaluate_operation(_cur_vm_operation);
|
||||
// now process all queued safepoint ops, iteratively draining
|
||||
// the queue until there are none left
|
||||
@ -533,6 +581,10 @@ void VMThread::loop() {
|
||||
|
||||
_vm_queue->set_drain_list(NULL);
|
||||
|
||||
if (_timeout_task != NULL) {
|
||||
_timeout_task->disarm();
|
||||
}
|
||||
|
||||
// Complete safepoint synchronization
|
||||
SafepointSynchronize::end();
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "runtime/perfData.hpp"
|
||||
#include "runtime/thread.hpp"
|
||||
#include "runtime/task.hpp"
|
||||
#include "runtime/vmOperations.hpp"
|
||||
|
||||
//
|
||||
@ -84,6 +85,26 @@ class VMOperationQueue : public CHeapObj<mtInternal> {
|
||||
};
|
||||
|
||||
|
||||
// VM operation timeout handling: warn or abort the VM when VM operation takes
|
||||
// too long. Periodic tasks do not participate in safepoint protocol, and therefore
|
||||
// can fire when application threads are stopped.
|
||||
|
||||
class VMOperationTimeoutTask : public PeriodicTask {
|
||||
private:
|
||||
volatile int _armed;
|
||||
jlong _arm_time;
|
||||
|
||||
public:
|
||||
VMOperationTimeoutTask(size_t interval_time) :
|
||||
PeriodicTask(interval_time), _armed(0), _arm_time(0) {}
|
||||
|
||||
virtual void task();
|
||||
|
||||
bool is_armed();
|
||||
void arm();
|
||||
void disarm();
|
||||
};
|
||||
|
||||
//
|
||||
// A single VMThread (the primordial thread) spawns all other threads
|
||||
// and is itself used by other threads to offload heavy vm operations
|
||||
@ -101,6 +122,8 @@ class VMThread: public NamedThread {
|
||||
|
||||
static const char* _no_op_reason;
|
||||
|
||||
static VMOperationTimeoutTask* _timeout_task;
|
||||
|
||||
static bool no_op_safepoint_needed(bool check_time);
|
||||
|
||||
void evaluate_operation(VM_Operation* op);
|
||||
|
@ -996,7 +996,7 @@ class Attribute implements Comparable<Attribute> {
|
||||
endp = cstr.indexOf(',', cp);
|
||||
if (endp < 0) endp = cstrlen;
|
||||
String cstr1 = cstr.substring(cp, endp);
|
||||
if (cstr1.length() == 0)
|
||||
if (cstr1.isEmpty())
|
||||
cstr1 = "empty"; // will fail parse
|
||||
int value0, value1;
|
||||
// Check for a case range (new in 1.6).
|
||||
|
@ -279,7 +279,7 @@ class Driver {
|
||||
junpack.properties().putAll(engProps);
|
||||
if (doRepack && newfile.equals(jarfile)) {
|
||||
String zipc = getZipComment(jarfile);
|
||||
if (verbose && zipc.length() > 0)
|
||||
if (verbose && !zipc.isEmpty())
|
||||
System.out.println(MessageFormat.format(RESOURCE.getString(DriverResource.DETECTED_ZIP_COMMENT), zipc));
|
||||
if (zipc.indexOf(Utils.PACK_ZIP_ARCHIVE_MARKER_COMMENT) >= 0) {
|
||||
System.out.println(MessageFormat.format(RESOURCE.getString(DriverResource.SKIP_FOR_REPACKED), jarfile));
|
||||
@ -552,7 +552,7 @@ class Driver {
|
||||
if (words.length == 0) continue loadOptmap;
|
||||
String opt = words[0];
|
||||
words[0] = ""; // initial word is not a spec
|
||||
if (opt.length() == 0 && words.length >= 1) {
|
||||
if (opt.isEmpty() && words.length >= 1) {
|
||||
opt = words[1]; // initial "word" is empty due to leading ' '
|
||||
words[1] = "";
|
||||
}
|
||||
@ -622,7 +622,7 @@ class Driver {
|
||||
switch (specop) {
|
||||
case '+':
|
||||
// + means we want an non-empty val suffix.
|
||||
ok = (val.length() != 0);
|
||||
ok = !val.isEmpty();
|
||||
specop = spec.charAt(sidx++);
|
||||
break;
|
||||
case '*':
|
||||
@ -641,10 +641,10 @@ class Driver {
|
||||
String specarg = spec.substring(sidx);
|
||||
switch (specop) {
|
||||
case '.': // terminate the option sequence
|
||||
resultString = (specarg.length() != 0)? specarg.intern(): opt;
|
||||
resultString = specarg.isEmpty() ? opt : specarg.intern();
|
||||
break doArgs;
|
||||
case '?': // abort the option sequence
|
||||
resultString = (specarg.length() != 0)? specarg.intern(): arg;
|
||||
resultString = specarg.isEmpty() ? arg : specarg.intern();
|
||||
isError = true;
|
||||
break eachSpec;
|
||||
case '@': // change the effective opt name
|
||||
@ -655,14 +655,14 @@ class Driver {
|
||||
val = "";
|
||||
break;
|
||||
case '!': // negation option
|
||||
String negopt = (specarg.length() != 0)? specarg.intern(): opt;
|
||||
String negopt = specarg.isEmpty() ? opt : specarg.intern();
|
||||
properties.remove(negopt);
|
||||
properties.put(negopt, null); // leave placeholder
|
||||
didAction = true;
|
||||
break;
|
||||
case '$': // normal "boolean" option
|
||||
String boolval;
|
||||
if (specarg.length() != 0) {
|
||||
if (!specarg.isEmpty()) {
|
||||
// If there is a given spec token, store it.
|
||||
boolval = specarg;
|
||||
} else {
|
||||
|
@ -153,7 +153,7 @@ public class KeyManagerFactory {
|
||||
String provider)
|
||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||
{
|
||||
if (provider == null || provider.length() == 0)
|
||||
if (provider == null || provider.isEmpty())
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
Object[] objs = SSLSecurity.getImpl(algorithm, "KeyManagerFactory",
|
||||
provider);
|
||||
|
@ -109,7 +109,7 @@ public class SSLContext {
|
||||
public static SSLContext getInstance(String protocol, String provider)
|
||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||
{
|
||||
if (provider == null || provider.length() == 0)
|
||||
if (provider == null || provider.isEmpty())
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
Object[] objs = SSLSecurity.getImpl(protocol, "SSLContext",
|
||||
provider);
|
||||
|
@ -155,7 +155,7 @@ public class TrustManagerFactory {
|
||||
String provider)
|
||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||
{
|
||||
if (provider == null || provider.length() == 0)
|
||||
if (provider == null || provider.isEmpty())
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
Object[] objs = SSLSecurity.getImpl(algorithm, "TrustManagerFactory",
|
||||
provider);
|
||||
|
@ -247,7 +247,7 @@ public final class Console implements Flushable
|
||||
String line = null;
|
||||
synchronized (writeLock) {
|
||||
synchronized(readLock) {
|
||||
if (fmt.length() != 0)
|
||||
if (!fmt.isEmpty())
|
||||
pw.format(fmt, args);
|
||||
try {
|
||||
char[] ca = readline(false);
|
||||
@ -319,7 +319,7 @@ public final class Console implements Flushable
|
||||
}
|
||||
IOError ioe = null;
|
||||
try {
|
||||
if (fmt.length() != 0)
|
||||
if (!fmt.isEmpty())
|
||||
pw.format(fmt, args);
|
||||
passwd = readline(true);
|
||||
} catch (IOException x) {
|
||||
|
@ -1119,7 +1119,7 @@ public abstract class ClassLoader {
|
||||
|
||||
// true if the name is null or has the potential to be a valid binary name
|
||||
private boolean checkName(String name) {
|
||||
if ((name == null) || (name.length() == 0))
|
||||
if ((name == null) || (name.isEmpty()))
|
||||
return true;
|
||||
if ((name.indexOf('/') != -1) || (name.charAt(0) == '['))
|
||||
return false;
|
||||
|
@ -1077,8 +1077,8 @@ public final class Double extends Number
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a nominal descriptor for this instance, which is the instance
|
||||
* itself.
|
||||
* Returns an {@link Optional} containing the nominal descriptor for this
|
||||
* instance, which is the instance itself.
|
||||
*
|
||||
* @return an {@link Optional} describing the {@linkplain Double} instance
|
||||
* @since 12
|
||||
|
@ -989,8 +989,8 @@ public final class Float extends Number
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a nominal descriptor for this instance, which is the instance
|
||||
* itself.
|
||||
* Returns an {@link Optional} containing the nominal descriptor for this
|
||||
* instance, which is the instance itself.
|
||||
*
|
||||
* @return an {@link Optional} describing the {@linkplain Float} instance
|
||||
* @since 12
|
||||
|
@ -1409,7 +1409,7 @@ public final class Integer extends Number
|
||||
boolean negative = false;
|
||||
Integer result;
|
||||
|
||||
if (nm.length() == 0)
|
||||
if (nm.isEmpty())
|
||||
throw new NumberFormatException("Zero length string");
|
||||
char firstChar = nm.charAt(0);
|
||||
// Handle sign, if present
|
||||
@ -1838,8 +1838,8 @@ public final class Integer extends Number
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a nominal descriptor for this instance, which is the instance
|
||||
* itself.
|
||||
* Returns an {@link Optional} containing the nominal descriptor for this
|
||||
* instance, which is the instance itself.
|
||||
*
|
||||
* @return an {@link Optional} describing the {@linkplain Integer} instance
|
||||
* @since 12
|
||||
|
@ -1248,7 +1248,7 @@ public final class Long extends Number
|
||||
boolean negative = false;
|
||||
Long result;
|
||||
|
||||
if (nm.length() == 0)
|
||||
if (nm.isEmpty())
|
||||
throw new NumberFormatException("Zero length string");
|
||||
char firstChar = nm.charAt(0);
|
||||
// Handle sign, if present
|
||||
@ -1967,8 +1967,8 @@ public final class Long extends Number
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a nominal descriptor for this instance, which is the instance
|
||||
* itself.
|
||||
* Returns an {@link Optional} containing the nominal descriptor for this
|
||||
* instance, which is the instance itself.
|
||||
*
|
||||
* @return an {@link Optional} describing the {@linkplain Long} instance
|
||||
* @since 12
|
||||
|
@ -397,11 +397,11 @@ public class Package extends NamedPackage implements java.lang.reflect.Annotated
|
||||
public String toString() {
|
||||
String spec = versionInfo.specTitle;
|
||||
String ver = versionInfo.specVersion;
|
||||
if (spec != null && spec.length() > 0)
|
||||
if (spec != null && !spec.isEmpty())
|
||||
spec = ", " + spec;
|
||||
else
|
||||
spec = "";
|
||||
if (ver != null && ver.length() > 0)
|
||||
if (ver != null && !ver.isEmpty())
|
||||
ver = ", version " + ver;
|
||||
else
|
||||
ver = "";
|
||||
|
@ -403,7 +403,7 @@ public class Runtime {
|
||||
*/
|
||||
public Process exec(String command, String[] envp, File dir)
|
||||
throws IOException {
|
||||
if (command.length() == 0)
|
||||
if (command.isEmpty())
|
||||
throw new IllegalArgumentException("Empty command");
|
||||
|
||||
StringTokenizer st = new StringTokenizer(command);
|
||||
|
@ -664,7 +664,7 @@ public final class String
|
||||
* object.
|
||||
*/
|
||||
public int length() {
|
||||
return value.length >> coder();
|
||||
return isLatin1() ? value.length : value.length >> UTF16;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1943,8 +1943,7 @@ public final class String
|
||||
* characters followed by the string argument's characters.
|
||||
*/
|
||||
public String concat(String str) {
|
||||
int olen = str.length();
|
||||
if (olen == 0) {
|
||||
if (str.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
if (coder() == str.coder()) {
|
||||
@ -1956,6 +1955,7 @@ public final class String
|
||||
return new String(buf, coder);
|
||||
}
|
||||
int len = length();
|
||||
int olen = str.length();
|
||||
byte[] buf = StringUTF16.newBytesFor(len + olen);
|
||||
getBytes(buf, 0, UTF16);
|
||||
str.getBytes(buf, len, UTF16);
|
||||
@ -2316,7 +2316,7 @@ public final class String
|
||||
// Construct result
|
||||
int resultSize = list.size();
|
||||
if (limit == 0) {
|
||||
while (resultSize > 0 && list.get(resultSize - 1).length() == 0) {
|
||||
while (resultSize > 0 && list.get(resultSize - 1).isEmpty()) {
|
||||
resultSize--;
|
||||
}
|
||||
}
|
||||
@ -3545,8 +3545,8 @@ public final class String
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a nominal descriptor for this instance, which is the instance
|
||||
* itself.
|
||||
* Returns an {@link Optional} containing the nominal descriptor for this
|
||||
* instance, which is the instance itself.
|
||||
*
|
||||
* @return an {@link Optional} describing the {@linkplain String} instance
|
||||
* @since 12
|
||||
|
@ -73,7 +73,7 @@ class VersionProps {
|
||||
"@@VENDOR_VERSION_STRING@@";
|
||||
|
||||
private static final String vendor_version =
|
||||
(VENDOR_VERSION_STRING.length() > 0
|
||||
(!VENDOR_VERSION_STRING.isEmpty()
|
||||
? " " + VENDOR_VERSION_STRING : "");
|
||||
|
||||
private static final String VENDOR =
|
||||
@ -95,7 +95,7 @@ class VersionProps {
|
||||
props.put("java.version.date", java_version_date);
|
||||
props.put("java.runtime.version", java_runtime_version);
|
||||
props.put("java.runtime.name", java_runtime_name);
|
||||
if (VENDOR_VERSION_STRING.length() > 0)
|
||||
if (!VENDOR_VERSION_STRING.isEmpty())
|
||||
props.put("java.vendor.version", VENDOR_VERSION_STRING);
|
||||
|
||||
props.put("java.class.version", CLASSFILE_MAJOR_MINOR);
|
||||
|
@ -112,13 +112,13 @@ public interface ClassDesc
|
||||
*
|
||||
* A field type descriptor string for a non-array type is either
|
||||
* a one-letter code corresponding to a primitive type
|
||||
* ({@code J,I,C,S,B,D,F,Z,V}), or the letter {@code L}, followed
|
||||
* by the fully qualified binary name of a class, followed by {@code ;}.
|
||||
* A field type descriptor for an array type is the character {@code [}
|
||||
* ({@code "J", "I", "C", "S", "B", "D", "F", "Z", "V"}), or the letter {@code "L"}, followed
|
||||
* by the fully qualified binary name of a class, followed by {@code ";"}.
|
||||
* A field type descriptor for an array type is the character {@code "["}
|
||||
* followed by the field descriptor for the component type. Examples of
|
||||
* valid type descriptor strings include {@code Ljava/lang/String;}, {@code I},
|
||||
* {@code [I}, {@code V}, {@code [Ljava/lang/String;}, etc.
|
||||
* for more detail.
|
||||
* valid type descriptor strings include {@code "Ljava/lang/String;"}, {@code "I"},
|
||||
* {@code "[I"}, {@code "V"}, {@code "[Ljava/lang/String;"}, etc.
|
||||
* See JVMS 4.3.2 ("Field Descriptors") for more detail.
|
||||
*
|
||||
* @param descriptor a field descriptor string
|
||||
* @return a {@linkplain ClassDesc} describing the desired class
|
||||
@ -126,9 +126,15 @@ public interface ClassDesc
|
||||
* @throws IllegalArgumentException if the name string is not in the
|
||||
* correct format
|
||||
* @jvms 4.3.2 Field Descriptors
|
||||
* @jvms 4.4.1 The CONSTANT_Class_info Structure
|
||||
*/
|
||||
static ClassDesc ofDescriptor(String descriptor) {
|
||||
requireNonNull(descriptor);
|
||||
int depth = ConstantUtils.arrayDepth(descriptor);
|
||||
if (depth > ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS) {
|
||||
throw new IllegalArgumentException(String.format("Cannot create an array type descriptor with more than %d dimensions",
|
||||
ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS));
|
||||
}
|
||||
return (descriptor.length() == 1)
|
||||
? new PrimitiveClassDescImpl(descriptor)
|
||||
: new ReferenceClassDescImpl(descriptor);
|
||||
@ -139,8 +145,15 @@ public interface ClassDesc
|
||||
* is described by this {@linkplain ClassDesc}.
|
||||
*
|
||||
* @return a {@linkplain ClassDesc} describing the array type
|
||||
* @throws IllegalStateException if the resulting {@linkplain ClassDesc} would have an array rank of greater than 255
|
||||
* @jvms 4.4.1 The CONSTANT_Class_info Structure
|
||||
*/
|
||||
default ClassDesc arrayType() {
|
||||
int depth = ConstantUtils.arrayDepth(descriptorString());
|
||||
if (depth >= ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS) {
|
||||
throw new IllegalStateException(String.format("Cannot create an array type descriptor with more than %d dimensions",
|
||||
ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS));
|
||||
}
|
||||
return arrayType(1);
|
||||
}
|
||||
|
||||
@ -150,11 +163,14 @@ public interface ClassDesc
|
||||
*
|
||||
* @param rank the rank of the array
|
||||
* @return a {@linkplain ClassDesc} describing the array type
|
||||
* @throws IllegalArgumentException if the rank is zero or negative
|
||||
* @throws IllegalArgumentException if the rank is less than zero or if the rank of the resulting array type is
|
||||
* greater than 255
|
||||
* @jvms 4.4.1 The CONSTANT_Class_info Structure
|
||||
*/
|
||||
default ClassDesc arrayType(int rank) {
|
||||
if (rank <= 0)
|
||||
throw new IllegalArgumentException("rank: " + rank);
|
||||
int currentDepth = ConstantUtils.arrayDepth(descriptorString());
|
||||
if (rank <= 0 || currentDepth + rank > ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS)
|
||||
throw new IllegalArgumentException("rank: " + currentDepth + rank);
|
||||
return ClassDesc.ofDescriptor("[".repeat(rank) + descriptorString());
|
||||
}
|
||||
|
||||
@ -162,6 +178,12 @@ public interface ClassDesc
|
||||
* Returns a {@linkplain ClassDesc} for a nested class of the class or
|
||||
* interface type described by this {@linkplain ClassDesc}.
|
||||
*
|
||||
* @apiNote
|
||||
*
|
||||
* Example: If descriptor {@code d} describes the class {@code java.util.Map}, a
|
||||
* descriptor for the class {@code java.util.Map.Entry} could be obtained
|
||||
* by {@code d.nested("Entry")}.
|
||||
*
|
||||
* @param nestedName the unqualified name of the nested class
|
||||
* @return a {@linkplain ClassDesc} describing the nested class
|
||||
* @throws NullPointerException if any argument is {@code null}
|
||||
|
@ -65,8 +65,9 @@ import java.util.Optional;
|
||||
*/
|
||||
public interface Constable {
|
||||
/**
|
||||
* Returns a nominal descriptor for this instance, if one can be
|
||||
* constructed, or an empty {@link Optional} if one cannot be constructed.
|
||||
* Returns an {@link Optional} containing the nominal descriptor for this
|
||||
* instance, if one can be constructed, or an empty {@link Optional}
|
||||
* if one cannot be constructed.
|
||||
*
|
||||
* @return An {@link Optional} containing the resulting nominal descriptor,
|
||||
* or an empty {@link Optional} if one cannot be constructed.
|
||||
|
@ -37,6 +37,7 @@ class ConstantUtils {
|
||||
/** an empty constant descriptor */
|
||||
public static final ConstantDesc[] EMPTY_CONSTANTDESC = new ConstantDesc[0];
|
||||
static final Constable[] EMPTY_CONSTABLE = new Constable[0];
|
||||
static final int MAX_ARRAY_TYPE_DESC_DIMENSIONS = 255;
|
||||
|
||||
private static final Set<String> pointyNames = Set.of("<init>", "<clinit>");
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
* storing the value in a constant pool entry, or reconstituting the value given
|
||||
* a class loading context. Every {@link java.lang.constant.ConstantDesc}
|
||||
* knows how to <em>resolve</em> itself -- compute the value that it describes --
|
||||
* via {@link java.lang.constant.ConstantDesc#resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup)}.
|
||||
* via {@link java.lang.constant.ConstantDesc#resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup) ConstantDesc.resolveConstantDesc}.
|
||||
* This allows an API which accepts {@link java.lang.constant.ConstantDesc}
|
||||
* objects to evaluate them reflectively, provided that the classes and methods
|
||||
* referenced in their nominal description are present and accessible.
|
||||
@ -68,7 +68,7 @@
|
||||
* When a bytecode-reading API encounters a constant pool entry, it can
|
||||
* convert it to the appropriate type of nominal descriptor. For dynamic
|
||||
* constants, bytecode-reading APIs may wish to use the factory
|
||||
* {@link java.lang.constant.DynamicConstantDesc#ofCanonical(DirectMethodHandleDesc, java.lang.String, ClassDesc, ConstantDesc[])},
|
||||
* {@link java.lang.constant.DynamicConstantDesc#ofCanonical(DirectMethodHandleDesc, java.lang.String, ClassDesc, ConstantDesc[]) DynamicConstantDesc.ofCanonical},
|
||||
* which will inspect the bootstrap and, for well-known bootstraps, return
|
||||
* a more specific subtype of {@link java.lang.constant.DynamicConstantDesc}, such as
|
||||
* {@link java.lang.Enum.EnumDesc}.
|
||||
|
@ -103,7 +103,7 @@ public final class ConstantBootstraps {
|
||||
if (type != Class.class) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (name.length() == 0 || name.length() > 1) {
|
||||
if (name.length() != 1) {
|
||||
throw new IllegalArgumentException(String.format("not primitive: %s", name));
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ public class MethodHandles {
|
||||
throw new IllegalAccessException(callerModule + " does not read " + targetModule);
|
||||
if (targetModule.isNamed()) {
|
||||
String pn = targetClass.getPackageName();
|
||||
assert pn.length() > 0 : "unnamed package cannot be in named module";
|
||||
assert !pn.isEmpty() : "unnamed package cannot be in named module";
|
||||
if (!targetModule.isOpen(pn, callerModule))
|
||||
throw new IllegalAccessException(targetModule + " does not open " + pn + " to " + callerModule);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ final class ProxyClassesDumper {
|
||||
}
|
||||
try {
|
||||
path = path.trim();
|
||||
final Path dir = Path.of(path.length() == 0 ? "." : path);
|
||||
final Path dir = Path.of(path.isEmpty() ? "." : path);
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Void run() {
|
||||
|
@ -61,7 +61,8 @@ public interface TypeDescriptor {
|
||||
boolean isArray();
|
||||
|
||||
/**
|
||||
* Does this field descriptor describe a primitive type?
|
||||
* Does this field descriptor describe a primitive type (including void.)
|
||||
*
|
||||
* @return whether this field descriptor describes a primitive type
|
||||
*/
|
||||
boolean isPrimitive();
|
||||
|
@ -1864,6 +1864,16 @@ public abstract class VarHandle implements Constable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare this {@linkplain VarHandle} with another object for equality.
|
||||
* Two {@linkplain VarHandle}s are considered equal if they both describe the
|
||||
* same instance field, both describe the same static field, both describe
|
||||
* array elements for arrays with the same component type, or both describe
|
||||
* the same component of an off-heap structure.
|
||||
*
|
||||
* @param o the other object
|
||||
* @return Whether this {@linkplain VarHandle} is equal to the other object
|
||||
*/
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
@ -1883,6 +1893,12 @@ public abstract class VarHandle implements Constable {
|
||||
|
||||
abstract int internalHashCode();
|
||||
|
||||
/**
|
||||
* Returns a compact textual description of this {@linkplain VarHandle},
|
||||
* including the type of variable described, and a description of its coordinates.
|
||||
*
|
||||
* @return A compact textual description of this {@linkplain VarHandle}
|
||||
*/
|
||||
@Override
|
||||
public final String toString() {
|
||||
return String.format("VarHandle[varType=%s, coord=%s]",
|
||||
@ -2272,6 +2288,14 @@ public abstract class VarHandle implements Constable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a compact textual description of this constant description.
|
||||
* For a field {@linkplain VarHandle}, includes the owner, name, and type
|
||||
* of the field, and whether it is static; for an array {@linkplain VarHandle},
|
||||
* the name of the component type.
|
||||
*
|
||||
* @return A compact textual description of this descriptor
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (kind) {
|
||||
|
@ -149,7 +149,7 @@ public final class HttpCookie implements Cloneable {
|
||||
*/
|
||||
HttpCookie(String name, String value, String header, long creationTime) {
|
||||
name = name.trim();
|
||||
if (name.length() == 0 || !isToken(name) || name.charAt(0) == '$') {
|
||||
if (name.isEmpty() || !isToken(name) || name.charAt(0) == '$') {
|
||||
throw new IllegalArgumentException("Illegal cookie name");
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ class Inet6Address extends InetAddress {
|
||||
NetworkInterface nif)
|
||||
throws UnknownHostException
|
||||
{
|
||||
if (host != null && host.length() > 0 && host.charAt(0) == '[') {
|
||||
if (host != null && !host.isEmpty() && host.charAt(0) == '[') {
|
||||
if (host.charAt(host.length()-1) == ']') {
|
||||
host = host.substring(1, host.length() -1);
|
||||
}
|
||||
@ -466,7 +466,7 @@ class Inet6Address extends InetAddress {
|
||||
int scope_id)
|
||||
throws UnknownHostException
|
||||
{
|
||||
if (host != null && host.length() > 0 && host.charAt(0) == '[') {
|
||||
if (host != null && !host.isEmpty() && host.charAt(0) == '[') {
|
||||
if (host.charAt(host.length()-1) == ']') {
|
||||
host = host.substring(1, host.length() -1);
|
||||
}
|
||||
@ -601,7 +601,7 @@ class Inet6Address extends InetAddress {
|
||||
boolean scope_ifname_set = gf.get("scope_ifname_set", false);
|
||||
String ifname = (String)gf.get("ifname", null);
|
||||
|
||||
if (ifname != null && !"".equals (ifname)) {
|
||||
if (ifname != null && !ifname.isEmpty()) {
|
||||
try {
|
||||
scope_ifname = NetworkInterface.getByName(ifname);
|
||||
if (scope_ifname == null) {
|
||||
|
@ -1187,7 +1187,7 @@ class InetAddress implements java.io.Serializable {
|
||||
*/
|
||||
public static InetAddress getByAddress(String host, byte[] addr)
|
||||
throws UnknownHostException {
|
||||
if (host != null && host.length() > 0 && host.charAt(0) == '[') {
|
||||
if (host != null && !host.isEmpty() && host.charAt(0) == '[') {
|
||||
if (host.charAt(host.length()-1) == ']') {
|
||||
host = host.substring(1, host.length() -1);
|
||||
}
|
||||
@ -1301,7 +1301,7 @@ class InetAddress implements java.io.Serializable {
|
||||
private static InetAddress[] getAllByName(String host, InetAddress reqAddr)
|
||||
throws UnknownHostException {
|
||||
|
||||
if (host == null || host.length() == 0) {
|
||||
if (host == null || host.isEmpty()) {
|
||||
InetAddress[] ret = new InetAddress[1];
|
||||
ret[0] = impl.loopbackAddress();
|
||||
return ret;
|
||||
|
@ -460,7 +460,7 @@ public final class SocketPermission extends Permission
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (host.length() > 0) {
|
||||
if (!host.isEmpty()) {
|
||||
// see if we are being initialized with an IP address.
|
||||
char ch = host.charAt(0);
|
||||
if (ch == ':' || Character.digit(ch, 16) != -1) {
|
||||
@ -705,8 +705,7 @@ public final class SocketPermission extends Permission
|
||||
.orElse(b);
|
||||
}
|
||||
|
||||
return cdomain.length() != 0 && hdomain.length() != 0
|
||||
&& cdomain.equals(hdomain);
|
||||
return !cdomain.isEmpty() && !hdomain.isEmpty() && cdomain.equals(hdomain);
|
||||
}
|
||||
|
||||
private boolean authorized(String cname, byte[] addr) {
|
||||
|
@ -1959,10 +1959,8 @@ public final class URI
|
||||
throws URISyntaxException
|
||||
{
|
||||
if (scheme != null) {
|
||||
if ((path != null)
|
||||
&& ((path.length() > 0) && (path.charAt(0) != '/')))
|
||||
throw new URISyntaxException(s,
|
||||
"Relative path in absolute URI");
|
||||
if (path != null && !path.isEmpty() && path.charAt(0) != '/')
|
||||
throw new URISyntaxException(s, "Relative path in absolute URI");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2163,7 +2161,7 @@ public final class URI
|
||||
ru.port = base.port;
|
||||
|
||||
String cp = (child.path == null) ? "" : child.path;
|
||||
if ((cp.length() > 0) && (cp.charAt(0) == '/')) {
|
||||
if (!cp.isEmpty() && cp.charAt(0) == '/') {
|
||||
// 5.2 (5): Child path is absolute
|
||||
ru.path = child.path;
|
||||
} else {
|
||||
@ -2187,7 +2185,7 @@ public final class URI
|
||||
// o.w., return a new URI containing the normalized path.
|
||||
//
|
||||
private static URI normalize(URI u) {
|
||||
if (u.isOpaque() || (u.path == null) || (u.path.length() == 0))
|
||||
if (u.isOpaque() || u.path == null || u.path.isEmpty())
|
||||
return u;
|
||||
|
||||
String np = normalize(u.path);
|
||||
|
@ -1513,7 +1513,7 @@ public final class URL implements java.io.Serializable {
|
||||
String ref = (String)gf.get("ref", null);
|
||||
int hashCode = gf.get("hashCode", -1);
|
||||
if (authority == null
|
||||
&& ((host != null && host.length() > 0) || port != -1)) {
|
||||
&& ((host != null && !host.isEmpty()) || port != -1)) {
|
||||
if (host == null)
|
||||
host = "";
|
||||
authority = (port == -1) ? host : host + ":" + port;
|
||||
@ -1560,7 +1560,7 @@ public final class URL implements java.io.Serializable {
|
||||
|
||||
// Construct authority part
|
||||
if (authority == null
|
||||
&& ((host != null && host.length() > 0) || port != -1)) {
|
||||
&& ((host != null && !host.isEmpty()) || port != -1)) {
|
||||
if (host == null)
|
||||
host = "";
|
||||
authority = (port == -1) ? host : host + ":" + port;
|
||||
@ -1716,7 +1716,7 @@ final class UrlDeserializedState {
|
||||
|
||||
// pre-compute length of StringBuffer
|
||||
int len = protocol.length() + 1;
|
||||
if (authority != null && authority.length() > 0)
|
||||
if (authority != null && !authority.isEmpty())
|
||||
len += 2 + authority.length();
|
||||
if (file != null) {
|
||||
len += file.length();
|
||||
@ -1726,7 +1726,7 @@ final class UrlDeserializedState {
|
||||
StringBuilder result = new StringBuilder(len);
|
||||
result.append(protocol);
|
||||
result.append(":");
|
||||
if (authority != null && authority.length() > 0) {
|
||||
if (authority != null && !authority.isEmpty()) {
|
||||
result.append("//");
|
||||
result.append(authority);
|
||||
}
|
||||
|
@ -743,7 +743,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
locUrl = ((JarURLConnection)urlConnection).getJarFileURL();
|
||||
}
|
||||
String host = locUrl.getHost();
|
||||
if (host != null && (host.length() > 0))
|
||||
if (host != null && !host.isEmpty())
|
||||
p = new SocketPermission(host,
|
||||
SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class URLDecoder {
|
||||
* @since 1.4
|
||||
*/
|
||||
public static String decode(String s, String enc) throws UnsupportedEncodingException {
|
||||
if (enc.length() == 0) {
|
||||
if (enc.isEmpty()) {
|
||||
throw new UnsupportedEncodingException ("URLDecoder: empty string enc parameter");
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ public final class URLPermission extends Permission {
|
||||
char c = methods.charAt(i);
|
||||
if (c == ',') {
|
||||
String s = b.toString();
|
||||
if (s.length() > 0)
|
||||
if (!s.isEmpty())
|
||||
l.add(s);
|
||||
b = new StringBuilder();
|
||||
} else if (c == ' ' || c == '\t') {
|
||||
@ -423,7 +423,7 @@ public final class URLPermission extends Permission {
|
||||
}
|
||||
}
|
||||
String s = b.toString();
|
||||
if (s.length() > 0)
|
||||
if (!s.isEmpty())
|
||||
l.add(s);
|
||||
return l;
|
||||
}
|
||||
@ -448,7 +448,7 @@ public final class URLPermission extends Permission {
|
||||
b.append(c);
|
||||
} else if (c == ',') {
|
||||
String s = b.toString();
|
||||
if (s.length() > 0)
|
||||
if (!s.isEmpty())
|
||||
l.add(s);
|
||||
b = new StringBuilder();
|
||||
capitalizeNext = true;
|
||||
@ -458,7 +458,7 @@ public final class URLPermission extends Permission {
|
||||
}
|
||||
}
|
||||
String s = b.toString();
|
||||
if (s.length() > 0)
|
||||
if (!s.isEmpty())
|
||||
l.add(s);
|
||||
return l;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ public abstract class URLStreamHandler {
|
||||
start = i;
|
||||
// If the authority is defined then the path is defined by the
|
||||
// spec only; See RFC 2396 Section 5.2.4.
|
||||
if (authority != null && authority.length() > 0)
|
||||
if (authority != null && !authority.isEmpty())
|
||||
path = "";
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ public abstract class URLStreamHandler {
|
||||
if (start < limit) {
|
||||
if (spec.charAt(start) == '/') {
|
||||
path = spec.substring(start, limit);
|
||||
} else if (path != null && path.length() > 0) {
|
||||
} else if (path != null && !path.isEmpty()) {
|
||||
isRelPath = true;
|
||||
int ind = path.lastIndexOf('/');
|
||||
String separator = "";
|
||||
@ -483,11 +483,11 @@ public abstract class URLStreamHandler {
|
||||
String s;
|
||||
return u.getProtocol()
|
||||
+ ':'
|
||||
+ (((s = u.getAuthority()) != null && s.length() > 0)
|
||||
+ ((s = u.getAuthority()) != null && !s.isEmpty()
|
||||
? "//" + s : "")
|
||||
+ (((s = u.getPath()) != null) ? s : "")
|
||||
+ (((s = u.getQuery()) != null) ? '?' + s : "")
|
||||
+ (((s = u.getRef()) != null) ? '#' + s : "");
|
||||
+ ((s = u.getPath()) != null ? s : "")
|
||||
+ ((s = u.getQuery()) != null ? '?' + s : "")
|
||||
+ ((s = u.getRef()) != null ? '#' + s : "");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -544,7 +544,7 @@ public abstract class URLStreamHandler {
|
||||
*/
|
||||
String authority = null;
|
||||
String userInfo = null;
|
||||
if (host != null && host.length() != 0) {
|
||||
if (host != null && !host.isEmpty()) {
|
||||
authority = (port == -1) ? host : host + ":" + port;
|
||||
int at = host.lastIndexOf('@');
|
||||
if (at != -1) {
|
||||
|
@ -104,7 +104,7 @@ public final class LinkPermission extends BasicPermission {
|
||||
public LinkPermission(String name, String actions) {
|
||||
super(name);
|
||||
checkName(name);
|
||||
if (actions != null && actions.length() > 0) {
|
||||
if (actions != null && !actions.isEmpty()) {
|
||||
throw new IllegalArgumentException("actions: " + actions);
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ public class AlgorithmParameterGenerator {
|
||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||
{
|
||||
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||
if (provider == null || provider.length() == 0)
|
||||
if (provider == null || provider.isEmpty())
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
Object[] objs = Security.getImpl(algorithm,
|
||||
"AlgorithmParameterGenerator",
|
||||
|
@ -209,7 +209,7 @@ public class AlgorithmParameters {
|
||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||
{
|
||||
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||
if (provider == null || provider.length() == 0)
|
||||
if (provider == null || provider.isEmpty())
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
|
||||
provider);
|
||||
|
@ -913,7 +913,7 @@ public class KeyStore {
|
||||
throws KeyStoreException, NoSuchProviderException
|
||||
{
|
||||
Objects.requireNonNull(type, "null type name");
|
||||
if (provider == null || provider.length() == 0)
|
||||
if (provider == null || provider.isEmpty())
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
try {
|
||||
Object[] objs = Security.getImpl(type, "KeyStore", provider);
|
||||
|
@ -237,7 +237,7 @@ public abstract class MessageDigest extends MessageDigestSpi {
|
||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||
{
|
||||
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||
if (provider == null || provider.length() == 0)
|
||||
if (provider == null || provider.isEmpty())
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
Object[] objs = Security.getImpl(algorithm, "MessageDigest", provider);
|
||||
if (objs[0] instanceof MessageDigest) {
|
||||
|
@ -222,7 +222,7 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
||||
*/
|
||||
public String toString() {
|
||||
String actions = getActions();
|
||||
if ((actions == null) || (actions.length() == 0)) { // OPTIONAL
|
||||
if (actions == null || actions.isEmpty()) { // OPTIONAL
|
||||
return "(\"" + getClass().getName() + "\" \"" + name + "\")";
|
||||
} else {
|
||||
return "(\"" + getClass().getName() + "\" \"" + name +
|
||||
|
@ -456,7 +456,7 @@ public abstract class Policy {
|
||||
throws NoSuchProviderException, NoSuchAlgorithmException {
|
||||
|
||||
Objects.requireNonNull(type, "null type name");
|
||||
if (provider == null || provider.length() == 0) {
|
||||
if (provider == null || provider.isEmpty()) {
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
}
|
||||
|
||||
|
@ -942,7 +942,7 @@ public class SecureRandom extends java.util.Random {
|
||||
}
|
||||
});
|
||||
|
||||
if ((property == null) || (property.length() == 0)) {
|
||||
if (property == null || property.isEmpty()) {
|
||||
throw new NoSuchAlgorithmException(
|
||||
"Null/empty securerandom.strongAlgorithms Security Property");
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ public final class Security {
|
||||
}
|
||||
}
|
||||
|
||||
if ((candidates == null) || (candidates.isEmpty()))
|
||||
if (candidates == null || candidates.isEmpty())
|
||||
return null;
|
||||
|
||||
Object[] candidatesArray = candidates.toArray();
|
||||
@ -1005,11 +1005,11 @@ public final class Security {
|
||||
String algName = null;
|
||||
String attrName = null;
|
||||
|
||||
if (filterValue.length() == 0) {
|
||||
if (filterValue.isEmpty()) {
|
||||
// The filterValue is an empty string. So the filterKey
|
||||
// should be in the format of <crypto_service>.<algorithm_or_type>.
|
||||
algName = filterKey.substring(algIndex + 1).trim();
|
||||
if (algName.length() == 0) {
|
||||
if (algName.isEmpty()) {
|
||||
// There must be a algorithm or type name.
|
||||
throw new InvalidParameterException("Invalid filter");
|
||||
}
|
||||
@ -1024,7 +1024,7 @@ public final class Security {
|
||||
throw new InvalidParameterException("Invalid filter");
|
||||
} else {
|
||||
attrName = filterKey.substring(attrIndex + 1).trim();
|
||||
if (attrName.length() == 0) {
|
||||
if (attrName.isEmpty()) {
|
||||
// There is no attribute name in the filter.
|
||||
throw new InvalidParameterException("Invalid filter");
|
||||
}
|
||||
@ -1070,7 +1070,7 @@ public final class Security {
|
||||
**/
|
||||
public static Set<String> getAlgorithms(String serviceName) {
|
||||
|
||||
if ((serviceName == null) || (serviceName.length() == 0) ||
|
||||
if ((serviceName == null) || (serviceName.isEmpty()) ||
|
||||
(serviceName.endsWith("."))) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ public abstract class Signature extends SignatureSpi {
|
||||
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
|
||||
// exception compatibility with existing code
|
||||
if ((provider == null) || (provider.length() == 0)) {
|
||||
if (provider == null || provider.isEmpty()) {
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
}
|
||||
Provider p = Security.getProvider(provider);
|
||||
|
@ -210,7 +210,7 @@ public class TrustAnchor {
|
||||
if (caName == null)
|
||||
throw new NullPointerException("the caName parameter must be " +
|
||||
"non-null");
|
||||
if (caName.length() == 0)
|
||||
if (caName.isEmpty())
|
||||
throw new IllegalArgumentException("the caName " +
|
||||
"parameter must be a non-empty String");
|
||||
// check if caName is formatted correctly
|
||||
|
@ -85,7 +85,7 @@ public class AttributedString {
|
||||
|
||||
text = buffer.toString();
|
||||
|
||||
if (text.length() > 0) {
|
||||
if (!text.isEmpty()) {
|
||||
// Determine the runs, creating a new run when the attributes
|
||||
// differ.
|
||||
int offset = 0;
|
||||
@ -144,7 +144,7 @@ public class AttributedString {
|
||||
}
|
||||
this.text = text;
|
||||
|
||||
if (text.length() == 0) {
|
||||
if (text.isEmpty()) {
|
||||
if (attributes.isEmpty())
|
||||
return;
|
||||
throw new IllegalArgumentException("Can't add attribute to 0-length text");
|
||||
|
@ -125,7 +125,7 @@ public final class CollationElementIterator
|
||||
CollationElementIterator(String sourceText, RuleBasedCollator owner) {
|
||||
this.owner = owner;
|
||||
ordering = owner.getTables();
|
||||
if ( sourceText.length() != 0 ) {
|
||||
if (!sourceText.isEmpty()) {
|
||||
NormalizerBase.Mode mode =
|
||||
CollatorUtilities.toNormalizerMode(owner.getDecomposition());
|
||||
text = new NormalizerBase(sourceText, mode);
|
||||
|
@ -799,7 +799,7 @@ public final class CompactNumberFormat extends NumberFormat {
|
||||
*/
|
||||
private void append(StringBuffer result, String string,
|
||||
FieldDelegate delegate, List<FieldPosition> positions) {
|
||||
if (string.length() > 0) {
|
||||
if (!string.isEmpty()) {
|
||||
int start = result.length();
|
||||
result.append(string);
|
||||
for (int counter = 0; counter < positions.size(); counter++) {
|
||||
@ -1213,7 +1213,7 @@ public final class CompactNumberFormat extends NumberFormat {
|
||||
}
|
||||
|
||||
// If no 0s are specified in a non empty pattern, it is invalid
|
||||
if (pattern.length() != 0 && zeros.isEmpty()) {
|
||||
if (!pattern.isEmpty() && zeros.isEmpty()) {
|
||||
throw new IllegalArgumentException("Invalid pattern"
|
||||
+ " [" + pattern + "]: all patterns must include digit"
|
||||
+ " placement 0s");
|
||||
|
@ -1113,11 +1113,9 @@ public class DecimalFormat extends NumberFormat {
|
||||
|
||||
// Records the need for adding prefix or suffix
|
||||
fastPathData.positiveAffixesRequired
|
||||
= (positivePrefix.length() != 0)
|
||||
|| (positiveSuffix.length() != 0);
|
||||
= !positivePrefix.isEmpty() || !positiveSuffix.isEmpty();
|
||||
fastPathData.negativeAffixesRequired
|
||||
= (negativePrefix.length() != 0)
|
||||
|| (negativeSuffix.length() != 0);
|
||||
= !negativePrefix.isEmpty() || !negativeSuffix.isEmpty();
|
||||
|
||||
// Creates a cached char container for result, with max possible size.
|
||||
int maxNbIntegralDigits = 10;
|
||||
@ -2062,7 +2060,7 @@ public class DecimalFormat extends NumberFormat {
|
||||
Format.Field signAttribute) {
|
||||
int start = result.length();
|
||||
|
||||
if (string.length() > 0) {
|
||||
if (!string.isEmpty()) {
|
||||
result.append(string);
|
||||
for (int counter = 0, max = positions.length; counter < max;
|
||||
counter++) {
|
||||
@ -3042,7 +3040,7 @@ public class DecimalFormat extends NumberFormat {
|
||||
} else {
|
||||
string = symbols.getCurrencySymbol();
|
||||
}
|
||||
if (string.length() > 0) {
|
||||
if (!string.isEmpty()) {
|
||||
if (positions == null) {
|
||||
positions = new ArrayList<>(2);
|
||||
}
|
||||
@ -3613,7 +3611,7 @@ public class DecimalFormat extends NumberFormat {
|
||||
}
|
||||
}
|
||||
|
||||
if (pattern.length() == 0) {
|
||||
if (pattern.isEmpty()) {
|
||||
posPrefixPattern = posSuffixPattern = "";
|
||||
setMinimumIntegerDigits(0);
|
||||
setMaximumIntegerDigits(MAXIMUM_INTEGER_DIGITS);
|
||||
|
@ -663,7 +663,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
|
||||
// Check for empty country string separately because it's a valid
|
||||
// country ID for Locale (and used for the C locale), but not a valid
|
||||
// ISO 3166 country code, and exceptions are expensive.
|
||||
if (locale.getCountry().length() > 0) {
|
||||
if (!locale.getCountry().isEmpty()) {
|
||||
try {
|
||||
currency = Currency.getInstance(locale);
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
@ -92,7 +92,7 @@ final class MergeCollation {
|
||||
int i;
|
||||
for (i = 0; i < patterns.size(); ++i) {
|
||||
PatternEntry entry = patterns.get(i);
|
||||
if (entry.extension.length() != 0) {
|
||||
if (!entry.extension.isEmpty()) {
|
||||
if (extList == null)
|
||||
extList = new ArrayList<>();
|
||||
extList.add(entry);
|
||||
@ -122,7 +122,7 @@ final class MergeCollation {
|
||||
private final PatternEntry findLastWithNoExtension(int i) {
|
||||
for (--i;i >= 0; --i) {
|
||||
PatternEntry entry = patterns.get(i);
|
||||
if (entry.extension.length() == 0) {
|
||||
if (entry.extension.isEmpty()) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
@ -1330,7 +1330,7 @@ public class MessageFormat extends Format {
|
||||
}
|
||||
arg = null;
|
||||
}
|
||||
if (arg != null && arg.length() > 0) {
|
||||
if (arg != null && !arg.isEmpty()) {
|
||||
result.append(arg);
|
||||
characterIterators.add(
|
||||
createAttributedCharacterIterator(
|
||||
@ -1476,7 +1476,7 @@ public class MessageFormat extends Format {
|
||||
|
||||
// now get the format
|
||||
Format newFormat = null;
|
||||
if (segments[SEG_TYPE].length() != 0) {
|
||||
if (!segments[SEG_TYPE].isEmpty()) {
|
||||
int type = findKeyword(segments[SEG_TYPE], TYPE_KEYWORDS);
|
||||
switch (type) {
|
||||
case TYPE_NULL:
|
||||
|
@ -141,7 +141,7 @@ class PatternEntry {
|
||||
if (showWhiteSpace)
|
||||
toAddTo.append(' ');
|
||||
appendQuoted(chars,toAddTo);
|
||||
if (showExtension && extension.length() != 0) {
|
||||
if (showExtension && !extension.isEmpty()) {
|
||||
toAddTo.append('/');
|
||||
appendQuoted(extension,toAddTo);
|
||||
}
|
||||
|
@ -75,13 +75,10 @@ final class RBTableBuilder {
|
||||
* @exception ParseException If the rules format is incorrect.
|
||||
*/
|
||||
|
||||
public void build(String pattern, int decmp) throws ParseException
|
||||
{
|
||||
boolean isSource = true;
|
||||
int i = 0;
|
||||
public void build(String pattern, int decmp) throws ParseException {
|
||||
String expChars;
|
||||
String groupChars;
|
||||
if (pattern.length() == 0)
|
||||
if (pattern.isEmpty())
|
||||
throw new ParseException("Build rules empty.", 0);
|
||||
|
||||
// This array maps Unicode characters to their collation ordering
|
||||
@ -119,8 +116,7 @@ final class RBTableBuilder {
|
||||
int order = 0;
|
||||
|
||||
// Now walk though each entry and add it to my own tables
|
||||
for (i = 0; i < mPattern.getCount(); ++i)
|
||||
{
|
||||
for (int i = 0; i < mPattern.getCount(); ++i) {
|
||||
PatternEntry entry = mPattern.getItemAt(i);
|
||||
if (entry != null) {
|
||||
groupChars = entry.getChars();
|
||||
@ -140,7 +136,7 @@ final class RBTableBuilder {
|
||||
order = increment(entry.getStrength(), order);
|
||||
expChars = entry.getExtension();
|
||||
|
||||
if (expChars.length() != 0) {
|
||||
if (!expChars.isEmpty()) {
|
||||
addExpandOrder(groupChars, expChars, order);
|
||||
} else if (groupChars.length() > 1) {
|
||||
char ch = groupChars.charAt(0);
|
||||
|
@ -372,7 +372,7 @@ public abstract class ZoneId implements Serializable {
|
||||
public static ZoneId ofOffset(String prefix, ZoneOffset offset) {
|
||||
Objects.requireNonNull(prefix, "prefix");
|
||||
Objects.requireNonNull(offset, "offset");
|
||||
if (prefix.length() == 0) {
|
||||
if (prefix.isEmpty()) {
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
@ -1439,7 +1439,7 @@ public final class DateTimeFormatterBuilder {
|
||||
*/
|
||||
public DateTimeFormatterBuilder appendLiteral(String literal) {
|
||||
Objects.requireNonNull(literal, "literal");
|
||||
if (literal.length() > 0) {
|
||||
if (!literal.isEmpty()) {
|
||||
if (literal.length() == 1) {
|
||||
appendInternal(new CharLiteralPrinterParser(literal.charAt(0)));
|
||||
} else {
|
||||
@ -1832,7 +1832,7 @@ public final class DateTimeFormatterBuilder {
|
||||
throw new IllegalArgumentException("Pattern ends with an incomplete string literal: " + pattern);
|
||||
}
|
||||
String str = pattern.substring(start + 1, pos);
|
||||
if (str.length() == 0) {
|
||||
if (str.isEmpty()) {
|
||||
appendLiteral('\'');
|
||||
} else {
|
||||
appendLiteral(str.replace("''", "'"));
|
||||
@ -4332,7 +4332,7 @@ public final class DateTimeFormatterBuilder {
|
||||
this.key = k;
|
||||
this.value = v;
|
||||
this.child = child;
|
||||
if (k.length() == 0){
|
||||
if (k.isEmpty()) {
|
||||
c0 = 0xffff;
|
||||
} else {
|
||||
c0 = key.charAt(0);
|
||||
|
@ -2232,7 +2232,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
if (strings != null) {
|
||||
Map<String,Integer> names = new HashMap<>();
|
||||
for (int i = 0; i < strings.length; i++) {
|
||||
if (strings[i].length() == 0) {
|
||||
if (strings[i].isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
names.put(strings[i], i);
|
||||
|
@ -1396,11 +1396,11 @@ public final class Locale implements Cloneable, Serializable {
|
||||
*/
|
||||
@Override
|
||||
public final String toString() {
|
||||
boolean l = (baseLocale.getLanguage().length() != 0);
|
||||
boolean s = (baseLocale.getScript().length() != 0);
|
||||
boolean r = (baseLocale.getRegion().length() != 0);
|
||||
boolean v = (baseLocale.getVariant().length() != 0);
|
||||
boolean e = (localeExtensions != null && localeExtensions.getID().length() != 0);
|
||||
boolean l = !baseLocale.getLanguage().isEmpty();
|
||||
boolean s = !baseLocale.getScript().isEmpty();
|
||||
boolean r = !baseLocale.getRegion().isEmpty();
|
||||
boolean v = !baseLocale.getVariant().isEmpty();
|
||||
boolean e = localeExtensions != null && !localeExtensions.getID().isEmpty();
|
||||
|
||||
StringBuilder result = new StringBuilder(baseLocale.getLanguage());
|
||||
if (r || (l && (v || s || e))) {
|
||||
@ -1504,18 +1504,18 @@ public final class Locale implements Cloneable, Serializable {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
||||
String subtag = tag.getLanguage();
|
||||
if (subtag.length() > 0) {
|
||||
if (!subtag.isEmpty()) {
|
||||
buf.append(LanguageTag.canonicalizeLanguage(subtag));
|
||||
}
|
||||
|
||||
subtag = tag.getScript();
|
||||
if (subtag.length() > 0) {
|
||||
if (!subtag.isEmpty()) {
|
||||
buf.append(LanguageTag.SEP);
|
||||
buf.append(LanguageTag.canonicalizeScript(subtag));
|
||||
}
|
||||
|
||||
subtag = tag.getRegion();
|
||||
if (subtag.length() > 0) {
|
||||
if (!subtag.isEmpty()) {
|
||||
buf.append(LanguageTag.SEP);
|
||||
buf.append(LanguageTag.canonicalizeRegion(subtag));
|
||||
}
|
||||
@ -1534,7 +1534,7 @@ public final class Locale implements Cloneable, Serializable {
|
||||
}
|
||||
|
||||
subtag = tag.getPrivateuse();
|
||||
if (subtag.length() > 0) {
|
||||
if (!subtag.isEmpty()) {
|
||||
if (buf.length() > 0) {
|
||||
buf.append(LanguageTag.SEP);
|
||||
}
|
||||
@ -1684,7 +1684,7 @@ public final class Locale implements Cloneable, Serializable {
|
||||
bldr.setLanguageTag(tag);
|
||||
BaseLocale base = bldr.getBaseLocale();
|
||||
LocaleExtensions exts = bldr.getLocaleExtensions();
|
||||
if (exts == null && base.getVariant().length() > 0) {
|
||||
if (exts == null && !base.getVariant().isEmpty()) {
|
||||
exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(),
|
||||
base.getRegion(), base.getVariant());
|
||||
}
|
||||
@ -1917,7 +1917,7 @@ public final class Locale implements Cloneable, Serializable {
|
||||
* @exception NullPointerException if <code>inLocale</code> is <code>null</code>
|
||||
*/
|
||||
public String getDisplayVariant(Locale inLocale) {
|
||||
if (baseLocale.getVariant().length() == 0)
|
||||
if (baseLocale.getVariant().isEmpty())
|
||||
return "";
|
||||
|
||||
LocaleResources lr = LocaleProviderAdapter
|
||||
@ -1998,14 +1998,14 @@ public final class Locale implements Cloneable, Serializable {
|
||||
// The display name consists of a main name, followed by qualifiers.
|
||||
// Typically, the format is "MainName (Qualifier, Qualifier)" but this
|
||||
// depends on what pattern is stored in the display locale.
|
||||
String mainName = null;
|
||||
String[] qualifierNames = null;
|
||||
String mainName;
|
||||
String[] qualifierNames;
|
||||
|
||||
// The main name is the language, or if there is no language, the script,
|
||||
// then if no script, the country. If there is no language/script/country
|
||||
// (an anomalous situation) then the display name is simply the variant's
|
||||
// display name.
|
||||
if (languageName.length() == 0 && scriptName.length() == 0 && countryName.length() == 0) {
|
||||
if (languageName.isEmpty() && scriptName.isEmpty() && countryName.isEmpty()) {
|
||||
if (variantNames.length == 0) {
|
||||
return "";
|
||||
} else {
|
||||
@ -2013,13 +2013,13 @@ public final class Locale implements Cloneable, Serializable {
|
||||
}
|
||||
}
|
||||
ArrayList<String> names = new ArrayList<>(4);
|
||||
if (languageName.length() != 0) {
|
||||
if (!languageName.isEmpty()) {
|
||||
names.add(languageName);
|
||||
}
|
||||
if (scriptName.length() != 0) {
|
||||
if (!scriptName.isEmpty()) {
|
||||
names.add(scriptName);
|
||||
}
|
||||
if (countryName.length() != 0) {
|
||||
if (!countryName.isEmpty()) {
|
||||
names.add(countryName);
|
||||
}
|
||||
if (variantNames.length != 0) {
|
||||
@ -2309,7 +2309,7 @@ public final class Locale implements Cloneable, Serializable {
|
||||
String variant = (String)fields.get("variant", "");
|
||||
String extStr = (String)fields.get("extensions", "");
|
||||
baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant);
|
||||
if (extStr.length() > 0) {
|
||||
if (!extStr.isEmpty()) {
|
||||
try {
|
||||
InternalLocaleBuilder bldr = new InternalLocaleBuilder();
|
||||
bldr.setExtensions(extStr);
|
||||
@ -2367,13 +2367,13 @@ public final class Locale implements Cloneable, Serializable {
|
||||
LocaleExtensions extensions = null;
|
||||
// Special cases for backward compatibility support
|
||||
if (LocaleUtils.caseIgnoreMatch(language, "ja")
|
||||
&& script.length() == 0
|
||||
&& script.isEmpty()
|
||||
&& LocaleUtils.caseIgnoreMatch(country, "jp")
|
||||
&& "JP".equals(variant)) {
|
||||
// ja_JP_JP -> u-ca-japanese (calendar = japanese)
|
||||
extensions = LocaleExtensions.CALENDAR_JAPANESE;
|
||||
} else if (LocaleUtils.caseIgnoreMatch(language, "th")
|
||||
&& script.length() == 0
|
||||
&& script.isEmpty()
|
||||
&& LocaleUtils.caseIgnoreMatch(country, "th")
|
||||
&& "TH".equals(variant)) {
|
||||
// th_TH_TH -> u-nu-thai (numbersystem = thai)
|
||||
@ -2806,7 +2806,7 @@ public final class Locale implements Cloneable, Serializable {
|
||||
public Locale build() {
|
||||
BaseLocale baseloc = localeBuilder.getBaseLocale();
|
||||
LocaleExtensions extensions = localeBuilder.getLocaleExtensions();
|
||||
if (extensions == null && baseloc.getVariant().length() > 0) {
|
||||
if (extensions == null && !baseloc.getVariant().isEmpty()) {
|
||||
extensions = getCompatibilityExtensions(baseloc.getLanguage(), baseloc.getScript(),
|
||||
baseloc.getRegion(), baseloc.getVariant());
|
||||
}
|
||||
|
@ -771,8 +771,8 @@ public abstract class ResourceBundle {
|
||||
@Override
|
||||
public String toString() {
|
||||
String l = locale.toString();
|
||||
if (l.length() == 0) {
|
||||
if (locale.getVariant().length() != 0) {
|
||||
if (l.isEmpty()) {
|
||||
if (!locale.getVariant().isEmpty()) {
|
||||
l = "__" + locale.getVariant();
|
||||
} else {
|
||||
l = "\"\"";
|
||||
@ -2903,7 +2903,7 @@ public abstract class ResourceBundle {
|
||||
List<Locale> bokmalList = new LinkedList<>();
|
||||
for (Locale l : tmpList) {
|
||||
bokmalList.add(l);
|
||||
if (l.getLanguage().length() == 0) {
|
||||
if (l.getLanguage().isEmpty()) {
|
||||
break;
|
||||
}
|
||||
bokmalList.add(Locale.getInstance("no", l.getScript(), l.getCountry(),
|
||||
@ -2921,7 +2921,7 @@ public abstract class ResourceBundle {
|
||||
}
|
||||
// Special handling for Chinese
|
||||
else if (language.equals("zh")) {
|
||||
if (script.length() == 0 && region.length() > 0) {
|
||||
if (script.isEmpty() && !region.isEmpty()) {
|
||||
// Supply script for users who want to use zh_Hans/zh_Hant
|
||||
// as bundle names (recommended for Java7+)
|
||||
switch (region) {
|
||||
@ -2944,7 +2944,7 @@ public abstract class ResourceBundle {
|
||||
private static List<Locale> getDefaultList(String language, String script, String region, String variant) {
|
||||
List<String> variants = null;
|
||||
|
||||
if (variant.length() > 0) {
|
||||
if (!variant.isEmpty()) {
|
||||
variants = new LinkedList<>();
|
||||
int idx = variant.length();
|
||||
while (idx != -1) {
|
||||
@ -2960,14 +2960,14 @@ public abstract class ResourceBundle {
|
||||
list.add(Locale.getInstance(language, script, region, v, null));
|
||||
}
|
||||
}
|
||||
if (region.length() > 0) {
|
||||
if (!region.isEmpty()) {
|
||||
list.add(Locale.getInstance(language, script, region, "", null));
|
||||
}
|
||||
if (script.length() > 0) {
|
||||
if (!script.isEmpty()) {
|
||||
list.add(Locale.getInstance(language, script, "", "", null));
|
||||
// Special handling for Chinese
|
||||
if (language.equals("zh")) {
|
||||
if (region.length() == 0) {
|
||||
if (region.isEmpty()) {
|
||||
// Supply region(country) for users who still package Chinese
|
||||
// bundles using old convension.
|
||||
switch (script) {
|
||||
@ -2988,11 +2988,11 @@ public abstract class ResourceBundle {
|
||||
list.add(Locale.getInstance(language, "", region, v, null));
|
||||
}
|
||||
}
|
||||
if (region.length() > 0) {
|
||||
if (!region.isEmpty()) {
|
||||
list.add(Locale.getInstance(language, "", region, "", null));
|
||||
}
|
||||
}
|
||||
if (language.length() > 0) {
|
||||
if (!language.isEmpty()) {
|
||||
list.add(Locale.getInstance(language, "", "", "", null));
|
||||
}
|
||||
// Add root locale at the end
|
||||
|
@ -1297,16 +1297,16 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
nanString = "\\Q" + dfs.getNaN() + "\\E";
|
||||
infinityString = "\\Q" + dfs.getInfinity() + "\\E";
|
||||
positivePrefix = df.getPositivePrefix();
|
||||
if (positivePrefix.length() > 0)
|
||||
if (!positivePrefix.isEmpty())
|
||||
positivePrefix = "\\Q" + positivePrefix + "\\E";
|
||||
negativePrefix = df.getNegativePrefix();
|
||||
if (negativePrefix.length() > 0)
|
||||
if (!negativePrefix.isEmpty())
|
||||
negativePrefix = "\\Q" + negativePrefix + "\\E";
|
||||
positiveSuffix = df.getPositiveSuffix();
|
||||
if (positiveSuffix.length() > 0)
|
||||
if (!positiveSuffix.isEmpty())
|
||||
positiveSuffix = "\\Q" + positiveSuffix + "\\E";
|
||||
negativeSuffix = df.getNegativeSuffix();
|
||||
if (negativeSuffix.length() > 0)
|
||||
if (!negativeSuffix.isEmpty())
|
||||
negativeSuffix = "\\Q" + negativeSuffix + "\\E";
|
||||
|
||||
// Force rebuilding and recompilation of locale dependent
|
||||
|
@ -1390,7 +1390,7 @@ public final class Pattern
|
||||
localTCNCount = 0;
|
||||
|
||||
// if length > 0, the Pattern is lazily compiled
|
||||
if (pattern.length() == 0) {
|
||||
if (pattern.isEmpty()) {
|
||||
root = new Start(lastAccept);
|
||||
matchRoot = lastAccept;
|
||||
compiled = true;
|
||||
@ -1423,7 +1423,7 @@ public final class Pattern
|
||||
localCount = 0;
|
||||
localTCNCount = 0;
|
||||
|
||||
if (pattern.length() > 0) {
|
||||
if (!pattern.isEmpty()) {
|
||||
compile();
|
||||
} else {
|
||||
root = new Start(lastAccept);
|
||||
|
@ -341,7 +341,7 @@ public class Cipher {
|
||||
throw new NoSuchAlgorithmException("Invalid transformation " +
|
||||
"format:" + transformation);
|
||||
}
|
||||
if ((parts[0] == null) || (parts[0].length() == 0)) {
|
||||
if ((parts[0] == null) || (parts[0].isEmpty())) {
|
||||
throw new NoSuchAlgorithmException("Invalid transformation:" +
|
||||
"algorithm not specified-"
|
||||
+ transformation);
|
||||
@ -445,10 +445,10 @@ public class Cipher {
|
||||
String alg = parts[0];
|
||||
String mode = parts[1];
|
||||
String pad = parts[2];
|
||||
if ((mode != null) && (mode.length() == 0)) {
|
||||
if ((mode != null) && (mode.isEmpty())) {
|
||||
mode = null;
|
||||
}
|
||||
if ((pad != null) && (pad.length() == 0)) {
|
||||
if ((pad != null) && (pad.isEmpty())) {
|
||||
pad = null;
|
||||
}
|
||||
|
||||
@ -634,7 +634,7 @@ public class Cipher {
|
||||
if ((transformation == null) || transformation.isEmpty()) {
|
||||
throw new NoSuchAlgorithmException("Null or empty transformation");
|
||||
}
|
||||
if ((provider == null) || (provider.length() == 0)) {
|
||||
if ((provider == null) || (provider.isEmpty())) {
|
||||
throw new IllegalArgumentException("Missing provider");
|
||||
}
|
||||
Provider p = Security.getProvider(provider);
|
||||
|
@ -337,7 +337,7 @@ public class SealedObject implements Serializable {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key is null");
|
||||
}
|
||||
if (provider == null || provider.length() == 0) {
|
||||
if (provider == null || provider.isEmpty()) {
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public abstract class SSLSocketFactory extends SocketFactory
|
||||
String s = java.security.Security.getProperty(name);
|
||||
if (s != null) {
|
||||
s = s.trim();
|
||||
if (s.length() == 0) {
|
||||
if (s.isEmpty()) {
|
||||
s = null;
|
||||
}
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ public final class PrivateCredentialPermission extends Permission {
|
||||
|
||||
private void init(String name) {
|
||||
|
||||
if (name == null || name.trim().length() == 0) {
|
||||
if (name == null || name.trim().isEmpty()) {
|
||||
throw new IllegalArgumentException("invalid empty name");
|
||||
}
|
||||
|
||||
|
@ -98,13 +98,13 @@ public class ChoiceCallback implements Callback, java.io.Serializable {
|
||||
public ChoiceCallback(String prompt, String[] choices,
|
||||
int defaultChoice, boolean multipleSelectionsAllowed) {
|
||||
|
||||
if (prompt == null || prompt.length() == 0 ||
|
||||
if (prompt == null || prompt.isEmpty() ||
|
||||
choices == null || choices.length == 0 ||
|
||||
defaultChoice < 0 || defaultChoice >= choices.length)
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
for (int i = 0; i < choices.length; i++) {
|
||||
if (choices[i] == null || choices[i].length() == 0)
|
||||
if (choices[i] == null || choices[i].isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
if (options[i] == null || options[i].length() == 0)
|
||||
if (options[i] == null || options[i].isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
|
||||
public ConfirmationCallback(String prompt, int messageType,
|
||||
int optionType, int defaultOption) {
|
||||
|
||||
if (prompt == null || prompt.length() == 0 ||
|
||||
if (prompt == null || prompt.isEmpty() ||
|
||||
messageType < INFORMATION || messageType > ERROR ||
|
||||
optionType < YES_NO_OPTION || optionType > OK_CANCEL_OPTION)
|
||||
throw new IllegalArgumentException();
|
||||
@ -357,14 +357,14 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
|
||||
public ConfirmationCallback(String prompt, int messageType,
|
||||
String[] options, int defaultOption) {
|
||||
|
||||
if (prompt == null || prompt.length() == 0 ||
|
||||
if (prompt == null || prompt.isEmpty() ||
|
||||
messageType < INFORMATION || messageType > ERROR ||
|
||||
options == null || options.length == 0 ||
|
||||
defaultOption < 0 || defaultOption >= options.length)
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
if (options[i] == null || options[i].length() == 0)
|
||||
if (options[i] == null || options[i].isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class NameCallback implements Callback, java.io.Serializable {
|
||||
* or if {@code prompt} has a length of 0.
|
||||
*/
|
||||
public NameCallback(String prompt) {
|
||||
if (prompt == null || prompt.length() == 0)
|
||||
if (prompt == null || prompt.isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
this.prompt = prompt;
|
||||
}
|
||||
@ -82,8 +82,8 @@ public class NameCallback implements Callback, java.io.Serializable {
|
||||
* or if {@code defaultName} has a length of 0.
|
||||
*/
|
||||
public NameCallback(String prompt, String defaultName) {
|
||||
if (prompt == null || prompt.length() == 0 ||
|
||||
defaultName == null || defaultName.length() == 0)
|
||||
if (prompt == null || prompt.isEmpty() ||
|
||||
defaultName == null || defaultName.isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
this.prompt = prompt;
|
||||
|
@ -67,7 +67,7 @@ public class PasswordCallback implements Callback, java.io.Serializable {
|
||||
* if {@code prompt} has a length of 0.
|
||||
*/
|
||||
public PasswordCallback(String prompt, boolean echoOn) {
|
||||
if (prompt == null || prompt.length() == 0)
|
||||
if (prompt == null || prompt.isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
this.prompt = prompt;
|
||||
|
@ -63,7 +63,7 @@ public class TextInputCallback implements Callback, java.io.Serializable {
|
||||
* or if {@code prompt} has a length of 0.
|
||||
*/
|
||||
public TextInputCallback(String prompt) {
|
||||
if (prompt == null || prompt.length() == 0)
|
||||
if (prompt == null || prompt.isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
this.prompt = prompt;
|
||||
}
|
||||
@ -83,8 +83,8 @@ public class TextInputCallback implements Callback, java.io.Serializable {
|
||||
* or if {@code defaultText} has a length of 0.
|
||||
*/
|
||||
public TextInputCallback(String prompt, String defaultText) {
|
||||
if (prompt == null || prompt.length() == 0 ||
|
||||
defaultText == null || defaultText.length() == 0)
|
||||
if (prompt == null || prompt.isEmpty() ||
|
||||
defaultText == null || defaultText.isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
this.prompt = prompt;
|
||||
|
@ -74,7 +74,7 @@ public class TextOutputCallback implements Callback, java.io.Serializable {
|
||||
public TextOutputCallback(int messageType, String message) {
|
||||
if ((messageType != INFORMATION &&
|
||||
messageType != WARNING && messageType != ERROR) ||
|
||||
message == null || message.length() == 0)
|
||||
message == null || message.isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
this.messageType = messageType;
|
||||
|
@ -75,7 +75,7 @@ public class AppConfigurationEntry {
|
||||
LoginModuleControlFlag controlFlag,
|
||||
Map<String,?> options)
|
||||
{
|
||||
if (loginModuleName == null || loginModuleName.length() == 0 ||
|
||||
if (loginModuleName == null || loginModuleName.isEmpty() ||
|
||||
(controlFlag != LoginModuleControlFlag.REQUIRED &&
|
||||
controlFlag != LoginModuleControlFlag.REQUISITE &&
|
||||
controlFlag != LoginModuleControlFlag.SUFFICIENT &&
|
||||
|
@ -418,7 +418,7 @@ public abstract class Configuration {
|
||||
throws NoSuchProviderException, NoSuchAlgorithmException {
|
||||
|
||||
Objects.requireNonNull(type, "null type name");
|
||||
if (provider == null || provider.length() == 0) {
|
||||
if (provider == null || provider.isEmpty()) {
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ public class LoginContext {
|
||||
public CallbackHandler run() throws Exception {
|
||||
String defaultHandler = java.security.Security.getProperty
|
||||
(DEFAULT_HANDLER);
|
||||
if (defaultHandler == null || defaultHandler.length() == 0)
|
||||
if (defaultHandler == null || defaultHandler.isEmpty())
|
||||
return null;
|
||||
Class<? extends CallbackHandler> c = Class.forName(
|
||||
defaultHandler, true,
|
||||
|
@ -210,7 +210,7 @@ public abstract class X509Certificate extends Certificate {
|
||||
* under JDK1.1.
|
||||
*/
|
||||
String className = X509Provider;
|
||||
if (className == null || className.length() == 0) {
|
||||
if (className == null || className.isEmpty()) {
|
||||
// shouldn't happen, but assume corrupted properties file
|
||||
// provide access to sun implementation
|
||||
className = "com.sun.security.cert.internal.x509.X509V1CertImpl";
|
||||
|
@ -60,7 +60,7 @@ public class SignatureParser {
|
||||
switch (c) {
|
||||
case 'L': {
|
||||
String pkg = arguments.get(arg_index);
|
||||
if(pkg.length() > 0) {
|
||||
if(!pkg.isEmpty()) {
|
||||
out.append(pkg).append("/");
|
||||
}
|
||||
arg_index+=1;
|
||||
|
@ -168,7 +168,7 @@ public class StringSharingDecompressor implements ResourceDecompressor {
|
||||
int index = indices.get(argIndex);
|
||||
argIndex += 1;
|
||||
String pkg = reader.getString(index);
|
||||
if (pkg.length() > 0) {
|
||||
if (!pkg.isEmpty()) {
|
||||
pkg = pkg + "/";
|
||||
byte[] encoded = getEncoded(pkg);
|
||||
buffer = safeAdd(buffer, encoded);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user