@JsType(isNative = true, name = "ordinal")
public static class Ordinal {
/** @todo TODO: this crashes. Why? */
public native <I, O> O range(I[] values); // this doesn't work
//public native <I> Ordinal range(I[] values); // this works
}
D3.Scale.Ordinal color = D3.Scale.ordinal().range(new String[] {"#98abc5", "#8a89a6"});
Error: java.lang.ClassCastException
at java_lang_ClassCastException_ClassCastException__V.java_lang_Throwable_createError__Ljava_lang_String_2Ljava_lang_Object_2 [as package_private$java_lang$createError__Ljava_lang_String_2Ljava_lang_Object_2] (dashboard-0.js:7245)
at java_lang_ClassCastException_ClassCastException__V.java_lang_Throwable_initializeBackingError__V [as private$java_lang_Throwable$initializeBackingError__V] (dashboard-0.js:7300)
at java_lang_ClassCastException_ClassCastException__V.java_lang_Throwable_Throwable__V (dashboard-0.js:7133)
at java_lang_ClassCastException_ClassCastException__V.java_lang_Exception_Exception__V (dashboard-0.js:7381)
at java_lang_ClassCastException_ClassCastException__V.java_lang_RuntimeException_RuntimeException__V (dashboard-0.js:29724)
at java_lang_ClassCastException_ClassCastException__V (dashboard-0.js:57274)
at javaemul_internal_InternalPreconditions_checkCriticalType__ZV (dashboard-0.js:72135)
at javaemul_internal_InternalPreconditions_checkType__ZV (dashboard-0.js:72342)
at com_google_gwt_lang_Cast_castToNative__Ljava_lang_Object_2Lcom_google_gwt_core_client_JavaScriptObject_2Ljava_lang_Object_2 (dashboard-0.js:707)
function com_google_gwt_lang_Cast_castToNative__Ljava_lang_Object_2Lcom_google_gwt_core_client_JavaScriptObject_2Ljava_lang_Object_2(src_0, jsType){
com_google_gwt_lang_Cast_$clinit__V();
javaemul_internal_InternalPreconditions_checkType__ZV(com_google_gwt_lang_Cast_jsEquals__Ljava_lang_Object_2Ljava_lang_Object_2Z(src_0, null) || com_google_gwt_lang_Cast_jsinstanceOf__Ljava_lang_Object_2Lcom_google_gwt_core_client_JavaScriptObject_2Z(src_0, jsType));
return src_0;
}
function com_google_gwt_lang_Cast_jsinstanceOf__Ljava_lang_Object_2Lcom_google_gwt_core_client_JavaScriptObject_2Z(obj, jsType){
com_google_gwt_lang_Cast_$clinit__V();
return obj && (jsType && obj instanceof jsType);
}
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAKbOjEx1v%3D-%3DVHd0Z5pcgTbKTPzFktR7nxoCx2Sr9yutZHtxiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAC7T7gkBCv_yUPL6-f0jcZvMGhpyNWZcNidWdmJ9MO4jcuUL8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Ηι,thanks for answeringd3.ordinal does not exist as you said. However d3.scale.ordinal exists and that part works great.
in d3 ordinal is both a function ordinal() which returns an ordinal instance and an object with more methods such as range() which is the crux of my issue.The problem there is that
- public native <I, O> O range(I[] values); // this doesn't work
- // public native <I> Ordinal range(I[] values); // this works
I would like to use the first definition because it allows reusing some code between different scales. Otherwise I have to copy-paste the range() method multiple times instead of put it in a base class.
The problem is on the exceptions generated by the attempting casting.As you said this may not be a bug but not for the reason you mentioned.So the question remains: Should I report it as an issue?
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/6206fb29-d3c1-48de-ab04-0610cbb3c2bd%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/6206fb29-d3c1-48de-ab04-0610cbb3c2bd%40googlegroups.com.
--Vassilis Virvilis