Devin Rosenbauer created GROOVY-9006:
----------------------------------------
Summary: Static type checking fails on java.sql.Timestamp when
compared to null
Key: GROOVY-9006
URL: https://issues.apache.org/jira/browse/GROOVY-9006
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Affects Versions: 2.5.6
Reporter: Devin Rosenbauer
The following class fails when compiled by Groovy 2.5.6 (via Gradle). The error
is:
{noformat}
src/main/groovy/Bug.groovy: 11: [Static type checking] - Reference to method is
ambiguous. Cannot choose between [boolean
java.sql.Timestamp#equals(java.sql.Timestamp), boolean
java.sql.Timestamp#equals(java.lang.Object)]
@ line 11, column 13.
if (timestamp != null) {
^
{noformat}
Class code for {{Bug.groovy}} -
{code:java}
import groovy.transform.TypeChecked
import java.sql.Timestamp
@TypeChecked
class Bug {
public void bug() {
java.sql.Timestamp timestamp = new Timestamp(new Date().getTime());
if (timestamp != null) {
}
}
}
{code}
Expected behavior: Groovy compiles "x != null" without reference to Java's
{{equals}}.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)