javac 8 with target level 7

Vicente-Arturo Romero-Zaldivar vicente.romero at oracle.com
Mon Jan 20 08:45:24 PST 2014


Thanks Anna for the report. I think that this issue should be studied 
carefully so I have created this bug entry to track it: 
https://bugs.openjdk.java.net/browse/JDK-8032268

Vicente

On 22/12/13 11:41, Gernot Neppert wrote:
> Hi,
>
> I think the option "-target 7" mandates that the generated *classfiles*
> be compatible with a Java-7 VM.
> The option "-source 7" would mandate that the compiler accept all
> sources that were valid Java-7 sources.
> However, there is no option that would force a newer compiler to
> *reject* the same set of sources that was rejected in an earlier version.
> (The reason is, of course, that making previously invalid sources
> compilable certainly does not break any promises of compatibility.)
>
> Does that make sense?
>
>> Hi,
>>
>> The code compiles with java 8 (b. 119) target 7, but fails to compile with
>> javac 7 target 7:
>>
>> import java.util.Comparator;
>>
>> class GenericMethod {
>>       <E extends Comparable<E>> Comparator<E> getComparator() {
>>           return null;
>>       }
>>
>>       <E> void useComparator(Comparator<? super E> comparator) {
>>       }
>>
>>       void test() {
>>           useComparator(this.getComparator());
>>       }
>> }
>>
>> Was that intended?
>>
>> Thanks,
>> Anna
>>
>>
>



More information about the lambda-dev mailing list