-
Notifications
You must be signed in to change notification settings - Fork 303
Remove Commons Lang dependency #607
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
base: master
Are you sure you want to change the base?
Conversation
Commons Compress version 1.26.0 depends on Commons Lang, which is a 650 KiB dependency. In reality, however, only 4 methods accounting for less than 1% of Commons Lang are used. We replace the dependency on `commons-lang3` with a local copy of these 4 methods.
src/main/java/org/apache/commons/compress/internal/lang3/SystemProperties.java
Outdated
Show resolved
Hide resolved
|
As I've pointed out on the dev mailing list: This a horrible mess IMO. To make things even worse, this PR adds public code (the package name is irrelevant), with ZERO Javadoc and ZERO unit tests. This is not the example we should set for contributors and even less for ourselves. This seems to me like a reflection of short term hacking without long term care. I am -1, but it seems pointless as some people are in love with copy-paste over long term maintenance. |
Sure, there is work to be done on this PR (I marked it as draft). Don't worry, if you are willing to accept this solution, I will make the package really private (in OSGi and JPMS) and add the relevant Javadoc and unit tests.
Let's ignore
|
|
I released Kala Compress 1.27.1-1. It is based on commons-compress, but does not depend on commons-io and commons-lang. Maybe this will be what you want. |
I don't believe that forking Commons Compress is the right approach. Your changes in Kala Compress are aligned with what we plan for Commons Compress 2.x. I have created a |
|
We would really appreciate this one, it came as a surprise to us that when we updated from 1.25.0 we had to add a new dependency on commons lang. |
vlsi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good, and it does solve the true pain for the end-users.
Currently commons-compress brings 700KiB commons-lang3 dependency while it uses only a few methods from it. It does sound like a bloat that the PR addresses.
The point of "the code duplicates lang3" is somewhat valid, however, the only "complicated" code relates to FieldUtils which is used in a to-be-deprecated pack200, so I believe it is absolutely fine to move FieldUtils right into pack200 so the "duplicated getField" would die with pack200.
|
|
||
| import java.lang.reflect.Field; | ||
|
|
||
| public final class FieldUtils { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used in a pack200 which has been deprecated for removal in Java 11.
Have you considered moving the implementation to pack200 so the other compressors won't accidentally depend on reflection-like approaches?
Commons Compress version 1.26.0 depends on Commons Lang, which is a 650 KiB dependency. In reality, however, only 4 methods accounting for less than 1% of Commons Lang are used.
We replace the dependency on
commons-lang3with a local copy of these 4 methods.