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

Pull #14954: Add upwards compat for deprecated classes in maven-check… #14954

Merged

Conversation

michael-o
Copy link
Contributor

The Maven Checkstyle Plugin cannot upgraded to 10.x at the moment, but users want to swap 9.x for 10.x at runtime. Add a new, deprecated constructor to SarifLogger to make that possible.

This covers apache/maven-checkstyle-plugin#141

michael-o added a commit to michael-o/checkstyle that referenced this pull request Jun 7, 2024
@michael-o michael-o force-pushed the add-upwards-compat-maven-checkstyle-plugin branch from f0e5625 to 8dd54e3 Compare June 7, 2024 15:51
@michael-o michael-o changed the title Pull #14945: Add upwards compat for deprecated classes in maven-check… Pull #14954: Add upwards compat for deprecated classes in maven-check… Jun 7, 2024
@michael-o
Copy link
Contributor Author

osipovmi@deblndw011x:~/var/Projekte/maven-checkstyle-plugin (master *=)
 git diff
diff --git a/pom.xml b/pom.xml
index adff04a..bd7db55 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@ under the License.
     <javaVersion>8</javaVersion>
     <mavenVersion>3.6.3</mavenVersion>
     <resolverVersion>1.4.1</resolverVersion>
-    <checkstyleVersion>9.3</checkstyleVersion>
+    <checkstyleVersion>10.18.0-SNAPSHOT</checkstyleVersion>
     <slf4jVersion>1.7.36</slf4jVersion>
     <doxiaVersion>1.11.1</doxiaVersion>
     <doxiaSitetoolsVersion>1.11.1</doxiaSitetoolsVersion>
osipovmi@deblndw011x:~/var/Projekte/maven-checkstyle-plugin (master *=)
$ tree ./target/local-repo | grep checkstyle
│   │       └── checkstyle
│   │           │   ├── checkstyle-10.18.0-SNAPSHOT.jar
│   │           │   ├── checkstyle-10.18.0-SNAPSHOT.pom
│   │           │   ├── checkstyle-8.15.jar
│   │           │   ├── checkstyle-8.15.jar.lastUpdated
│   │           │   ├── checkstyle-8.15.jar.sha1
│   │           │   ├── checkstyle-8.15.pom
│   │           │   ├── checkstyle-8.15.pom.lastUpdated
│   │           │   └── checkstyle-8.15.pom.sha1
│   │   │   │   ├── maven-checkstyle-plugin
│   │   │   │   │   │   ├── maven-checkstyle-plugin-3.4.1-SNAPSHOT.jar
│   │   │   │   │   │   ├── maven-checkstyle-plugin-3.4.1-SNAPSHOT.pom
...
[INFO] --- maven-invoker-plugin:3.6.1:verify (integration-test) @ maven-checkstyle-plugin ---
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO]   Passed: 49, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:36 min
[INFO] Finished at: 2024-06-07T16:35:30+02:00
[INFO] ------------------------------------------------------------------------

Copy link
Member

@rnveach rnveach left a comment

Choose a reason for hiding this comment

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

I am against supporting new code which has been deprecated for 15 months. While it does seem we forgot to support an old version of the constructor during our change, our goal has always been to move forward and not support old things. We dropped Java 6 and 8 support, and have turned people away as we couldn't support them any longer. We will probably soon drop 11 support.

We still have runtime compatibility with the old maven plugin version. The only reason why we still have this compatibility with the plugin is because we have ingrained ourselves too much with the plugin. We have asked years ago for the plugin to update so we could move on and remove old code, but it hasn't really happened. Our goal now is eventually to break away from the maven plugin and create even more breaking changes. This case is just a sign of things to come. I see maven plugin now needs to decide how it will support versions as we break things further.

Even if we made this change and released it, you would only get it in 10.17.1. What does this mean for versions users want to use between 10.9.3 and 10.17.0 where this constructor didn't exist? Will they be unsupportable? Why do you need compile compatibility with 10.9.3+ if you still have runtime compatibility with us through our snapshot? Can't you just use 10.9.2 as the latest before the breaking change?

@michael-o
Copy link
Contributor Author

Reference: apache/maven-checkstyle-plugin#136 (comment)

@motlin

@michael-o
Copy link
Contributor Author

I'll get back to this next week.

@rnveach
Copy link
Member

rnveach commented Jun 7, 2024

Reference: apache/maven-checkstyle-plugin#136 (comment)
java.lang.NoSuchMethodError:

This is a runtime issue. Other thread said compile compatibility is what was being looked for.

This also shows that if we released this, it would only be supported in 10.17.1 and users could not use versions between 10.9.3 and 10.17.0.

Why doesn't maven plugin drop support for these old versions and use 10.9.3 as the base of what will be supported in the next plugin release?

@michael-o
Copy link
Contributor Author

Reference: apache/maven-checkstyle-plugin#136 (comment)
java.lang.NoSuchMethodError:

This is a runtime issue. Other thread said compile compatibility is what was being looked for.

This also shows that if we released this, it would only be supported in 10.17.1 and users could not use versions between 10.9.3 and 10.17.0.

That would be acceptable.

Why doesn't maven plugin drop support for these old versions and use 10.9.3 as the base of what will be supported in the next plugin release?

Because we cannot raise the plugin baseline to Java 11. All core plugins will remain on Java 8.

@rnveach
Copy link
Member

rnveach commented Jun 7, 2024

Because we cannot raise the plugin baseline to Java 11. All core plugins will remain on Java 8.

However, CS cannot be used on a Java 8 RE (Runtime Environment) since 10.0 .

Also technically, you are already asking us to support 10.17.1 with releasing this PR, so I don't see how you can say you can't upgrade to 10.9.3 but can support 10.17.1. Can't you keep things as "Java 8" and use CS 10.9.3 similar to how you are doing now?

I am sorry I am asking a lot of questions. I am sure admins will talk more on this over the weekend, I am just 1 of 3. I am still leaning against this as in the future you will have more pains and less options to overcome them when we do break from using the plugin.

@romani
Copy link
Member

romani commented Jun 8, 2024

@michael-o ,
What if you do two releases sequentially:

  1. based on checkstyle 10.0, just make it clear it is for jdk 11 binaries. No changes in plugin code about such Enum.
  2. based on 10.9.3 when we introduced different class name. With changes in plugin to use new class name.

Second release will be in good position all further releases does not damage compatibility with maven plugin. So users will play with custom Checkstyle version freely.

@romani
Copy link
Member

romani commented Jun 8, 2024

@motlin ,
For apache/maven-checkstyle-plugin#136 (comment)

It will be always a problem to ask be backwards compatible and need to use latest.
Checkstyle library doesn't support old versions, we going only forward.
If you need to stay on old versions of jdk, you can not use latest checkstyle library.
In few months we will bump min jdk to jdk17. So it will be checkstyle 11.0.0 and will be new big era.

@motlin
Copy link
Contributor

motlin commented Jun 8, 2024

@motlin , For apache/maven-checkstyle-plugin#136 (comment)

It will be always a problem to ask be backwards compatible and need to use latest. Checkstyle library doesn't need support old versions, we going only forward. If you need to stay on old versions of jdk, you can not use latest checkstyle library. In few months we will bump min jdk to jdk17. So it will be checkstyle 11.0.0 and will be new big era.

@romani just to clarify, I'm trying to use recent versions of everything: java 21, checkstyle 10.17.0, and maven-checkstyle-plugin 3.4.0. And I'm trying to set up SARIF output.

I'm one of the maintainers of https://github.com/eclipse/eclipse-collections/ where we go to great lengths to not break backwards compatibility so I can appreciate the effort here.

For folks who do want to use an old version of Java, they'd also have to use an old version of Checkstyle. It seems reasonable to me that they'd also have to use an old version of maven-checkstyle-plugin.

@michael-o
Copy link
Contributor Author

Although I will provide an elaborated answer next week. All I wanted is to provide to as many users (like @motlin) as possible Maven Core plugins with a reasonable set of transitive deps, in other words: make as many people happy as possible since they give us a lot, like Eclipse IDE which I have been using for the past 20 years.

@romani
Copy link
Member

romani commented Jun 8, 2024

I'm trying to use recent versions of everything

Yes, good decision. That why I suggesting to release Plugin 2 times to let people who can not use latest checkstyle library, just use not latest maven plugin.

@michael-o
Copy link
Contributor Author

michael-o commented Jul 8, 2024

Guys, how to move forward with this? While I understand your sentiments, your limitations seems very arbitrary and biased to me. I try to include as many users as possible and -- as said -- moving to Java 11 is not an option at this time.
I see the following solutions:

  1. Close this and lock people into 9.3
  2. Merge and have upwards compat to 10.x at runtime to some extent
  3. Move to https://github.com/rnveach/checkstyle-backport-jre8 (blocker is that it is not in Maven Central)
  4. Remove SARIF support from the Maven Checkstyle Plugin

Note that I do not know what the technical motivation was to move Java 11 for Checkstyle.

@michael-o
Copy link
Contributor Author

I am currently looking into option 3 with the given limitation put aside.

@michael-o
Copy link
Contributor Author

Draft: apache/maven-checkstyle-plugin#143. Requires availability in Maven Central though.

@rnveach
Copy link
Member

rnveach commented Jul 8, 2024

Note that I do not know what the technical motivation was to move Java 11 for Checkstyle.

You can read the discussion at #9146 . Basically more groups were moving to Java 11 and a discussion was had to move forward to 11 too.

There are already discussions to move to 17 soon.

your limitations seems very arbitrary and biased to me

From me, definitely not a bias to you. But I will admit we have have had hard times with the maven plugin. If you can't overcome this issue, things will get even harder when we break more compatibility in the future, which is planned.

Move to https://github.com/rnveach/checkstyle-backport-jre8 (blocker is that it is not in Maven Central)

There are no plans from me right now to put this into maven central. I am not against it, but it would be a big learn for me.

https://github.com/xvik/gradle-quality-plugin already uses backport. Maybe look at how they use backport to see if maven plugin can do the same. As far as I know, they link to the url in the plugin repositories ( see example in https://rnveach.github.io/checkstyle-backport-jre8/ ).

@michael-o
Copy link
Contributor Author

Note that I do not know what the technical motivation was to move Java 11 for Checkstyle.

You can read the discussion at #9146 . Basically more groups were moving to Java 11 and a discussion was had to move forward to 11 too.

There are already discussions to move to 17 soon.

Scanned through the topic, there is zero mentioning about the technical benefits of 11, not to speak of 17.

your limitations seems very arbitrary and biased to me

From me, definitely not a bias to you. But I will admit we have have had hard times with the maven plugin. If you can't overcome this issue, things will get even harder when we break more compatibility in the future, which is planned.

Move to https://github.com/rnveach/checkstyle-backport-jre8 (blocker is that it is not in Maven Central)

There are no plans from me right now to put this into maven central. I am not against it, but it would be a big learn for me.

The release procedure is idential as to the actual checkstyle since the group id is the same. Take the config, apply, release, done.

https://github.com/xvik/gradle-quality-plugin already uses backport. Maybe look at how they use backport to see if maven plugin can do the same. As far as I know, they link to the url in the plugin repositories ( see example in https://rnveach.github.io/checkstyle-backport-jre8/ ).

Not an option because all artifacts on Central must be selfcontained. One cannot reference to a repo outside of Central. If it is not on Central then it does not exist.

@rnveach
Copy link
Member

rnveach commented Jul 8, 2024

there is zero mentioning about the technical benefits of 11, not to speak of 17.

There was none. It was more about "keeping up with the kardashians" then looking for any new features.

The release procedure is idential as to the actual checkstyle

I don't do releases here. At one time we had to do manual releases, and I did it only once or twice. However, I never did the whole process from scratch, including applying for the name and new permissions, which is what backport will need since it is under a different organization.

@motlin
Copy link
Contributor

motlin commented Jul 8, 2024

There's a part of this conversation I don't understand. If I'm on a project where I want/need to use an old version of Java (like Java 8), I must use an old version of Checkstyle too (like Checkstyle 9). If I'm using an old version of Checkstyle, I already have plenty of versions of the maven-checkstyle-plugin which work for me - all the recently released versions including the latest.

Am I missing something? I was expecting that the way forward would be to release apache/maven-checkstyle-plugin#141 and to add documentation about which versions of the maven plugin are compatible with which versions of Checkstyle/Java.

@michael-o
Copy link
Contributor Author

There's a part of this conversation I don't understand. If I'm on a project where I want/need to use an old version of Java (like Java 8), I must use an old version of Checkstyle too (like Checkstyle 9). If I'm using an old version of Checkstyle, I already have plenty of versions of the maven-checkstyle-plugin which work for me - all the recently released versions including the latest.

Am I missing something? I was expecting that the way forward would be to release apache/maven-checkstyle-plugin#141 and to add documentation about which versions of the maven plugin are compatible with which versions of Checkstyle/Java.

That PR was just a PoC.

@michael-o
Copy link
Contributor Author

there is zero mentioning about the technical benefits of 11, not to speak of 17.

There was none. It was more about "keeping up with the kardashians" then looking for any new features.

That is quite disappointing and more or less needless. No itch, no scratch.

The release procedure is idential as to the actual checkstyle

I don't do releases here. At one time we had to do manual releases, and I did it only once or twice. However, I never did the whole process from scratch, including applying for the name and new permissions, which is what backport will need since it is under a different organization.

@romani Do you do the releases? Would you be willing to publish to Central?

@rnveach
Copy link
Member

rnveach commented Jul 8, 2024

@romani basically does the releases for the CS organization. Backport is under my organization. CS didn't want to support anything as official since they only support the latest version. This is a main reason I don't support this PR, as you want to basically bring back support for what we are trying to remove.

Edit: Just adding Java 17 issue at #13209 . It has some other comments on why we want to move on to 17.

@romani
Copy link
Member

romani commented Jul 9, 2024

We are small team, I try to not put more work on our team, we barely able to handle activities and support for main repo.
So backport exists for people who needs old stuff for longer, no support, nobody requested maven central until now, so means that no much needs, and people who needs old jdk are ok to build and put it in their private maven.

@michael-o
Copy link
Contributor Author

We are small team, I try to not put more work on our team, we barely able to handle activities and support for main repo. So backport exists for people who needs old stuff for longer, no support, nobody requested maven central until now, so means that no much needs, and people who needs old jdk are ok to build and put it in their private maven.

I see, then the backport is not an option. 😟

@romani romani force-pushed the add-upwards-compat-maven-checkstyle-plugin branch from 8dd54e3 to 2e51881 Compare October 17, 2024 15:55
romani pushed a commit to michael-o/checkstyle that referenced this pull request Oct 17, 2024
@romani romani force-pushed the add-upwards-compat-maven-checkstyle-plugin branch from 2e51881 to a43ccba Compare October 18, 2024 13:01
Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

I am approving PR.
There is disagreement in team in this update.
But I reusing supper power to move forward with merge.

@romani romani merged commit fdf8903 into checkstyle:master Oct 26, 2024
111 of 112 checks passed
@github-actions github-actions bot added this to the 10.19.0 milestone Oct 26, 2024
@michael-o michael-o deleted the add-upwards-compat-maven-checkstyle-plugin branch October 26, 2024 07:12
@michael-o
Copy link
Contributor Author

I am approving PR. There is disagreement in team in this update. But I reusing supper power to move forward with merge.

Awesome, thank you.

@romani
Copy link
Member

romani commented Oct 26, 2024

@michael-o , 10.19.0 is released please use it in plugin.

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

Successfully merging this pull request may close these issues.

4 participants