[BLUEJ-620] Enum value with body messes up object bench/codepad
Pretty obscure bug. If you use an enum with a body, it is technically given a different type by the Java runtime, I believe. If you try to "Get" this enum value on to the object bench, the codepad will no longer work (returning "" for "1+2"), I presume because we are generating bad code in the shell class. To reproduce, use this code:
{code:java}
enum Color
{
RED(255,0,0), // Constructor arguments
GRAY(128,128,128) // Individual body:
{
public String toString() { return "gray/grey"; }
},
BLACK(0,0,0);
// Group body:
int red, green, blue;
private Color(int red, int green, int blue)
{
this.red=red;this.green=green;this.blue=blue;
}
} {code}
Then inspect the Color class, and try to "Get" the middle enum (grey) to the object bench, then use the codepad.
Issue metadata
- Issue type: Bug
- Priority: Medium