Hi Eduard

Yeah, I mean checkstyle (not spotless).

AFAIR, I saw a couple of locations without the diamond syntax. Let me
find it out. Maybe we can start with fixing there.

Thanks !
Regards
JB

On Thu, Oct 24, 2024 at 5:07 PM Eduard Tudenhöfner
<etudenhoef...@apache.org> wrote:
>
> Hey JB,
>
> I don't think we're ever using e.g. Lists.newArrayList() without the diamond 
> syntax in the codebase, so it's typically always List<String> list = 
> Lists.newArrayList().
> So I wonder how much of an issue that actually is? Do you have examples in 
> the codebase that don't use the diamond syntax and is it worth updating the 
> entire codebase?
>
>> to loosen the Lists/Maps/... enforcement in spotless)
>
>
> FYI this is being enforced by checkstyle and was first introduced by 
> https://github.com/apache/iceberg/pull/3689 in order to have a consistent 
> style around collection instantiation.
>
> Thanks
> Eduard
>
> On Thu, Oct 24, 2024 at 8:20 AM Jean-Baptiste Onofré <j...@nanthrax.net> 
> wrote:
>>
>> Hi folks,
>>
>> We are using Guava for different "utils" methods. Especially, we are
>> using Guava to create lists and maps. For instance, we do (and we
>> force the use of):
>>
>> List myList = Lists.newArrayList();
>>
>> or
>>
>> Map myMap = Maps.newHashMap();
>>
>> If it was a good idea up to JDK7, these methods are now unnecessary,
>> and the "regular" approach should be preferred in order to cleanly use
>> the diamond syntax
>> (https://docs.oracle.com/javase/tutorial/java/generics/genTypeInference.html#type-inference-instantiation).
>>
>> The Guava Javadoc actually clearly states this:
>> https://github.com/google/guava/blob/v33.3.1/guava/src/com/google/common/collect/Lists.java#L79
>>
>> So, I propose:
>> - to loosen the Lists/Maps/... enforcement in spotless)
>> - to refactore Iceberg to use JDK list and map constructors instead of
>> Guava Lists/Maps/...
>>
>> I started the change, but as it's a pretty large one, I would like
>> your feedback before completing the PR.
>>
>> Regards
>> JB

Reply via email to