Case sensitive Java type annotations
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by reproducing the formatting of the Java snippet with Spotless 2.38.0 under Maven 3.8, then trace the hardcoded type-annotation matching used by the formatter. Done means annotations differing only by case, such as Checker Framework @min and Jakarta Validation @Min, are not treated as the same annotation and the shown examples format consistently.
Written by the indexing model from the issue text.
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.
- Dominant language
- Java
- Stars
- 5.7k
- Forks
- 560
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 40
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from diffplug/spotless
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 66/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
All issues in diffplug/spotless
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
inu-appcenter/memorIN-backend#288 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
frontend maui-pilot pilot-ask question
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
area/plugin
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
kestra-io/plugin-kestra#190 ·