From acd5ec0e4cd466852e9365dfba3aedf474f1d575 Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Wed, 3 May 2023 14:53:17 +0200 Subject: [PATCH 1/6] 8305082: Remove finalize() from test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java --- .../jtreg/runtime/linkResolver/InterfaceObjectTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java index d7ccd069ae076..ac7b9f8e8e948 100644 --- a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java +++ b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -42,7 +42,7 @@ public Object clone() { System.out.println("In InterfaceObjectTest's clone() method\n"); return null; } - + @SuppressWarnings("removal") public void finalize() throws Throwable { try { System.out.println("In InterfaceObjectTest's finalize() method\n"); From 1d4fcff9fe2c1bc9b7cb78da94add3b5186032ef Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Mon, 8 May 2023 10:03:03 +0200 Subject: [PATCH 2/6] 8305082: Remove finalize() from test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java --- .../runtime/linkResolver/InterfaceObj.jasm | 20 ------------------ .../linkResolver/InterfaceObjectTest.java | 21 ++++++------------- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm index 18231344c64fb..4f0f0e72befdd 100644 --- a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm +++ b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm @@ -26,12 +26,6 @@ interface I { } public class InterfaceObj implements I { - static void f(I intf) throws Throwable { - I.finalize(); - } - public static void testFinalize() throws Throwable { - f(new InterfaceObj()); - } static void c(I intf) throws Throwable { I.clone(); } @@ -53,20 +47,6 @@ super public class InterfaceObj implements I version 60:0 { return; } - static Method f:"(LI;)V" throws java/lang/Throwable stack 1 locals 1 { - aload_0; - invokeinterface InterfaceMethod I.finalize:"()V", 1; - return; - } - - public static Method testFinalize:"()V" throws java/lang/Throwable stack 2 locals 1 { - new class InterfaceObj; - dup; - invokespecial Method "":"()V"; - invokestatic Method f:"(LI;)V"; - return; - } - static Method c:"(LI;)V" throws java/lang/Throwable stack 1 locals 1 { aload_0; invokeinterface InterfaceMethod I.clone:"()Ljava/lang/Object;", 1; diff --git a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java index ac7b9f8e8e948..391a445bc73b4 100644 --- a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java +++ b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java @@ -24,13 +24,13 @@ /* * @test * @bug 8026394 8251414 - * @summary test interface resolution when clone and finalize are declared abstract within + * @summary test interface resolution when clone and toString are declared abstract within * an interface and when they are not * @compile InterfaceObj.jasm * @run main InterfaceObjectTest */ interface IClone extends Cloneable { - void finalize() throws Throwable; + String toString(); Object clone(); } @@ -42,19 +42,19 @@ public Object clone() { System.out.println("In InterfaceObjectTest's clone() method\n"); return null; } - @SuppressWarnings("removal") - public void finalize() throws Throwable { + public String toString() { try { - System.out.println("In InterfaceObjectTest's finalize() method\n"); + System.out.println("In InterfaceObjectTest's toString() method\n"); } catch (Throwable t) { throw new AssertionError(t); } + return "InterfaceObjectTest"; } public static void tryIt(ICloneExtend o1) { try { Object o2 = o1.clone(); - o1.finalize(); + o1.toString(); } catch (Throwable t) { throw new AssertionError(t); } @@ -69,15 +69,6 @@ public static void main(String[] args) throws Exception { // Test with reflection without abstract public clone() and finalize() methods. Class cls = Class.forName("InterfaceObj"); - try { - java.lang.reflect.Method m = cls.getMethod("testFinalize"); - m.invoke(cls); - throw new RuntimeException("Failed to throw NoSuchMethodError for finalize()"); - } catch (java.lang.reflect.InvocationTargetException e) { - if (!e.getCause().toString().contains("NoSuchMethodError")) { - throw new RuntimeException("wrong ITE: " + e.getCause().toString()); - } - } try { java.lang.reflect.Method m = cls.getMethod("testClone"); From baeafe07c20d2aa75826f0a023213378f05f824a Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Mon, 8 May 2023 10:03:45 +0200 Subject: [PATCH 3/6] 8305082: Remove finalize() from test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java --- test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm index 4f0f0e72befdd..cc1c25e5f40e2 100644 --- a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm +++ b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023 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 From e3e4a257eed733d5293664842927789480de7d1c Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Tue, 9 May 2023 09:59:38 +0200 Subject: [PATCH 4/6] 8305082: Remove finalize() from test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java --- .../runtime/linkResolver/InterfaceObjectTest.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java index 391a445bc73b4..b84422a7fd578 100644 --- a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java +++ b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java @@ -42,19 +42,11 @@ public Object clone() { System.out.println("In InterfaceObjectTest's clone() method\n"); return null; } - public String toString() { - try { - System.out.println("In InterfaceObjectTest's toString() method\n"); - } catch (Throwable t) { - throw new AssertionError(t); - } - return "InterfaceObjectTest"; - } public static void tryIt(ICloneExtend o1) { try { Object o2 = o1.clone(); - o1.toString(); + o1.clone(); } catch (Throwable t) { throw new AssertionError(t); } @@ -62,12 +54,12 @@ public static void tryIt(ICloneExtend o1) { public static void main(String[] args) throws Exception { - // Test with abstract public clone() and finalize() methods. + // Test with abstract public clone() method. InterfaceObjectTest o1 = new InterfaceObjectTest(); tryIt(o1); - // Test with reflection without abstract public clone() and finalize() methods. + // Test with reflection without abstract public clone() and method. Class cls = Class.forName("InterfaceObj"); try { From 23ac0d8b0a53f379ddefa94aff8f94b08828004a Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Tue, 9 May 2023 11:58:33 +0200 Subject: [PATCH 5/6] 8305082: Remove finalize() from test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java --- test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm | 2 +- .../jtreg/runtime/linkResolver/InterfaceObjectTest.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm index cc1c25e5f40e2..cadb904504814 100644 --- a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm +++ b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObj.jasm @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 diff --git a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java index b84422a7fd578..01d21a28dc1c5 100644 --- a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java +++ b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java @@ -46,7 +46,6 @@ public Object clone() { public static void tryIt(ICloneExtend o1) { try { Object o2 = o1.clone(); - o1.clone(); } catch (Throwable t) { throw new AssertionError(t); } @@ -59,7 +58,7 @@ public static void main(String[] args) throws Exception { tryIt(o1); - // Test with reflection without abstract public clone() and method. + // Test with reflection without abstract public clone() method. Class cls = Class.forName("InterfaceObj"); try { From 8ecb5ed7189d6567870d7269c775e8ac709a7041 Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Wed, 10 May 2023 09:48:51 +0200 Subject: [PATCH 6/6] 8305082: Remove finalize() from test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java --- .../jtreg/runtime/linkResolver/InterfaceObjectTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java index 01d21a28dc1c5..3104ec1f1736c 100644 --- a/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java +++ b/test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java @@ -24,13 +24,12 @@ /* * @test * @bug 8026394 8251414 - * @summary test interface resolution when clone and toString are declared abstract within + * @summary test interface resolution when clone is declared abstract within * an interface and when they are not * @compile InterfaceObj.jasm * @run main InterfaceObjectTest */ interface IClone extends Cloneable { - String toString(); Object clone(); }