Compilation error with JDK8 (original) (raw)

Olivier Bourgain obourgain at gmail.com
Tue Apr 2 06:50:41 PDT 2013


I'm still trying to compile my project with java 8 (b83), I and get another error.

Here is the simplest test case I've found which reproduce this error :

===== Vo.java

public interface Vo { public Integer getId(); }

===== Service.java

public class Service {

public static H getParentById(H vo) { return (H) getParent(findByPk(vo.getClass(), vo.getId())); }

public static H getParent(H vo) { return null; }

public static H findByPk(Class voClass, Integer id) { return null; } }

The error message is :

ยป javac src/*.java src/Service.java:4: error: method getParent in class Service cannot be applied to given types; return (H) getParent(findByPk(vo.getClass(), vo.getId())); ^ required: H#1 found: CAP#1 reason: cannot infer type-variable(s) H#1,H#2 (argument mismatch; Vo cannot be converted to CAP#2) where H#1,H#2 are type-variables: H#1 extends Vo declared in method <H#1>getParent(H#1) H#2 extends Vo declared in method <H#2>findByPk(Class<H#2>,Integer) where CAP#1,CAP#2 are fresh type-variables: CAP#1 extends Vo from capture of ? extends Vo CAP#2 extends Vo from capture of ? extends Vo 1 error

The java version : openjdk version "1.8.0-ea" OpenJDK Runtime Environment (build 1.8.0-ea-lambda-nightly-h3797-20130325-b83-b00) OpenJDK Server VM (build 25.0-b21, mixed mode)

Olivier Bourgain



More information about the lambda-dev mailing list