Skip to content

Instantly share code, notes, and snippets.

@Madusudanan
Created April 27, 2017 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Madusudanan/135e70cf55934c318b90eeee624236d8 to your computer and use it in GitHub Desktop.
Save Madusudanan/135e70cf55934c318b90eeee624236d8 to your computer and use it in GitHub Desktop.
Complex number case class decompiled
public class ComplexNumber implements scala.Product,scala.Serializable {
public static scala.Option<scala.Tuple2<java.lang.Object, java.lang.Object>> unapply(ComplexNumber);
Code:
0: getstatic #20 // Field ComplexNumber$.MODULE$:LComplexNumber$;
3: aload_0
4: invokevirtual #22 // Method ComplexNumber$.unapply:(LComplexNumber;)Lscala/Option;
7: areturn
public static ComplexNumber apply(double, double);
Code:
0: getstatic #20 // Field ComplexNumber$.MODULE$:LComplexNumber$;
3: dload_0
4: dload_2
5: invokevirtual #26 // Method ComplexNumber$.apply:(DD)LComplexNumber;
8: areturn
public static scala.Function1<scala.Tuple2<java.lang.Object, java.lang.Object>, ComplexNumber> tupled();
Code:
0: getstatic #20 // Field ComplexNumber$.MODULE$:LComplexNumber$;
3: invokevirtual #30 // Method ComplexNumber$.tupled:()Lscala/Function1;
6: areturn
public static scala.Function1<java.lang.Object, scala.Function1<java.lang.Object, ComplexNumber>> curried();
Code:
0: getstatic #20 // Field ComplexNumber$.MODULE$:LComplexNumber$;
3: invokevirtual #33 // Method ComplexNumber$.curried:()Lscala/Function1;
6: areturn
public double real();
Code:
0: aload_0
1: getfield #39 // Field real:D
4: dreturn
public double imaginary();
Code:
0: aload_0
1: getfield #43 // Field imaginary:D
4: dreturn
public ComplexNumber $plus(ComplexNumber);
Code:
0: new #2 // class ComplexNumber
3: dup
4: aload_0
5: invokevirtual #47 // Method real:()D
8: aload_1
9: invokevirtual #47 // Method real:()D
12: dadd
13: aload_0
14: invokevirtual #49 // Method imaginary:()D
17: aload_1
18: invokevirtual #49 // Method imaginary:()D
21: dadd
22: invokespecial #53 // Method "<init>":(DD)V
25: areturn
public ComplexNumber copy(double, double);
Code:
0: new #2 // class ComplexNumber
3: dup
4: dload_1
5: dload_3
6: invokespecial #53 // Method "<init>":(DD)V
9: areturn
public double copy$default$1();
Code:
0: aload_0
1: invokevirtual #47 // Method real:()D
4: dreturn
public double copy$default$2();
Code:
0: aload_0
1: invokevirtual #49 // Method imaginary:()D
4: dreturn
public java.lang.String productPrefix();
Code:
0: ldc #60 // String ComplexNumber
2: areturn
public int productArity();
Code:
0: iconst_2
1: ireturn
public java.lang.Object productElement(int);
Code:
0: iload_1
1: istore_2
2: iload_2
3: tableswitch { // 0 to 1
0: 49
1: 39
default: 24
}
24: new #66 // class java/lang/IndexOutOfBoundsException
27: dup
28: iload_1
29: invokestatic #72 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
32: invokevirtual #75 // Method java/lang/Object.toString:()Ljava/lang/String;
35: invokespecial #78 // Method java/lang/IndexOutOfBoundsException."<init>":(Ljava/lang/String;)V
38: athrow
39: aload_0
40: invokevirtual #49 // Method imaginary:()D
43: invokestatic #82 // Method scala/runtime/BoxesRunTime.boxToDouble:(D)Ljava/lang/Double;
46: goto 56
49: aload_0
50: invokevirtual #47 // Method real:()D
53: invokestatic #82 // Method scala/runtime/BoxesRunTime.boxToDouble:(D)Ljava/lang/Double;
56: areturn
public scala.collection.Iterator<java.lang.Object> productIterator();
Code:
0: getstatic #93 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
3: aload_0
4: invokevirtual #97 // Method scala/runtime/ScalaRunTime$.typedProductIterator:(Lscala/Product;)Lscala/collection/Iterator;
7: areturn
public boolean canEqual(java.lang.Object);
Code:
0: aload_1
1: instanceof #2 // class ComplexNumber
4: ireturn
public int hashCode();
Code:
0: ldc #102 // int -889275714
2: istore_1
3: iload_1
4: aload_0
5: invokevirtual #47 // Method real:()D
8: invokestatic #108 // Method scala/runtime/Statics.doubleHash:(D)I
11: invokestatic #112 // Method scala/runtime/Statics.mix:(II)I
14: istore_1
15: iload_1
16: aload_0
17: invokevirtual #49 // Method imaginary:()D
20: invokestatic #108 // Method scala/runtime/Statics.doubleHash:(D)I
23: invokestatic #112 // Method scala/runtime/Statics.mix:(II)I
26: istore_1
27: iload_1
28: iconst_2
29: invokestatic #115 // Method scala/runtime/Statics.finalizeHash:(II)I
32: ireturn
public java.lang.String toString();
Code:
0: getstatic #93 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
3: aload_0
4: invokevirtual #119 // Method scala/runtime/ScalaRunTime$._toString:(Lscala/Product;)Ljava/lang/String;
7: areturn
public boolean equals(java.lang.Object);
Code:
0: aload_0
1: aload_1
2: if_acmpeq 74
5: aload_1
6: astore_2
7: aload_2
8: instanceof #2 // class ComplexNumber
11: ifeq 19
14: iconst_1
15: istore_3
16: goto 21
19: iconst_0
20: istore_3
21: iload_3
22: ifeq 78
25: aload_1
26: checkcast #2 // class ComplexNumber
29: astore 4
31: aload_0
32: invokevirtual #47 // Method real:()D
35: aload 4
37: invokevirtual #47 // Method real:()D
40: dcmpl
41: ifne 70
44: aload_0
45: invokevirtual #49 // Method imaginary:()D
48: aload 4
50: invokevirtual #49 // Method imaginary:()D
53: dcmpl
54: ifne 70
57: aload 4
59: aload_0
60: invokevirtual #122 // Method canEqual:(Ljava/lang/Object;)Z
63: ifeq 70
66: iconst_1
67: goto 71
70: iconst_0
71: ifeq 78
74: iconst_1
75: goto 79
78: iconst_0
79: ireturn
public ComplexNumber(double, double);
Code:
0: aload_0
1: dload_1
2: putfield #39 // Field real:D
5: aload_0
6: dload_3
7: putfield #43 // Field imaginary:D
10: aload_0
11: invokespecial #125 // Method java/lang/Object."<init>":()V
14: aload_0
15: invokestatic #131 // Method scala/Product$class.$init$:(Lscala/Product;)V
18: return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment