Created
April 30, 2021 05:26
-
-
Save umireon/00da8dbab2b6bf926d83a646fc7589b7 to your computer and use it in GitHub Desktop.
Scala trait ABI
This file contains hidden or 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
package main; | |
public interface TestTrait { | |
public default int method(int x) { | |
return x * 2; | |
} | |
} |
This file contains hidden or 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
package main | |
trait TestTrait { | |
def method(x: Int): Unit = { | |
x * 2 | |
} | |
} |
This file contains hidden or 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
// Generated by running 'javap -c TestTrait' | |
Compiled from "TestTrait.java" | |
public interface main.TestTrait { | |
public int method(int); | |
Code: | |
0: iload_1 | |
1: iconst_2 | |
2: imul | |
3: ireturn | |
} |
This file contains hidden or 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
// Generated by running 'javap -c TestTrait' | |
Compiled from "TestTrait.scala" | |
public interface main.TestTrait { | |
public static void method$(main.TestTrait, int); | |
Code: | |
0: aload_0 | |
1: iload_1 | |
2: invokespecial #16 // InterfaceMethod method:(I)V | |
5: return | |
public void method(int); | |
Code: | |
0: iload_1 | |
1: iconst_2 | |
2: imul | |
3: pop | |
4: return | |
public static void $init$(main.TestTrait); | |
Code: | |
0: return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment