Skip to content

Update eclipse jdt formatter configuration #605

Closed

Description

@marko-radosavljevic

We should update our formatting configuration. It's based on old google style, and it lacks all the new features.

It also has a weird issue with formatting a specific record. Issue noticed first here: #140. Investigated by spotless devs here: diffplug/spotless#951

image

After investigation, the conclusion is that our configuration is the issue. And our band-aid solution was to pin the eclipse jdt formatter version to the latest known working, eclipse('4.19.0').

Partly because of that pinning, we don't have @snippet support. #591. And we will continue experiencing more and more issues down the line.


It's also a good opportunity to rethink our formatter choice, use better and smarter configuration etc.

Activity

  1. added
    enhancement
    bug
    and removed
    enhancement
    on Oct 4, 2022
  2. github-actions commented on Nov 4, 2022

    @github-actions

    This issue is stale because it has been open 30 days with no activity. Remove stale label, comment or add the valid label or this will be closed in 5 days.

  3. added
    valid
    and removed on Nov 4, 2022
  4. Taz03 commented on Feb 18, 2023

    @Taz03
    Contributor

    i'd like to work on this. Should the configuration should be same as before?

  5. self-assigned this
    on Feb 18, 2023
  6. marko-radosavljevic commented on Mar 8, 2023

    @marko-radosavljevic
    ContributorAuthor

    Yeah, ideally it would be the same, or almost the same. It's not a hard requirement tho, we could agree on a different style, in case it's superior for whatever reason.

    The best way we found to edit and test the configuration is in eclipse preferences, formatter edit tool. You can export or import configurations, and edit them in real time with a preview.

    Looks like this:
    editing eclipse formatter

    Since this issue hasn't been updated, and I was on the vacation, I'm not up-to-date on the recent developments. Tell me if I can help you with anything. ☺️

  7. linked a pull request that will close this issueupdated spotless files #785on Mar 8, 2023
  8. removed their assignment
    on Apr 13, 2024
  9. added a commit that references this issue on May 7, 2024
    546e626
  10. thrashy commented on May 7, 2024

    @thrashy
    Contributor

    Hey! I came across this issue on the spotless repo diffplug/spotless#951 because i was having the same issue. I noticed it wasn't resolved in your repo so i opened a PR for it. #1105

    Basically, the issue revolves around the source version being set to 1.7 <setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/>. I noticed you're on 21 so i bumped all 3 compiler settings to 21

            <setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="21"/>
            <setting id="org.eclipse.jdt.core.compiler.compliance" value="21"/>
            <setting id="org.eclipse.jdt.core.compiler.source" value="21"/>
    

    and reran spotless ./gradlew spotlessApply There may be some undesirable changes after removing the pinned eclipse jdt version, so you may want to check the files affected.

  11. moved this to No Status in Together Javaon May 18, 2024
  12. removed
    valid
    on May 18, 2024
  13. added a commit that references this issue on May 22, 2024
    9cf8944
  14. moved this from No Status to Done in Together Javaon May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: normal

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions