Fwd: Re: Compilation error with JDK9-ea+138

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Oct 6 15:30:16 UTC 2016


What Jon says. I;ve tried to give this a try using this example:

class Test {

interface Expression<T> { }

interface SimpleCase<A, B> { }

<C, R> SimpleCase<C, R> selectCase(Expression<? extends C> expression) {
           return selectCase((Class<R>) null, expression);
}

<C, R> SimpleCase<C, R> selectCase(Class<R> type, Expression<? extends 
C> expression) {
           return null;
       }
}


But this passes with latest compiler. So I'm probably missing something 
(i.e. some bounds in the type-variable decl for Expression or SimpleCase?)

Maurizio


On 06/10/16 16:17, Jonathan Gibbons wrote:
>
> Christian,
>
> As a general rule, it is better if you can post complete but reduced 
> test cases, and post all the messages from the compiler. It is often 
> hard to properly diagnose cases where someone posts some fragment of 
> code and asks what's wrong.
>
> -- Jon
>
>
> On 10/6/16 8:08 AM, Christian Beikov wrote:
>>
>> I have been directed to this mailing list for this error.
>>
>> Is this a known issue?
>>
>>
>>
>> -------- Weitergeleitete Nachricht --------
>> Betreff: 	Re: Compilation error with JDK9-ea+138
>> Datum: 	Wed, 05 Oct 2016 10:27:53 -0700
>> Von: 	Alex Buckley <alex.buckley at oracle.com>
>> Organisation: 	Oracle Corporation
>> An: 	jigsaw-dev at openjdk.java.net
>>
>>
>>
>> This isn't a Jigsaw issue, please mail compiler-dev instead, being sure
>> to note which JDK 9 build you are compiling with.
>>
>> On 10/5/2016 12:55 AM, Christian Beikov wrote:
>> > The following used to compile just fine on JDKs < 9
>> >
>> >      @Override
>> >      public <C, R> SimpleCase<C, R> selectCase(Expression<? extends C>
>> > expression) {
>> >          return selectCase((Class<R>) null, expression);
>> >      }
>> >
>> >      public <C, R> SimpleCase<C, R> selectCase(Class<R> type,
>> > Expression<? extends C> expression) {
>> >          return new SimpleCaseExpression<C, R>(this, type, expression);
>> >      }
>> >
>> > but now fails with:
>> >      error: incompatible types: SimpleCase<CAP#1,R> cannot be converted
>> > to SimpleCase<C,R>
>> >
>> > The error is in the first selectCase method.
>> >
>> > Is that a bug in the compiler?
>> >
>> > Regards,
>> > Christian
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20161006/602140dc/attachment-0001.html>


More information about the compiler-dev mailing list