Thanks a lot, Lofi for your help. My code is similar to your CalculatorNoExport class as I dont use jsInterop. I tried your example and it's works with the same GWTversion 2.9.0. So for now, I dont have any clue what prevents this to not work in my project. Of course, it's more complex than your example, I use GWT Material Design for UI and RestyGwt for accessing Rest service ... Pierre
Le mercredi 21 avril 2021 à 22:21:57 UTC+2, [email protected] a écrit : > Yes, thanks. > > Here is the result, I documented here with examples: > https://github.com/lofidewanto/gwt-overloading > > Hope this helps, > Lofi > > [email protected] schrieb am Mittwoch, 21. April 2021 um 22:02:48 UTC+2: > >> The error reads like you need to mark one the methods as not exported to >> JS >> >> On Wed, Apr 21, 2021 at 3:45 PM [email protected] <[email protected]> >> wrote: >> >>> Hi, >>> >>> I could confirm your problem. Here is an example: >>> >>> >>> https://github.com/lofidewanto/gwt-overloading/blob/main/src/main/java/com/github/lofi/client/Calculator.java >>> >>> [INFO] --- gwt-maven-plugin:1.0.0:compile (default) @ >>> jsinterop-simple-example --- >>> [INFO] Compiling module com.github.lofi.Calculator >>> [INFO] Errors in com/github/lofi/client/Calculator.java >>> [INFO] [ERROR] Line 33: 'void Calculator.setValue(Float)' and >>> 'void Calculator.setValue(Integer)' cannot both use the same JavaScript >>> name 'setValue'. >>> [INFO] [WARN] Line 33: [unusable-by-js] Type of parameter 'value' >>> in 'void Calculator.setValue(Float)' is not usable by but exposed to >>> JavaScript. >>> [INFO] [WARN] Line 37: [unusable-by-js] Type of parameter 'value' >>> in 'void Calculator.setValue(Integer)' is not usable by but exposed to >>> JavaScript. >>> [INFO] [WARN] Suppress "[unusable-by-js]" warnings by adding a >>> `@SuppressWarnings("unusable-by-js")` annotation to the corresponding >>> member. >>> >>> [email protected] schrieb am Mittwoch, 21. April 2021 um 08:50:31 >>> UTC+2: >>> >>>> The value was an Integer but is now an Float: >>>> >>>> private Float value; >>>> >>>> The "normal" setter is now: >>>> public void setValue(Float value) { >>>> this.value = value; >>>> } >>>> Then, I added this method to accomodate the current app : >>>> public void setValue(Integer value) { >>>> this.value = value.floatValue(); >>>> } >>>> Thanks for any hint >>>> Pierre >>>> >>>> >>>> Le mardi 20 avril 2021 à 18:54:28 UTC+2, [email protected] a écrit : >>>> >>>>> Could you show me the whole class? >>>>> >>>>> this.value cannot be an Integer... >>>>> >>>>> .... >>>>> >>>>> // This won't work in Java - Type mismatch... >>>>> private Integer value; >>>>> >>>>> public void setValue(Integer value) { >>>>> this.value = value.floatValue(); >>>>> } >>>>> >>>>> [email protected] schrieb am Dienstag, 20. April 2021 um 11:34:57 >>>>> UTC+2: >>>>> >>>>>> I have a model class Item with a Integer value. I builded an app >>>>>> using this model. >>>>>> For a new particular case, the value should be a Float as well. >>>>>> So I changed the type of value to Float and regenerate setter/getter. >>>>>> In order to not change the current app, I try to create a overloading >>>>>> method : >>>>>> public void setValue(Integer value) { >>>>>> this.value = value.floatValue(); >>>>>> } >>>>>> At java level, everything seems ok, all compile errors are solved. >>>>>> But at GWT compilation, the call of this method complains with : >>>>>> [ERROR] Line 93: The method setValue(Float) in the type >>>>>> Item is not applicable for the arguments (Integer) >>>>>> like if GWT doesnot see my method setValue(Integer). >>>>>> >>>>>> Am I missing something ? Is there a way to make this works without >>>>>> creating a second separate attribute ? >>>>>> Thanks in advance >>>>>> >>>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "GWT Users" 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/eef0bc47-a2a3-4cf7-b5fb-5a65d2b77163n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/google-web-toolkit/eef0bc47-a2a3-4cf7-b5fb-5a65d2b77163n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- You received this message because you are subscribed to the Google Groups "GWT Users" 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/c0752be0-dd15-4089-9bd1-93f0ce28129bn%40googlegroups.com.
