Compiling some project fails due to ambiguous Record class name

Remi Forax forax at univ-mlv.fr
Wed Jan 1 13:34:24 UTC 2020


Yes,
I remember we had the same issue when introducing java.lang.Enum or java.lang.ClassValue.

If a classfile is using 'import *', it may not work with future version of the jdk
(because javac does by default an import java.lang.*).

Rémi

----- Mail original -----
> De: "Tagir Valeev" <amaembo at gmail.com>
> À: "amber-dev" <amber-dev at openjdk.java.net>
> Envoyé: Mercredi 1 Janvier 2020 12:29:15
> Objet: Compiling some project fails due to ambiguous Record class name

> Hello!
> 
> Probably it's quite expected, but I'm reporting this just for the
> case. We are trying to build some opensource projects just using the
> Java 14. One of our test projects is univocity-parsers [1]. When I try
> to compile it with Java 14 (without even preview option) I see 57
> compilation errors like this:
> 
> .../univocity-parsers/src/main/java/com/univocity/parsers/common/AbstractWriter.java:[711,22]
> reference to Record is ambiguous
> both interface com.univocity.parsers.common.record.Record in
> com.univocity.parsers.common.record and class java.lang.Record in
> java.lang match
> 
> This project defines a class
> com.univocity.parsers.common.record.Record and often imports it using
> import com.univocity.parsers.common.record.*;
> 
> Thus, the import becomes ambiguous. This could be fixed by rewriting
> the imports manually (our IDE doesn't provide an easy way to automate
> this). I wonder how many projects could be affected by this problem.
> The 'Record' type name is quite common. In any case, this problem
> should be mentioned in Java 14 migration notes.
> 
> With best regards,
> Tagir Valeev.
> 
> [1] https://github.com/uniVocity/univocity-parsers


More information about the amber-dev mailing list