Hi Goktug, I have the same problem as described by Michael. In my case I get the same error
"JsType methods cannot overload another method." It would be great if the JsInterop method overloading will be included in the GWT 2.7 final release. That makes things a lot more easy. Am Dienstag, 4. November 2014 00:15:10 UTC+1 schrieb Goktug Gokdogan: > > Method overloading is supposed to be ok if there is no prototype is given, > however in your case prototype is provided hence even if we fix it, it will > not work for your case. > > There two ways to cover your use case here. One is making var-args work > (if it is not already working) so that you can do something like following > to cover both in single method: > > boolean draggable(Object... args) > > You can give it a try and see if works (but I doubt it will work right > now). > > The second way is to support overloading. We already decided to support > overloading at least based on number of arguments and this scenario is > covered under that. > > However we don't have an ETA for this and 2.7 is already at RC1 so you > need to wait for the next release. > > On Mon, Nov 3, 2014 at 1:27 PM, confile <[email protected] > <javascript:>> wrote: > >> Will the custom names method be part of the GWT 2.7 release? That would >> be great. I think with this method you can handle nearly everything with >> JsInterop. >> >> When I tried the above JsType as Interface I get the following error: >> >> GET /recompile/mobilePhoneGapIOS >> Job test.mobile.MobilePhoneGapIOS_1_6 >> starting job: test.mobile.MobilePhoneGapIOS_1_6 >> binding: mgwt.density=xhigh >> Compiling module test.mobile.MobilePhoneGapIOS >> Ignored 1 unit with compilation errors in first pass. >> Compile with -strict or with -logLevel set to TRACE or DEBUG to see all >> errors. >> Tracing compile failure path for type >> 'org.test.kinetic.client.KNode' >> [ERROR] Errors in >> 'file:/Users/mg/Documents/Grails/GGTS3.5.1Test/test/src/gwt/org/test/kinetic/client/KNode.java' >> [ERROR] Line 22: JsType methods cannot overload another >> method. >> [ERROR] Errors in >> 'file:/Users/mg/Documents/Grails/GGTS3.5.1Test/test/src/gwt/org/test/kinetic/client/events/KNodeEventCallbackJSO.java' >> [ERROR] org.test.kinetic.client.events.KNodeEvent cannot >> be resolved to a type >> [ERROR] Errors in >> 'file:/Users/mg/Documents/Grails/GGTS3.5.1Test/test/src/gwt/org/test/kinetic/client/events/KNodeEvent.java' >> [ERROR] org.test.kinetic.client.KShape cannot be resolved >> to a type >> [ERROR] Errors in >> 'file:/Users/mg/Documents/Grails/GGTS3.5.1Test/test/src/gwt/org/test/kinetic/client/KShape.java' >> [ERROR] org.test.kinetic.client.KNode cannot be resolved >> to a type >> Computing all possible rebind results for >> 'test.mobile.client.app.photoEditor.PhotoEditor.Resources' >> Rebinding >> test.mobile.client.app.photoEditor.PhotoEditor.Resources >> Checking rule <generate-with >> class='com.googlecode.gwtphonegap.server.log.rebind.PhoneGapLogThresholdGenerator'/> >> [ERROR] Hint: Check the inheritance chain from your >> module; it may not be inheriting a required module or a module may not be >> adding its source path entries properly >> [ERROR] Errors in >> 'test/mobile/client/app/photoEditor/PhotoEditor.java' >> [ERROR] Line 67: Failed to resolve >> 'test.mobile.client.app.photoEditor.PhotoEditor.Resources' via deferred >> binding >> Unification traversed 510 fields and methods and 343 types. 15 >> are considered part of the current module and 15 had all of their fields >> and methods traversed. >> [WARN] Some stale types ([org.test.kinetic.client.KNode]) were >> not reprocessed as was expected. This is either a compiler bug or a >> Generator has legitimately stopped creating these types. >> [ERROR] Compiler returned false >> [WARN] recompile failed >> [WARN] continuing to serve previous version >> >> >> >> Michael >> >> >> >> Am Montag, 3. November 2014 20:00:29 UTC+1 schrieb Goktug Gokdogan: >>> >>> There is going to be a JsMethod to provide custom names to the method so >>> that you can name the method as abc() and map it to xyx() in the js. >>> >>> But before that I didn't understand why it doesn't work out of the box. >>> You are not overloading based on return type; one of the methods has an >>> argument and the other one doesn't have any? >>> >>> On Mon, Nov 3, 2014 at 1:13 AM, confile <[email protected]> >>> wrote: >>> >>>> Consider the following JavaScript functions: >>>> >>>> >>>> // get draggable flag >>>> var draggable = node.draggable(); >>>> >>>> // enable drag and drop >>>> node.draggable(true); >>>> >>>> >>>> >>>> I do not see how I can modle them in JsInterop. The following would not >>>> work: >>>> >>>> @JsType(prototype = "$wnd.Kinetic.Node") >>>> >>>> public interface KNode { >>>> >>>> void draggable(boolean value); >>>> >>>> boolean draggable(); >>>> >>>> } >>>> >>>> The former would not work because overlaying in Java based on return >>>> type is forbidden. I also could not use @JsProperty because the getter and >>>> setter are JavaScript functions. >>>> >>>> Is there another way to deal with this in JsInterop? >>>> >>>> >>>> >>>> >>>> -- >>>> 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/862d9a24-3a07- >>>> 4181-9cc0-17b7a26401ee%40googlegroups.com >>>> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/862d9a24-3a07-4181-9cc0-17b7a26401ee%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> 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 [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/google-web-toolkit-contributors/6dfbc8e7-9997-4918-aeb3-befea70bd9d2%40googlegroups.com >> >> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/6dfbc8e7-9997-4918-aeb3-befea70bd9d2%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/fac0c5d4-b871-4c1d-8a9b-96463f11a173%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
