Skip to content

Commit 935650c

Browse files
committed
Merge master HEAD into openj9-staging
Signed-off-by: J9 Build <[email protected]>
2 parents 7c3befa + 3393a71 commit 935650c

File tree

44 files changed

+638
-403
lines changed

Some content is hidden

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

44 files changed

+638
-403
lines changed

src/java.base/share/classes/java/lang/doc-files/ValueBased.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!doctype html>
22
<!--
3-
Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
3+
Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
44
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
66
This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
2626
<html lang="en">
2727
<head>
2828
<title>Value-based Classes</title>
29-
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
3029
</head>
3130
<body>
3231
<h1 id="ValueBased">{@index "Value-based Classes"}</h1>

src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!doctype html>
22
<!--
3-
Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
3+
Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
44
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
66
This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
2626
<html lang="en">
2727
<head>
2828
<title>Java Thread Primitive Deprecation</title>
29-
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
3029
</head>
3130
<body>
3231
<h1>Java Thread Primitive Deprecation</h1>

src/java.base/share/classes/java/lang/reflect/Method.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ public final class Method extends Executable {
101101
// If this branching structure would ever contain cycles, deadlocks can
102102
// occur in annotation code.
103103
private Method root;
104+
// Hash code of this object
105+
private int hash;
104106

105107
// Generics infrastructure
106108
private String getGenericSignature() {return signature;}
@@ -387,7 +389,13 @@ public boolean equals(Object obj) {
387389
* method's declaring class name and the method's name.
388390
*/
389391
public int hashCode() {
390-
return getDeclaringClass().getName().hashCode() ^ getName().hashCode();
392+
int hc = hash;
393+
394+
if (hc == 0) {
395+
hc = hash = getDeclaringClass().getName().hashCode() ^ getName()
396+
.hashCode();
397+
}
398+
return hc;
391399
}
392400

393401
/**

src/java.base/share/classes/java/util/HexFormat.java

+20-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
2-
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2024, Alibaba Group Holding Limited. All rights reserved.
34
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45
*
56
* This code is free software; you can redistribute it and/or modify it
@@ -158,37 +159,32 @@ public final class HexFormat {
158159
* The hexadecimal characters are from lowercase alpha digits.
159160
*/
160161
private static final HexFormat HEX_FORMAT =
161-
new HexFormat("", "", "", Case.LOWERCASE);
162+
new HexFormat("", "", "", false);
162163

163164
private static final HexFormat HEX_UPPER_FORMAT =
164-
new HexFormat("", "", "", Case.UPPERCASE);
165+
new HexFormat("", "", "", true);
165166

166167
private static final byte[] EMPTY_BYTES = {};
167168

168169
private final String delimiter;
169170
private final String prefix;
170171
private final String suffix;
171-
private final Case digitCase;
172-
173-
private enum Case {
174-
LOWERCASE,
175-
UPPERCASE
176-
}
172+
private final boolean ucase;
177173

178174
/**
179175
* Returns a HexFormat with a delimiter, prefix, suffix, and array of digits.
180176
*
181177
* @param delimiter a delimiter, non-null
182178
* @param prefix a prefix, non-null
183179
* @param suffix a suffix, non-null
184-
* @param digitCase enum indicating how to case digits
180+
* @param ucase enum indicating how to case digits
185181
* @throws NullPointerException if any argument is null
186182
*/
187-
private HexFormat(String delimiter, String prefix, String suffix, Case digitCase) {
183+
private HexFormat(String delimiter, String prefix, String suffix, boolean ucase) {
188184
this.delimiter = Objects.requireNonNull(delimiter, "delimiter");
189185
this.prefix = Objects.requireNonNull(prefix, "prefix");
190186
this.suffix = Objects.requireNonNull(suffix, "suffix");
191-
this.digitCase = digitCase;
187+
this.ucase = ucase;
192188
}
193189

194190
/**
@@ -217,7 +213,7 @@ public static HexFormat of() {
217213
* @return a {@link HexFormat} with the delimiter and lowercase characters
218214
*/
219215
public static HexFormat ofDelimiter(String delimiter) {
220-
return new HexFormat(delimiter, "", "", Case.LOWERCASE);
216+
return new HexFormat(delimiter, "", "", false);
221217
}
222218

223219
/**
@@ -226,7 +222,7 @@ public static HexFormat ofDelimiter(String delimiter) {
226222
* @return a copy of this {@code HexFormat} with the delimiter
227223
*/
228224
public HexFormat withDelimiter(String delimiter) {
229-
return new HexFormat(delimiter, this.prefix, this.suffix, this.digitCase);
225+
return new HexFormat(delimiter, this.prefix, this.suffix, this.ucase);
230226
}
231227

232228
/**
@@ -236,7 +232,7 @@ public HexFormat withDelimiter(String delimiter) {
236232
* @return a copy of this {@code HexFormat} with the prefix
237233
*/
238234
public HexFormat withPrefix(String prefix) {
239-
return new HexFormat(this.delimiter, prefix, this.suffix, this.digitCase);
235+
return new HexFormat(this.delimiter, prefix, this.suffix, this.ucase);
240236
}
241237

242238
/**
@@ -246,7 +242,7 @@ public HexFormat withPrefix(String prefix) {
246242
* @return a copy of this {@code HexFormat} with the suffix
247243
*/
248244
public HexFormat withSuffix(String suffix) {
249-
return new HexFormat(this.delimiter, this.prefix, suffix, this.digitCase);
245+
return new HexFormat(this.delimiter, this.prefix, suffix, this.ucase);
250246
}
251247

252248
/**
@@ -258,7 +254,7 @@ public HexFormat withSuffix(String suffix) {
258254
public HexFormat withUpperCase() {
259255
if (this == HEX_FORMAT)
260256
return HEX_UPPER_FORMAT;
261-
return new HexFormat(this.delimiter, this.prefix, this.suffix, Case.UPPERCASE);
257+
return new HexFormat(this.delimiter, this.prefix, this.suffix, true);
262258
}
263259

264260
/**
@@ -268,7 +264,7 @@ public HexFormat withUpperCase() {
268264
* @return a copy of this {@code HexFormat} with lowercase hexadecimal characters
269265
*/
270266
public HexFormat withLowerCase() {
271-
return new HexFormat(this.delimiter, this.prefix, this.suffix, Case.LOWERCASE);
267+
return new HexFormat(this.delimiter, this.prefix, this.suffix, false);
272268
}
273269

274270
/**
@@ -306,7 +302,7 @@ public String suffix() {
306302
* otherwise {@code false}
307303
*/
308304
public boolean isUpperCase() {
309-
return digitCase == Case.UPPERCASE;
305+
return ucase;
310306
}
311307

312308
/**
@@ -436,7 +432,6 @@ private String formatOptDelimiter(byte[] bytes, int fromIndex, int toIndex) {
436432
return null;
437433
}
438434

439-
boolean ucase = digitCase == Case.UPPERCASE;
440435
int length = toIndex - fromIndex;
441436
if (delimiter.isEmpty()) {
442437
// Allocate the byte array and fill in the hex pairs for each byte
@@ -637,7 +632,7 @@ public char toLowHexDigit(int value) {
637632
if (value < 10) {
638633
return (char)('0' + value);
639634
}
640-
if (digitCase == Case.LOWERCASE) {
635+
if (!ucase) {
641636
return (char)('a' - 10 + value);
642637
}
643638
return (char)('A' - 10 + value);
@@ -658,7 +653,7 @@ public char toHighHexDigit(int value) {
658653
if (value < 10) {
659654
return (char)('0' + value);
660655
}
661-
if (digitCase == Case.LOWERCASE) {
656+
if (!ucase) {
662657
return (char)('a' - 10 + value);
663658
}
664659
return (char)('A' - 10 + value);
@@ -1067,7 +1062,7 @@ public boolean equals(Object o) {
10671062
if (o == null || getClass() != o.getClass())
10681063
return false;
10691064
HexFormat otherHex = (HexFormat) o;
1070-
return digitCase == otherHex.digitCase &&
1065+
return ucase == otherHex.ucase &&
10711066
delimiter.equals(otherHex.delimiter) &&
10721067
prefix.equals(otherHex.prefix) &&
10731068
suffix.equals(otherHex.suffix);
@@ -1081,7 +1076,7 @@ public boolean equals(Object o) {
10811076
@Override
10821077
public int hashCode() {
10831078
int result = Objects.hash(delimiter, prefix, suffix);
1084-
result = 31 * result + Boolean.hashCode(digitCase == Case.UPPERCASE);
1079+
result = 31 * result + Boolean.hashCode(ucase);
10851080
return result;
10861081
}
10871082

@@ -1093,7 +1088,7 @@ public int hashCode() {
10931088
*/
10941089
@Override
10951090
public String toString() {
1096-
return escapeNL("uppercase: " + (digitCase == Case.UPPERCASE) +
1091+
return escapeNL("uppercase: " + ucase +
10971092
", delimiter: \"" + delimiter +
10981093
"\", prefix: \"" + prefix +
10991094
"\", suffix: \"" + suffix + "\"");

src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2024, 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
@@ -75,6 +75,7 @@
7575
import com.apple.laf.AquaUtilControlSize.Sizeable;
7676
import com.apple.laf.AquaUtils.RecyclableSingleton;
7777
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
78+
import sun.swing.MnemonicHandler;
7879
import sun.swing.SwingUtilities2;
7980

8081
public class AquaButtonUI extends BasicButtonUI implements Sizeable {
@@ -487,12 +488,10 @@ protected void paintIcon(final Graphics g, final AbstractButton b, final Rectang
487488
* Use the paintText method which takes the AbstractButton argument.
488489
*/
489490
protected void paintText(final Graphics g, final JComponent c, final Rectangle localTextRect, final String text) {
490-
final Graphics2D g2d = g instanceof Graphics2D ? (Graphics2D)g : null;
491-
492491
final AbstractButton b = (AbstractButton)c;
493492
final ButtonModel model = b.getModel();
494493
final FontMetrics fm = g.getFontMetrics();
495-
final int mnemonicIndex = AquaMnemonicHandler.isMnemonicHidden() ? -1 : b.getDisplayedMnemonicIndex();
494+
final int mnemonicIndex = MnemonicHandler.isMnemonicHidden() ? -1 : b.getDisplayedMnemonicIndex();
496495

497496
/* Draw the Text */
498497
if (model.isEnabled()) {

src/java.desktop/macosx/classes/com/apple/laf/AquaLabelUI.java

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2024, 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
@@ -25,16 +25,19 @@
2525

2626
package com.apple.laf;
2727

28-
import java.awt.*;
28+
import java.awt.Color;
29+
import java.awt.Graphics;
2930

30-
import javax.swing.*;
31-
import javax.swing.plaf.*;
32-
import javax.swing.plaf.basic.*;
33-
34-
import sun.swing.SwingUtilities2;
31+
import javax.swing.JComponent;
32+
import javax.swing.JLabel;
33+
import javax.swing.plaf.ComponentUI;
34+
import javax.swing.plaf.UIResource;
35+
import javax.swing.plaf.basic.BasicLabelUI;
3536

3637
import com.apple.laf.AquaUtils.RecyclableSingleton;
3738
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
39+
import sun.swing.MnemonicHandler;
40+
import sun.swing.SwingUtilities2;
3841

3942
public class AquaLabelUI extends BasicLabelUI {
4043
private static final RecyclableSingleton<AquaLabelUI> aquaLabelUI = new RecyclableSingletonFromDefaultConstructor<AquaLabelUI>(AquaLabelUI.class);
@@ -55,7 +58,7 @@ protected void uninstallListeners(final JLabel c) {
5558

5659
protected void paintEnabledText(final JLabel l, final Graphics g, final String s, final int textX, final int textY) {
5760
int mnemIndex = l.getDisplayedMnemonicIndex();
58-
if (AquaMnemonicHandler.isMnemonicHidden()) {
61+
if (MnemonicHandler.isMnemonicHidden()) {
5962
mnemIndex = -1;
6063
}
6164

@@ -72,7 +75,7 @@ protected void paintEnabledText(final JLabel l, final Graphics g, final String s
7275
*/
7376
protected void paintDisabledText(final JLabel l, final Graphics g, final String s, final int textX, final int textY) {
7477
int accChar = l.getDisplayedMnemonicIndex();
75-
if (AquaMnemonicHandler.isMnemonicHidden()) {
78+
if (MnemonicHandler.isMnemonicHidden()) {
7679
accChar = -1;
7780
}
7881

src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2024, 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
@@ -55,6 +55,8 @@
5555

5656
import apple.laf.JRSUIControl;
5757
import apple.laf.JRSUIUtils;
58+
import sun.swing.AltProcessor;
59+
import sun.swing.MnemonicHandler;
5860
import sun.swing.SwingAccessor;
5961
import sun.swing.SwingUtilities2;
6062

@@ -174,7 +176,9 @@ public Void run() {
174176
spf.setActive(true);
175177
PopupFactory.setSharedInstance(spf);
176178

177-
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor(AquaMnemonicHandler.getInstance());
179+
KeyboardFocusManager.getCurrentKeyboardFocusManager()
180+
.addKeyEventPostProcessor(AltProcessor.getInstance());
181+
MnemonicHandler.setMnemonicHidden(true);
178182
}
179183

180184
/**
@@ -185,7 +189,8 @@ public Void run() {
185189
* @see #initialize
186190
*/
187191
public void uninitialize() {
188-
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventPostProcessor(AquaMnemonicHandler.getInstance());
192+
KeyboardFocusManager.getCurrentKeyboardFocusManager()
193+
.removeKeyEventPostProcessor(AltProcessor.getInstance());
189194

190195
final PopupFactory popupFactory = PopupFactory.getSharedInstance();
191196
if (popupFactory instanceof ScreenPopupFactory spf) {

0 commit comments

Comments
 (0)