public
Created

Eclipse generated method hashCode()

  • Download Gist
T1.java
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
package bytecode;
 
public class T1 {
 
private int i;
 
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + i;
return result;
}
 
}
T1.javap
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
Compiled from "T1.java"
public class bytecode.T1 extends java.lang.Object
SourceFile: "T1.java"
minor version: 0
major version: 50
Constant pool:
const #1 = class #2; // bytecode/T1
const #2 = Asciz bytecode/T1;
const #3 = class #4; // java/lang/Object
const #4 = Asciz java/lang/Object;
const #5 = Asciz i;
const #6 = Asciz I;
const #7 = Asciz <init>;
const #8 = Asciz ()V;
const #9 = Asciz Code;
const #10 = Method #3.#11; // java/lang/Object."<init>":()V
const #11 = NameAndType #7:#8;// "<init>":()V
const #12 = Asciz LineNumberTable;
const #13 = Asciz LocalVariableTable;
const #14 = Asciz this;
const #15 = Asciz Lbytecode/T1;;
const #16 = Asciz hashCode;
const #17 = Asciz ()I;
const #18 = Field #1.#19; // bytecode/T1.i:I
const #19 = NameAndType #5:#6;// i:I
const #20 = Asciz prime;
const #21 = Asciz result;
const #22 = Asciz SourceFile;
const #23 = Asciz T1.java;
 
{
private int i;
 
 
public bytecode.T1();
Code:
Stack=1, Locals=1, Args_size=1
0: aload_0
1: invokespecial #10; //Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 3: 0
 
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this Lbytecode/T1;
 
 
public int hashCode();
Code:
Stack=2, Locals=3, Args_size=1
0: bipush 31
2: istore_1
3: iconst_1
4: istore_2
5: bipush 31
7: iload_2
8: imul
9: aload_0
10: getfield #18; //Field i:I
13: iadd
14: istore_2
15: iload_2
16: ireturn
LineNumberTable:
line 9: 0
line 10: 3
line 11: 5
line 12: 15
 
LocalVariableTable:
Start Length Slot Name Signature
0 17 0 this Lbytecode/T1;
3 14 1 prime I
5 12 2 result I
 
 
}
T1T2.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
--- c1 2011-07-04 11:17:33.812155700 +0200
+++ c2 2011-07-04 11:17:36.984010400 +0200
@@ -1,79 +1,80 @@
-Compiled from "T1.java"
-public class bytecode.T1 extends java.lang.Object
- SourceFile: "T1.java"
+Compiled from "T2.java"
+public class bytecode.T2 extends java.lang.Object
+ SourceFile: "T2.java"
minor version: 0
major version: 50
Constant pool:
-const #1 = class #2; // bytecode/T1
-const #2 = Asciz bytecode/T1;
+const #1 = class #2; // bytecode/T2
+const #2 = Asciz bytecode/T2;
const #3 = class #4; // java/lang/Object
const #4 = Asciz java/lang/Object;
const #5 = Asciz i;
const #6 = Asciz I;
-const #7 = Asciz <init>;
-const #8 = Asciz ()V;
-const #9 = Asciz Code;
-const #10 = Method #3.#11; // java/lang/Object."<init>":()V
-const #11 = NameAndType #7:#8;// "<init>":()V
-const #12 = Asciz LineNumberTable;
-const #13 = Asciz LocalVariableTable;
-const #14 = Asciz this;
-const #15 = Asciz Lbytecode/T1;;
-const #16 = Asciz hashCode;
-const #17 = Asciz ()I;
-const #18 = Field #1.#19; // bytecode/T1.i:I
-const #19 = NameAndType #5:#6;// i:I
-const #20 = Asciz prime;
-const #21 = Asciz result;
-const #22 = Asciz SourceFile;
-const #23 = Asciz T1.java;
+const #7 = Asciz PRIME;
+const #8 = Asciz ConstantValue;
+const #9 = int 31;
+const #10 = Asciz <init>;
+const #11 = Asciz ()V;
+const #12 = Asciz Code;
+const #13 = Method #3.#14; // java/lang/Object."<init>":()V
+const #14 = NameAndType #10:#11;// "<init>":()V
+const #15 = Asciz LineNumberTable;
+const #16 = Asciz LocalVariableTable;
+const #17 = Asciz this;
+const #18 = Asciz Lbytecode/T2;;
+const #19 = Asciz hashCode;
+const #20 = Asciz ()I;
+const #21 = Field #1.#22; // bytecode/T2.i:I
+const #22 = NameAndType #5:#6;// i:I
+const #23 = Asciz result;
+const #24 = Asciz SourceFile;
+const #25 = Asciz T2.java;
 
{
private int i;
 
 
-public bytecode.T1();
+private static final int PRIME;
+ Constant value: int 31
+
+public bytecode.T2();
Code:
Stack=1, Locals=1, Args_size=1
0: aload_0
- 1: invokespecial #10; //Method java/lang/Object."<init>":()V
+ 1: invokespecial #13; //Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 3: 0
 
LocalVariableTable:
Start Length Slot Name Signature
- 0 5 0 this Lbytecode/T1;
+ 0 5 0 this Lbytecode/T2;
 
 
public int hashCode();
Code:
- Stack=2, Locals=3, Args_size=1
- 0: bipush 31
- 2: istore_1
- 3: iconst_1
- 4: istore_2
- 5: bipush 31
- 7: iload_2
- 8: imul
- 9: aload_0
- 10: getfield #18; //Field i:I
- 13: iadd
- 14: istore_2
- 15: iload_2
- 16: ireturn
+ Stack=2, Locals=2, Args_size=1
+ 0: iconst_1
+ 1: istore_1
+ 2: bipush 31
+ 4: iload_1
+ 5: imul
+ 6: aload_0
+ 7: getfield #21; //Field i:I
+ 10: iadd
+ 11: istore_1
+ 12: iload_1
+ 13: ireturn
LineNumberTable:
line 9: 0
- line 10: 3
- line 11: 5
- line 12: 15
+ line 10: 2
+ line 11: 12
 
LocalVariableTable:
Start Length Slot Name Signature
- 0 17 0 this Lbytecode/T1;
- 3 14 1 prime I
- 5 12 2 result I
+ 0 14 0 this Lbytecode/T2;
+ 2 12 1 result I
 
 
}
T2.java
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package bytecode;
 
public class T2 {
 
private int i;
 
@Override
public int hashCode() {
int result = 1;
result = PRIME * result + i;
return result;
}
 
private static final int PRIME = 31;
 
}
T2.javap
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
Compiled from "T2.java"
public class bytecode.T2 extends java.lang.Object
SourceFile: "T2.java"
minor version: 0
major version: 50
Constant pool:
const #1 = class #2; // bytecode/T2
const #2 = Asciz bytecode/T2;
const #3 = class #4; // java/lang/Object
const #4 = Asciz java/lang/Object;
const #5 = Asciz i;
const #6 = Asciz I;
const #7 = Asciz PRIME;
const #8 = Asciz ConstantValue;
const #9 = int 31;
const #10 = Asciz <init>;
const #11 = Asciz ()V;
const #12 = Asciz Code;
const #13 = Method #3.#14; // java/lang/Object."<init>":()V
const #14 = NameAndType #10:#11;// "<init>":()V
const #15 = Asciz LineNumberTable;
const #16 = Asciz LocalVariableTable;
const #17 = Asciz this;
const #18 = Asciz Lbytecode/T2;;
const #19 = Asciz hashCode;
const #20 = Asciz ()I;
const #21 = Field #1.#22; // bytecode/T2.i:I
const #22 = NameAndType #5:#6;// i:I
const #23 = Asciz result;
const #24 = Asciz SourceFile;
const #25 = Asciz T2.java;
 
{
private int i;
 
 
private static final int PRIME;
Constant value: int 31
 
public bytecode.T2();
Code:
Stack=1, Locals=1, Args_size=1
0: aload_0
1: invokespecial #13; //Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 3: 0
 
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this Lbytecode/T2;
 
 
public int hashCode();
Code:
Stack=2, Locals=2, Args_size=1
0: iconst_1
1: istore_1
2: bipush 31
4: iload_1
5: imul
6: aload_0
7: getfield #21; //Field i:I
10: iadd
11: istore_1
12: iload_1
13: ireturn
LineNumberTable:
line 9: 0
line 10: 2
line 11: 12
 
LocalVariableTable:
Start Length Slot Name Signature
0 14 0 this Lbytecode/T2;
2 12 1 result I
 
 
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.