eclipse-jdt / eclipse-jdt/eclipse.jdt.ui

[formatting][java] method with parameter annotation incorrectly formatted.

Open
#1,688 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
59
Forks
127
Avg merge
1d 8h
Merged PRs (30d)
37

Description

Dear developers,

I have the following formatting settings
![image](https://github.com/eclipse-jdt/eclipse.jdt.ui/assets/171016967/cd7c0bfa-885b-44c6-ba33-b33b16d6b1be)

When I format the following code that uses [junit-pioneer](https://junit-pioneer.org/)'s [Cartesian product](https://junit-pioneer.org/docs/cartesian-product/):
```java
@CartesianTest
void test(@Values(booleans = {true, false}) boolean identical, @Values(ints = {2, 3, 4}) int low,
@Values(ints =
{4, 5}) int high) {
fail("todo");
}
```
nothing changes.

Yet since a wrap has occurred in my method declaration, I expected
```java
@CartesianTest
void test(@Values(booleans = {true, false}) boolean identical, @Values(ints = {2, 3, 4}) int low,
@Values(ints =
{4, 5}) int high)
{
fail("todo");
}
```

My expectations are confirmed by checkstyle:
![image](https://github.com/eclipse-jdt/eclipse.jdt.ui/assets/171016967/28c7ad82-d48d-405a-bece-0c925c35eea6)

Can you confirm that this is indeed a bug.
If so, could you please fix it?

Thanks in advance for your answers!

Contributor guide

Open the contributing guide

Research direction

No source file or test is named in the issue. Start by reproducing the formatter behavior with the provided Java method and inspect the formatter handling of method declarations with parameter annotations. Done means the declaration is wrapped as shown and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.