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 b4b21a3 minor edits
b4b21a3 is described below
commit b4b21a39f914d995fbf79bddef1c50c437ecfa1c
Author: Eric Milles <[email protected]>
AuthorDate: Sat Jan 23 09:59:33 2021 -0600
minor edits
---
.../org/codehaus/groovy/control/ResolveVisitor.java | 2 +-
src/test/groovy/bugs/Groovy9790.groovy | 14 +++++++-------
src/test/groovy/transform/stc/GenericsSTCTest.groovy | 15 ++++++---------
src/test/groovy/util/GroovyCollectionsTest.groovy | 17 +++++++----------
src/test/groovy/util/logging/vm9/PlatformLogTest.groovy | 4 ++--
.../AssertionsInDifferentLocationsTest.groovy | 5 +++--
.../groovy/runtime/powerassert/EvaluationTest.groovy | 5 +++--
.../powerassert/ImplicitClosureCallRenderingTest.groovy | 5 +++--
.../powerassert/NotTransformedAssertionsTest.groovy | 5 +++--
9 files changed, 35 insertions(+), 37 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
b/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
index 859003f..c2aa72b 100644
--- a/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
+++ b/src/main/java/org/codehaus/groovy/control/ResolveVisitor.java
@@ -516,7 +516,7 @@ public class ResolveVisitor extends
ClassCodeExpressionTransformer {
// GROOVY-4043: for type "X", try "A$X" with each type in the class
hierarchy (except for Object)
for (; cn != null && cycleCheck.add(cn) &&
!cn.equals(ClassHelper.OBJECT_TYPE); cn = cn.getSuperClass()) {
if (setRedirect(type, cn)) return true;
- // GROOVY-9866: interfaces not resolved
+ // GROOVY-9866: unresolvable interfaces
}
// GROOVY-8947: non-static inner class outside of outer class
diff --git a/src/test/groovy/bugs/Groovy9790.groovy
b/src/test/groovy/bugs/Groovy9790.groovy
index b2b4044..5bd071b 100644
--- a/src/test/groovy/bugs/Groovy9790.groovy
+++ b/src/test/groovy/bugs/Groovy9790.groovy
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package bugs
+package groovy.bugs
import groovy.transform.CompileStatic
import org.junit.Test
@@ -30,12 +30,12 @@ final class Groovy9790 {
void "test GROOVY-9790 - 1"() {
assertScript '''
import java.util.stream.IntStream
-
+
@groovy.transform.CompileStatic
def x() {
IntStream.range(0, 2).forEach((Integer i) -> { assert 0 <= i
&& i < 2})
}
-
+
x()
'''
}
@@ -44,12 +44,12 @@ final class Groovy9790 {
void "test GROOVY-9790 - 2"() {
assertScript '''
import java.util.stream.IntStream
-
+
@groovy.transform.CompileStatic
def x() {
IntStream.range(0, 2).forEach((int i) -> { assert 0 <= i && i
< 2})
}
-
+
x()
'''
}
@@ -58,12 +58,12 @@ final class Groovy9790 {
void "test GROOVY-9790 - 3"() {
def err = shouldFail '''
import java.util.stream.IntStream
-
+
@groovy.transform.CompileStatic
def x() {
IntStream.range(0, 2).forEach((String i) -> { return i })
}
-
+
x()
'''
diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
index 7983f6b..4028800 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -1329,7 +1329,7 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
assert twoIntegers.getTop() == 2
def oneIntegerAgain = stack.push(1).push(2).pop()
- assert oneIntegerAgain.getTop() == 1 // BOOM!!!!
+ assert oneIntegerAgain.getTop() == 1 // Cannot find matching
method IStack#getTop()
'''
}
@@ -2201,7 +2201,8 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
'''
}
- void testGROOVY5981() {
+ // GROOVY-5981
+ void testCovariantAssignment() {
assertScript '''
import javax.swing.*
import java.awt.*
@@ -2209,16 +2210,12 @@ class GenericsSTCTest extends
StaticTypeCheckingTestCase {
class ComponentFixture<T extends Component> {}
class JButtonFixture extends ComponentFixture<JButton> {}
class ContainerFixture<T extends Container> extends
ComponentFixture<T> {}
- abstract class ComponentAdapter<Fixture extends ComponentFixture> {
- Fixture getFixture() {
- return fixture
- }
- }
+ abstract class ComponentAdapter<Fixture extends ComponentFixture>
{ Fixture getFixture() {} }
abstract class ContainerAdapter<Fixture extends ContainerFixture>
extends ComponentAdapter<Fixture> {}
class ButtonComponent extends ComponentAdapter<JButtonFixture> {
- void setFixtureResolver(final ContainerAdapter<? extends
ContainerFixture> containerAdapter) {
- final ContainerFixture containerFixture =
containerAdapter.getFixture()
+ void setFixtureResolver(ContainerAdapter<? extends
ContainerFixture> containerAdapter) {
+ ContainerFixture containerFixture =
containerAdapter.getFixture() // Cannot assign value of type ComponentFixture
to variable of type ContainerFixture
}
}
diff --git a/src/test/groovy/util/GroovyCollectionsTest.groovy
b/src/test/groovy/util/GroovyCollectionsTest.groovy
index 61c90bf..2597182 100644
--- a/src/test/groovy/util/GroovyCollectionsTest.groovy
+++ b/src/test/groovy/util/GroovyCollectionsTest.groovy
@@ -20,16 +20,13 @@ package groovy.util
import groovy.test.GroovyTestCase
-import static GroovyCollections.min
-import static GroovyCollections.max
-import static GroovyCollections.combinations
-import static GroovyCollections.transpose
-import static GroovyCollections.sum
-
-/**
-* Tests GroovyCollections
-*/
-class GroovyCollectionsTest extends GroovyTestCase {
+import static groovy.util.GroovyCollections.combinations
+import static groovy.util.GroovyCollections.max
+import static groovy.util.GroovyCollections.min
+import static groovy.util.GroovyCollections.sum
+import static groovy.util.GroovyCollections.transpose
+
+final class GroovyCollectionsTest extends GroovyTestCase {
void testCombinations() {
// use Sets because we don't care about order
diff --git a/src/test/groovy/util/logging/vm9/PlatformLogTest.groovy
b/src/test/groovy/util/logging/vm9/PlatformLogTest.groovy
index b1b4aed..5b4a3a7 100644
--- a/src/test/groovy/util/logging/vm9/PlatformLogTest.groovy
+++ b/src/test/groovy/util/logging/vm9/PlatformLogTest.groovy
@@ -26,7 +26,7 @@ import java.lang.reflect.Field
import java.lang.reflect.Modifier
/**
- * Test to make sure the @Log annotation is working correctly.
+ * Test to make sure the @Log annotation is working correctly.
*/
class PlatformLogTest extends GroovyTestCase {
void testPrivateFinalStaticLogFieldAppears() {
@@ -157,7 +157,7 @@ class PlatformLogTest extends GroovyTestCase {
}
@PlatformLog
- class MyClassLogFromStaticMethods {
+ static class MyClassLogFromStaticMethods {
static loggingMethod() {
log.info ('info called')
}
diff --git
a/src/test/org/codehaus/groovy/runtime/powerassert/AssertionsInDifferentLocationsTest.groovy
b/src/test/org/codehaus/groovy/runtime/powerassert/AssertionsInDifferentLocationsTest.groovy
index 985b633..b5aa3fa 100644
---
a/src/test/org/codehaus/groovy/runtime/powerassert/AssertionsInDifferentLocationsTest.groovy
+++
b/src/test/org/codehaus/groovy/runtime/powerassert/AssertionsInDifferentLocationsTest.groovy
@@ -20,12 +20,13 @@ package org.codehaus.groovy.runtime.powerassert
import groovy.test.GroovyTestCase
-import static AssertionTestUtil.*
+import static org.codehaus.groovy.runtime.powerassert.AssertionTestUtil.*
/**
* Defines assertions in different locations and checks if they are
transformed.
*/
-class AssertionsInDifferentLocationsTest extends GroovyTestCase {
+final class AssertionsInDifferentLocationsTest extends GroovyTestCase {
+
void testInConstructor() {
fails {
new AssertionInConstructor()
diff --git
a/src/test/org/codehaus/groovy/runtime/powerassert/EvaluationTest.groovy
b/src/test/org/codehaus/groovy/runtime/powerassert/EvaluationTest.groovy
index 6b77414..38bee33 100644
--- a/src/test/org/codehaus/groovy/runtime/powerassert/EvaluationTest.groovy
+++ b/src/test/org/codehaus/groovy/runtime/powerassert/EvaluationTest.groovy
@@ -22,7 +22,7 @@ import groovy.test.GroovyTestCase
import static java.lang.Math.max
import static java.lang.Math.min
-import static AssertionTestUtil.*
+import static org.codehaus.groovy.runtime.powerassert.AssertionTestUtil.*
/**
* Checks that:
@@ -32,7 +32,8 @@ import static AssertionTestUtil.*
* <li>assertion execution has the expected result (checked explicitly)</li>
* </ul>
*/
-class EvaluationTest extends GroovyTestCase {
+final class EvaluationTest extends GroovyTestCase {
+
void testPassingAndFailingAsserts() {
assert true
fails { assert false }
diff --git
a/src/test/org/codehaus/groovy/runtime/powerassert/ImplicitClosureCallRenderingTest.groovy
b/src/test/org/codehaus/groovy/runtime/powerassert/ImplicitClosureCallRenderingTest.groovy
index d0d4a5e..a380132 100644
---
a/src/test/org/codehaus/groovy/runtime/powerassert/ImplicitClosureCallRenderingTest.groovy
+++
b/src/test/org/codehaus/groovy/runtime/powerassert/ImplicitClosureCallRenderingTest.groovy
@@ -20,14 +20,15 @@ package org.codehaus.groovy.runtime.powerassert
import groovy.test.GroovyTestCase
-import static AssertionTestUtil.*
+import static org.codehaus.groovy.runtime.powerassert.AssertionTestUtil.*
/**
* Tests rendering of assertions that contain a closure call
* with the implicit "foo(args)" syntax instead of the explicit
* "foo.call(args)" syntax. See GROOVY-4344.
*/
-class ImplicitClosureCallRenderingTest extends GroovyTestCase {
+final class ImplicitClosureCallRenderingTest extends GroovyTestCase {
+
void testWithLocalVariable() {
isRendered """
assert func(42) == null
diff --git
a/src/test/org/codehaus/groovy/runtime/powerassert/NotTransformedAssertionsTest.groovy
b/src/test/org/codehaus/groovy/runtime/powerassert/NotTransformedAssertionsTest.groovy
index 061b6bf..b6a669b 100644
---
a/src/test/org/codehaus/groovy/runtime/powerassert/NotTransformedAssertionsTest.groovy
+++
b/src/test/org/codehaus/groovy/runtime/powerassert/NotTransformedAssertionsTest.groovy
@@ -20,12 +20,13 @@ package org.codehaus.groovy.runtime.powerassert
import groovy.test.GroovyTestCase
-import static AssertionTestUtil.*
+import static org.codehaus.groovy.runtime.powerassert.AssertionTestUtil.*
/**
* Tests that certain kinds of assertions are not transformed.
*/
-class NotTransformedAssertionsTest extends GroovyTestCase {
+final class NotTransformedAssertionsTest extends GroovyTestCase {
+
void testAssertsWithMessage() {
// no way to check whether this assertion has been transformed or not,
// but at least make sure it doesn't fail