Skip to content

Commit c2bf70d

Browse files
committed
Merge master HEAD into openj9-staging
Signed-off-by: J9 Build <[email protected]>
2 parents 70473a0 + e4a1ff9 commit c2bf70d

File tree

42 files changed

+1139
-342
lines changed

Some content is hidden

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

42 files changed

+1139
-342
lines changed

Diff for: src/java.base/share/classes/java/util/Currency.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 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
@@ -444,8 +444,8 @@ public static Currency getInstance(Locale locale) {
444444
public static Set<Currency> getAvailableCurrencies() {
445445
synchronized(Currency.class) {
446446
if (available == null) {
447+
var sysTime = System.currentTimeMillis();
447448
available = new HashSet<>(256);
448-
449449
// Add simple currencies first
450450
for (char c1 = 'A'; c1 <= 'Z'; c1 ++) {
451451
for (char c2 = 'A'; c2 <= 'Z'; c2 ++) {
@@ -467,7 +467,7 @@ public static Set<Currency> getAvailableCurrencies() {
467467
SpecialCaseEntry scEntry = specialCasesList.get(index);
468468

469469
if (scEntry.cutOverTime == Long.MAX_VALUE
470-
|| System.currentTimeMillis() < scEntry.cutOverTime) {
470+
|| sysTime < scEntry.cutOverTime) {
471471
available.add(getInstance(scEntry.oldCurrency,
472472
scEntry.oldCurrencyFraction,
473473
scEntry.oldCurrencyNumericCode));

Diff for: src/java.base/share/classes/java/util/TimeZone.java

+42-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.io.Serializable;
4242
import java.time.ZoneId;
4343
import java.time.ZoneOffset;
44+
import java.util.stream.Stream;
4445

4546
import jdk.internal.util.StaticProperty;
4647
import sun.util.calendar.ZoneInfo;
@@ -615,24 +616,63 @@ private static TimeZone getTimeZone(String ID, boolean fallback) {
615616
/**
616617
* Gets the available IDs according to the given time zone offset in milliseconds.
617618
*
619+
* @apiNote Consider using {@link #availableIDs(int)} which returns
620+
* a stream of the available time zone IDs according to the given offset.
621+
*
618622
* @param rawOffset the given time zone GMT offset in milliseconds.
619623
* @return an array of IDs, where the time zone for that ID has
620624
* the specified GMT offset. For example, "America/Phoenix" and "America/Denver"
621625
* both have GMT-07:00, but differ in daylight saving behavior.
622626
* @see #getRawOffset()
627+
* @see #availableIDs(int)
623628
*/
624629
public static String[] getAvailableIDs(int rawOffset) {
625630
return ZoneInfo.getAvailableIDs(rawOffset);
626631
}
627632

628633
/**
629-
* Gets all the available IDs supported.
630-
* @return an array of IDs.
634+
* {@return an array of the available IDs supported}
635+
*
636+
* @apiNote Consider using {@link #availableIDs()} which returns
637+
* a stream of the available time zone IDs.
638+
*
639+
* @see #availableIDs()
631640
*/
632641
public static String[] getAvailableIDs() {
633642
return ZoneInfo.getAvailableIDs();
634643
}
635644

645+
/**
646+
* Gets the available IDs according to the given time zone offset in milliseconds.
647+
*
648+
* @implNote Unlike {@link #getAvailableIDs(int)}, this method does
649+
* not create a copy of the {@code TimeZone} IDs array.
650+
*
651+
* @param rawOffset the given time zone GMT offset in milliseconds.
652+
* @return a stream of IDs, where the time zone for that ID has
653+
* the specified GMT offset. For example, "America/Phoenix" and "America/Denver"
654+
* both have GMT-07:00, but differ in daylight saving behavior.
655+
* @see #getRawOffset()
656+
* @see #getAvailableIDs(int)
657+
* @since 25
658+
*/
659+
public static Stream<String> availableIDs(int rawOffset) {
660+
return ZoneInfo.availableIDs(rawOffset);
661+
}
662+
663+
/**
664+
* {@return a stream of the available IDs supported}
665+
*
666+
* @implNote Unlike {@link #getAvailableIDs()}, this method does
667+
* not create a copy of the {@code TimeZone} IDs array.
668+
*
669+
* @since 25
670+
* @see #getAvailableIDs()
671+
*/
672+
public static Stream<String> availableIDs() {
673+
return ZoneInfo.availableIDs();
674+
}
675+
636676
/**
637677
* Gets the platform defined TimeZone ID.
638678
**/

Diff for: src/java.base/share/classes/sun/util/calendar/ZoneInfo.java

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 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
@@ -31,6 +31,7 @@
3131
import java.util.Map;
3232
import java.util.SimpleTimeZone;
3333
import java.util.TimeZone;
34+
import java.util.stream.Stream;
3435

3536
/**
3637
* <code>ZoneInfo</code> is an implementation subclass of {@link
@@ -562,6 +563,27 @@ public static String[] getAvailableIDs(int rawOffset) {
562563
return ZoneInfoFile.getZoneIds(rawOffset);
563564
}
564565

566+
/**
567+
* Gets all available IDs supported in the Java run-time.
568+
*
569+
* @return a stream of time zone IDs.
570+
*/
571+
public static Stream<String> availableIDs() {
572+
return ZoneInfoFile.zoneIds();
573+
}
574+
575+
/**
576+
* Gets all available IDs that have the same value as the
577+
* specified raw GMT offset.
578+
*
579+
* @param rawOffset the GMT offset in milliseconds. This
580+
* value should not include any daylight saving time.
581+
* @return a stream of time zone IDs.
582+
*/
583+
public static Stream<String> availableIDs(int rawOffset) {
584+
return ZoneInfoFile.zoneIds(rawOffset);
585+
}
586+
565587
/**
566588
* Gets the ZoneInfo for the given ID.
567589
*

Diff for: src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java

+28-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 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
@@ -45,6 +45,7 @@
4545
import java.util.Map;
4646
import java.util.SimpleTimeZone;
4747
import java.util.concurrent.ConcurrentHashMap;
48+
import java.util.stream.Stream;
4849
import java.util.zip.CRC32;
4950

5051
import jdk.internal.util.StaticProperty;
@@ -59,7 +60,7 @@ public final class ZoneInfoFile {
5960
/**
6061
* Gets all available IDs supported in the Java run-time.
6162
*
62-
* @return a set of time zone IDs.
63+
* @return an array of time zone IDs.
6364
*/
6465
public static String[] getZoneIds() {
6566
var shortIDs = ZoneId.SHORT_IDS.keySet();
@@ -92,11 +93,35 @@ public static String[] getZoneIds(int rawOffset) {
9293
// sorted list, though the specification does not
9394
// specify it. Keep the same behavior for better
9495
// compatibility.
95-
String[] list = ids.toArray(new String[ids.size()]);
96+
String[] list = ids.toArray(new String[0]);
9697
Arrays.sort(list);
9798
return list;
9899
}
99100

101+
/**
102+
* Gets all available IDs supported in the Java run-time.
103+
*
104+
* @return a stream of time zone IDs.
105+
*/
106+
public static Stream<String> zoneIds() {
107+
return Stream.concat(Arrays.stream(regions),
108+
ZoneId.SHORT_IDS.keySet().stream());
109+
}
110+
111+
/**
112+
* Gets all available IDs that have the same value as the
113+
* specified raw GMT offset.
114+
*
115+
* @param rawOffset the GMT offset in milliseconds. This
116+
* value should not include any daylight saving time.
117+
* @return a stream of time zone IDs.
118+
*/
119+
public static Stream<String> zoneIds(int rawOffset) {
120+
return zoneIds()
121+
.filter(id -> getZoneInfo(id).getRawOffset() == rawOffset)
122+
.sorted(); // Sort the IDs, see getZoneIds(int)
123+
}
124+
100125
public static ZoneInfo getZoneInfo(String zoneId) {
101126
if (zoneId == null) {
102127
return null;

Diff for: src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class CLDRTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
5555
private static final String NO_INHERITANCE_MARKER = "\u2205\u2205\u2205";
5656
private static class AVAILABLE_IDS {
5757
static final String[] INSTANCE =
58-
Arrays.stream(ZoneInfoFile.getZoneIds())
58+
ZoneInfoFile.zoneIds()
5959
.sorted()
6060
.toArray(String[]::new);
6161
}

Diff for: src/java.base/share/native/libzip/zip_util.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,9 @@ static void freeCEN(jzfile *);
7272
static jint INITIAL_META_COUNT = 2; /* initial number of entries in meta name array */
7373

7474
/*
75-
* Declare library specific JNI_Onload entry if static build
75+
* Declare library specific JNI_Onload entry
7676
*/
77-
#ifdef STATIC_BUILD
7877
DEF_STATIC_JNI_OnLoad
79-
#endif
8078

8179
/*
8280
* The ZFILE_* functions exist to provide some platform-independence with

Diff for: src/java.desktop/share/classes/sun/print/PathGraphics.java

+15-2
Original file line numberDiff line numberDiff line change
@@ -934,23 +934,36 @@ boolean printedSimpleGlyphVector(GlyphVector g, float x, float y) {
934934

935935
/* If we reach here we have mapped all the glyphs back
936936
* one-to-one to simple unicode chars that we know are in the font.
937-
* We can call "drawChars" on each one of them in turn, setting
937+
* We can call "drawString" on each one of them in turn, setting
938938
* the position based on the glyph positions.
939939
* There's typically overhead in this. If numGlyphs is 'large',
940940
* it may even be better to try printGlyphVector() in this case.
941941
* This may be less recoverable for apps, but sophisticated apps
942942
* should be able to recover the text from simple glyph vectors
943943
* and we can avoid penalising the more common case - although
944944
* this is already a minority case.
945+
* If we do use "drawString" on each character, we need to use a
946+
* font without translation transform, since the font translation
947+
* transform will already be reflected in the glyph positions, and
948+
* we do not want to apply the translation twice.
945949
*/
946950
if (numGlyphs > 10 && printGlyphVector(g, x, y)) {
947951
return true;
948952
}
949953

954+
Font font2 = font;
955+
if (font.isTransformed()) {
956+
AffineTransform t = font.getTransform();
957+
if ((t.getType() & AffineTransform.TYPE_TRANSLATION) != 0) {
958+
t.setTransform(t.getScaleX(), t.getShearY(), t.getShearX(), t.getScaleY(), 0, 0);
959+
font2 = font.deriveFont(t);
960+
}
961+
}
962+
950963
for (int i=0; i<numGlyphs; i++) {
951964
String s = new String(chars, i, 1);
952965
drawString(s, x+positions[i*2], y+positions[i*2+1],
953-
font, gvFrc, 0f);
966+
font2, gvFrc, 0f);
954967
}
955968
return true;
956969
}

Diff for: src/java.desktop/share/native/libawt/awt/image/imageInitIDs.c

+72-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,78 @@
2424
*/
2525
#include <jni.h>
2626
#include "jni_util.h"
27-
#define IMGEXTERN
28-
#include "imageInitIDs.h"
27+
28+
/* BufferedImage ids */
29+
jfieldID g_BImgRasterID;
30+
jfieldID g_BImgTypeID;
31+
jfieldID g_BImgCMID;
32+
jmethodID g_BImgGetRGBMID;
33+
jmethodID g_BImgSetRGBMID;
34+
35+
/* Raster ids */
36+
jfieldID g_RasterWidthID;
37+
jfieldID g_RasterHeightID;
38+
jfieldID g_RasterMinXID;
39+
jfieldID g_RasterMinYID;
40+
jfieldID g_RasterBaseOriginXID;
41+
jfieldID g_RasterBaseOriginYID;
42+
jfieldID g_RasterSampleModelID;
43+
jfieldID g_RasterDataBufferID;
44+
jfieldID g_RasterNumDataElementsID;
45+
jfieldID g_RasterNumBandsID;
46+
47+
jfieldID g_BCRdataID;
48+
jfieldID g_BCRscanstrID;
49+
jfieldID g_BCRpixstrID;
50+
jfieldID g_BCRdataOffsetsID;
51+
jfieldID g_BCRtypeID;
52+
jfieldID g_BPRdataID;
53+
jfieldID g_BPRscanstrID;
54+
jfieldID g_BPRpixstrID;
55+
jfieldID g_BPRtypeID;
56+
jfieldID g_BPRdataBitOffsetID;
57+
jfieldID g_SCRdataID;
58+
jfieldID g_SCRscanstrID;
59+
jfieldID g_SCRpixstrID;
60+
jfieldID g_SCRdataOffsetsID;
61+
jfieldID g_SCRtypeID;
62+
jfieldID g_ICRdataID;
63+
jfieldID g_ICRscanstrID;
64+
jfieldID g_ICRpixstrID;
65+
jfieldID g_ICRdataOffsetsID;
66+
jfieldID g_ICRtypeID;
67+
68+
/* Color Model ids */
69+
jfieldID g_CMnBitsID;
70+
jfieldID g_CMcspaceID;
71+
jfieldID g_CMnumComponentsID;
72+
jfieldID g_CMsuppAlphaID;
73+
jfieldID g_CMisAlphaPreID;
74+
jfieldID g_CMtransparencyID;
75+
jfieldID g_CMcsTypeID;
76+
jfieldID g_CMis_sRGBID;
77+
jmethodID g_CMgetRGBdefaultMID;
78+
79+
jfieldID g_ICMtransIdxID;
80+
jfieldID g_ICMmapSizeID;
81+
jfieldID g_ICMrgbID;
82+
83+
/* Sample Model ids */
84+
jfieldID g_SMWidthID;
85+
jfieldID g_SMHeightID;
86+
jmethodID g_SMGetPixelsMID;
87+
jmethodID g_SMSetPixelsMID;
88+
89+
/* Single Pixel Packed Sample Model ids */
90+
jfieldID g_SPPSMmaskArrID;
91+
jfieldID g_SPPSMmaskOffID;
92+
jfieldID g_SPPSMnBitsID;
93+
jfieldID g_SPPSMmaxBitID;
94+
95+
/* Kernel ids */
96+
jfieldID g_KernelWidthID;
97+
jfieldID g_KernelHeightID;
98+
jfieldID g_KernelDataID;
2999

30100
JNIEXPORT void JNICALL
31101
Java_java_awt_image_BufferedImage_initIDs(JNIEnv *env, jclass cls) {

0 commit comments

Comments
 (0)