You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2015/11/28 11:07:09 UTC
incubator-groovy git commit: GROOVY-7691: Create a test (closes #198)
Repository: incubator-groovy
Updated Branches:
refs/heads/master 59f63ff68 -> 167708deb
GROOVY-7691: Create a test (closes #198)
Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/167708de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/167708de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/167708de
Branch: refs/heads/master
Commit: 167708deb05baa58c71eb02c9342e0d938f5a1a8
Parents: 59f63ff
Author: Frank Pavageau <fp...@ekino.com>
Authored: Thu Nov 26 23:37:46 2015 +0100
Committer: pascalschumacher <pa...@gmx.net>
Committed: Sat Nov 28 11:06:33 2015 +0100
----------------------------------------------------------------------
.../groovy/transform/stc/GenericsSTCTest.groovy | 24 ++++++++++++++++++++
1 file changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/167708de/src/test/groovy/transform/stc/GenericsSTCTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
index ec8992e..f69e55a 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -1666,6 +1666,30 @@ assert result == 'ok'
'''
}
+ // GROOVY-7691
+ @NotYetImplemented
+ void testCovariantGenericField() {
+ assertScript '''
+ abstract class AbstractNumberWrapper<S extends Number> {
+ protected final S number;
+
+ AbstractNumberWrapper(S number) {
+ this.number = number
+ }
+ }
+ class LongWrapper<S extends Long> extends AbstractNumberWrapper<S> {
+ LongWrapper(S longNumber) {
+ super(longNumber)
+ }
+
+ S getValue() {
+ return number;
+ }
+ }
+ assert new LongWrapper<Long>(42L).value == 42L
+'''
+ }
+
static class MyList extends LinkedList<String> {}
public static class ClassA<T> {