[
https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567875&page=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:
[email protected]
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)