Compiling some project fails due to ambiguous Record class name

Tagir Valeev amaembo at gmail.com
Wed Jan 1 11:29:15 UTC 2020


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