[jira] [Commented] (BEANUTILS-509) WeakHashmap enters into infinite loop in WrapDynaClass.java
[ https://issues.apache.org/jira/browse/BEANUTILS-509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17303771#comment-17303771 ] sunil commented on BEANUTILS-509: - Hi, I do see that [https://github.com/apache/commons-beanutils/pull/37] is merged ! Does the latest version have the fix for same ? If so can you please confirm the stable version number to pick up the changes. [~melloware] Thank You > WeakHashmap enters into infinite loop in WrapDynaClass.java > --- > > Key: BEANUTILS-509 > URL: https://issues.apache.org/jira/browse/BEANUTILS-509 > Project: Commons BeanUtils > Issue Type: Bug > Components: DynaBean >Affects Versions: 1.8.2 >Reporter: sunil >Priority: Major > Attachments: 2018-10-13T11-43-27_961-jvmRun1.dump, > 2018-10-13T11-43-27_961.dumpstream, BEANUTILS-509.diff, WrapDynaCache.patch, > WrapDynaCache_after_svn_commit.patch, console.log.backup > > Time Spent: 10m > Remaining Estimate: 0h > > We noticed that our application was using too much of CPU , all the 6 cores > were used. > On capturing the thread dump we saw that large number of threads were in the > running state and in : > at java.util.WeakHashMap.get(WeakHashMap.java:403) > at > org.apache.commons.beanutils.WrapDynaClass.createDynaClass(WrapDynaClass.java:425) > > So we are suspecting that the thread has entered into indefinite while loop > and hogging all the CPU resources. > I have attached the thread dump for reference. > > what is the solution for this issue? -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567984=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567984 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 21:32 Start Date: 17/Mar/21 21:32 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-800829428 [![Coverage Status](https://coveralls.io/builds/38029860/badge)](https://coveralls.io/builds/38029860) Coverage increased (+0.003%) to 94.939% when pulling **4f6f768f4525f469f3994650f2f67614e7d2a7ad on arturobernalg:feature/LANG-1649** into **69c9593cc1da760bb4dbcf32f4ae755c54376b77 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567984) Time Spent: 3h 50m (was: 3h 40m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 3h 50m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] coveralls edited a comment on pull request #731: LANG-1649 - Check if method is Overridable
coveralls edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-800829428 [![Coverage Status](https://coveralls.io/builds/38029860/badge)](https://coveralls.io/builds/38029860) Coverage increased (+0.003%) to 94.939% when pulling **4f6f768f4525f469f3994650f2f67614e7d2a7ad on arturobernalg:feature/LANG-1649** into **69c9593cc1da760bb4dbcf32f4ae755c54376b77 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [commons-vfs] garydgregory commented on pull request #168: [bug] find a bug about chinese characters in FileObject path then call toFile
garydgregory commented on pull request #168: URL: https://github.com/apache/commons-vfs/pull/168#issuecomment-801382910 @XenoAmess May you please rebase on master to pick up the new build matrix? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Created] (IO-724) FileUtils.deleteDirectory javadoc is inaccurate for nonexistent directory
Henry Tung created IO-724: - Summary: FileUtils.deleteDirectory javadoc is inaccurate for nonexistent directory Key: IO-724 URL: https://issues.apache.org/jira/browse/IO-724 Project: Commons IO Issue Type: Bug Components: Utilities Affects Versions: 2.8.0 Reporter: Henry Tung FileUtils.deleteDirectory javadoc claims: {code:java} @throws IllegalArgumentException if {@code directory} does not exist or is not a directory{code} but the first two lines of the code are: {code:java} Objects.requireNonNull(directory, "directory"); if (!directory.exists()) { return; }{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Created] (CSV-273) Define automatic Java module name for jar file
Marcel Baumann created CSV-273: -- Summary: Define automatic Java module name for jar file Key: CSV-273 URL: https://issues.apache.org/jira/browse/CSV-273 Project: Commons CSV Issue Type: Improvement Components: Build Affects Versions: 1.8 Reporter: Marcel Baumann It would be great to at least define an automatic Java module name in the manifest following apache convention: 'org.apache.commons.csv'. The effort would be minimal. Far better would be to provide a full-fledged module-info.java definition. But I understand that the effort is greater. It should be considered that JDK 9 introduced modules a long time ago and it is reasonable to start supporting this feature. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567902=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567902 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 18:46 Start Date: 17/Mar/21 18:46 Worklog Time Spent: 10m Work Description: arturobernalg commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596293696 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -1131,6 +1140,24 @@ public void test_isAssignable_Widening() { assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE), "boolean -> boolean"); } +/** + * Test for {@link ClassUtils#isOverridable(Method, Class)}. + */ +@Test +public void test_isOverridable() throws Exception { +final Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null); +assertTrue(ClassUtils.isOverridable(publicMethod, Object.class)); +assertFalse(ClassUtils.isOverridable(null, Object.class)); +final Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null); +assertFalse(ClassUtils.isOverridable(privateMethod, ABG.class)); +final Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null); Review comment: Done ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: Done This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567902) Time Spent: 3h 40m (was: 3.5h) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 3h 40m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
arturobernalg commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596293696 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -1131,6 +1140,24 @@ public void test_isAssignable_Widening() { assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE), "boolean -> boolean"); } +/** + * Test for {@link ClassUtils#isOverridable(Method, Class)}. + */ +@Test +public void test_isOverridable() throws Exception { +final Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null); +assertTrue(ClassUtils.isOverridable(publicMethod, Object.class)); +assertFalse(ClassUtils.isOverridable(null, Object.class)); +final Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null); +assertFalse(ClassUtils.isOverridable(privateMethod, ABG.class)); +final Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null); Review comment: Done ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: Done This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567900=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567900 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 18:43 Start Date: 17/Mar/21 18:43 Worklog Time Spent: 10m Work Description: arturobernalg edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-801322756 HI @aherbert Hi, thank you for the test case tip. I didn't know the reflect test package. Regarding with use bitwise operator IMO it's more complex TY This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567900) Time Spent: 3.5h (was: 3h 20m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 3.5h > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg edited a comment on pull request #731: LANG-1649 - Check if method is Overridable
arturobernalg edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-801322756 HI @aherbert Hi, thank you for the test case tip. I didn't know the reflect test package. Regarding with use bitwise operator IMO it's more complex TY This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567898=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567898 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 18:42 Start Date: 17/Mar/21 18:42 Worklog Time Spent: 10m Work Description: arturobernalg commented on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-801322756 HI @aherbert Hi, thank you for the test case tip. Regarding with use bitwise operator IMO it's more complex TY This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567898) Time Spent: 3h 20m (was: 3h 10m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 3h 20m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg commented on pull request #731: LANG-1649 - Check if method is Overridable
arturobernalg commented on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-801322756 HI @aherbert Hi, thank you for the test case tip. Regarding with use bitwise operator IMO it's more complex TY This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567876=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567876 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 18:17 Start Date: 17/Mar/21 18:17 Worklog Time Spent: 10m Work Description: aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596273898 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: Using `&` here is a bitwise AND operation (see [Bitwise Operators](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op3.html)). Look at the source code for Modifier.isStatic(...) for an example. Did you try the code? It has a missing parenthesis so this should be correct: ```java final int mod = method.getModifiers(); if ((mod & (Modifier.STATIC | Modifier.FINAL | Modifier.PRIVATE)) != 0) { return false; } if ((mod & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) { return true; } // default scope: the package must be the same to allow override return getPackageName(method.getDeclaringClass()).equals(getPackageName(cls)); ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567876) Time Spent: 3h 10m (was: 3h) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 3h 10m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] aherbert commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596273898 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: Using `&` here is a bitwise AND operation (see [Bitwise Operators](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op3.html)). Look at the source code for Modifier.isStatic(...) for an example. Did you try the code? It has a missing parenthesis so this should be correct: ```java final int mod = method.getModifiers(); if ((mod & (Modifier.STATIC | Modifier.FINAL | Modifier.PRIVATE)) != 0) { return false; } if ((mod & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) { return true; } // default scope: the package must be the same to allow override return getPackageName(method.getDeclaringClass()).equals(getPackageName(cls)); ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567875=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567875 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 18:11 Start Date: 17/Mar/21 18:11 Worklog Time Spent: 10m Work Description: aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596269673 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -1131,6 +1140,24 @@ public void test_isAssignable_Widening() { assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE), "boolean -> boolean"); } +/** + * Test for {@link ClassUtils#isOverridable(Method, Class)}. + */ +@Test +public void test_isOverridable() throws Exception { +final Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null); +assertTrue(ClassUtils.isOverridable(publicMethod, Object.class)); +assertFalse(ClassUtils.isOverridable(null, Object.class)); +final Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null); +assertFalse(ClassUtils.isOverridable(privateMethod, ABG.class)); +final Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null); Review comment: The test case should also pull in a default method from a super class declared in another package and test that the result is false. Try putting a public class in `src/test/o.a.c.lang3/reflect/testbed` with a default method then extending that in your test class (e.g. `ClassUtilsTest.ABG2`) and see if the method detects the package is incorrect and it cannot be overridden This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567875) Time Spent: 3h (was: 2h 50m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 3h > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] aherbert commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596269673 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -1131,6 +1140,24 @@ public void test_isAssignable_Widening() { assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE), "boolean -> boolean"); } +/** + * Test for {@link ClassUtils#isOverridable(Method, Class)}. + */ +@Test +public void test_isOverridable() throws Exception { +final Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null); +assertTrue(ClassUtils.isOverridable(publicMethod, Object.class)); +assertFalse(ClassUtils.isOverridable(null, Object.class)); +final Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null); +assertFalse(ClassUtils.isOverridable(privateMethod, ABG.class)); +final Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null); Review comment: The test case should also pull in a default method from a super class declared in another package and test that the result is false. Try putting a public class in `src/test/o.a.c.lang3/reflect/testbed` with a default method then extending that in your test class (e.g. `ClassUtilsTest.ABG2`) and see if the method detects the package is incorrect and it cannot be overridden This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567874=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567874 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 18:10 Start Date: 17/Mar/21 18:10 Worklog Time Spent: 10m Work Description: arturobernalg commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596268511 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: & cannot be applied to int. Will not work. And IMO to more complex and hard to read This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567874) Time Spent: 2h 50m (was: 2h 40m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 2h 50m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567871=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567871 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 18:10 Start Date: 17/Mar/21 18:10 Worklog Time Spent: 10m Work Description: arturobernalg commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596268511 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: & cannot be applied to int. Will not work This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567871) Time Spent: 2h 40m (was: 2.5h) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 2h 40m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
arturobernalg commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596268511 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: & cannot be applied to int. Will not work. And IMO to more complex and hard to read This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567869=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567869 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 18:09 Start Date: 17/Mar/21 18:09 Worklog Time Spent: 10m Work Description: arturobernalg commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596268511 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: & cannot be applied to int This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567869) Time Spent: 2.5h (was: 2h 20m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 2.5h > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
arturobernalg commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596268511 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: & cannot be applied to int. Will not work This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [commons-lang] arturobernalg commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
arturobernalg commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596268511 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: & cannot be applied to int This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567864=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567864 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 18:01 Start Date: 17/Mar/21 18:01 Worklog Time Spent: 10m Work Description: aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596262934 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: Given that `Modifiers` exposes the bit flag constants can this all be done with 2 comparisons: ```java final int mod = method.getModifiers(); if ((mod & (Modifier.STATIC | Modifier.FINAL | Modifier.PRIVATE) != 0) { return false; } if ((mod & (Modifier.PUBLIC | Modifier.PROTECTED) != 0) { return true; } // default scope: the package must be the same to allow override return getPackageName(method.getDeclaringClass()).equals(getPackageName(cls)); ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567864) Time Spent: 2h 20m (was: 2h 10m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 2h 20m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] aherbert commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596262934 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod() { + *} + *void defaultMethod() { + *} + *public void publicMethod() { + *} + *public final void finalMethod() { + *} + *public static void staticMethod() { + *} + *} + * Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null) + * Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null) + * Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null) + * + * + * ClassUtils.isOverridable(null, null)= false + * ClassUtils.isOverridable(null, Class) = false + * ClassUtils.isOverridable(Class, null) = false + * ClassUtils.isOverridable(privateMethod, ABG.class)) = false + * ClassUtils.isOverridable(defaultMethod, ABG.class)) = true + * ClassUtils.isOverridable(publicMethod, ABG.class)) = true + * ClassUtils.isOverridable(finalMethod, ABG.class)) = false + * ClassUtils.isOverridable(staticMethod, ABG.class)) = false + * + * + * @param method the method to check, may be {@code null} + * @param cls the target class to check against, may be {@code null} + * @return {@code true} if the is overridable, false if not or any {@code null} input + * @since 3.13.0 + */ +public static boolean isOverridable(final Method method, final Class cls) { +if (ObjectUtils.anyNull(method, cls)) { +return false; +} +if (Modifier.isStatic(method.getModifiers())) { Review comment: Given that `Modifiers` exposes the bit flag constants can this all be done with 2 comparisons: ```java final int mod = method.getModifiers(); if ((mod & (Modifier.STATIC | Modifier.FINAL | Modifier.PRIVATE) != 0) { return false; } if ((mod & (Modifier.PUBLIC | Modifier.PROTECTED) != 0) { return true; } // default scope: the package must be the same to allow override return getPackageName(method.getDeclaringClass()).equals(getPackageName(cls)); ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567863=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567863 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 17:57 Start Date: 17/Mar/21 17:57 Worklog Time Spent: 10m Work Description: arturobernalg commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596260192 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -88,6 +88,14 @@ // empty } } +private static class ABG { Review comment: Done ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -88,6 +88,14 @@ // empty } } +private static class ABG { +public void publicMethod(){} +private void privateMethod(){} +void defaultMethod(){} +public final void finalMethod(){} +public static void staticMethod(){} Review comment: Done ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -1131,6 +1139,25 @@ public void test_isAssignable_Widening() { assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE), "boolean -> boolean"); } +/** + * Test for {@link ClassUtils#isOverridable(Method, Class)}. + */ +@Test +public void test_isOverridable() throws Exception { +final Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null); +assertTrue(ClassUtils.isOverridable(publicMethod, Object.class)); +assertFalse(ClassUtils.isOverridable(null, Object.class)); +final Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null); +assertFalse(ClassUtils.isOverridable(privateMethod, ABG.class)); +final Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null); +assertTrue(ClassUtils.isOverridable(defaultMethod, ABG.class)); +final Method finalMethod = ABG.class.getDeclaredMethod("finalMethod", null); +assertFalse(ClassUtils.isOverridable(finalMethod, ABG.class)); +final Method staticMethod = ABG.class.getDeclaredMethod("staticMethod", null); +assertFalse(ClassUtils.isOverridable(staticMethod, ABG.class)); + Review comment: Done ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. Review comment: Done ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod(){ Review comment: Done This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567863) Time Spent: 2h 10m (was: 2h) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 2h 10m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
arturobernalg commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596260192 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -88,6 +88,14 @@ // empty } } +private static class ABG { Review comment: Done ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -88,6 +88,14 @@ // empty } } +private static class ABG { +public void publicMethod(){} +private void privateMethod(){} +void defaultMethod(){} +public final void finalMethod(){} +public static void staticMethod(){} Review comment: Done ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -1131,6 +1139,25 @@ public void test_isAssignable_Widening() { assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE), "boolean -> boolean"); } +/** + * Test for {@link ClassUtils#isOverridable(Method, Class)}. + */ +@Test +public void test_isOverridable() throws Exception { +final Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null); +assertTrue(ClassUtils.isOverridable(publicMethod, Object.class)); +assertFalse(ClassUtils.isOverridable(null, Object.class)); +final Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null); +assertFalse(ClassUtils.isOverridable(privateMethod, ABG.class)); +final Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null); +assertTrue(ClassUtils.isOverridable(defaultMethod, ABG.class)); +final Method finalMethod = ABG.class.getDeclaredMethod("finalMethod", null); +assertFalse(ClassUtils.isOverridable(finalMethod, ABG.class)); +final Method staticMethod = ABG.class.getDeclaredMethod("staticMethod", null); +assertFalse(ClassUtils.isOverridable(staticMethod, ABG.class)); + Review comment: Done ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. Review comment: Done ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod(){ Review comment: Done This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567855=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567855 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 17:46 Start Date: 17/Mar/21 17:46 Worklog Time Spent: 10m Work Description: aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596251679 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod(){ Review comment: Add whitespace before the curly brace `{` (to match our coding style) This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567855) Time Spent: 2h (was: 1h 50m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 2h > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] aherbert commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596251679 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. + * + * This method returns {@code false} for any {@code null} input or method with the static or final modifiers. + * + * + * private static class ABG { + *private void privateMethod(){ Review comment: Add whitespace before the curly brace `{` (to match our coding style) This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [commons-lang] aherbert commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596251089 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. Review comment: No `` tags on the first paragraph This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567853=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567853 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 17:45 Start Date: 17/Mar/21 17:45 Worklog Time Spent: 10m Work Description: aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596251089 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -935,6 +935,60 @@ public static boolean isAssignable(Class cls, final Class toClass, final b return toClass.isAssignableFrom(cls); } +/** + * Check if the given {@code Method} is overridable in the given target {@code Class}. Review comment: No `` tags on the first paragraph This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567853) Time Spent: 1h 50m (was: 1h 40m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 1h 50m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567850=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567850 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 17:44 Start Date: 17/Mar/21 17:44 Worklog Time Spent: 10m Work Description: aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596249900 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -88,6 +88,14 @@ // empty } } +private static class ABG { +public void publicMethod(){} +private void privateMethod(){} +void defaultMethod(){} +public final void finalMethod(){} +public static void staticMethod(){} Review comment: Remove double whitespace after void. The same change in the javadoc of the method in ClassUtils. ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -1131,6 +1139,25 @@ public void test_isAssignable_Widening() { assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE), "boolean -> boolean"); } +/** + * Test for {@link ClassUtils#isOverridable(Method, Class)}. + */ +@Test +public void test_isOverridable() throws Exception { +final Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null); +assertTrue(ClassUtils.isOverridable(publicMethod, Object.class)); +assertFalse(ClassUtils.isOverridable(null, Object.class)); +final Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null); +assertFalse(ClassUtils.isOverridable(privateMethod, ABG.class)); +final Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null); +assertTrue(ClassUtils.isOverridable(defaultMethod, ABG.class)); +final Method finalMethod = ABG.class.getDeclaredMethod("finalMethod", null); +assertFalse(ClassUtils.isOverridable(finalMethod, ABG.class)); +final Method staticMethod = ABG.class.getDeclaredMethod("staticMethod", null); +assertFalse(ClassUtils.isOverridable(staticMethod, ABG.class)); + Review comment: Remove extra line here This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567850) Time Spent: 1h 40m (was: 1.5h) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 1h 40m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] aherbert commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596249900 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -88,6 +88,14 @@ // empty } } +private static class ABG { +public void publicMethod(){} +private void privateMethod(){} +void defaultMethod(){} +public final void finalMethod(){} +public static void staticMethod(){} Review comment: Remove double whitespace after void. The same change in the javadoc of the method in ClassUtils. ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -1131,6 +1139,25 @@ public void test_isAssignable_Widening() { assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE), "boolean -> boolean"); } +/** + * Test for {@link ClassUtils#isOverridable(Method, Class)}. + */ +@Test +public void test_isOverridable() throws Exception { +final Method publicMethod = ABG.class.getDeclaredMethod("publicMethod", null); +assertTrue(ClassUtils.isOverridable(publicMethod, Object.class)); +assertFalse(ClassUtils.isOverridable(null, Object.class)); +final Method privateMethod = ABG.class.getDeclaredMethod("privateMethod", null); +assertFalse(ClassUtils.isOverridable(privateMethod, ABG.class)); +final Method defaultMethod = ABG.class.getDeclaredMethod("defaultMethod", null); +assertTrue(ClassUtils.isOverridable(defaultMethod, ABG.class)); +final Method finalMethod = ABG.class.getDeclaredMethod("finalMethod", null); +assertFalse(ClassUtils.isOverridable(finalMethod, ABG.class)); +final Method staticMethod = ABG.class.getDeclaredMethod("staticMethod", null); +assertFalse(ClassUtils.isOverridable(staticMethod, ABG.class)); + Review comment: Remove extra line here This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567849=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567849 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 17:43 Start Date: 17/Mar/21 17:43 Worklog Time Spent: 10m Work Description: aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596249386 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -88,6 +88,14 @@ // empty } } +private static class ABG { Review comment: Add an extra line This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567849) Time Spent: 1.5h (was: 1h 20m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 1.5h > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] aherbert commented on a change in pull request #731: LANG-1649 - Check if method is Overridable
aherbert commented on a change in pull request #731: URL: https://github.com/apache/commons-lang/pull/731#discussion_r596249386 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -88,6 +88,14 @@ // empty } } +private static class ABG { Review comment: Add an extra line This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567828=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567828 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 17:06 Start Date: 17/Mar/21 17:06 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-800829428 [![Coverage Status](https://coveralls.io/builds/38021203/badge)](https://coveralls.io/builds/38021203) Coverage increased (+0.003%) to 94.939% when pulling **9e848fb6171a8271b97b786e91bd19d6f660b986 on arturobernalg:feature/LANG-1649** into **a6714731f5451427cdf6225d1f61c5deab29bd2b on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567828) Time Spent: 1h 20m (was: 1h 10m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 1h 20m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] coveralls edited a comment on pull request #731: LANG-1649 - Check if method is Overridable
coveralls edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-800829428 [![Coverage Status](https://coveralls.io/builds/38021203/badge)](https://coveralls.io/builds/38021203) Coverage increased (+0.003%) to 94.939% when pulling **9e848fb6171a8271b97b786e91bd19d6f660b986 on arturobernalg:feature/LANG-1649** into **a6714731f5451427cdf6225d1f61c5deab29bd2b on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Updated] (MATH-1567) Harmonic Mean Calculation
[ https://issues.apache.org/jira/browse/MATH-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hasan Diwan updated MATH-1567: -- Attachment: harmonicMean.pat > Harmonic Mean Calculation > - > > Key: MATH-1567 > URL: https://issues.apache.org/jira/browse/MATH-1567 > Project: Commons Math > Issue Type: New Feature >Affects Versions: 3.6.1 >Reporter: Hasan Diwan >Priority: Trivial > Labels: easyfix, newbie, patch > Fix For: 4.0 > > Attachments: harmonicMean.pat > > Original Estimate: 1h > Remaining Estimate: 1h > > Patch adds harmonic mean support to StatsUtils. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (MATH-1567) Harmonic Mean Calculation
[ https://issues.apache.org/jira/browse/MATH-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hasan Diwan updated MATH-1567: -- Attachment: (was: harmonicMean.pat) > Harmonic Mean Calculation > - > > Key: MATH-1567 > URL: https://issues.apache.org/jira/browse/MATH-1567 > Project: Commons Math > Issue Type: New Feature >Affects Versions: 3.6.1 >Reporter: Hasan Diwan >Priority: Trivial > Labels: easyfix, newbie, patch > Fix For: 4.0 > > Original Estimate: 1h > Remaining Estimate: 1h > > Patch adds harmonic mean support to StatsUtils. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Created] (COMPRESS-572) Update zstd-jni dependency version to 1.4.9-1
Michael Heuer created COMPRESS-572: -- Summary: Update zstd-jni dependency version to 1.4.9-1 Key: COMPRESS-572 URL: https://issues.apache.org/jira/browse/COMPRESS-572 Project: Commons Compress Issue Type: New Feature Reporter: Michael Heuer Apache Avro and Parquet projects are releasing new versions with zstd-jni dependency version at 1.4.9-1. It would be desireable for the next version of commons-compress to use the same version for compatibility reasons. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Created] (CRYPTO-158) Illegal reflective access
Juan F Arjona created CRYPTO-158: Summary: Illegal reflective access Key: CRYPTO-158 URL: https://issues.apache.org/jira/browse/CRYPTO-158 Project: Commons Crypto Issue Type: Bug Components: Cipher Affects Versions: 1.1.0 Environment: Linux OpenJDK 15.0.2 Reporter: Juan F Arjona Getting this message: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.apache.commons.crypto.stream.CryptoInputStream (.../BOOT-INF/lib/commons-crypto-1.1.0.jar!/) to method sun.nio.ch.DirectBuffer.cleaner() WARNING: Please consider reporting this to the maintainers of org.apache.commons.crypto.stream.CryptoInputStream WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567702=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567702 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 14:25 Start Date: 17/Mar/21 14:25 Worklog Time Spent: 10m Work Description: arturobernalg edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-801104206 > There are more rules to check here. You should also check the method is not **final** using `Modifier.isFinal` which prevents being overridden. > > How to handle static methods is an issue. You cannot create an **instance** method in a subclass with the same signature as a **static** method from the super class. But you can create a **static** method with the same signature. The static methods are not dispatched on an object at runtime. The method to use is chosen by the compiler. > > So perhaps this should return false for any method with the static or final modifiers. Hi @aherbert I completely forgot about the final. I have change the validation in order to return false when the method it's static or final. TY This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567702) Time Spent: 1h 10m (was: 1h) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 1h 10m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg edited a comment on pull request #731: LANG-1649 - Check if method is Overridable
arturobernalg edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-801104206 > There are more rules to check here. You should also check the method is not **final** using `Modifier.isFinal` which prevents being overridden. > > How to handle static methods is an issue. You cannot create an **instance** method in a subclass with the same signature as a **static** method from the super class. But you can create a **static** method with the same signature. The static methods are not dispatched on an object at runtime. The method to use is chosen by the compiler. > > So perhaps this should return false for any method with the static or final modifiers. Hi @aherbert I completely forgot about the final. I have change the validation in order to return false when the method it's static or final. TY This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567673=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567673 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 14:00 Start Date: 17/Mar/21 14:00 Worklog Time Spent: 10m Work Description: arturobernalg commented on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-801104206 > There are more rules to check here. You should also check the method is not **final** using `Modifier.isFinal` which prevents being overridden. > > How to handle static methods is an issue. You cannot create an **instance** method in a subclass with the same signature as a **static** method from the super class. But you can create a **static** method with the same signature. The static methods are not dispatched on an object at runtime. The method to use is chosen by the compiler. > > So perhaps this should return false for any method with the static or final modifiers. Hi @aherbert I completely forgot about the final. I will check the static case. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567673) Time Spent: 1h (was: 50m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 1h > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg commented on pull request #731: LANG-1649 - Check if method is Overridable
arturobernalg commented on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-801104206 > There are more rules to check here. You should also check the method is not **final** using `Modifier.isFinal` which prevents being overridden. > > How to handle static methods is an issue. You cannot create an **instance** method in a subclass with the same signature as a **static** method from the super class. But you can create a **static** method with the same signature. The static methods are not dispatched on an object at runtime. The method to use is chosen by the compiler. > > So perhaps this should return false for any method with the static or final modifiers. Hi @aherbert I completely forgot about the final. I will check the static case. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567634=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567634 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 13:04 Start Date: 17/Mar/21 13:04 Worklog Time Spent: 10m Work Description: aherbert commented on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-801064190 There are more rules to check here. You should also check the method is not **final** using `Modifier.isFinal` which prevents being overridden. How to handle static methods is an issue. You cannot create an **instance** method in a subclass with the same signature as a **static** method from the super class. But you can create a **static** method with the same signature. The static methods are not dispatched on an object at runtime. The method to use is chosen by the compiler. So perhaps this should return false for any method with the static or final modifiers. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567634) Time Spent: 50m (was: 40m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 50m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] aherbert commented on pull request #731: LANG-1649 - Check if method is Overridable
aherbert commented on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-801064190 There are more rules to check here. You should also check the method is not **final** using `Modifier.isFinal` which prevents being overridden. How to handle static methods is an issue. You cannot create an **instance** method in a subclass with the same signature as a **static** method from the super class. But you can create a **static** method with the same signature. The static methods are not dispatched on an object at runtime. The method to use is chosen by the compiler. So perhaps this should return false for any method with the static or final modifiers. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (COMPRESS-571) 7z random access fails on shuffled entry list
[ https://issues.apache.org/jira/browse/COMPRESS-571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17303383#comment-17303383 ] Michael Osipov commented on COMPRESS-571: - Why a copy and not a unmodifiable list? > 7z random access fails on shuffled entry list > - > > Key: COMPRESS-571 > URL: https://issues.apache.org/jira/browse/COMPRESS-571 > Project: Commons Compress > Issue Type: Bug >Affects Versions: 1.20 >Reporter: Robin Schimpf >Assignee: Peter Lee >Priority: Major > > I noticed a problem on a 7z file and could reproduce the error if the > InputStream is retrieved after shuffling the entries. > This test fails with a checksum verification error > {code:java} > @Test > public void retrieveInputStreamForShuffledEntries() throws IOException { > try (final SevenZFile sevenZFile = new > SevenZFile(getFile("COMPRESS-256.7z"))) { > List entries = (List) > sevenZFile.getEntries(); > Collections.shuffle(entries); > for (final SevenZArchiveEntry entry : entries) { > IOUtils.toByteArray(sevenZFile.getInputStream(entry)); > } > } > } > {code} > This is the exception > {code:java} > java.io.IOException: Checksum verification failed > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:94) > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:74) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:87) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:62) > at > org.apache.commons.compress.utils.IOUtils.toByteArray(IOUtils.java:247) > at > org.apache.commons.compress.archivers.sevenz.SevenZFileTest.retrieveInputStreamForShuffledEntries(SevenZFileTest.java:616) > {code} > This also fails on the current master with the same error -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (COMPRESS-571) 7z random access fails on shuffled entry list
[ https://issues.apache.org/jira/browse/COMPRESS-571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Osipov updated COMPRESS-571: Summary: 7z random access fails on shuffled entry list (was: 7z random access failes on shuffled entry list) > 7z random access fails on shuffled entry list > - > > Key: COMPRESS-571 > URL: https://issues.apache.org/jira/browse/COMPRESS-571 > Project: Commons Compress > Issue Type: Bug >Affects Versions: 1.20 >Reporter: Robin Schimpf >Assignee: Peter Lee >Priority: Major > > I noticed a problem on a 7z file and could reproduce the error if the > InputStream is retrieved after shuffling the entries. > This test fails with a checksum verification error > {code:java} > @Test > public void retrieveInputStreamForShuffledEntries() throws IOException { > try (final SevenZFile sevenZFile = new > SevenZFile(getFile("COMPRESS-256.7z"))) { > List entries = (List) > sevenZFile.getEntries(); > Collections.shuffle(entries); > for (final SevenZArchiveEntry entry : entries) { > IOUtils.toByteArray(sevenZFile.getInputStream(entry)); > } > } > } > {code} > This is the exception > {code:java} > java.io.IOException: Checksum verification failed > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:94) > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:74) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:87) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:62) > at > org.apache.commons.compress.utils.IOUtils.toByteArray(IOUtils.java:247) > at > org.apache.commons.compress.archivers.sevenz.SevenZFileTest.retrieveInputStreamForShuffledEntries(SevenZFileTest.java:616) > {code} > This also fails on the current master with the same error -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Comment Edited] (MATH-1567) Harmonic Mean Calculation
[ https://issues.apache.org/jira/browse/MATH-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17303348#comment-17303348 ] Gilles Sadowski edited comment on MATH-1567 at 3/17/21, 12:25 PM: -- You should verify that updates don't break the build... Also: * Please follow the style convention (one space around operators, "final" for constants, 4-spaces indentation) * Full documentation is mandatory (there is a missing {{@return}} tag) * In Junit test: Why the use of {{NumberFormat}} (rather than the usual tolerance parameter)? * No trailing white space Many checks are automatically perfomed if you create a pull request through [GitHub|https://github.com/apache/commons-math/]. was (Author: erans): You should verify that updates don't break the build... Also: * Please follow the style convention (one space around operators, "final" for constants, 4-spaces indentation, ...), * Full documentation is mandatory (there is a missing {{@return}} tag) * In Junit test: Why the use of {{NumberFormat}} (rather than the usual tolerance parameter)? * No trailing white space > Harmonic Mean Calculation > - > > Key: MATH-1567 > URL: https://issues.apache.org/jira/browse/MATH-1567 > Project: Commons Math > Issue Type: New Feature >Affects Versions: 3.6.1 >Reporter: Hasan Diwan >Priority: Trivial > Labels: easyfix, newbie, patch > Fix For: 4.0 > > Attachments: harmonicMean.pat > > Original Estimate: 1h > Remaining Estimate: 1h > > Patch adds harmonic mean support to StatsUtils. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MATH-1567) Harmonic Mean Calculation
[ https://issues.apache.org/jira/browse/MATH-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17303348#comment-17303348 ] Gilles Sadowski commented on MATH-1567: --- You should verify that updates don't break the build... Also: * Please follow the style convention (one space around operators, "final" for constants, 4-spaces indentation, ...), * Full documentation is mandatory (there is a missing {{@return}} tag) * In Junit test: Why the use of {{NumberFormat}} (rather than the usual tolerance parameter)? * No trailing white space > Harmonic Mean Calculation > - > > Key: MATH-1567 > URL: https://issues.apache.org/jira/browse/MATH-1567 > Project: Commons Math > Issue Type: New Feature >Affects Versions: 3.6.1 >Reporter: Hasan Diwan >Priority: Trivial > Labels: easyfix, newbie, patch > Fix For: 4.0 > > Attachments: harmonicMean.pat > > Original Estimate: 1h > Remaining Estimate: 1h > > Patch adds harmonic mean support to StatsUtils. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (COMPRESS-571) 7z random access failes on shuffled entry list
[ https://issues.apache.org/jira/browse/COMPRESS-571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17303178#comment-17303178 ] Peter Lee commented on COMPRESS-571: Fixed with 65a5c75c. > 7z random access failes on shuffled entry list > -- > > Key: COMPRESS-571 > URL: https://issues.apache.org/jira/browse/COMPRESS-571 > Project: Commons Compress > Issue Type: Bug >Affects Versions: 1.20 >Reporter: Robin Schimpf >Assignee: Peter Lee >Priority: Major > > I noticed a problem on a 7z file and could reproduce the error if the > InputStream is retrieved after shuffling the entries. > This test fails with a checksum verification error > {code:java} > @Test > public void retrieveInputStreamForShuffledEntries() throws IOException { > try (final SevenZFile sevenZFile = new > SevenZFile(getFile("COMPRESS-256.7z"))) { > List entries = (List) > sevenZFile.getEntries(); > Collections.shuffle(entries); > for (final SevenZArchiveEntry entry : entries) { > IOUtils.toByteArray(sevenZFile.getInputStream(entry)); > } > } > } > {code} > This is the exception > {code:java} > java.io.IOException: Checksum verification failed > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:94) > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:74) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:87) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:62) > at > org.apache.commons.compress.utils.IOUtils.toByteArray(IOUtils.java:247) > at > org.apache.commons.compress.archivers.sevenz.SevenZFileTest.retrieveInputStreamForShuffledEntries(SevenZFileTest.java:616) > {code} > This also fails on the current master with the same error -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (COMPRESS-571) 7z random access failes on shuffled entry list
[ https://issues.apache.org/jira/browse/COMPRESS-571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Peter Lee updated COMPRESS-571: --- Assignee: Peter Lee > 7z random access failes on shuffled entry list > -- > > Key: COMPRESS-571 > URL: https://issues.apache.org/jira/browse/COMPRESS-571 > Project: Commons Compress > Issue Type: Bug >Affects Versions: 1.20 >Reporter: Robin Schimpf >Assignee: Peter Lee >Priority: Major > > I noticed a problem on a 7z file and could reproduce the error if the > InputStream is retrieved after shuffling the entries. > This test fails with a checksum verification error > {code:java} > @Test > public void retrieveInputStreamForShuffledEntries() throws IOException { > try (final SevenZFile sevenZFile = new > SevenZFile(getFile("COMPRESS-256.7z"))) { > List entries = (List) > sevenZFile.getEntries(); > Collections.shuffle(entries); > for (final SevenZArchiveEntry entry : entries) { > IOUtils.toByteArray(sevenZFile.getInputStream(entry)); > } > } > } > {code} > This is the exception > {code:java} > java.io.IOException: Checksum verification failed > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:94) > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:74) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:87) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:62) > at > org.apache.commons.compress.utils.IOUtils.toByteArray(IOUtils.java:247) > at > org.apache.commons.compress.archivers.sevenz.SevenZFileTest.retrieveInputStreamForShuffledEntries(SevenZFileTest.java:616) > {code} > This also fails on the current master with the same error -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567460=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567460 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 07:02 Start Date: 17/Mar/21 07:02 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-800829428 [![Coverage Status](https://coveralls.io/builds/38004445/badge)](https://coveralls.io/builds/38004445) Coverage increased (+0.008%) to 94.938% when pulling **613d5a1b1f12102bb3e09e70d7a4b7eb96c13d66 on arturobernalg:feature/LANG-1649** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567460) Time Spent: 40m (was: 0.5h) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 40m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] coveralls edited a comment on pull request #731: LANG-1649 - Check if method is Overridable
coveralls edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-800829428 [![Coverage Status](https://coveralls.io/builds/38004445/badge)](https://coveralls.io/builds/38004445) Coverage increased (+0.008%) to 94.938% when pulling **613d5a1b1f12102bb3e09e70d7a4b7eb96c13d66 on arturobernalg:feature/LANG-1649** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [commons-lang] coveralls edited a comment on pull request #731: LANG-1649 - Check if method is Overridable
coveralls edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-800829428 [![Coverage Status](https://coveralls.io/builds/38004453/badge)](https://coveralls.io/builds/38004453) Coverage increased (+0.008%) to 94.938% when pulling **613d5a1b1f12102bb3e09e70d7a4b7eb96c13d66 on arturobernalg:feature/LANG-1649** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567459=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567459 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 07:01 Start Date: 17/Mar/21 07:01 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-800829428 [![Coverage Status](https://coveralls.io/builds/38004453/badge)](https://coveralls.io/builds/38004453) Coverage increased (+0.008%) to 94.938% when pulling **613d5a1b1f12102bb3e09e70d7a4b7eb96c13d66 on arturobernalg:feature/LANG-1649** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567459) Time Spent: 0.5h (was: 20m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 0.5h > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (COMPRESS-571) 7z random access failes on shuffled entry list
[ https://issues.apache.org/jira/browse/COMPRESS-571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17303144#comment-17303144 ] Stefan Bodewig commented on COMPRESS-571: - +1 to returning a copy. We already do in other places (for example when returning ZIP extra fields). I wonder why findbugs doesn't complain about the current code - at least it flags cases where you return the array directly. > 7z random access failes on shuffled entry list > -- > > Key: COMPRESS-571 > URL: https://issues.apache.org/jira/browse/COMPRESS-571 > Project: Commons Compress > Issue Type: Bug >Affects Versions: 1.20 >Reporter: Robin Schimpf >Priority: Major > > I noticed a problem on a 7z file and could reproduce the error if the > InputStream is retrieved after shuffling the entries. > This test fails with a checksum verification error > {code:java} > @Test > public void retrieveInputStreamForShuffledEntries() throws IOException { > try (final SevenZFile sevenZFile = new > SevenZFile(getFile("COMPRESS-256.7z"))) { > List entries = (List) > sevenZFile.getEntries(); > Collections.shuffle(entries); > for (final SevenZArchiveEntry entry : entries) { > IOUtils.toByteArray(sevenZFile.getInputStream(entry)); > } > } > } > {code} > This is the exception > {code:java} > java.io.IOException: Checksum verification failed > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:94) > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:74) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:87) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:62) > at > org.apache.commons.compress.utils.IOUtils.toByteArray(IOUtils.java:247) > at > org.apache.commons.compress.archivers.sevenz.SevenZFileTest.retrieveInputStreamForShuffledEntries(SevenZFileTest.java:616) > {code} > This also fails on the current master with the same error -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1649) Check if method is Overridable
[ https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567447=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567447 ] ASF GitHub Bot logged work on LANG-1649: Author: ASF GitHub Bot Created on: 17/Mar/21 06:23 Start Date: 17/Mar/21 06:23 Worklog Time Spent: 10m Work Description: coveralls commented on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-800829428 [![Coverage Status](https://coveralls.io/builds/38003794/badge)](https://coveralls.io/builds/38003794) Coverage increased (+0.008%) to 94.938% when pulling **2fad301d3e4c7557821b3862c01ee32900c606f1 on arturobernalg:feature/LANG-1649** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 567447) Time Spent: 20m (was: 10m) > Check if method is Overridable > -- > > Key: LANG-1649 > URL: https://issues.apache.org/jira/browse/LANG-1649 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.12.0 >Reporter: Arturo Bernal >Priority: Minor > Time Spent: 20m > Remaining Estimate: 0h > > Create a method that Check if the given Method is overridable in the given a > Class > > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] coveralls commented on pull request #731: LANG-1649 - Check if method is Overridable
coveralls commented on pull request #731: URL: https://github.com/apache/commons-lang/pull/731#issuecomment-800829428 [![Coverage Status](https://coveralls.io/builds/38003794/badge)](https://coveralls.io/builds/38003794) Coverage increased (+0.008%) to 94.938% when pulling **2fad301d3e4c7557821b3862c01ee32900c606f1 on arturobernalg:feature/LANG-1649** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (COMPRESS-571) 7z random access failes on shuffled entry list
[ https://issues.apache.org/jira/browse/COMPRESS-571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17303127#comment-17303127 ] Robin Schimpf commented on COMPRESS-571: You are correct. Shuffling the list also shuffles the underlying array. This is also documented in the {{Arrays.asList}} JavaDoc {code:java} (Changes to the returned list "write through" to the array.) {code} So returning a copy seems to be the correct fix for this. The user of the class should not be able to change the internal representation with his actions > 7z random access failes on shuffled entry list > -- > > Key: COMPRESS-571 > URL: https://issues.apache.org/jira/browse/COMPRESS-571 > Project: Commons Compress > Issue Type: Bug >Affects Versions: 1.20 >Reporter: Robin Schimpf >Priority: Major > > I noticed a problem on a 7z file and could reproduce the error if the > InputStream is retrieved after shuffling the entries. > This test fails with a checksum verification error > {code:java} > @Test > public void retrieveInputStreamForShuffledEntries() throws IOException { > try (final SevenZFile sevenZFile = new > SevenZFile(getFile("COMPRESS-256.7z"))) { > List entries = (List) > sevenZFile.getEntries(); > Collections.shuffle(entries); > for (final SevenZArchiveEntry entry : entries) { > IOUtils.toByteArray(sevenZFile.getInputStream(entry)); > } > } > } > {code} > This is the exception > {code:java} > java.io.IOException: Checksum verification failed > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:94) > at > org.apache.commons.compress.utils.ChecksumVerifyingInputStream.read(ChecksumVerifyingInputStream.java:74) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:87) > at org.apache.commons.compress.utils.IOUtils.copy(IOUtils.java:62) > at > org.apache.commons.compress.utils.IOUtils.toByteArray(IOUtils.java:247) > at > org.apache.commons.compress.archivers.sevenz.SevenZFileTest.retrieveInputStreamForShuffledEntries(SevenZFileTest.java:616) > {code} > This also fails on the current master with the same error -- This message was sent by Atlassian Jira (v8.3.4#803005)