From 2735645263f5d2ad920598fb52827f05b30b7902 Mon Sep 17 00:00:00 2001 From: John DeRegnaucourt Date: Tue, 31 Oct 2023 21:17:02 -0400 Subject: [PATCH] Ensuring JDK 1.8 - JDK 21 support. Class fileformat 52. --- pom.xml | 2 +- .../com/cedarsoftware/util/ExceptionUtilities.java | 5 ----- .../com/cedarsoftware/util/UniqueIdGenerator.java | 5 +++-- .../cedarsoftware/util/UrlInvocationHandler.java | 4 ---- .../cedarsoftware/util/TestExceptionUtilities.java | 14 +------------- .../cedarsoftware/util/TestReflectionUtils.java | 11 ----------- 6 files changed, 5 insertions(+), 36 deletions(-) diff --git a/pom.xml b/pom.xml index 9f21cc38..5bba7090 100644 --- a/pom.xml +++ b/pom.xml @@ -142,7 +142,7 @@ ${maven.compiler.source} ${maven.compiler.target} - ${maven.compiler.release} + diff --git a/src/main/java/com/cedarsoftware/util/ExceptionUtilities.java b/src/main/java/com/cedarsoftware/util/ExceptionUtilities.java index a62abdac..1357a584 100644 --- a/src/main/java/com/cedarsoftware/util/ExceptionUtilities.java +++ b/src/main/java/com/cedarsoftware/util/ExceptionUtilities.java @@ -32,11 +32,6 @@ private ExceptionUtilities() { */ public static void safelyIgnoreException(Throwable t) { - if (t instanceof ThreadDeath) - { - throw (ThreadDeath) t; - } - if (t instanceof OutOfMemoryError) { throw (OutOfMemoryError) t; diff --git a/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java b/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java index 790ebf62..fe67141c 100644 --- a/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java +++ b/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java @@ -40,6 +40,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@SuppressWarnings("unchecked") public class UniqueIdGenerator { public static final String JAVA_UTIL_CLUSTERID = "JAVA_UTIL_CLUSTERID"; @@ -168,7 +169,7 @@ private static long getUniqueIdAttempt() previousTimeMilliseconds = currentTimeMilliseconds; } - return currentTimeMilliseconds * 100000 + count * 100 + serverId; + return currentTimeMilliseconds * 100000 + count * 100L + serverId; } /** @@ -221,7 +222,7 @@ private static long getFullUniqueId19() previousTimeMilliseconds2 = currentTimeMilliseconds; } - return currentTimeMilliseconds * 1000000 + count2 * 100 + serverId; + return currentTimeMilliseconds * 1000000 + count2 * 100L + serverId; } /** diff --git a/src/main/java/com/cedarsoftware/util/UrlInvocationHandler.java b/src/main/java/com/cedarsoftware/util/UrlInvocationHandler.java index 6dcbc364..405c4b12 100644 --- a/src/main/java/com/cedarsoftware/util/UrlInvocationHandler.java +++ b/src/main/java/com/cedarsoftware/util/UrlInvocationHandler.java @@ -91,10 +91,6 @@ public Object invoke(Object proxy, Method m, Object[] args) throws Throwable // Get the return value of the call result = _strategy.readResponse(c); } - catch (ThreadDeath e) - { - throw e; - } catch (Throwable e) { UrlUtilities.readErrorResponse(c); diff --git a/src/test/java/com/cedarsoftware/util/TestExceptionUtilities.java b/src/test/java/com/cedarsoftware/util/TestExceptionUtilities.java index dbf4d85d..673d7b05 100644 --- a/src/test/java/com/cedarsoftware/util/TestExceptionUtilities.java +++ b/src/test/java/com/cedarsoftware/util/TestExceptionUtilities.java @@ -37,19 +37,7 @@ public void testConstructorIsPrivate() throws Exception { assertNotNull(con.newInstance()); } - - public void testThreadDeathThrown() - { - try - { - ExceptionUtilities.safelyIgnoreException(new ThreadDeath()); - fail("should not make it here"); - } - catch (ThreadDeath e) - { - } - } - + public void testOutOfMemoryErrorThrown() { try diff --git a/src/test/java/com/cedarsoftware/util/TestReflectionUtils.java b/src/test/java/com/cedarsoftware/util/TestReflectionUtils.java index ab7a3257..63fdbc9c 100644 --- a/src/test/java/com/cedarsoftware/util/TestReflectionUtils.java +++ b/src/test/java/com/cedarsoftware/util/TestReflectionUtils.java @@ -186,17 +186,6 @@ public void testMethodAnnotation() throws Exception assertNull(a); } - @SuppressWarnings("unchecked") - @Test - public void testGetDeclaredFields() throws Exception - { - List fields = mock(ArrayList.class); - when(fields.add(any())).thenThrow(ThreadDeath.class); - - assertThatExceptionOfType(ThreadDeath.class) - .isThrownBy(() -> ReflectionUtils.getDeclaredFields(Parent.class, fields)); - } - @Test public void testDeepDeclaredFields() throws Exception {