groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <>
Subject [jira] [Created] (GROOVY-8321) !instanceof treated incorrectly in type checker
Date Sat, 16 Sep 2017 04:03:00 GMT
Paul King created GROOVY-8321:

             Summary: !instanceof treated incorrectly in type checker
                 Key: GROOVY-8321
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 2.6.0-alpha-1
            Reporter: Paul King

Currently in:

The `instanceof` and `!instanceof` operators are treated the same when in fact the exact opposite
is required.

[42, 'bar'].each { doit(it) }

doit(arg) {
  if (arg !instanceof String) {
    println arg.toUpperCase() // MME: Integer.toUpperCase()
  } else {
    // println arg.toUpperCase() // [STC] [Static type checking] - Cannot find Object#toUpperCase()
    println 'is a number'
Bonus points if the commented line in the else clause can be made to work.

This message was sent by Atlassian JIRA

View raw message