Created
July 4, 2011 09:51
-
-
Save rklemme/1063153 to your computer and use it in GitHub Desktop.
Eclipse generated method hashCode()
This file contains 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 bytecode; | |
public class T1 { | |
private int i; | |
@Override | |
public int hashCode() { | |
final int prime = 31; | |
int result = 1; | |
result = prime * result + i; | |
return result; | |
} | |
} |
This file contains 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
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 | |
} | |
This file contains 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
--- 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 | |
} | |
This file contains 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 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; | |
} |
This file contains 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
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 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment