The key aspect for that example is in the preceding paragraph "When code is annotated with @TypeChecked".
If you had those three lines in a script called Upper.groovy, you could try: > groovy --compile-static Upper.groovy Or in the groovyConsole, you could try something like this: @groovy.transform.TypeChecked // or CompileStatic static main(args) { def message = 'Welcome to Groovy!' println message.toUpperCase() println message.upper() } You should see the compile time error. The runtime error is the expected behavior without type checking in play. Cheers, Paul. On Thu, Jun 16, 2022 at 5:28 AM Henry <2000n...@gmx.net> wrote: > > Hi > > In the example of the documentation > https://groovy-lang.org/semantics.html#type-inference the callout number > 3 states 'calling |upper| will fail at compile time'. But when I run > those three lines of code in GroovyConsole I get > groovy.lang.MissingMethodException which is a runtime exception. > > So shouldn't it say '... will fail at runtime'? > > Thanks. > > Henry > > >