Created
June 4, 2013 17:58
-
-
Save stew/5708046 to your computer and use it in GitHub Desktop.
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
| public java.lang.String foo(scala.Option<java.lang.String>); | |
| Code: | |
| 0: aload_1 | |
| 1: astore_2 | |
| 2: aload_2 | |
| 3: instanceof #16 // class scala/Some | |
| 6: ifeq 34 | |
| 9: aload_2 | |
| 10: checkcast #16 // class scala/Some | |
| 13: astore_3 | |
| 14: aload_3 | |
| 15: ifnull 34 | |
| 18: aload_3 | |
| 19: invokevirtual #20 // Method scala/Some.x:()Ljava/lang/Object; | |
| 22: checkcast #22 // class java/lang/String | |
| 25: astore 4 | |
| 27: aload 4 | |
| 29: astore 5 | |
| 31: goto 68 | |
| 34: getstatic #27 // Field scala/None$.MODULE$:Lscala/None$; | |
| 37: aload_2 | |
| 38: astore 6 | |
| 40: dup | |
| 41: ifnonnull 53 | |
| 44: pop | |
| 45: aload 6 | |
| 47: ifnull 61 | |
| 50: goto 71 | |
| 53: aload 6 | |
| 55: invokevirtual #31 // Method java/lang/Object.equals:(Ljava/lang/Object;)Z | |
| 58: ifeq 71 | |
| 61: aload_2 | |
| 62: astore 7 | |
| 64: ldc #33 // String | |
| 66: astore 5 | |
| 68: aload 5 | |
| 70: areturn | |
| 71: new #35 // class scala/MatchError | |
| 74: dup | |
| 75: aload_2 | |
| 76: invokespecial #38 // Method scala/MatchError."<init>":(Ljava/lang/Object;)V | |
| 79: athrow |
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
| object TestMatch { | |
| def foo(x: Option[String]): String = { | |
| x match { | |
| case Some(y) => y | |
| case None => "" | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment