Last active
August 12, 2019 02:30
-
-
Save xuwei-k/d1c18a9d74c6e0755809942868bcfca7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Classfile /Users/kenji/structural-subtype-javap/A.class | |
Last modified Aug 12, 2019; size 2453 bytes | |
MD5 checksum dc2e1948b339005c82b1948b25e9356f | |
Compiled from "A.scala" | |
public class A | |
minor version: 0 | |
major version: 52 | |
flags: ACC_PUBLIC, ACC_SUPER | |
Constant pool: | |
#1 = Utf8 A | |
#2 = Class #1 // A | |
#3 = Utf8 java/lang/Object | |
#4 = Class #3 // java/lang/Object | |
#5 = Utf8 A.scala | |
#6 = Utf8 Lscala/reflect/ScalaSignature; | |
#7 = Utf8 bytes | |
#8 = Utf8 }1Aa!)aC!)!C'\t\tICaT-9uszaAD)\t1\"AtGd-\t1I\=SKaP5oSRtD#\tEQ\"|w/A\"F-)A!8ji\")Da3\tP!11a$/4j]lWM;?i\"D\"Gn\:f)! | |
#9 = Utf8 java/lang/invoke/MethodHandles$Lookup | |
#10 = Class #9 // java/lang/invoke/MethodHandles$Lookup | |
#11 = Utf8 java/lang/invoke/MethodHandles | |
#12 = Class #11 // java/lang/invoke/MethodHandles | |
#13 = Utf8 Lookup | |
#14 = Utf8 reflMethod$Method1 | |
#15 = Utf8 (Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
#16 = Utf8 x$1 | |
#17 = Utf8 ()Ljava/lang/Object; | |
#18 = MethodType #17 // ()Ljava/lang/Object; | |
#19 = Utf8 scala/runtime/StructuralCallSite | |
#20 = Class #19 // scala/runtime/StructuralCallSite | |
#21 = Utf8 bootstrap | |
#22 = Utf8 (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; | |
#23 = NameAndType #21:#22 // bootstrap:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; | |
#24 = Methodref #20.#23 // scala/runtime/StructuralCallSite.bootstrap:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; | |
#25 = MethodHandle #6:#24 // invokestatic scala/runtime/StructuralCallSite.bootstrap:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; | |
#26 = Utf8 apply | |
#27 = Utf8 ()Lscala/runtime/StructuralCallSite; | |
#28 = NameAndType #26:#27 // apply:()Lscala/runtime/StructuralCallSite; | |
#29 = InvokeDynamic #0:#28 // #0:apply:()Lscala/runtime/StructuralCallSite; | |
#30 = Utf8 find | |
#31 = NameAndType #30:#15 // find:(Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
#32 = Methodref #20.#31 // scala/runtime/StructuralCallSite.find:(Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
#33 = Utf8 scala/runtime/ScalaRunTime$ | |
#34 = Class #33 // scala/runtime/ScalaRunTime$ | |
#35 = Utf8 MODULE$ | |
#36 = Utf8 Lscala/runtime/ScalaRunTime$; | |
#37 = NameAndType #35:#36 // MODULE$:Lscala/runtime/ScalaRunTime$; | |
#38 = Fieldref #34.#37 // scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$; | |
#39 = Utf8 close | |
#40 = String #39 // close | |
#41 = Utf8 parameterTypes | |
#42 = Utf8 ()[Ljava/lang/Class; | |
#43 = NameAndType #41:#42 // parameterTypes:()[Ljava/lang/Class; | |
#44 = Methodref #20.#43 // scala/runtime/StructuralCallSite.parameterTypes:()[Ljava/lang/Class; | |
#45 = Utf8 java/lang/Class | |
#46 = Class #45 // java/lang/Class | |
#47 = Utf8 getMethod | |
#48 = Utf8 (Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
#49 = NameAndType #47:#48 // getMethod:(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
#50 = Methodref #46.#49 // java/lang/Class.getMethod:(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
#51 = Utf8 ensureAccessible | |
#52 = Utf8 (Ljava/lang/reflect/Method;)Ljava/lang/reflect/Method; | |
#53 = NameAndType #51:#52 // ensureAccessible:(Ljava/lang/reflect/Method;)Ljava/lang/reflect/Method; | |
#54 = Methodref #34.#53 // scala/runtime/ScalaRunTime$.ensureAccessible:(Ljava/lang/reflect/Method;)Ljava/lang/reflect/Method; | |
#55 = Utf8 add | |
#56 = Utf8 (Ljava/lang/Class;Ljava/lang/reflect/Method;)Ljava/lang/reflect/Method; | |
#57 = NameAndType #55:#56 // add:(Ljava/lang/Class;Ljava/lang/reflect/Method;)Ljava/lang/reflect/Method; | |
#58 = Methodref #20.#57 // scala/runtime/StructuralCallSite.add:(Ljava/lang/Class;Ljava/lang/reflect/Method;)Ljava/lang/reflect/Method; | |
#59 = Utf8 methodCache1 | |
#60 = Utf8 Lscala/runtime/StructuralCallSite; | |
#61 = Utf8 method1 | |
#62 = Utf8 Ljava/lang/reflect/Method; | |
#63 = Utf8 Ljava/lang/Class; | |
#64 = Utf8 java/lang/reflect/Method | |
#65 = Class #64 // java/lang/reflect/Method | |
#66 = Utf8 foo | |
#67 = Utf8 (Ljava/lang/Object;)V | |
#68 = Utf8 x | |
#69 = Utf8 java/lang/reflect/InvocationTargetException | |
#70 = Class #69 // java/lang/reflect/InvocationTargetException | |
#71 = Utf8 getClass | |
#72 = Utf8 ()Ljava/lang/Class; | |
#73 = NameAndType #71:#72 // getClass:()Ljava/lang/Class; | |
#74 = Methodref #4.#73 // java/lang/Object.getClass:()Ljava/lang/Class; | |
#75 = NameAndType #14:#15 // reflMethod$Method1:(Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
#76 = Methodref #2.#75 // A.reflMethod$Method1:(Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
#77 = Utf8 invoke | |
#78 = Utf8 (Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; | |
#79 = NameAndType #77:#78 // invoke:(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; | |
#80 = Methodref #65.#79 // java/lang/reflect/Method.invoke:(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; | |
#81 = Utf8 getCause | |
#82 = Utf8 ()Ljava/lang/Throwable; | |
#83 = NameAndType #81:#82 // getCause:()Ljava/lang/Throwable; | |
#84 = Methodref #70.#83 // java/lang/reflect/InvocationTargetException.getCause:()Ljava/lang/Throwable; | |
#85 = Utf8 scala/runtime/BoxedUnit | |
#86 = Class #85 // scala/runtime/BoxedUnit | |
#87 = Utf8 UNIT | |
#88 = Utf8 Lscala/runtime/BoxedUnit; | |
#89 = NameAndType #87:#88 // UNIT:Lscala/runtime/BoxedUnit; | |
#90 = Fieldref #86.#89 // scala/runtime/BoxedUnit.UNIT:Lscala/runtime/BoxedUnit; | |
#91 = Utf8 1 | |
#92 = Utf8 Ljava/lang/reflect/InvocationTargetException; | |
#93 = Utf8 qual1 | |
#94 = Utf8 Ljava/lang/Object; | |
#95 = Utf8 this | |
#96 = Utf8 LA; | |
#97 = Utf8 <init> | |
#98 = Utf8 ()V | |
#99 = NameAndType #97:#98 // "<init>":()V | |
#100 = Methodref #4.#99 // java/lang/Object."<init>":()V | |
#101 = Utf8 Code | |
#102 = Utf8 StackMapTable | |
#103 = Utf8 LineNumberTable | |
#104 = Utf8 LocalVariableTable | |
#105 = Utf8 MethodParameters | |
#106 = Utf8 InnerClasses | |
#107 = Utf8 SourceFile | |
#108 = Utf8 RuntimeVisibleAnnotations | |
#109 = Utf8 BootstrapMethods | |
#110 = Utf8 ScalaInlineInfo | |
#111 = Utf8 ScalaSig | |
{ | |
public static java.lang.reflect.Method reflMethod$Method1(java.lang.Class); | |
descriptor: (Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
flags: ACC_PUBLIC, ACC_STATIC | |
Code: | |
stack=4, locals=3, args_size=1 | |
0: invokedynamic #29, 0 // InvokeDynamic #0:apply:()Lscala/runtime/StructuralCallSite; | |
5: astore_1 | |
6: aload_1 | |
7: aload_0 | |
8: invokevirtual #32 // Method scala/runtime/StructuralCallSite.find:(Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
11: astore_2 | |
12: aload_2 | |
13: ifnull 18 | |
16: aload_2 | |
17: areturn | |
18: getstatic #38 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$; | |
21: aload_0 | |
22: ldc #40 // String close | |
24: aload_1 | |
25: invokevirtual #44 // Method scala/runtime/StructuralCallSite.parameterTypes:()[Ljava/lang/Class; | |
28: invokevirtual #50 // Method java/lang/Class.getMethod:(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
31: invokevirtual #54 // Method scala/runtime/ScalaRunTime$.ensureAccessible:(Ljava/lang/reflect/Method;)Ljava/lang/reflect/Method; | |
34: astore_2 | |
35: aload_1 | |
36: aload_0 | |
37: aload_2 | |
38: invokevirtual #58 // Method scala/runtime/StructuralCallSite.add:(Ljava/lang/Class;Ljava/lang/reflect/Method;)Ljava/lang/reflect/Method; | |
41: pop | |
42: aload_2 | |
43: areturn | |
StackMapTable: number_of_entries = 1 | |
frame_type = 253 /* append */ | |
offset_delta = 18 | |
locals = [ class scala/runtime/StructuralCallSite, class java/lang/reflect/Method ] | |
LineNumberTable: | |
line 3: 0 | |
LocalVariableTable: | |
Start Length Slot Name Signature | |
5 39 1 methodCache1 Lscala/runtime/StructuralCallSite; | |
11 33 2 method1 Ljava/lang/reflect/Method; | |
0 44 0 x$1 Ljava/lang/Class; | |
MethodParameters: | |
Name Flags | |
x$1 final | |
public void foo(java.lang.Object); | |
descriptor: (Ljava/lang/Object;)V | |
flags: ACC_PUBLIC | |
Code: | |
stack=3, locals=4, args_size=2 | |
0: aload_1 | |
1: astore_2 | |
2: aload_2 | |
3: invokevirtual #74 // Method java/lang/Object.getClass:()Ljava/lang/Class; | |
6: invokestatic #76 // Method reflMethod$Method1:(Ljava/lang/Class;)Ljava/lang/reflect/Method; | |
9: aload_2 | |
10: iconst_0 | |
11: anewarray #4 // class java/lang/Object | |
14: invokevirtual #80 // Method java/lang/reflect/Method.invoke:(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; | |
17: goto 26 | |
20: astore_3 | |
21: aload_3 | |
22: invokevirtual #84 // Method java/lang/reflect/InvocationTargetException.getCause:()Ljava/lang/Throwable; | |
25: athrow | |
26: pop | |
27: getstatic #90 // Field scala/runtime/BoxedUnit.UNIT:Lscala/runtime/BoxedUnit; | |
30: pop | |
31: return | |
Exception table: | |
from to target type | |
2 17 20 Class java/lang/reflect/InvocationTargetException | |
StackMapTable: number_of_entries = 2 | |
frame_type = 255 /* full_frame */ | |
offset_delta = 20 | |
locals = [ class A, class java/lang/Object, class java/lang/Object ] | |
stack = [ class java/lang/reflect/InvocationTargetException ] | |
frame_type = 69 /* same_locals_1_stack_item */ | |
stack = [ class java/lang/Object ] | |
LineNumberTable: | |
line 3: 0 | |
LocalVariableTable: | |
Start Length Slot Name Signature | |
20 6 3 1 Ljava/lang/reflect/InvocationTargetException; | |
1 30 2 qual1 Ljava/lang/Object; | |
0 32 0 this LA; | |
0 32 1 x Ljava/lang/Object; | |
MethodParameters: | |
Name Flags | |
x final | |
public A(); | |
descriptor: ()V | |
flags: ACC_PUBLIC | |
Code: | |
stack=1, locals=1, args_size=1 | |
0: aload_0 | |
1: invokespecial #100 // Method java/lang/Object."<init>":()V | |
4: return | |
LineNumberTable: | |
line 5: 0 | |
line 1: 4 | |
LocalVariableTable: | |
Start Length Slot Name Signature | |
0 5 0 this LA; | |
} | |
InnerClasses: | |
public static final #13= #10 of #12; //Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles | |
SourceFile: "A.scala" | |
RuntimeVisibleAnnotations: | |
0: #6(#7=s#8) | |
BootstrapMethods: | |
0: #25 invokestatic scala/runtime/StructuralCallSite.bootstrap:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; | |
Method arguments: | |
#18 ()Ljava/lang/Object; | |
Error: unknown attribute | |
ScalaInlineInfo: length = 0x13 | |
01 00 00 03 00 61 00 62 00 00 42 00 43 00 00 0E | |
00 0F 00 | |
Error: unknown attribute | |
ScalaSig: length = 0x3 | |
05 02 00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
def foo(x: {def close(): Unit}): Unit = { | |
x.close() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.javadecompilers.com | |
import scala.runtime.BoxedUnit; | |
import java.lang.reflect.InvocationTargetException; | |
import scala.runtime.StructuralCallSite; | |
import scala.runtime.ScalaRunTime$; | |
import java.lang.reflect.Method; | |
import scala.reflect.ScalaSignature; | |
// | |
// Decompiled by Procyon v0.5.36 | |
// | |
@ScalaSignature(bytes = "\u0006\u0005}1Aa\u0001\u0003\u0001\u000f!)a\u0002\u0001C\u0001\u001f!)!\u0003\u0001C\u0001'\t\t\u0011IC\u0001\u0006\u0003\u001daT-\u001c9usz\u001a\u0001a\u0005\u0002\u0001\u0011A\u0011\u0011\u0002D\u0007\u0002\u0015)\t1\"A\u0003tG\u0006d\u0017-\u0003\u0002\u000e\u0015\t1\u0011I\\=SK\u001a\fa\u0001P5oSRtD#\u0001\t\u0011\u0005E\u0001Q\"\u0001\u0003\u0002\u0007\u0019|w\u000e\u0006\u0002\u0015/A\u0011\u0011\"F\u0005\u0003-)\u0011A!\u00168ji\")\u0001D\u0001a\u00013\u0005\t\u0001P\u0005\u0002\u001b\u0011\u0019!1\u0004\u0001\u0001\u001a\u00051a$/\u001a4j]\u0016lWM\u001c;?\u0011\u0015i\"D\"\u0001\u001f\u0003\u0015\u0019Gn\\:f)\u0005!\u0002") | |
public class A | |
{ | |
public static Method reflMethod$Method1(final Class x$1) { | |
final StructuralCallSite methodCache1 = invokedynamic(apply:()Lscala/runtime/StructuralCallSite;); | |
Method method1 = methodCache1.find(x$1); | |
if (method1 != null) { | |
return method1; | |
} | |
method1 = ScalaRunTime$.MODULE$.ensureAccessible(x$1.getMethod("close", (Class[])methodCache1.parameterTypes())); | |
methodCache1.add(x$1, method1); | |
return method1; | |
} | |
public void foo(final Object x) { | |
final Object qual1 = x; | |
try { | |
reflMethod$Method1(qual1.getClass()).invoke(qual1, new Object[0]); | |
} | |
catch (InvocationTargetException 1) { | |
throw 1.getCause(); | |
} | |
final BoxedUnit unit = BoxedUnit.UNIT; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment