Skip to content

Commit

Permalink
Merge pull request #600 from ibmruntimes/openj9-staging
Browse files Browse the repository at this point in the history
Merge jdk-11.0.18+6 to 0.36
  • Loading branch information
JasonFengJ9 committed Dec 8, 2022
2 parents 19f7b1b + 4d317f2 commit 2f0ebd8
Show file tree
Hide file tree
Showing 20 changed files with 499 additions and 31 deletions.
2 changes: 1 addition & 1 deletion closed/openjdk-tag.gmk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
OPENJDK_TAG := jdk-11.0.18+5
OPENJDK_TAG := jdk-11.0.18+6
20 changes: 8 additions & 12 deletions src/java.desktop/share/native/common/awt/utility/sizecalc.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@

#define IS_SAFE_SIZE_T(x) ((x) >= 0 && (unsigned long long)(x) <= SIZE_MAX)

#define IS_MUL_OVERFLOW(m, n) \
((m) != 0 && (n) != 0 && (((size_t)((m)*(n))) != (((size_t)(m)) * ((size_t)(n)))))

#define IS_SAFE_SIZE_MUL(m, n) \
(IS_SAFE_SIZE_T(m) && IS_SAFE_SIZE_T(n) && \
((m) == 0 || (n) == 0 || (size_t)(n) <= (SIZE_MAX / (size_t)(m))) && \
!IS_MUL_OVERFLOW(m, n))
((m) == 0 || (n) == 0 || (size_t)(n) <= (SIZE_MAX / (size_t)(m))))

#define IS_SAFE_SIZE_ADD(a, b) \
(IS_SAFE_SIZE_T(a) && IS_SAFE_SIZE_T(b) && (size_t)(b) <= (SIZE_MAX - (size_t)(a)))
Expand All @@ -75,10 +71,10 @@
* // Use the allocated array...
*/
#define SAFE_SIZE_ARRAY_ALLOC(func, m, n) \
(IS_SAFE_SIZE_MUL((m), (n)) ? ((func)((m) * (n))) : FAILURE_RESULT)
(IS_SAFE_SIZE_MUL((m), (n)) ? ((func)((size_t)(m) * (size_t)(n))) : FAILURE_RESULT)

#define SAFE_SIZE_ARRAY_REALLOC(func, p, m, n) \
(IS_SAFE_SIZE_MUL((m), (n)) ? ((func)((p), (m) * (n))) : FAILURE_RESULT)
(IS_SAFE_SIZE_MUL((m), (n)) ? ((func)((p), (size_t)(m) * (size_t)(n))) : FAILURE_RESULT)

/*
* A helper macro to safely allocate an array of type 'type' with 'n' items
Expand All @@ -92,19 +88,19 @@
* IS_SAFE_... macros to check if the calculations are safe.
*/
#define SAFE_SIZE_NEW_ARRAY(type, n) \
(IS_SAFE_SIZE_MUL(sizeof(type), (n)) ? (new type[(n)]) : throw std::bad_alloc())
(IS_SAFE_SIZE_MUL(sizeof(type), (n)) ? (new type[(size_t)(n)]) : throw std::bad_alloc())

#define SAFE_SIZE_NEW_ARRAY2(type, n, m) \
(IS_SAFE_SIZE_MUL((m), (n)) && IS_SAFE_SIZE_MUL(sizeof(type), (n) * (m)) ? \
(new type[(n) * (m)]) : throw std::bad_alloc())
(IS_SAFE_SIZE_MUL((m), (n)) && IS_SAFE_SIZE_MUL(sizeof(type), (size_t)(n) * (size_t)(m)) ? \
(new type[(size_t)(n) * (size_t)(m)]) : throw std::bad_alloc())

/*
* Checks if a data structure of size (a + m*n) can be safely allocated
* w/o producing an integer overflow when calculating its size.
*/
#define IS_SAFE_STRUCT_SIZE(a, m, n) \
( \
IS_SAFE_SIZE_MUL((m), (n)) && IS_SAFE_SIZE_ADD((m) * (n), (a)) \
IS_SAFE_SIZE_MUL((m), (n)) && IS_SAFE_SIZE_ADD((size_t)(m) * (size_t)(n), (a)) \
)

/*
Expand All @@ -116,7 +112,7 @@
* // Use the allocated memory...
*/
#define SAFE_SIZE_STRUCT_ALLOC(func, a, m, n) \
(IS_SAFE_STRUCT_SIZE((a), (m), (n)) ? ((func)((a) + (m) * (n))) : FAILURE_RESULT)
(IS_SAFE_STRUCT_SIZE((a), (m), (n)) ? ((func)((size_t)(a) + (size_t)(m) * (size_t)(n))) : FAILURE_RESULT)


#endif /* SIZECALC_H */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2022, 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
Expand Down Expand Up @@ -76,8 +76,8 @@ convertUft8ToPlatformString(char* utf8_str, int utf8_len, char* platform_str, in
if (plen >= 0) {
platform_str[plen] = '\0';
}
free(wstr);
}
free(wstr);
}
}
return plen;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2975,11 +2975,11 @@ public boolean hasBlockTag(Element element, DocTree.Kind kind, final String tagN
*/
public TreePath getTreePath(Element e) {
DocCommentDuo duo = dcTreeCache.get(e);
if (isValidDuo(duo) && duo.treePath != null) {
if (duo != null && duo.treePath != null) {
return duo.treePath;
}
duo = configuration.cmtUtils.getSyntheticCommentDuo(e);
if (isValidDuo(duo) && duo.treePath != null) {
if (duo != null && duo.treePath != null) {
return duo.treePath;
}
Map<Element, TreePath> elementToTreePath = configuration.workArounds.getElementToTreePath();
Expand All @@ -3005,20 +3005,20 @@ public DocCommentTree getDocCommentTree0(Element element) {
ElementKind kind = element.getKind();
if (kind == ElementKind.PACKAGE || kind == ElementKind.OTHER) {
duo = dcTreeCache.get(element); // local cache
if (!isValidDuo(duo) && kind == ElementKind.PACKAGE) {
if (duo == null && kind == ElementKind.PACKAGE) {
// package-info.java
duo = getDocCommentTuple(element);
}
if (!isValidDuo(duo)) {
if (duo == null) {
// package.html or overview.html
duo = configuration.cmtUtils.getHtmlCommentDuo(element); // html source
}
} else {
duo = configuration.cmtUtils.getSyntheticCommentDuo(element);
if (!isValidDuo(duo)) {
if (duo == null) {
duo = dcTreeCache.get(element); // local cache
}
if (!isValidDuo(duo)) {
if (duo == null) {
duo = getDocCommentTuple(element); // get the real mccoy
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ For terms of use, see http://www.unicode.org/copyright.html
<type name="tvfun" description="Funafuti, Tuvalu" alias="Pacific/Funafuti"/>
<type name="twtpe" description="Taipei, Taiwan" alias="Asia/Taipei ROC"/>
<type name="tzdar" description="Dar es Salaam, Tanzania" alias="Africa/Dar_es_Salaam"/>
<type name="uaiev" description="Kiev, Ukraine" alias="Europe/Kiev"/>
<type name="uaiev" description="Kyiv, Ukraine" alias="Europe/Kiev Europe/Kyiv"/>
<type name="uaozh" description="Zaporizhia (Zaporozhye), Ukraine" alias="Europe/Zaporozhye"/>
<type name="uasip" description="Simferopol, Ukraine" alias="Europe/Simferopol"/>
<type name="uauzh" description="Uzhhorod (Uzhgorod), Ukraine" alias="Europe/Uzhgorod"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1018,11 +1018,8 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/
<decimalFormats numberSystem="latn">
<decimalFormatLength type="long">
<decimalFormat>
<pattern type="1000000000000" count="one">0 billón</pattern>
<pattern type="1000000000000" count="other">0 billón</pattern>
<pattern type="10000000000000" count="one">00 billones</pattern>
<pattern type="10000000000000" count="other">00 billones</pattern>
<pattern type="100000000000000" count="one">000 billones</pattern>
<pattern type="100000000000000" count="other">000 billones</pattern>
</decimalFormat>
</decimalFormatLength>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,9 @@ For terms of use, see http://www.unicode.org/copyright.html
<usesMetazone mzone="America_Central"/>
</timezone>
<timezone type="America/Chihuahua">
<usesMetazone to="1998-04-05 09:00" mzone="America_Central"/>
<usesMetazone from="1998-04-05 09:00" mzone="Mexico_Pacific"/>
<usesMetazone to="1998-04-05 09:00" mzone="America_Central"/>
<usesMetazone to="2022-10-30 08:00" from="1998-04-05 09:00" mzone="Mexico_Pacific"/>
<usesMetazone from="2022-10-30 08:00" mzone="America_Central"/>
</timezone>
<timezone type="America/Coral_Harbour">
<usesMetazone mzone="America_Eastern"/>
Expand Down Expand Up @@ -611,8 +612,9 @@ For terms of use, see http://www.unicode.org/copyright.html
<usesMetazone from="2003-10-26 08:00" mzone="America_Central"/>
</timezone>
<timezone type="America/Ojinaga">
<usesMetazone to="1998-04-05 09:00" mzone="America_Central"/>
<usesMetazone from="1998-04-05 09:00" mzone="America_Mountain"/>
<usesMetazone to="1998-04-05 09:00" mzone="America_Central"/>
<usesMetazone to="2022-10-30 08:00" from="1998-04-05 09:00" mzone="America_Mountain"/>
<usesMetazone from="2022-10-30 08:00" mzone="America_Central"/>
</timezone>
<timezone type="America/Panama">
<usesMetazone mzone="America_Eastern"/>
Expand Down
212 changes: 212 additions & 0 deletions test/jdk/java/awt/event/KeyEvent/KeyEventLocationTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
/*
* Copyright (c) 2002, 2022, 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
* @key headful
* @bug 4424517
* @summary Verify the mapping of various KeyEvents with their KeyLocations
* is as expected.
* @run main KeyEventLocationTest
*/

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;

import javax.swing.SwingUtilities;

public class KeyEventLocationTest {

private static volatile Frame frame;
private static volatile boolean keyPressed;
private static volatile boolean keyReleased;
private static volatile boolean keyTyped;
private static volatile Robot robot;
private static volatile int xLocation;
private static volatile int yLocation;
private static volatile int width;
private static volatile int height;
private static volatile Label label = new Label();
private static volatile String currentString = "";

private static int[] keyEvents = { KeyEvent.VK_0, KeyEvent.VK_1,
KeyEvent.VK_2, KeyEvent.VK_3, KeyEvent.VK_4, KeyEvent.VK_5,
KeyEvent.VK_6, KeyEvent.VK_7, KeyEvent.VK_8, KeyEvent.VK_9,
KeyEvent.VK_A, KeyEvent.VK_B, KeyEvent.VK_C, KeyEvent.VK_D,
KeyEvent.VK_E, KeyEvent.VK_F, KeyEvent.VK_G, KeyEvent.VK_H,
KeyEvent.VK_I, KeyEvent.VK_J, KeyEvent.VK_K, KeyEvent.VK_L,
KeyEvent.VK_M, KeyEvent.VK_N, KeyEvent.VK_O, KeyEvent.VK_P,
KeyEvent.VK_Q, KeyEvent.VK_R, KeyEvent.VK_S, KeyEvent.VK_T,
KeyEvent.VK_U, KeyEvent.VK_V, KeyEvent.VK_W, KeyEvent.VK_X,
KeyEvent.VK_Y, KeyEvent.VK_Z, KeyEvent.VK_BACK_QUOTE,
KeyEvent.VK_BACK_SLASH, KeyEvent.VK_BACK_SPACE,
KeyEvent.VK_CLOSE_BRACKET, KeyEvent.VK_COMMA, KeyEvent.VK_EQUALS,
KeyEvent.VK_ESCAPE, KeyEvent.VK_MINUS, KeyEvent.VK_OPEN_BRACKET,
KeyEvent.VK_PERIOD, KeyEvent.VK_QUOTE, KeyEvent.VK_SEMICOLON,
KeyEvent.VK_SLASH, KeyEvent.VK_SPACE };

private static int specialKeyEvents[] = { KeyEvent.VK_F1, KeyEvent.VK_F2,
KeyEvent.VK_F3, KeyEvent.VK_F4, KeyEvent.VK_F5, KeyEvent.VK_F6,
KeyEvent.VK_F7, KeyEvent.VK_F8, KeyEvent.VK_F9, KeyEvent.VK_F10 };

private static void createGUI() {
frame = new Frame("Test frame");
frame.setLayout(new BorderLayout());
frame.setAlwaysOnTop(true);

frame.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent event) {
try {
handleEvent("keyPressed", event);
} catch (Exception e) {
e.printStackTrace();
}
keyPressed = true;
}

public void keyReleased(KeyEvent event) {
try {
handleEvent("keyReleased", event);
} catch (Exception e) {
e.printStackTrace();
}
keyReleased = true;
}

public void keyTyped(KeyEvent event) {
try {
handleEvent("keyTyped", event);
} catch (Exception e) {
e.printStackTrace();
}
keyTyped = true;
}

private void handleEvent(String eventString, KeyEvent event)
throws Exception {
label.setText(eventString + " triggered for " + event);
if ((event.getID() == KeyEvent.KEY_TYPED
&& event.getKeyLocation() != KeyEvent.KEY_LOCATION_UNKNOWN)
|| ((event.getID() == KeyEvent.KEY_PRESSED
|| event.getID() == KeyEvent.KEY_PRESSED)
&& event.getKeyLocation()
!= KeyEvent.KEY_LOCATION_STANDARD)) {
throw new Exception("FAIL: Incorrect KeyLocation: "
+ event.getKeyLocation() + " returned when "
+ eventString + " triggered for " + event.getKeyChar());
}
}
});
label.setText("Current Event: ");
frame.add(label, BorderLayout.SOUTH);
frame.setSize(600, 300);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.toFront();
}

private static void doTest() throws Exception {
robot = new Robot();
robot.setAutoWaitForIdle(true);
robot.setAutoDelay(100);

SwingUtilities.invokeAndWait(() -> {
xLocation = frame.getLocationOnScreen().x;
yLocation = frame.getLocationOnScreen().y;
width = frame.getWidth();
height = frame.getHeight();
});

robot.mouseMove(xLocation + width / 2, yLocation + height / 2);
robot.mousePress(MouseEvent.BUTTON1_MASK);
robot.mouseRelease(MouseEvent.BUTTON1_MASK);

for (int i = 0; i < keyEvents.length; i++) {
resetValues();
robot.keyPress(keyEvents[i]);
robot.delay(200);
if (!keyPressed) {
throw new Exception(
"FAIL: keyPressed did not get triggered for "
+ KeyEvent.getKeyText(keyEvents[i]));
}
robot.keyRelease(keyEvents[i]);
robot.delay(200);
if (!keyReleased) {
throw new Exception(
"FAIL: keyReleased did not get triggered for "
+ KeyEvent.getKeyText(keyEvents[i]));
}
robot.delay(200);
if (!keyTyped) {
throw new Exception("FAIL: keyTyped did not get triggered for "
+ KeyEvent.getKeyText(keyEvents[i]));
}
}

for (int i = 0; i < specialKeyEvents.length; i++) {
resetValues();
robot.keyPress(specialKeyEvents[i]);
robot.delay(200);
if (!keyPressed) {
throw new Exception("FAIL: keyPressed did not get triggered"
+ " for " + KeyEvent.getKeyText(specialKeyEvents[i]));
}
robot.keyRelease(specialKeyEvents[i]);
robot.delay(200);
if (!keyReleased) {
throw new Exception("FAIL: keyReleased got triggered for "
+ KeyEvent.getKeyText(specialKeyEvents[i]));
}
robot.delay(200);
if (keyTyped) {
throw new Exception("FAIL: keyTyped got triggered for "
+ KeyEvent.getKeyText(specialKeyEvents[i]));
}
}
}

private static void resetValues() {
keyPressed = false;
keyReleased = false;
keyTyped = false;
}

public static void main(String[] args) throws Exception {
try {
EventQueue.invokeAndWait(() -> createGUI());
doTest();
System.out.println("Test Passed");
} finally {
if (frame != null)
EventQueue.invokeAndWait(() -> frame.dispose());
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
* @test
* @bug 8264666
* @summary No exception or errors should occur in ColorConvertOp.filter().
* @run main/othervm/timeout=600 UnexpectedSourceImageSize
*/
public final class UnexpectedSourceImageSize {

Expand Down
4 changes: 4 additions & 0 deletions test/jdk/sun/text/resources/LocaleData.cldr
Original file line number Diff line number Diff line change
Expand Up @@ -8382,3 +8382,7 @@ CalendarData/zh_SG/minimalDaysInFirstWeek=1: 001 GU UM US VI;4: AD AN AT AX BE B
CalendarData/zh_SG/firstDayOfWeek=1: AG AR AS AU BD BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IE IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PY SA SG SV TH TN TT TW UM US VE VI WS YE ZA ZW;2: 001 AD AI AL AM AN AT AX AZ BA BE BG BM BN BY CH CL CM CR CY CZ DE DK EC EE ES FI FJ FO FR GB GE GF GP GR HR HU IS IT KG KZ LB LI LK LT LU LV MC MD ME MK MN MQ MY NL NO NZ PL PT RE RO RS RU SE SI SK SM TJ TM TR UA UY UZ VA VN XK;6: MV;7: AE AF BH DJ DZ EG IQ IR JO KW LY MA OM QA SD SY
CalendarData/zh_TW/firstDayOfWeek=1: AG AR AS AU BD BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IE IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PY SA SG SV TH TN TT TW UM US VE VI WS YE ZA ZW;2: 001 AD AI AL AM AN AT AX AZ BA BE BG BM BN BY CH CL CM CR CY CZ DE DK EC EE ES FI FJ FO FR GB GE GF GP GR HR HU IS IT KG KZ LB LI LK LT LU LV MC MD ME MK MN MQ MY NL NO NZ PL PT RE RO RS RU SE SI SK SM TJ TM TR UA UY UZ VA VN XK;6: MV;7: AE AF BH DJ DZ EG IQ IR JO KW LY MA OM QA SD SY
CalendarData/zh_TW/minimalDaysInFirstWeek=1: 001 GU UM US VI;4: AD AN AT AX BE BG CH CZ DE DK EE ES FI FJ FO FR GB GF GG GI GP GR HU IE IM IS IT JE LI LT LU MC MQ NL NO PL PT RE RU SE SJ SK SM VA

# tzdata2022f
TimeZoneNames/en/America\/Ojinaga/1=Central Standard Time
TimeZoneNames/en/America\/Chihuahua/1=Central Standard Time

0 comments on commit 2f0ebd8

Please sign in to comment.