1 Star 0 Fork 27

Alex Gao/openjdk-17

forked from src-openEuler/openjdk-17 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Backport-Important-Fixed-Issues.patch 85.92 KB
一键复制 编辑 原始数据 按行查看 历史
Benshuai5D 提交于 2024-10-16 23:06 . IAXNDZ:update to 17.0.13
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042
---
src/hotspot/cpu/aarch64/assembler_aarch64.cpp | 20 ++
src/hotspot/cpu/aarch64/assembler_aarch64.hpp | 13 +-
src/hotspot/os/linux/osContainer_linux.cpp | 2 +-
src/hotspot/os/linux/os_perf_linux.cpp | 2 +-
src/hotspot/share/c1/c1_globals.hpp | 6 +-
src/hotspot/share/gc/parallel/psScavenge.cpp | 8 +-
.../recorder/checkpoint/types/jfrTypeSet.cpp | 2 +-
src/hotspot/share/opto/c2compiler.cpp | 1 +
src/hotspot/share/opto/compile.cpp | 2 +-
src/hotspot/share/opto/library_call.cpp | 11 +-
src/hotspot/share/opto/loopPredicate.cpp | 2 +-
src/hotspot/share/opto/loopopts.cpp | 6 +-
src/hotspot/share/opto/macroArrayCopy.cpp | 4 +-
src/hotspot/share/utilities/exceptions.cpp | 4 +-
.../classes/java/nio/charset/Charset.java | 8 +-
.../sun/security/jca/ProviderList.java | 8 +-
.../classes/sun/security/provider/SHA3.java | 14 +-
.../sun/security/provider/SHAKE128.java | 49 ++++
.../media/sound/StandardMidiFileReader.java | 10 +-
.../classes/java/awt/image/BufferedImage.java | 28 +--
.../java/awt/image/WritableRaster.java | 37 +--
.../swing/plaf/basic/BasicComboPopup.java | 4 +-
.../swing/plaf/basic/BasicDirectoryModel.java | 103 ++++-----
.../classes/javax/swing/text/html/CSS.java | 6 +-
.../sun/jndi/ldap/sasl/SaslInputStream.java | 4 +-
.../jdk/internal/net/http/common/Utils.java | 10 +-
.../share/native/libj2gss/GSSLibStub.c | 10 +-
.../com/sun/tools/javac/comp/Annotate.java | 7 +-
.../sun/tools/javac/comp/DeferredAttr.java | 5 +-
.../classes/sun/security/pkcs11/P11Key.java | 9 +-
.../sun/jvmstat/monitor/MonitoredHost.java | 16 +-
.../arraycopy/TestArrayCopyOfRangeGuards.java | 61 +++++
.../TestCountedLoopMinJintStride.java | 64 ++++++
.../TestSplitDivThroughPhiWithControl.java | 210 ++++++++++++++++++
.../containers/docker/TestContainerInfo.java | 97 ++++++++
.../java/awt/image/BufferedImage/SetData.java | 114 ++++++++++
.../net/httpclient/HttpClientBuilderTest.java | 19 +-
.../java/nio/charset/Charset/AliasesCopy.java | 69 ++++++
.../File/SMFInterruptedRunningStatus.java | 143 ++++++++++++
.../javax/swing/JComboBox/ComboPopupBug.java | 91 ++++++++
.../jfr/api/consumer/TestRecordedClass.java | 115 ++++++++++
.../ConcurrentGetMonitoredHost.java | 90 ++++++++
.../sun/security/jca/NullPreferredList.java | 41 ++++
.../sun/security/jca/app-security.properties | 1 +
test/langtools/tools/javac/T8320144.java | 19 ++
test/langtools/tools/javac/T8320144.out | 4 +
.../recovery/CrashDueToUnreportedError.java | 29 +++
.../recovery/CrashDueToUnreportedError.out | 2 +
48 files changed, 1403 insertions(+), 177 deletions(-)
create mode 100644 src/java.base/share/classes/sun/security/provider/SHAKE128.java
create mode 100644 test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyOfRangeGuards.java
create mode 100644 test/hotspot/jtreg/compiler/predicates/TestCountedLoopMinJintStride.java
create mode 100644 test/hotspot/jtreg/compiler/splitif/TestSplitDivThroughPhiWithControl.java
create mode 100644 test/hotspot/jtreg/containers/docker/TestContainerInfo.java
create mode 100644 test/jdk/java/awt/image/BufferedImage/SetData.java
create mode 100644 test/jdk/java/nio/charset/Charset/AliasesCopy.java
create mode 100644 test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java
create mode 100644 test/jdk/javax/swing/JComboBox/ComboPopupBug.java
create mode 100644 test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java
create mode 100644 test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java
create mode 100644 test/jdk/sun/security/jca/NullPreferredList.java
create mode 100644 test/jdk/sun/security/jca/app-security.properties
create mode 100644 test/langtools/tools/javac/T8320144.java
create mode 100644 test/langtools/tools/javac/T8320144.out
create mode 100644 test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java
create mode 100644 test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out
diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.cpp b/src/hotspot/cpu/aarch64/assembler_aarch64.cpp
index d31f63883..ca033b71a 100644
--- a/src/hotspot/cpu/aarch64/assembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/assembler_aarch64.cpp
@@ -156,6 +156,26 @@ void Assembler::adrp(Register reg1, const Address &dest, uint64_t &byte_offset)
rf(Rd, 0);
}
+// This encoding is similar (but not quite identical) to the encoding used
+// by literal ld/st. see JDK-8324123.
+// PRFM does not support writeback or pre/post index.
+void Assembler::prfm(const Address &adr, prfop pfop) {
+ Address::mode mode = adr.getMode();
+ // PRFM does not support pre/post index
+ guarantee((mode != Address::pre) && (mode != Address::post), "prfm does not support pre/post indexing");
+ if (mode == Address::literal) {
+ starti;
+ f(0b11, 31, 30), f(0b011, 29, 27), f(0b000, 26, 24);
+ f(pfop, 4, 0);
+ int64_t offset = (adr.target() - pc()) >> 2;
+ sf(offset, 23, 5);
+ } else {
+ assert((mode == Address::base_plus_offset)
+ || (mode == Address::base_plus_offset_reg), "must be base_plus_offset/base_plus_offset_reg");
+ ld_st2(as_Register(pfop), adr, 0b11, 0b10);
+ }
+}
+
#undef starti
Address::Address(address target, relocInfo::relocType rtype) : _mode(literal){
diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp
index 1fea866cc..313c22318 100644
--- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp
+++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp
@@ -763,6 +763,8 @@ public:
void adrp(Register Rd, const Address &dest, uint64_t &offset);
+ void prfm(const Address &adr, prfop pfop = PLDL1KEEP);
+
#undef INSN
void add_sub_immediate(Register Rd, Register Rn, unsigned uimm, int op,
@@ -1498,17 +1500,6 @@ public:
#undef INSN
-#define INSN(NAME, size, op) \
- void NAME(const Address &adr, prfop pfop = PLDL1KEEP) { \
- ld_st2((Register)pfop, adr, size, op); \
- }
-
- INSN(prfm, 0b11, 0b10); // FIXME: PRFM should not be used with
- // writeback modes, but the assembler
- // doesn't enfore that.
-
-#undef INSN
-
#define INSN(NAME, size, op) \
void NAME(FloatRegister Rt, const Address &adr) { \
ld_st2((Register)Rt, adr, size, op, 1); \
diff --git a/src/hotspot/os/linux/osContainer_linux.cpp b/src/hotspot/os/linux/osContainer_linux.cpp
index 52e6ab86c..88a9289b9 100644
--- a/src/hotspot/os/linux/osContainer_linux.cpp
+++ b/src/hotspot/os/linux/osContainer_linux.cpp
@@ -138,7 +138,7 @@ jlong OSContainer::pids_current() {
void OSContainer::print_container_helper(outputStream* st, jlong j, const char* metrics) {
st->print("%s: ", metrics);
- if (j > 0) {
+ if (j >= 0) {
if (j >= 1024) {
st->print_cr(UINT64_FORMAT " k", uint64_t(j) / 1024);
} else {
diff --git a/src/hotspot/share/c1/c1_globals.hpp b/src/hotspot/share/c1/c1_globals.hpp
index 7564b2b8a..41d4607f8 100644
--- a/src/hotspot/share/c1/c1_globals.hpp
+++ b/src/hotspot/share/c1/c1_globals.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -287,9 +287,11 @@
develop(bool, InstallMethods, true, \
"Install methods at the end of successful compilations") \
\
+ /* The compiler assumes, in many places, that methods are at most 1MB. */ \
+ /* Therefore, we restrict this flag to at most 1MB. */ \
develop(intx, NMethodSizeLimit, (64*K)*wordSize, \
"Maximum size of a compiled method.") \
- range(0, max_jint) \
+ range(0, 1*M) \
\
develop(bool, TraceFPUStack, false, \
"Trace emulation of the FPU stack (intel only)") \
diff --git a/src/hotspot/share/gc/parallel/psScavenge.cpp b/src/hotspot/share/gc/parallel/psScavenge.cpp
index 98ab42022..56ed8a5dd 100644
--- a/src/hotspot/share/gc/parallel/psScavenge.cpp
+++ b/src/hotspot/share/gc/parallel/psScavenge.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -750,12 +750,14 @@ bool PSScavenge::should_attempt_scavenge() {
size_t avg_promoted = (size_t) policy->padded_average_promoted_in_bytes();
size_t promotion_estimate = MIN2(avg_promoted, young_gen->used_in_bytes());
- bool result = promotion_estimate < old_gen->free_in_bytes();
+ // Total free size after possible old gen expansion
+ size_t free_in_old_gen = old_gen->max_gen_size() - old_gen->used_in_bytes();
+ bool result = promotion_estimate < free_in_old_gen;
log_trace(ergo)("%s scavenge: average_promoted " SIZE_FORMAT " padded_average_promoted " SIZE_FORMAT " free in old gen " SIZE_FORMAT,
result ? "Do" : "Skip", (size_t) policy->average_promoted_in_bytes(),
(size_t) policy->padded_average_promoted_in_bytes(),
- old_gen->free_in_bytes());
+ free_in_old_gen);
if (young_gen->used_in_bytes() < (size_t) policy->padded_average_promoted_in_bytes()) {
log_trace(ergo)(" padded_promoted_average is greater than maximum promotion = " SIZE_FORMAT, young_gen->used_in_bytes());
}
diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp
index 13de7651e..411733814 100644
--- a/src/hotspot/share/opto/c2compiler.cpp
+++ b/src/hotspot/share/opto/c2compiler.cpp
@@ -103,6 +103,7 @@ void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, boo
bool do_locks_coarsening = EliminateLocks;
while (!env->failing()) {
+ ResourceMark rm;
// Attempt to compile while subsuming loads into machine instructions.
Compile C(env, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing, do_locks_coarsening, install_code, directive);
diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp
index 10ab50369..5d1422519 100644
--- a/src/hotspot/share/opto/compile.cpp
+++ b/src/hotspot/share/opto/compile.cpp
@@ -4610,7 +4610,7 @@ void Compile::remove_speculative_types(PhaseIterGVN &igvn) {
const Type* t_no_spec = t->remove_speculative();
if (t_no_spec != t) {
bool in_hash = igvn.hash_delete(n);
- assert(in_hash, "node should be in igvn hash table");
+ assert(in_hash || n->hash() == Node::NO_HASH, "node should be in igvn hash table");
tn->set_type(t_no_spec);
igvn.hash_insert(n);
igvn._worklist.push(n); // give it a chance to go away
diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp
index c52f24834..d732c706e 100644
--- a/src/hotspot/share/opto/library_call.cpp
+++ b/src/hotspot/share/opto/library_call.cpp
@@ -3599,12 +3599,16 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
length = _gvn.transform(new SubINode(end, start));
}
- // Bail out if length is negative.
+ // Bail out if length is negative (i.e., if start > end).
// Without this the new_array would throw
// NegativeArraySizeException but IllegalArgumentException is what
// should be thrown
generate_negative_guard(length, bailout, &length);
+ // Bail out if start is larger than the original length
+ Node* orig_tail = _gvn.transform(new SubINode(orig_length, start));
+ generate_negative_guard(orig_tail, bailout, &orig_tail);
+
if (bailout->req() > 1) {
PreserveJVMState pjvms(this);
set_control(_gvn.transform(bailout));
@@ -3614,8 +3618,7 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
if (!stopped()) {
// How many elements will we copy from the original?
- // The answer is MinI(orig_length - start, length).
- Node* orig_tail = _gvn.transform(new SubINode(orig_length, start));
+ // The answer is MinI(orig_tail, length).
Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length);
// Generate a direct call to the right arraycopy function(s).
@@ -3663,7 +3666,7 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
if (!stopped()) {
newcopy = new_array(klass_node, length, 0); // no arguments to push
- ArrayCopyNode* ac = ArrayCopyNode::make(this, true, original, start, newcopy, intcon(0), moved, true, false,
+ ArrayCopyNode* ac = ArrayCopyNode::make(this, true, original, start, newcopy, intcon(0), moved, true, true,
load_object_klass(original), klass_node);
if (!is_copyOfRange) {
ac->set_copyof(validated);
diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp
index 0a189bf49..9df2a8fb8 100644
--- a/src/hotspot/share/opto/loopPredicate.cpp
+++ b/src/hotspot/share/opto/loopPredicate.cpp
@@ -1042,7 +1042,7 @@ bool PhaseIdealLoop::loop_predication_should_follow_branches(IdealLoopTree *loop
CountedLoopNode* cl = head->as_CountedLoop();
if (cl->phi() != nullptr) {
const TypeInt* t = _igvn.type(cl->phi())->is_int();
- float worst_case_trip_cnt = ((float)t->_hi - t->_lo) / ABS(cl->stride_con());
+ float worst_case_trip_cnt = ((float)t->_hi - t->_lo) / ABS((float)cl->stride_con());
if (worst_case_trip_cnt < loop_trip_cnt) {
loop_trip_cnt = worst_case_trip_cnt;
}
diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp
index 880dbff83..0165c6410 100644
--- a/src/hotspot/share/opto/loopopts.cpp
+++ b/src/hotspot/share/opto/loopopts.cpp
@@ -236,7 +236,11 @@ bool PhaseIdealLoop::cannot_split_division(const Node* n, const Node* region) co
return false;
}
- assert(n->in(0) == nullptr, "divisions with zero check should already have bailed out earlier in split-if");
+ if (n->in(0) != nullptr) {
+ // Cannot split through phi if Div or Mod node has a control dependency to a zero check.
+ return true;
+ }
+
Node* divisor = n->in(2);
return is_divisor_counted_loop_phi(divisor, region) &&
loop_phi_backedge_type_contains_zero(divisor, zero);
diff --git a/src/hotspot/share/opto/macroArrayCopy.cpp b/src/hotspot/share/opto/macroArrayCopy.cpp
index 4785e45b7..5d88a84f9 100644
--- a/src/hotspot/share/opto/macroArrayCopy.cpp
+++ b/src/hotspot/share/opto/macroArrayCopy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1266,7 +1266,7 @@ void PhaseMacroExpand::expand_arraycopy_node(ArrayCopyNode *ac) {
generate_arraycopy(ac, alloc, &ctrl, merge_mem, &io,
adr_type, T_OBJECT,
src, src_offset, dest, dest_offset, length,
- true, !ac->is_copyofrange());
+ true, ac->has_negative_length_guard());
return;
}
diff --git a/src/hotspot/share/utilities/exceptions.cpp b/src/hotspot/share/utilities/exceptions.cpp
index cf9291f6d..499542235 100644
--- a/src/hotspot/share/utilities/exceptions.cpp
+++ b/src/hotspot/share/utilities/exceptions.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -440,6 +440,7 @@ void Exceptions::wrap_dynamic_exception(bool is_indy, JavaThread* THREAD) {
// Pass through an Error, including BootstrapMethodError, any other form
// of linkage error, or say ThreadDeath/OutOfMemoryError
if (ls != NULL) {
+ ResourceMark rm(THREAD);
ls->print_cr("bootstrap method invocation wraps BSME around " INTPTR_FORMAT, p2i((void *)exception));
exception->print_on(ls);
}
@@ -448,6 +449,7 @@ void Exceptions::wrap_dynamic_exception(bool is_indy, JavaThread* THREAD) {
// Otherwise wrap the exception in a BootstrapMethodError
if (ls != NULL) {
+ ResourceMark rm(THREAD);
ls->print_cr("%s throws BSME for " INTPTR_FORMAT, is_indy ? "invokedynamic" : "dynamic constant", p2i((void *)exception));
exception->print_on(ls);
}
diff --git a/src/java.base/share/classes/java/nio/charset/Charset.java b/src/java.base/share/classes/java/nio/charset/Charset.java
index 0ac18a23b..2b1942122 100644
--- a/src/java.base/share/classes/java/nio/charset/Charset.java
+++ b/src/java.base/share/classes/java/nio/charset/Charset.java
@@ -41,7 +41,6 @@ import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Objects;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.Set;
@@ -636,7 +635,12 @@ public abstract class Charset
* If the canonical name or any of the aliases are illegal
*/
protected Charset(String canonicalName, String[] aliases) {
- String[] as = Objects.requireNonNullElse(aliases, zeroAliases);
+ String[] as =
+ aliases == null ?
+ zeroAliases :
+ VM.isSystemDomainLoader(getClass().getClassLoader()) ?
+ aliases :
+ Arrays.copyOf(aliases, aliases.length);
// Skip checks for the standard, built-in Charsets we always load
// during initialization.
diff --git a/src/java.base/share/classes/sun/security/jca/ProviderList.java b/src/java.base/share/classes/sun/security/jca/ProviderList.java
index 9b41172c0..4b30c76cf 100644
--- a/src/java.base/share/classes/sun/security/jca/ProviderList.java
+++ b/src/java.base/share/classes/sun/security/jca/ProviderList.java
@@ -366,17 +366,19 @@ public final class ProviderList {
int i;
// Preferred provider list
- if (preferredPropList != null &&
- (pList = preferredPropList.getAll(type, name)) != null) {
+ if (preferredPropList != null) {
+ pList = preferredPropList.getAll(type, name);
for (i = 0; i < pList.size(); i++) {
Provider p = getProvider(pList.get(i).provider);
+ if (p == null) {
+ continue;
+ }
Service s = p.getService(type, name);
if (s != null) {
return s;
}
}
}
-
for (i = 0; i < configs.length; i++) {
Provider p = getProvider(i);
Service s = p.getService(type, name);
diff --git a/src/java.base/share/classes/sun/security/provider/SHA3.java b/src/java.base/share/classes/sun/security/provider/SHA3.java
index fb21e3ceb..931056f81 100644
--- a/src/java.base/share/classes/sun/security/provider/SHA3.java
+++ b/src/java.base/share/classes/sun/security/provider/SHA3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -106,7 +106,15 @@ abstract class SHA3 extends DigestBase {
throw new ProviderException("Incorrect pad size: " + numOfPadding);
}
implCompress(buffer, 0);
- System.arraycopy(state, 0, out, ofs, engineGetDigestLength());
+ int availableBytes = buffer.length;
+ int numBytes = engineGetDigestLength();
+ while (numBytes > availableBytes) {
+ System.arraycopy(state, 0, out, ofs, availableBytes);
+ numBytes -= availableBytes;
+ ofs += availableBytes;
+ keccak();
+ }
+ System.arraycopy(state, 0, out, ofs, numBytes);
}
/**
@@ -253,7 +261,7 @@ abstract class SHA3 extends DigestBase {
/**
* The function Keccak as defined in section 5.2 with
- * rate r = 1600 and capacity c = (digest length x 2).
+ * rate r = 1600 and capacity c.
*/
private void keccak() {
// convert the 200-byte state into 25 lanes
diff --git a/src/java.base/share/classes/sun/security/provider/SHAKE128.java b/src/java.base/share/classes/sun/security/provider/SHAKE128.java
new file mode 100644
index 000000000..0d62497b3
--- /dev/null
+++ b/src/java.base/share/classes/sun/security/provider/SHAKE128.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.security.provider;
+
+/*
+ * The SHAKE128 extendable output function.
+ */
+public final class SHAKE128 extends SHA3 {
+ public SHAKE128(int d) {
+ super("SHAKE128", d, (byte) 0x1F, 32);
+ }
+
+ public void update(byte in) {
+ engineUpdate(in);
+ }
+ public void update(byte[] in, int off, int len) {
+ engineUpdate(in, off, len);
+ }
+
+ public byte[] digest() {
+ return engineDigest();
+ }
+
+ public void reset() {
+ engineReset();
+ }
+}
diff --git a/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java b/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java
index 85f31acb0..a60c47469 100644
--- a/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java
+++ b/src/java.desktop/share/classes/com/sun/media/sound/StandardMidiFileReader.java
@@ -326,10 +326,10 @@ final class SMFParser {
// reset current tick to 0
long tick = 0;
- // reset current status byte to 0 (invalid value).
+ // reset current running status byte to 0 (invalid value).
// this should cause us to throw an InvalidMidiDataException if we don't
// get a valid status byte from the beginning of the track.
- int status = 0;
+ int runningStatus = 0;
boolean endOfTrackFound = false;
while (!trackFinished() && !endOfTrackFound) {
@@ -346,9 +346,15 @@ final class SMFParser {
// check for new status
int byteValue = readUnsigned();
+ int status;
if (byteValue >= 0x80) {
status = byteValue;
+ // update running status (only for channel messages)
+ if ((status & 0xF0) != 0xF0) {
+ runningStatus = status;
+ }
} else {
+ status = runningStatus;
data1 = byteValue;
}
diff --git a/src/java.desktop/share/classes/java/awt/image/BufferedImage.java b/src/java.desktop/share/classes/java/awt/image/BufferedImage.java
index 3c937dd38..b7db576a3 100644
--- a/src/java.desktop/share/classes/java/awt/image/BufferedImage.java
+++ b/src/java.desktop/share/classes/java/awt/image/BufferedImage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1509,31 +1509,7 @@ public class BufferedImage extends java.awt.Image
* @see #getData(Rectangle)
*/
public void setData(Raster r) {
- int width = r.getWidth();
- int height = r.getHeight();
- int startX = r.getMinX();
- int startY = r.getMinY();
-
- int[] tdata = null;
-
- // Clip to the current Raster
- Rectangle rclip = new Rectangle(startX, startY, width, height);
- Rectangle bclip = new Rectangle(0, 0, raster.width, raster.height);
- Rectangle intersect = rclip.intersection(bclip);
- if (intersect.isEmpty()) {
- return;
- }
- width = intersect.width;
- height = intersect.height;
- startX = intersect.x;
- startY = intersect.y;
-
- // remind use get/setDataElements for speed if Rasters are
- // compatible
- for (int i = startY; i < startY+height; i++) {
- tdata = r.getPixels(startX,i,width,1,tdata);
- raster.setPixels(startX,i,width,1, tdata);
- }
+ raster.setRect(r);
}
diff --git a/src/java.desktop/share/classes/java/awt/image/WritableRaster.java b/src/java.desktop/share/classes/java/awt/image/WritableRaster.java
index 0e345026c..bcca029c1 100644
--- a/src/java.desktop/share/classes/java/awt/image/WritableRaster.java
+++ b/src/java.desktop/share/classes/java/awt/image/WritableRaster.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -422,36 +422,19 @@ public class WritableRaster extends Raster {
* @throws NullPointerException if srcRaster is null.
*/
public void setRect(int dx, int dy, Raster srcRaster) {
- int width = srcRaster.getWidth();
- int height = srcRaster.getHeight();
int srcOffX = srcRaster.getMinX();
int srcOffY = srcRaster.getMinY();
- int dstOffX = dx+srcOffX;
- int dstOffY = dy+srcOffY;
-
- // Clip to this raster
- if (dstOffX < this.minX) {
- int skipX = this.minX - dstOffX;
- width -= skipX;
- srcOffX += skipX;
- dstOffX = this.minX;
- }
- if (dstOffY < this.minY) {
- int skipY = this.minY - dstOffY;
- height -= skipY;
- srcOffY += skipY;
- dstOffY = this.minY;
- }
- if (dstOffX+width > this.minX+this.width) {
- width = this.minX + this.width - dstOffX;
- }
- if (dstOffY+height > this.minY+this.height) {
- height = this.minY + this.height - dstOffY;
- }
-
- if (width <= 0 || height <= 0) {
+ Rectangle bsrc = new Rectangle(dx+srcOffX, dy+srcOffY, srcRaster.getWidth(), srcRaster.getHeight());
+ Rectangle clip = bsrc.intersection(new Rectangle(minX, minY, width, height));
+ if (clip.isEmpty()) {
return;
}
+ srcOffX += clip.x - bsrc.x;
+ srcOffY += clip.y - bsrc.y;
+ final int dstOffX = clip.x;
+ final int dstOffY = clip.y;
+ final int width = clip.width;
+ final int height = clip.height;
switch (srcRaster.getSampleModel().getDataType()) {
case DataBuffer.TYPE_BYTE:
diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
index 050f27e72..197f3238b 100644
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -921,7 +921,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
if (e.getSource() == list) {
return;
}
- if (!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled())
+ if (!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled() || !comboBox.isShowing())
return;
if ( comboBox.isEditable() ) {
diff --git a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java b/src/java.desktop/share/classes/javax/swing/text/html/CSS.java
index c14b5a126..311f172b8 100644
--- a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java
+++ b/src/java.desktop/share/classes/javax/swing/text/html/CSS.java
@@ -2830,8 +2830,8 @@ public class CSS implements Serializable {
*/
@SuppressWarnings("serial") // Same-version serialization only
static class BackgroundImage extends CssValue {
- private boolean loadedImage;
- private ImageIcon image;
+ private volatile boolean loadedImage;
+ private ImageIcon image;
Object parseCssValue(String value) {
BackgroundImage retValue = new BackgroundImage();
@@ -2849,7 +2849,6 @@ public class CSS implements Serializable {
synchronized(this) {
if (!loadedImage) {
URL url = CSS.getURL(base, svalue);
- loadedImage = true;
if (url != null) {
image = new ImageIcon();
Image tmpImg = Toolkit.getDefaultToolkit().createImage(url);
@@ -2857,6 +2856,7 @@ public class CSS implements Serializable {
image.setImage(tmpImg);
}
}
+ loadedImage = true;
}
}
}
diff --git a/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java b/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java
index f0746c103..534f7dac7 100644
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@ public class SaslInputStream extends InputStream {
byte[] inBuf = new byte[1];
int count = read(inBuf, 0, 1);
if (count > 0) {
- return inBuf[0];
+ return inBuf[0] & 0xff;
} else {
return -1;
}
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
index a3f6a11aa..0955bdffe 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -535,7 +535,12 @@ public final class Utils {
p1.setMaximumPacketSize(p.getMaximumPacketSize());
// JDK 8 EXCL END
p1.setEndpointIdentificationAlgorithm(p.getEndpointIdentificationAlgorithm());
- p1.setNeedClientAuth(p.getNeedClientAuth());
+ if (p.getNeedClientAuth()) {
+ p1.setNeedClientAuth(true);
+ }
+ if (p.getWantClientAuth()) {
+ p1.setWantClientAuth(true);
+ }
String[] protocols = p.getProtocols();
if (protocols != null) {
p1.setProtocols(protocols.clone());
@@ -543,7 +548,6 @@ public final class Utils {
p1.setSNIMatchers(p.getSNIMatchers());
p1.setServerNames(p.getServerNames());
p1.setUseCipherSuitesOrder(p.getUseCipherSuitesOrder());
- p1.setWantClientAuth(p.getWantClientAuth());
return p1;
}
diff --git a/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c b/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c
index d6e1712a2..cc9e8c3cb 100644
--- a/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c
+++ b/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -197,7 +197,10 @@ gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) {
return GSS_C_NO_CHANNEL_BINDINGS;
}
- cb = malloc(sizeof(struct gss_channel_bindings_struct));
+ // initialize cb as zeroes to avoid uninitialized pointer being
+ // freed when deleteGSSCB is called at cleanup.
+ cb = calloc(1, sizeof(struct gss_channel_bindings_struct));
+
if (cb == NULL) {
throwOutOfMemoryError(env,NULL);
return NULL;
@@ -217,9 +220,6 @@ gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) {
cb->initiator_addrtype = GSS_C_AF_NULLADDR;
cb->acceptor_addrtype = GSS_C_AF_NULLADDR;
}
- // addresses needs to be initialized to empty
- memset(&cb->initiator_address, 0, sizeof(cb->initiator_address));
- memset(&cb->acceptor_address, 0, sizeof(cb->acceptor_address));
/* set up initiator address */
jinetAddr = (*env)->CallObjectMethod(env, jcb,
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
index 2561ae38f..bafbdb5a6 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
@@ -554,7 +554,6 @@ public class Annotate {
if (expectedElementType.hasTag(ARRAY)) {
return getAnnotationArrayValue(expectedElementType, tree, env);
-
}
//error recovery
@@ -706,11 +705,15 @@ public class Annotate {
}
JCNewArray na = (JCNewArray)tree;
+ List<JCExpression> elems = na.elems;
if (na.elemtype != null) {
log.error(na.elemtype.pos(), Errors.NewNotAllowedInAnnotation);
+ if (elems == null) {
+ elems = List.nil();
+ }
}
ListBuffer<Attribute> buf = new ListBuffer<>();
- for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
+ for (List<JCExpression> l = elems; l.nonEmpty(); l = l.tail) {
buf.append(attributeAnnotationValue(types.elemtype(expectedElementType),
l.head,
env));
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
index d5400cdd8..7fd883ace 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
@@ -1074,7 +1074,10 @@ public class DeferredAttr extends JCTree.Visitor {
boolean isLambdaOrMemberRef =
dt.tree.hasTag(REFERENCE) || dt.tree.hasTag(LAMBDA);
boolean needsRecoveryType =
- pt == null || (isLambdaOrMemberRef && !types.isFunctionalInterface(pt));
+ pt == null ||
+ ((dt instanceof ArgumentAttr.ArgumentType<?> at) &&
+ at.speculativeTypes.values().stream().allMatch(type -> type.hasTag(ERROR))) ||
+ (isLambdaOrMemberRef && !types.isFunctionalInterface(pt));
Type ptRecovery = needsRecoveryType ? Type.recoveryType: pt;
dt.check(attr.new RecoveryInfo(deferredAttrContext, ptRecovery) {
@Override
diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java
index d12244337..f3c7fdf99 100644
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1483,7 +1483,12 @@ final class NativeKeyHolder {
// destroy
this.keyID = 0;
- this.ref.removeNativeKey();
+ try {
+ this.ref.removeNativeKey();
+ } finally {
+ // prevent enqueuing SessionKeyRef until removeNativeKey is done
+ Reference.reachabilityFence(this);
+ }
} else {
if (cnt < 0) {
// should never happen as we start count at 1 and pair get/release calls
diff --git a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java
index b119a0045..fafcce1c4 100644
--- a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java
+++ b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@ import sun.jvmstat.monitor.event.HostListener;
* @see HostListener
*/
public abstract class MonitoredHost {
- private static Map<HostIdentifier, MonitoredHost> monitoredHosts =
+ private static final Map<HostIdentifier, MonitoredHost> monitoredHosts =
new HashMap<HostIdentifier, MonitoredHost>();
/*
@@ -133,13 +133,6 @@ public abstract class MonitoredHost {
return getMonitoredHost(hostId);
}
-
- /*
- * Load the MonitoredHostServices
- */
- private static ServiceLoader<MonitoredHostService> monitoredHostServiceLoader =
- ServiceLoader.load(MonitoredHostService.class, MonitoredHostService.class.getClassLoader());
-
/**
* Factory method to construct a MonitoredHost instance to manage the
* connection to the host indicated by {@code hostId}.
@@ -167,9 +160,12 @@ public abstract class MonitoredHost {
hostId = resolveHostId(hostId);
- for (MonitoredHostService mhs : monitoredHostServiceLoader) {
+ ServiceLoader<MonitoredHostService> services = ServiceLoader.load(
+ MonitoredHostService.class, MonitoredHostService.class.getClassLoader());
+ for (MonitoredHostService mhs : services) {
if (mhs.getScheme().equals(hostId.getScheme())) {
mh = mhs.getMonitoredHost(hostId);
+ break;
}
}
diff --git a/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyOfRangeGuards.java b/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyOfRangeGuards.java
new file mode 100644
index 000000000..e5886d700
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/arraycopy/TestArrayCopyOfRangeGuards.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8323682
+ * @summary Test that the appropriate guards are generated for the copyOfRange
+ * intrinsic, even if the result of the array copy is not used.
+ *
+ * @run main/othervm -XX:-TieredCompilation
+ * -XX:CompileCommand=compileonly,compiler.arraycopy.TestArrayCopyOfRangeGuards::test
+ * -Xbatch
+ * compiler.arraycopy.TestArrayCopyOfRangeGuards
+ */
+
+package compiler.arraycopy;
+
+import java.util.Arrays;
+
+public class TestArrayCopyOfRangeGuards {
+ static int counter = 0;
+
+ public static void main(String[] args) {
+ Object[] array = new Object[10];
+ for (int i = 0; i < 50_000; i++) {
+ test(array);
+ }
+ if (counter != 50_000) {
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ static void test(Object[] array) {
+ try {
+ Arrays.copyOfRange(array, 15, 20, Object[].class);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // Expected
+ counter++;
+ }
+ }
+}
diff --git a/test/hotspot/jtreg/compiler/predicates/TestCountedLoopMinJintStride.java b/test/hotspot/jtreg/compiler/predicates/TestCountedLoopMinJintStride.java
new file mode 100644
index 000000000..62bfc60cc
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/predicates/TestCountedLoopMinJintStride.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2024, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8328822
+ * @summary C2: "negative trip count?" assert failure in profile predicate code
+ * @run main/othervm -XX:-BackgroundCompilation TestCountedLoopMinJintStride
+ */
+
+import java.util.Objects;
+
+public class TestCountedLoopMinJintStride {
+ public static void main(String[] args) {
+ for (int i = 0; i < 20_000; i++) {
+ test1(Integer.MAX_VALUE-1, Integer.MAX_VALUE, 0);
+ testHelper1(100, -1, Integer.MAX_VALUE, 0);
+ test2(Integer.MAX_VALUE-1, Integer.MAX_VALUE, 0);
+ testHelper2(100, -1, Integer.MAX_VALUE, 0);
+ }
+ }
+
+ private static void test1(int stop, int range, int start) {
+ testHelper1(stop, Integer.MIN_VALUE, range, start);
+ }
+
+ private static void testHelper1(int stop, int stride, int range, int start) {
+ for (int i = stop; i >= start; i += stride) {
+ Objects.checkIndex(i, range);
+ }
+ }
+
+ private static void test2(int stop, int range, int start) {
+ testHelper1(stop, Integer.MIN_VALUE, range, start);
+ }
+
+ private static void testHelper2(int stop, int stride, int range, int start) {
+ for (int i = stop; i >= start; i += stride) {
+ if (i < 0 || i >= range) {
+ throw new RuntimeException("out of bounds");
+ }
+ }
+ }
+}
diff --git a/test/hotspot/jtreg/compiler/splitif/TestSplitDivThroughPhiWithControl.java b/test/hotspot/jtreg/compiler/splitif/TestSplitDivThroughPhiWithControl.java
new file mode 100644
index 000000000..28e4db334
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/splitif/TestSplitDivThroughPhiWithControl.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test id=normal
+ * @bug 8323101
+ * @summary Test split_thru_phi with pinned divisions/modulo that have phi as inputs.
+ * @run main/othervm -Xbatch
+ * -XX:CompileCommand=compileonly,compiler.splitif.TestSplitDivThroughPhiWithControl::*
+ * compiler.splitif.TestSplitDivThroughPhiWithControl
+ */
+
+/*
+ * @test id=fuzzer
+ * @bug 8323101
+ * @summary Test split_thru_phi with pinned divisions/modulo that have phi as inputs.
+ * @run main/othervm -Xbatch -XX:PerMethodTrapLimit=0
+ * -XX:CompileCommand=compileonly,compiler.splitif.TestSplitDivThroughPhiWithControl::*
+ * compiler.splitif.TestSplitDivThroughPhiWithControl
+ */
+
+package compiler.splitif;
+
+public class TestSplitDivThroughPhiWithControl {
+ static int divisorInt = 34;
+ static int iFld;
+ static int x;
+ static int y;
+ static long divisorLong = 34L;
+ static long lFld;
+ static long lFld2;
+ static long lFld3;
+ static boolean flag;
+
+ static int[] iArr = new int[400];
+
+ public static void main(String[] strArr) {
+ iArr[0] = 52329;
+ for (int i = 0; i < 10000; i++) {
+ flag = i % 3 == 0; // Avoid unstable if trap
+ divisorInt = i % 2 == 0 ? 0 : 23; // Avoid div by zero trap
+ divisorLong = divisorInt; // Avoid div by zero trap
+ try {
+ testIntDiv();
+ } catch (ArithmeticException e) {
+ // Expected.
+ }
+
+ try {
+ testIntMod();
+ } catch (ArithmeticException e) {
+ // Expected.
+ }
+
+ try {
+ testLongDiv(); // Currently does not trigger due to JDK-8323652
+ } catch (ArithmeticException e) {
+ // Expected.
+ }
+
+ try {
+ testLongMod(); // Currently does not trigger due to JDK-8323652
+ } catch (ArithmeticException e) {
+ // Expected.
+ }
+
+ testFuzzer();
+ }
+ }
+
+ static void testIntDiv() {
+ int a;
+
+ for (int j = 0; j < 100; j++) {
+ y += 5;
+ int sub = j - 3; // AddI
+ int div = (sub / divisorInt); // DivI with AddI input
+
+ if (flag) {
+ a = y;
+ } else {
+ a = 2;
+ }
+ // Region
+
+ // Use StoreI with AddI input. Store needs to be split through Region in Split-If which is done together
+ // with AddI.
+ iFld = sub;
+
+ if (a < 3) { // If that's split in Split-If
+ // Use of DivI -> after Split-If, DivI gets a Phi input that merges the split AddI nodes.
+ // -> triggers assert that we should not find pinned div nodes in cannot_split_division().
+ x = div;
+ }
+ }
+ }
+
+ // Same as testIntDiv() but with ModI
+ static void testIntMod() {
+ int a;
+
+ for (int j = 0; j < 100; j++) {
+ y += 5;
+ int sub = j - 3;
+ int mod = (sub % divisorInt);
+
+ if (flag) {
+ a = y;
+ } else {
+ a = 2;
+ }
+
+ iFld = sub;
+
+ if (a < 3) {
+ x = mod; // Only StoreI visited first but not mod since it's an input
+ }
+ }
+ }
+
+ // Same as testIntDiv() but with DivL
+ static void testLongDiv() {
+ long a;
+
+ for (int j = 0; j < 100; j++) {
+ y += 5;
+ long sub = j - 3;
+ long div = (sub / divisorLong);
+
+ if (flag) {
+ a = lFld2;
+ } else {
+ a = 2;
+ }
+
+ lFld = sub;
+
+ if (a < 3) {
+ lFld3 = div;
+ }
+ }
+ }
+
+
+ // Same as testIntDiv() but with ModL
+ static void testLongMod() {
+ long a;
+
+ for (long j = 0; j < 100; j++) {
+ lFld2 += 5;
+ long sub = j - 3;
+ long mod = (sub % divisorLong);
+
+ if (flag) {
+ a = lFld2;
+ } else {
+ a = 2;
+ }
+
+ lFld = sub;
+
+ if (a < 3) {
+ lFld3 = mod; // Only StoreI visited first but not mod since it's an input
+ }
+ }
+ }
+
+ // Original fuzzer crash
+ static void testFuzzer() {
+ int i19, i21 = 4928, i23 = 14;
+ for (int i = 5; i < 100; i++) {
+ i19 = i23;
+ int j = 1;
+ while (true) {
+ try {
+ i21 = (iArr[0] / 34);
+ i23 = (j % i21);
+ } catch (ArithmeticException a_e) {
+ }
+ iArr = iArr;
+ iFld = i21;
+ iArr[1] += 5;
+ if (j == 1000) {
+ break;
+ }
+ j++;
+ }
+ }
+ }
+}
diff --git a/test/hotspot/jtreg/containers/docker/TestContainerInfo.java b/test/hotspot/jtreg/containers/docker/TestContainerInfo.java
new file mode 100644
index 000000000..dadc262cd
--- /dev/null
+++ b/test/hotspot/jtreg/containers/docker/TestContainerInfo.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2024, Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @summary Test container info for cgroup v2
+ * @requires docker.support
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * java.management
+ * jdk.jartool/sun.tools.jar
+ * @build CheckContainerized jdk.test.whitebox.WhiteBox PrintContainerInfo
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar whitebox.jar jdk.test.whitebox.WhiteBox
+ * @run driver TestContainerInfo
+ */
+import jtreg.SkippedException;
+import jdk.test.lib.containers.docker.Common;
+import jdk.test.lib.containers.docker.DockerTestUtils;
+import jdk.test.lib.containers.docker.DockerRunOptions;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+
+public class TestContainerInfo {
+ private static final String imageName = Common.imageName("container-info");
+
+ public static void main(String[] args) throws Exception {
+ if (!DockerTestUtils.canTestDocker()) {
+ return;
+ }
+
+ Common.prepareWhiteBox();
+ DockerTestUtils.buildJdkContainerImage(imageName);
+
+ try {
+ testPrintContainerInfoWithoutSwap();
+ } finally {
+ DockerTestUtils.removeDockerImage(imageName);
+ }
+ }
+
+ private static void testPrintContainerInfoWithoutSwap() throws Exception {
+ Common.logNewTestCase("Test print_container_info() - without swap");
+
+ DockerRunOptions opts = Common.newOpts(imageName, "PrintContainerInfo")
+ .addDockerOpts("--memory=500m")
+ .addDockerOpts("--memory-swap=500m"); // no swap
+ Common.addWhiteBoxOpts(opts);
+
+ OutputAnalyzer out = Common.run(opts);
+ checkContainerInfo(out);
+ }
+
+ private static void shouldMatchWithValue(OutputAnalyzer output, String match, String value) {
+ output.shouldContain(match);
+ String str = output.getOutput();
+ for (String s : str.split(System.lineSeparator())) {
+ if (s.contains(match)) {
+ if (!s.contains(value)) {
+ throw new RuntimeException("memory_swap_current_in_bytes NOT " + value + "! Line was : " + s);
+ }
+ }
+ }
+ }
+
+ private static void checkContainerInfo(OutputAnalyzer out) throws Exception {
+ String str = out.getOutput();
+ if (str.contains("cgroupv2")) {
+ shouldMatchWithValue(out, "memory_swap_max_limit_in_bytes", "0");
+ shouldMatchWithValue(out, "memory_swap_current_in_bytes", "0");
+ } else {
+ throw new SkippedException("This test is cgroups v2 specific, skipped on cgroups v1");
+ }
+ }
+}
diff --git a/test/jdk/java/awt/image/BufferedImage/SetData.java b/test/jdk/java/awt/image/BufferedImage/SetData.java
new file mode 100644
index 000000000..5085df5ea
--- /dev/null
+++ b/test/jdk/java/awt/image/BufferedImage/SetData.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Point;
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
+import java.awt.image.BandedSampleModel;
+import java.awt.image.BufferedImage;
+import java.awt.image.ComponentColorModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.DataBufferFloat;
+import java.awt.image.DataBufferInt;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.util.Arrays;
+
+/**
+ * @test
+ * @author Martin Desruisseaux
+ */
+public final class SetData {
+ private static final int WIDTH = 3, HEIGHT = 2;
+
+ private static final int TRANSLATE_X = -2, TRANSLATE_Y = -3;
+
+ public static void main(final String[] args) {
+ testWithIntegers();
+ testWithFloats();
+ testTranslatedSource();
+ }
+
+ private static void testWithIntegers() {
+ var data = new int[] {4, 8, 2, 7, 9, 1};
+ var empty = new DataBufferInt(WIDTH*HEIGHT);
+ var buffer = new DataBufferInt(data, WIDTH*HEIGHT);
+ buffer = (DataBufferInt) writeAndRead(buffer, empty);
+ if (!Arrays.equals(data, buffer.getData())) {
+ throw new AssertionError("Pixel values are not equal.");
+ }
+ }
+
+ private static void testWithFloats() {
+ var data = new float[] {0.4f, 0.8f, 0.2f, 0.7f, 0.9f, 0.1f};
+ var empty = new DataBufferFloat(WIDTH*HEIGHT);
+ var buffer = new DataBufferFloat(data, WIDTH*HEIGHT);
+ buffer = (DataBufferFloat) writeAndRead(buffer, empty);
+ if (!Arrays.equals(data, buffer.getData())) {
+ throw new AssertionError("Pixel values are not equal.");
+ }
+ }
+
+ private static DataBuffer writeAndRead(DataBuffer buffer, DataBuffer empty) {
+ /*
+ * Prepare an image with all pixels initialized to zero.
+ */
+ var dt = buffer.getDataType();
+ var cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
+ var cm = new ComponentColorModel(cs, false, false, Transparency.OPAQUE, dt);
+ var sm = new BandedSampleModel(dt, WIDTH, HEIGHT, 1);
+ var wr = Raster.createWritableRaster(sm, empty, null);
+ var im = new BufferedImage(cm, wr, false, null);
+ /*
+ * Write data provided by the data buffer.
+ */
+ wr = Raster.createWritableRaster(sm, buffer, null);
+ im.setData(wr);
+ return im.getRaster().getDataBuffer();
+ }
+
+ private static void testTranslatedSource() {
+ var source = WritableRaster.createBandedRaster(
+ DataBuffer.TYPE_BYTE,
+ WIDTH - TRANSLATE_X + 2,
+ HEIGHT - TRANSLATE_Y + 1, 1,
+ new Point(TRANSLATE_X, TRANSLATE_Y));
+
+ for (int y=0; y<HEIGHT; y++) {
+ for (int x=0; x<WIDTH; x++) {
+ source.setSample(x, y, 0, (y+1)*10 + (x+1));
+ }
+ }
+ var expected = new byte[] {
+ 11, 12, 13,
+ 21, 22, 23
+ };
+ var im = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_BYTE_GRAY);
+ im.setData(source);
+ var actual = ((DataBufferByte) im.getRaster().getDataBuffer()).getData();
+ if (!Arrays.equals(expected, actual)) {
+ throw new AssertionError("Pixel values are not equal.");
+ }
+ }
+}
diff --git a/test/jdk/java/net/httpclient/HttpClientBuilderTest.java b/test/jdk/java/net/httpclient/HttpClientBuilderTest.java
index 121793014..ef43ec8b9 100644
--- a/test/jdk/java/net/httpclient/HttpClientBuilderTest.java
+++ b/test/jdk/java/net/httpclient/HttpClientBuilderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* 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,6 +55,7 @@ import static org.testng.Assert.*;
/*
* @test
+ * @bug 8326233
* @summary HttpClient[.Builder] API and behaviour checks
* @library /test/lib
* @build jdk.test.lib.net.SimpleSSLContext
@@ -205,6 +206,22 @@ public class HttpClientBuilderTest {
builder.sslParameters(c);
c.setProtocols(new String[] { "D" });
assertTrue(builder.build().sslParameters().getProtocols()[0].equals("C"));
+ // test defaults for needClientAuth and wantClientAuth
+ builder.sslParameters(new SSLParameters());
+ assertFalse(builder.build().sslParameters().getNeedClientAuth(),"needClientAuth() was expected to be false");
+ assertFalse(builder.build().sslParameters().getWantClientAuth(),"wantClientAuth() was expected to be false");
+ // needClientAuth = true and thus wantClientAuth = false
+ SSLParameters needClientAuthParams = new SSLParameters();
+ needClientAuthParams.setNeedClientAuth(true);
+ builder.sslParameters(needClientAuthParams);
+ assertTrue(builder.build().sslParameters().getNeedClientAuth(),"needClientAuth() was expected to be true");
+ assertFalse(builder.build().sslParameters().getWantClientAuth(),"wantClientAuth() was expected to be false");
+ // wantClientAuth = true and thus needClientAuth = false
+ SSLParameters wantClientAuthParams = new SSLParameters();
+ wantClientAuthParams.setWantClientAuth(true);
+ builder.sslParameters(wantClientAuthParams);
+ assertTrue(builder.build().sslParameters().getWantClientAuth(),"wantClientAuth() was expected to be true");
+ assertFalse(builder.build().sslParameters().getNeedClientAuth(),"needClientAuth() was expected to be false");
}
@Test
diff --git a/test/jdk/java/nio/charset/Charset/AliasesCopy.java b/test/jdk/java/nio/charset/Charset/AliasesCopy.java
new file mode 100644
index 000000000..66ee830c5
--- /dev/null
+++ b/test/jdk/java/nio/charset/Charset/AliasesCopy.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8319817
+ * @summary Check that aliases cannot be mutated
+ * @run junit AliasesCopy
+ */
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.util.Set;
+
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertIterableEquals;
+
+public class AliasesCopy {
+ private static final Set<String> ALIASES_SET = Set.of("foo-alias");
+ private static final String[] ALIASES_ARRAY = ALIASES_SET.toArray(String[]::new);
+
+ @Test
+ public void aliasesCopy() {
+ final FooCharset cs = new FooCharset(ALIASES_ARRAY);
+ ALIASES_ARRAY[0] = "bar-alias";
+ assertIterableEquals(ALIASES_SET, cs.aliases());
+ }
+
+ private static final class FooCharset extends Charset {
+ private FooCharset(String[] aliases) {
+ super("foo", aliases);
+ }
+
+ @Override
+ public CharsetEncoder newEncoder() {
+ throw new RuntimeException("not implemented");
+ }
+
+ @Override
+ public CharsetDecoder newDecoder() {
+ throw new RuntimeException("not implemented");
+ }
+
+ @Override
+ public boolean contains(Charset cs) {
+ throw new RuntimeException("not implemented");
+ }
+ }
+}
diff --git a/test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java b/test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java
new file mode 100644
index 000000000..1b82e2f73
--- /dev/null
+++ b/test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+
+import javax.sound.midi.MidiSystem;
+import javax.sound.midi.Sequence;
+import javax.sound.midi.Track;
+
+/**
+ * @test
+ * @bug 8319598
+ * @summary SMFParser bug with running status, interrupted by Meta or SysEx messages
+ */
+public class SMFInterruptedRunningStatus {
+
+ public static void main(String[] args) throws Exception {
+
+ byte[][] files = new byte[][] {SMF_1, SMF_2, SMF_3};
+ for (int i = 0; i < files.length; i++) {
+ Sequence seq = MidiSystem.getSequence(
+ new ByteArrayInputStream(files[i]));
+ testSequence(seq, i + 1);
+ }
+
+ // no exception thrown, all files have been parsed correctly
+ System.out.println("Test passed");
+ }
+
+ private static void testSequence(Sequence seq, int fileNumber) {
+
+ // check number of tracks and number of events
+ Track[] tracks = seq.getTracks();
+ if (1 != tracks.length) {
+ throw new RuntimeException("file number "
+ + fileNumber + " fails (incorrect number of tracks: "
+ + tracks.length + ")");
+ }
+ Track track = tracks[0];
+ if (7 != track.size()) {
+ throw new RuntimeException("file number " + fileNumber
+ + " fails (incorrect number of events: "
+ + track.size() + ")");
+ }
+
+ // check status byte of each message
+ int[] expectedStatusBytes = new int[] {
+ 0x90, 0xFF, 0x90, 0x90, 0x90, 0xFF, 0xFF};
+ for (int i = 0; i < expectedStatusBytes.length; i++) {
+ int expected = expectedStatusBytes[i];
+ if (expected != track.get(i).getMessage().getStatus()) {
+ throw new RuntimeException("file number " + fileNumber
+ + " fails (wrong status byte in event " + i + ")");
+ }
+ }
+ }
+
+ // MIDI file without running status - should work equally before
+ // and after the bugfix
+ private static final byte[] SMF_1 = {
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x24, // track header
+ 0x00, // delta time
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
+ 0x40, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x20, // delta time
+ (byte) 0x90, 0x3C, 0x00, // Note-OFF (C)
+ 0x20, // delta time
+ (byte) 0x90, 0x3E, 0x7F, // Note-ON (D)
+ 0x60, // delta time
+ (byte) 0x90, 0x3E, 0x00, // Note-OFF (D)
+ 0x20, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x00, // delta time
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
+ };
+
+ // MIDI file with running status, interrupted by a META message
+ // - failed before the bugfix
+ private static final byte[] SMF_2 = {
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x21, // track header
+ 0x00, // delta time
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
+ 0x40, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (interruptor)
+ 0x20, // delta time
+ 0x3C, 0x00, // Note-OFF (C) - running status
+ 0x20, // delta time
+ 0x3E, 0x7F, // Note-ON (D) - running status
+ 0x60, // delta time
+ 0x3E, 0x00, // Note-OFF (D) - running status
+ 0x20, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x00, // delta time
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
+ };
+
+ // MIDI file with running status, interrupted by a META message
+ // - succeeded before the bugfix but with wrong interpretation of the data
+ private static final byte[] SMF_3 = {
+ 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, // file header (start)
+ 0x00, 0x01, 0x00, 0x01, 0x00, (byte) 0x80, // file header (end)
+ 0x4D, 0x54, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x21, // track header
+ 0x00, // delta time
+ (byte) 0x90, 0x3C, 0x7F, // Note-ON (C)
+ 0x40, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (interruptor)
+ 0x20, // delta time
+ 0x3C, 0x00, // Note-OFF (C) - running status
+ 0x0D, // delta time
+ 0x3E, 0x7F, // Note-ON (D) - running status
+ 0x60, // delta time
+ 0x3E, 0x00, // Note-OFF (D) - running status
+ 0x20, // delta time
+ (byte) 0xFF, 0x01, 0x04, 0x54, 0x65, 0x73, 0x74, // META (text)
+ 0x00, // delta time
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
+ };
+}
diff --git a/test/jdk/javax/swing/JComboBox/ComboPopupBug.java b/test/jdk/javax/swing/JComboBox/ComboPopupBug.java
new file mode 100644
index 000000000..830216f0d
--- /dev/null
+++ b/test/jdk/javax/swing/JComboBox/ComboPopupBug.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * 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 javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+/*
+ * @test
+ * @bug 8322754
+ * @summary Verifies clicking JComboBox during frame closure causes Exception
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual ComboPopupBug
+ */
+
+public class ComboPopupBug {
+ private static final String instructionsText = """
+ This test is used to verify that clicking on JComboBox
+ when frame containing it is about to close should not
+ cause IllegalStateException.
+ A JComboBox is shown with Close button at the bottom.
+ Click on Close and then click on JComboBox arrow button
+ to try to show combobox popup.
+ If IllegalStateException is thrown, test will automatically Fail
+ otherwise click Pass. """;
+
+ public static void main(String[] args) throws Exception {
+ PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ .title("ComboPopup Instructions")
+ .instructions(instructionsText)
+ .testTimeOut(5)
+ .rows(10)
+ .columns(35)
+ .build();
+
+ SwingUtilities.invokeAndWait(() -> {
+ JFrame frame = new JFrame("ComboPopup");
+
+ JComboBox cb = new JComboBox();
+ cb.setEditable(true);
+ cb.addItem("test");
+ cb.addItem("test2");
+ cb.addItem("test3");
+ frame.getContentPane().add(cb, "North");
+
+ JButton b = new JButton("Close");
+ b.addActionListener(
+ (e)->{
+ try {
+ Thread.sleep(3000);
+ }
+ catch (Exception ex) {
+ }
+ frame.setVisible(false);
+
+ });
+ frame.getContentPane().add(b, "South");
+ frame.setSize(200, 200);
+
+ PassFailJFrame.addTestWindow(frame);
+ PassFailJFrame.positionTestWindow(frame,
+ PassFailJFrame.Position.HORIZONTAL);
+
+ frame.setVisible(true);
+ });
+
+ passFailJFrame.awaitAndCheck();
+ }
+}
diff --git a/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java b/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java
new file mode 100644
index 000000000..a6049f6a0
--- /dev/null
+++ b/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * 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.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import sun.jvmstat.monitor.MonitoredHost;
+import sun.jvmstat.monitor.VmIdentifier;
+
+/*
+ * @test
+ * @bug 8320687
+ * @summary verify that sun.jvmstat.monitor.MonitoredHost.getMonitoredHost() doesn't
+ * unexpectedly throw an exception when invoked by concurrent threads
+ *
+ * @run main/othervm ConcurrentGetMonitoredHost
+ */
+public class ConcurrentGetMonitoredHost {
+
+ /*
+ * Launches multiple concurrent threads and invokes MonitoredHost.getMonitoredHost()
+ * in each of these threads and expects the call to return successfully without any
+ * exceptions.
+ */
+ public static void main(final String[] args) throws Exception {
+ final String pidStr = "12345";
+ final VmIdentifier vmid = new VmIdentifier(pidStr);
+ final int numTasks = 100;
+ final List<Task> tasks = new ArrayList<>();
+ for (int i = 0; i < numTasks; i++) {
+ tasks.add(new Task(vmid));
+ }
+ System.out.println("Submitting " + numTasks + " concurrent tasks to" +
+ " get MonitoredHost for " + vmid);
+ ExecutorService executor = Executors.newCachedThreadPool();
+ // wait for all tasks to complete
+ final List<Future<MonitoredHost>> results = executor.invokeAll(tasks);
+ // verify each one successfully completed and each of
+ // the returned MonitoredHost is not null
+ for (final Future<MonitoredHost> result : results) {
+ final MonitoredHost mh = result.get();
+ if (mh == null) {
+ throw new AssertionError("MonitoredHost.getMonitoredHost() returned" +
+ " null for vmid " + vmid);
+ }
+ }
+
+ System.out.println("All " + numTasks + " completed successfully");
+ }
+
+ // a task which just calls MonitoredHost.getMonitoredHost(VmIdentifier) and
+ // returns the resultant MonitoredHost
+ private static final class Task implements Callable<MonitoredHost> {
+ private final VmIdentifier vmid;
+
+ private Task(final VmIdentifier vmid) {
+ this.vmid = Objects.requireNonNull(vmid);
+ }
+
+ @Override
+ public MonitoredHost call() throws Exception {
+ return MonitoredHost.getMonitoredHost(this.vmid);
+ }
+ }
+}
diff --git a/test/jdk/sun/security/jca/NullPreferredList.java b/test/jdk/sun/security/jca/NullPreferredList.java
new file mode 100644
index 000000000..0a8cf7344
--- /dev/null
+++ b/test/jdk/sun/security/jca/NullPreferredList.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * 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.*;
+
+/**
+ * @test
+ * @bug 8328864
+ * @summary Test that ProviderList.getService checks configs when
+ * ProviderList.getProvider fails for preferred providers.
+ * @run main/othervm
+ * -Djava.security.properties=${test.src}/app-security.properties NullPreferredList
+ */
+
+public class NullPreferredList {
+
+ public static void main(final String[] args) throws Exception {
+ final KeyStore ks = KeyStore.getInstance("PKCS12");
+ System.out.println("Got keystore " + ks);
+ }
+}
diff --git a/test/jdk/sun/security/jca/app-security.properties b/test/jdk/sun/security/jca/app-security.properties
new file mode 100644
index 000000000..1f15a7797
--- /dev/null
+++ b/test/jdk/sun/security/jca/app-security.properties
@@ -0,0 +1 @@
+jdk.security.provider.preferred=KeyStore.PKCS12:NonExistingProvider
diff --git a/test/langtools/tools/javac/T8320144.java b/test/langtools/tools/javac/T8320144.java
new file mode 100644
index 000000000..6bd3c4ab6
--- /dev/null
+++ b/test/langtools/tools/javac/T8320144.java
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8320144
+ * @summary Compilation crashes when a custom annotation with invalid default value is used
+ * @compile/fail/ref=T8320144.out -XDrawDiagnostics T8320144.java
+ */
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+public class T8320144 {
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE})
+ public @interface TestAnnotation {
+ public String[] excludeModules() default new String[0];
+ public String[] value() default new String[] { 3 };
+ }
+}
diff --git a/test/langtools/tools/javac/T8320144.out b/test/langtools/tools/javac/T8320144.out
new file mode 100644
index 000000000..cb09e379c
--- /dev/null
+++ b/test/langtools/tools/javac/T8320144.out
@@ -0,0 +1,4 @@
+T8320144.java:16:54: compiler.err.new.not.allowed.in.annotation
+T8320144.java:17:45: compiler.err.new.not.allowed.in.annotation
+T8320144.java:17:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
+3 errors
diff --git a/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java
new file mode 100644
index 000000000..4520a01f7
--- /dev/null
+++ b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java
@@ -0,0 +1,29 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 8320948
+ * @summary NPE due to unreported compiler error
+ * @compile/fail/ref=CrashDueToUnreportedError.out -XDrawDiagnostics CrashDueToUnreportedError.java
+ */
+
+import java.util.List;
+
+public class CrashDueToUnreportedError {
+ class Builder {
+ private Builder(Person person, String unused) {}
+ public Builder withTypes(Entity<String> entities) {
+ return new Builder(Person.make(Entity.combineAll(entities)));
+ }
+ }
+
+ interface Person {
+ static <E> Person make(List<? extends Entity<E>> eventSubtypes) {
+ return null;
+ }
+ }
+
+ class Entity<E> {
+ public static <Root> List<? extends Entity<Root>> combineAll(Entity<Root> subtypes) {
+ return null;
+ }
+ }
+}
diff --git a/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out
new file mode 100644
index 000000000..83655eb07
--- /dev/null
+++ b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out
@@ -0,0 +1,2 @@
+CrashDueToUnreportedError.java:14:43: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: E,compiler.misc.type.captureof: 1, ? extends CrashDueToUnreportedError.Entity<Root>,Root, (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 2, ? extends CrashDueToUnreportedError.Entity<Root>>, java.util.List<? extends CrashDueToUnreportedError.Entity<java.lang.Object>>))
+1 error
--
2.19.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gaoxiang90/openjdk-17.git
git@gitee.com:gaoxiang90/openjdk-17.git
gaoxiang90
openjdk-17
openjdk-17
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385