You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Emond Papegaaij <em...@topicus.nl> on 2016/11/15 13:51:12 UTC

Re: buildbot failure in on wicket-master

It seems I've hit a bug in javac:
LambdaModelTest[46,61] reference to of is ambiguous:
<T>   of(SerializableSupplier<T>, SerializableConsumer<T>)
<X,T> of(IModel<X>,               SerializableFunction<X,T>)

This clearly is wrong:
IModel<String> personNameModel = LambdaModel.of(
    () -> person.getName(),
    (name) -> person.setName(name));

The first parameter could match both SerializableSupplier<T> and IModel<X>, 
but the second parameter only matches SerializableConsumer<T>. Eclipse has no 
problem with this and compiles the code just fine.

This now surfaces due to the change in the constructor. This testcase used to 
call new LambdaModel(...), which had the same signature as the first 'of'. I 
had to change it to use the overloaded factory method.

I see two possible solutions:
 - Change the name of the factory methodes, so they are no longer overloaded 
(suggestions for the names are welcome)
 - Add a cast to the calling code to circumvent the bug.

IMHO both are ugly.

Best regards,
Emond

On dinsdag 15 november 2016 13:36:56 CET buildbot@apache.org wrote:
> The Buildbot has detected a new failure on builder wicket-master while
> building wicket. Full details are available at:
> https://ci.apache.org/builders/wicket-master/builds/550
> 
> Buildbot URL: https://ci.apache.org/
> 
> Buildslave for this Build: bb_slave1_ubuntu
> 
> Build Reason: The SingleBranchScheduler scheduler named
> 'on-wicket-master-commit' triggered this build Build Source Stamp: [branch
> master] b40e9e1cd9ad7a9ffc63ab6c329c8d9c8b78b924 Blamelist: Emond Papegaaij
> <pa...@apache.org>
> 
> BUILD FAILED: failed compile
> 
> Sincerely,
>  -The Buildbot



Re: buildbot failure in on wicket-master

Posted by Sven Meier <sv...@meiers.net>.
-0 for #chained(), this isn't even a verb (I know, 'of' isn't a verb either)

Regards
Sven


On 17.11.2016 12:22, Martin Grigorov wrote:
> On Thu, Nov 17, 2016 at 12:13 PM, Martijn Dashorst <
> martijn.dashorst@gmail.com> wrote:
>
>> We could also opt to rename map(...) to to(...)
>>
>> Model.of(account).to(Account::getPerson).to(Person::
>> getLastName).to(String::toUppercase)
>>
> #map() is more widely used in JVM langs
>
>
>> Martijn
>>
>>
>> On Thu, Nov 17, 2016 at 11:09 AM, Emond Papegaaij
>> <em...@topicus.nl> wrote:
>>> I also think 'chained' better covers the intent. 'map' normally isn't
>>> a read/write transformation.
>>>
>>> Emond
>>>
>>> On Thu, Nov 17, 2016 at 12:38 AM, Martin Grigorov <mg...@apache.org>
>> wrote:
>>>> +1 for #chained() .
>>>>
>>>> Martin Grigorov
>>>> Wicket Training and Consulting
>>>> https://twitter.com/mtgrigorov
>>>>
>>>> On Tue, Nov 15, 2016 at 10:07 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>>> We could rename the methods taking an IModel as first parameter to
>>>>>> "chained" or "from".
>>>>> or "map":
>>>>>
>>>>>      LambdaModel.map(IModel, SerializableFunction,
>> SerializableBiConsumer)
>>>>>      LambdaModel.map(IModel, SerializableFunction)
>>>>>
>>>>> Sven
>>>>>
>>>>>
>>>>>
>>>>> Am 15.11.2016 um 20:52 schrieb Emond Papegaaij:
>>>>>
>>>>>> IModel.map(Function) indeed is functionally equivalent to
>>>>>> LambdaModel.of(IModel, Function), but its memory footprint is
>>>>>> significantly larger (120 vs 80 bytes). Also, there's no equivalent
>>>>>> method for of(IModel, Function, BiConsumer). Naturally, we can add the
>>>>>> corresponding method, but it will remain much less efficient. These
>>>>>> chained models require an additional object.
>>>>>>
>>>>>> We've ran into similar problems many times at Topicus. Javac still is
>>>>>> very buggy when it comes to lambda type inference. IMHO the best
>>>>>> solution is to simply rename the methods to prevent the collisions.
>>>>>>
>>>>>> We could rename the methods taking an IModel as first parameter to
>>>>>> "chained" or "from". Another solution would be a builder API, but I
>>>>>> doubt that would make the code more readable.
>>>>>>
>>>>>> Best regards,
>>>>>> Emond
>>>>>>
>>>>>> On Tue, Nov 15, 2016 at 8:06 PM, Martin Grigorov <
>> mgrigorov@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>>> On Tue, Nov 15, 2016 at 2:51 PM, Emond Papegaaij <
>>>>>>> emond.papegaaij@topicus.nl
>>>>>>>
>>>>>>>> wrote:
>>>>>>>> It seems I've hit a bug in javac:
>>>>>>>> LambdaModelTest[46,61] reference to of is ambiguous:
>>>>>>>> <T>   of(SerializableSupplier<T>, SerializableConsumer<T>)
>>>>>>>> <X,T> of(IModel<X>,               SerializableFunction<X,T>)
>>>>>>>>
>>>>>>>> This clearly is wrong:
>>>>>>>> IModel<String> personNameModel = LambdaModel.of(
>>>>>>>>       () -> person.getName(),
>>>>>>>>       (name) -> person.setName(name));
>>>>>>>>
>>>>>>>> The first parameter could match both SerializableSupplier<T> and
>>>>>>>> IModel<X>,
>>>>>>>> but the second parameter only matches SerializableConsumer<T>.
>> Eclipse
>>>>>>>> has
>>>>>>>> no
>>>>>>>> problem with this and compiles the code just fine.
>>>>>>>>
>>>>>>>> I guess it confuses it with SerializableFunction<String, Void>.
>>>>>>> Although, I
>>>>>>> agree it should return null to actually match.
>>>>>>>
>>>>>>> IMO we don't
>>>>>>> need org.apache.wicket.model.LambdaModel#of(org.apache.wicket.
>>>>>>> model.IModel<X>,
>>>>>>> org.danekja.java.util.function.serializable.
>> SerializableFunction<X,T>)
>>>>>>> It gives the same
>>>>>>> as org.apache.wicket.model.IModel#map(SerializableFunction<? super
>> T, R>
>>>>>>> mapper).
>>>>>>>
>>>>>>>
>>>>>>> This now surfaces due to the change in the constructor. This testcase
>>>>>>>> used
>>>>>>>> to
>>>>>>>> call new LambdaModel(...), which had the same signature as the first
>>>>>>>> 'of'.
>>>>>>>> I
>>>>>>>> had to change it to use the overloaded factory method.
>>>>>>>>
>>>>>>>> I see two possible solutions:
>>>>>>>>    - Change the name of the factory methodes, so they are no longer
>>>>>>>> overloaded
>>>>>>>> (suggestions for the names are welcome)
>>>>>>>>    - Add a cast to the calling code to circumvent the bug.
>>>>>>>>
>>>>>>>> IMHO both are ugly.
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Emond
>>>>>>>>
>>>>>>>> On dinsdag 15 november 2016 13:36:56 CET buildbot@apache.org wrote:
>>>>>>>>
>>>>>>>>> The Buildbot has detected a new failure on builder wicket-master
>> while
>>>>>>>>> building wicket. Full details are available at:
>>>>>>>>> https://ci.apache.org/builders/wicket-master/builds/550
>>>>>>>>>
>>>>>>>>> Buildbot URL: https://ci.apache.org/
>>>>>>>>>
>>>>>>>>> Buildslave for this Build: bb_slave1_ubuntu
>>>>>>>>>
>>>>>>>>> Build Reason: The SingleBranchScheduler scheduler named
>>>>>>>>> 'on-wicket-master-commit' triggered this build Build Source Stamp:
>>>>>>>>>
>>>>>>>> [branch
>>>>>>>>
>>>>>>>>> master] b40e9e1cd9ad7a9ffc63ab6c329c8d9c8b78b924 Blamelist: Emond
>>>>>>>>>
>>>>>>>> Papegaaij
>>>>>>>>
>>>>>>>>> <pa...@apache.org>
>>>>>>>>>
>>>>>>>>> BUILD FAILED: failed compile
>>>>>>>>>
>>>>>>>>> Sincerely,
>>>>>>>>>    -The Buildbot
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>


Re: buildbot failure in on wicket-master

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Nov 17, 2016 at 12:13 PM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> We could also opt to rename map(...) to to(...)
>
> Model.of(account).to(Account::getPerson).to(Person::
> getLastName).to(String::toUppercase)
>

#map() is more widely used in JVM langs


>
> Martijn
>
>
> On Thu, Nov 17, 2016 at 11:09 AM, Emond Papegaaij
> <em...@topicus.nl> wrote:
> > I also think 'chained' better covers the intent. 'map' normally isn't
> > a read/write transformation.
> >
> > Emond
> >
> > On Thu, Nov 17, 2016 at 12:38 AM, Martin Grigorov <mg...@apache.org>
> wrote:
> >> +1 for #chained() .
> >>
> >> Martin Grigorov
> >> Wicket Training and Consulting
> >> https://twitter.com/mtgrigorov
> >>
> >> On Tue, Nov 15, 2016 at 10:07 PM, Sven Meier <sv...@meiers.net> wrote:
> >>
> >>> Hi,
> >>>
> >>> >We could rename the methods taking an IModel as first parameter to
> >>> >"chained" or "from".
> >>>
> >>> or "map":
> >>>
> >>>     LambdaModel.map(IModel, SerializableFunction,
> SerializableBiConsumer)
> >>>
> >>>     LambdaModel.map(IModel, SerializableFunction)
> >>>
> >>> Sven
> >>>
> >>>
> >>>
> >>> Am 15.11.2016 um 20:52 schrieb Emond Papegaaij:
> >>>
> >>>> IModel.map(Function) indeed is functionally equivalent to
> >>>> LambdaModel.of(IModel, Function), but its memory footprint is
> >>>> significantly larger (120 vs 80 bytes). Also, there's no equivalent
> >>>> method for of(IModel, Function, BiConsumer). Naturally, we can add the
> >>>> corresponding method, but it will remain much less efficient. These
> >>>> chained models require an additional object.
> >>>>
> >>>> We've ran into similar problems many times at Topicus. Javac still is
> >>>> very buggy when it comes to lambda type inference. IMHO the best
> >>>> solution is to simply rename the methods to prevent the collisions.
> >>>>
> >>>> We could rename the methods taking an IModel as first parameter to
> >>>> "chained" or "from". Another solution would be a builder API, but I
> >>>> doubt that would make the code more readable.
> >>>>
> >>>> Best regards,
> >>>> Emond
> >>>>
> >>>> On Tue, Nov 15, 2016 at 8:06 PM, Martin Grigorov <
> mgrigorov@apache.org>
> >>>> wrote:
> >>>>
> >>>>> On Tue, Nov 15, 2016 at 2:51 PM, Emond Papegaaij <
> >>>>> emond.papegaaij@topicus.nl
> >>>>>
> >>>>>> wrote:
> >>>>>> It seems I've hit a bug in javac:
> >>>>>> LambdaModelTest[46,61] reference to of is ambiguous:
> >>>>>> <T>   of(SerializableSupplier<T>, SerializableConsumer<T>)
> >>>>>> <X,T> of(IModel<X>,               SerializableFunction<X,T>)
> >>>>>>
> >>>>>> This clearly is wrong:
> >>>>>> IModel<String> personNameModel = LambdaModel.of(
> >>>>>>      () -> person.getName(),
> >>>>>>      (name) -> person.setName(name));
> >>>>>>
> >>>>>> The first parameter could match both SerializableSupplier<T> and
> >>>>>> IModel<X>,
> >>>>>> but the second parameter only matches SerializableConsumer<T>.
> Eclipse
> >>>>>> has
> >>>>>> no
> >>>>>> problem with this and compiles the code just fine.
> >>>>>>
> >>>>>> I guess it confuses it with SerializableFunction<String, Void>.
> >>>>> Although, I
> >>>>> agree it should return null to actually match.
> >>>>>
> >>>>> IMO we don't
> >>>>> need org.apache.wicket.model.LambdaModel#of(org.apache.wicket.
> >>>>> model.IModel<X>,
> >>>>> org.danekja.java.util.function.serializable.
> SerializableFunction<X,T>)
> >>>>> It gives the same
> >>>>> as org.apache.wicket.model.IModel#map(SerializableFunction<? super
> T, R>
> >>>>> mapper).
> >>>>>
> >>>>>
> >>>>> This now surfaces due to the change in the constructor. This testcase
> >>>>>> used
> >>>>>> to
> >>>>>> call new LambdaModel(...), which had the same signature as the first
> >>>>>> 'of'.
> >>>>>> I
> >>>>>> had to change it to use the overloaded factory method.
> >>>>>>
> >>>>>> I see two possible solutions:
> >>>>>>   - Change the name of the factory methodes, so they are no longer
> >>>>>> overloaded
> >>>>>> (suggestions for the names are welcome)
> >>>>>>   - Add a cast to the calling code to circumvent the bug.
> >>>>>>
> >>>>>> IMHO both are ugly.
> >>>>>>
> >>>>>> Best regards,
> >>>>>> Emond
> >>>>>>
> >>>>>> On dinsdag 15 november 2016 13:36:56 CET buildbot@apache.org wrote:
> >>>>>>
> >>>>>>> The Buildbot has detected a new failure on builder wicket-master
> while
> >>>>>>> building wicket. Full details are available at:
> >>>>>>> https://ci.apache.org/builders/wicket-master/builds/550
> >>>>>>>
> >>>>>>> Buildbot URL: https://ci.apache.org/
> >>>>>>>
> >>>>>>> Buildslave for this Build: bb_slave1_ubuntu
> >>>>>>>
> >>>>>>> Build Reason: The SingleBranchScheduler scheduler named
> >>>>>>> 'on-wicket-master-commit' triggered this build Build Source Stamp:
> >>>>>>>
> >>>>>> [branch
> >>>>>>
> >>>>>>> master] b40e9e1cd9ad7a9ffc63ab6c329c8d9c8b78b924 Blamelist: Emond
> >>>>>>>
> >>>>>> Papegaaij
> >>>>>>
> >>>>>>> <pa...@apache.org>
> >>>>>>>
> >>>>>>> BUILD FAILED: failed compile
> >>>>>>>
> >>>>>>> Sincerely,
> >>>>>>>   -The Buildbot
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>

Re: buildbot failure in on wicket-master

Posted by Martijn Dashorst <ma...@gmail.com>.
We could also opt to rename map(...) to to(...)

Model.of(account).to(Account::getPerson).to(Person::getLastName).to(String::toUppercase)

Martijn


On Thu, Nov 17, 2016 at 11:09 AM, Emond Papegaaij
<em...@topicus.nl> wrote:
> I also think 'chained' better covers the intent. 'map' normally isn't
> a read/write transformation.
>
> Emond
>
> On Thu, Nov 17, 2016 at 12:38 AM, Martin Grigorov <mg...@apache.org> wrote:
>> +1 for #chained() .
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Tue, Nov 15, 2016 at 10:07 PM, Sven Meier <sv...@meiers.net> wrote:
>>
>>> Hi,
>>>
>>> >We could rename the methods taking an IModel as first parameter to
>>> >"chained" or "from".
>>>
>>> or "map":
>>>
>>>     LambdaModel.map(IModel, SerializableFunction, SerializableBiConsumer)
>>>
>>>     LambdaModel.map(IModel, SerializableFunction)
>>>
>>> Sven
>>>
>>>
>>>
>>> Am 15.11.2016 um 20:52 schrieb Emond Papegaaij:
>>>
>>>> IModel.map(Function) indeed is functionally equivalent to
>>>> LambdaModel.of(IModel, Function), but its memory footprint is
>>>> significantly larger (120 vs 80 bytes). Also, there's no equivalent
>>>> method for of(IModel, Function, BiConsumer). Naturally, we can add the
>>>> corresponding method, but it will remain much less efficient. These
>>>> chained models require an additional object.
>>>>
>>>> We've ran into similar problems many times at Topicus. Javac still is
>>>> very buggy when it comes to lambda type inference. IMHO the best
>>>> solution is to simply rename the methods to prevent the collisions.
>>>>
>>>> We could rename the methods taking an IModel as first parameter to
>>>> "chained" or "from". Another solution would be a builder API, but I
>>>> doubt that would make the code more readable.
>>>>
>>>> Best regards,
>>>> Emond
>>>>
>>>> On Tue, Nov 15, 2016 at 8:06 PM, Martin Grigorov <mg...@apache.org>
>>>> wrote:
>>>>
>>>>> On Tue, Nov 15, 2016 at 2:51 PM, Emond Papegaaij <
>>>>> emond.papegaaij@topicus.nl
>>>>>
>>>>>> wrote:
>>>>>> It seems I've hit a bug in javac:
>>>>>> LambdaModelTest[46,61] reference to of is ambiguous:
>>>>>> <T>   of(SerializableSupplier<T>, SerializableConsumer<T>)
>>>>>> <X,T> of(IModel<X>,               SerializableFunction<X,T>)
>>>>>>
>>>>>> This clearly is wrong:
>>>>>> IModel<String> personNameModel = LambdaModel.of(
>>>>>>      () -> person.getName(),
>>>>>>      (name) -> person.setName(name));
>>>>>>
>>>>>> The first parameter could match both SerializableSupplier<T> and
>>>>>> IModel<X>,
>>>>>> but the second parameter only matches SerializableConsumer<T>. Eclipse
>>>>>> has
>>>>>> no
>>>>>> problem with this and compiles the code just fine.
>>>>>>
>>>>>> I guess it confuses it with SerializableFunction<String, Void>.
>>>>> Although, I
>>>>> agree it should return null to actually match.
>>>>>
>>>>> IMO we don't
>>>>> need org.apache.wicket.model.LambdaModel#of(org.apache.wicket.
>>>>> model.IModel<X>,
>>>>> org.danekja.java.util.function.serializable.SerializableFunction<X,T>)
>>>>> It gives the same
>>>>> as org.apache.wicket.model.IModel#map(SerializableFunction<? super T, R>
>>>>> mapper).
>>>>>
>>>>>
>>>>> This now surfaces due to the change in the constructor. This testcase
>>>>>> used
>>>>>> to
>>>>>> call new LambdaModel(...), which had the same signature as the first
>>>>>> 'of'.
>>>>>> I
>>>>>> had to change it to use the overloaded factory method.
>>>>>>
>>>>>> I see two possible solutions:
>>>>>>   - Change the name of the factory methodes, so they are no longer
>>>>>> overloaded
>>>>>> (suggestions for the names are welcome)
>>>>>>   - Add a cast to the calling code to circumvent the bug.
>>>>>>
>>>>>> IMHO both are ugly.
>>>>>>
>>>>>> Best regards,
>>>>>> Emond
>>>>>>
>>>>>> On dinsdag 15 november 2016 13:36:56 CET buildbot@apache.org wrote:
>>>>>>
>>>>>>> The Buildbot has detected a new failure on builder wicket-master while
>>>>>>> building wicket. Full details are available at:
>>>>>>> https://ci.apache.org/builders/wicket-master/builds/550
>>>>>>>
>>>>>>> Buildbot URL: https://ci.apache.org/
>>>>>>>
>>>>>>> Buildslave for this Build: bb_slave1_ubuntu
>>>>>>>
>>>>>>> Build Reason: The SingleBranchScheduler scheduler named
>>>>>>> 'on-wicket-master-commit' triggered this build Build Source Stamp:
>>>>>>>
>>>>>> [branch
>>>>>>
>>>>>>> master] b40e9e1cd9ad7a9ffc63ab6c329c8d9c8b78b924 Blamelist: Emond
>>>>>>>
>>>>>> Papegaaij
>>>>>>
>>>>>>> <pa...@apache.org>
>>>>>>>
>>>>>>> BUILD FAILED: failed compile
>>>>>>>
>>>>>>> Sincerely,
>>>>>>>   -The Buildbot
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

Re: buildbot failure in on wicket-master

Posted by Emond Papegaaij <em...@topicus.nl>.
I also think 'chained' better covers the intent. 'map' normally isn't
a read/write transformation.

Emond

On Thu, Nov 17, 2016 at 12:38 AM, Martin Grigorov <mg...@apache.org> wrote:
> +1 for #chained() .
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, Nov 15, 2016 at 10:07 PM, Sven Meier <sv...@meiers.net> wrote:
>
>> Hi,
>>
>> >We could rename the methods taking an IModel as first parameter to
>> >"chained" or "from".
>>
>> or "map":
>>
>>     LambdaModel.map(IModel, SerializableFunction, SerializableBiConsumer)
>>
>>     LambdaModel.map(IModel, SerializableFunction)
>>
>> Sven
>>
>>
>>
>> Am 15.11.2016 um 20:52 schrieb Emond Papegaaij:
>>
>>> IModel.map(Function) indeed is functionally equivalent to
>>> LambdaModel.of(IModel, Function), but its memory footprint is
>>> significantly larger (120 vs 80 bytes). Also, there's no equivalent
>>> method for of(IModel, Function, BiConsumer). Naturally, we can add the
>>> corresponding method, but it will remain much less efficient. These
>>> chained models require an additional object.
>>>
>>> We've ran into similar problems many times at Topicus. Javac still is
>>> very buggy when it comes to lambda type inference. IMHO the best
>>> solution is to simply rename the methods to prevent the collisions.
>>>
>>> We could rename the methods taking an IModel as first parameter to
>>> "chained" or "from". Another solution would be a builder API, but I
>>> doubt that would make the code more readable.
>>>
>>> Best regards,
>>> Emond
>>>
>>> On Tue, Nov 15, 2016 at 8:06 PM, Martin Grigorov <mg...@apache.org>
>>> wrote:
>>>
>>>> On Tue, Nov 15, 2016 at 2:51 PM, Emond Papegaaij <
>>>> emond.papegaaij@topicus.nl
>>>>
>>>>> wrote:
>>>>> It seems I've hit a bug in javac:
>>>>> LambdaModelTest[46,61] reference to of is ambiguous:
>>>>> <T>   of(SerializableSupplier<T>, SerializableConsumer<T>)
>>>>> <X,T> of(IModel<X>,               SerializableFunction<X,T>)
>>>>>
>>>>> This clearly is wrong:
>>>>> IModel<String> personNameModel = LambdaModel.of(
>>>>>      () -> person.getName(),
>>>>>      (name) -> person.setName(name));
>>>>>
>>>>> The first parameter could match both SerializableSupplier<T> and
>>>>> IModel<X>,
>>>>> but the second parameter only matches SerializableConsumer<T>. Eclipse
>>>>> has
>>>>> no
>>>>> problem with this and compiles the code just fine.
>>>>>
>>>>> I guess it confuses it with SerializableFunction<String, Void>.
>>>> Although, I
>>>> agree it should return null to actually match.
>>>>
>>>> IMO we don't
>>>> need org.apache.wicket.model.LambdaModel#of(org.apache.wicket.
>>>> model.IModel<X>,
>>>> org.danekja.java.util.function.serializable.SerializableFunction<X,T>)
>>>> It gives the same
>>>> as org.apache.wicket.model.IModel#map(SerializableFunction<? super T, R>
>>>> mapper).
>>>>
>>>>
>>>> This now surfaces due to the change in the constructor. This testcase
>>>>> used
>>>>> to
>>>>> call new LambdaModel(...), which had the same signature as the first
>>>>> 'of'.
>>>>> I
>>>>> had to change it to use the overloaded factory method.
>>>>>
>>>>> I see two possible solutions:
>>>>>   - Change the name of the factory methodes, so they are no longer
>>>>> overloaded
>>>>> (suggestions for the names are welcome)
>>>>>   - Add a cast to the calling code to circumvent the bug.
>>>>>
>>>>> IMHO both are ugly.
>>>>>
>>>>> Best regards,
>>>>> Emond
>>>>>
>>>>> On dinsdag 15 november 2016 13:36:56 CET buildbot@apache.org wrote:
>>>>>
>>>>>> The Buildbot has detected a new failure on builder wicket-master while
>>>>>> building wicket. Full details are available at:
>>>>>> https://ci.apache.org/builders/wicket-master/builds/550
>>>>>>
>>>>>> Buildbot URL: https://ci.apache.org/
>>>>>>
>>>>>> Buildslave for this Build: bb_slave1_ubuntu
>>>>>>
>>>>>> Build Reason: The SingleBranchScheduler scheduler named
>>>>>> 'on-wicket-master-commit' triggered this build Build Source Stamp:
>>>>>>
>>>>> [branch
>>>>>
>>>>>> master] b40e9e1cd9ad7a9ffc63ab6c329c8d9c8b78b924 Blamelist: Emond
>>>>>>
>>>>> Papegaaij
>>>>>
>>>>>> <pa...@apache.org>
>>>>>>
>>>>>> BUILD FAILED: failed compile
>>>>>>
>>>>>> Sincerely,
>>>>>>   -The Buildbot
>>>>>>
>>>>>
>>>>>
>>>>>
>>

Re: buildbot failure in on wicket-master

Posted by Martin Grigorov <mg...@apache.org>.
+1 for #chained() .

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Nov 15, 2016 at 10:07 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> >We could rename the methods taking an IModel as first parameter to
> >"chained" or "from".
>
> or "map":
>
>     LambdaModel.map(IModel, SerializableFunction, SerializableBiConsumer)
>
>     LambdaModel.map(IModel, SerializableFunction)
>
> Sven
>
>
>
> Am 15.11.2016 um 20:52 schrieb Emond Papegaaij:
>
>> IModel.map(Function) indeed is functionally equivalent to
>> LambdaModel.of(IModel, Function), but its memory footprint is
>> significantly larger (120 vs 80 bytes). Also, there's no equivalent
>> method for of(IModel, Function, BiConsumer). Naturally, we can add the
>> corresponding method, but it will remain much less efficient. These
>> chained models require an additional object.
>>
>> We've ran into similar problems many times at Topicus. Javac still is
>> very buggy when it comes to lambda type inference. IMHO the best
>> solution is to simply rename the methods to prevent the collisions.
>>
>> We could rename the methods taking an IModel as first parameter to
>> "chained" or "from". Another solution would be a builder API, but I
>> doubt that would make the code more readable.
>>
>> Best regards,
>> Emond
>>
>> On Tue, Nov 15, 2016 at 8:06 PM, Martin Grigorov <mg...@apache.org>
>> wrote:
>>
>>> On Tue, Nov 15, 2016 at 2:51 PM, Emond Papegaaij <
>>> emond.papegaaij@topicus.nl
>>>
>>>> wrote:
>>>> It seems I've hit a bug in javac:
>>>> LambdaModelTest[46,61] reference to of is ambiguous:
>>>> <T>   of(SerializableSupplier<T>, SerializableConsumer<T>)
>>>> <X,T> of(IModel<X>,               SerializableFunction<X,T>)
>>>>
>>>> This clearly is wrong:
>>>> IModel<String> personNameModel = LambdaModel.of(
>>>>      () -> person.getName(),
>>>>      (name) -> person.setName(name));
>>>>
>>>> The first parameter could match both SerializableSupplier<T> and
>>>> IModel<X>,
>>>> but the second parameter only matches SerializableConsumer<T>. Eclipse
>>>> has
>>>> no
>>>> problem with this and compiles the code just fine.
>>>>
>>>> I guess it confuses it with SerializableFunction<String, Void>.
>>> Although, I
>>> agree it should return null to actually match.
>>>
>>> IMO we don't
>>> need org.apache.wicket.model.LambdaModel#of(org.apache.wicket.
>>> model.IModel<X>,
>>> org.danekja.java.util.function.serializable.SerializableFunction<X,T>)
>>> It gives the same
>>> as org.apache.wicket.model.IModel#map(SerializableFunction<? super T, R>
>>> mapper).
>>>
>>>
>>> This now surfaces due to the change in the constructor. This testcase
>>>> used
>>>> to
>>>> call new LambdaModel(...), which had the same signature as the first
>>>> 'of'.
>>>> I
>>>> had to change it to use the overloaded factory method.
>>>>
>>>> I see two possible solutions:
>>>>   - Change the name of the factory methodes, so they are no longer
>>>> overloaded
>>>> (suggestions for the names are welcome)
>>>>   - Add a cast to the calling code to circumvent the bug.
>>>>
>>>> IMHO both are ugly.
>>>>
>>>> Best regards,
>>>> Emond
>>>>
>>>> On dinsdag 15 november 2016 13:36:56 CET buildbot@apache.org wrote:
>>>>
>>>>> The Buildbot has detected a new failure on builder wicket-master while
>>>>> building wicket. Full details are available at:
>>>>> https://ci.apache.org/builders/wicket-master/builds/550
>>>>>
>>>>> Buildbot URL: https://ci.apache.org/
>>>>>
>>>>> Buildslave for this Build: bb_slave1_ubuntu
>>>>>
>>>>> Build Reason: The SingleBranchScheduler scheduler named
>>>>> 'on-wicket-master-commit' triggered this build Build Source Stamp:
>>>>>
>>>> [branch
>>>>
>>>>> master] b40e9e1cd9ad7a9ffc63ab6c329c8d9c8b78b924 Blamelist: Emond
>>>>>
>>>> Papegaaij
>>>>
>>>>> <pa...@apache.org>
>>>>>
>>>>> BUILD FAILED: failed compile
>>>>>
>>>>> Sincerely,
>>>>>   -The Buildbot
>>>>>
>>>>
>>>>
>>>>
>

Re: buildbot failure in on wicket-master

Posted by Sven Meier <sv...@meiers.net>.
Hi,

 >We could rename the methods taking an IModel as first parameter to
 >"chained" or "from".

or "map":

     LambdaModel.map(IModel, SerializableFunction, SerializableBiConsumer)

     LambdaModel.map(IModel, SerializableFunction)

Sven


Am 15.11.2016 um 20:52 schrieb Emond Papegaaij:
> IModel.map(Function) indeed is functionally equivalent to
> LambdaModel.of(IModel, Function), but its memory footprint is
> significantly larger (120 vs 80 bytes). Also, there's no equivalent
> method for of(IModel, Function, BiConsumer). Naturally, we can add the
> corresponding method, but it will remain much less efficient. These
> chained models require an additional object.
>
> We've ran into similar problems many times at Topicus. Javac still is
> very buggy when it comes to lambda type inference. IMHO the best
> solution is to simply rename the methods to prevent the collisions.
>
> We could rename the methods taking an IModel as first parameter to
> "chained" or "from". Another solution would be a builder API, but I
> doubt that would make the code more readable.
>
> Best regards,
> Emond
>
> On Tue, Nov 15, 2016 at 8:06 PM, Martin Grigorov <mg...@apache.org> wrote:
>> On Tue, Nov 15, 2016 at 2:51 PM, Emond Papegaaij <emond.papegaaij@topicus.nl
>>> wrote:
>>> It seems I've hit a bug in javac:
>>> LambdaModelTest[46,61] reference to of is ambiguous:
>>> <T>   of(SerializableSupplier<T>, SerializableConsumer<T>)
>>> <X,T> of(IModel<X>,               SerializableFunction<X,T>)
>>>
>>> This clearly is wrong:
>>> IModel<String> personNameModel = LambdaModel.of(
>>>      () -> person.getName(),
>>>      (name) -> person.setName(name));
>>>
>>> The first parameter could match both SerializableSupplier<T> and IModel<X>,
>>> but the second parameter only matches SerializableConsumer<T>. Eclipse has
>>> no
>>> problem with this and compiles the code just fine.
>>>
>> I guess it confuses it with SerializableFunction<String, Void>. Although, I
>> agree it should return null to actually match.
>>
>> IMO we don't
>> need org.apache.wicket.model.LambdaModel#of(org.apache.wicket.model.IModel<X>,
>> org.danekja.java.util.function.serializable.SerializableFunction<X,T>)
>> It gives the same
>> as org.apache.wicket.model.IModel#map(SerializableFunction<? super T, R>
>> mapper).
>>
>>
>>> This now surfaces due to the change in the constructor. This testcase used
>>> to
>>> call new LambdaModel(...), which had the same signature as the first 'of'.
>>> I
>>> had to change it to use the overloaded factory method.
>>>
>>> I see two possible solutions:
>>>   - Change the name of the factory methodes, so they are no longer
>>> overloaded
>>> (suggestions for the names are welcome)
>>>   - Add a cast to the calling code to circumvent the bug.
>>>
>>> IMHO both are ugly.
>>>
>>> Best regards,
>>> Emond
>>>
>>> On dinsdag 15 november 2016 13:36:56 CET buildbot@apache.org wrote:
>>>> The Buildbot has detected a new failure on builder wicket-master while
>>>> building wicket. Full details are available at:
>>>> https://ci.apache.org/builders/wicket-master/builds/550
>>>>
>>>> Buildbot URL: https://ci.apache.org/
>>>>
>>>> Buildslave for this Build: bb_slave1_ubuntu
>>>>
>>>> Build Reason: The SingleBranchScheduler scheduler named
>>>> 'on-wicket-master-commit' triggered this build Build Source Stamp:
>>> [branch
>>>> master] b40e9e1cd9ad7a9ffc63ab6c329c8d9c8b78b924 Blamelist: Emond
>>> Papegaaij
>>>> <pa...@apache.org>
>>>>
>>>> BUILD FAILED: failed compile
>>>>
>>>> Sincerely,
>>>>   -The Buildbot
>>>
>>>


Re: buildbot failure in on wicket-master

Posted by Emond Papegaaij <em...@gmail.com>.
IModel.map(Function) indeed is functionally equivalent to
LambdaModel.of(IModel, Function), but its memory footprint is
significantly larger (120 vs 80 bytes). Also, there's no equivalent
method for of(IModel, Function, BiConsumer). Naturally, we can add the
corresponding method, but it will remain much less efficient. These
chained models require an additional object.

We've ran into similar problems many times at Topicus. Javac still is
very buggy when it comes to lambda type inference. IMHO the best
solution is to simply rename the methods to prevent the collisions.

We could rename the methods taking an IModel as first parameter to
"chained" or "from". Another solution would be a builder API, but I
doubt that would make the code more readable.

Best regards,
Emond

On Tue, Nov 15, 2016 at 8:06 PM, Martin Grigorov <mg...@apache.org> wrote:
> On Tue, Nov 15, 2016 at 2:51 PM, Emond Papegaaij <emond.papegaaij@topicus.nl
>> wrote:
>
>> It seems I've hit a bug in javac:
>> LambdaModelTest[46,61] reference to of is ambiguous:
>> <T>   of(SerializableSupplier<T>, SerializableConsumer<T>)
>> <X,T> of(IModel<X>,               SerializableFunction<X,T>)
>>
>> This clearly is wrong:
>> IModel<String> personNameModel = LambdaModel.of(
>>     () -> person.getName(),
>>     (name) -> person.setName(name));
>>
>> The first parameter could match both SerializableSupplier<T> and IModel<X>,
>> but the second parameter only matches SerializableConsumer<T>. Eclipse has
>> no
>> problem with this and compiles the code just fine.
>>
>
> I guess it confuses it with SerializableFunction<String, Void>. Although, I
> agree it should return null to actually match.
>
> IMO we don't
> need org.apache.wicket.model.LambdaModel#of(org.apache.wicket.model.IModel<X>,
> org.danekja.java.util.function.serializable.SerializableFunction<X,T>)
> It gives the same
> as org.apache.wicket.model.IModel#map(SerializableFunction<? super T, R>
> mapper).
>
>
>>
>> This now surfaces due to the change in the constructor. This testcase used
>> to
>> call new LambdaModel(...), which had the same signature as the first 'of'.
>> I
>> had to change it to use the overloaded factory method.
>>
>> I see two possible solutions:
>>  - Change the name of the factory methodes, so they are no longer
>> overloaded
>> (suggestions for the names are welcome)
>>  - Add a cast to the calling code to circumvent the bug.
>>
>> IMHO both are ugly.
>>
>> Best regards,
>> Emond
>>
>> On dinsdag 15 november 2016 13:36:56 CET buildbot@apache.org wrote:
>> > The Buildbot has detected a new failure on builder wicket-master while
>> > building wicket. Full details are available at:
>> > https://ci.apache.org/builders/wicket-master/builds/550
>> >
>> > Buildbot URL: https://ci.apache.org/
>> >
>> > Buildslave for this Build: bb_slave1_ubuntu
>> >
>> > Build Reason: The SingleBranchScheduler scheduler named
>> > 'on-wicket-master-commit' triggered this build Build Source Stamp:
>> [branch
>> > master] b40e9e1cd9ad7a9ffc63ab6c329c8d9c8b78b924 Blamelist: Emond
>> Papegaaij
>> > <pa...@apache.org>
>> >
>> > BUILD FAILED: failed compile
>> >
>> > Sincerely,
>> >  -The Buildbot
>>
>>
>>

Re: buildbot failure in on wicket-master

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Nov 15, 2016 at 2:51 PM, Emond Papegaaij <emond.papegaaij@topicus.nl
> wrote:

> It seems I've hit a bug in javac:
> LambdaModelTest[46,61] reference to of is ambiguous:
> <T>   of(SerializableSupplier<T>, SerializableConsumer<T>)
> <X,T> of(IModel<X>,               SerializableFunction<X,T>)
>
> This clearly is wrong:
> IModel<String> personNameModel = LambdaModel.of(
>     () -> person.getName(),
>     (name) -> person.setName(name));
>
> The first parameter could match both SerializableSupplier<T> and IModel<X>,
> but the second parameter only matches SerializableConsumer<T>. Eclipse has
> no
> problem with this and compiles the code just fine.
>

I guess it confuses it with SerializableFunction<String, Void>. Although, I
agree it should return null to actually match.

IMO we don't
need org.apache.wicket.model.LambdaModel#of(org.apache.wicket.model.IModel<X>,
org.danekja.java.util.function.serializable.SerializableFunction<X,T>)
It gives the same
as org.apache.wicket.model.IModel#map(SerializableFunction<? super T, R>
mapper).


>
> This now surfaces due to the change in the constructor. This testcase used
> to
> call new LambdaModel(...), which had the same signature as the first 'of'.
> I
> had to change it to use the overloaded factory method.
>
> I see two possible solutions:
>  - Change the name of the factory methodes, so they are no longer
> overloaded
> (suggestions for the names are welcome)
>  - Add a cast to the calling code to circumvent the bug.
>
> IMHO both are ugly.
>
> Best regards,
> Emond
>
> On dinsdag 15 november 2016 13:36:56 CET buildbot@apache.org wrote:
> > The Buildbot has detected a new failure on builder wicket-master while
> > building wicket. Full details are available at:
> > https://ci.apache.org/builders/wicket-master/builds/550
> >
> > Buildbot URL: https://ci.apache.org/
> >
> > Buildslave for this Build: bb_slave1_ubuntu
> >
> > Build Reason: The SingleBranchScheduler scheduler named
> > 'on-wicket-master-commit' triggered this build Build Source Stamp:
> [branch
> > master] b40e9e1cd9ad7a9ffc63ab6c329c8d9c8b78b924 Blamelist: Emond
> Papegaaij
> > <pa...@apache.org>
> >
> > BUILD FAILED: failed compile
> >
> > Sincerely,
> >  -The Buildbot
>
>
>