--- a/.hgtags Wed Dec 19 08:32:48 2018 +0100
+++ b/.hgtags Wed Dec 19 20:53:30 2018 +0100
@@ -526,4 +526,5 @@
f8fb0c86f2b3d24294d39c5685a628e1beb14ba7 jdk-12+21
732bec44c89e8b93a38296bf690f97b7230c5b6d jdk-12+22
eef755718cb24813031a842bbfc716a6cea18e9a jdk-12+23
+cc4098b3bc10d1c390384289025fea7b0d4b9e93 jdk-13+0
7d4397b43fa305806160785a4c7210600d59581a jdk-12+24
--- a/make/autoconf/version-numbers Wed Dec 19 08:32:48 2018 +0100
+++ b/make/autoconf/version-numbers Wed Dec 19 20:53:30 2018 +0100
@@ -25,17 +25,17 @@
# Default version numbers to use unless overridden by configure
-DEFAULT_VERSION_FEATURE=12
+DEFAULT_VERSION_FEATURE=13
DEFAULT_VERSION_INTERIM=0
DEFAULT_VERSION_UPDATE=0
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_EXTRA1=0
DEFAULT_VERSION_EXTRA2=0
DEFAULT_VERSION_EXTRA3=0
-DEFAULT_VERSION_DATE=2019-03-19
-DEFAULT_VERSION_CLASSFILE_MAJOR=56 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
+DEFAULT_VERSION_DATE=2019-09-17
+DEFAULT_VERSION_CLASSFILE_MAJOR=57 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
-DEFAULT_ACCEPTABLE_BOOT_VERSIONS="11 12"
+DEFAULT_ACCEPTABLE_BOOT_VERSIONS="11 12 13"
LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK
--- a/make/common/SetupJavaCompilers.gmk Wed Dec 19 08:32:48 2018 +0100
+++ b/make/common/SetupJavaCompilers.gmk Wed Dec 19 20:53:30 2018 +0100
@@ -72,7 +72,7 @@
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -source 12 -target 12 --doclint-format html5 \
+ FLAGS := -source 13 -target 13 --doclint-format html5 \
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -82,7 +82,7 @@
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -source 12 -target 12 \
+ FLAGS := -source 13 -target 13 \
-encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/src/hotspot/cpu/aarch64/aarch64.ad Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/cpu/aarch64/aarch64.ad Wed Dec 19 20:53:30 2018 +0100
@@ -12606,6 +12606,63 @@
%}
+// Math.max(FF)F
+instruct maxF_reg_reg(vRegF dst, vRegF src1, vRegF src2) %{
+ match(Set dst (MaxF src1 src2));
+
+ format %{ "fmaxs $dst, $src1, $src2" %}
+ ins_encode %{
+ __ fmaxs(as_FloatRegister($dst$$reg),
+ as_FloatRegister($src1$$reg),
+ as_FloatRegister($src2$$reg));
+ %}
+
+ ins_pipe(fp_dop_reg_reg_s);
+%}
+
+// Math.min(FF)F
+instruct minF_reg_reg(vRegF dst, vRegF src1, vRegF src2) %{
+ match(Set dst (MinF src1 src2));
+
+ format %{ "fmins $dst, $src1, $src2" %}
+ ins_encode %{
+ __ fmins(as_FloatRegister($dst$$reg),
+ as_FloatRegister($src1$$reg),
+ as_FloatRegister($src2$$reg));
+ %}
+
+ ins_pipe(fp_dop_reg_reg_s);
+%}
+
+// Math.max(DD)D
+instruct maxD_reg_reg(vRegD dst, vRegD src1, vRegD src2) %{
+ match(Set dst (MaxD src1 src2));
+
+ format %{ "fmaxd $dst, $src1, $src2" %}
+ ins_encode %{
+ __ fmaxd(as_FloatRegister($dst$$reg),
+ as_FloatRegister($src1$$reg),
+ as_FloatRegister($src2$$reg));
+ %}
+
+ ins_pipe(fp_dop_reg_reg_d);
+%}
+
+// Math.min(DD)D
+instruct minD_reg_reg(vRegD dst, vRegD src1, vRegD src2) %{
+ match(Set dst (MinD src1 src2));
+
+ format %{ "fmind $dst, $src1, $src2" %}
+ ins_encode %{
+ __ fmind(as_FloatRegister($dst$$reg),
+ as_FloatRegister($src1$$reg),
+ as_FloatRegister($src2$$reg));
+ %}
+
+ ins_pipe(fp_dop_reg_reg_d);
+%}
+
+
instruct divF_reg_reg(vRegF dst, vRegF src1, vRegF src2) %{
match(Set dst (DivF src1 src2));
--- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp Wed Dec 19 20:53:30 2018 +0100
@@ -1826,12 +1826,16 @@
INSN(fdivs, 0b000, 0b00, 0b0001);
INSN(fadds, 0b000, 0b00, 0b0010);
INSN(fsubs, 0b000, 0b00, 0b0011);
+ INSN(fmaxs, 0b000, 0b00, 0b0100);
+ INSN(fmins, 0b000, 0b00, 0b0101);
INSN(fnmuls, 0b000, 0b00, 0b1000);
INSN(fmuld, 0b000, 0b01, 0b0000);
INSN(fdivd, 0b000, 0b01, 0b0001);
INSN(faddd, 0b000, 0b01, 0b0010);
INSN(fsubd, 0b000, 0b01, 0b0011);
+ INSN(fmaxd, 0b000, 0b01, 0b0100);
+ INSN(fmind, 0b000, 0b01, 0b0101);
INSN(fnmuld, 0b000, 0b01, 0b1000);
#undef INSN
--- a/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -105,8 +105,8 @@
// compiled code in threads for which the event is enabled. Check here for
// interp_only_mode if these events CAN be enabled.
- __ ldrb(rscratch1, Address(rthread, JavaThread::interp_only_mode_offset()));
- __ cbnz(rscratch1, run_compiled_code);
+ __ ldrw(rscratch1, Address(rthread, JavaThread::interp_only_mode_offset()));
+ __ cbzw(rscratch1, run_compiled_code);
__ ldr(rscratch1, Address(method, Method::interpreter_entry_offset()));
__ br(rscratch1);
__ BIND(run_compiled_code);
--- a/src/hotspot/share/adlc/formssel.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/adlc/formssel.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -3801,7 +3801,7 @@
"AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
"AndI","AndL",
"AndV",
- "MaxI","MinI",
+ "MaxI","MinI","MaxF","MinF","MaxD","MinD",
"MulI","MulL","MulF","MulD",
"MulVS","MulVI","MulVL","MulVF","MulVD",
"OrI","OrL",
--- a/src/hotspot/share/c1/c1_Instruction.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/c1/c1_Instruction.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -827,9 +827,16 @@
for_each_local_value(existing_state, index, existing_value) {
Value new_value = new_state->local_at(index);
if (new_value == NULL || new_value->type()->tag() != existing_value->type()->tag()) {
- // The old code invalidated the phi function here
- // Because dead locals are replaced with NULL, this is a very rare case now, so simply bail out
- return false; // BAILOUT in caller
+ Phi* existing_phi = existing_value->as_Phi();
+ if (existing_phi == NULL) {
+ return false; // BAILOUT in caller
+ }
+ // Invalidate the phi function here. This case is very rare except for
+ // JVMTI capability "can_access_local_variables".
+ // In really rare cases we will bail out in LIRGenerator::move_to_phi.
+ existing_phi->make_illegal();
+ existing_state->invalidate_local(index);
+ TRACE_PHI(tty->print_cr("invalidating local %d because of type mismatch", index));
}
}
--- a/src/hotspot/share/c1/c1_LIRGenerator.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -1113,7 +1113,7 @@
// no moves are created for phi functions at the begin of exception
// handlers, so assign operands manually here
for_each_phi_fun(block(), phi,
- operand_for_instruction(phi));
+ if (!phi->is_illegal()) { operand_for_instruction(phi); });
LIR_Opr thread_reg = getThreadPointer();
__ move_wide(new LIR_Address(thread_reg, in_bytes(JavaThread::exception_oop_offset()), T_OBJECT),
--- a/src/hotspot/share/c1/c1_LinearScan.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/c1/c1_LinearScan.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -574,7 +574,7 @@
// Phi functions at the begin of an exception handler are
// implicitly defined (= killed) at the beginning of the block.
for_each_phi_fun(block, phi,
- live_kill.set_bit(phi->operand()->vreg_number())
+ if (!phi->is_illegal()) { live_kill.set_bit(phi->operand()->vreg_number()); }
);
}
@@ -1904,7 +1904,7 @@
// the live_in bits are not set for phi functions of the xhandler entry, so iterate them separately
for_each_phi_fun(block, phi,
- resolve_exception_entry(block, phi->operand()->vreg_number(), move_resolver)
+ if (!phi->is_illegal()) { resolve_exception_entry(block, phi->operand()->vreg_number(), move_resolver); }
);
if (move_resolver.has_mappings()) {
@@ -1978,7 +1978,7 @@
// the live_in bits are not set for phi functions of the xhandler entry, so iterate them separately
for_each_phi_fun(block, phi,
- resolve_exception_edge(handler, throwing_op_id, phi->operand()->vreg_number(), phi, move_resolver)
+ if (!phi->is_illegal()) { resolve_exception_edge(handler, throwing_op_id, phi->operand()->vreg_number(), phi, move_resolver); }
);
if (move_resolver.has_mappings()) {
--- a/src/hotspot/share/c1/c1_ValueStack.hpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/c1/c1_ValueStack.hpp Wed Dec 19 20:53:30 2018 +0100
@@ -299,7 +299,7 @@
}
-// Macro definition for simple iteration of all phif functions of a block, i.e all
+// Macro definition for simple iteration of all phi functions of a block, i.e all
// phi functions of the ValueStack where the block matches.
// Use the following code pattern to iterate all phi functions of a block:
//
@@ -315,7 +315,7 @@
Value value; \
{ \
for_each_stack_value(cur_state, cur_index, value) { \
- Phi* v_phi = value->as_Phi(); \
+ Phi* v_phi = value->as_Phi(); \
if (v_phi != NULL && v_phi->block() == v_block) { \
v_code; \
} \
@@ -323,7 +323,7 @@
} \
{ \
for_each_local_value(cur_state, cur_index, value) { \
- Phi* v_phi = value->as_Phi(); \
+ Phi* v_phi = value->as_Phi(); \
if (v_phi != NULL && v_phi->block() == v_block) { \
v_code; \
} \
--- a/src/hotspot/share/classfile/classFileParser.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/classfile/classFileParser.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -119,6 +119,8 @@
#define JAVA_12_VERSION 56
+#define JAVA_13_VERSION 57
+
void ClassFileParser::set_class_bad_constant_seen(short bad_constant) {
assert((bad_constant == 19 || bad_constant == 20) && _major_version >= JAVA_9_VERSION,
"Unexpected bad constant pool entry");
--- a/src/hotspot/share/classfile/vmSymbols.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/classfile/vmSymbols.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -580,6 +580,10 @@
case vmIntrinsics::_max:
case vmIntrinsics::_floatToIntBits:
case vmIntrinsics::_doubleToLongBits:
+ case vmIntrinsics::_maxF:
+ case vmIntrinsics::_minF:
+ case vmIntrinsics::_maxD:
+ case vmIntrinsics::_minD:
if (!InlineMathNatives) return true;
break;
case vmIntrinsics::_fmaD:
--- a/src/hotspot/share/classfile/vmSymbols.hpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/classfile/vmSymbols.hpp Wed Dec 19 20:53:30 2018 +0100
@@ -748,6 +748,7 @@
do_class(java_lang_StrictMath, "java/lang/StrictMath") \
do_signature(double2_double_signature, "(DD)D") \
do_signature(double3_double_signature, "(DDD)D") \
+ do_signature(float2_float_signature, "(FF)F") \
do_signature(float3_float_signature, "(FFF)F") \
do_signature(int2_int_signature, "(II)I") \
do_signature(long2_long_signature, "(JJ)J") \
@@ -794,6 +795,10 @@
do_intrinsic(_subtractExactL, java_lang_Math, subtractExact_name, long2_long_signature, F_S) \
do_intrinsic(_fmaD, java_lang_Math, fma_name, double3_double_signature, F_S) \
do_intrinsic(_fmaF, java_lang_Math, fma_name, float3_float_signature, F_S) \
+ do_intrinsic(_maxF, java_lang_Math, max_name, float2_float_signature, F_S) \
+ do_intrinsic(_minF, java_lang_Math, min_name, float2_float_signature, F_S) \
+ do_intrinsic(_maxD, java_lang_Math, max_name, double2_double_signature, F_S) \
+ do_intrinsic(_minD, java_lang_Math, min_name, double2_double_signature, F_S) \
\
do_intrinsic(_floatToRawIntBits, java_lang_Float, floatToRawIntBits_name, float_int_signature, F_S) \
do_name( floatToRawIntBits_name, "floatToRawIntBits") \
--- a/src/hotspot/share/gc/g1/dirtyCardQueue.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/gc/g1/dirtyCardQueue.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -137,7 +137,9 @@
PtrQueueSet(notify_when_complete),
_shared_dirty_card_queue(this, true /* permanent */),
_free_ids(NULL),
- _processed_buffers_mut(0), _processed_buffers_rs_thread(0)
+ _processed_buffers_mut(0),
+ _processed_buffers_rs_thread(0),
+ _cur_par_buffer_node(NULL)
{
_all_active = true;
}
--- a/src/hotspot/share/gc/g1/g1CardCounts.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1CardCounts.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -58,7 +58,7 @@
}
G1CardCounts::G1CardCounts(G1CollectedHeap *g1h):
- _listener(), _g1h(g1h), _card_counts(NULL), _reserved_max_card_num(0) {
+ _listener(), _g1h(g1h), _ct(NULL), _card_counts(NULL), _reserved_max_card_num(0), _ct_bot(NULL) {
_listener.set_cardcounts(this);
}
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -4287,7 +4287,7 @@
public:
G1FreeHumongousRegionClosure(FreeRegionList* free_region_list) :
- _free_region_list(free_region_list), _humongous_objects_reclaimed(0), _humongous_regions_reclaimed(0), _freed_bytes(0) {
+ _free_region_list(free_region_list), _proxy_set(NULL), _humongous_objects_reclaimed(0), _humongous_regions_reclaimed(0), _freed_bytes(0) {
}
virtual bool do_heap_region(HeapRegion* r) {
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -337,10 +337,6 @@
}
class VerifyArchivePointerRegionClosure: public HeapRegionClosure {
-private:
- G1CollectedHeap* _g1h;
-public:
- VerifyArchivePointerRegionClosure(G1CollectedHeap* g1h) { }
virtual bool do_heap_region(HeapRegion* r) {
if (r->is_archive()) {
VerifyObjectInArchiveRegionClosure verify_oop_pointers(r, false);
@@ -352,7 +348,7 @@
void G1HeapVerifier::verify_archive_regions() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
- VerifyArchivePointerRegionClosure cl(NULL);
+ VerifyArchivePointerRegionClosure cl;
g1h->heap_region_iterate(&cl);
}
--- a/src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,8 @@
"G1YoungRemSetSamplingThread monitor",
true,
Monitor::_safepoint_check_never),
- _last_periodic_gc_attempt_s(os::elapsedTime()) {
+ _last_periodic_gc_attempt_s(os::elapsedTime()),
+ _vtime_accum(0) {
set_name("G1 Young RemSet Sampling");
create_and_start();
}
--- a/src/hotspot/share/gc/g1/heapRegion.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/gc/g1/heapRegion.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -877,8 +877,10 @@
}
G1ContiguousSpace::G1ContiguousSpace(G1BlockOffsetTable* bot) :
+ _top(NULL),
_bot_part(bot, this),
- _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true)
+ _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true),
+ _pre_dummy_top(NULL)
{
}
--- a/src/hotspot/share/memory/heapInspection.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/memory/heapInspection.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -168,14 +168,12 @@
KlassInfoTable::KlassInfoTable(bool add_all_classes) {
_size_of_instances_in_words = 0;
- _size = 0;
_ref = (HeapWord*) Universe::boolArrayKlassObj();
_buckets =
(KlassInfoBucket*) AllocateHeap(sizeof(KlassInfoBucket) * _num_buckets,
mtInternal, CURRENT_PC, AllocFailStrategy::RETURN_NULL);
if (_buckets != NULL) {
- _size = _num_buckets;
- for (int index = 0; index < _size; index++) {
+ for (int index = 0; index < _num_buckets; index++) {
_buckets[index].initialize();
}
if (add_all_classes) {
@@ -187,11 +185,11 @@
KlassInfoTable::~KlassInfoTable() {
if (_buckets != NULL) {
- for (int index = 0; index < _size; index++) {
+ for (int index = 0; index < _num_buckets; index++) {
_buckets[index].empty();
}
FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets);
- _size = 0;
+ _buckets = NULL;
}
}
@@ -200,7 +198,7 @@
}
KlassInfoEntry* KlassInfoTable::lookup(Klass* k) {
- uint idx = hash(k) % _size;
+ uint idx = hash(k) % _num_buckets;
assert(_buckets != NULL, "Allocation failure should have been caught");
KlassInfoEntry* e = _buckets[idx].lookup(k);
// Lookup may fail if this is a new klass for which we
@@ -227,8 +225,8 @@
}
void KlassInfoTable::iterate(KlassInfoClosure* cic) {
- assert(_size == 0 || _buckets != NULL, "Allocation failure should have been caught");
- for (int index = 0; index < _size; index++) {
+ assert(_buckets != NULL, "Allocation failure should have been caught");
+ for (int index = 0; index < _num_buckets; index++) {
_buckets[index].iterate(cic);
}
}
--- a/src/hotspot/share/memory/heapInspection.hpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/memory/heapInspection.hpp Wed Dec 19 20:53:30 2018 +0100
@@ -234,7 +234,6 @@
class KlassInfoTable: public StackObj {
private:
- int _size;
static const int _num_buckets = 20011;
size_t _size_of_instances_in_words;
--- a/src/hotspot/share/opto/addnode.hpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/opto/addnode.hpp Wed Dec 19 20:53:30 2018 +0100
@@ -249,4 +249,52 @@
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
};
+//------------------------------MaxFNode---------------------------------------
+// Maximum of 2 floats.
+class MaxFNode : public MaxNode {
+public:
+ MaxFNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
+ virtual int Opcode() const;
+ virtual const Type *add_ring(const Type*, const Type*) const { return Type::FLOAT; }
+ virtual const Type *add_id() const { return TypeF::NEG_INF; }
+ virtual const Type *bottom_type() const { return Type::FLOAT; }
+ virtual uint ideal_reg() const { return Op_RegF; }
+};
+
+//------------------------------MinFNode---------------------------------------
+// Minimum of 2 floats.
+class MinFNode : public MaxNode {
+public:
+ MinFNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
+ virtual int Opcode() const;
+ virtual const Type *add_ring(const Type*, const Type*) const { return Type::FLOAT; }
+ virtual const Type *add_id() const { return TypeF::POS_INF; }
+ virtual const Type *bottom_type() const { return Type::FLOAT; }
+ virtual uint ideal_reg() const { return Op_RegF; }
+};
+
+//------------------------------MaxDNode---------------------------------------
+// Maximum of 2 doubles.
+class MaxDNode : public MaxNode {
+public:
+ MaxDNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
+ virtual int Opcode() const;
+ virtual const Type *add_ring(const Type*, const Type*) const { return Type::DOUBLE; }
+ virtual const Type *add_id() const { return TypeD::NEG_INF; }
+ virtual const Type *bottom_type() const { return Type::DOUBLE; }
+ virtual uint ideal_reg() const { return Op_RegD; }
+};
+
+//------------------------------MinDNode---------------------------------------
+// Minimum of 2 doubles.
+class MinDNode : public MaxNode {
+public:
+ MinDNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
+ virtual int Opcode() const;
+ virtual const Type *add_ring(const Type*, const Type*) const { return Type::DOUBLE; }
+ virtual const Type *add_id() const { return TypeD::POS_INF; }
+ virtual const Type *bottom_type() const { return Type::DOUBLE; }
+ virtual uint ideal_reg() const { return Op_RegD; }
+};
+
#endif // SHARE_VM_OPTO_ADDNODE_HPP
--- a/src/hotspot/share/opto/c2compiler.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/opto/c2compiler.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -440,6 +440,18 @@
case vmIntrinsics::_isWhitespace:
if (!Matcher::match_rule_supported(Op_Whitespace)) return false;
break;
+ case vmIntrinsics::_maxF:
+ if (!Matcher::match_rule_supported(Op_MaxF)) return false;
+ break;
+ case vmIntrinsics::_minF:
+ if (!Matcher::match_rule_supported(Op_MinF)) return false;
+ break;
+ case vmIntrinsics::_maxD:
+ if (!Matcher::match_rule_supported(Op_MaxD)) return false;
+ break;
+ case vmIntrinsics::_minD:
+ if (!Matcher::match_rule_supported(Op_MinD)) return false;
+ break;
case vmIntrinsics::_hashCode:
case vmIntrinsics::_identityHashCode:
case vmIntrinsics::_getClass:
--- a/src/hotspot/share/opto/classes.hpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/opto/classes.hpp Wed Dec 19 20:53:30 2018 +0100
@@ -202,6 +202,8 @@
macro(Mach)
macro(MachProj)
macro(MulAddS2I)
+macro(MaxD)
+macro(MaxF)
macro(MaxI)
macro(MemBarAcquire)
macro(LoadFence)
@@ -214,6 +216,8 @@
macro(MemBarVolatile)
macro(MemBarStoreStore)
macro(MergeMem)
+macro(MinD)
+macro(MinF)
macro(MinI)
macro(ModD)
macro(ModF)
--- a/src/hotspot/share/opto/library_call.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/opto/library_call.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -325,6 +325,7 @@
bool inline_vectorizedMismatch();
bool inline_fma(vmIntrinsics::ID id);
bool inline_character_compare(vmIntrinsics::ID id);
+ bool inline_fp_min_max(vmIntrinsics::ID id);
bool inline_profileBoolean();
bool inline_isCompileConstant();
@@ -874,6 +875,12 @@
case vmIntrinsics::_isWhitespace:
return inline_character_compare(intrinsic_id());
+ case vmIntrinsics::_maxF:
+ case vmIntrinsics::_minF:
+ case vmIntrinsics::_maxD:
+ case vmIntrinsics::_minD:
+ return inline_fp_min_max(intrinsic_id());
+
default:
// If you get here, it may be that someone has added a new intrinsic
// to the list in vmSymbols.hpp without implementing it here.
@@ -6588,6 +6595,42 @@
return true;
}
+//------------------------------inline_fp_min_max------------------------------
+bool LibraryCallKit::inline_fp_min_max(vmIntrinsics::ID id) {
+ Node *a = NULL;
+ Node *b = NULL;
+ Node *n = NULL;
+ switch (id) {
+ case vmIntrinsics::_maxF:
+ case vmIntrinsics::_minF:
+ assert(callee()->signature()->size() == 2, "minF/maxF has 2 parameters of size 1 each.");
+ a = argument(0);
+ b = argument(1);
+ break;
+ case vmIntrinsics::_maxD:
+ case vmIntrinsics::_minD:
+ assert(callee()->signature()->size() == 4, "minD/maxD has 2 parameters of size 2 each.");
+ a = round_double_node(argument(0));
+ b = round_double_node(argument(2));
+ break;
+ default:
+ fatal_unexpected_iid(id);
+ break;
+ }
+ if (a->is_Con() || b->is_Con()) {
+ return false;
+ }
+ switch (id) {
+ case vmIntrinsics::_maxF: n = new MaxFNode(a, b); break;
+ case vmIntrinsics::_minF: n = new MinFNode(a, b); break;
+ case vmIntrinsics::_maxD: n = new MaxDNode(a, b); break;
+ case vmIntrinsics::_minD: n = new MinDNode(a, b); break;
+ default: fatal_unexpected_iid(id); break;
+ }
+ set_result(_gvn.transform(n));
+ return true;
+}
+
bool LibraryCallKit::inline_profileBoolean() {
Node* counts = argument(1);
const TypeAryPtr* ary = NULL;
--- a/src/hotspot/share/opto/type.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/opto/type.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -416,6 +416,18 @@
#define SMALLINT ((juint)3) // a value too insignificant to consider widening
+static double pos_dinf() {
+ union { int64_t i; double d; } v;
+ v.i = CONST64(0x7ff0000000000000);
+ return v.d;
+}
+
+static float pos_finf() {
+ union { int32_t i; float f; } v;
+ v.i = 0x7f800000;
+ return v.f;
+}
+
//--------------------------Initialize_shared----------------------------------
void Type::Initialize_shared(Compile* current) {
// This method does not need to be locked because the first system
@@ -445,9 +457,13 @@
TypeF::ZERO = TypeF::make(0.0); // Float 0 (positive zero)
TypeF::ONE = TypeF::make(1.0); // Float 1
+ TypeF::POS_INF = TypeF::make(pos_finf());
+ TypeF::NEG_INF = TypeF::make(-pos_finf());
TypeD::ZERO = TypeD::make(0.0); // Double 0 (positive zero)
TypeD::ONE = TypeD::make(1.0); // Double 1
+ TypeD::POS_INF = TypeD::make(pos_dinf());
+ TypeD::NEG_INF = TypeD::make(-pos_dinf());
TypeInt::MINUS_1 = TypeInt::make(-1); // -1
TypeInt::ZERO = TypeInt::make( 0); // 0
@@ -1087,6 +1103,8 @@
// Convenience common pre-built types.
const TypeF *TypeF::ZERO; // Floating point zero
const TypeF *TypeF::ONE; // Floating point one
+const TypeF *TypeF::POS_INF; // Floating point positive infinity
+const TypeF *TypeF::NEG_INF; // Floating point negative infinity
//------------------------------make-------------------------------------------
// Create a float constant
@@ -1195,6 +1213,8 @@
// Convenience common pre-built types.
const TypeD *TypeD::ZERO; // Floating point zero
const TypeD *TypeD::ONE; // Floating point one
+const TypeD *TypeD::POS_INF; // Floating point positive infinity
+const TypeD *TypeD::NEG_INF; // Floating point negative infinity
//------------------------------make-------------------------------------------
const TypeD *TypeD::make(double d) {
--- a/src/hotspot/share/opto/type.hpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/opto/type.hpp Wed Dec 19 20:53:30 2018 +0100
@@ -483,6 +483,8 @@
// Convenience common pre-built types.
static const TypeF *ZERO; // positive zero only
static const TypeF *ONE;
+ static const TypeF *POS_INF;
+ static const TypeF *NEG_INF;
#ifndef PRODUCT
virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
#endif
@@ -510,6 +512,8 @@
// Convenience common pre-built types.
static const TypeD *ZERO; // positive zero only
static const TypeD *ONE;
+ static const TypeD *POS_INF;
+ static const TypeD *NEG_INF;
#ifndef PRODUCT
virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
#endif
--- a/src/hotspot/share/prims/jvmti.xml Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/prims/jvmti.xml Wed Dec 19 20:53:30 2018 +0100
@@ -13595,7 +13595,7 @@
</event>
<event label="Sampled Object Allocation"
- id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" num="86" since="11">
+ id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11">
<description>
Sent when an allocated object is sampled.
By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid
--- a/src/hotspot/share/prims/jvmtiEventController.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/prims/jvmtiEventController.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -96,7 +96,8 @@
static const jlong INTERP_EVENT_BITS = SINGLE_STEP_BIT | METHOD_ENTRY_BIT | METHOD_EXIT_BIT |
FRAME_POP_BIT | FIELD_ACCESS_BIT | FIELD_MODIFICATION_BIT;
static const jlong THREAD_FILTERED_EVENT_BITS = INTERP_EVENT_BITS | EXCEPTION_BITS | MONITOR_BITS |
- BREAKPOINT_BIT | CLASS_LOAD_BIT | CLASS_PREPARE_BIT | THREAD_END_BIT;
+ BREAKPOINT_BIT | CLASS_LOAD_BIT | CLASS_PREPARE_BIT | THREAD_END_BIT |
+ SAMPLED_OBJECT_ALLOC_BIT;
static const jlong NEED_THREAD_LIFE_EVENTS = THREAD_FILTERED_EVENT_BITS | THREAD_START_BIT;
static const jlong EARLY_EVENT_BITS = CLASS_FILE_LOAD_HOOK_BIT | CLASS_LOAD_BIT | CLASS_PREPARE_BIT |
VM_START_BIT | VM_INIT_BIT | VM_DEATH_BIT | NATIVE_METHOD_BIND_BIT |
--- a/src/hotspot/share/prims/jvmtiExport.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/prims/jvmtiExport.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -2567,6 +2567,11 @@
}
void JvmtiExport::post_sampled_object_alloc(JavaThread *thread, oop object) {
+ JvmtiThreadState *state = thread->jvmti_thread_state();
+ if (state == NULL) {
+ return;
+ }
+
EVT_TRIG_TRACE(JVMTI_EVENT_SAMPLED_OBJECT_ALLOC,
("[%s] Trg sampled object alloc triggered",
JvmtiTrace::safe_get_thread_name(thread)));
@@ -2575,14 +2580,16 @@
}
HandleMark hm(thread);
Handle h(thread, object);
- JvmtiEnvIterator it;
- for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {
- if (env->is_enabled(JVMTI_EVENT_SAMPLED_OBJECT_ALLOC)) {
+
+ JvmtiEnvThreadStateIterator it(state);
+ for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) {
+ if (ets->is_enabled(JVMTI_EVENT_SAMPLED_OBJECT_ALLOC)) {
EVT_TRACE(JVMTI_EVENT_SAMPLED_OBJECT_ALLOC,
("[%s] Evt sampled object alloc sent %s",
JvmtiTrace::safe_get_thread_name(thread),
object == NULL ? "NULL" : object->klass()->external_name()));
+ JvmtiEnv *env = ets->get_env();
JvmtiObjectAllocEventMark jem(thread, h());
JvmtiJavaThreadEventTransition jet(thread);
jvmtiEventSampledObjectAlloc callback = env->callbacks()->SampledObjectAlloc;
--- a/src/hotspot/share/runtime/vmStructs.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/hotspot/share/runtime/vmStructs.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -1516,6 +1516,10 @@
declare_c2_type(MaxNode, AddNode) \
declare_c2_type(MaxINode, MaxNode) \
declare_c2_type(MinINode, MaxNode) \
+ declare_c2_type(MaxFNode, MaxNode) \
+ declare_c2_type(MinFNode, MaxNode) \
+ declare_c2_type(MaxDNode, MaxNode) \
+ declare_c2_type(MinDNode, MaxNode) \
declare_c2_type(StartNode, MultiNode) \
declare_c2_type(StartOSRNode, StartNode) \
declare_c2_type(ParmNode, ProjNode) \
--- a/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c Wed Dec 19 20:53:30 2018 +0100
@@ -138,13 +138,13 @@
char *args = NULL;
jstring cmdexe = NULL;
char fn[32];
- struct stat stat_buf;
+ struct stat64 stat_buf;
/*
* Stat /proc/<pid> to get the user id
*/
snprintf(fn, sizeof fn, "/proc/%d", pid);
- if (stat(fn, &stat_buf) == 0) {
+ if (stat64(fn, &stat_buf) == 0) {
unix_getUserInfo(env, jinfo, stat_buf.st_uid);
JNU_CHECK_EXCEPTION(env);
}
--- a/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -578,13 +578,15 @@
cssmPerror("_addItemToKeychain: SecKeychainItemImport", err);
}
- (*env)->ReleaseByteArrayElements(env, rawDataObj, rawData, JNI_ABORT);
-
if (createdItems != NULL) {
CFRelease(createdItems);
}
errOut:
+ if (rawData) {
+ (*env)->ReleaseByteArrayElements(env, rawDataObj, rawData, JNI_ABORT);
+ }
+
if (passwordStrRef) CFRelease(passwordStrRef);
if (passwordChars) {
// clear the password and release
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Wed Dec 19 20:53:30 2018 +0100
@@ -50,6 +50,7 @@
1.10 to 1.10.X 54,0
1.11 to 1.11.X 55,0
1.12 to 1.12.X 56,0
+ 1.13 to 1.13.X 57,0
*/
public static final Package.Version JAVA_MIN_CLASS_VERSION =
@@ -79,6 +80,9 @@
public static final Package.Version JAVA12_MAX_CLASS_VERSION =
Package.Version.of(56, 00);
+ public static final Package.Version JAVA13_MAX_CLASS_VERSION =
+ Package.Version.of(57, 00);
+
public static final int JAVA_PACKAGE_MAGIC = 0xCAFED00D;
public static final Package.Version JAVA5_PACKAGE_VERSION =
@@ -95,7 +99,7 @@
// upper limit, should point to the latest class version
public static final Package.Version JAVA_MAX_CLASS_VERSION =
- JAVA12_MAX_CLASS_VERSION;
+ JAVA13_MAX_CLASS_VERSION;
// upper limit should point to the latest package version, for version info!.
public static final Package.Version MAX_PACKAGE_VERSION =
--- a/src/java.base/share/classes/java/lang/Math.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/share/classes/java/lang/Math.java Wed Dec 19 20:53:30 2018 +0100
@@ -1460,6 +1460,7 @@
* @param b another argument.
* @return the larger of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static float max(float a, float b) {
if (a != a)
return a; // a is NaN
@@ -1486,6 +1487,7 @@
* @param b another argument.
* @return the larger of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static double max(double a, double b) {
if (a != a)
return a; // a is NaN
@@ -1541,6 +1543,7 @@
* @param b another argument.
* @return the smaller of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static float min(float a, float b) {
if (a != a)
return a; // a is NaN
@@ -1567,6 +1570,7 @@
* @param b another argument.
* @return the smaller of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static double min(double a, double b) {
if (a != a)
return a; // a is NaN
--- a/src/java.base/share/classes/java/lang/StrictMath.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/share/classes/java/lang/StrictMath.java Wed Dec 19 20:53:30 2018 +0100
@@ -1154,6 +1154,7 @@
* @param b another argument.
* @return the larger of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static float max(float a, float b) {
return Math.max(a, b);
}
@@ -1172,6 +1173,7 @@
* @param b another argument.
* @return the larger of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static double max(double a, double b) {
return Math.max(a, b);
}
@@ -1219,6 +1221,7 @@
* @param b another argument.
* @return the smaller of {@code a} and {@code b.}
*/
+ @HotSpotIntrinsicCandidate
public static float min(float a, float b) {
return Math.min(a, b);
}
@@ -1237,6 +1240,7 @@
* @param b another argument.
* @return the smaller of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static double min(double a, double b) {
return Math.min(a, b);
}
--- a/src/java.base/share/classes/java/math/BigDecimal.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/share/classes/java/math/BigDecimal.java Wed Dec 19 20:53:30 2018 +0100
@@ -2871,6 +2871,8 @@
* @throws ArithmeticException if scale overflows.
*/
public BigDecimal movePointLeft(int n) {
+ if (n == 0) return this;
+
// Cannot use movePointRight(-n) in case of n==Integer.MIN_VALUE
int newScale = checkScale((long)scale + n);
BigDecimal num = new BigDecimal(intVal, intCompact, newScale, 0);
@@ -2893,6 +2895,8 @@
* @throws ArithmeticException if scale overflows.
*/
public BigDecimal movePointRight(int n) {
+ if (n == 0) return this;
+
// Cannot use movePointLeft(-n) in case of n==Integer.MIN_VALUE
int newScale = checkScale((long)scale - n);
BigDecimal num = new BigDecimal(intVal, intCompact, newScale, 0);
--- a/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java Wed Dec 19 20:53:30 2018 +0100
@@ -63,7 +63,7 @@
public final class ModuleInfo {
private final int JAVA_MIN_SUPPORTED_VERSION = 53;
- private final int JAVA_MAX_SUPPORTED_VERSION = 56;
+ private final int JAVA_MAX_SUPPORTED_VERSION = 57;
private static final JavaLangModuleAccess JLMA
= SharedSecrets.getJavaLangModuleAccess();
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java Wed Dec 19 20:53:30 2018 +0100
@@ -210,7 +210,7 @@
b = classFileBuffer;
// Check the class' major_version. This field is after the magic and minor_version fields, which
// use 4 and 2 bytes respectively.
- if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V12) {
+ if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V13) {
throw new IllegalArgumentException(
"Unsupported class file major version " + readShort(classFileOffset + 6));
}
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java Wed Dec 19 20:53:30 2018 +0100
@@ -95,6 +95,7 @@
int V10 = 0 << 16 | 54;
int V11 = 0 << 16 | 55;
int V12 = 0 << 16 | 56;
+ int V13 = 0 << 16 | 57;
/**
* Version flag indicating that the class is using 'preview' features.
--- a/src/java.base/unix/native/libjava/TimeZone_md.c Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/unix/native/libjava/TimeZone_md.c Wed Dec 19 20:53:30 2018 +0100
@@ -56,6 +56,12 @@
#define fileclose fclose
#endif
+#if defined(_ALLBSD_SOURCE)
+#define stat64 stat
+#define lstat64 lstat
+#define fstat64 fstat
+#endif
+
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
@@ -115,7 +121,7 @@
findZoneinfoFile(char *buf, size_t size, const char *dir)
{
DIR *dirp = NULL;
- struct stat statbuf;
+ struct stat64 statbuf;
struct dirent *dp = NULL;
char *pathname = NULL;
int fd = -1;
@@ -156,7 +162,7 @@
if (pathname == NULL) {
break;
}
- RESTARTABLE(stat(pathname, &statbuf), res);
+ RESTARTABLE(stat64(pathname, &statbuf), res);
if (res == -1) {
break;
}
@@ -219,7 +225,7 @@
static char *
getPlatformTimeZoneID()
{
- struct stat statbuf;
+ struct stat64 statbuf;
char *tz = NULL;
FILE *fp;
int fd;
@@ -256,7 +262,7 @@
/*
* Next, try /etc/localtime to find the zone ID.
*/
- RESTARTABLE(lstat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
+ RESTARTABLE(lstat64(DEFAULT_ZONEINFO_FILE, &statbuf), res);
if (res == -1) {
return NULL;
}
@@ -296,7 +302,7 @@
return NULL;
}
- RESTARTABLE(fstat(fd, &statbuf), res);
+ RESTARTABLE(fstat64(fd, &statbuf), res);
if (res == -1) {
(void) close(fd);
return NULL;
@@ -557,7 +563,7 @@
static char *
getSolarisDefaultZoneID() {
char *tz = NULL;
- struct stat statbuf;
+ struct stat64 statbuf;
size_t size;
char *buf;
int fd;
@@ -597,7 +603,7 @@
}
cleanupScf(h, snap, inst, pg, prop, val, tz);
- RESTARTABLE(stat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
+ RESTARTABLE(stat64(DEFAULT_ZONEINFO_FILE, &statbuf), res);
if (res == -1) {
return NULL;
}
--- a/src/java.base/unix/native/libjava/UnixFileSystem_md.c Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.base/unix/native/libjava/UnixFileSystem_md.c Wed Dec 19 20:53:30 2018 +0100
@@ -69,6 +69,7 @@
#if defined(_ALLBSD_SOURCE)
#ifndef MACOSX
#define statvfs64 statvfs
+ #define stat64 stat
#endif
#endif
@@ -121,8 +122,8 @@
static jboolean
statMode(const char *path, int *mode)
{
- struct stat sb;
- if (stat(path, &sb) == 0) {
+ struct stat64 sb;
+ if (stat64(path, &sb) == 0) {
*mode = sb.st_mode;
return JNI_TRUE;
}
@@ -229,8 +230,8 @@
jlong rv = 0;
WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
- struct stat sb;
- if (stat(path, &sb) == 0) {
+ struct stat64 sb;
+ if (stat64(path, &sb) == 0) {
#if defined(_AIX)
rv = (jlong)sb.st_mtime * 1000;
rv += (jlong)sb.st_mtime_n / 1000000;
@@ -254,8 +255,8 @@
jlong rv = 0;
WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
- struct stat sb;
- if (stat(path, &sb) == 0) {
+ struct stat64 sb;
+ if (stat64(path, &sb) == 0) {
rv = sb.st_size;
}
} END_PLATFORM_STRING(env, path);
@@ -408,9 +409,9 @@
jboolean rv = JNI_FALSE;
WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
- struct stat sb;
+ struct stat64 sb;
- if (stat(path, &sb) == 0) {
+ if (stat64(path, &sb) == 0) {
struct timeval tv[2];
/* Preserve access time */
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Wed Dec 19 20:53:30 2018 +0100
@@ -59,6 +59,7 @@
* 10: local-variable type inference (var)
* 11: local-variable syntax for lambda parameters
* 12: TBD
+ * 13: TBD
*/
/**
@@ -183,7 +184,15 @@
*
* @since 12
*/
- RELEASE_12;
+ RELEASE_12,
+
+ /**
+ * The version recognized by the Java Platform, Standard Edition
+ * 13.
+ *
+ * @since 13
+ */
+ RELEASE_13;
// Note that when adding constants for newer releases, the
// behavior of latest() and latestSupported() must be updated too.
@@ -194,7 +203,7 @@
* @return the latest source version that can be modeled
*/
public static SourceVersion latest() {
- return RELEASE_12;
+ return RELEASE_13;
}
private static final SourceVersion latestSupported = getLatestSupported();
@@ -204,6 +213,8 @@
String specVersion = System.getProperty("java.specification.version");
switch (specVersion) {
+ case "13":
+ return RELEASE_13;
case "12":
return RELEASE_12;
case "11":
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java Wed Dec 19 20:53:30 2018 +0100
@@ -32,7 +32,7 @@
/**
* A skeletal visitor for annotation values with default behavior
* appropriate for source versions {@link SourceVersion#RELEASE_9
- * RELEASE_9} through {@link SourceVersion#RELEASE_12 RELEASE_12}.
+ * RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* <p> <b>WARNING:</b> The {@code AnnotationValueVisitor} interface
* implemented by this class may have methods added to it in the
@@ -59,7 +59,7 @@
* @see AbstractAnnotationValueVisitor8
* @since 9
*/
-@SupportedSourceVersion(RELEASE_12)
+@SupportedSourceVersion(RELEASE_13)
public abstract class AbstractAnnotationValueVisitor9<R, P> extends AbstractAnnotationValueVisitor8<R, P> {
/**
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java Wed Dec 19 20:53:30 2018 +0100
@@ -34,7 +34,7 @@
/**
* A skeletal visitor of program elements with default behavior
* appropriate for source versions {@link SourceVersion#RELEASE_9
- * RELEASE_9} through {@link SourceVersion#RELEASE_12 RELEASE_12}.
+ * RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* <p> <b>WARNING:</b> The {@code ElementVisitor} interface
* implemented by this class may have methods added to it in the
@@ -65,7 +65,7 @@
* @since 9
* @spec JPMS
*/
-@SupportedSourceVersion(RELEASE_12)
+@SupportedSourceVersion(RELEASE_13)
public abstract class AbstractElementVisitor9<R, P> extends AbstractElementVisitor8<R, P> {
/**
* Constructor for concrete subclasses to call.
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java Wed Dec 19 20:53:30 2018 +0100
@@ -33,7 +33,7 @@
/**
* A skeletal visitor of types with default behavior appropriate for
* source versions {@link SourceVersion#RELEASE_9 RELEASE_9} through
- * {@link SourceVersion#RELEASE_12 RELEASE_12}.
+ * {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
* by this class may have methods added to it in the future to
@@ -63,7 +63,7 @@
* @see AbstractTypeVisitor8
* @since 9
*/
-@SupportedSourceVersion(RELEASE_12)
+@SupportedSourceVersion(RELEASE_13)
public abstract class AbstractTypeVisitor9<R, P> extends AbstractTypeVisitor8<R, P> {
/**
* Constructor for concrete subclasses to call.
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java Wed Dec 19 20:53:30 2018 +0100
@@ -34,7 +34,7 @@
* A visitor of program elements based on their {@linkplain
* ElementKind kind} with default behavior appropriate for source
* versions {@link SourceVersion#RELEASE_9 RELEASE_9} through {@link
- * SourceVersion#RELEASE_12 RELEASE_12}.
+ * SourceVersion#RELEASE_13 RELEASE_13}.
*
* For {@linkplain
* Element elements} <code><i>Xyz</i></code> that may have more than one
@@ -80,7 +80,7 @@
* @since 9
* @spec JPMS
*/
-@SupportedSourceVersion(RELEASE_12)
+@SupportedSourceVersion(RELEASE_13)
public class ElementKindVisitor9<R, P> extends ElementKindVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java Wed Dec 19 20:53:30 2018 +0100
@@ -34,7 +34,7 @@
/**
* A scanning visitor of program elements with default behavior
* appropriate for source versions {@link SourceVersion#RELEASE_9
- * RELEASE_9} through {@link SourceVersion#RELEASE_12 RELEASE_12}.
+ * RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* The <code>visit<i>Xyz</i></code> methods in this
* class scan their component elements by calling {@code scan} on
@@ -92,7 +92,7 @@
* @since 9
* @spec JPMS
*/
-@SupportedSourceVersion(RELEASE_12)
+@SupportedSourceVersion(RELEASE_13)
public class ElementScanner9<R, P> extends ElementScanner8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java Wed Dec 19 20:53:30 2018 +0100
@@ -32,7 +32,7 @@
/**
* A simple visitor for annotation values with default behavior
* appropriate for source versions {@link SourceVersion#RELEASE_9
- * RELEASE_9} through {@link SourceVersion#RELEASE_12 RELEASE_12}.
+ * RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* Visit methods call {@link #defaultAction
* defaultAction} passing their arguments to {@code defaultAction}'s
@@ -68,7 +68,7 @@
* @see SimpleAnnotationValueVisitor8
* @since 9
*/
-@SupportedSourceVersion(RELEASE_12)
+@SupportedSourceVersion(RELEASE_13)
public class SimpleAnnotationValueVisitor9<R, P> extends SimpleAnnotationValueVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java Wed Dec 19 20:53:30 2018 +0100
@@ -33,7 +33,7 @@
/**
* A simple visitor of program elements with default behavior
* appropriate for source versions {@link SourceVersion#RELEASE_9
- * RELEASE_9} through {@link SourceVersion#RELEASE_12 RELEASE_12}.
+ * RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* Visit methods corresponding to {@code RELEASE_9} and earlier
* language constructs call {@link #defaultAction defaultAction},
@@ -73,7 +73,7 @@
* @since 9
* @spec JPMS
*/
-@SupportedSourceVersion(RELEASE_12)
+@SupportedSourceVersion(RELEASE_13)
public class SimpleElementVisitor9<R, P> extends SimpleElementVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java Wed Dec 19 20:53:30 2018 +0100
@@ -33,7 +33,7 @@
/**
* A simple visitor of types with default behavior appropriate for
* source versions {@link SourceVersion#RELEASE_9 RELEASE_9} through
- * {@link SourceVersion#RELEASE_12 RELEASE_12}.
+ * {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* Visit methods corresponding to {@code RELEASE_9} and earlier
* language constructs call {@link #defaultAction defaultAction},
@@ -73,7 +73,7 @@
* @see SimpleTypeVisitor8
* @since 9
*/
-@SupportedSourceVersion(RELEASE_12)
+@SupportedSourceVersion(RELEASE_13)
public class SimpleTypeVisitor9<R, P> extends SimpleTypeVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
--- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java Wed Dec 19 20:53:30 2018 +0100
@@ -34,7 +34,7 @@
* A visitor of types based on their {@linkplain TypeKind kind} with
* default behavior appropriate for source versions {@link
* SourceVersion#RELEASE_9 RELEASE_9} through {@link
- * SourceVersion#RELEASE_12 RELEASE_12}.
+ * SourceVersion#RELEASE_13 RELEASE_13}.
*
* For {@linkplain
* TypeMirror types} <code><i>Xyz</i></code> that may have more than one
@@ -77,7 +77,7 @@
* @see TypeKindVisitor8
* @since 9
*/
-@SupportedSourceVersion(RELEASE_12)
+@SupportedSourceVersion(RELEASE_13)
public class TypeKindVisitor9<R, P> extends TypeKindVisitor8<R, P> {
/**
* Constructor for concrete subclasses to call; uses {@code null}
--- a/src/java.desktop/share/classes/com/sun/media/sound/SoftChannel.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.desktop/share/classes/com/sun/media/sound/SoftChannel.java Wed Dec 19 20:53:30 2018 +0100
@@ -1472,7 +1472,7 @@
}
for (int controller : co_midi_nrpn_nrpn.keySet())
nrpnChange(controller, 0);
- rpnChange(0, 2 << 7); // Bitch Bend sensitivity
+ rpnChange(0, 2 << 7); // Pitch Bend sensitivity
rpnChange(1, 64 << 7); // Channel fine tunning
rpnChange(2, 64 << 7); // Channel Coarse Tuning
rpnChange(5, 64); // Modulation Depth, +/- 50 cent
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/BitArray.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/BitArray.java Wed Dec 19 20:53:30 2018 +0100
@@ -133,7 +133,7 @@
* This method returns the Nth bit that is set in the bit array. The
* current position is cached in the following 4 variables and will
* help speed up a sequence of next() call in an index iterator. This
- * method is a mess, but it is fast and it works, so don't fuck with it.
+ * method is a mess, but it is fast and it works, so don't change it.
*/
private int _pos = Integer.MAX_VALUE;
private int _node = 0;
--- a/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c Wed Dec 19 20:53:30 2018 +0100
@@ -457,12 +457,11 @@
if (pCode == NULL) {
JNU_ThrowIOExceptionWithLastError(env, "VirtualAllocEx failed");
VirtualFreeEx(hProcess, pData, 0, MEM_RELEASE);
+ (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
return;
}
WriteProcessMemory( hProcess, (LPVOID)pCode, (LPCVOID)stubCode, (SIZE_T)stubLen, NULL );
- if (isCopy) {
- (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
- }
+ (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
/*
* Create thread in target process to execute code
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Wed Dec 19 20:53:30 2018 +0100
@@ -85,7 +85,10 @@
JDK11("11"),
/** 12 covers the to be determined language features that will be added in JDK 12. */
- JDK12("12");
+ JDK12("12"),
+
+ /** 13 covers the to be determined language features that will be added in JDK 13. */
+ JDK13("13");
private static final Context.Key<Source> sourceKey = new Context.Key<>();
@@ -136,6 +139,7 @@
}
public Target requiredTarget() {
+ if (this.compareTo(JDK13) >= 0) return Target.JDK1_13;
if (this.compareTo(JDK12) >= 0) return Target.JDK1_12;
if (this.compareTo(JDK11) >= 0) return Target.JDK1_11;
if (this.compareTo(JDK10) >= 0) return Target.JDK1_10;
@@ -182,10 +186,10 @@
LOCAL_VARIABLE_TYPE_INFERENCE(JDK10),
VAR_SYNTAX_IMPLICIT_LAMBDAS(JDK11, Fragments.FeatureVarSyntaxInImplicitLambda, DiagKind.PLURAL),
IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES(JDK1_2, JDK8),
- SWITCH_MULTIPLE_CASE_LABELS(JDK12, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL),
- SWITCH_RULE(JDK12, Fragments.FeatureSwitchRules, DiagKind.PLURAL),
- SWITCH_EXPRESSION(JDK12, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL),
- RAW_STRING_LITERALS(JDK12, Fragments.FeatureRawStringLiterals, DiagKind.PLURAL);
+ SWITCH_MULTIPLE_CASE_LABELS(JDK13, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL),
+ SWITCH_RULE(JDK13, Fragments.FeatureSwitchRules, DiagKind.PLURAL),
+ SWITCH_EXPRESSION(JDK13, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL),
+ RAW_STRING_LITERALS(JDK13, Fragments.FeatureRawStringLiterals, DiagKind.PLURAL);
enum DiagKind {
NORMAL,
@@ -270,6 +274,8 @@
return RELEASE_11;
case JDK12:
return RELEASE_12;
+ case JDK13:
+ return RELEASE_13;
default:
return null;
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Wed Dec 19 20:53:30 2018 +0100
@@ -427,6 +427,10 @@
if (annotations.isEmpty()) {
return type;
}
+ // All annotations share the same position
+ for (TypeCompound tc : annotations) {
+ Assert.check(tc.position == pos);
+ }
if (type.hasTag(TypeTag.ARRAY))
return rewriteArrayType((ArrayType)type, annotations, pos);
@@ -522,10 +526,7 @@
if (depth.nonEmpty()) {
// Only need to change the annotation positions
// if they are on an enclosed type.
- // All annotations share the same position; modify the first one.
- Attribute.TypeCompound a = annotations.get(0);
- TypeAnnotationPosition p = a.position;
- p.location = p.location.appendList(depth.toList());
+ pos.location = pos.location.appendList(depth.toList());
}
Type ret = typeWithAnnotations(type, enclTy, annotations);
@@ -583,11 +584,7 @@
tomodify.elemtype = elemType;
// Update positions
- for (TypeCompound tc : annotations) {
- if (tc.position == null)
- tc.position = pos;
- tc.position.location = loc;
- }
+ pos.location = loc;
return res;
}
@@ -1396,16 +1393,6 @@
scan(tree.elems);
}
-
- private void findTypeCompoundPosition(JCTree tree, JCTree frame, List<Attribute.TypeCompound> annotations) {
- if (!annotations.isEmpty()) {
- final TypeAnnotationPosition p =
- resolveFrame(tree, frame, frames, currentLambda, 0, new ListBuffer<>());
- for (TypeCompound tc : annotations)
- tc.position = p;
- }
- }
-
private void findPosition(JCTree tree, JCTree frame, List<JCAnnotation> annotations) {
if (!annotations.isEmpty())
{
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Wed Dec 19 20:53:30 2018 +0100
@@ -26,6 +26,7 @@
package com.sun.tools.javac.comp;
import java.util.*;
+import java.util.function.Supplier;
import javax.tools.JavaFileManager;
@@ -1797,7 +1798,7 @@
if (!isDeprecatedOverrideIgnorable(other, origin)) {
Lint prevLint = setLint(lint.augment(m));
try {
- checkDeprecated(TreeInfo.diagnosticPositionFor(m, tree), m, other);
+ checkDeprecated(() -> TreeInfo.diagnosticPositionFor(m, tree), m, other);
} finally {
setLint(prevLint);
}
@@ -3259,10 +3260,14 @@
}
void checkDeprecated(final DiagnosticPosition pos, final Symbol other, final Symbol s) {
+ checkDeprecated(() -> pos, other, s);
+ }
+
+ void checkDeprecated(Supplier<DiagnosticPosition> pos, final Symbol other, final Symbol s) {
if ( (s.isDeprecatedForRemoval()
|| s.isDeprecated() && !other.isDeprecated())
&& (s.outermostClass() != other.outermostClass() || s.outermostClass() == null)) {
- deferredLintHandler.report(() -> warnDeprecated(pos, s));
+ deferredLintHandler.report(() -> warnDeprecated(pos.get(), s));
}
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java Wed Dec 19 20:53:30 2018 +0100
@@ -116,7 +116,8 @@
V53(53, 0), // JDK 1.9: modules, indy string concat
V54(54, 0), // JDK 10
V55(55, 0), // JDK 11: constant dynamic, nest mates
- V56(56, 0); // JDK 12
+ V56(56, 0), // JDK 12
+ V57(57, 0); // JDK 13
Version(int major, int minor) {
this.major = major;
this.minor = minor;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java Wed Dec 19 20:53:30 2018 +0100
@@ -40,9 +40,9 @@
* deletion without notice.</b>
*/
public enum Profile {
- COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12),
- COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12),
- COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12),
+ COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13),
+ COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13),
+ COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13),
DEFAULT {
@Override
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java Wed Dec 19 20:53:30 2018 +0100
@@ -70,7 +70,10 @@
JDK1_11("11", 55, 0),
/** JDK 12. */
- JDK1_12("12", 56, 0);
+ JDK1_12("12", 56, 0),
+
+ /** JDK 13. */
+ JDK1_13("13", 57, 0);
private static final Context.Key<Target> targetKey = new Context.Key<>();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Wed Dec 19 20:53:30 2018 +0100
@@ -55,7 +55,7 @@
* deletion without notice.</b>
*/
@SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_12)
+@SupportedSourceVersion(SourceVersion.RELEASE_13)
public class PrintingProcessor extends AbstractProcessor {
PrintWriter writer;
--- a/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -722,19 +722,25 @@
IDebugDataSpaces* ptrIDebugDataSpaces = (IDebugDataSpaces*) env->GetLongField(obj,
ptrIDebugDataSpaces_ID);
- CHECK_EXCEPTION_(0);
+ if (env->ExceptionOccurred()) {
+ env->ReleaseByteArrayElements(byteArray, bytePtr, JNI_ABORT);
+ return 0;
+ }
ULONG bytesRead;
if (ptrIDebugDataSpaces->ReadVirtual((ULONG64) address, (PVOID) bytePtr,
(ULONG)numBytes, &bytesRead) != S_OK) {
- THROW_NEW_DEBUGGER_EXCEPTION_("Windbg Error: ReadVirtual failed!", 0);
+ env->ReleaseByteArrayElements(byteArray, bytePtr, JNI_ABORT);
+ throwNewDebuggerException(env, "Windbg Error: ReadVirtual failed!");
+ return 0;
}
if (bytesRead != numBytes) {
+ env->ReleaseByteArrayElements(byteArray, bytePtr, JNI_ABORT);
return 0;
}
+ env->ReleaseByteArrayElements(byteArray, bytePtr, 0);
- env->ReleaseByteArrayElements(byteArray, bytePtr, 0);
CHECK_EXCEPTION_(0);
return byteArray;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java Wed Dec 19 20:53:30 2018 +0100
@@ -49,7 +49,7 @@
private final List<ClassfileBytecode> codeAttributes;
private static final int MAJOR_VERSION_JAVA_MIN = 51; // JDK7
- private static final int MAJOR_VERSION_JAVA_MAX = 56; // JDK12
+ private static final int MAJOR_VERSION_JAVA_MAX = 57; // JDK13
private static final int MAGIC = 0xCAFEBABE;
/**
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java Wed Dec 19 20:53:30 2018 +0100
@@ -106,7 +106,7 @@
// Keep these updated manually until there's a compiler API
// that allows querying of supported releases.
final Set<String> releasesWithoutForRemoval = Set.of("6", "7", "8");
- final Set<String> releasesWithForRemoval = Set.of("9", "10", "11", "12");
+ final Set<String> releasesWithForRemoval = Set.of("9", "10", "11", "12", "13");
final Set<String> validReleases;
{
--- a/src/jdk.rmic/share/classes/sun/tools/java/RuntimeConstants.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.rmic/share/classes/sun/tools/java/RuntimeConstants.java Wed Dec 19 20:53:30 2018 +0100
@@ -67,7 +67,7 @@
/* Class File Constants */
int JAVA_MAGIC = 0xcafebabe;
int JAVA_MIN_SUPPORTED_VERSION = 45;
- int JAVA_MAX_SUPPORTED_VERSION = 56;
+ int JAVA_MAX_SUPPORTED_VERSION = 57;
int JAVA_MAX_SUPPORTED_MINOR_VERSION = 0;
/* Generate class file version for 1.1 by default */
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java Wed Dec 19 20:53:30 2018 +0100
@@ -48,7 +48,6 @@
*
* @author Steve Drach
*/
-
class JarFileSystem extends ZipFileSystem {
private Function<byte[],byte[]> lookup;
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystemProvider.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystemProvider.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,21 +25,13 @@
package jdk.nio.zipfs;
-import java.nio.file.*;
-import java.nio.file.spi.*;
-import java.nio.file.attribute.*;
-import java.nio.file.spi.FileSystemProvider;
-
import java.net.URI;
-import java.io.IOException;
import java.net.URISyntaxException;
-import java.nio.channels.FileChannel;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
+import java.nio.file.FileSystem;
+import java.nio.file.Path;
+import java.nio.file.Paths;
-class JarFileSystemProvider extends ZipFileSystemProvider
-{
+class JarFileSystemProvider extends ZipFileSystemProvider {
@Override
public String getScheme() {
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,15 +34,14 @@
import java.nio.charset.CodingErrorAction;
import java.util.Arrays;
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static java.nio.charset.StandardCharsets.ISO_8859_1;
/**
* Utility class for zipfile name and comment decoding and encoding
*
- * @author Xueming Shen
+ * @author Xueming Shen
*/
-
class ZipCoder {
static class UTF8 extends ZipCoder {
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipConstants.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipConstants.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,10 +26,8 @@
package jdk.nio.zipfs;
/**
- *
* @author Xueming Shen
*/
-
class ZipConstants {
/*
* Compression methods
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipDirectoryStream.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipDirectoryStream.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,19 +25,18 @@
package jdk.nio.zipfs;
+import java.io.IOException;
+import java.nio.file.ClosedDirectoryStreamException;
import java.nio.file.DirectoryStream;
-import java.nio.file.ClosedDirectoryStreamException;
import java.nio.file.NotDirectoryException;
import java.nio.file.Path;
import java.util.Iterator;
import java.util.NoSuchElementException;
-import java.io.IOException;
/**
*
- * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
+ * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
*/
-
class ZipDirectoryStream implements DirectoryStream<Path> {
private final ZipFileSystem zipfs;
@@ -70,8 +69,8 @@
} catch (IOException e) {
throw new IllegalStateException(e);
}
+
return new Iterator<Path>() {
- private Path next;
@Override
public boolean hasNext() {
if (isClosed)
@@ -97,5 +96,4 @@
public synchronized void close() throws IOException {
isClosed = true;
}
-
}
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileAttributeView.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileAttributeView.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,17 +25,17 @@
package jdk.nio.zipfs;
-import java.nio.file.attribute.*;
import java.io.IOException;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.FileAttributeView;
+import java.nio.file.attribute.FileTime;
import java.util.LinkedHashMap;
import java.util.Map;
-/*
- * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
+/**
+ * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
*/
-
-class ZipFileAttributeView implements BasicFileAttributeView
-{
+class ZipFileAttributeView implements BasicFileAttributeView {
private static enum AttrID {
size,
creationTime,
@@ -85,8 +85,7 @@
return isZipView ? "zip" : "basic";
}
- public ZipFileAttributes readAttributes() throws IOException
- {
+ public ZipFileAttributes readAttributes() throws IOException {
return path.getAttributes();
}
@@ -104,11 +103,11 @@
{
try {
if (AttrID.valueOf(attribute) == AttrID.lastModifiedTime)
- setTimes ((FileTime)value, null, null);
+ setTimes((FileTime)value, null, null);
if (AttrID.valueOf(attribute) == AttrID.lastAccessTime)
- setTimes (null, (FileTime)value, null);
+ setTimes(null, (FileTime)value, null);
if (AttrID.valueOf(attribute) == AttrID.creationTime)
- setTimes (null, null, (FileTime)value);
+ setTimes(null, null, (FileTime)value);
return;
} catch (IllegalArgumentException x) {}
throw new UnsupportedOperationException("'" + attribute +
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileAttributes.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileAttributes.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,10 +28,10 @@
import java.nio.file.attribute.BasicFileAttributes;
/**
+ * The attributes of a file stored in a zip file.
*
- * @author Xueming Shen, Rajendra Gutupalli,Jaya Hangal
+ * @author Xueming Shen, Rajendra Gutupalli,Jaya Hangal
*/
-
interface ZipFileAttributes extends BasicFileAttributes {
public long compressedSize();
public long crc();
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileStore.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileStore.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,21 +26,17 @@
package jdk.nio.zipfs;
import java.io.IOException;
-import java.nio.file.Files;
import java.nio.file.FileStore;
import java.nio.file.FileSystems;
+import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.FileAttributeView;
import java.nio.file.attribute.FileStoreAttributeView;
-import java.nio.file.attribute.BasicFileAttributeView;
-import java.util.Formatter;
-/*
- *
- * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
+/**
+ * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
*/
-
class ZipFileStore extends FileStore {
private final ZipFileSystem zfs;
@@ -76,7 +72,6 @@
}
@Override
- @SuppressWarnings("unchecked")
public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) {
if (type == null)
throw new NullPointerException();
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,17 +29,22 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
-import java.io.File;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
-import java.nio.channels.*;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.channels.WritableByteChannel;
import java.nio.file.*;
-import java.nio.file.attribute.*;
-import java.nio.file.spi.*;
+import java.nio.file.attribute.FileAttribute;
+import java.nio.file.attribute.FileTime;
+import java.nio.file.attribute.UserPrincipalLookupService;
+import java.nio.file.spi.FileSystemProvider;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
@@ -49,25 +54,30 @@
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.regex.Pattern;
import java.util.zip.CRC32;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
import java.util.zip.Inflater;
-import java.util.zip.Deflater;
import java.util.zip.InflaterInputStream;
-import java.util.zip.DeflaterOutputStream;
import java.util.zip.ZipException;
-import static java.lang.Boolean.*;
+
+import static java.lang.Boolean.TRUE;
+import static java.nio.file.StandardCopyOption.COPY_ATTRIBUTES;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static java.nio.file.StandardOpenOption.APPEND;
+import static java.nio.file.StandardOpenOption.CREATE;
+import static java.nio.file.StandardOpenOption.CREATE_NEW;
+import static java.nio.file.StandardOpenOption.READ;
+import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
+import static java.nio.file.StandardOpenOption.WRITE;
import static jdk.nio.zipfs.ZipConstants.*;
import static jdk.nio.zipfs.ZipUtils.*;
-import static java.nio.file.StandardOpenOption.*;
-import static java.nio.file.StandardCopyOption.*;
/**
* A FileSystem built on a zip file
*
* @author Xueming Shen
*/
-
class ZipFileSystem extends FileSystem {
-
private final ZipFileSystemProvider provider;
private final Path zfpath;
final ZipCoder zc;
@@ -79,15 +89,15 @@
private final boolean useTempFile; // use a temp file for newOS, default
// is to use BAOS for better performance
private static final boolean isWindows = AccessController.doPrivileged(
- (PrivilegedAction<Boolean>) () -> System.getProperty("os.name")
- .startsWith("Windows"));
+ (PrivilegedAction<Boolean>)() -> System.getProperty("os.name")
+ .startsWith("Windows"));
private final boolean forceEnd64;
private final int defaultMethod; // METHOD_STORED if "noCompression=true"
// METHOD_DEFLATED otherwise
ZipFileSystem(ZipFileSystemProvider provider,
Path zfpath,
- Map<String, ?> env) throws IOException
+ Map<String, ?> env) throws IOException
{
// default encoding for name/comment
String nameEncoding = env.containsKey("encoding") ?
@@ -269,12 +279,12 @@
}
if (!streams.isEmpty()) { // unlock and close all remaining streams
Set<InputStream> copy = new HashSet<>(streams);
- for (InputStream is: copy)
+ for (InputStream is : copy)
is.close();
}
beginWrite(); // lock and sync
try {
- AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
+ AccessController.doPrivileged((PrivilegedExceptionAction<Void>)() -> {
sync(); return null;
});
ch.close(); // close the ch just in case no update
@@ -296,7 +306,7 @@
IOException ioe = null;
synchronized (tmppaths) {
- for (Path p: tmppaths) {
+ for (Path p : tmppaths) {
try {
AccessController.doPrivileged(
(PrivilegedExceptionAction<Boolean>)() -> Files.deleteIfExists(p));
@@ -521,7 +531,7 @@
boolean hasCreate = false;
boolean hasAppend = false;
boolean hasTruncate = false;
- for (OpenOption opt: options) {
+ for (OpenOption opt : options) {
if (opt == READ)
throw new IllegalArgumentException("READ not allowed");
if (opt == CREATE_NEW)
@@ -1455,6 +1465,7 @@
e.size = def.getBytesRead();
e.csize = def.getBytesWritten();
e.crc = crc.getValue();
+ releaseDeflater(def);
}
}
@@ -1477,7 +1488,7 @@
// TBD: wrap to hook close()
// streams.add(eis);
return eis;
- } else { // untouced CEN or COPY
+ } else { // untouched CEN or COPY
eis = new EntryInputStream(e, ch);
}
if (e.method == METHOD_DEFLATED) {
@@ -1539,14 +1550,12 @@
// point to a new channel after sync()
private long pos; // current position within entry data
protected long rem; // number of remaining bytes within entry
- protected final long size; // uncompressed size of this entry
EntryInputStream(Entry e, SeekableByteChannel zfch)
throws IOException
{
this.zfch = zfch;
rem = e.csize;
- size = e.size;
pos = e.locoff;
if (pos == -1) {
Entry e2 = getEntry(e.name);
@@ -1613,10 +1622,6 @@
return rem > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) rem;
}
- public long size() {
- return size;
- }
-
public void close() {
rem = 0;
streams.remove(this);
@@ -1672,7 +1677,7 @@
// List of available Deflater objects for compression
private final List<Deflater> deflaters = new ArrayList<>();
- // Gets an deflater from the list of available deflaters or allocates
+ // Gets a deflater from the list of available deflaters or allocates
// a new one.
private Deflater getDeflater() {
synchronized (deflaters) {
@@ -1985,9 +1990,7 @@
return this;
}
- int writeCEN(OutputStream os) throws IOException
- {
- int written = CENHDR;
+ int writeCEN(OutputStream os) throws IOException {
int version0 = version();
long csize0 = csize;
long size0 = size;
@@ -2101,9 +2104,7 @@
///////////////////// LOC //////////////////////
int writeLOC(OutputStream os) throws IOException {
- writeInt(os, LOCSIG); // LOC header signature
- int version = version();
-
+ int version0 = version();
byte[] zname = isdir ? toDirectoryPath(name) : name;
int nlen = (zname != null) ? zname.length - 1 : 0; // [0] is slash
int elen = (extra != null) ? extra.length : 0;
@@ -2112,8 +2113,9 @@
int elen64 = 0;
int elenEXTT = 0;
int elenNTFS = 0;
+ writeInt(os, LOCSIG); // LOC header signature
if ((flag & FLAG_DATADESCR) != 0) {
- writeShort(os, version()); // version needed to extract
+ writeShort(os, version0); // version needed to extract
writeShort(os, flag); // general purpose bit flag
writeShort(os, method); // compression method
// last modification time
@@ -2128,7 +2130,7 @@
elen64 = 20; //headid(2) + size(2) + size(8) + csize(8)
writeShort(os, 45); // ver 4.5 for zip64
} else {
- writeShort(os, version()); // version needed to extract
+ writeShort(os, version0); // version needed to extract
}
writeShort(os, flag); // general purpose bit flag
writeShort(os, method); // compression method
@@ -2430,7 +2432,6 @@
// structure.
// A possible solution is to build the node tree ourself as
// implemented below.
- private IndexNode root;
// default time stamp for pseudo entries
private long zfsDefaultTimeStamp = System.currentTimeMillis();
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,28 +25,31 @@
package jdk.nio.zipfs;
-import java.io.*;
-import java.nio.channels.*;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.channels.AsynchronousFileChannel;
+import java.nio.channels.FileChannel;
+import java.nio.channels.SeekableByteChannel;
import java.nio.file.*;
import java.nio.file.DirectoryStream.Filter;
-import java.nio.file.attribute.*;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileAttribute;
+import java.nio.file.attribute.FileAttributeView;
import java.nio.file.spi.FileSystemProvider;
-import java.net.URI;
-import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ExecutorService;
import java.util.zip.ZipException;
-import java.util.concurrent.ExecutorService;
-/*
- *
- * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
+/**
+ * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
*/
-
public class ZipFileSystemProvider extends FileSystemProvider {
-
private final Map<Path, ZipFileSystem> filesystems = new HashMap<>();
public ZipFileSystemProvider() {}
@@ -202,7 +205,6 @@
}
@Override
- @SuppressWarnings("unchecked")
public <V extends FileAttributeView> V
getFileAttributeView(Path path, Class<V> type, LinkOption... options)
{
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipInfo.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipInfo.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,15 +28,17 @@
import java.nio.file.Paths;
import java.util.Collections;
import java.util.Map;
+
import static jdk.nio.zipfs.ZipConstants.*;
-import static jdk.nio.zipfs.ZipUtils.*;
+import static jdk.nio.zipfs.ZipUtils.dosToJavaTime;
+import static jdk.nio.zipfs.ZipUtils.unixToJavaTime;
+import static jdk.nio.zipfs.ZipUtils.winToJavaTime;
/**
* Print all loc and cen headers of the ZIP file
*
- * @author Xueming Shen
+ * @author Xueming Shen
*/
-
public class ZipInfo {
public static void main(String[] args) throws Throwable {
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,36 @@
package jdk.nio.zipfs;
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URI;
-import java.nio.channels.*;
+import java.nio.channels.FileChannel;
+import java.nio.channels.SeekableByteChannel;
import java.nio.file.*;
import java.nio.file.DirectoryStream.Filter;
-import java.nio.file.attribute.*;
-import java.util.*;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.FileAttribute;
+import java.nio.file.attribute.FileTime;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Set;
+
import static java.nio.charset.StandardCharsets.UTF_8;
-import static java.nio.file.StandardOpenOption.*;
-import static java.nio.file.StandardCopyOption.*;
+import static java.nio.file.StandardCopyOption.COPY_ATTRIBUTES;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static java.nio.file.StandardOpenOption.CREATE;
+import static java.nio.file.StandardOpenOption.READ;
+import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
+import static java.nio.file.StandardOpenOption.WRITE;
/**
- *
- * @author Xueming Shen, Rajendra Gutupalli,Jaya Hangal
+ * @author Xueming Shen, Rajendra Gutupalli,Jaya Hangal
*/
-
final class ZipPath implements Path {
private final ZipFileSystem zfs;
@@ -522,7 +536,6 @@
private byte[] normalize(String path, int off, int len) {
StringBuilder to = new StringBuilder(len);
to.append(path, 0, off);
- int m = off;
char prevC = 0;
while (off < len) {
char c = path.charAt(off++);
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipUtils.java Wed Dec 19 08:32:48 2018 +0100
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipUtils.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,14 +33,12 @@
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Date;
+import java.util.concurrent.TimeUnit;
import java.util.regex.PatternSyntaxException;
-import java.util.concurrent.TimeUnit;
/**
- *
* @author Xueming Shen
*/
-
class ZipUtils {
/*
@@ -155,7 +153,6 @@
ldt.getSecond() >> 1) & 0xffffffffL;
}
-
// used to adjust values between Windows and java epoch
private static final long WINDOWS_EPOCH_IN_MICROSECONDS = -11644473600000000L;
public static final long winToJavaTime(long wtime) {
--- a/test/hotspot/jtreg/ProblemList.txt Wed Dec 19 08:32:48 2018 +0100
+++ b/test/hotspot/jtreg/ProblemList.txt Wed Dec 19 20:53:30 2018 +0100
@@ -187,7 +187,6 @@
vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java 7013634,6606767 generic-all
vmTestbase/nsk/jvmti/ThreadStart/threadstart001/TestDescription.java 8016181 generic-all
vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/TestDescription.java 8173658 generic-all
-vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/TestDescription.java 8051349 generic-all
vmTestbase/nsk/jvmti/AttachOnDemand/attach034/TestDescription.java 8042145 generic-all
vmTestbase/nsk/jvmti/AttachOnDemand/attach045/TestDescription.java 8202971 generic-all
vmTestbase/nsk/jvmti/unit/heap/HeapWalkTests/TestDescription.java 8016181 generic-all
--- a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorEventsForTwoThreadsTest.java Wed Dec 19 08:32:48 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2018, Google and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package MyPackage;
-
-/**
- * @test
- * @build Frame HeapMonitor ThreadInformation
- * @summary Ensures the JVMTI Heap Monitor is not thread enable (test to change when it becomes so)
- * @compile HeapMonitorEventsForTwoThreadsTest.java
- * @run main/othervm/native -agentlib:HeapMonitorTest MyPackage.HeapMonitorEventsForTwoThreadsTest
- */
-
-import java.util.List;
-
-public class HeapMonitorEventsForTwoThreadsTest {
- public native static boolean checkSamples();
-
- public static void main(String[] args) {
- final int numThreads = 24;
- List<ThreadInformation> threadList = ThreadInformation.createThreadList(numThreads);
-
- Thread firstThread = threadList.get(0).getThread();
- Thread secondThread = threadList.get(1).getThread();
- if (HeapMonitor.enableSamplingEventsForTwoThreads(firstThread, secondThread)) {
- throw new RuntimeException("Sampling event is thread enabled, that is unexpected.");
- }
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorThreadDisabledTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Google and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package MyPackage;
+
+/**
+ * @test
+ * @build Frame HeapMonitor ThreadInformation
+ * @summary Verifies the JVMTI Heap Monitor Thread can disable events for a given thread.
+ * @compile HeapMonitorThreadDisabledTest.java
+ * @run main/othervm/native -Xmx512m -agentlib:HeapMonitorTest MyPackage.HeapMonitorThreadDisabledTest
+ */
+
+import java.util.List;
+
+public class HeapMonitorThreadDisabledTest {
+ private native static void enableSamplingEvents(Thread thread);
+ private native static boolean checkThreadSamplesOnlyFrom(Thread thread);
+
+ public static void main(String[] args) {
+ final int numThreads = 4;
+ List<ThreadInformation> threadList = ThreadInformation.createThreadList(numThreads);
+
+ // Sample at a interval of 8k.
+ HeapMonitor.setSamplingInterval(1 << 13);
+
+ // Only enable the sampling for a given thread.
+ Thread thread = threadList.get(0).getThread();
+ enableSamplingEvents(thread);
+
+ System.err.println("Starting threads");
+ ThreadInformation.startThreads(threadList);
+ ThreadInformation.waitForThreads(threadList);
+ System.err.println("Waited for threads");
+
+ // Only have the samples for a given thread should be captured.
+ if (!checkThreadSamplesOnlyFrom(thread)) {
+ throw new RuntimeException(
+ "Problem with checkSamples: got no events from the expected thread");
+ }
+
+ // Now inform each thread we are done and wait for them to be done.
+ ThreadInformation.stopThreads(threadList);
+ }
+}
--- a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.c Wed Dec 19 08:32:48 2018 +0100
+++ b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.c Wed Dec 19 20:53:30 2018 +0100
@@ -720,101 +720,86 @@
#define MAX_THREADS 500
typedef struct ThreadStats {
- int number_threads;
+ int thread_count;
int counts[MAX_THREADS];
- int not_helper_counts[MAX_THREADS];
- int index[MAX_THREADS];
- jthread threads[MAX_THREADS];
-
- int method_resolution_problem;
+ char* threads[MAX_THREADS];
} ThreadStats;
static ThreadStats thread_stats;
-static void add_thread_count(jthread thread, int lock, int helper) {
- int i;
+JNIEXPORT jboolean JNICALL
+Java_MyPackage_HeapMonitorThreadDisabledTest_checkThreadSamplesOnlyFrom(
+ JNIEnv* env, jclass cls, jthread thread) {
jvmtiThreadInfo info;
- const char* name;
- char* end;
- int idx;
- int err;
+ jvmtiError err;
+ char* expected_name;
+ int found_thread = FALSE;
+
+ err = (*jvmti)->GetThreadInfo(jvmti, thread, &info);
+ expected_name = info.name;
- if (lock) {
- event_storage_lock(&global_event_storage);
+ if (err != JVMTI_ERROR_NONE) {
+ fprintf(stderr, "Failed to get thread information\n");
+ return FALSE;
+ }
+
+ if (thread_stats.thread_count != 1) {
+ fprintf(stderr, "Wrong thread number: %d (expected 1)\n",
+ thread_stats.thread_count);
+ return FALSE;
}
- for (i = 0; i < thread_stats.number_threads; i++) {
- if (thread_stats.threads[i] == thread) {
- if (helper) {
- thread_stats.counts[i]++;
- } else {
- thread_stats.not_helper_counts[i]++;
- }
+ if (strcmp(expected_name, thread_stats.threads[0]) != 0) {
+ fprintf(stderr, "Unexpected thread name: '%s' (expected '%s')\n",
+ thread_stats.threads[0], expected_name);
+ return FALSE;
+ }
+
+ return TRUE;
+}
- if (lock) {
- event_storage_unlock(&global_event_storage);
- }
+static void add_thread_count(jthread thread) {
+ int i;
+ jvmtiThreadInfo info;
+ jvmtiError err;
+
+ err = (*jvmti)->GetThreadInfo(jvmti, thread, &info);
+ if (err != JVMTI_ERROR_NONE) {
+ fprintf(stderr, "Thread info for %p failed, ignoring thread count\n",
+ thread);
+ return;
+ }
+
+ event_storage_lock(&global_event_storage);
+ for (i = 0; i < thread_stats.thread_count; i++) {
+ if (!strcmp(thread_stats.threads[i], info.name)) {
+ thread_stats.counts[i]++;
+ event_storage_unlock(&global_event_storage);
return;
}
}
- thread_stats.threads[thread_stats.number_threads] = thread;
-
- err = (*jvmti)->GetThreadInfo(jvmti, thread, &info);
- if (err != JVMTI_ERROR_NONE) {
- if (lock) {
- event_storage_unlock(&global_event_storage);
- }
-
- // Just to have it accounted as an error...
- info.name = "Allocator99";
- }
-
- if (!strstr(info.name, "Allocator")) {
- if (lock) {
- event_storage_unlock(&global_event_storage);
- }
-
- // Just to have it accounted as an error...
- info.name = "Allocator98";
- }
+ thread_stats.threads[thread_stats.thread_count] = info.name;
+ thread_stats.counts[thread_stats.thread_count]++;
+ thread_stats.thread_count++;
+ event_storage_unlock(&global_event_storage);
+}
- name = info.name + 9;
- end = NULL;
- idx = strtol(name, &end, 0);
-
- if (*end == '\0') {
- if (helper) {
- thread_stats.counts[thread_stats.number_threads]++;
- } else {
- thread_stats.not_helper_counts[thread_stats.number_threads]++;
- }
-
- thread_stats.index[thread_stats.number_threads] = idx;
- thread_stats.number_threads++;
- } else {
- fprintf(stderr, "Problem with thread name...: %p %s\n", thread, name);
- }
-
- if (PRINT_OUT) {
- fprintf(stderr, "Added %s - %p - %d - lock: %d\n", info.name, thread, idx, lock);
- }
-
- if (lock) {
- event_storage_unlock(&global_event_storage);
- }
+JNIEXPORT void JNICALL
+Java_MyPackage_HeapMonitorThreadDisabledTest_enableSamplingEvents(
+ JNIEnv* env, jclass cls, jthread thread) {
+ fprintf(stderr, "Enabling for %p\n", thread);
+ check_error((*jvmti)->SetEventNotificationMode(
+ jvmti, JVMTI_ENABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, thread),
+ "Set event notifications for a single thread");
}
static void print_thread_stats() {
int i;
event_storage_lock(&global_event_storage);
- fprintf(stderr, "Method resolution problem: %d\n", thread_stats.method_resolution_problem);
fprintf(stderr, "Thread count:\n");
- for (i = 0; i < thread_stats.number_threads; i++) {
- fprintf(stderr, "\t%p: %d: %d - %d\n", thread_stats.threads[i],
- thread_stats.index[i],
- thread_stats.counts[i],
- thread_stats.not_helper_counts[i]);
+ for (i = 0; i < thread_stats.thread_count; i++) {
+ fprintf(stderr, "\t%s: %d\n", thread_stats.threads[i], thread_stats.counts[i]);
}
event_storage_unlock(&global_event_storage);
}
@@ -826,7 +811,7 @@
jobject object,
jclass object_klass,
jlong size) {
- add_thread_count(thread, 1, 1);
+ add_thread_count(thread);
if (event_storage_get_compaction_required(&global_event_storage)) {
event_storage_compact(&global_event_storage, jni_env);
@@ -864,29 +849,6 @@
"Set event notifications");
}
-static int enable_notifications_for_two_threads(jthread first, jthread second) {
- if (check_error((*jvmti)->SetEventNotificationMode(
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL),
- "Set event notifications")) {
- return 0;
- }
-
- if (check_error((*jvmti)->SetEventNotificationMode(
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, first),
- "Set event notifications")) {
- return 0;
- }
-
- // Second thread should fail.
- if (check_error((*jvmti)->SetEventNotificationMode(
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, second),
- "Set event notifications")) {
- return 0;
- }
-
- return 1;
-}
-
static
jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
@@ -970,14 +932,6 @@
enable_notifications();
}
-JNIEXPORT jboolean JNICALL
-Java_MyPackage_HeapMonitor_enableSamplingEventsForTwoThreads(JNIEnv* env,
- jclass cls,
- jthread first,
- jthread second) {
- return enable_notifications_for_two_threads(first, second);
-}
-
JNIEXPORT void JNICALL
Java_MyPackage_HeapMonitor_disableSamplingEvents(JNIEnv* env, jclass cls) {
check_error((*jvmti)->SetEventNotificationMode(
@@ -1130,10 +1084,9 @@
JNIEXPORT jboolean JNICALL
Java_MyPackage_HeapMonitorThreadTest_checkSamples(JNIEnv* env, jclass cls,
jint num_threads) {
-
print_thread_stats();
// Ensure we got stacks from at least num_threads.
- return thread_stats.number_threads >= num_threads;
+ return thread_stats.thread_count >= num_threads;
}
JNIEXPORT
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -310,7 +310,8 @@
(long)frameStack[j].location);
/* query frame location */
if (!NSK_JVMTI_VERIFY(
- jvmti->GetFrameLocation(threadsDesc[i].thread, j, &qMethod, &qLocation))) {
+ jvmti->GetFrameLocation(threadsDesc[i].thread, j, &qMethod, &qLocation))
+ && (suspended == NSK_TRUE)) {
nsk_jvmti_setFailStatus();
continue;
}
@@ -318,8 +319,8 @@
NSK_DISPLAY2(" queried: method: %p, location: %ld\n",
(void*)qMethod, (long)qLocation);
- /* check frame equalaty */
- if (frameStack[j].method != qMethod) {
+ /* check frame equality */
+ if ((suspended == NSK_TRUE) && (frameStack[j].method != qMethod)) {
NSK_COMPLAIN6("Different method in stack frame #%d for %s thread #%d (%s):\n"
"# GetStackTrace(): %p\n"
"# GetFrameLocation(): %p\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001.java Wed Dec 19 20:53:30 2018 +0100
@@ -268,6 +268,7 @@
class sp06t001ThreadRunningInterrupted extends sp06t001Thread {
private Object waitingMonitor = new Object();
+ volatile boolean interruptReady = false;
public sp06t001ThreadRunningInterrupted(String name, Log log) {
super(name, log);
@@ -275,8 +276,9 @@
public void testedMethod(boolean simulate, int i) {
if (!simulate) {
+ interruptReady = true;
synchronized (waitingMonitor) {
- // wait on watingMonitor until interrupted
+ // wait on waitingMonitor until interrupted
try {
waitingMonitor.wait();
} catch (InterruptedException ignore) {
@@ -303,6 +305,14 @@
public boolean checkReady() {
// interrupt thread on wait()
+ // delay until testMethod is ready
+ while (!interruptReady) {
+ try {
+ sleep(1000);
+ } catch (InterruptedException ie) {
+ // ignored
+ }
+ }
synchronized (waitingMonitor) {
interrupt();
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp Wed Dec 19 08:32:48 2018 +0100
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp Wed Dec 19 20:53:30 2018 +0100
@@ -333,7 +333,8 @@
(long)frameStack[j].location);
/* query frame location */
if (!NSK_JVMTI_VERIFY(
- jvmti->GetFrameLocation(threadsDesc[i].thread, j, &qMethod, &qLocation))) {
+ jvmti->GetFrameLocation(threadsDesc[i].thread, j, &qMethod, &qLocation))
+ && (suspended == NSK_TRUE)) {
nsk_jvmti_setFailStatus();
continue;
}
@@ -341,8 +342,8 @@
NSK_DISPLAY2(" queried: method: 0x%p, location: %ld\n",
(void*)qMethod, (long)qLocation);
- /* check frame equalaty */
- if (frameStack[j].method != qMethod) {
+ /* check frame equality */
+ if ((suspended == NSK_TRUE) && (frameStack[j].method != qMethod)) {
NSK_COMPLAIN6("Different method in stack frame #%d for %s thread #%d (%s):\n"
"# GetStackTrace(): 0x%p\n"
"# GetFrameLocation(): 0x%p\n",
@@ -350,7 +351,7 @@
(void*)frameStack[j].method, (void*)qMethod);
nsk_jvmti_setFailStatus();
}
- if (frameStack[j].location != qLocation) {
+ if ((suspended == NSK_TRUE) && (frameStack[j].location != qLocation)) {
NSK_COMPLAIN6("Different location in stack frame #%d for %s thread #%d (%s):\n"
"# GetStackTrace(): %ld\n"
"# GetFrameLocation(): %ld\n",
--- a/test/jaxp/TEST.ROOT Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jaxp/TEST.ROOT Wed Dec 19 20:53:30 2018 +0100
@@ -23,7 +23,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b12
+requiredVersion=4.2 b13
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
--- a/test/jdk/TEST.ROOT Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/TEST.ROOT Wed Dec 19 20:53:30 2018 +0100
@@ -49,7 +49,7 @@
release.implementor
# Minimum jtreg version
-requiredVersion=4.2 b12
+requiredVersion=4.2 b13
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -64,7 +64,7 @@
* implementation.
* @modules java.base/sun.util.logging
* java.base/jdk.internal.logger
- * @build AccessSystemLogger BaseDefaultLoggerFinderTest CustomSystemClassLoader
+ * @build AccessSystemLogger BaseDefaultLoggerFinderTest CustomSystemClassLoader BaseLoggerFinder
* @run driver AccessSystemLogger
* @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest NOSECURITY
* @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest NOPERMISSIONS
@@ -97,7 +97,7 @@
static {
try {
providerClass = new Class<?>[] {
- ClassLoader.getSystemClassLoader().loadClass("BaseDefaultLoggerFinderTest$BaseLoggerFinder"),
+ ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder"),
};
} catch (ClassNotFoundException ex) {
throw new ExceptionInInitializerError(ex);
@@ -120,43 +120,6 @@
PlatformLogger.Bridge asPlatformLoggerBridge(Logger logger);
}
- public static class BaseLoggerFinder extends DefaultLoggerFinder implements TestLoggerFinder {
-
- static final RuntimePermission LOGGERFINDER_PERMISSION =
- new RuntimePermission("loggerFinder");
- public BaseLoggerFinder() {
- if (fails.get()) {
- throw new RuntimeException("Simulate exception while loading provider");
- }
- }
-
- @Override
- public void setLevel(Logger logger, Level level, Module caller) {
- PrivilegedAction<Void> pa = () -> {
- setLevel(logger, PlatformLogger.toPlatformLevel(level), caller);
- return null;
- };
- AccessController.doPrivileged(pa);
- }
-
- @Override
- public void setLevel(Logger logger, PlatformLogger.Level level, Module caller) {
- PrivilegedAction<Logger> pa = () -> demandLoggerFor(logger.getName(), caller);
- Logger impl = AccessController.doPrivileged(pa);
- SimpleConsoleLogger.class.cast(impl)
- .getLoggerConfiguration()
- .setPlatformLevel(level);
- }
-
- @Override
- public PlatformLogger.Bridge asPlatformLoggerBridge(Logger logger) {
- PrivilegedAction<PlatformLogger.Bridge> pa = () ->
- PlatformLogger.Bridge.convert(logger);
- return AccessController.doPrivileged(pa);
- }
-
- }
-
public static class MyBundle extends ResourceBundle {
final ConcurrentHashMap<String,String> map = new ConcurrentHashMap<>();
@@ -477,7 +440,7 @@
System.out.println("\n*** Without Security Manager\n");
System.out.println(TestLoggerFinder.conf.get());
provider = getLoggerFinder(expectedClass);
- if (!provider.getClass().getName().equals("BaseDefaultLoggerFinderTest$BaseLoggerFinder")) {
+ if (!provider.getClass().getName().equals("BaseLoggerFinder")) {
throw new RuntimeException("Unexpected provider: " + provider.getClass().getName());
}
test(provider, true);
@@ -498,7 +461,7 @@
try {
allowControl.get().set(true);
provider = getLoggerFinder(expectedClass);
- if (!provider.getClass().getName().equals("BaseDefaultLoggerFinderTest$BaseLoggerFinder")) {
+ if (!provider.getClass().getName().equals("BaseLoggerFinder")) {
throw new RuntimeException("Unexpected provider: " + provider.getClass().getName());
}
} finally {
@@ -516,7 +479,7 @@
try {
allowControl.get().set(true);
provider = getLoggerFinder(expectedClass);
- if (!provider.getClass().getName().equals("BaseDefaultLoggerFinderTest$BaseLoggerFinder")) {
+ if (!provider.getClass().getName().equals("BaseLoggerFinder")) {
throw new RuntimeException("Unexpected provider: " + provider.getClass().getName());
}
test(provider, true);
@@ -532,7 +495,7 @@
try {
allowControl.get().set(true);
provider = getLoggerFinder(expectedClass);
- if (!provider.getClass().getName().equals("BaseDefaultLoggerFinderTest$BaseLoggerFinder")) {
+ if (!provider.getClass().getName().equals("BaseLoggerFinder")) {
throw new RuntimeException("Unexpected provider: " + provider.getClass().getName());
}
test(provider, CustomLoggerWrapper::new, true);
@@ -550,7 +513,7 @@
try {
allowControl.get().set(true);
provider = getLoggerFinder(expectedClass);
- if (!provider.getClass().getName().equals("BaseDefaultLoggerFinderTest$BaseLoggerFinder")) {
+ if (!provider.getClass().getName().equals("BaseLoggerFinder")) {
throw new RuntimeException("Unexpected provider: " + provider.getClass().getName());
}
test(provider, ReflectionLoggerWrapper::new, true);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseLoggerFinder.java Wed Dec 19 20:53:30 2018 +0100
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.internal.logger.DefaultLoggerFinder;
+import jdk.internal.logger.SimpleConsoleLogger;
+import sun.util.logging.PlatformLogger;
+
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+public class BaseLoggerFinder extends DefaultLoggerFinder
+ implements BaseDefaultLoggerFinderTest.TestLoggerFinder {
+
+ public BaseLoggerFinder() {
+ if (fails.get()) {
+ throw new RuntimeException("Simulate exception while loading provider");
+ }
+ }
+
+ @Override
+ public void setLevel(Logger logger, Level level, Module caller) {
+ PrivilegedAction<Void> pa = () -> {
+ setLevel(logger, PlatformLogger.toPlatformLevel(level), caller);
+ return null;
+ };
+ AccessController.doPrivileged(pa);
+ }
+
+ @Override
+ public void setLevel(Logger logger, PlatformLogger.Level level, Module caller) {
+ PrivilegedAction<Logger> pa = () -> demandLoggerFor(logger.getName(), caller);
+ Logger impl = AccessController.doPrivileged(pa);
+ SimpleConsoleLogger.class.cast(impl)
+ .getLoggerConfiguration()
+ .setPlatformLevel(level);
+ }
+
+ @Override
+ public PlatformLogger.Bridge asPlatformLoggerBridge(Logger logger) {
+ PrivilegedAction<PlatformLogger.Bridge> pa = () ->
+ PlatformLogger.Bridge.convert(logger);
+ return AccessController.doPrivileged(pa);
+ }
+
+}
+
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/CustomSystemClassLoader.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/CustomSystemClassLoader.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
@@ -48,8 +49,8 @@
final List<String> finderClassNames =
- Arrays.asList("BaseDefaultLoggerFinderTest$BaseLoggerFinder");
- final Map<String, Class<?>> finderClasses = new HashMap<>();
+ Arrays.asList("BaseLoggerFinder");
+ final Map<String, Class<?>> finderClasses = new ConcurrentHashMap<>();
Class<?> testLoggerFinderClass;
public CustomSystemClassLoader() {
@@ -61,9 +62,14 @@
private Class<?> defineFinderClass(String name)
throws ClassNotFoundException {
+ Class<?> finderClass = finderClasses.get(name);
+ if (finderClass != null) return finderClass;
+
final Object obj = getClassLoadingLock(name);
synchronized(obj) {
- if (finderClasses.get(name) != null) return finderClasses.get(name);
+ finderClasses.get(name);
+ if (finderClass != null) return finderClass;
+
if (testLoggerFinderClass == null) {
// Hack: we load testLoggerFinderClass to get its code source.
// we can't use this.getClass() since we are in the boot.
@@ -76,7 +82,7 @@
byte[] b = Files.readAllBytes(file.toPath());
Permissions perms = new Permissions();
perms.add(new AllPermission());
- Class<?> finderClass = defineClass(
+ finderClass = defineClass(
name, b, 0, b.length, new ProtectionDomain(
this.getClass().getProtectionDomain().getCodeSource(),
perms));
@@ -94,9 +100,13 @@
}
}
+ private static boolean matches(String prefix, String name) {
+ return prefix.equals(name) || name.startsWith(prefix + "$");
+ }
+
@Override
public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- if (finderClassNames.contains(name)) {
+ if (finderClassNames.stream().anyMatch(n -> matches(n, name))) {
Class<?> c = defineFinderClass(name);
if (resolve) {
resolveClass(c);
@@ -108,7 +118,7 @@
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
- if (finderClassNames.contains(name)) {
+ if (finderClassNames.stream().anyMatch(n -> matches(n, name))) {
return defineFinderClass(name);
}
return super.findClass(name);
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 20:53:30 2018 +0100
@@ -1,1 +1,1 @@
-BaseDefaultLoggerFinderTest$BaseLoggerFinder
+BaseLoggerFinder
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
* Tests a naive implementation of System.Logger, and in particular
* the default mapping provided by PlatformLogger.Bridge.
* @modules java.base/sun.util.logging java.base/jdk.internal.logger
- * @build CustomSystemClassLoader BaseLoggerBridgeTest
+ * @build CustomSystemClassLoader BaseLoggerFinder BaseLoggerBridgeTest
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest NOSECURITY
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest NOPERMISSIONS
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest WITHPERMISSIONS
@@ -94,7 +94,7 @@
static final Class<?> providerClass;
static {
try {
- providerClass = ClassLoader.getSystemClassLoader().loadClass("BaseLoggerBridgeTest$BaseLoggerFinder");
+ providerClass = ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder");
} catch (ClassNotFoundException ex) {
throw new ExceptionInInitializerError(ex);
}
@@ -336,33 +336,12 @@
log(LogEvent.of(isLoggable(level), name, level, thrown, msgSupplier));
}
-
-
}
public Logger getLogger(String name, Module caller);
public Logger getLocalizedLogger(String name, ResourceBundle bundle, Module caller);
}
- public static class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
- static final RuntimePermission LOGGERFINDER_PERMISSION =
- new RuntimePermission("loggerFinder");
- @Override
- public Logger getLogger(String name, Module caller) {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(LOGGERFINDER_PERMISSION);
- }
- PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
- ClassLoader callerLoader = AccessController.doPrivileged(pa);
- if (callerLoader == null) {
- return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
- } else {
- return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
- }
- }
- }
-
static PlatformLogger.Bridge convert(Logger logger) {
boolean old = allowAll.get().get();
allowAccess.get().set(true);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerFinder.java Wed Dec 19 20:53:30 2018 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.lang.System.LoggerFinder;
+import java.lang.System.Logger;
+
+public class BaseLoggerFinder extends LoggerFinder
+ implements BaseLoggerBridgeTest.TestLoggerFinder {
+ static final RuntimePermission LOGGERFINDER_PERMISSION =
+ new RuntimePermission("loggerFinder");
+
+ @Override
+ public Logger getLogger(String name, Module caller) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(LOGGERFINDER_PERMISSION);
+ }
+ PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
+ ClassLoader callerLoader = AccessController.doPrivileged(pa);
+ if (callerLoader == null) {
+ return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
+ } else {
+ return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
+ }
+ }
+}
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/CustomSystemClassLoader.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/CustomSystemClassLoader.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
import java.security.AllPermission;
import java.security.Permissions;
import java.security.ProtectionDomain;
-
+import java.util.concurrent.ConcurrentHashMap;
/**
* A custom ClassLoader to load the concrete LoggerFinder class
@@ -39,7 +39,7 @@
public class CustomSystemClassLoader extends ClassLoader {
- Class<?> finderClass = null;
+ private final ConcurrentHashMap<String, Class<?>> classes = new ConcurrentHashMap<>();
public CustomSystemClassLoader() {
super();
@@ -50,8 +50,13 @@
private Class<?> defineFinderClass(String name)
throws ClassNotFoundException {
+ Class<?> finderClass = classes.get(name);
+ if (finderClass != null) return finderClass;
+
final Object obj = getClassLoadingLock(name);
+
synchronized(obj) {
+ finderClass = classes.get(name);
if (finderClass != null) return finderClass;
URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
@@ -66,6 +71,7 @@
this.getClass().getProtectionDomain().getCodeSource(),
perms));
System.out.println("Loaded " + name);
+ classes.put(name, finderClass);
return finderClass;
} catch (Throwable ex) {
ex.printStackTrace();
@@ -80,7 +86,7 @@
@Override
public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- if (name.endsWith("$BaseLoggerFinder")) {
+ if (name.equals("BaseLoggerFinder") || name.startsWith("BaseLoggerFinder$")) {
Class<?> c = defineFinderClass(name);
if (resolve) {
resolveClass(c);
@@ -92,7 +98,7 @@
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
- if (name.endsWith("$BaseLoggerFinder")) {
+ if (name.equals("BaseLoggerFinder") || name.startsWith("BaseLoggerFinder$")) {
return defineFinderClass(name);
}
return super.findClass(name);
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 20:53:30 2018 +0100
@@ -1,1 +1,1 @@
-BaseLoggerBridgeTest$BaseLoggerFinder
+BaseLoggerFinder
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BaseLoggerFinder.java Wed Dec 19 20:53:30 2018 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.System.Logger;
+import java.lang.System.LoggerFinder;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+public class BaseLoggerFinder extends LoggerFinder
+ implements BasePlatformLoggerTest.TestLoggerFinder {
+
+ public static final RuntimePermission LOGGERFINDER_PERMISSION =
+ new RuntimePermission("loggerFinder");
+
+ @Override
+ public Logger getLogger(String name, Module caller) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(LOGGERFINDER_PERMISSION);
+ }
+ PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
+ ClassLoader callerLoader = AccessController.doPrivileged(pa);
+ if (callerLoader == null) {
+ return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
+ } else {
+ return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
+ }
+ }
+}
+
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
* Tests a naive implementation of System.Logger, and in particular
* the default mapping provided by PlatformLogger.
* @modules java.base/sun.util.logging
- * @build CustomSystemClassLoader BasePlatformLoggerTest
+ * @build CustomSystemClassLoader BaseLoggerFinder BasePlatformLoggerTest
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest NOSECURITY
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest NOPERMISSIONS
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest WITHPERMISSIONS
@@ -90,7 +90,7 @@
static final Class<?> providerClass;
static {
try {
- providerClass = ClassLoader.getSystemClassLoader().loadClass("BasePlatformLoggerTest$BaseLoggerFinder");
+ providerClass = ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder");
} catch (ClassNotFoundException ex) {
throw new ExceptionInInitializerError(ex);
}
@@ -330,23 +330,6 @@
public Logger getLogger(String name, Module caller);
}
- public static class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
- @Override
- public Logger getLogger(String name, Module caller) {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(LOGGERFINDER_PERMISSION);
- }
- PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
- ClassLoader callerLoader = AccessController.doPrivileged(pa);
- if (callerLoader == null) {
- return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
- } else {
- return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
- }
- }
- }
-
static PlatformLogger getPlatformLogger(String name) {
boolean old = allowAccess.get().get();
allowAccess.get().set(true);
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/CustomSystemClassLoader.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/CustomSystemClassLoader.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
import java.security.AllPermission;
import java.security.Permissions;
import java.security.ProtectionDomain;
+import java.util.concurrent.ConcurrentHashMap;
/**
@@ -39,7 +40,7 @@
public class CustomSystemClassLoader extends ClassLoader {
- Class<?> finderClass = null;
+ private final ConcurrentHashMap<String, Class<?>> classes = new ConcurrentHashMap<>();
public CustomSystemClassLoader() {
super();
@@ -50,8 +51,12 @@
private Class<?> defineFinderClass(String name)
throws ClassNotFoundException {
+ Class<?> finderClass = classes.get(name);
+ if (finderClass != null) return finderClass;
+
final Object obj = getClassLoadingLock(name);
synchronized(obj) {
+ finderClass = classes.get(name);
if (finderClass != null) return finderClass;
URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
@@ -66,6 +71,7 @@
this.getClass().getProtectionDomain().getCodeSource(),
perms));
System.out.println("Loaded " + name);
+ classes.put(name, finderClass);
return finderClass;
} catch (Throwable ex) {
ex.printStackTrace();
@@ -80,7 +86,7 @@
@Override
public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- if (name.endsWith("$BaseLoggerFinder")) {
+ if (name.endsWith("BaseLoggerFinder") || name.startsWith("BaseLoggerFinder$")) {
Class<?> c = defineFinderClass(name);
if (resolve) {
resolveClass(c);
@@ -92,7 +98,7 @@
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
- if (name.endsWith("$BaseLoggerFinder")) {
+ if (name.endsWith("BaseLoggerFinder") || name.startsWith("BaseLoggerFinder$")) {
return defineFinderClass(name);
}
return super.findClass(name);
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 20:53:30 2018 +0100
@@ -1,1 +1,1 @@
-BasePlatformLoggerTest$BaseLoggerFinder
+BaseLoggerFinder
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/CustomSystemClassLoader.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/CustomSystemClassLoader.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
import java.security.AllPermission;
import java.security.Permissions;
import java.security.ProtectionDomain;
+import java.util.concurrent.ConcurrentHashMap;
/**
@@ -39,8 +40,7 @@
public class CustomSystemClassLoader extends ClassLoader {
- Class<?> loggerFinderClass = null;
-// Class<?> loggerImplClass = null;
+ private final ConcurrentHashMap<String, Class<?>> classes = new ConcurrentHashMap<>();
public CustomSystemClassLoader() {
super();
@@ -51,8 +51,13 @@
private Class<?> defineFinderClass(String name)
throws ClassNotFoundException {
+
+ Class<?> loggerFinderClass = classes.get(name);
+ if (loggerFinderClass != null) return loggerFinderClass;
+
final Object obj = getClassLoadingLock(name);
synchronized(obj) {
+ loggerFinderClass = classes.get(name);
if (loggerFinderClass != null) return loggerFinderClass;
URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
@@ -66,6 +71,7 @@
name, b, 0, b.length, new ProtectionDomain(
this.getClass().getProtectionDomain().getCodeSource(),
perms));
+ classes.put(name, loggerFinderClass);
System.out.println("Loaded " + name);
return loggerFinderClass;
} catch (Throwable ex) {
@@ -78,61 +84,22 @@
}
}
}
-// private Class<?> defineLoggerImplClass(String name)
-// throws ClassNotFoundException {
-// final Object obj = getClassLoadingLock(name);
-// synchronized(obj) {
-// if (loggerImplClass != null) return loggerImplClass;
-//
-// URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
-// File file = new File(url.getPath(), name+".class");
-// if (file.canRead()) {
-// try {
-// byte[] b = Files.readAllBytes(file.toPath());
-// Permissions perms = new Permissions();
-// perms.add(new AllPermission());
-// loggerImplClass = defineClass(
-// name, b, 0, b.length, new ProtectionDomain(
-// this.getClass().getProtectionDomain().getCodeSource(),
-// perms));
-// System.out.println("Loaded " + name);
-// return loggerImplClass;
-// } catch (Throwable ex) {
-// ex.printStackTrace();
-// throw new ClassNotFoundException(name, ex);
-// }
-// } else {
-// throw new ClassNotFoundException(name,
-// new IOException(file.toPath() + ": can't read"));
-// }
-// }
-// }
-//
+
@Override
public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- if (name.endsWith("$LogProducerFinder")) {
+ if (name.equals("LogProducerFinder") || name.startsWith("LogProducerFinder$")) {
Class<?> c = defineFinderClass(name);
if (resolve) {
resolveClass(c);
}
return c;
}
-// if (name.endsWith("$LogProducerFinder$LoggerImpl")) {
-// Class<?> c = defineLoggerImplClass(name);
-// if (resolve) {
-// resolveClass(c);
-// }
-// return c;
-// }
return super.loadClass(name, resolve);
}
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
-// if (name.endsWith("$LogProducerFinder$LoggerImpl")) {
-// return defineLoggerImplClass(name);
-// }
- if (name.endsWith("$$LogProducerFinder")) {
+ if (name.equals("LogProducerFinder") || name.startsWith("LogProducerFinder$")) {
return defineFinderClass(name);
}
return super.findClass(name);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LogProducerFinder.java Wed Dec 19 20:53:30 2018 +0100
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.System.Logger;
+import java.lang.System.LoggerFinder;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class LogProducerFinder extends LoggerFinder {
+
+ public static final RuntimePermission LOGGERFINDER_PERMISSION =
+ new RuntimePermission("loggerFinder");
+ final ConcurrentHashMap<String, LoggerBridgeTest.LoggerImpl> system = new ConcurrentHashMap<>();
+ final ConcurrentHashMap<String, LoggerBridgeTest.LoggerImpl> user = new ConcurrentHashMap<>();
+
+ @Override
+ public Logger getLogger(String name, Module caller) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(LOGGERFINDER_PERMISSION);
+ }
+ PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
+ ClassLoader callerLoader = AccessController.doPrivileged(pa);
+ if (callerLoader == null) {
+ return system.computeIfAbsent(name, (n) -> new LoggerBridgeTest.LoggerImpl(n));
+ } else {
+ return user.computeIfAbsent(name, (n) -> new LoggerBridgeTest.LoggerImpl(n));
+ }
+ }
+}
+
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,13 +23,11 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessControlException;
-import java.security.AccessController;
import java.security.CodeSource;
import java.security.Permission;
import java.security.PermissionCollection;
import java.security.Permissions;
import java.security.Policy;
-import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
import java.util.Arrays;
import java.util.Collections;
@@ -48,7 +46,6 @@
import java.util.logging.LogRecord;
import java.lang.System.LoggerFinder;
import java.lang.System.Logger;
-import java.lang.System.Logger.Level;
import java.util.stream.Stream;
import sun.util.logging.PlatformLogger;
@@ -61,7 +58,7 @@
* @modules java.base/sun.util.logging
* java.base/jdk.internal.logger
* java.logging
- * @build CustomSystemClassLoader LoggerBridgeTest
+ * @build CustomSystemClassLoader LogProducerFinder LoggerBridgeTest
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest NOSECURITY
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest NOPERMISSIONS
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest WITHPERMISSIONS
@@ -231,204 +228,188 @@
static {
try {
// Preload classes before the security manager is on.
- providerClass = ClassLoader.getSystemClassLoader().loadClass("LoggerBridgeTest$LogProducerFinder");
+ providerClass = ClassLoader.getSystemClassLoader().loadClass("LogProducerFinder");
((LoggerFinder)providerClass.newInstance()).getLogger("foo", providerClass.getModule());
} catch (Exception ex) {
throw new ExceptionInInitializerError(ex);
}
}
- public static class LogProducerFinder extends LoggerFinder {
- final ConcurrentHashMap<String, LoggerImpl> system = new ConcurrentHashMap<>();
- final ConcurrentHashMap<String, LoggerImpl> user = new ConcurrentHashMap<>();
-
- public class LoggerImpl implements Logger, PlatformLogger.Bridge {
- private final String name;
- private sun.util.logging.PlatformLogger.Level level = sun.util.logging.PlatformLogger.Level.INFO;
- private sun.util.logging.PlatformLogger.Level OFF = sun.util.logging.PlatformLogger.Level.OFF;
- private sun.util.logging.PlatformLogger.Level FINE = sun.util.logging.PlatformLogger.Level.FINE;
- private sun.util.logging.PlatformLogger.Level FINER = sun.util.logging.PlatformLogger.Level.FINER;
- private sun.util.logging.PlatformLogger.Level FINEST = sun.util.logging.PlatformLogger.Level.FINEST;
- private sun.util.logging.PlatformLogger.Level CONFIG = sun.util.logging.PlatformLogger.Level.CONFIG;
- private sun.util.logging.PlatformLogger.Level INFO = sun.util.logging.PlatformLogger.Level.INFO;
- private sun.util.logging.PlatformLogger.Level WARNING = sun.util.logging.PlatformLogger.Level.WARNING;
- private sun.util.logging.PlatformLogger.Level SEVERE = sun.util.logging.PlatformLogger.Level.SEVERE;
-
- public LoggerImpl(String name) {
- this.name = name;
- }
+ public static class LoggerImpl implements System.Logger, PlatformLogger.Bridge {
+ private final String name;
+ private PlatformLogger.Level level = PlatformLogger.Level.INFO;
+ private PlatformLogger.Level OFF = PlatformLogger.Level.OFF;
+ private PlatformLogger.Level FINE = PlatformLogger.Level.FINE;
+ private PlatformLogger.Level FINER = PlatformLogger.Level.FINER;
+ private PlatformLogger.Level FINEST = PlatformLogger.Level.FINEST;
+ private PlatformLogger.Level CONFIG = PlatformLogger.Level.CONFIG;
+ private PlatformLogger.Level INFO = PlatformLogger.Level.INFO;
+ private PlatformLogger.Level WARNING = PlatformLogger.Level.WARNING;
+ private PlatformLogger.Level SEVERE = PlatformLogger.Level.SEVERE;
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public boolean isLoggable(Level level) {
- return this.level != OFF && this.level.intValue() <= level.getSeverity();
- }
-
- @Override
- public void log(Level level, ResourceBundle bundle,
- String key, Throwable thrown) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void log(Level level, ResourceBundle bundle,
- String format, Object... params) {
- throw new UnsupportedOperationException();
- }
+ public LoggerImpl(String name) {
+ this.name = name;
+ }
- void log(LogEvent event) {
- eventQueue.add(event);
- }
-
- @Override
- public void log(Level level, Supplier<String> msgSupplier) {
- throw new UnsupportedOperationException();
- }
+ public void configureLevel(PlatformLogger.Level level) {
+ this.level = level;
+ }
- @Override
- public void log(Level level, Supplier<String> msgSupplier,
- Throwable thrown) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void log(sun.util.logging.PlatformLogger.Level level, String msg) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, null, msg, null, (Object[])null));
- }
+ @Override
+ public String getName() {
+ return name;
+ }
- @Override
- public void log(sun.util.logging.PlatformLogger.Level level,
- Supplier<String> msgSupplier) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, null, msgSupplier, null, (Object[])null));
- }
+ @Override
+ public boolean isLoggable(Level level) {
+ return this.level != OFF && this.level.intValue() <= level.getSeverity();
+ }
- @Override
- public void log(sun.util.logging.PlatformLogger.Level level, String msg,
- Object... params) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, null, msg, null, params));
- }
-
- @Override
- public void log(sun.util.logging.PlatformLogger.Level level, String msg,
- Throwable thrown) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, null, msg, thrown, (Object[])null));
- }
+ @Override
+ public void log(Level level, ResourceBundle bundle,
+ String key, Throwable thrown) {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public void log(sun.util.logging.PlatformLogger.Level level, Throwable thrown,
- Supplier<String> msgSupplier) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, null, msgSupplier, thrown, (Object[])null));
- }
+ @Override
+ public void log(Level level, ResourceBundle bundle,
+ String format, Object... params) {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, String msg) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, null, msg, null, (Object[])null));
- }
+ void log(LogEvent event) {
+ eventQueue.add(event);
+ }
- @Override
- public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, Supplier<String> msgSupplier) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, null, msgSupplier, null, (Object[])null));
- }
+ @Override
+ public void log(Level level, Supplier<String> msgSupplier) {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, String msg, Object... params) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, null, msg, null, params));
- }
-
- @Override
- public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, String msg, Throwable thrown) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, null, msg, thrown, (Object[])null));
- }
+ @Override
+ public void log(Level level, Supplier<String> msgSupplier,
+ Throwable thrown) {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, Throwable thrown,
- Supplier<String> msgSupplier) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, null, msgSupplier, thrown, (Object[])null));
- }
+ @Override
+ public void log(PlatformLogger.Level level, String msg) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, null, msg, null, (Object[]) null));
+ }
- @Override
- public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, ResourceBundle bundle, String msg,
- Object... params) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, bundle, msg, null, params));
- }
-
- @Override
- public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
- String msg, Object... params) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, bundle, msg, null, params));
- }
+ @Override
+ public void log(PlatformLogger.Level level,
+ Supplier<String> msgSupplier) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, null, msgSupplier, null, (Object[]) null));
+ }
- @Override
- public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, ResourceBundle bundle, String msg,
- Throwable thrown) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, bundle, msg, thrown, (Object[])null));
- }
+ @Override
+ public void log(PlatformLogger.Level level, String msg,
+ Object... params) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, null, msg, null, params));
+ }
- @Override
- public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
- String msg, Throwable thrown) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, bundle, msg, thrown, (Object[])null));
- }
-
- @Override
- public boolean isLoggable(sun.util.logging.PlatformLogger.Level level) {
- return this.level != OFF && level.intValue()
- >= this.level.intValue();
- }
-
- @Override
- public boolean isEnabled() {
- return this.level != OFF;
- }
-
+ @Override
+ public void log(PlatformLogger.Level level, String msg,
+ Throwable thrown) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, null, msg, thrown, (Object[]) null));
}
@Override
- public Logger getLogger(String name, Module caller) {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(LOGGERFINDER_PERMISSION);
- }
- PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
- ClassLoader callerLoader = AccessController.doPrivileged(pa);
- if (callerLoader == null) {
- return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
- } else {
- return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
- }
+ public void log(PlatformLogger.Level level, Throwable thrown,
+ Supplier<String> msgSupplier) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, null, msgSupplier, thrown, (Object[]) null));
+ }
+
+ @Override
+ public void logp(PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, String msg) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, null, msg, null, (Object[]) null));
+ }
+
+ @Override
+ public void logp(PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, Supplier<String> msgSupplier) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, null, msgSupplier, null, (Object[]) null));
+ }
+
+ @Override
+ public void logp(PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, String msg, Object... params) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, null, msg, null, params));
+ }
+
+ @Override
+ public void logp(PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, String msg, Throwable thrown) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, null, msg, thrown, (Object[]) null));
}
+
+ @Override
+ public void logp(PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, Throwable thrown,
+ Supplier<String> msgSupplier) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, null, msgSupplier, thrown, (Object[]) null));
+ }
+
+ @Override
+ public void logrb(PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, ResourceBundle bundle, String msg,
+ Object... params) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, bundle, msg, null, params));
+ }
+
+ @Override
+ public void logrb(PlatformLogger.Level level, ResourceBundle bundle,
+ String msg, Object... params) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, bundle, msg, null, params));
+ }
+
+ @Override
+ public void logrb(PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, ResourceBundle bundle, String msg,
+ Throwable thrown) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, bundle, msg, thrown, (Object[]) null));
+ }
+
+ @Override
+ public void logrb(PlatformLogger.Level level, ResourceBundle bundle,
+ String msg, Throwable thrown) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, bundle, msg, thrown, (Object[]) null));
+ }
+
+ @Override
+ public boolean isLoggable(PlatformLogger.Level level) {
+ return this.level != OFF && level.intValue()
+ >= this.level.intValue();
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return this.level != OFF;
+ }
+
}
static ClassLoader getClassLoader(Module m) {
@@ -675,14 +656,14 @@
}
- final LogProducerFinder.LoggerImpl appSink;
- final LogProducerFinder.LoggerImpl sysSink;
+ final LoggerImpl appSink;
+ final LoggerImpl sysSink;
boolean old = allowControl.get().get();
allowControl.get().set(true);
try {
- appSink = LogProducerFinder.LoggerImpl.class.cast(
+ appSink = LoggerImpl.class.cast(
provider.getLogger("foo", LoggerBridgeTest.class.getModule()));
- sysSink = LogProducerFinder.LoggerImpl.class.cast(
+ sysSink = LoggerImpl.class.cast(
provider.getLogger("foo", Thread.class.getModule()));
} finally {
allowControl.get().set(old);
@@ -739,20 +720,20 @@
}
}
- static void setLevel( LogProducerFinder.LoggerImpl sink,
+ static void setLevel(LoggerImpl sink,
sun.util.logging.PlatformLogger.Level loggerLevel) {
- sink.level = loggerLevel;
+ sink.configureLevel(loggerLevel);
}
- // Calls the methods defined on LogProducer and verify the
- // parameters received by the underlying LogProducerFinder.LoggerImpl
+ // Calls the methods defined on PlatformLogger.Bridge and verify the
+ // parameters received by the underlying LoggerImpl
// logger.
private static void testLogger(LoggerFinder provider,
Map<Object, String> loggerDescMap,
String name,
ResourceBundle loggerBundle,
PlatformLogger.Bridge logger,
- LogProducerFinder.LoggerImpl sink) {
+ LoggerImpl sink) {
System.out.println("Testing " + loggerDescMap.get(logger) + "[" + logger + "]");
final sun.util.logging.PlatformLogger.Level OFF = sun.util.logging.PlatformLogger.Level.OFF;
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 20:53:30 2018 +0100
@@ -1,1 +1,1 @@
-LoggerBridgeTest$LogProducerFinder
+LogProducerFinder
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/BaseLoggerFinder.java Wed Dec 19 20:53:30 2018 +0100
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.internal.logger.SimpleConsoleLogger;
+
+import java.lang.System.Logger;
+import java.lang.System.LoggerFinder;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+public class BaseLoggerFinder extends LoggerFinder
+ implements LoggerFinderLoaderTest.TestLoggerFinder {
+
+ static final RuntimePermission LOGGERFINDER_PERMISSION =
+ new RuntimePermission("loggerFinder");
+
+ public BaseLoggerFinder() {
+ if (fails.get()) {
+ throw new RuntimeException("Simulate exception while loading provider");
+ }
+ }
+
+ Logger createSimpleLogger(String name) {
+ PrivilegedAction<Logger> pa = () -> SimpleConsoleLogger.makeSimpleLogger(name);
+ return AccessController.doPrivileged(pa);
+ }
+
+ @Override
+ public Logger getLogger(String name, Module caller) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(LOGGERFINDER_PERMISSION);
+ }
+ PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
+ ClassLoader callerLoader = AccessController.doPrivileged(pa);
+ if (callerLoader == null) {
+ return system.computeIfAbsent(name, (n) -> new LoggerImpl(n, createSimpleLogger(name)));
+ } else {
+ return user.computeIfAbsent(name, (n) -> new LoggerImpl(n, createSimpleLogger(name)));
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/BaseLoggerFinder2.java Wed Dec 19 20:53:30 2018 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.System.Logger;
+import java.lang.System.LoggerFinder;
+import java.util.ServiceConfigurationError;
+
+public class BaseLoggerFinder2 extends LoggerFinder
+ implements LoggerFinderLoaderTest.TestLoggerFinder {
+
+ public BaseLoggerFinder2() {
+ throw new ServiceConfigurationError("Should not come here");
+ }
+
+ @Override
+ public Logger getLogger(String name, Module caller) {
+ throw new ServiceConfigurationError("Should not come here");
+ }
+}
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/CustomSystemClassLoader.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/CustomSystemClassLoader.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
@@ -48,9 +49,8 @@
final List<String> finderClassNames =
- Arrays.asList("LoggerFinderLoaderTest$BaseLoggerFinder",
- "LoggerFinderLoaderTest$BaseLoggerFinder2");
- final Map<String, Class<?>> finderClasses = new HashMap<>();
+ Arrays.asList("BaseLoggerFinder", "BaseLoggerFinder2");
+ final Map<String, Class<?>> finderClasses = new ConcurrentHashMap<>();
Class<?> testLoggerFinderClass;
public CustomSystemClassLoader() {
@@ -62,9 +62,13 @@
private Class<?> defineFinderClass(String name)
throws ClassNotFoundException {
+ Class<?> finderClass = finderClasses.get(name);
+ if (finderClass != null) return finderClass;
+
final Object obj = getClassLoadingLock(name);
synchronized(obj) {
- if (finderClasses.get(name) != null) return finderClasses.get(name);
+ finderClass = finderClasses.get(name);
+ if (finderClass != null) return finderClass;
if (testLoggerFinderClass == null) {
// Hack: we load testLoggerFinderClass to get its code source.
// we can't use this.getClass() since we are in the boot.
@@ -77,7 +81,7 @@
byte[] b = Files.readAllBytes(file.toPath());
Permissions perms = new Permissions();
perms.add(new AllPermission());
- Class<?> finderClass = defineClass(
+ finderClass = defineClass(
name, b, 0, b.length, new ProtectionDomain(
this.getClass().getProtectionDomain().getCodeSource(),
perms));
@@ -95,9 +99,13 @@
}
}
+ private static boolean matches(String prefix, String name) {
+ return prefix.equals(name) || name.startsWith(prefix + "$");
+ }
+
@Override
public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- if (finderClassNames.contains(name)) {
+ if (finderClassNames.stream().anyMatch(n -> matches(n, name))) {
Class<?> c = defineFinderClass(name);
if (resolve) {
resolveClass(c);
@@ -109,7 +117,7 @@
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
- if (finderClassNames.contains(name)) {
+ if (finderClassNames.stream().anyMatch(n -> matches(n, name))) {
return defineFinderClass(name);
}
return super.findClass(name);
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,7 @@
* DefaultLoggerFinder and SimpleConsoleLogger implementation.
* @modules java.base/sun.util.logging
* java.base/jdk.internal.logger
- * @build AccessSystemLogger LoggerFinderLoaderTest CustomSystemClassLoader
+ * @build AccessSystemLogger LoggerFinderLoaderTest CustomSystemClassLoader BaseLoggerFinder BaseLoggerFinder2
* @run driver AccessSystemLogger
* @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader LoggerFinderLoaderTest NOSECURITY
* @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader LoggerFinderLoaderTest NOPERMISSIONS
@@ -118,8 +118,8 @@
static {
try {
providerClass = new Class<?>[] {
- ClassLoader.getSystemClassLoader().loadClass("LoggerFinderLoaderTest$BaseLoggerFinder"),
- ClassLoader.getSystemClassLoader().loadClass("LoggerFinderLoaderTest$BaseLoggerFinder2")
+ ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder"),
+ ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder2")
};
} catch (ClassNotFoundException ex) {
throw new ExceptionInInitializerError(ex);
@@ -171,51 +171,6 @@
public Logger getLocalizedLogger(String name, ResourceBundle bundle, Module caller);
}
- public static class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
-
- static final RuntimePermission LOGGERFINDER_PERMISSION =
- new RuntimePermission("loggerFinder");
- public BaseLoggerFinder() {
- if (fails.get()) {
- throw new RuntimeException("Simulate exception while loading provider");
- }
- }
-
- System.Logger createSimpleLogger(String name) {
- PrivilegedAction<System.Logger> pa = () -> SimpleConsoleLogger.makeSimpleLogger(name);
- return AccessController.doPrivileged(pa);
- }
-
-
- @Override
- public Logger getLogger(String name, Module caller) {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(LOGGERFINDER_PERMISSION);
- }
- PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
- ClassLoader callerLoader = AccessController.doPrivileged(pa);
- if (callerLoader == null) {
- return system.computeIfAbsent(name, (n) -> new LoggerImpl(n, createSimpleLogger(name)));
- } else {
- return user.computeIfAbsent(name, (n) -> new LoggerImpl(n, createSimpleLogger(name)));
- }
- }
- }
-
- public static class BaseLoggerFinder2 extends LoggerFinder implements TestLoggerFinder {
-
- static final RuntimePermission LOGGERFINDER_PERMISSION =
- new RuntimePermission("loggerFinder");
- public BaseLoggerFinder2() {
- throw new ServiceConfigurationError("Should not come here");
- }
- @Override
- public Logger getLogger(String name, Module caller) {
- throw new ServiceConfigurationError("Should not come here");
- }
- }
-
public static class MyBundle extends ResourceBundle {
final ConcurrentHashMap<String,String> map = new ConcurrentHashMap<>();
@@ -270,7 +225,7 @@
throw new RuntimeException("Expected message not found. Error stream contained: " + warning);
}
if (TestLoggerFinder.fails.get()) {
- if (!warning.contains("java.util.ServiceConfigurationError: java.lang.System$LoggerFinder: Provider LoggerFinderLoaderTest$BaseLoggerFinder could not be instantiated")) {
+ if (!warning.contains("java.util.ServiceConfigurationError: java.lang.System$LoggerFinder: Provider BaseLoggerFinder could not be instantiated")) {
throw new RuntimeException("Expected message not found. Error stream contained: " + warning);
}
} else if (singleton) {
@@ -425,7 +380,7 @@
ServiceLoader.load(LoggerFinder.class, ClassLoader.getSystemClassLoader());
Iterator<LoggerFinder> iterator = serviceLoader.iterator();
Object firstProvider = iterator.next();
- if (!firstProvider.getClass().getName().equals("LoggerFinderLoaderTest$BaseLoggerFinder")) {
+ if (!firstProvider.getClass().getName().equals("BaseLoggerFinder")) {
throw new RuntimeException("Unexpected provider: " + firstProvider.getClass().getName());
}
if (!iterator.hasNext()) {
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 20:53:30 2018 +0100
@@ -1,3 +1,3 @@
-LoggerFinderLoaderTest$BaseLoggerFinder
-LoggerFinderLoaderTest$BaseLoggerFinder2
+BaseLoggerFinder
+BaseLoggerFinder2
--- a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/CustomSystemClassLoader.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/CustomSystemClassLoader.java Wed Dec 19 20:53:30 2018 +0100
@@ -28,6 +28,8 @@
import java.security.AllPermission;
import java.security.Permissions;
import java.security.ProtectionDomain;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
@@ -39,7 +41,7 @@
public class CustomSystemClassLoader extends ClassLoader {
- Class<?> loggerFinderClass = null;
+ final ConcurrentHashMap<String, Class<?>> classes = new ConcurrentHashMap<>();
public CustomSystemClassLoader() {
super();
@@ -50,8 +52,11 @@
private Class<?> defineFinderClass(String name)
throws ClassNotFoundException {
+ Class<?> loggerFinderClass = classes.get(name);
+ if (loggerFinderClass != null) return loggerFinderClass;
final Object obj = getClassLoadingLock(name);
synchronized(obj) {
+ loggerFinderClass = classes.get(name);
if (loggerFinderClass != null) return loggerFinderClass;
URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
@@ -66,6 +71,7 @@
this.getClass().getProtectionDomain().getCodeSource(),
perms));
System.out.println("Loaded " + name);
+ classes.put(name, loggerFinderClass);
return loggerFinderClass;
} catch (Throwable ex) {
ex.printStackTrace();
@@ -80,7 +86,7 @@
@Override
public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- if (name.endsWith("$LogProducerFinder")) {
+ if (name.equals("LogProducerFinder") || name.startsWith("LogProducerFinder$")) {
Class<?> c = defineFinderClass(name);
if (resolve) {
resolveClass(c);
@@ -92,7 +98,7 @@
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
- if (name.endsWith("$$LogProducerFinder")) {
+ if (name.equals("LogProducerFinder") || name.startsWith("LogProducerFinder$")) {
return defineFinderClass(name);
}
return super.findClass(name);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/LogProducerFinder.java Wed Dec 19 20:53:30 2018 +0100
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Queue;
+import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Supplier;
+import java.lang.System.LoggerFinder;
+import java.lang.System.Logger;
+
+public class LogProducerFinder extends LoggerFinder {
+
+ static final RuntimePermission LOGGERFINDER_PERMISSION =
+ new RuntimePermission("loggerFinder");
+ final ConcurrentHashMap<String, PlatformLoggerBridgeTest.LoggerImpl>
+ system = new ConcurrentHashMap<>();
+ final ConcurrentHashMap<String, PlatformLoggerBridgeTest.LoggerImpl>
+ user = new ConcurrentHashMap<>();
+
+ private static PlatformLoggerBridgeTest.LoggerImpl newLoggerImpl(String name) {
+ return new PlatformLoggerBridgeTest.LoggerImpl(name);
+ }
+
+ @Override
+ public Logger getLogger(String name, Module caller) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(LOGGERFINDER_PERMISSION);
+ }
+ PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
+ ClassLoader callerLoader = AccessController.doPrivileged(pa);
+ if (callerLoader == null) {
+ return system.computeIfAbsent(name, (n) -> newLoggerImpl(n));
+ } else {
+ return user.computeIfAbsent(name, (n) -> newLoggerImpl(n));
+ }
+ }
+}
--- a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder Wed Dec 19 20:53:30 2018 +0100
@@ -1,1 +1,1 @@
-PlatformLoggerBridgeTest$LogProducerFinder
+LogProducerFinder
--- a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@
* backend whose loggers implement PlatformLogger.Bridge.
* @modules java.base/sun.util.logging
* java.logging
- * @build CustomSystemClassLoader PlatformLoggerBridgeTest
+ * @build CustomSystemClassLoader LogProducerFinder PlatformLoggerBridgeTest
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest NOSECURITY
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest NOPERMISSIONS
* @run main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest WITHPERMISSIONS
@@ -89,19 +89,19 @@
}
};
+ public static final Queue<LogEvent> eventQueue = new ArrayBlockingQueue<>(128);
+
static final Class<?> providerClass;
static {
try {
// Preload classes before the security manager is on.
- providerClass = ClassLoader.getSystemClassLoader().loadClass("PlatformLoggerBridgeTest$LogProducerFinder");
+ providerClass = ClassLoader.getSystemClassLoader().loadClass("LogProducerFinder");
((LoggerFinder)providerClass.newInstance()).getLogger("foo", providerClass.getModule());
} catch (Exception ex) {
throw new ExceptionInInitializerError(ex);
}
}
- public static final Queue<LogEvent> eventQueue = new ArrayBlockingQueue<>(128);
-
public static final class LogEvent implements Cloneable {
public LogEvent() {
@@ -234,200 +234,182 @@
}
- public static class LogProducerFinder extends LoggerFinder {
- static final RuntimePermission LOGGERFINDER_PERMISSION =
- new RuntimePermission("loggerFinder");
- final ConcurrentHashMap<String, LoggerImpl> system = new ConcurrentHashMap<>();
- final ConcurrentHashMap<String, LoggerImpl> user = new ConcurrentHashMap<>();
-
- public class LoggerImpl implements Logger, PlatformLogger.Bridge {
- private final String name;
- private sun.util.logging.PlatformLogger.Level level = sun.util.logging.PlatformLogger.Level.INFO;
- private sun.util.logging.PlatformLogger.Level OFF = sun.util.logging.PlatformLogger.Level.OFF;
- private sun.util.logging.PlatformLogger.Level FINE = sun.util.logging.PlatformLogger.Level.FINE;
- private sun.util.logging.PlatformLogger.Level FINER = sun.util.logging.PlatformLogger.Level.FINER;
- private sun.util.logging.PlatformLogger.Level FINEST = sun.util.logging.PlatformLogger.Level.FINEST;
- private sun.util.logging.PlatformLogger.Level CONFIG = sun.util.logging.PlatformLogger.Level.CONFIG;
- private sun.util.logging.PlatformLogger.Level INFO = sun.util.logging.PlatformLogger.Level.INFO;
- private sun.util.logging.PlatformLogger.Level WARNING = sun.util.logging.PlatformLogger.Level.WARNING;
- private sun.util.logging.PlatformLogger.Level SEVERE = sun.util.logging.PlatformLogger.Level.SEVERE;
+ public static class LoggerImpl implements System.Logger, PlatformLogger.Bridge {
+ private final String name;
+ private sun.util.logging.PlatformLogger.Level level = sun.util.logging.PlatformLogger.Level.INFO;
+ private sun.util.logging.PlatformLogger.Level OFF = sun.util.logging.PlatformLogger.Level.OFF;
+ private sun.util.logging.PlatformLogger.Level FINE = sun.util.logging.PlatformLogger.Level.FINE;
+ private sun.util.logging.PlatformLogger.Level FINER = sun.util.logging.PlatformLogger.Level.FINER;
+ private sun.util.logging.PlatformLogger.Level FINEST = sun.util.logging.PlatformLogger.Level.FINEST;
+ private sun.util.logging.PlatformLogger.Level CONFIG = sun.util.logging.PlatformLogger.Level.CONFIG;
+ private sun.util.logging.PlatformLogger.Level INFO = sun.util.logging.PlatformLogger.Level.INFO;
+ private sun.util.logging.PlatformLogger.Level WARNING = sun.util.logging.PlatformLogger.Level.WARNING;
+ private sun.util.logging.PlatformLogger.Level SEVERE = sun.util.logging.PlatformLogger.Level.SEVERE;
- public LoggerImpl(String name) {
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public boolean isLoggable(Level level) {
- return this.level != OFF && this.level.intValue() <= level.getSeverity();
- }
-
- @Override
- public void log(Level level, ResourceBundle bundle,
- String key, Throwable thrown) {
- throw new UnsupportedOperationException();
- }
+ public LoggerImpl(String name) {
+ this.name = name;
+ }
- @Override
- public void log(Level level, ResourceBundle bundle,
- String format, Object... params) {
- throw new UnsupportedOperationException();
- }
-
- void log(LogEvent event) {
- eventQueue.add(event);
- }
+ public void configureLevel(sun.util.logging.PlatformLogger.Level level) {
+ this.level = level;
+ }
- @Override
- public void log(Level level, Supplier<String> msgSupplier) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void log(Level level, Supplier<String> msgSupplier,
- Throwable thrown) {
- throw new UnsupportedOperationException();
- }
+ @Override
+ public String getName() {
+ return name;
+ }
- @Override
- public void log(sun.util.logging.PlatformLogger.Level level, String msg) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, null, msg, null, (Object[])null));
- }
-
- @Override
- public void log(sun.util.logging.PlatformLogger.Level level,
- Supplier<String> msgSupplier) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, null, msgSupplier, null, (Object[])null));
- }
+ @Override
+ public boolean isLoggable(Level level) {
+ return this.level != OFF && this.level.intValue() <= level.getSeverity();
+ }
- @Override
- public void log(sun.util.logging.PlatformLogger.Level level, String msg,
- Object... params) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, null, msg, null, params));
- }
-
- @Override
- public void log(sun.util.logging.PlatformLogger.Level level, String msg,
- Throwable thrown) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, null, msg, thrown, (Object[])null));
- }
+ @Override
+ public void log(Level level, ResourceBundle bundle,
+ String key, Throwable thrown) {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public void log(sun.util.logging.PlatformLogger.Level level, Throwable thrown,
- Supplier<String> msgSupplier) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, null, msgSupplier, thrown, (Object[])null));
- }
+ @Override
+ public void log(Level level, ResourceBundle bundle,
+ String format, Object... params) {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, String msg) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, null, msg, null, (Object[])null));
- }
+ void log(PlatformLoggerBridgeTest.LogEvent event) {
+ eventQueue.add(event);
+ }
- @Override
- public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, Supplier<String> msgSupplier) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, null, msgSupplier, null, (Object[])null));
- }
+ @Override
+ public void log(Level level, Supplier<String> msgSupplier) {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, String msg, Object... params) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, null, msg, null, params));
- }
-
- @Override
- public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, String msg, Throwable thrown) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, null, msg, thrown, (Object[])null));
- }
+ @Override
+ public void log(Level level, Supplier<String> msgSupplier,
+ Throwable thrown) {
+ throw new UnsupportedOperationException();
+ }
- @Override
- public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, Throwable thrown,
- Supplier<String> msgSupplier) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, null, msgSupplier, thrown, (Object[])null));
- }
+ @Override
+ public void log(sun.util.logging.PlatformLogger.Level level, String msg) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, null, msg, null, (Object[]) null));
+ }
- @Override
- public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, ResourceBundle bundle, String msg,
- Object... params) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, bundle, msg, null, params));
- }
-
- @Override
- public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
- String msg, Object... params) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, bundle, msg, null, params));
- }
+ @Override
+ public void log(sun.util.logging.PlatformLogger.Level level,
+ Supplier<String> msgSupplier) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, null, msgSupplier, null, (Object[]) null));
+ }
- @Override
- public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
- String sourceMethod, ResourceBundle bundle, String msg,
- Throwable thrown) {
- log(LogEvent.of(isLoggable(level), name,
- sourceClass, sourceMethod,
- level, bundle, msg, thrown, (Object[])null));
- }
+ @Override
+ public void log(sun.util.logging.PlatformLogger.Level level, String msg,
+ Object... params) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, null, msg, null, params));
+ }
- @Override
- public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
- String msg, Throwable thrown) {
- log(LogEvent.of(isLoggable(level), name, null, null,
- level, bundle, msg, thrown, (Object[])null));
- }
-
- @Override
- public boolean isLoggable(sun.util.logging.PlatformLogger.Level level) {
- return this.level != OFF && level.intValue()
- >= this.level.intValue();
- }
-
- @Override
- public boolean isEnabled() {
- return this.level != OFF;
- }
-
-
+ @Override
+ public void log(sun.util.logging.PlatformLogger.Level level, String msg,
+ Throwable thrown) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, null, msg, thrown, (Object[]) null));
}
@Override
- public Logger getLogger(String name, Module caller) {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(LOGGERFINDER_PERMISSION);
- }
- PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
- ClassLoader callerLoader = AccessController.doPrivileged(pa);
- if (callerLoader == null) {
- return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
- } else {
- return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
- }
+ public void log(sun.util.logging.PlatformLogger.Level level, Throwable thrown,
+ Supplier<String> msgSupplier) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, null, msgSupplier, thrown, (Object[]) null));
+ }
+
+ @Override
+ public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, String msg) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, null, msg, null, (Object[]) null));
+ }
+
+ @Override
+ public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, Supplier<String> msgSupplier) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, null, msgSupplier, null, (Object[]) null));
+ }
+
+ @Override
+ public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, String msg, Object... params) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, null, msg, null, params));
+ }
+
+ @Override
+ public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, String msg, Throwable thrown) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, null, msg, thrown, (Object[]) null));
+ }
+
+ @Override
+ public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, Throwable thrown,
+ Supplier<String> msgSupplier) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, null, msgSupplier, thrown, (Object[]) null));
}
+
+ @Override
+ public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, ResourceBundle bundle, String msg,
+ Object... params) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, bundle, msg, null, params));
+ }
+
+ @Override
+ public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
+ String msg, Object... params) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, bundle, msg, null, params));
+ }
+
+ @Override
+ public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+ String sourceMethod, ResourceBundle bundle, String msg,
+ Throwable thrown) {
+ log(LogEvent.of(isLoggable(level), name,
+ sourceClass, sourceMethod,
+ level, bundle, msg, thrown, (Object[]) null));
+ }
+
+ @Override
+ public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
+ String msg, Throwable thrown) {
+ log(LogEvent.of(isLoggable(level), name, null, null,
+ level, bundle, msg, thrown, (Object[]) null));
+ }
+
+ @Override
+ public boolean isLoggable(sun.util.logging.PlatformLogger.Level level) {
+ return this.level != OFF && level.intValue()
+ >= this.level.intValue();
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return this.level != OFF;
+ }
+
+
}
static final sun.util.logging.PlatformLogger.Level[] julLevels = {
@@ -593,11 +575,11 @@
System.out.println("Got expected exception for system logger: " + acx);
}
- final LogProducerFinder.LoggerImpl sysSink;
+ final LoggerImpl sysSink;
boolean old = allowControl.get().get();
allowControl.get().set(true);
try {
- sysSink = LogProducerFinder.LoggerImpl.class.cast(
+ sysSink = LoggerImpl.class.cast(
provider.getLogger("foo", Thread.class.getModule()));
} finally {
allowControl.get().set(old);
@@ -647,20 +629,20 @@
}
}
- static void setLevel( LogProducerFinder.LoggerImpl sink,
+ static void setLevel(LoggerImpl sink,
sun.util.logging.PlatformLogger.Level loggerLevel) {
- sink.level = loggerLevel;
+ sink.configureLevel(loggerLevel);
}
// Calls the methods defined on LogProducer and verify the
- // parameters received by the underlying LogProducerFinder.LoggerImpl
+ // parameters received by the underlying LoggerImpl
// logger.
private static void testLogger(LoggerFinder provider,
Map<PlatformLogger, String> loggerDescMap,
String name,
ResourceBundle loggerBundle,
PlatformLogger logger,
- LogProducerFinder.LoggerImpl sink) {
+ LoggerImpl sink) {
System.out.println("Testing " + loggerDescMap.get(logger) + " [" + logger +"]");
final sun.util.logging.PlatformLogger.Level OFF = sun.util.logging.PlatformLogger.Level.OFF;
--- a/test/jdk/java/lang/module/ClassFileVersionsTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/lang/module/ClassFileVersionsTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -56,6 +56,7 @@
{ 54, 0, Set.of() }, // JDK 10
{ 55, 0, Set.of() }, // JDK 11
{ 56, 0, Set.of() }, // JDK 12
+ { 57, 0, Set.of() }, // JDK 13
};
}
@@ -79,7 +80,11 @@
{ 56, 0, Set.of(TRANSITIVE) },
{ 56, 0, Set.of(STATIC, TRANSITIVE) },
- { 57, 0, Set.of()}, // JDK 13
+ { 57, 0, Set.of(STATIC) }, // JDK 13
+ { 57, 0, Set.of(TRANSITIVE) },
+ { 57, 0, Set.of(STATIC, TRANSITIVE) },
+
+ { 58, 0, Set.of()}, // JDK 14
};
}
--- a/test/jdk/java/net/URL/RacyHandler.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/net/URL/RacyHandler.java Wed Dec 19 20:53:30 2018 +0100
@@ -32,6 +32,7 @@
* @test
* @bug 8213942
* @summary URLStreamHandler initialization race
+ * @modules java.base/java.net:open
* @run main/othervm RacyHandler
* @run main/othervm RacyHandler
* @run main/othervm RacyHandler
@@ -110,4 +111,4 @@
return null;
}
}
-}
\ No newline at end of file
+}
--- a/test/jdk/java/nio/file/DirectoryStream/Basic.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/nio/file/DirectoryStream/Basic.java Wed Dec 19 20:53:30 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -73,14 +73,18 @@
private PathMatcher matcher =
dir.getFileSystem().getPathMatcher("glob:f*");
public boolean accept(Path file) {
- return matcher.matches(file);
+ return matcher.matches(file.getFileName());
}
};
+
+ found = false;
try (DirectoryStream<Path> ds = newDirectoryStream(dir, filter)) {
for (Path entry: ds) {
- if (!entry.getFileName().equals(foo))
- throw new RuntimeException("entry not expected");
+ if (entry.getFileName().equals(foo))
+ found = true;
}
+ if (!found)
+ throw new RuntimeException(String.format("Error: entry: %s was not found", foo));
}
// check filtering: z* should not match any files
@@ -88,7 +92,7 @@
private PathMatcher matcher =
dir.getFileSystem().getPathMatcher("glob:z*");
public boolean accept(Path file) {
- return matcher.matches(file);
+ return matcher.matches(file.getFileName());
}
};
try (DirectoryStream<Path> ds = newDirectoryStream(dir, filter)) {
--- a/test/jdk/java/util/Locale/LocaleProvidersRun.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/util/Locale/LocaleProvidersRun.java Wed Dec 19 20:53:30 2018 +0100
@@ -156,6 +156,7 @@
launcher.addToolArg("-cp")
.addToolArg(Utils.TEST_CLASS_PATH)
.addToolArg("-Djava.locale.providers=" + prefList)
+ .addToolArg("--add-exports=java.base/sun.util.locale.provider=ALL-UNNAMED")
.addToolArg("LocaleProviders")
.addToolArg(methodName)
.addToolArg(param1)
--- a/test/jdk/java/util/zip/zip.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/jdk/java/util/zip/zip.java Wed Dec 19 20:53:30 2018 +0100
@@ -23,9 +23,14 @@
import java.io.*;
import java.nio.charset.Charset;
+import java.text.MessageFormat;
import java.util.*;
-import java.util.zip.*;
-import java.text.MessageFormat;
+import java.util.zip.CRC32;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
/**
* A stripped-down version of Jar tool with a "-encoding" option to
@@ -39,9 +44,9 @@
String[] files;
Charset cs = Charset.forName("UTF-8");
- Map<String, File> entryMap = new HashMap<String, File>();
- Set<File> entries = new LinkedHashSet<File>();
- List<String> paths = new ArrayList<String>();
+ Map<String, File> entryMap = new HashMap<>();
+ Set<File> entries = new LinkedHashSet<>();
+ List<String> paths = new ArrayList<>();
CRC32 crc32 = new CRC32();
/*
@@ -330,15 +335,13 @@
}
}
- boolean update(InputStream in, OutputStream out) throws IOException
- {
+ boolean update(InputStream in, OutputStream out) throws IOException {
try (ZipInputStream zis = new ZipInputStream(in, cs);
ZipOutputStream zos = new ZipOutputStream(out, cs))
{
ZipEntry e = null;
byte[] buf = new byte[1024];
int n = 0;
- boolean updateOk = true;
// put the old entries first, replace if necessary
while ((e = zis.getNextEntry()) != null) {
@@ -367,11 +370,11 @@
}
// add the remaining new files
- for (File f: entries) {
+ for (File f : entries) {
addFile(zos, f);
}
}
- return updateOk;
+ return true;
}
private String entryName(String name) {
@@ -479,6 +482,8 @@
Set<ZipEntry> newDirSet() {
return new HashSet<ZipEntry>() {
+ private static final long serialVersionUID = 4547977575248028254L;
+
public boolean add(ZipEntry e) {
return (e == null || super.add(e));
}};
@@ -520,7 +525,6 @@
Enumeration<? extends ZipEntry> zes = zf.entries();
while (zes.hasMoreElements()) {
ZipEntry e = zes.nextElement();
- InputStream is;
if (files == null) {
dirs.add(extractFile(zf.getInputStream(e), e));
} else {
@@ -533,8 +537,8 @@
}
}
}
+ updateLastModifiedTime(dirs);
}
- updateLastModifiedTime(dirs);
}
ZipEntry extractFile(InputStream is, ZipEntry e) throws IOException {
@@ -727,7 +731,7 @@
st.commentChar('#');
st.quoteChar('"');
st.quoteChar('\'');
- while (st.nextToken() != st.TT_EOF) {
+ while (st.nextToken() != StreamTokenizer.TT_EOF) {
args.add(st.sval);
}
r.close();
@@ -738,4 +742,3 @@
System.exit(z.run(args) ? 0 : 1);
}
}
-
--- a/test/langtools/TEST.ROOT Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/TEST.ROOT Wed Dec 19 20:53:30 2018 +0100
@@ -15,7 +15,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b12
+requiredVersion=4.2 b13
# Use new module options
useNewOptions=true
--- a/test/langtools/tools/javac/6330997/T6330997.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/6330997/T6330997.java Wed Dec 19 20:53:30 2018 +0100
@@ -32,8 +32,8 @@
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.util
* @clean T1 T2
- * @compile -source 11 -target 12 T1.java
- * @compile -source 11 -target 12 T2.java
+ * @compile -source 12 -target 13 T1.java
+ * @compile -source 12 -target 13 T2.java
* @run main/othervm T6330997
*/
--- a/test/langtools/tools/javac/ConditionalWithVoid.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/ConditionalWithVoid.java Wed Dec 19 20:53:30 2018 +0100
@@ -4,7 +4,7 @@
* @summary The compiler was allowing void types in its parsing of conditional expressions.
* @author tball
*
- * @compile/fail/ref=ConditionalWithVoid.out --enable-preview -source 12 -XDrawDiagnostics ConditionalWithVoid.java
+ * @compile/fail/ref=ConditionalWithVoid.out --enable-preview -source 13 -XDrawDiagnostics ConditionalWithVoid.java
*/
public class ConditionalWithVoid {
public void test(Object o, String s) {
--- a/test/langtools/tools/javac/RawStringLiteralLang.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/RawStringLiteralLang.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
/*
* @test
* @summary Unit tests for Raw String Literal language changes
- * @compile --enable-preview -source 12 -encoding utf8 RawStringLiteralLang.java
+ * @compile --enable-preview -source 13 -encoding utf8 RawStringLiteralLang.java
* @run main/othervm --enable-preview RawStringLiteralLang
*/
--- a/test/langtools/tools/javac/RawStringLiteralLangAPI.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/RawStringLiteralLangAPI.java Wed Dec 19 20:53:30 2018 +0100
@@ -130,7 +130,7 @@
new JavacTask(TOOLBOX)
.sources(code)
.classpath(".")
- .options("--enable-preview", "-source", "12")
+ .options("--enable-preview", "-source", "13")
.run();
String output = new JavaTask(TOOLBOX)
.vmOptions("--enable-preview")
@@ -153,7 +153,7 @@
String output = new JavacTask(TOOLBOX)
.sources(source)
.classpath(".")
- .options("--enable-preview", "-source", "12", "-encoding", "utf8")
+ .options("--enable-preview", "-source", "13", "-encoding", "utf8")
.run()
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
@@ -170,7 +170,7 @@
String errors = new JavacTask(TOOLBOX)
.sources(source)
.classpath(".")
- .options("-XDrawDiagnostics", "--enable-preview", "-source", "12", "-encoding", "utf8")
+ .options("-XDrawDiagnostics", "--enable-preview", "-source", "13", "-encoding", "utf8")
.run(Task.Expect.FAIL)
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
--- a/test/langtools/tools/javac/api/T6395981.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/api/T6395981.java Wed Dec 19 20:53:30 2018 +0100
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6395981 6458819 7025784 8028543 8028544 8193291 8193292 8193292
+ * @bug 6395981 6458819 7025784 8028543 8028544 8193291 8193292 8193292 8205393
* @summary JavaCompilerTool and Tool must specify version of JLS and JVMS
* @author Peter von der Ah\u00e9
* @modules java.compiler
@@ -31,7 +31,7 @@
* @run main/fail T6395981
* @run main/fail T6395981 RELEASE_3 RELEASE_5 RELEASE_6
* @run main/fail T6395981 RELEASE_0 RELEASE_1 RELEASE_2 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6
- * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9 RELEASE_10 RELEASE_11 RELEASE_12
+ * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9 RELEASE_10 RELEASE_11 RELEASE_12 RELEASE_13
*/
import java.util.EnumSet;
--- a/test/langtools/tools/javac/classfiles/ClassVersionChecker.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/classfiles/ClassVersionChecker.java Wed Dec 19 20:53:30 2018 +0100
@@ -47,7 +47,8 @@
NINE("9", 53),
TEN("10", 54),
ELEVEN("11", 55),
- TWELVE("12", 56);
+ TWELVE("12", 56),
+ THIRTEEN("13", 57);
private Version(String release, int classFileVer) {
this.release = release;
--- a/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.break.ambiguous.target
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class BreakAmbiguousTarget {
void m(int i, int j) {
--- a/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java Wed Dec 19 20:53:30 2018 +0100
@@ -33,7 +33,7 @@
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
// key: compiler.note.note
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
// run: backdoor
class BreakExprNotImmediate {
--- a/test/langtools/tools/javac/diags/examples/BreakMissingValue.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/BreakMissingValue.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.break.missing.value
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class BreakMissingValue {
int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.break.outside.switch.expression
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class BreakOutsideSwitchExpression {
int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.continue.outside.switch.expression
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class ContinueOutsideSwitchExpression {
int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java Wed Dec 19 20:53:30 2018 +0100
@@ -26,7 +26,7 @@
// key: compiler.misc.inconvertible.types
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class IncompatibleTypesInSwitchExpression {
--- a/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java Wed Dec 19 20:53:30 2018 +0100
@@ -23,7 +23,7 @@
// key: compiler.misc.feature.multiple.case.labels
// key: compiler.warn.preview.feature.use.plural
-// options: --enable-preview -source 12 -Xlint:preview
+// options: --enable-preview -source 13 -Xlint:preview
class MultipleCaseLabels {
void m(int i) {
--- a/test/langtools/tools/javac/diags/examples/NotExhaustive.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/NotExhaustive.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.not.exhaustive
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class NotExhaustive {
int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
//key: compiler.warn.preview.feature.use.plural
//key: compiler.misc.feature.diamond
//key: compiler.misc.feature.lambda
-//options: -Xlint:preview -XDforcePreview -source 12 --enable-preview
+//options: -Xlint:preview -XDforcePreview -source 13 --enable-preview
import java.util.ArrayList;
--- a/test/langtools/tools/javac/diags/examples/PreviewFilename.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/PreviewFilename.java Wed Dec 19 20:53:30 2018 +0100
@@ -23,7 +23,7 @@
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: -XDforcePreview -source 12 --enable-preview
+// options: -XDforcePreview -source 13 --enable-preview
import java.util.ArrayList;
import java.util.List;
--- a/test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.note.preview.filename.additional
// key: compiler.warn.preview.feature.use
// key: compiler.misc.feature.diamond
-// options: -Xlint:preview -Xmaxwarns 1 -XDforcePreview -source 12 --enable-preview
+// options: -Xlint:preview -Xmaxwarns 1 -XDforcePreview -source 13 --enable-preview
import java.util.ArrayList;
--- a/test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java Wed Dec 19 20:53:30 2018 +0100
@@ -23,7 +23,7 @@
// key: compiler.note.preview.plural
// key: compiler.note.preview.recompile
-// options: -XDforcePreview -source 12 --enable-preview
+// options: -XDforcePreview -source 13 --enable-preview
import java.util.ArrayList;
--- a/test/langtools/tools/javac/diags/examples/RawStringLiteral.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/RawStringLiteral.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.unicode.backtick
// key: compiler.misc.feature.raw.string.literals
// key: compiler.warn.preview.feature.use.plural
-// options: --enable-preview -source 12 -Xlint:preview
+// options: --enable-preview -source 13 -Xlint:preview
class RawStringLiteral {
String m() {
--- a/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.return.outside.switch.expression
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class ReturnOutsideSwitchExpression {
int t(int i) {
--- a/test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.rule.completes.normally
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class RuleCompletesNormally {
public String convert(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.switch.case.unexpected.statement
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class ReturnOutsideSwitchExpression {
void t(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.switch.expression.completes.normally
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class SwitchExpressionCompletesNormally {
public String convert(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.switch.expression.empty
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class BreakOutsideSwitchExpression {
String t(E e) {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java Wed Dec 19 20:53:30 2018 +0100
@@ -26,7 +26,7 @@
// key: compiler.misc.switch.expression.target.cant.be.void
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class SwitchExpressionTargetCantBeVoid {
--- a/test/langtools/tools/javac/diags/examples/SwitchExpressions.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/SwitchExpressions.java Wed Dec 19 20:53:30 2018 +0100
@@ -23,7 +23,7 @@
// key: compiler.misc.feature.switch.expressions
// key: compiler.warn.preview.feature.use.plural
-// options: --enable-preview -source 12 -Xlint:preview
+// options: --enable-preview -source 13 -Xlint:preview
class SwitchExpressions {
int m(int i) {
--- a/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java Wed Dec 19 20:53:30 2018 +0100
@@ -24,7 +24,7 @@
// key: compiler.err.switch.mixing.case.types
// key: compiler.note.preview.filename
// key: compiler.note.preview.recompile
-// options: --enable-preview -source 12
+// options: --enable-preview -source 13
class SwitchMixingCaseTypes {
--- a/test/langtools/tools/javac/diags/examples/SwitchRules.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/diags/examples/SwitchRules.java Wed Dec 19 20:53:30 2018 +0100
@@ -23,7 +23,7 @@
// key: compiler.misc.feature.switch.rules
// key: compiler.warn.preview.feature.use.plural
-// options: --enable-preview -source 12 -Xlint:preview
+// options: --enable-preview -source 13 -Xlint:preview
class SwitchExpressions {
void m(int i) {
--- a/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -75,6 +75,8 @@
}
}
+ private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", "13"};
+
private void program(String... constructs) {
String s = "class C { static boolean cond = false; static int x = 0; void m() { # } }";
for (String c : constructs)
@@ -84,7 +86,7 @@
private void assertOK(String... constructs) {
reset();
- addCompileOptions("--enable-preview", "-source", "12");
+ addCompileOptions(PREVIEW_OPTIONS);
program(constructs);
try {
compile();
@@ -97,7 +99,7 @@
private void assertOKWithWarning(String warning, String... constructs) {
reset();
- addCompileOptions("--enable-preview", "-source", "12");
+ addCompileOptions(PREVIEW_OPTIONS);
program(constructs);
try {
compile();
@@ -110,7 +112,7 @@
private void assertFail(String expectedDiag, String... constructs) {
reset();
- addCompileOptions("--enable-preview", "-source", "12");
+ addCompileOptions(PREVIEW_OPTIONS);
program(constructs);
try {
compile();
--- a/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Adding switch expressions
- * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics --enable-preview -source 12 BadSwitchExpressionLambda.java
+ * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics --enable-preview -source 13 BadSwitchExpressionLambda.java
*/
class BadSwitchExpressionLambda {
--- a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java Wed Dec 19 20:53:30 2018 +0100
@@ -110,7 +110,7 @@
* corresponding platform visitor type.
*/
- @SupportedSourceVersion(RELEASE_12)
+ @SupportedSourceVersion(RELEASE_13)
public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor9<R, P> {
/**
@@ -121,7 +121,7 @@
}
}
- @SupportedSourceVersion(RELEASE_12)
+ @SupportedSourceVersion(RELEASE_13)
public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
@@ -131,7 +131,7 @@
}
}
- @SupportedSourceVersion(RELEASE_12)
+ @SupportedSourceVersion(RELEASE_13)
public static abstract class AbstractTypeVisitor<R, P> extends AbstractTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
@@ -141,7 +141,7 @@
}
}
- @SupportedSourceVersion(RELEASE_12)
+ @SupportedSourceVersion(RELEASE_13)
public static class ElementKindVisitor<R, P> extends ElementKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -162,7 +162,7 @@
}
}
- @SupportedSourceVersion(RELEASE_12)
+ @SupportedSourceVersion(RELEASE_13)
public static class ElementScanner<R, P> extends ElementScanner9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -181,7 +181,7 @@
}
}
- @SupportedSourceVersion(RELEASE_12)
+ @SupportedSourceVersion(RELEASE_13)
public static class SimpleAnnotationValueVisitor<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -202,7 +202,7 @@
}
}
- @SupportedSourceVersion(RELEASE_12)
+ @SupportedSourceVersion(RELEASE_13)
public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -223,7 +223,7 @@
}
}
- @SupportedSourceVersion(RELEASE_12)
+ @SupportedSourceVersion(RELEASE_13)
public static class SimpleTypeVisitor<R, P> extends SimpleTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -244,7 +244,7 @@
}
}
- @SupportedSourceVersion(RELEASE_12)
+ @SupportedSourceVersion(RELEASE_13)
public static class TypeKindVisitor<R, P> extends TypeKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call; uses {@code null}
--- a/test/langtools/tools/javac/parser/JavacParserTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/parser/JavacParserTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -1096,7 +1096,7 @@
String expectedErrors = "Test.java:1:178: compiler.err.switch.case.unexpected.statement\n";
StringWriter out = new StringWriter();
JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null,
- Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", "12"),
+ Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", "13"),
null, Arrays.asList(new MyFileObject(code)));
CompilationUnitTree cut = ct.parse().iterator().next();
--- a/test/langtools/tools/javac/platform/CanHandleClassFilesTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/platform/CanHandleClassFilesTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -26,8 +26,11 @@
* @bug 8207954
* @summary Verify that CreateSymbols can handle classfiles from the current release.
* @library /tools/lib /tools/javac/lib
- * @modules jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.api:+open
* jdk.compiler/com.sun.tools.javac.main
+ * jdk.compiler/com.sun.tools.javac.jvm:+open
+ * jdk.compiler/com.sun.tools.javac.util:+open
+ * jdk.jdeps/com.sun.tools.classfile:+open
* @build toolbox.ToolBox toolbox.JavacTask toolbox.Task
* @run main CanHandleClassFilesTest
*/
@@ -36,6 +39,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.stream.Stream;
import javax.tools.StandardLocation;
@@ -93,8 +97,16 @@
}
};
+ // open the non-exported packages needed by CreateSymbols to its module
+ Module targetModule = cl.getUnnamedModule();
+ Stream.of("jdk.compiler/com.sun.tools.javac.api",
+ "jdk.compiler/com.sun.tools.javac.jvm",
+ "jdk.compiler/com.sun.tools.javac.util",
+ "jdk.jdeps/com.sun.tools.classfile")
+ .forEach(p -> open(p, targetModule));
+
var createSymbolsClass = Class.forName("build.tools.symbolgenerator.CreateSymbols", false, cl);
- var main = createSymbolsClass.getDeclaredMethod("main", String[].class);
+ var main = createSymbolsClass.getMethod("main", String[].class);
var symbols = targetDir.resolve("symbols");
try (Writer w = Files.newBufferedWriter(symbols)) {}
@@ -112,4 +124,11 @@
}
}
+ void open(String moduleAndPackage, Module target) {
+ String[] s = moduleAndPackage.split("/");
+ var moduleName = s[0];
+ var packageName = s[1];
+ ModuleLayer.boot().findModule(moduleName).orElseThrow().addOpens(packageName, target);
+ }
+
}
--- a/test/langtools/tools/javac/preview/classReaderTest/Client.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/preview/classReaderTest/Client.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,9 +2,9 @@
* @test /nodynamiccopyright/
* @bug 8199194
* @summary smoke test for --enabled-preview classreader support
- * @compile -XDforcePreview --enable-preview -source 12 Bar.java
+ * @compile -XDforcePreview --enable-preview -source 13 Bar.java
* @compile/fail/ref=Client.nopreview.out -Xlint:preview -XDrawDiagnostics Client.java
- * @compile/fail/ref=Client.preview.out -Werror -Xlint:preview -XDrawDiagnostics --enable-preview -source 12 Client.java
+ * @compile/fail/ref=Client.preview.out -Werror -Xlint:preview -XDrawDiagnostics --enable-preview -source 13 Client.java
*/
public class Client {
--- a/test/langtools/tools/javac/preview/classReaderTest/Client.nopreview.out Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/preview/classReaderTest/Client.nopreview.out Wed Dec 19 20:53:30 2018 +0100
@@ -1,2 +1,2 @@
-- compiler.err.preview.feature.disabled.classfile: Bar.class, 12
+- compiler.err.preview.feature.disabled.classfile: Bar.class, 13
1 error
--- a/test/langtools/tools/javac/preview/classReaderTest/Client.preview.out Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/preview/classReaderTest/Client.preview.out Wed Dec 19 20:53:30 2018 +0100
@@ -1,4 +1,4 @@
-- compiler.warn.preview.feature.use.classfile: Bar.class, 12
+- compiler.warn.preview.feature.use.classfile: Bar.class, 13
- compiler.err.warnings.and.werror
1 error
1 warning
--- a/test/langtools/tools/javac/profiles/ProfileOptionTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/profiles/ProfileOptionTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -151,6 +151,7 @@
case JDK1_10:
case JDK1_11:
case JDK1_12:
+ case JDK1_13:
if (p == Profile.DEFAULT)
break;
if (ise == null)
--- a/test/langtools/tools/javac/switchexpr/BlockExpression.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/BlockExpression.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Verify rule cases with expression statements and throw statements work.
- * @compile --enable-preview -source 12 BlockExpression.java
+ * @compile --enable-preview -source 13 BlockExpression.java
* @run main/othervm --enable-preview BlockExpression
*/
--- a/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify the type of a conditional expression with nested switch expression is computed properly
- * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics --enable-preview -source 12 BooleanNumericNonNumeric.java
+ * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics --enable-preview -source 13 BooleanNumericNonNumeric.java
*/
public class BooleanNumericNonNumeric {
--- a/test/langtools/tools/javac/switchexpr/BreakTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/BreakTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -66,7 +66,7 @@
StringWriter out = new StringWriter();
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
- List.of("-XDdev", "--enable-preview", "-source", "12"), null,
+ List.of("-XDdev", "--enable-preview", "-source", "13"), null,
Arrays.asList(new MyFileObject(CODE)));
List<String> labels = new ArrayList<>();
new TreePathScanner<Void, Void>() {
--- a/test/langtools/tools/javac/switchexpr/CRT.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/CRT.java Wed Dec 19 20:53:30 2018 +0100
@@ -151,7 +151,7 @@
new JavacTask(tb)
.options("-Xjcov",
"--enable-preview",
- "-source", "12")
+ "-source", "13")
.outdir(classes)
.sources("public class Test {\n" +
code +
--- a/test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8214031
* @summary Verify that definite assignment when true works (legal code)
- * @compile --enable-preview --source 12 DefiniteAssignment1.java
+ * @compile --enable-preview --source 13 DefiniteAssignment1.java
* @run main/othervm --enable-preview DefiniteAssignment1
*/
public class DefiniteAssignment1 {
--- a/test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8214031
* @summary Verify that definite assignment when true works (illegal code)
- * @compile/fail/ref=DefiniteAssignment2.out --enable-preview --source 12 -XDrawDiagnostics DefiniteAssignment2.java
+ * @compile/fail/ref=DefiniteAssignment2.out --enable-preview --source 13 -XDrawDiagnostics DefiniteAssignment2.java
*/
public class DefiniteAssignment2 {
--- a/test/langtools/tools/javac/switchexpr/EmptySwitch.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/EmptySwitch.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Verify than an empty switch expression is rejected.
- * @compile/fail/ref=EmptySwitch.out --enable-preview -source 12 -XDrawDiagnostics EmptySwitch.java
+ * @compile/fail/ref=EmptySwitch.out --enable-preview -source 13 -XDrawDiagnostics EmptySwitch.java
*/
public class EmptySwitch {
--- a/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Verify that an switch expression over enum can be exhaustive without default.
- * @compile --enable-preview -source 12 ExhaustiveEnumSwitch.java
+ * @compile --enable-preview -source 13 ExhaustiveEnumSwitch.java
* @compile ExhaustiveEnumSwitchExtra.java
* @run main/othervm --enable-preview ExhaustiveEnumSwitch
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java Wed Dec 19 20:53:30 2018 +0100
@@ -3,7 +3,7 @@
* @bug 8206986
* @summary Check expression switch works.
* @compile/fail/ref=ExpressionSwitch-old.out -source 9 -Xlint:-options -XDrawDiagnostics ExpressionSwitch.java
- * @compile --enable-preview -source 12 ExpressionSwitch.java
+ * @compile --enable-preview -source 13 ExpressionSwitch.java
* @run main/othervm --enable-preview ExpressionSwitch
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Verify behavior of various kinds of breaks.
- * @compile --enable-preview -source 12 ExpressionSwitchBreaks1.java
+ * @compile --enable-preview -source 13 ExpressionSwitchBreaks1.java
* @run main/othervm --enable-preview ExpressionSwitchBreaks1
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Check behavior for invalid breaks.
- * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics --enable-preview -source 12 ExpressionSwitchBreaks2.java
+ * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchBreaks2.java
*/
public class ExpressionSwitchBreaks2 {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986 8214114 8214529
* @summary Verify various corner cases with nested switch expressions.
- * @compile --enable-preview -source 12 ExpressionSwitchBugs.java
+ * @compile --enable-preview -source 13 ExpressionSwitchBugs.java
* @run main/othervm --enable-preview ExpressionSwitchBugs
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8214031
* @summary Verify various corner cases with nested switch expressions.
- * @compile --enable-preview -source 12 ExpressionSwitchBugsInGen.java
+ * @compile --enable-preview -source 13 ExpressionSwitchBugsInGen.java
* @run main/othervm --enable-preview ExpressionSwitchBugsInGen
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Check switch expressions
- * @compile --enable-preview -source 12 ExpressionSwitchCodeFromJLS.java
+ * @compile --enable-preview -source 13 ExpressionSwitchCodeFromJLS.java
* @run main/othervm --enable-preview ExpressionSwitchCodeFromJLS
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Check definite (un)assignment for in switch expressions.
- * @compile --enable-preview -source 12 ExpressionSwitchDA.java
+ * @compile --enable-preview -source 13 ExpressionSwitchDA.java
* @run main/othervm --enable-preview ExpressionSwitchDA
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8214031 8214114
* @summary Verify switch expressions embedded in various statements work properly.
- * @compile --enable-preview -source 12 ExpressionSwitchEmbedding.java
+ * @compile --enable-preview -source 13 ExpressionSwitchEmbedding.java
* @run main/othervm --enable-preview ExpressionSwitchEmbedding
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Check fall through in switch expressions.
- * @compile --enable-preview -source 12 ExpressionSwitchFallThrough.java
+ * @compile --enable-preview -source 13 ExpressionSwitchFallThrough.java
* @run main/othervm --enable-preview ExpressionSwitchFallThrough
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Check fall through in switch expressions.
- * @compile --enable-preview -source 12 ExpressionSwitchFallThrough1.java
+ * @compile --enable-preview -source 13 ExpressionSwitchFallThrough1.java
* @run main/othervm --enable-preview ExpressionSwitchFallThrough1
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8212982
* @summary Verify a compile-time error is produced if switch expression does not provide a value
- * @compile/fail/ref=ExpressionSwitchFlow.out --enable-preview -source 12 -XDrawDiagnostics ExpressionSwitchFlow.java
+ * @compile/fail/ref=ExpressionSwitchFlow.out --enable-preview -source 13 -XDrawDiagnostics ExpressionSwitchFlow.java
*/
public class ExpressionSwitchFlow {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Check switch expressions embedded in switch expressions.
- * @compile --enable-preview -source 12 ExpressionSwitchInExpressionSwitch.java
+ * @compile --enable-preview -source 13 ExpressionSwitchInExpressionSwitch.java
* @run main/othervm --enable-preview ExpressionSwitchInExpressionSwitch
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Check types inferred for switch expressions.
- * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics --enable-preview -source 12 ExpressionSwitchInfer.java
+ * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchInfer.java
*/
import java.util.ArrayList;
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8206986
* @summary Verify behavior when an intersection type is inferred for switch expression.
- * @compile --enable-preview -source 12 ExpressionSwitchIntersectionTypes.java
+ * @compile --enable-preview -source 13 ExpressionSwitchIntersectionTypes.java
* @run main/othervm --enable-preview ExpressionSwitchIntersectionTypes
*/
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify behavior of not exhaustive switch expressions.
- * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source 12 ExpressionSwitchNotExhaustive.java
+ * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchNotExhaustive.java
*/
public class ExpressionSwitchNotExhaustive {
--- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify reachability in switch expressions.
- * @compile/fail/ref=ExpressionSwitchUnreachable.out -XDrawDiagnostics --enable-preview -source 12 ExpressionSwitchUnreachable.java
+ * @compile/fail/ref=ExpressionSwitchUnreachable.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchUnreachable.java
*/
public class ExpressionSwitchUnreachable {
--- a/test/langtools/tools/javac/switchexpr/ParseIncomplete.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ParseIncomplete.java Wed Dec 19 20:53:30 2018 +0100
@@ -67,7 +67,7 @@
StringWriter out = new StringWriter();
try {
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
- List.of("-XDdev", "--enable-preview", "-source", "12"), null,
+ List.of("-XDdev", "--enable-preview", "-source", "13"), null,
Arrays.asList(new MyFileObject(code)));
ct.parse().iterator().next();
} catch (Throwable t) {
--- a/test/langtools/tools/javac/switchexpr/ParserRecovery.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/ParserRecovery.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify the parser handles broken input gracefully.
- * @compile/fail/ref=ParserRecovery.out -XDrawDiagnostics --enable-preview -source 12 ParserRecovery.java
+ * @compile/fail/ref=ParserRecovery.out -XDrawDiagnostics --enable-preview -source 13 ParserRecovery.java
*/
public class ParserRecovery {
--- a/test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java Wed Dec 19 20:53:30 2018 +0100
@@ -26,7 +26,7 @@
* @bug 8214113
* @summary Verify the switch expression's type does not have a constant attached,
* and so the switch expression is not elided.
- * @compile --enable-preview --source 12 SwitchExpressionIsNotAConstant.java
+ * @compile --enable-preview --source 13 SwitchExpressionIsNotAConstant.java
* @run main/othervm --enable-preview SwitchExpressionIsNotAConstant
*/
public class SwitchExpressionIsNotAConstant {
--- a/test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify that scopes in rule cases are isolated.
- * @compile/fail/ref=SwitchExpressionScopesIsolated.out -XDrawDiagnostics --enable-preview -source 12 SwitchExpressionScopesIsolated.java
+ * @compile/fail/ref=SwitchExpressionScopesIsolated.out -XDrawDiagnostics --enable-preview -source 13 SwitchExpressionScopesIsolated.java
*/
public class SwitchExpressionScopesIsolated {
--- a/test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -89,7 +89,7 @@
StringWriter out = new StringWriter();
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
- List.of("--enable-preview", "-source", "12"), null,
+ List.of("--enable-preview", "-source", "13"), null,
Arrays.asList(new MyFileObject(code)));
return ct.parse().iterator().next();
}
--- a/test/langtools/tools/javac/switchexpr/TryCatch.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchexpr/TryCatch.java Wed Dec 19 20:53:30 2018 +0100
@@ -25,7 +25,7 @@
* @test
* @bug 8214114
* @summary Verify try-catch inside a switch expression works properly.
- * @compile --enable-preview -source 12 TryCatch.java
+ * @compile --enable-preview -source 13 TryCatch.java
* @run main/othervm --enable-preview TryCatch
*/
public class TryCatch {
--- a/test/langtools/tools/javac/switchextra/CaseTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchextra/CaseTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -136,7 +136,7 @@
StringWriter out = new StringWriter();
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
- List.of("-XDdev", "--enable-preview", "-source", "12"), null,
+ List.of("-XDdev", "--enable-preview", "-source", "13"), null,
Arrays.asList(new MyFileObject(code)));
return ct.parse().iterator().next();
}
--- a/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java Wed Dec 19 20:53:30 2018 +0100
@@ -3,7 +3,7 @@
* @bug 8206986
* @summary Verify cases with multiple labels work properly.
* @compile/fail/ref=MultipleLabelsExpression-old.out -source 9 -Xlint:-options -XDrawDiagnostics MultipleLabelsExpression.java
- * @compile --enable-preview -source 12 MultipleLabelsExpression.java
+ * @compile --enable-preview -source 13 MultipleLabelsExpression.java
* @run main/othervm --enable-preview MultipleLabelsExpression
*/
--- a/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java Wed Dec 19 20:53:30 2018 +0100
@@ -3,7 +3,7 @@
* @bug 8206986
* @summary Verify cases with multiple labels work properly.
* @compile/fail/ref=MultipleLabelsStatement-old.out -source 9 -Xlint:-options -XDrawDiagnostics MultipleLabelsStatement.java
- * @compile --enable-preview -source 12 MultipleLabelsStatement.java
+ * @compile --enable-preview -source 13 MultipleLabelsStatement.java
* @run main/othervm --enable-preview MultipleLabelsStatement
*/
--- a/test/langtools/tools/javac/switchextra/RuleParsingTest.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchextra/RuleParsingTest.java Wed Dec 19 20:53:30 2018 +0100
@@ -94,7 +94,7 @@
StringWriter out = new StringWriter();
JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors,
- List.of("--enable-preview", "-source", "12"), null,
+ List.of("--enable-preview", "-source", "13"), null,
Arrays.asList(new MyFileObject(code.toString())));
CompilationUnitTree cut = ct.parse().iterator().next();
Trees trees = Trees.instance(ct);
--- a/test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java Wed Dec 19 20:53:30 2018 +0100
@@ -3,7 +3,7 @@
* @bug 8206986
* @summary Verify reasonable errors are produced when neither ':' nor '->'
* is found are the expression of a case
- * @compile/fail/ref=SwitchArrowBrokenConstant.out -source 12 --enable-preview -Xlint:-preview -XDrawDiagnostics SwitchArrowBrokenConstant.java
+ * @compile/fail/ref=SwitchArrowBrokenConstant.out -source 13 --enable-preview -Xlint:-preview -XDrawDiagnostics SwitchArrowBrokenConstant.java
*/
public class SwitchArrowBrokenConstant {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java Wed Dec 19 20:53:30 2018 +0100
@@ -3,7 +3,7 @@
* @bug 8206986
* @summary Verify rule cases work properly.
* @compile/fail/ref=SwitchStatementArrow-old.out -source 9 -Xlint:-options -XDrawDiagnostics SwitchStatementArrow.java
- * @compile --enable-preview -source 12 SwitchStatementArrow.java
+ * @compile --enable-preview -source 13 SwitchStatementArrow.java
* @run main/othervm --enable-preview SwitchStatementArrow
*/
--- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify that rule and ordinary cases cannot be mixed.
- * @compile/fail/ref=SwitchStatementBroken.out -XDrawDiagnostics --enable-preview -source 12 SwitchStatementBroken.java
+ * @compile/fail/ref=SwitchStatementBroken.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementBroken.java
*/
public class SwitchStatementBroken {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify that not allowed types of statements cannot be used in rule case.
- * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics --enable-preview -source 12 SwitchStatementBroken2.java
+ * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementBroken2.java
*/
public class SwitchStatementBroken2 {
--- a/test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java Wed Dec 19 20:53:30 2018 +0100
@@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8206986
* @summary Verify that scopes in rule cases are isolated.
- * @compile/fail/ref=SwitchStatementScopesIsolated.out -XDrawDiagnostics --enable-preview -source 12 SwitchStatementScopesIsolated.java
+ * @compile/fail/ref=SwitchStatementScopesIsolated.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementScopesIsolated.java
*/
public class SwitchStatementScopesIsolated {
--- a/test/langtools/tools/javac/versions/Versions.java Wed Dec 19 08:32:48 2018 +0100
+++ b/test/langtools/tools/javac/versions/Versions.java Wed Dec 19 20:53:30 2018 +0100
@@ -69,9 +69,9 @@
Set.of("1.2", "1.3", "1.4", "1.5", "1.6");
public static final Set<String> VALID_SOURCES =
- Set.of("1.7", "1.8", "1.9", "1.10", "11", "12");
+ Set.of("1.7", "1.8", "1.9", "1.10", "11", "12", "13");
- public static final String LATEST_MAJOR_VERSION = "56.0";
+ public static final String LATEST_MAJOR_VERSION = "57.0";
static enum SourceTarget {
SEVEN(true, "51.0", "7", Versions::checksrc17),
@@ -79,7 +79,8 @@
NINE(true, "53.0", "9", Versions::checksrc19),
TEN(true, "54.0", "10", Versions::checksrc110),
ELEVEN(false, "55.0", "11", Versions::checksrc111),
- TWELVE(false, "56.0", "12", Versions::checksrc112);
+ TWELVE(false, "56.0", "12", Versions::checksrc112),
+ THIRTEEN(false, "57.0", "13", Versions::checksrc113);
private final boolean dotOne;
private final String classFileVer;
@@ -293,6 +294,11 @@
checksrc111(args);
}
+ protected void checksrc113(String... args) {
+ printargs("checksrc113", args);
+ checksrc111(args);
+ }
+
protected void pass(String... args) {
printargs("pass", args);
--- a/test/nashorn/TEST.ROOT Wed Dec 19 08:32:48 2018 +0100
+++ b/test/nashorn/TEST.ROOT Wed Dec 19 20:53:30 2018 +0100
@@ -8,7 +8,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b12
+requiredVersion=4.2 b13
# Use new module options
useNewOptions=true