groovy / groovy/groovy-eclipse

Rename of class with constructor using default arguments causes error

Open
#902 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
681
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Consider the following:

class DefaultParams {
  String value

  DefaultParams(String value = '') {
    this.value = value
  }
  /*@Generated
  DefaultParams() {
    this((String)'')
  }*/
}

Rename "DefaultParams" to anything else and there is a refactoring error due to overlapping edits for generated constructors. The generated constructor(s) for default arguments share the name range of the original for searching purposes.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Groovy class in the issue body and reproduce the rename refactoring with its default-argument constructor. Trace how generated constructors are included in rename edits; done means renaming the class no longer fails with overlapping edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.