| // Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| package com.android.tools.r8.resolution.invokestaticinterfacedefault; |
| |
| import org.objectweb.asm.AnnotationVisitor; |
| import org.objectweb.asm.ClassWriter; |
| import org.objectweb.asm.FieldVisitor; |
| import org.objectweb.asm.MethodVisitor; |
| import org.objectweb.asm.Opcodes; |
| |
| /** |
| * Generated by {@link jdk.internal.org.objectweb.asm.util.ASMifier} from the following source: <p> |
| * <pre> |
| * interface Interface { |
| * |
| * default public void aMethod() { |
| * System.out.println(42); |
| * } |
| * } |
| * </pre> |
| */ |
| public class InterfaceDump implements Opcodes { |
| |
| public static byte[] dump() throws Exception { |
| |
| ClassWriter cw = new ClassWriter(0); |
| FieldVisitor fv; |
| MethodVisitor mv; |
| AnnotationVisitor av0; |
| |
| cw.visit(V1_8, ACC_ABSTRACT + ACC_INTERFACE, "Interface", null, "java/lang/Object", null); |
| |
| { |
| mv = cw.visitMethod(ACC_PUBLIC, "aMethod", "()V", null, null); |
| mv.visitCode(); |
| mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); |
| mv.visitIntInsn(BIPUSH, 42); |
| mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(I)V", false); |
| mv.visitInsn(RETURN); |
| mv.visitMaxs(2, 1); |
| mv.visitEnd(); |
| } |
| cw.visitEnd(); |
| |
| return cw.toByteArray(); |
| } |
| } |