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/11/28 18:03:00 UTC

[jira] [Created] (GROOVY-10395) SC: <=> compiled to ScriptBytecodeAdapter#compareTo for primitives

Eric Milles created GROOVY-10395:
------------------------------------

             Summary: SC: <=> compiled to ScriptBytecodeAdapter#compareTo for primitives
                 Key: GROOVY-10395
                 URL: https://issues.apache.org/jira/browse/GROOVY-10395
             Project: Groovy
          Issue Type: Improvement
          Components: Static compilation
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
@groovy.transform.CompileStatic
int test(int a, int b) {
  a <=> b
}
{code}

"a <=> b" for primitive types is not optimized to make use of Integer#compare -- instead it is transformed into {{ScriptBytecodeAdapter.compareTo(a,b)}}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)