[ 
https://issues.apache.org/jira/browse/LANG-1649?focusedWorklogId=567863&page=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);
     }
 
+    /**
+     * <p>Check if the given {@code Method} is overridable in the given target 
{@code Class}.</p>

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);
     }
 
+    /**
+     * <p>Check if the given {@code Method} is overridable in the given target 
{@code Class}.</p>
+     *
+     * <p>This method returns {@code false} for any {@code null} input or 
method with the static or final modifiers.</p>
+     * <pre>
+     * <code>
+     *   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)

Reply via email to