diffplug / diffplug/spotless

Case sensitive Java type annotations

Open
#1,974 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
5.6k
Forks
559
Avg merge
1d 13h
Merged PRs (30d)
34

Description

We are running Spotless 2.38.0 with Maven 3.8 to format Java and its annotations. Since currently hardcoded list of type annotations doesn't have fully qualified names I think annotations should be matched by case sensitive check.

Case in point, `@min` annotation from Checker Framework and `@Min(X)` annotation from Jakarta Validation are two different annotations.

Consider such code:
```
@NotNull
@Min(60)
@Max(86400)
public long getExpiration() {
return super.getExpiration();
}
```
Current behaviour results in `@Min` annotation moved inline with `@NotNull` and `@Max` left alone. What's more interesting (and could be related), is that `@NotNull` and `@Min` is never moved inline with `public long` even if I completely remove `@Max`.
```
@NotNull @Min(60)
@Max(86400)
public long getExpiration() {
return super.getExpiration();
}
```

Of source, checking by fully qualified names would be even better solution, but I think case sensitivity would solve current issue in a more trivial way.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.