Details
Description
class JavaLangClassUsageTest extends GroovyTestCase { void testCallFooGetNameMethod() { assert Foo.getName() == "Foo.getName" // passes } void testCallJavaLangClassGetNameMethod() { def clazz = new Foo().getClass() assert clazz.getName() == "Foo" // fails, actual: Foo.getName } } class Foo { static getName() { "Foo.getName" } }
Issue Links
- is related to
-
GROOVY-3549
Usage of ".class" to disambiguate between methods
-
Paul I found some code in StaticImportVisitor that may cause this issue here. It is changing a MethodCallExpression with a ClassExpression as receiver into a StaticMethodCallExpression and in the act it changes the receiver to the current class, which may not be what the ClassExpression is refering to.