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/02/25 19:15:41 UTC

[groovy] branch GROOVY_2_5_X updated: GROOVY-7609: add test cases

This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push:
     new c091294  GROOVY-7609: add test cases
c091294 is described below

commit c0912946c30cb8fc0e43697a2358f6ef1c36f9cc
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Fri Feb 25 13:15:27 2022 -0600

    GROOVY-7609: add test cases
---
 src/test/gls/innerClass/InnerClassTest.groovy | 47 +++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/src/test/gls/innerClass/InnerClassTest.groovy b/src/test/gls/innerClass/InnerClassTest.groovy
index 7d18553..af46d2c 100644
--- a/src/test/gls/innerClass/InnerClassTest.groovy
+++ b/src/test/gls/innerClass/InnerClassTest.groovy
@@ -1730,6 +1730,53 @@ final class InnerClassTest {
         '''
     }
 
+    @Test // GROOVY-7609
+    void testReferenceToInitializedThis1() {
+        assertScript '''
+            class Upper<T> {
+                Upper(String s, int i) {
+                }
+            }
+
+            class Outer {
+                Inner inner
+                private Outer() {
+                    inner = new Inner()
+                }
+                class Inner extends Upper<Inner> {
+                    private Inner() {
+                        super('x', 0)
+                    }
+                }
+
+                static Outer make() { new Outer() }
+            }
+
+            assert Outer.make().inner != null
+        '''
+    }
+
+    @Test // GROOVY-7609
+    void testReferenceToInitializedThis2() {
+        assertScript '''
+            import java.util.concurrent.ThreadFactory
+
+            class C {
+                public C() {
+                    this(new ThreadFactory() {
+                        @Override
+                        Thread newThread(Runnable runnable) {
+                        }
+                    })
+                }
+                private C(ThreadFactory factory) {
+                }
+            }
+
+            def obj = new C()
+        '''
+    }
+
     @Test // GROOVY-6809
     void testReferenceToUninitializedThis() {
         def err = shouldFail '''