Created
April 16, 2012 22:19
-
-
Save schwarzeszeux/2402048 to your computer and use it in GitHub Desktop.
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 BlocksAndStatements; | |
public class SwitchStatement { | |
// $FF: synthetic field | |
private static int[] $SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum; | |
public void TestSwitchOnString(String s) { | |
switch(s.hashCode()) { | |
case 49: | |
if(!s.equals("1")) { | |
; | |
} | |
break; | |
case 50: | |
if(!s.equals("2")) { | |
; | |
} | |
break; | |
case 84: | |
if(!s.equals("T")) { | |
; | |
} | |
break; | |
case 1631: | |
if(!s.equals("32")) { | |
; | |
} | |
break; | |
case 2571410: | |
if(!s.equals("TEST")) { | |
; | |
} | |
} | |
} | |
public String TestSwitchOnStringFallThrough(String s) { | |
switch(s.hashCode()) { | |
case 49: | |
if(s.equals("1")) { | |
return "first FF"; | |
} | |
break; | |
case 50: | |
if(s.equals("2")) { | |
return "first FF"; | |
} | |
break; | |
case 84: | |
if(s.equals("T")) { | |
return "second FF"; | |
} | |
break; | |
case 1631: | |
if(s.equals("32")) { | |
return "second FF"; | |
} | |
break; | |
case 2571410: | |
if(!s.equals("TEST")) { | |
; | |
} | |
} | |
return "third plus default"; | |
} | |
public void TestSwitchOnStringCollision(String s) { | |
switch(s.hashCode()) { | |
case 2236: | |
if(!s.equals("FB") && !s.equals("Ea")) { | |
; | |
} | |
default: | |
} | |
} | |
public void TestSwitchOnStringCollisionExtended(String s) { | |
switch(s.hashCode()) { | |
case 97: | |
if(!s.equals("a")) { | |
; | |
} | |
break; | |
case 98: | |
if(!s.equals("b")) { | |
; | |
} | |
break; | |
case 2236: | |
if(!s.equals("FB") && !s.equals("Ea")) { | |
; | |
} | |
} | |
} | |
public void TestSwitchOnInt(int i) { | |
switch(i) { | |
case 1: | |
case 2: | |
default: | |
} | |
} | |
public void TestSwitchOnEnum(SwitchStatement.TestEnum e) { | |
switch($SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum()[e.ordinal()]) { | |
case 1: | |
case 2: | |
case 3: | |
default: | |
} | |
} | |
public int TestSwitchOnEnumReturn(SwitchStatement.TestEnum e) { | |
switch($SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum()[e.ordinal()]) { | |
case 1: | |
return 1; | |
case 2: | |
default: | |
return 3; | |
case 3: | |
return 2; | |
} | |
} | |
// $FF: synthetic method | |
static int[] $SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum() { | |
if($SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum != null) { | |
return $SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum; | |
} else { | |
int[] var0 = new int[SwitchStatement.TestEnum.values().length]; | |
try { | |
var0[SwitchStatement.TestEnum.First.ordinal()] = 1; | |
} catch (NoSuchFieldError var3) { | |
; | |
} | |
try { | |
var0[SwitchStatement.TestEnum.Second.ordinal()] = 2; | |
} catch (NoSuchFieldError var2) { | |
; | |
} | |
try { | |
var0[SwitchStatement.TestEnum.Third.ordinal()] = 3; | |
} catch (NoSuchFieldError var1) { | |
; | |
} | |
$SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum = var0; | |
return var0; | |
} | |
} | |
static enum TestEnum { | |
First("First", 0), | |
Second("Second", 1), | |
Third("Third", 2); | |
// $FF: synthetic field | |
private static final SwitchStatement.TestEnum[] ENUM$VALUES = new SwitchStatement.TestEnum[]{First, Second, Third}; | |
private TestEnum(String var1, int var2) {} | |
} | |
} |
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
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. | |
// Jad home page: http://www.kpdus.com/jad.html | |
// Decompiler options: packimports(3) | |
// Source File Name: SwitchStatement.java | |
package BlocksAndStatements; | |
public class SwitchStatement | |
{ | |
static final class TestEnum extends Enum | |
{ | |
public static TestEnum[] values() | |
{ | |
TestEnum atestenum[]; | |
int i; | |
TestEnum atestenum1[]; | |
System.arraycopy(atestenum = ENUM$VALUES, 0, atestenum1 = new TestEnum[i = atestenum.length], 0, i); | |
return atestenum1; | |
} | |
public static TestEnum valueOf(String s) | |
{ | |
return (TestEnum)Enum.valueOf(BlocksAndStatements/SwitchStatement$TestEnum, s); | |
} | |
public static final TestEnum First; | |
public static final TestEnum Second; | |
public static final TestEnum Third; | |
private static final TestEnum ENUM$VALUES[]; | |
static | |
{ | |
First = new TestEnum("First", 0); | |
Second = new TestEnum("Second", 1); | |
Third = new TestEnum("Third", 2); | |
ENUM$VALUES = (new TestEnum[] { | |
First, Second, Third | |
}); | |
} | |
private TestEnum(String s, int i) | |
{ | |
super(s, i); | |
} | |
} | |
public SwitchStatement() | |
{ | |
} | |
public void TestSwitchOnString(String s) | |
{ | |
String s1; | |
switch((s1 = s).hashCode()) | |
{ | |
case 49: // '1' | |
if(s1.equals("1")); | |
break; | |
case 50: // '2' | |
if(s1.equals("2")); | |
break; | |
case 84: // 'T' | |
if(s1.equals("T")); | |
break; | |
case 1631: | |
if(s1.equals("32")); | |
break; | |
case 2571410: | |
if(s1.equals("TEST")); | |
break; | |
} | |
} | |
public String TestSwitchOnStringFallThrough(String s) | |
{ | |
String s1; | |
(s1 = s).hashCode(); | |
JVM INSTR lookupswitch 5: default 122 | |
// 49: 56 | |
// 50: 68 | |
// 84: 80 | |
// 1631: 92 | |
// 2571410: 104; | |
goto _L1 _L2 _L3 _L4 _L5 _L6 | |
_L1: | |
break; /* Loop/switch isn't completed */ | |
_L2: | |
if(!s1.equals("1")) | |
break; /* Loop/switch isn't completed */ | |
goto _L7 | |
_L3: | |
if(!s1.equals("2")) | |
break; /* Loop/switch isn't completed */ | |
goto _L7 | |
_L4: | |
if(!s1.equals("T")) | |
break; /* Loop/switch isn't completed */ | |
goto _L8 | |
_L5: | |
if(!s1.equals("32")) | |
break; /* Loop/switch isn't completed */ | |
goto _L8 | |
_L6: | |
if(s1.equals("TEST")); | |
break; /* Loop/switch isn't completed */ | |
_L7: | |
return "first FF"; | |
_L8: | |
return "second FF"; | |
return "third plus default"; | |
} | |
public void TestSwitchOnStringCollision(String s) | |
{ | |
String s1; | |
switch((s1 = s).hashCode()) | |
{ | |
default: | |
break; | |
case 2236: | |
if(!s1.equals("FB")) | |
if(s1.equals("Ea")); | |
break; | |
} | |
} | |
public void TestSwitchOnStringCollisionExtended(String s) | |
{ | |
String s1; | |
switch((s1 = s).hashCode()) | |
{ | |
default: | |
break; | |
case 97: // 'a' | |
if(s1.equals("a")); | |
break; | |
case 98: // 'b' | |
if(s1.equals("b")); | |
break; | |
case 2236: | |
if(!s1.equals("FB")) | |
if(s1.equals("Ea")); | |
break; | |
} | |
} | |
public void TestSwitchOnInt(int i) | |
{ | |
switch(i) | |
{ | |
case 1: // '\001' | |
case 2: // '\002' | |
default: | |
return; | |
} | |
} | |
public void TestSwitchOnEnum(TestEnum e) | |
{ | |
switch($SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum()[e.ordinal()]) | |
{ | |
case 1: // '\001' | |
case 2: // '\002' | |
case 3: // '\003' | |
default: | |
return; | |
} | |
} | |
public int TestSwitchOnEnumReturn(TestEnum e) | |
{ | |
switch($SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum()[e.ordinal()]) | |
{ | |
case 1: // '\001' | |
return 1; | |
case 3: // '\003' | |
return 2; | |
case 2: // '\002' | |
default: | |
return 3; | |
} | |
} | |
static int[] $SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum() | |
{ | |
$SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum; | |
if($SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum == null) goto _L2; else goto _L1 | |
_L1: | |
return; | |
_L2: | |
JVM INSTR pop ; | |
int ai[] = new int[TestEnum.values().length]; | |
try | |
{ | |
ai[TestEnum.First.ordinal()] = 1; | |
} | |
catch(NoSuchFieldError _ex) { } | |
try | |
{ | |
ai[TestEnum.Second.ordinal()] = 2; | |
} | |
catch(NoSuchFieldError _ex) { } | |
try | |
{ | |
ai[TestEnum.Third.ordinal()] = 3; | |
} | |
catch(NoSuchFieldError _ex) { } | |
return $SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum = ai; | |
} | |
private static int $SWITCH_TABLE$BlocksAndStatements$SwitchStatement$TestEnum[]; | |
} |
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 BlocksAndStatements; | |
public class SwitchStatement | |
{ | |
enum TestEnum | |
{ | |
First, | |
Second, | |
Third; | |
} | |
public void TestSwitchOnString(String a0) | |
{ | |
switch (a0) | |
{ | |
case "1": | |
case "2": | |
case "T": | |
case "32": | |
case "TEST": | |
default: | |
} | |
} | |
public String TestSwitchOnStringFallThrough(String a0) | |
{ | |
switch (a0) | |
{ | |
case "1": | |
case "2": | |
return "first FF"; | |
case "T": | |
case "32": | |
return "second FF"; | |
case "TEST": | |
default: | |
return "third plus default"; | |
} | |
} | |
public void TestSwitchOnStringCollision(String a0) | |
{ | |
switch (a0) | |
{ | |
case "FB": | |
case "Ea": | |
} | |
} | |
public void TestSwitchOnStringCollisionExtended(String a0) | |
{ | |
switch (a0) | |
{ | |
case "a": | |
case "b": | |
case "FB": | |
case "Ea": | |
} | |
} | |
public void TestSwitchOnInt(int a0) | |
{ | |
switch (a0) | |
{ | |
case 1: | |
case 2: | |
default: | |
} | |
} | |
public void TestSwitchOnEnum(TestEnum a0) | |
{ | |
switch (a0) | |
{ | |
case First: | |
case Second: | |
case Third: | |
} | |
} | |
public int TestSwitchOnEnumReturn(TestEnum a0) | |
{ | |
switch (a0) | |
{ | |
case First: | |
return 1; | |
case Second: | |
return 3; | |
case Third: | |
return 2; | |
} | |
} | |
} |
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 BlocksAndStatements; | |
public class SwitchStatement | |
{ | |
public void TestSwitchOnString(String s) | |
{ | |
String str; | |
switch ((str = s).hashCode()) { case 49: | |
if (str.equals("1")) break; break; | |
case 50: | |
case 84: | |
if ((str.equals("2")) || (goto 113) || (str.equals("T"))) break; break; | |
case 1631: | |
case 2571410: | |
if ((str.equals("32")) || (goto 113) || (str.equals("TEST"))) | |
break; | |
} | |
} | |
public String TestSwitchOnStringFallThrough(String s) | |
{ | |
String str; | |
switch ((str = s).hashCode()) { case 49: | |
if (str.equals("1")) break; break; | |
case 50: | |
if (str.equals("2")) break; break; | |
case 84: | |
if (str.equals("T")); | |
break; | |
case 1631: | |
if (str.equals("32")); | |
case 2571410: | |
if ((goto 122) && (!str.equals("TEST"))) { break label122; | |
return "first FF"; | |
return "second FF"; | |
} | |
} | |
label122: return "third plus default"; | |
} | |
public void TestSwitchOnStringCollision(String s) | |
{ | |
String str; | |
switch ((str = s).hashCode()) { case 2236: | |
if ((str.equals("FB")) || (str.equals("Ea"))) | |
break; | |
} | |
} | |
public void TestSwitchOnStringCollisionExtended(String s) | |
{ | |
String str; | |
switch ((str = s).hashCode()) { case 97: | |
case 98: | |
case 2236: | |
if ((str.equals("a")) || (goto 82) || (str.equals("b")) || (goto 82) || (str.equals("FB")) || (str.equals("Ea"))) | |
break; | |
} | |
} | |
public void TestSwitchOnInt(int i) | |
{ | |
switch (i) | |
{ | |
case 1: | |
break; | |
case 2: | |
break; | |
} | |
} | |
public void TestSwitchOnEnum(TestEnum e) | |
{ | |
switch (e) | |
{ | |
case First: | |
break; | |
case Third: | |
break; | |
case Second: | |
} | |
} | |
public int TestSwitchOnEnumReturn(TestEnum e) | |
{ | |
switch (e) | |
{ | |
case First: | |
return 1; | |
case Third: | |
return 2; | |
case Second: | |
}return 3; | |
} | |
static enum TestEnum | |
{ | |
First, | |
Second, | |
Third; | |
} | |
} |
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 BlocksAndStatements; | |
public class SwitchStatement { | |
public void TestSwitchOnString(String s) | |
{ | |
switch(s) | |
{ | |
case "1": | |
break; | |
case "2": | |
break; | |
case "32": | |
break; | |
case "T": | |
break; | |
case "TEST": | |
break; | |
default: | |
} | |
} | |
public String TestSwitchOnStringFallThrough(String s) | |
{ | |
switch(s) | |
{ | |
case "1": | |
case "2": | |
return "first FF"; | |
case "32": | |
case "T": | |
return "second FF"; | |
case "TEST": | |
default: | |
return "third plus default"; | |
} | |
} | |
public void TestSwitchOnStringCollision(String s) | |
{ | |
switch(s) | |
{ | |
case "FB": | |
break; | |
case "Ea": | |
break; | |
default: | |
break; | |
} | |
} | |
public void TestSwitchOnInt(int i) | |
{ | |
switch(i) | |
{ | |
case 1: | |
break; | |
case 2: | |
break; | |
default: | |
break; | |
} | |
} | |
public void TestSwitchOnEnum(TestEnum e) | |
{ | |
switch(e) | |
{ | |
case First: | |
break; | |
case Third: | |
break; | |
default: | |
break; | |
} | |
} | |
public int TestSwitchOnEnumReturn(TestEnum e) | |
{ | |
switch(e) | |
{ | |
case First: | |
return 1; | |
case Third: | |
return 2; | |
default: | |
return 3; | |
} | |
} | |
enum TestEnum | |
{ | |
First, | |
Second, | |
Third; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment