-
Notifications
You must be signed in to change notification settings - Fork 304
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
Draft
ppkarwasz
wants to merge
6
commits into
master
Choose a base branch
from
feature/remove-commons-lang
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+196
−8
Draft
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
329a68d
Remove Commons Lang dependency
ppkarwasz 682a82a
Fix style violations
ppkarwasz b56b277
Fix style violations (2)
ppkarwasz 18a4442
Simplify `SystemProperties.getOsName()`
ppkarwasz dffd198
Fix indentation
ppkarwasz ff2cf58
Merge remote-tracking branch 'apache/master' into feature/remove-comm…
ppkarwasz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/org/apache/commons/compress/internal/lang3/ArrayFill.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.commons.compress.internal.lang3; | ||
|
|
||
| import java.util.Arrays; | ||
|
|
||
| public final class ArrayFill { | ||
|
|
||
| public static int[] fill(final int[] a, final int val) { | ||
| Arrays.fill(a, val); | ||
| return a; | ||
| } | ||
|
|
||
| public static byte[] fill(final byte[] a, final byte val) { | ||
| Arrays.fill(a, val); | ||
| return a; | ||
| } | ||
|
|
||
| private ArrayFill() { | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
src/main/java/org/apache/commons/compress/internal/lang3/SystemProperties.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.commons.compress.internal.lang3; | ||
|
|
||
| public final class SystemProperties { | ||
|
|
||
| public static String getOsName() { | ||
| try { | ||
| return System.getProperty("os.name"); | ||
| } catch (final SecurityException e) { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| private SystemProperties() { | ||
| } | ||
| } | ||
31 changes: 31 additions & 0 deletions
31
src/main/java/org/apache/commons/compress/internal/lang3/package-info.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| /** | ||
| * Private copies of methods from Commons Lang. | ||
| * <p> | ||
| * These methods currently account to less then 1% of the size of Commons Lang. | ||
| * They have been copied to prevent the addition of Commons Lang as a dependency. | ||
| * </p> | ||
| * <p>If the size of this package becomes larger than 1% of the size of Commons Lang:</p> | ||
| * <ol> | ||
| * <li>Consider shading of up to 10% of the size of Commons Lang.</li> | ||
| * <li>If that does not work include Commons Lang as dependency.</li> | ||
| * </ol> | ||
| */ | ||
| package org.apache.commons.compress.internal.lang3; |
61 changes: 61 additions & 0 deletions
61
src/main/java/org/apache/commons/compress/internal/lang3/reflect/FieldUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.commons.compress.internal.lang3.reflect; | ||
|
|
||
| import static java.util.Objects.requireNonNull; | ||
|
|
||
| import java.lang.reflect.Field; | ||
|
|
||
| public final class FieldUtils { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
|
||
| public static Object readField(final Object target, final String fieldName, final boolean forceAccess) throws IllegalAccessException { | ||
| requireNonNull(target, "target"); | ||
| requireNonNull(fieldName, "fieldName"); | ||
| final Class<?> cls = target.getClass(); | ||
| final Field field = getField(cls, fieldName, forceAccess); | ||
| if (field == null) { | ||
| throw new IllegalArgumentException(String.format("Cannot locate field %s on %s", fieldName, cls)); | ||
| } | ||
| return field.get(target); | ||
| } | ||
|
|
||
| private static Field getField(final Class<?> cls, final String fieldName, final boolean forceAccess) { | ||
| requireNonNull(cls, "cls"); | ||
| requireNonNull(fieldName, "fieldName"); | ||
| Class<?> currentClass = cls; | ||
| while (currentClass != null) { | ||
| try { | ||
| final Field field = currentClass.getDeclaredField(fieldName); | ||
| // getDeclaredField checks for non-public scopes as well | ||
| // and it returns accurate results | ||
| if (forceAccess && !field.isAccessible()) { | ||
| field.setAccessible(true); | ||
| } | ||
| return field; | ||
| } catch (final NoSuchFieldException ignored) { | ||
| // ignore | ||
| } | ||
| currentClass = currentClass.getSuperclass(); | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| private FieldUtils() { | ||
| } | ||
| } | ||
29 changes: 29 additions & 0 deletions
29
src/main/java/org/apache/commons/compress/internal/lang3/reflect/package-info.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| /** | ||
| * A private copy of methods from Commons Lang. | ||
| * <p> | ||
| * See | ||
| * <a href="{@docRoot}/org/apache/commons/compress/internal/lang3/package-summary.html#package_description> | ||
| * {@code org.apache.commons.compress.internal.lang3} package description | ||
| * </a> | ||
| * for more information. | ||
| * </p> | ||
| */ | ||
| package org.apache.commons.compress.internal.lang3.reflect; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.