Skip to content

Instantly share code, notes, and snippets.

@mperry
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mperry/10692600 to your computer and use it in GitHub Desktop.
Save mperry/10692600 to your computer and use it in GitHub Desktop.
Example of found defect in Groovy 2.3.0-beta-2
/**
* This scripts runs successfully with Groovy 2.2.2, but not with Groovy 2.3.0-beta-2
*/
@Grab('junit:junit:4.11')
import groovy.transform.TypeChecked
import org.junit.Test
import static org.junit.Assert.assertTrue
/**
* Created by MarkPerry on 15/04/2014.
*/
@TypeChecked
class TestEquals {
static <A> Set<List<A>> create(List<A> list) {
[list].toSet()
}
@Test
void test1() {
assertTrue(true)
def expected = [[1, 2]].toSet()
def s = create([1, 2])
assertTrue(expected == [[1, 2]].toSet())
assertTrue(expected == expected)
assertTrue(expected == create([1, 2]))
assertTrue(expected == s)
// type check fails next 2 lines
assertTrue(s == expected)
assertTrue(create([1, 2]) == expected)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment