Tue, 16 Aug 2016 21:41:28 -0700
Added tag jdk8u102-b33 for changeset 36e3c21b5fca
attila@270 | 1 | /* |
attila@270 | 2 | * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
attila@270 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
attila@962 | 4 | * |
attila@270 | 5 | * This code is free software; you can redistribute it and/or modify it |
attila@270 | 6 | * under the terms of the GNU General Public License version 2 only, as |
attila@270 | 7 | * published by the Free Software Foundation. |
attila@962 | 8 | * |
attila@270 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
attila@270 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
attila@270 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
attila@270 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
attila@270 | 13 | * accompanied this code). |
attila@962 | 14 | * |
attila@270 | 15 | * You should have received a copy of the GNU General Public License version |
attila@270 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
attila@270 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
attila@962 | 18 | * |
attila@270 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
attila@270 | 20 | * or visit www.oracle.com if you need additional information or have any |
attila@270 | 21 | * questions. |
attila@270 | 22 | */ |
attila@270 | 23 | |
attila@270 | 24 | /** |
attila@270 | 25 | * JDK-8014647: Allow class-based overrides to be initialized with a ScriptFunction |
attila@270 | 26 | * |
attila@270 | 27 | * @test |
attila@270 | 28 | * @run |
attila@270 | 29 | */ |
attila@270 | 30 | |
attila@270 | 31 | var RunnableImpl1 = Java.extend(java.lang.Runnable, function() { print("I'm runnable 1!") }) |
attila@270 | 32 | var RunnableImpl2 = Java.extend(java.lang.Runnable, function() { print("I'm runnable 2!") }) |
attila@270 | 33 | var r1 = new RunnableImpl1() |
attila@270 | 34 | var r2 = new RunnableImpl2() |
attila@719 | 35 | var RunnableImpl3 = Java.extend(RunnableImpl2); |
attila@719 | 36 | var r3 = new RunnableImpl3({ run: function() { print("I'm runnable 3!") }}) |
attila@270 | 37 | r1.run() |
attila@270 | 38 | r2.run() |
attila@270 | 39 | r3.run() |
attila@719 | 40 | print("r1.class !== r2.class: " + (r1.class !== r2.class)) |
attila@719 | 41 | print("r2.class !== r3.class: " + (r2.class !== r3.class)) |