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 2023/02/05 14:36:57 UTC

[groovy] branch master updated: GROOVY-10594: add test case

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 dd416da5ad GROOVY-10594: add test case
dd416da5ad is described below

commit dd416da5ad6d905e0138397bcd7939af519d147d
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Sun Feb 5 08:36:41 2023 -0600

    GROOVY-10594: add test case
---
 src/test/groovy/bugs/Groovy8339Bug.groovy        | 29 ------------------------
 src/test/groovy/transform/stc/BugsSTCTest.groovy |  9 +++++++-
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/src/test/groovy/bugs/Groovy8339Bug.groovy b/src/test/groovy/bugs/Groovy8339Bug.groovy
deleted file mode 100644
index c9e239316a..0000000000
--- a/src/test/groovy/bugs/Groovy8339Bug.groovy
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package groovy.bugs
-
-import groovy.test.GroovyTestCase
-
-// TODO add JVM option `--illegal-access=deny` when all warnings fixed
-class Groovy8339Bug extends GroovyTestCase {
-    void testCase2() {
-        StringBuilder sb = new StringBuilder()
-        sb.setLength(0)
-    }
-}
diff --git a/src/test/groovy/transform/stc/BugsSTCTest.groovy b/src/test/groovy/transform/stc/BugsSTCTest.groovy
index dfc61454b0..a50dfde53a 100644
--- a/src/test/groovy/transform/stc/BugsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/BugsSTCTest.groovy
@@ -1116,13 +1116,20 @@ Printer
         '''
     }
 
-    // GROOVY-10109
+    // GROOVY-8339, GROOVY-10109, GROOVY-10594
     void testInvokePublicMethodFromInaccessibleBase() {
+        assertScript '''
+            new StringBuilder().setLength(0)
+        '''
         assertScript '''
             new StringBuilder().with {
                 assert length() == 0 // access error
             }
         '''
+        assertScript '''
+            String sub = new StringBuilder("Hello World").substring(0,5)
+            assert sub == 'Hello'
+        '''
     }
 
     void testInvokeSuperMethodFromCovariantOverride() {