mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-15 16:09:44 +00:00
8283774: TestZoneOffset::test_immutable should ignore ZoneOffset::rules
Reviewed-by: rriggs, naoto
This commit is contained in:
parent
0e788e0ecb
commit
cc598e03de
@ -742,7 +742,7 @@ java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java 8277816 macosx-aarch64
|
||||
java/awt/Robot/CheckCommonColors/CheckCommonColors.java 8277816 macosx-aarch64
|
||||
java/awt/ColorClass/AlphaColorTest.java 8277816 macosx-aarch64
|
||||
java/awt/AlphaComposite/WindowAlphaCompositeTest.java 8277816 macosx-aarch64
|
||||
|
||||
|
||||
# macos12 failure
|
||||
javax/swing/JMenu/4515762/bug4515762.java 8276074 macosx-all
|
||||
|
||||
@ -759,9 +759,6 @@ javax/swing/JTree/4908142/bug4908142.java 8278348 macosx-all
|
||||
|
||||
# jdk_time
|
||||
|
||||
java/time/test/java/time/TestZoneOffset.java 8283716 generic-all
|
||||
|
||||
|
||||
############################################################################
|
||||
|
||||
# core_tools
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
@ -66,6 +66,7 @@ import static org.testng.Assert.assertTrue;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Base test class.
|
||||
@ -83,11 +84,15 @@ public abstract class AbstractTest {
|
||||
}
|
||||
|
||||
protected static void assertImmutable(Class<?> cls) {
|
||||
assertImmutable(cls, Set.of());
|
||||
}
|
||||
|
||||
protected static void assertImmutable(Class<?> cls, Set<String> ignoreFields) {
|
||||
assertTrue(Modifier.isPublic(cls.getModifiers()));
|
||||
assertTrue(Modifier.isFinal(cls.getModifiers()));
|
||||
Field[] fields = cls.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if (field.getName().contains("$") == false) {
|
||||
if (!field.getName().contains("$") && !ignoreFields.contains(field.getName())) {
|
||||
if (Modifier.isStatic(field.getModifiers())) {
|
||||
assertTrue(Modifier.isFinal(field.getModifiers()), "Field:" + field.getName());
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
@ -61,6 +61,7 @@ package test.java.time;
|
||||
|
||||
import static org.testng.Assert.assertSame;
|
||||
|
||||
import java.util.Set;
|
||||
import java.time.ZoneOffset;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
@ -73,7 +74,7 @@ public class TestZoneOffset extends AbstractTest {
|
||||
|
||||
@Test
|
||||
public void test_immutable() {
|
||||
assertImmutable(ZoneOffset.class);
|
||||
assertImmutable(ZoneOffset.class, /* ignore field */ Set.of("rules"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user