Skip to content

Commit 3a72f86

Browse files
authored
Merge branch 'master' into goetz_backport_8356187
2 parents 9cc8bbd + c1fdf82 commit 3a72f86

File tree

137 files changed

+5172
-1322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+5172
-1322
lines changed

.github/workflows/build-cross-compile.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,33 +60,33 @@ jobs:
6060
gnu-arch: aarch64
6161
debian-arch: arm64
6262
debian-repository: https://httpredir.debian.org/debian/
63-
debian-version: bookworm
63+
debian-version: trixie
6464
tolerate-sysroot-errors: false
6565
- target-cpu: arm
6666
gnu-arch: arm
6767
debian-arch: armhf
6868
debian-repository: https://httpredir.debian.org/debian/
69-
debian-version: bookworm
69+
debian-version: trixie
7070
tolerate-sysroot-errors: false
7171
gnu-abi: eabihf
7272
- target-cpu: s390x
7373
gnu-arch: s390x
7474
debian-arch: s390x
7575
debian-repository: https://httpredir.debian.org/debian/
76-
debian-version: bookworm
76+
debian-version: trixie
7777
tolerate-sysroot-errors: false
7878
- target-cpu: ppc64le
7979
gnu-arch: powerpc64le
8080
debian-arch: ppc64el
8181
debian-repository: https://httpredir.debian.org/debian/
82-
debian-version: bookworm
82+
debian-version: trixie
8383
tolerate-sysroot-errors: false
8484
- target-cpu: riscv64
8585
gnu-arch: riscv64
8686
debian-arch: riscv64
8787
debian-repository: https://httpredir.debian.org/debian/
88-
debian-version: sid
89-
tolerate-sysroot-errors: true
88+
debian-version: trixie
89+
tolerate-sysroot-errors: false
9090

9191
steps:
9292
- name: 'Checkout the JDK source'

make/RunTests.gmk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ UseSpecialTestHandler = \
10551055
# Now process each test to run and setup a proper make rule
10561056
$(foreach test, $(TESTS_TO_RUN), \
10571057
$(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \
1058-
$(TR) -cs '[a-z][A-Z][0-9]\n' '[_*1000]')) \
1058+
$(TR) -cs '[a-z][A-Z][0-9]\n' '_')) \
10591059
$(eval ALL_TEST_IDS += $(TEST_ID)) \
10601060
$(if $(call UseCustomTestHandler, $(test)), \
10611061
$(eval $(call SetupRunCustomTest, $(TEST_ID), \
@@ -1135,9 +1135,9 @@ run-test-report: post-run-test
11351135
TEST TOTAL PASS FAIL ERROR " "
11361136
$(foreach test, $(TESTS_TO_RUN), \
11371137
$(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \
1138-
$(TR) -cs '[a-z][A-Z][0-9]\n' '[_*1000]')) \
1138+
$(TR) -cs '[a-z][A-Z][0-9]\n' '_')) \
11391139
$(ECHO) >> $(TEST_LAST_IDS) $(TEST_ID) $(NEWLINE) \
1140-
$(eval NAME_PATTERN := $(shell $(ECHO) $(test) | $(TR) -c '\n' '[_*1000]')) \
1140+
$(eval NAME_PATTERN := $(shell $(ECHO) $(test) | $(TR) -c '\n' '_')) \
11411141
$(if $(filter __________________________________________________%, $(NAME_PATTERN)), \
11421142
$(eval TEST_NAME := ) \
11431143
$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s\n" " " "$(test)" $(NEWLINE) \

src/hotspot/share/runtime/abstract_vm_version.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,18 @@ const char* Abstract_VM_Version::internal_vm_info_string() {
253253
#define HOTSPOT_BUILD_COMPILER "MS VC++ 17.7 (VS2022)"
254254
#elif _MSC_VER == 1938
255255
#define HOTSPOT_BUILD_COMPILER "MS VC++ 17.8 (VS2022)"
256+
#elif _MSC_VER == 1939
257+
#define HOTSPOT_BUILD_COMPILER "MS VC++ 17.9 (VS2022)"
258+
#elif _MSC_VER == 1940
259+
#define HOTSPOT_BUILD_COMPILER "MS VC++ 17.10 (VS2022)"
260+
#elif _MSC_VER == 1941
261+
#define HOTSPOT_BUILD_COMPILER "MS VC++ 17.11 (VS2022)"
262+
#elif _MSC_VER == 1942
263+
#define HOTSPOT_BUILD_COMPILER "MS VC++ 17.12 (VS2022)"
264+
#elif _MSC_VER == 1943
265+
#define HOTSPOT_BUILD_COMPILER "MS VC++ 17.13 (VS2022)"
266+
#elif _MSC_VER == 1944
267+
#define HOTSPOT_BUILD_COMPILER "MS VC++ 17.14 (VS2022)"
256268
#else
257269
#define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
258270
#endif

src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ public class AWTEventMulticaster implements
110110
TextListener, InputMethodListener, HierarchyListener,
111111
HierarchyBoundsListener, MouseWheelListener {
112112

113+
private static final int MAX_UNBALANCED_TOP_NODES = 100;
114+
113115
/**
114116
* A variable in the event chain (listener-a)
115117
*/
@@ -954,14 +956,72 @@ public static MouseWheelListener remove(MouseWheelListener l,
954956
* If listener-b is null, it returns listener-a
955957
* If neither are null, then it creates and returns
956958
* a new AWTEventMulticaster instance which chains a with b.
959+
*
957960
* @param a event listener-a
958961
* @param b event listener-b
959962
* @return the resulting listener
960963
*/
961964
protected static EventListener addInternal(EventListener a, EventListener b) {
962965
if (a == null) return b;
963966
if (b == null) return a;
964-
return new AWTEventMulticaster(a, b);
967+
AWTEventMulticaster n = new AWTEventMulticaster(a, b);
968+
if (!needsRebalance(n)) {
969+
return n;
970+
}
971+
972+
EventListener[] array = getListeners(n, EventListener.class);
973+
return rebalance(array, 0, array.length - 1);
974+
}
975+
976+
/**
977+
* Return true if the argument represents a binary tree that needs to be rebalanced.
978+
*/
979+
private static boolean needsRebalance(AWTEventMulticaster l) {
980+
int level = 0;
981+
while (true) {
982+
// The criteria for when we need a rebalance is subjective. This method checks
983+
// up to a given threshold of the topmost nodes of a AWTEventMulticaster. If
984+
// they all include one leaf node, then this method returns true. This criteria
985+
// will be met after several consecutive iterations of `addInternal(a, b)`
986+
if (++level > MAX_UNBALANCED_TOP_NODES) {
987+
return true;
988+
}
989+
if (l.a instanceof AWTEventMulticaster aMulti) {
990+
if (l.b instanceof AWTEventMulticaster) {
991+
// we reached a node where both children are AWTEventMulticaster: let's assume
992+
// the current node marks the start of a well-balanced subtree
993+
return false;
994+
}
995+
l = aMulti;
996+
} else if (l.b instanceof AWTEventMulticaster bMulti) {
997+
l = bMulti;
998+
} else {
999+
return false;
1000+
}
1001+
}
1002+
}
1003+
1004+
/**
1005+
* Recursively create a balanced tree that includes a given range of EventListeners.
1006+
*
1007+
* @param array the array of the EventListeners to consult
1008+
* @param index0 the lowest index (inclusive) that the return value must include
1009+
* @param index1 the highest index (inclusive) that the return value must include.
1010+
*
1011+
* @return a balanced tree. If index0 equals index1 then this returns an EventListener from
1012+
* the array provided. Otherwise this returns an AWTEventMulticaster.
1013+
*/
1014+
private static EventListener rebalance(EventListener[] array, int index0, int index1) {
1015+
if (index0 == index1) {
1016+
return array[index0];
1017+
}
1018+
if (index0 == index1 - 1) {
1019+
return new AWTEventMulticaster(array[index0], array[index1]);
1020+
}
1021+
int mid = (index0 + index1) / 2;
1022+
return new AWTEventMulticaster(
1023+
rebalance(array, index0, mid),
1024+
rebalance(array, mid + 1, index1));
9651025
}
9661026

9671027
/**

src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -140,10 +140,11 @@ public ICC_ColorSpace(ICC_Profile profile) {
140140
if (profileClass != ICC_Profile.CLASS_INPUT
141141
&& profileClass != ICC_Profile.CLASS_DISPLAY
142142
&& profileClass != ICC_Profile.CLASS_OUTPUT
143+
&& profileClass != ICC_Profile.CLASS_DEVICELINK
143144
&& profileClass != ICC_Profile.CLASS_COLORSPACECONVERSION
144145
&& profileClass != ICC_Profile.CLASS_NAMEDCOLOR
145146
&& profileClass != ICC_Profile.CLASS_ABSTRACT) {
146-
throw new IllegalArgumentException("Invalid profile type");
147+
throw new IllegalArgumentException("Invalid profile class");
147148
}
148149

149150
thisProfile = profile;

src/java.desktop/share/classes/java/awt/color/ICC_Profile.java

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -751,6 +751,7 @@ private interface BuiltInProfile {
751751
*/
752752
public static final int icXYZNumberX = 8;
753753

754+
private static final int HEADER_SIZE = 128;
754755

755756
/**
756757
* Constructs an {@code ICC_Profile} object with a given ID.
@@ -799,10 +800,15 @@ public static ICC_Profile getInstance(byte[] data) {
799800
ProfileDataVerifier.verify(data);
800801
Profile p;
801802
try {
803+
byte[] theHeader = new byte[HEADER_SIZE];
804+
System.arraycopy(data, 0, theHeader, 0, HEADER_SIZE);
805+
verifyHeader(theHeader);
806+
802807
p = CMSManager.getModule().loadProfile(data);
803808
} catch (CMMException c) {
804809
throw new IllegalArgumentException("Invalid ICC Profile Data");
805810
}
811+
806812
try {
807813
if (getColorSpaceType(p) == ColorSpace.TYPE_GRAY
808814
&& getData(p, icSigMediaWhitePointTag) != null
@@ -991,6 +997,10 @@ public int getProfileClass() {
991997
return info.profileClass;
992998
}
993999
byte[] theHeader = getData(icSigHead);
1000+
return getProfileClass(theHeader);
1001+
}
1002+
1003+
private static int getProfileClass(byte[] theHeader) {
9941004
int theClassSig = intFromBigEndian(theHeader, icHdrDeviceClass);
9951005
return switch (theClassSig) {
9961006
case icSigInputClass -> CLASS_INPUT;
@@ -1032,6 +1042,11 @@ private static int getColorSpaceType(Profile p) {
10321042
return iccCStoJCS(theColorSpaceSig);
10331043
}
10341044

1045+
private static int getColorSpaceType(byte[] theHeader) {
1046+
int theColorSpaceSig = intFromBigEndian(theHeader, icHdrColorSpace);
1047+
return iccCStoJCS(theColorSpaceSig);
1048+
}
1049+
10351050
/**
10361051
* Returns the color space type of the Profile Connection Space (PCS).
10371052
* Returns one of the color space type constants defined by the ColorSpace
@@ -1051,6 +1066,21 @@ public int getPCSType() {
10511066
return iccCStoJCS(thePCSSig);
10521067
}
10531068

1069+
private static int getPCSType(byte[] theHeader) {
1070+
int thePCSSig = intFromBigEndian(theHeader, icHdrPcs);
1071+
int theDeviceClass = intFromBigEndian(theHeader, icHdrDeviceClass);
1072+
1073+
if (theDeviceClass == icSigLinkClass) {
1074+
return iccCStoJCS(thePCSSig);
1075+
} else {
1076+
return switch (thePCSSig) {
1077+
case icSigXYZData -> ColorSpace.TYPE_XYZ;
1078+
case icSigLabData -> ColorSpace.TYPE_Lab;
1079+
default -> throw new IllegalArgumentException("Unexpected PCS type");
1080+
};
1081+
}
1082+
}
1083+
10541084
/**
10551085
* Write this {@code ICC_Profile} to a file.
10561086
*
@@ -1129,9 +1159,42 @@ private static byte[] getData(Profile p, int tagSignature) {
11291159
* @see #getData
11301160
*/
11311161
public void setData(int tagSignature, byte[] tagData) {
1162+
if (tagSignature == ICC_Profile.icSigHead) {
1163+
verifyHeader(tagData);
1164+
}
11321165
CMSManager.getModule().setTagData(cmmProfile(), tagSignature, tagData);
11331166
}
11341167

1168+
private static void verifyHeader(byte[] data) {
1169+
if (data == null || data.length < HEADER_SIZE) {
1170+
throw new IllegalArgumentException("Invalid header data");
1171+
}
1172+
getProfileClass(data);
1173+
getColorSpaceType(data);
1174+
getPCSType(data);
1175+
checkRenderingIntent(data);
1176+
}
1177+
1178+
private static boolean checkRenderingIntent(byte[] header) {
1179+
int index = ICC_Profile.icHdrRenderingIntent;
1180+
1181+
/* According to ICC spec, only the least-significant 16 bits shall be
1182+
* used to encode the rendering intent. The most significant 16 bits
1183+
* shall be set to zero. Thus, we are ignoring two most significant
1184+
* bytes here. Please refer ICC Spec Document for more details.
1185+
*/
1186+
int renderingIntent = ((header[index+2] & 0xff) << 8) |
1187+
(header[index+3] & 0xff);
1188+
1189+
switch (renderingIntent) {
1190+
case icPerceptual, icMediaRelativeColorimetric,
1191+
icSaturation, icAbsoluteColorimetric -> {
1192+
return true;
1193+
}
1194+
default -> throw new IllegalArgumentException("Unknown Rendering Intent");
1195+
}
1196+
}
1197+
11351198
/**
11361199
* Returns the number of color components in the "input" color space of this
11371200
* profile. For example if the color space type of this profile is

src/java.desktop/share/classes/javax/swing/JViewport.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,15 @@ public final Insets getInsets(Insets insets) {
603603

604604

605605
private Graphics getBackingStoreGraphics(Graphics g) {
606-
Graphics bsg = backingStoreImage.getGraphics();
607-
bsg.setColor(g.getColor());
608-
bsg.setFont(g.getFont());
609-
bsg.setClip(g.getClipBounds());
610-
return bsg;
606+
if (!SwingUtilities2.isPrinting(g)) {
607+
Graphics bsg = backingStoreImage.getGraphics();
608+
bsg.setColor(g.getColor());
609+
bsg.setFont(g.getFont());
610+
bsg.setClip(g.getClipBounds());
611+
return bsg;
612+
} else {
613+
return g;
614+
}
611615
}
612616

613617

src/java.desktop/share/classes/javax/swing/TablePrintable.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
282282
// dictated by the previous two assertions
283283
assert sf > 0;
284284

285+
Rectangle bounds = table.getBounds();
286+
bounds.x = bounds.y = 0;
287+
285288
// This is in a loop for two reasons:
286289
// First, it allows us to catch up in case we're called starting
287290
// with a non-zero pageIndex. Second, we know that we can be called
@@ -303,9 +306,10 @@ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
303306
// calculate the area of the table to be printed for this page
304307
findNextClip(scaledWidth, scaledHeight);
305308

306-
if (!((table.getBounds()).intersects(clip))) {
309+
if (!(bounds.intersects(clip))) {
307310
return NO_SUCH_PAGE;
308311
}
312+
309313
last++;
310314
}
311315

@@ -395,8 +399,6 @@ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
395399
// draw a box around the table
396400
g2d.setColor(Color.BLACK);
397401

398-
Rectangle bounds = table.getBounds();
399-
bounds.x = bounds.y = 0;
400402

401403
// compute the visible portion of table and draw the rect around it
402404
Rectangle visibleBounds = clip.intersection(bounds);

0 commit comments

Comments
 (0)