Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8168134

Inference: javac incorrectly propagating inner constraint with primitive target

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • tools
    • b143
    • Verified

      >
      > javac started rejecting the following program between 9-ea+119 and 9-ea+120. The culprit appears to be JDK-8157149 [1][2]. Was this intentional?
      >
      > Thanks,
      >
      > [1] https://bugs.openjdk.java.net/browse/JDK-8157149
      > [2] http://hg.openjdk.java.net/jdk9/dev/langtools/rev/a8b7c9938b74
      >
      > === Test.java
      > abstract class Test {
      > interface W<A> {}
      > abstract <B> B f(W<B> e);
      > abstract <C> C g(C b, long i);
      >
      > void h(W<Long> i) {
      > g("", f(i));
      > }
      > }
      > ===
      >
      > $ javac Test.java
      > ...
      > error: method g in class Test cannot be applied to given types;
      > g("", f(i));
      > ^
      > required: C,long
      > found: String,Long
      > reason: cannot infer type-variable(s) C,B
      > (argument mismatch; B cannot be converted to long)
      > where C,B are type-variables:
      > C extends Object declared in method <C>g(C,long)
      > B extends Object declared in method <B>f(W<B>)
      > 1 error

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: