hilla icon indicating copy to clipboard operation
hilla copied to clipboard

Some type parameters do not follow naming conventions

Open cromoteca opened this issue 3 years ago • 1 comments

While looking at https://github.com/vaadin/hilla/blob/main/packages/java/parser-jvm-core/src/test/java/dev/hilla/parser/test/helpers/context/AbstractContext.java, I was trying to find the ReflectionOrigin class returned by getReflectionOrigin. Turns out it is a type parameter.

The "official" Java convention for type parameter is to use single uppercase letters.

Some developers want to use meaningful names. In that case, uppercase names are used sometimes. Google proposed to append a T to the name, like ReflectionOriginT.

But in this case, I think that T is perfectly fine, since all other names, including the mentioned method name, already describe what type is expected.

I haven't found an IDEA inspection to search for parameterized type names that do not follow any convention.

cromoteca avatar Sep 08 '22 14:09 cromoteca

Here's some inspiration for what kind of mayhem you can cause with type parameter names that look like regular types: https://horstmann.com/unblog/2022-07-20/index.html

Legioth avatar Sep 09 '22 07:09 Legioth