[libvirt] [PATCH libvirt-java] Require at least Java 8

Wido den Hollander wido at widodh.nl
Mon Sep 7 09:36:38 UTC 2015



On 04-09-15 07:12, Claudio Bley wrote:
> At Wed, 2 Sep 2015 17:38:03 +0200,
> Wido den Hollander wrote:
>>
>>
>>
>>>     The current code doesn't compile under Java 7, but Java 7 is also EOL.
>>>
>>>
>>> That should not be the case. Can you provide the error messages or
>>> simply point to the place where Java 8 classes are used?
>>>
>>
>> build:
>>     [javac] Compiling 98 source files to
>> /home/wido/repos/libvirt-java/target/classes
>>     [javac] warning: [options] bootstrap class path not set in
>> conjunction with -source 1.7
>>     [javac]
>> /home/wido/repos/libvirt-java/src/main/java/org/libvirt/event/DomainEvent.java:63:
>> error: incompatible types: inference variable T#1 has incompatible upper
>> bounds Enum<T#2>,T#3
>>     [javac]         return this.type.obtain(this.detail);
>>     [javac]                                ^
>>     [javac]   where T#1,T#2,T#3 are type-variables:
>>     [javac]     T#1 extends Enum<T#1> declared in method <T#1>obtain(int)
>>     [javac]     T#2 extends T#3
>>     [javac]     T#3 extends Enum<T#3>,DomainEventDetail declared in
>> method <T#3>getDetail()
>>     [javac] 1 error
>>     [javac] 1 warning
> 
> This reminded me of a problem I once saw with the Java 7 (I think)
> compiler being unable to correctly infer the types when calling static
> generic methods.
> 
> Since I always used the Java 7 compiler to compile the code and as I
> saw the javac warning above, I got curious.
> 
> The thing is: the code compiles just fine with an actual Java 7
> compiler (OpenJDK 1.7.0_85), but not when using a Java 8 compiler
> (OpenJDK 1.8.0_60) with the `-source 1.7` switch.
> 

Ah, indeed. I'm using the Oracle Java 8 JDK and not OpenJDK.

>> But if the compile issue can be fixed we can probably require at least
>> Java 7. I think Java 6 is dangerous.
> 
> I'm still thinking about this. Maybe you're right. But still, the code
> is valid 1.7 source code. Should we prevent that code from compiling
> on Java 7 to protect users from using an obsolete JVM? I don't think
> this is the right place to control that.
> 

No, we can probably depend on Java 7, but we should update the README
that it doesn't compile properly on Oracle's JDK and you should use OpenJDK.

Wido

> --
> Claudio
> 




More information about the libvir-list mailing list