Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface ParticleInt<O extends ParticleInt<O>>{
- O withSmt();
- }
- class Particle implements ParticleInt<Particle>{
- @Override
- public Particle withSmt() {
- return new Particle();
- }
- }
- class Particle2 implements ParticleInt<Particle2>{
- @Override
- public Particle2 withSmt() {
- return new Particle2();
- }
- }
- interface Executable<P extends ParticleInt<? extends ParticleInt>>{
- void setExecutableStrategy(ExecutableStrategy<P> s);
- }
- interface ExecutableStrategy<P extends ParticleInt<? extends ParticleInt>>{
- Stream<P> exec(List<P> l);
- }
- class Particle2Strat implements ExecutableStrategy<Particle2>{
- @Override
- public Stream<Particle2> exec(List<Particle2> l) {
- return l.stream().map(x -> x.withSmt());
- }
- }
- class ParticleStrat<P extends ParticleInt<? extends ParticleInt>> implements ExecutableStrategy<P>{
- @Override
- public Stream<P> exec(List<P> l) {
- return l.stream().map(x -> x.withSmt());
- // [44,38] incompatible types: inference variable R has incompatible bounds
- // equality constraints: P
- // [ERROR] lower bounds: capture#1 of ? extends ParticleInt
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement