You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/04/29 20:49:00 UTC
[jira] [Assigned] (GROOVY-9006) Static type checking fails on
java.sql.Timestamp when compared to null
[ https://issues.apache.org/jira/browse/GROOVY-9006?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-9006:
-----------------------------------
Assignee: Eric Milles
> 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
> Assignee: Eric Milles
> Priority: Major
>
> 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)