Skip to content
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

Java's try-with-resources is not supported #628

Closed
shanshin opened this issue Jun 10, 2024 · 1 comment · Fixed by #639
Closed

Java's try-with-resources is not supported #628

shanshin opened this issue Jun 10, 2024 · 1 comment · Fixed by #639
Assignees
Labels
Bug Bug issue type S: ready for release Status: merged in the main branch

Comments

@shanshin
Copy link
Collaborator

Describe the bug
When using try-with-resources in a Java class, some lines are marked as partially covered in the generated report.

Expected behavior
All lines should be fully covered (green in HTML report)

Reproducer
Java class

public final class TryWithResources {

    private TryWithResources() {}

    public static void test() throws Exception {
        final AutoCloseable autoCloseable = new AutoCloseable() {
            @Override
            public void close() {
                System.out.println("closed");
            }
        };

        try (autoCloseable) {
            System.out.println("action");
        }
    }
}

Reports
when calling the test method, the following coverage report is generated
HTML report

Environment

  • IntelliJ agent 1.0.754
@shanshin shanshin added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Jun 10, 2024
@shanshin shanshin self-assigned this Jun 10, 2024
shanshin added a commit that referenced this issue Jun 19, 2024
@shanshin shanshin reopened this Jun 25, 2024
@shanshin shanshin added S: ready for release Status: merged in the main branch and removed S: untriaged Status: issue reported but unprocessed labels Jun 25, 2024
@shanshin
Copy link
Collaborator Author

Fixed in 0.8.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: ready for release Status: merged in the main branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant