Skip to content

Test try-with-resources against "Only one statement per line" checkstyle rule #136

Closed
@philwebb

Description

@philwebb

See spring-projects/spring-boot#17637 and #113 (comment) for more details.


I have the following code:

try (Session session = this.driver.session();
		Transaction tx = session.beginTransaction()) {
		// Do something
}

Spring Java Format complains

 Formatting violations found in the following files:
 * /Users/msimons/Projects/spring-projects/spring-boot/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/neo4j/Neo4jDriverAutoConfigurationIntegrationTests.java

Run `spring-javaformat:apply` to fix.

Fix turns the snippet into

try (Session session = this.driver.session(); Transaction tx = session.beginTransaction()) {
}

Checkstyle complains OneStatementPerLine.

I have no clue how to format the thing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions