Skip to content

Instantly share code, notes, and snippets.

@dstarh
Created February 15, 2010 20:13
Show Gist options
  • Save dstarh/304948 to your computer and use it in GitHub Desktop.
Save dstarh/304948 to your computer and use it in GitHub Desktop.
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3)
// Source File Name: ExternalEnum.java
import java.io.PrintStream;
public class ExternalEnum
{
public ExternalEnum()
{
}
public static void main(String args[])
{
TestEnum blah = TestEnum.FOO;
int x = 0;
switch($SWITCH_TABLE$TestEnum()[blah.ordinal()])
{
case 1: // '\001'
x = 1;
break;
case 2: // '\002'
x = 2;
break;
case 3: // '\003'
x = 3;
break;
}
System.out.println(x);
}
static int[] $SWITCH_TABLE$TestEnum()
{
$SWITCH_TABLE$TestEnum;
if($SWITCH_TABLE$TestEnum == null) goto _L2; else goto _L1
_L1:
return;
_L2:
JVM INSTR pop ;
int ai[] = new int[TestEnum.values().length];
try
{
ai[TestEnum.BAR.ordinal()] = 3;
}
catch(NoSuchFieldError _ex) { }
try
{
ai[TestEnum.BLAH.ordinal()] = 1;
}
catch(NoSuchFieldError _ex) { }
try
{
ai[TestEnum.FOO.ordinal()] = 2;
}
catch(NoSuchFieldError _ex) { }
return $SWITCH_TABLE$TestEnum = ai;
}
private static int $SWITCH_TABLE$TestEnum[];
}
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3)
// Source File Name: InternalEnum.java
import java.io.PrintStream;
public class InternalEnum
{
public static final class Internal extends Enum
{
public static Internal[] values()
{
Internal ainternal[];
int i;
Internal ainternal1[];
System.arraycopy(ainternal = ENUM$VALUES, 0, ainternal1 = new Internal[i = ainternal.length], 0, i);
return ainternal1;
}
public static Internal valueOf(String s)
{
return (Internal)Enum.valueOf(InternalEnum$Internal, s);
}
public static final Internal THIS;
public static final Internal THAT;
public static final Internal FOO;
private static final Internal ENUM$VALUES[];
static
{
THIS = new Internal("THIS", 0);
THAT = new Internal("THAT", 1);
FOO = new Internal("FOO", 2);
ENUM$VALUES = (new Internal[] {
THIS, THAT, FOO
});
}
private Internal(String s, int i)
{
super(s, i);
}
}
public InternalEnum()
{
}
public static void main(String args[])
{
Internal blah = Internal.FOO;
int x = 0;
switch($SWITCH_TABLE$InternalEnum$Internal()[blah.ordinal()])
{
case 1: // '\001'
x = 1;
break;
case 2: // '\002'
x = 2;
break;
case 3: // '\003'
x = 3;
break;
}
System.out.println(x);
}
static int[] $SWITCH_TABLE$InternalEnum$Internal()
{
$SWITCH_TABLE$InternalEnum$Internal;
if($SWITCH_TABLE$InternalEnum$Internal == null) goto _L2; else goto _L1
_L1:
return;
_L2:
JVM INSTR pop ;
int ai[] = new int[Internal.values().length];
try
{
ai[Internal.FOO.ordinal()] = 3;
}
catch(NoSuchFieldError _ex) { }
try
{
ai[Internal.THAT.ordinal()] = 2;
}
catch(NoSuchFieldError _ex) { }
try
{
ai[Internal.THIS.ordinal()] = 1;
}
catch(NoSuchFieldError _ex) { }
return $SWITCH_TABLE$InternalEnum$Internal = ai;
}
private static int $SWITCH_TABLE$InternalEnum$Internal[];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment