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/21 16:18:43 UTC
[groovy] branch GROOVY-6363 created (now 445c307)
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a change to branch GROOVY-6363
in repository https://gitbox.apache.org/repos/asf/groovy.git.
at 445c307 GROOVY-6363: allow category to override private method of self-type impl
This branch includes the following new commits:
new 445c307 GROOVY-6363: allow category to override private method of self-type impl
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[groovy] 01/01: GROOVY-6363: allow category to override private method of self-type impl
Posted by em...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch GROOVY-6363
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 445c3074f043abc0814a3a4bf37fc9295ffa56df
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