Skip to content

Reordering Annotations #544

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

steve-aom-elliott
Copy link
Contributor

@steve-aom-elliott steve-aom-elliott commented May 6, 2025

Reordering annotations (alphabetically only for now on method declarations alone).

Looking to define boundaries for what should be included in the changes for annotation reordering. As per the linked issue, the starting point would be a default alphabetical ordering of annotations (the ability to pass in what Comparator<J.Annotation> to use will be upcoming). It's been suggested to start with just method declarations and move on from there after, but I'm open to thoughts and suggestions.

What's changed?

  • Added a ReorderAnnotations recipe for reordering annotations (default alphabetic) on J.MethodDeclaration
  • Added simple tests for the reordering for method declarations (only using the default sorting)

Related issue with additional fixes that should be implemented first

Anyone you would like to review specifically?

@timtebeek
@greg-at-moderne

Checklist

  • I've added unit tests to cover both positive and negative cases for method declarations
  • I've implemented handling of class declarations
  • I've implemented handling of field declarations
  • I've added unit tests to cover both positive and negative cases for class declarations
  • I've added unit tests to cover both positive and negative cases for field declarations
  • I've implemented the ability to provide what Comparator<J.Annotation> you would like to use to sort the annotations on a given LST entry point
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite May 6, 2025
@steve-aom-elliott steve-aom-elliott force-pushed the feature/consistently-ordered-annotations branch from a7188bd to c25c65b Compare May 6, 2025 20:38
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Some suggestions could not be made:

  • src/main/resources/META-INF/rewrite/examples.yml
    • lines 1230-1249
    • lines 1282-1281
    • lines 2311-2310
    • lines 2326-2338
    • lines 2435-2434

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Some suggestions could not be made:

  • src/main/resources/META-INF/rewrite/examples.yml
    • lines 636-652
    • lines 698-697
    • lines 2311-2310
    • lines 2326-2338
    • lines 2435-2434

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Some suggestions could not be made:

  • src/main/resources/META-INF/rewrite/examples.yml
    • lines 636-652
    • lines 698-697
    • lines 2311-2310
    • lines 2326-2338
    • lines 2435-2434

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

2 participants