rawhide java versioning issue?

Deepak Bhole dbhole at redhat.com
Thu Dec 1 16:57:21 UTC 2011


* Sérgio Basto <sergio at serjux.com> [2011-11-29 14:39]:
> On Tue, 2011-11-29 at 09:02 -0500, Deepak Bhole wrote: 
> > Java 7 needs to become the default JDK for rawhide. We will start working
> > on this over the coming few days. Until done, Java stuff might be broken
> > here and there.
> 
> yeah new Java breaks build of VirtualBox-4.1.6 (from rpmfusion)
> 
> I got this error 
> warning: [options] bootstrap class path not set in conjunction with
> -source 1.5                        
> /builddir/build/BUILD/VirtualBox-4.1.6_OSE/obj/obj/vboxjxpcom-gen/jxpcomgen/java/glue/Helper.java:123: error: name clash: unwrap(List<Integer>) and unwrap(List<Short>) have the same erasure                 
>     public static int[] unwrap(List<Integer> vals)
> {                                                   
> 
> ^                                                                              
> /builddir/build/BUILD/VirtualBox-4.1.6_OSE/obj/obj/vboxjxpcom-gen/jxpcomgen/java/glue/Helper.java:135: error: name clash: unwrap(List<Long>) and unwrap(List<Short>) have the same erasure                    
>     public static long[] unwrap(List<Long> vals) {    
> 
> > As a workaround, you can manually install java-1.7.0-openjdk{,-devel}
> > and it should be fine.
> 
> the build is with mock , I don't understand your suggestion .
> Can we use java 1.6 or java 1.6 is in repo of rawhide ? 
> 

I am surprised the above code builds with 6. It shouldn't.

Java erases types when writing bytecode:
http://docs.oracle.com/javase/tutorial/java/generics/erasure.html

Essentially, the above code is wrong based on Java's implementation
because the bytecode is ending up 2 unwrap methods that both take
"List".

I would suggest fixing the code to change the method names. It may be
working at runtime with 6 for now, but can break any time. 

Cheers,
Deepak


More information about the devel mailing list