java.lang.ClassCastException: Cannot cast java.math.BigDecimal to java.lang.Double

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Setting indy="true" causes JavaFX binds to fail on failure to convert BigDecimal to double. This works ok when indy="false" ===== "hourAngleProperty.bind((hours() * 30.0) + (minutes() * 0.5))" this actually translates to this: hourAngleProperty.bind(hours().multiply(30.0).add(minutes().multiply(0.5))); where hourAngleProperty, hours() and minutes() are type javafx.beans.property.DoubleProperty. The problem is the 30.0 and 0.5 are treated as BigDecimal and with Indy, there seems to be no unboxing of BigDecimal to "double". If i do this: hourAngleProperty.bind((hours() * (double)30.0) + (minutes() * (double)0.5)) it works. But this error is all over the GroovyFX code base. ====== java.lang.ClassCastException: Cannot cast java.math.BigDecimal to java.lang.Double at java.lang.Class.cast(Class.java:3005) at sun.invoke.util.ValueConversions.primitiveConversion(ValueConversions.java:236) at sun.invoke.util.ValueConversions.unboxDouble(ValueConversions.java:118) at java.lang.invoke.MethodHandleImpl$GuardWithCatch.invoke_L2(MethodHandleImpl.java:1130) at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:684) at Time.<init>(AnalogClockDemo.groovy:38) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) at AnalogClockDemo$_run_closure1.doCall(AnalogClockDemo.groovy:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:904) at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:809) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:792) at org.codehaus.groovy.runtime.InvokerHelper.invokeClosure(InvokerHelper.java:95) at groovyx.javafx.GroovyFX.start(GroovyFX.java:35) at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319) at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206) at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76) Exception in Application start method Exception in thread "main" java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:403) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.ClassCastException: Cannot cast java.math.BigDecimal to java.lang.Double at java.lang.Class.cast(Class.java:3005) at sun.invoke.util.ValueConversions.primitiveConversion(ValueConversions.java:236) at sun.invoke.util.ValueConversions.unboxDouble(ValueConversions.java:118) at java.lang.invoke.MethodHandleImpl$GuardWithCatch.invoke_L2(MethodHandleImpl.java:1130) at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:684) at Time.<init>(AnalogClockDemo.groovy:38) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) at AnalogClockDemo$_run_closure1.doCall(AnalogClockDemo.groovy:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:904) at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:809) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:792) at org.codehaus.groovy.runtime.InvokerHelper.invokeClosure(InvokerHelper.java:95) at groovyx.javafx.GroovyFX.start(GroovyFX.java:35) at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319) at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206) at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76) Java Result: 1
    via by Jim Clarke,
  • java mock framework with play!
    via by leifg,
    • java.lang.ClassCastException: Cannot cast java.math.BigDecimal to java.lang.Double at java.lang.Class.cast(Class.java:3005) at sun.invoke.util.ValueConversions.primitiveConversion(ValueConversions.java:236) at sun.invoke.util.ValueConversions.unboxDouble(ValueConversions.java:118) at java.lang.invoke.MethodHandleImpl$GuardWithCatch.invoke_L2(MethodHandleImpl.java:1130) at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:684) at Time.<init>(AnalogClockDemo.groovy:38) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) at AnalogClockDemo$_run_closure1.doCall(AnalogClockDemo.groovy:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:904) at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:809) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:792) at org.codehaus.groovy.runtime.InvokerHelper.invokeClosure(InvokerHelper.java:95) at groovyx.javafx.GroovyFX.start(GroovyFX.java:35) at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319) at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206) at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)

    Users with the same issue

    musketyr
    musketyr2 times, last one,
    tvrmsmith
    tvrmsmith7 times, last one,
    filpgame
    filpgame8 times, last one,
    rp
    rp1 times, last one,
    kid
    kid11 times, last one,
    22 more bugmates