Skip to content

Use of Nullable on a statement puts the annotation on its own line #442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
snicoll opened this issue May 27, 2025 · 1 comment
Closed

Use of Nullable on a statement puts the annotation on its own line #442

snicoll opened this issue May 27, 2025 · 1 comment
Assignees
Milestone

Comments

@snicoll
Copy link
Contributor

snicoll commented May 27, 2025

This is a follow-up issue on the nullability support. I am using 0.0.45.

Consider the following (silly) example:

private @Nullable Object[] doSomething(int length) {
	@Nullable Object[] args = new Object[length];
	for (int i = 0; i < length; i++) {
		args[i] = (i % 2 == 0) ? Boolean.TRUE : null;
	}
	return args;
}

If I ask to reformat, this does:

private @Nullable Object[] doSomething(int length) {
	@Nullable
	Object[] args = new Object[length];
	for (int i = 0; i < length; i++) {
		args[i] = (i % 2 == 0) ? Boolean.TRUE : null;
	}
	return args;
}
@snicoll snicoll changed the title Use of Nullable on a statement put the annotation on its own line Use of Nullable on a statement puts the annotation on its own line May 27, 2025
@philwebb philwebb self-assigned this May 27, 2025
@philwebb philwebb added this to the 0.0.46 milestone May 27, 2025
@snicoll
Copy link
Contributor Author

snicoll commented May 28, 2025

Thanks, tried the snapshot and it does format as expected now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants