[ 
https://issues.apache.org/jira/browse/GROOVY-10775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17614087#comment-17614087
 ] 

Eric Milles commented on GROOVY-10775:
--------------------------------------


No error running script with Groovy 3.0.13 on Java 8 or 11 (oracle).  Is there 
more to it?
{code:groovy}
new NetworkPortSpec(null)
new NetworkPortSpec("12")
new NetworkPortSpec(3456)

class NetworkPortSpec {

        int port
        boolean none
        Integer defaultValue

        NetworkPortSpec(String s) {
                if(s == null)
                        none = true
                else
                        port = convert(s)
                validateOrThrow(port, s)
        }

        NetworkPortSpec(int defaultValue) {
                validateOrThrow(defaultValue, "defaultValue")
                this.defaultValue = defaultValue
        }

        int getPort() {
                if(port > 0)
                        return port
                if(defaultValue != null)
                        return defaultValue
                return 0
        }

        boolean isNone() {
                none
        }

        static boolean validate(int port) {
                return (port >= 0 || port <= 65535)
        }

        static void validateOrThrow(int port, String s) {
                if(!validate(port))
                        throw new RuntimeException("invalid port value: " + s)
        }

        static int convert(String s) {
                try {
                        return Integer.valueOf(s)
                } catch(NumberFormatException e) {
                        return -1
                }
        }
}
{code}

> VerifyError: Expecting a stackmap
> ---------------------------------
>
>                 Key: GROOVY-10775
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10775
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.13
>         Environment: JDK8, JDK11, JDK17, Windows, OpenJDK, Oracle
>            Reporter: Darryl L. Miles
>            Priority: Major
>         Attachments: NetworkPortSpec.groovy
>
>
> Don't think this is a dupe of other open bugs.
> This error does not concern invokedynamic or invokespecial like the others.
> Originally the application is targetting 1.6 with JDK8.
> Bug I can not make the problem go away with JDK11, JDK17 and targeting 17, 
> also tried a mix of Oracle and Red Hat JDKs



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to