GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — google-java-format Eclipse plugin does not provide AOSP Style option as google-java-format IntelliJ plugin · Issue #179 · google/google-java-format

google-java-format Eclipse plugin does not provide AOSP Style option as google-java-format IntelliJ plugin  #179

New issue
Copy link
New issue
Copy link
Closed
Closed
google-java-format Eclipse plugin does not provide AOSP Style option as google-java-format IntelliJ plugin #179
Copy link
Labels
Eclipse

Description

@BruceZu
BruceZu
opened on Aug 21, 2017
Issue body actions

The google-java-format Eclipse plugin works in Eclipse IDE for Java Developers
Version: Oxygen Release (4.7.0)
Build id: 20170620-1800

But it does not provide AOSP Style option. Is this intentional design?
Most members of my team like AOSP style, while half of them are using Eclipse.
Is there a workaround to get over this problem. E.g. can you expose an XML configuration file for AOSP.
Thank you!

screenshot from 2017-08-20 21-51-25
screenshot from 2017-08-20 21-50-30

Reacted by thc202, Christian Ciach and Oliver Kopp

Activity

  1. sormuras commented on Aug 21, 2017

    @sormuras
    sormuras
    on Aug 21, 2017
    Contributor
    More actions

    The easiest way is to install a second "Formatter implementation" plugin that provides AOSP style formatting out of the box. Then the user may choose the first or second implementation in the drop-down box shown in your screenshot.

    Reacted by Oliver Kopp
  2. sormuras commented on Aug 21, 2017

    @sormuras
    sormuras
    on Aug 21, 2017
    Contributor
    More actions

    This is the line that creates the Formatter with default options: https://github.com/google/google-java-format/blob/master/core/src/main/java/com/google/googlejavaformat/java/SnippetFormatter.java#L60
    Here you could create a Formatter instance using AOSP style.

  3. BruceZu commented on Aug 21, 2017

    @BruceZu
    BruceZu
    on Aug 21, 2017
    Author
    More actions

    Thank you! @sormuras
    About the idea to "install a second "Formatter implementation" plugin that provides AOSP style ".
    I am wondering if it has the same effect as 'google-java-format IntelliJ plugin'. Because I just fetched a copy of https://github.com/android/platform_development/blob/master/ide/eclipse/android-formatting.xml and configured it in eclipse. Let Eclipse format a class and find the result is not same as that formated by 'google-java-format IntelliJ plugin'.

  4. BruceZu commented on Aug 21, 2017

    @BruceZu
    BruceZu
    on Aug 21, 2017
    Author
    More actions

    @sormuras
    This is a good idea to add a hot patch. I want to know where I can get the src code of 'google-java-format Eclipse plugin'.
    If I need to add a patch I think I should add it to the 'google-java-format Eclipse plugin'.
    correct me if I am wrong. Thank you!

  5. sormuras commented on Aug 21, 2017

    @sormuras
    sormuras
    on Aug 21, 2017
    Contributor
    More actions

    AFAIK, there's no (easy) possibility to present custom formatter options for the selected formatter implementation in Eclipse.

    The Eclipse plugin contains an entire GJF distro -- using a default Formatter instance with default FormatterOptions.

    This is what I'd do:

    • Fork the project and copy the eclipse_plugin folder to eclipse_plugin_aosp.
    • Modify the eclipse_plugin_aosp source to produce a different artifact (jar) then eclipse_plugin.
    • Enhance the SnippetFormatter to take a FormatterOptions instance.
    • Use/pass the normal options in eclipse_plugin and the AOSP style options eclipse_plugin_aosp

    Finally, use https://jitpack.io to build and host your fork with two eclipse plugins.

  6. bryanschofield commented on Feb 6, 2018

    @bryanschofield
    bryanschofield
    on Feb 6, 2018
    More actions

    I've create a PR to address this: #251

  7. cushon
    added
    Eclipse
    on May 22, 2018
  8. chkpnt commented on Jan 20, 2022

    @chkpnt
    chkpnt
    on Jan 20, 2022
    More actions

    It is weird a solution to this issue doesn't seem to be needed. Looks like nobody is using Eclipse anymore and I'm the only one.

    After playing around a little bit with google-java-format, I think for Eclipse users it is still more convenient to use the old eclipse-java-google-style.xml.

    Reacted by Oliver Kopp
  9. ChristianCiach commented on Apr 26, 2022

    @ChristianCiach
    ChristianCiach
    on Apr 26, 2022
    More actions

    I still would like to use the AOSP style with eclipse and I would greatly appreciate any kind of feedback from Google about the PR #251

    The XML files for Eclipse do not behave the same as the actual formatter implementation. I see them more as an approximation of the real thing. I actually think that the XML files should be removed. See google/styleguide#687

    Reacted by Elango Cheran and Mihai Nita
  10. cushon commented on Oct 27, 2025

    @cushon
    cushon
    on Oct 27, 2025
    Collaborator
    More actions

    Support for this was added in 60a00f2

  11. echeran commented on Oct 27, 2025

    @echeran
    echeran
    on Oct 27, 2025
    More actions

    Support for this was added in 60a00f2

    Thanks @cushon, and thanks @mihnita for doing the implementation work!

  12. mihnita commented on Oct 27, 2025

    @mihnita
    mihnita
    on Oct 27, 2025
    Member
    More actions

    The Eclipse plugin in Release 1.31 does not work.

    > unzip -l  ~/Downloads/google-java-format-eclipse-plugin-1.31.0.jar
    Archive:  /Users/mnita/Downloads/google-java-format-eclipse-plugin-1.31.0.jar
      Length      Date    Time    Name
    ---------  ---------- -----   ----
            0  10-27-2025 10:17   META-INF/
          510  10-27-2025 10:17   META-INF/MANIFEST.MF
            0  10-27-2025 10:17   com/
            0  10-27-2025 10:17   com/google/
            0  10-27-2025 10:17   com/google/googlejavaformat/
            0  10-27-2025 10:17   com/google/googlejavaformat/java/
            0  10-27-2025 10:17   lib/
            0  10-27-2025 10:17   META-INF/maven/
            0  10-27-2025 10:17   META-INF/maven/com.google.googlejavaformat/
            0  10-27-2025 10:17   META-INF/maven/com.google.googlejavaformat/google-java-format-eclipse-plugin/
         6289  10-27-2025 10:17   com/google/googlejavaformat/java/GoogleJavaFormatter.class
      3043932  10-10-2023 20:53   lib/guava.jar
       280835  10-27-2025 10:17   lib/google-java-format.jar
          952  10-27-2025 10:16   plugin.xml
         3690  10-27-2025 10:17   META-INF/maven/com.google.googlejavaformat/google-java-format-eclipse-plugin/pom.xml
           96  10-27-2025 10:17   META-INF/maven/com.google.googlejavaformat/google-java-format-eclipse-plugin/pom.properties
    ---------                     -------
      3336304                     16 files

    The fix should contain:

          596  10-24-2025 10:18   com/google/googlejavaformat/java/GoogleJavaFormatter.class
         1095  10-24-2025 10:18   com/google/googlejavaformat/java/AospJavaFormatter.class
         6471  10-27-2025 13:27   com/google/googlejavaformat/java/JavaFormatterBase.class
    

    AospJavaFormatter.class and JavaFormatterBase.class are missing, and GoogleJavaFormatter.class is a lot bigger than it should be (because all of the logic should now be in JavaFormatterBase).

  13. mihnita commented on Oct 27, 2025

    @mihnita
    mihnita
    on Oct 27, 2025
    Member
    More actions

    Ah!

    The release was "10 hours ago" (github-actions released this 10 hours ago)
    The commit with the code changes was 4 hours ago (60a00f2)

  14. cushon commented on Oct 28, 2025

    @cushon
    cushon
    on Oct 28, 2025
    Collaborator
    More actions

    I released 1.32.0 with the Eclipse plugin changes: https://github.com/google/google-java-format/releases/tag/v1.32.0

    Reacted by Mihai Nita
  15. cushon
    closed this as completedon Oct 28, 2025
  16. mihnita commented on Oct 28, 2025

    @mihnita
    mihnita
    on Oct 28, 2025
    Member
    More actions

    I checked it, works fine!
    Thank you very much!

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

    Eclipse

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.