< prev index next >

test/java/lang/reflect/Method/InterfaceStatic/StaticInterfaceMethodInWayOfDefault.java

Print this page
rev 16983 : [mq]: 8180397

*** 1,7 **** /* ! * Copyright (c) 2013, 2014, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2013, 2017, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 32,47 **** * @run main StaticInterfaceMethodInWayOfDefault */ import java.io.IOException; import java.io.InputStream; - import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.concurrent.Callable; - import jdk.testlibrary.IOUtils; - public class StaticInterfaceMethodInWayOfDefault { public interface A_v1 { } public interface A_v2 { --- 32,44 ----
*** 145,155 **** if (name.endsWith("_v1")) { String altName = name.substring(0, name.length() - 3) + "_v2"; String altPath = altName.replace('.', '/').concat(".class"); try (InputStream is = getResourceAsStream(altPath)) { if (is != null) { ! byte[] bytes = IOUtils.readFully(is); // patch class bytes to contain original name for (int i = 0; i < bytes.length - 2; i++) { if (bytes[i] == '_' && bytes[i + 1] == 'v' && bytes[i + 2] == '2') { --- 142,152 ---- if (name.endsWith("_v1")) { String altName = name.substring(0, name.length() - 3) + "_v2"; String altPath = altName.replace('.', '/').concat(".class"); try (InputStream is = getResourceAsStream(altPath)) { if (is != null) { ! byte[] bytes = is.readAllBytes(); // patch class bytes to contain original name for (int i = 0; i < bytes.length - 2; i++) { if (bytes[i] == '_' && bytes[i + 1] == 'v' && bytes[i + 2] == '2') {
*** 168,178 **** } else { // not special class name -> just load the class String path = name.replace('.', '/').concat(".class"); try (InputStream is = getResourceAsStream(path)) { if (is != null) { ! byte[] bytes = IOUtils.readFully(is); return defineClass(name, bytes, 0, bytes.length); } else { throw new ClassNotFoundException(name); } --- 165,175 ---- } else { // not special class name -> just load the class String path = name.replace('.', '/').concat(".class"); try (InputStream is = getResourceAsStream(path)) { if (is != null) { ! byte[] bytes = is.readAllBytes(); return defineClass(name, bytes, 0, bytes.length); } else { throw new ClassNotFoundException(name); }
< prev index next >