Building langtools on MacOS fails with ClassReader.java:911: reference to Version is ambiguous

Dalibor Topic dalibor.topic at oracle.com
Mon Dec 13 03:00:49 PST 2010


On 12/13/10 6:22 AM, Reinier Zwitserloot wrote:
> Dalibor,
> 
> could you elaborate on what this patch does?

Sure.

The error message was:

"reference to Version is ambiguous, both class
> com.sun.tools.javac.jvm.ClassFile.Version in
> com.sun.tools.javac.jvm.ClassFile and class
> com.sun.tools.javac.util.Version in com.sun.tools.javac.util match"

In OpenJDK, only one of the types is resolvable by javac during the compilation (i.e. ClassFile.Version),
so using plain 'Version' everywhere in the class is fine. Apparently, there is at least one 
implementation where another class named Version exists in the com.sun.tools.javac package (dragged in 
via import com.sun.tools.javac.util.*), so one needs to make clear which one is used.

Which changing usage in the class from Version to ClassFile.Version did by touching two lines.

cheers,
dalibor topic

-- 
Oracle <http://www.oracle.com>
Dalibor Topic | Java F/OSS Ambassador
Phone: +494023646738 <tel:+494023646738> | | | Mobile: +491772664192 <tel:+491772664192>
Oracle Java Platform Group

ORACLE Deutschland B.V. & Co. KG | Nagelsweg 55 | 20097 Hamburg

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Rijnzathe 6, 3454PV De Meern, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven

Green Oracle <http://www.oracle.com/commitment> Oracle is committed to developing practices and products that help protect the environment


More information about the lambda-dev mailing list