Single Abstract Method for SAMs cannot be polymorphic (original) (raw)
Grégoire Neuville gregoire.neuville at gmail.com
Tue Apr 2 13:16:19 PDT 2013
- Previous message: Single Abstract Method for SAMs cannot be polymorphic
- Next message: Single Abstract Method for SAMs cannot be polymorphic
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I meant 'the annotation in itself is marked as erroneous' : so does the code '(a, g) -> new Gen<>()'.
Note though that the sole annotation (i.e if 'CoArbitrary<?> coArb = (a, g) -> new Gen<>();' is commented) doesn't prevent the code from being compiled by javac : should it ?
On 2 April 2013 22:04, Grégoire Neuville <gregoire.neuville at gmail.com>wrote:
Hi all,
The below code : public class TestGenericSAM { class Gen {} @FunctionalInterface interface CoArbitrary { abstract Gen coarbitrary(A a, Gen g); } void test() { CoArbitrary<?> coArb = (a, g) -> new Gen<>(); } } doesn't compile. I guess this is by design (the annotation alone is marked as erroneous by IntelliJ), but I'm just wondering why. Thanks a lot for any explanation ! -- Grégoire Neuville
-- Grégoire Neuville
- Previous message: Single Abstract Method for SAMs cannot be polymorphic
- Next message: Single Abstract Method for SAMs cannot be polymorphic
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]