Skip to content

Improve filter for try-with-resources #1662

@Godin

Description

@Godin
class Example {
	static String example(boolean f) {
		try (Resource r = open()) {
			if (f) return "a";
		} // currently 1 of 2 branches missed
		return "b";
	}

	public static void main(String[] args) {
		example(true);
		example(false);
	}

	static class Resource open() {
		return new Resource();
	}

	static class Resource implements AutoCloseable {
		@Override
		public void close() {
		}
	}
}

See https://groups.google.com/g/jacoco/c/s2clBCBXzac/m/wPV-YrGbAQAJ

Metadata

Metadata

Assignees

Type

No type

Projects

Status

To Do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions