Skip to content

Instantly share code, notes, and snippets.

@dmlloyd
Created October 19, 2021 20:22
Show Gist options
  • Save dmlloyd/10a4e2b8213ac267e730be9f7003a870 to your computer and use it in GitHub Desktop.
Save dmlloyd/10a4e2b8213ac267e730be9f7003a870 to your computer and use it in GitHub Desktop.
Why does javac do this?
public <T extends java.lang.Object> T[] toArray(T[]);
descriptor: ([Ljava/lang/Object;)[Ljava/lang/Object;
flags: (0x0001) ACC_PUBLIC
Code:
stack=2, locals=4, args_size=2
0: aload_0
1: getfield #21 // Field mutex:Ljava/lang/Object;
4: dup
5: astore_2
6: monitorenter
7: aload_0
8: getfield #15 // Field c:Ljava/util/Collection;
11: aload_1
12: invokeinterface #41, 2 // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
17: aload_2
18: monitorexit
19: areturn
20: astore_3
21: aload_2
22: monitorexit
23: aload_3
24: athrow
Exception table:
from to target type
7 19 20 any
20 23 20 any // <-- why?!
LineNumberTable:
line 2029: 0
LocalVariableTable:
Start Length Slot Name Signature
0 25 0 this Ljava/util/Collections$SynchronizedCollection;
0 25 1 a [Ljava/lang/Object;
LocalVariableTypeTable:
Start Length Slot Name Signature
0 25 0 this Ljava/util/Collections$SynchronizedCollection<TE;>;
0 25 1 a [TT;
StackMapTable: number_of_entries = 1
frame_type = 255 /* full_frame */
offset_delta = 20
locals = [ class java/util/Collections$SynchronizedCollection, class "[Ljava/lang/Object;", class java/lang/Object ]
stack = [ class java/lang/Throwable ]
Signature: #129 // <T:Ljava/lang/Object;>([TT;)[TT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment