-
Notifications
You must be signed in to change notification settings - Fork 509
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
Support custom rulesets and reporters on Java 9+ #495
Conversation
Hey maintainers! Thanks for the effort you've invested so far in building and taking care of this library. May I ask for feedback on this PR, please? Many apologies for putting pressure on you. |
Are there tests that can verify this change? |
The original PR (#351) included some tests, but in order to achieve that it refactored significant portions of the code to improve testability, something which I gather the maintainers didn't like. Please let me know if you think it's possible to add tests while avoiding the refactoring! |
I think the only question about your previous PR was that it included some gradle upgrades, which seemed outside the scope of the classloader change. |
Oh, if that's the case, then I will rebase some more commits by @marschwar on top of current |
This happened! Some updates were necessary, but most of @marschwar's code is there. For example, I couldn't find a way to preserve the following test (https://github.com/marschwar/ktlint/blob/78b63624c1d6f0767d321727452c0207e5d8f09a/ktlint/src/test/kotlin/com/github/shyiko/ktlint/internal/RuleSetLoaderKtTest.kt#L26-L38) because I couldn't find a ruleset published on Maven compatible with |
14ebf4c
to
b6a2238
Compare
Hi @shashachu ! Sorry to bother you again, but we'd really love to use the custom ruleset feature on Java 9+. The fact that this PR adds code to the deprecated |
Hi! I am actually planning on removing the |
As expected, merging #566 caused conflicts for this PR. Now, do you like the solution that I proposed in #495 (comment) (adding a |
I don't have a problem with it assuming there's still enough code left to warrant a separate class. Making the code cleaner never seems like a bad idea. |
I may be wrong, but only problem to support Java 9+ seems to be this hack to load 3rd party jars:
Most probably, using this (picked from your changes, replace val rulesetClassLoader = URLClassLoader(urls.toTypedArray(), RuleSet::class.java.classLoader) would solve the problem. |
It blows up a little earlier, when trying to cast the system class loader as a |
I am not an expert in classloaders, but seems it is the right way to go. |
This PR is pretty much a rebase on current
master
of the first commit in #351. The idea is to reduce the scope so that we can merge and get a release as fast as possible, as I needktlint
to support Java 9+.