You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2022/01/25 15:14:20 UTC
[groovy] branch master updated: GROOVY-6363: allow category to override private method of self-type impl
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new c63c466 GROOVY-6363: allow category to override private method of self-type impl
c63c466 is described below
commit c63c466c24b2196357067633f195601a770fc83a
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Fri Jan 21 10:18:31 2022 -0600
GROOVY-6363: allow category to override private method of self-type impl
category with same or more specific self-type can already replace method
---
src/main/java/groovy/lang/MetaClassImpl.java | 2 +-
src/test/groovy/lang/CategoryAnnotationTest.groovy | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/main/java/groovy/lang/MetaClassImpl.java b/src/main/java/groovy/lang/MetaClassImpl.java
index 7600e7a..9cb38db 100644
--- a/src/main/java/groovy/lang/MetaClassImpl.java
+++ b/src/main/java/groovy/lang/MetaClassImpl.java
@@ -3266,7 +3266,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
// replace if self type is the same or the category self type is more specific
if (selfType1 == selfType2 || selfType1.isAssignableFrom(selfType2)) return Boolean.TRUE;
// GROOVY-6363: replace if the private method self type is more specific
- // if (aMethod.isPrivate() && selfType2.isAssignableFrom(selfType1)) return Boolean.TRUE;
+ if (aMethod.isPrivate() && selfType2.isAssignableFrom(selfType1)) return Boolean.TRUE;
return null;
}
diff --git a/src/test/groovy/lang/CategoryAnnotationTest.groovy b/src/test/groovy/lang/CategoryAnnotationTest.groovy
index 0a0fde2..382b660 100644
--- a/src/test/groovy/lang/CategoryAnnotationTest.groovy
+++ b/src/test/groovy/lang/CategoryAnnotationTest.groovy
@@ -18,7 +18,6 @@
*/
package groovy.lang
-import groovy.test.NotYetImplemented
import org.junit.Test
import static groovy.test.GroovyAssert.assertScript
@@ -283,7 +282,7 @@ final class CategoryAnnotationTest {
'''
}
- @NotYetImplemented @Test // GROOVY-6363
+ @Test // GROOVY-6363
void testCategoryMethodOverridesPrivateMethod() {
assertScript '''
import groovy.transform.CompileStatic