Skip to content

Method arguments are getting reassigned in xtend code #20

@abies

Description

@abies
public class Test {
    public void m(int arg) {
        arg = 5;
        System.out.println(arg);
    }
}

generates

class Test {
  def m(  int arg){
    arg=5
    println(arg)
  }
}

which fails at assignment of 5 to arg. Solution would be to create artificial variable at the very start of method, rename method arg to _arg and then use variable later in the method (of course, only if this is needed, too much visual noise otherwise)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions