Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • B bjgf
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 127
    • Issues 127
    • List
    • Boards
    • Service Desk
    • Milestones
  • Jira
    • Jira
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • BlueJ
  • bjgf
  • Issues
  • #609

[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
Assignee
Assign to
Time tracking