Andrey Hihlovskiy

Professional blog on groovy, gradle, Java, Javascript and other stuff.

Tag Archives: bug

groovy switch: nasty bug

I found nasty error in Groovy compiler. Consider the following code:

byte b = 1
switch(b) {
  case 0..9:
    println 'it is between 0 and 9'
    break
  default:
    println 'it is something else'
}

It executes ‘default’ part, not the part with 0..9, which is not what a programmer would typically expect.
The reason behind it should be related to type conversion between “byte” and “int” types. With the following workaround:

switch((int)b)

the program executes “proper” case.

Advertisements

Ugly bug in Linux Mint/MATE

Whenever you switch between Firefox and Eclipse (Juno/Kepler) and window-compositing is enabled, Caja crashes. That means: menu and taskbar disappear, all Caja windows are closed. The bug is still not fixed in Linux Mint 15 Olivia. I have to switch to Cinnamon 😦

Change in JDK 1.7.0_25 breaks all grails applications

Change in JDK 1.7.0_25 breaks all grails applications:
https://bugzilla.redhat.com/show_bug.cgi?id=976693
I just tried grails 2.2.3 – the problem is still not fixed, the application fails to start with an error message “Could not determine Hibernate dialect for database name [H2]”
Any workarounds suggesting to replace hibernate libraries don’t work.
The following additional parameter allows to start grails:

grails -noreloading run-app

But hey, it’s no fun to start in no-reloading mode! Oracle, but things back!