8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /** 25 * @test 26 * @bug 8200167 8010319 27 * @summary Test direct and MethodHandle access to interface methods using invokespecial semantics 28 * @comment This must be compiled for JDK 10 so that invokespecial is generated. 29 * @compile -source 10 -target 10 SpecialInterfaceCall.java 30 * @compile SpecialInterfaceCallI4.jasm 31 * @run main/othervm -Xint SpecialInterfaceCall 32 * @run main/othervm -Xbatch -XX:+TieredCompilation -XX:TieredStopAtLevel=1 SpecialInterfaceCall 33 * @run main/othervm -Xbatch -XX:-TieredCompilation SpecialInterfaceCall 34 */ 35 36 import java.lang.invoke.*; 37 38 public class SpecialInterfaceCall { 39 interface I1 { 40 default void pub_m() {}; 41 private void priv_m() {}; 42 } 43 interface I2 extends I1 { 44 // This needs to be a public method to avoid access control issues, 45 // but logically we treat it as private and emulate invokespecial 46 // using MethodHandles. 47 default void pub_m() {}; 48 49 private void priv_m() {}; | 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /** 25 * @test 26 * @bug 8200167 8010319 27 * @summary Test direct and MethodHandle access to interface methods using invokespecial semantics 28 * @comment This must be compiled so invokespecial is used 29 * @compile -XDdisableVirtualizedPrivateInvoke SpecialInterfaceCall.java 30 * @compile SpecialInterfaceCallI4.jasm 31 * @run main/othervm -Xint SpecialInterfaceCall 32 * @run main/othervm -Xbatch -XX:+TieredCompilation -XX:TieredStopAtLevel=1 SpecialInterfaceCall 33 * @run main/othervm -Xbatch -XX:-TieredCompilation SpecialInterfaceCall 34 */ 35 36 import java.lang.invoke.*; 37 38 public class SpecialInterfaceCall { 39 interface I1 { 40 default void pub_m() {}; 41 private void priv_m() {}; 42 } 43 interface I2 extends I1 { 44 // This needs to be a public method to avoid access control issues, 45 // but logically we treat it as private and emulate invokespecial 46 // using MethodHandles. 47 default void pub_m() {}; 48 49 private void priv_m() {}; |