[
https://issues.apache.org/jira/browse/GROOVY-12538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18132842#comment-18132842
]
ASF GitHub Bot commented on GROOVY-12538:
-----------------------------------------
testlens-app[bot] commented on PR #3053:
URL: https://github.com/apache/groovy/pull/3053#issuecomment-6440915790
## 🚨 TestLens detected 1 failed test 🚨
### Test Summary
> [!TIP]
> Inspect all details with the [TestLens
CLI](https://testlens.app/docs/features/cli): `testlens pr 3053`
#### [Build and test / lts \(17,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/40494810032/job/122157449528?pr=3053)
> :groovy-lsp:test
| Test | Runs | Flakiness |
|---|---|--:|
| GroovyLanguageServerTest >
publishDiagnosticsIncludeVersionAndClearRemovedUris\(\) | ❌ | 1% 🟡 |
🏷️ Commit: 738c4ede0687a70b5d54b7c0e5e8a6e51e78eff5
▶️ Tests: 39474 executed
🟡 Checks: 6/30 completed
### Test Failures
<details><summary><strong>GroovyLanguageServerTest >
publishDiagnosticsIncludeVersionAndClearRemovedUris()</strong>
(:groovy-lsp:test in <a
href="https://github.com/apache/groovy/actions/runs/40494810032/job/122157449528?pr=3053">Build
and test / lts (17, ubuntu-latest)</a>)</summary>
```
java.util.ConcurrentModificationException
at
java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013)
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:967)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getPropertySpreadSafe(ScriptBytecodeAdapter.java:503)
at
org.apache.groovy.lsp.GroovyLanguageServerTest.publishDiagnosticsIncludeVersionAndClearRemovedUris(GroovyLanguageServerTest.groovy:236)
```
</details>
### Rerun Controls
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
🔲 GroovyLanguageServerTest >
publishDiagnosticsIncludeVersionAndClearRemovedUris\(\) <!
> Primitive double/float > and >= comparisons return true when an operand is NaN
> ------------------------------------------------------------------------------
>
> Key: GROOVY-12538
> URL: https://issues.apache.org/jira/browse/GROOVY-12538
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Priority: Major
>
> Description:
> When both operands of a comparison are primitive double (or float) values,
> Groovy
> compiles the comparison to a DCMPG (FCMPG) instruction for all four ordered
> operators.
> DCMPG pushes 1 when either operand is NaN, so > and >= evaluate to true;
> javac uses
> DCMPL (FCMPL) for > and >= and DCMPG (FCMPG) for < and <=, so that every
> comparison
> with a NaN operand is false (JLS 15.20.1).
> {code:groovy}
> double n = Double.NaN
> assert !(n > 0.0d) // fails: true
> assert !(n >= 0.0d) // fails: true
> assert !(n < 0.0d) // passes
> assert !(n <= 0.0d) // passes
> float f = Float.NaN
> assert !(f > 0.0f) // fails: true
> {code}
> It affects local variables, fields, static fields and parameters declared
> double or
> float, in dynamic code as well as under @TypeChecked and @CompileStatic. Under
> @CompileStatic it also affects Double.NaN itself, which is a primitive there:
> Double.NaN > 0.0d is false in dynamic code (the field value is boxed) and
> true under
> @CompileStatic.
> Groovy is also inconsistent with itself: for two Double objects, n > 0.0d
> already
> gives false, because the runtime unboxes and uses Java's operator.
> Cause: BinaryDoubleExpressionHelper.getCompareCode() returns DCMPG and
> BinaryFloatExpressionHelper.getCompareCode() returns FCMPG for every operator
> (since the primitive-optimisation backends were added in 2011).
> This is narrower than GROOVY-3309, which asks for NaN comparisons through
> Groovy's
> number comparison (mixed types, ==) to follow IEEE 754 as well. Those paths
> follow
> Double.compareTo/Double.equals by design and are not changed here; <=> already
> matches Double.compare for primitives.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)