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

Eclipse drop in downloaded from 1.16.0 does not format long line of "throws" like the command line #926

Open
deckrider opened this issue Mar 28, 2023 · 7 comments
Labels

Comments

@deckrider
Copy link

Eclipse drop in downloaded from 1.16.0 does not format long line of "throws" like the command line.

And I don't see a command line option to make it format like the Eclipse drop in.

(Also in the 1.16.0 release, the Eclipse drop claims to be 1.13.0)

@deckrider
Copy link
Author

deckrider commented Mar 30, 2023

I was able to build a working eclipse dropin myself by:

  1. download source from https://github.com/google/google-java-format/archive/refs/tags/v1.16.0.tar.gz
  2. search and replace "1.13.0" with "1.16.0" as shown below
  3. run 'mvn clean verify' using OpenJDK 17.0.6 and Maven 3.9.1
$ diff -ruNp google-java-format-1.16.0-old google-java-format-1.16.0-new
diff -ruNp google-java-format-1.16.0-old/eclipse_plugin/META-INF/MANIFEST.MF google-java-format-1.16.0-new/eclipse_plugin/META-INF/MANIFEST.MF
--- google-java-format-1.16.0-old/eclipse_plugin/META-INF/MANIFEST.MF	2023-02-24 14:54:02.000000000 -0700
+++ google-java-format-1.16.0-new/eclipse_plugin/META-INF/MANIFEST.MF	2023-03-30 10:09:40.449595120 -0600
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
 Bundle-Name: google-java-format
 Bundle-SymbolicName: google-java-format-eclipse-plugin;singleton:=true
 Bundle-Vendor: Google
-Bundle-Version: 1.13.0
+Bundle-Version: 1.16.0
 Bundle-RequiredExecutionEnvironment: JavaSE-11
 Require-Bundle: org.eclipse.jdt.core;bundle-version="3.10.0",
  org.eclipse.jface,
diff -ruNp google-java-format-1.16.0-old/eclipse_plugin/pom.xml google-java-format-1.16.0-new/eclipse_plugin/pom.xml
--- google-java-format-1.16.0-old/eclipse_plugin/pom.xml	2023-02-24 14:54:02.000000000 -0700
+++ google-java-format-1.16.0-new/eclipse_plugin/pom.xml	2023-03-30 10:09:40.441595568 -0600
@@ -22,7 +22,7 @@
   <groupId>com.google.googlejavaformat</groupId>
   <artifactId>google-java-format-eclipse-plugin</artifactId>
   <packaging>eclipse-plugin</packaging>
-  <version>1.13.0</version>
+  <version>1.16.0</version>
 
   <name>Google Java Format Plugin for Eclipse 4.5+</name>
 

@PhilippWendler
Copy link

Before it was not working, did you update your Eclipse plugin from 1.13.0 to 1.16.0 by simply dropping the new JAR in dropins? My suspicion is (cf. #744 (comment)) that Eclipse sees that the new JAR has the same version number as the previously installed one and simply ignores it. It would probably have worked to remove google-java-format and then install the "really version 1.16.0 but claims to be 1.13.0" JAR.

If this is correct, this issue essentially becomes a duplicate of #744.

@cushon cushon added the Eclipse label Mar 30, 2023
@deckrider
Copy link
Author

deckrider commented Apr 4, 2023 via email

@deckrider
Copy link
Author

deckrider commented Apr 5, 2023

Why not use Maven interpolation to fix the version issue? For example:

Bundle-Version: ${project.version}

Or:

<version>${project.version}</version>

@tbroyer
Copy link
Contributor

tbroyer commented Apr 5, 2023

My understanding is that Eclipse is still and always built with/against gjf 1.13.0; it has never been updated: https://github.com/google/google-java-format/blob/master/eclipse_plugin/pom.xml

@deckrider
Copy link
Author

Ah yes of course, line 25 is picked up in line 42!

So when I changed the source as shown, I also changed which version was being used, which is why it started working

@PhilippWendler
Copy link

Please try with version 1.18.1 of the plugin. It has the correct version number and should work.

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

No branches or pull requests

4 participants