|
Groovy example source code file (Groovy4457GenericTypeDeclarationLeakTest.groovy)
The Groovy Groovy4457GenericTypeDeclarationLeakTest.groovy source codepackage groovy.bugs /** * @author Guillaume Laforge */ class Groovy4457GenericTypeDeclarationLeakTest extends GroovyTestCase { void testLeak() { assertScript """ class A<String> {} class B { void foo(String s) {} } // use the name to check the class, since the error was that String was seen as // a symbol resolved to Object, not as the class String, thus a ... == String would // not have failed assert B.declaredMethods.find { it.name == "foo" }.parameterTypes[0].name.contains("String") """ } void testLeakWithInnerClass() { assertScript """ class A<String> { static class B { void foo(String s) {} } } assert A.B.declaredMethods.find { it.name == "foo" }.parameterTypes[0].name.contains("String") """ } } Other Groovy examples (source code examples)Here is a short list of links related to this Groovy Groovy4457GenericTypeDeclarationLeakTest.groovy source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.