Change regarding conditional expression & capture & lub?

Stephan Herrmann stephan.herrmann at
Sun Dec 8 07:56:04 PST 2013

This doesn't seem directly connected to JSR 335 but I wonder
if the following change in behavior has s.t. to do with the
type checking we are discussing here:

   class A{/**/}
   class B extends A {/**/}

   class G<T> {
     G<B> gb=null;
     G<? super A> gsa=null;
     G<? super B> l = (true)? gsa : gb;

javac7- rejects this, which corresponds to my understanding of the JLS:

(1) capture the types of gsa and gb, respectively.
(2) compute the lub
(3) detect type mismatch

javac8, OTOH, accepts the snippet.

Has the specification for any of the three steps been changed?
I suspect that conditional expressions no longer capture before
lub computation?? Wouldn't that require a change in 15.11.1 et al:
    "the type of the field access expression is the type
     of the member field after capture conversion"

Or has lub computation been changed in some way?
(spec and/or implementation?)

Either way the effect would probably be relevant for my work on inference :)


More information about the lambda-spec-experts mailing list