1.1 --- a/test/tools/javac/defaultMethods/defaultMethodExecution/DefaultMethodRegressionTests.java Thu Aug 15 09:26:00 2013 -0700 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,138 +0,0 @@ 1.4 -/* 1.5 - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 - * 1.8 - * This code is free software; you can redistribute it and/or modify it 1.9 - * under the terms of the GNU General Public License version 2 only, as 1.10 - * published by the Free Software Foundation. Oracle designates this 1.11 - * particular file as subject to the "Classpath" exception as provided 1.12 - * by Oracle in the LICENSE file that accompanied this code. 1.13 - * 1.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 - * version 2 for more details (a copy is included in the LICENSE file that 1.18 - * accompanied this code). 1.19 - * 1.20 - * You should have received a copy of the GNU General Public License version 1.21 - * 2 along with this work; if not, write to the Free Software Foundation, 1.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 - * 1.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 - * or visit www.oracle.com if you need additional information or have any 1.26 - * questions. 1.27 - */ 1.28 - 1.29 -/** 1.30 - * @test 1.31 - * @ignore 8007517: DefaultMethodRegressionTests.java fail in TL 1.32 - * @bug 8003639 1.33 - * @summary convert lambda testng tests to jtreg and add them 1.34 - * @run testng DefaultMethodRegressionTests 1.35 - */ 1.36 - 1.37 -import java.util.ArrayList; 1.38 -import java.util.Arrays; 1.39 -import java.util.List; 1.40 -import org.testng.annotations.Test; 1.41 - 1.42 -import static org.testng.Assert.*; 1.43 - 1.44 -/** 1.45 - * This set of classes/interfaces (K/I/C) is specially designed to expose a 1.46 - * bug in the JVM where it did not find some overloaded methods in some 1.47 - * specific situations. (fixed by hotspot changeset ffb9316fd9ed) 1.48 - */ 1.49 -interface K { 1.50 - int bbb(Long l); 1.51 -} 1.52 - 1.53 -interface I extends K { 1.54 - default void aaa() {} 1.55 - default void aab() {} 1.56 - default void aac() {} 1.57 - 1.58 - default int bbb(Integer i) { return 22; } 1.59 - default int bbb(Float f) { return 33; } 1.60 - default int bbb(Long l) { return 44; } 1.61 - default int bbb(Double d) { return 55; } 1.62 - default int bbb(String s) { return 66; } 1.63 - 1.64 - default void caa() {} 1.65 - default void cab() {} 1.66 - default void cac() {} 1.67 -} 1.68 - 1.69 -class C implements I {} 1.70 - 1.71 -public class DefaultMethodRegressionTests { 1.72 - 1.73 - @Test(groups = "vm") 1.74 - public void testLostOverloadedMethod() { 1.75 - C c = new C(); 1.76 - assertEquals(c.bbb(new Integer(1)), 22); 1.77 - assertEquals(c.bbb(new Float(1.1)), 33); 1.78 - assertEquals(c.bbb(new Long(1L)), 44); 1.79 - assertEquals(c.bbb(new Double(0.01)), 55); 1.80 - assertEquals(c.bbb(new String("")), 66); 1.81 - } 1.82 - 1.83 - // Test to ensure that the inference verifier accepts older classfiles 1.84 - // with classes that implement interfaces with defaults. 1.85 - @Test(groups = "vm") 1.86 - public void testInferenceVerifier() { 1.87 - // interface I { int m() default { return 99; } } 1.88 - byte I_bytes[] = { 1.89 - (byte)0xca, (byte)0xfe, (byte)0xba, (byte)0xbe, 0x00, 0x00, 0x00, 0x33, 1.90 - 0x00, 0x08, 0x07, 0x00, 0x06, 0x07, 0x00, 0x07, 1.91 - 0x01, 0x00, 0x03, 0x66, 0x6f, 0x6f, 0x01, 0x00, 1.92 - 0x03, 0x28, 0x29, 0x49, 0x01, 0x00, 0x04, 0x43, 1.93 - 0x6f, 0x64, 0x65, 0x01, 0x00, 0x01, 0x49, 0x01, 1.94 - 0x00, 0x10, 0x6a, 0x61, 0x76, 0x61, 0x2f, 0x6c, 1.95 - 0x61, 0x6e, 0x67, 0x2f, 0x4f, 0x62, 0x6a, 0x65, 1.96 - 0x63, 0x74, 0x06, 0x00, 0x00, 0x01, 0x00, 0x02, 1.97 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x01, 1.98 - 0x00, 0x03, 0x00, 0x04, 0x00, 0x01, 0x00, 0x05, 1.99 - 0x00, 0x00, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x01, 1.100 - 0x00, 0x00, 0x00, 0x03, 0x10, 0x63, (byte)0xac, 0x00, 1.101 - 0x00, 0x00, 0x00, 0x00, 0x00 1.102 - }; 1.103 - // public class C implements I {} /* -target 1.5 */ 1.104 - byte C_bytes[] = { 1.105 - (byte)0xca, (byte)0xfe, (byte)0xba, (byte)0xbe, 0x00, 0x00, 0x00, 0x31, 1.106 - 0x00, 0x0c, 0x0a, 0x00, 0x03, 0x00, 0x08, 0x07, 1.107 - 0x00, 0x09, 0x07, 0x00, 0x0a, 0x07, 0x00, 0x0b, 1.108 - 0x01, 0x00, 0x06, 0x3c, 0x69, 0x6e, 0x69, 0x74, 1.109 - 0x3e, 0x01, 0x00, 0x03, 0x28, 0x29, 0x56, 0x01, 1.110 - 0x00, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x0c, 0x00, 1.111 - 0x05, 0x00, 0x06, 0x01, 0x00, 0x01, 0x43, 0x01, 1.112 - 0x00, 0x10, 0x6a, 0x61, 0x76, 0x61, 0x2f, 0x6c, 1.113 - 0x61, 0x6e, 0x67, 0x2f, 0x4f, 0x62, 0x6a, 0x65, 1.114 - 0x63, 0x74, 0x01, 0x00, 0x01, 0x49, 0x00, 0x21, 1.115 - 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 1.116 - 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x05, 1.117 - 0x00, 0x06, 0x00, 0x01, 0x00, 0x07, 0x00, 0x00, 1.118 - 0x00, 0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 1.119 - 0x00, 0x05, 0x2a, (byte)0xb7, 0x00, 0x01, (byte)0xb1, 0x00, 1.120 - 0x00, 0x00, 0x00, 0x00, 0x00 1.121 - }; 1.122 - 1.123 - ClassLoader cl = new ClassLoader() { 1.124 - protected Class<?> findClass(String name) { 1.125 - if (name.equals("I")) { 1.126 - return defineClass("I", I_bytes, 0, I_bytes.length); 1.127 - } else if (name.equals("C")) { 1.128 - return defineClass("C", C_bytes, 0, C_bytes.length); 1.129 - } else { 1.130 - return null; 1.131 - } 1.132 - } 1.133 - }; 1.134 - try { 1.135 - Class.forName("C", true, cl); 1.136 - } catch (Exception e) { 1.137 - // unmodified verifier will throw VerifyError 1.138 - fail("No exception should be thrown"); 1.139 - } 1.140 - } 1.141 -}