Groovy web console

subscribe to the feed Subscribe
to this
site

TypeChecked-pass-String-x.groovy

Published 4 months ago by Anonymous
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
// TypeChecked-pass-String-x.groovy
// https://stackoverflow.com/questions/74573276/why-does-the-groovy-typechecked-annotation-catch-me-putting-a-string-into-an-in
@groovy.transform.TypeChecked
void m(){
    String x

    x = "abc"
    println(x)
    println(x.getClass())

    println()

    x = 123
    println(x)
    println(x.getClass())
}

m()