Eclipse drop in downloaded from 1.16.0 does not format long line of "throws" like the command line
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)
I was able to build a working eclipse dropin myself by:
- download source from https://github.com/google/google-java-format/archive/refs/tags/v1.16.0.tar.gz
- search and replace "1.13.0" with "1.16.0" as shown below
- 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>
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. https://github.com/google/google-java-format/issues/744#issuecomment-1398056103) 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.
The issue is that the wrong version (that I corrected above) was being used to build the Eclipse dropin
Why not use Maven interpolation to fix the version issue? For example:
Bundle-Version: ${project.version}
Or:
<version>${project.version}</version>
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
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
Please try with version 1.18.1 of the plugin. It has the correct version number and should work.