X

Geertjan's Blog

  • October 24, 2007

Untyped Variables in Groovy and the NetBeans Debugger

Geertjan Wielenga
Product Manager
When I blogged about stepping through Groovy recently (here), Peter Williams left this question in the comments: "Are groovy variables typed and/or can their type change dynamically (e.g. x="foo" followed by x=1 being legal, though the type is changing from string to integer?) If so, is the NetBeans debugger displaying this change properly?"

Well, today I had a look, curious to see what would happen. Here's my Groovy script, with a variable called "thing", which is first defined as "Tom" and then later as "50":

First, once we've stepped past the first definition, the debugger shows us the correct value as well as the type:

Next, it does the same for the number:

Pretty cool. Untyped variables in Groovy are correctly reflected according to type in the NetBeans debugger.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.