Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: constructor and method receiver parameter #642

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

jtkiesel
Copy link
Contributor

@jtkiesel jtkiesel commented Feb 12, 2024

What changed with this PR:

Fixes some issues with constructor receiver parameters, and added support for method receiver parameters.

Example

Input

class Currency {
  Currency(Currency this) {}

  Currency(Currency this, Currency other) {}

  Currency(@AnnotatedUsage Currency this, Currency other) {}

  Currency(@AnnotatedUsage Currency this, String aaaaaaaaaa, String bbbbbbbbbb) {}

  String getCode(Currency this) {}

  int compareTo(Currency this, Currency other) {}

  int compareTo(@AnnotatedUsage Currency this, Currency other) {}

  int compareTo(@AnnotatedUsage Currency this, String aaaaaaaaaa, String bbbbbbbbbb) {}

  class Inner {
    Inner(Currency Currency.this) {}

    String getCode(Currency Currency.this) {}
  }
}

Output

class Currency {

  Currency(Currency this) {}

  Currency(Currency this, Currency other) {}

  Currency(@AnnotatedUsage Currency this, Currency other) {}

  Currency(
    @AnnotatedUsage Currency this,
    String aaaaaaaaaa,
    String bbbbbbbbbb
  ) {}

  String getCode(Currency this) {}

  int compareTo(Currency this, Currency other) {}

  int compareTo(@AnnotatedUsage Currency this, Currency other) {}

  int compareTo(
    @AnnotatedUsage Currency this,
    String aaaaaaaaaa,
    String bbbbbbbbbb
  ) {}

  class Inner {

    Inner(Currency Currency.this) {}

    String getCode(Currency Currency.this) {}
  }
}

Relative issues or prs:

Closes #607

Copy link
Contributor

@clementdessoude clementdessoude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question, but LGTM !

@@ -320,13 +320,22 @@ export function defineRules($, t) {
]);
});

// https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-MethodDeclarator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a bump ! 😆

@clementdessoude clementdessoude merged commit e1daee2 into jhipster:main Feb 15, 2024
6 checks passed
@jtkiesel jtkiesel deleted the fix/receiver-parameter branch April 11, 2024 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fails with receiver parameter (implicit this)
2 participants