[
https://issues.apache.org/jira/browse/GROOVY-9006?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17433389#comment-17433389
]
Eric Milles commented on GROOVY-9006:
-------------------------------------
https://github.com/apache/groovy/commit/c48525afc0aa1632d89c3e4f6c8d932ecfb710e4
> 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.15, 3.0.9
> Reporter: Devin Rosenbauer
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-beta-2
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> 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
(v8.3.4#803005)