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

VerifyException in StreamResourceLeak #2322

Closed
dododge opened this issue May 7, 2021 · 1 comment
Closed

VerifyException in StreamResourceLeak #2322

dododge opened this issue May 7, 2021 · 1 comment

Comments

@dododge
Copy link

dododge commented May 7, 2021

ATTENTION! Please read and follow:

Description of the problem / feature request:

Getting an unhandled exception within StreamResourceLeak. It looks very much like issue #1629 but is happening in 2.6.0 which I assume includes the fix from that issue.

[ERROR]      error-prone version: 2.6.0
[ERROR]      BugPattern: StreamResourceLeak
[ERROR]      Stack Trace:
[ERROR]      com.google.common.base.VerifyException
[ERROR]   	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
[ERROR]   	at com.google.errorprone.matchers.Matchers.methodCallInDeclarationOfThrowingRunnable(Matchers.java:1321)
[ERROR]   	at com.google.errorprone.bugpatterns.AbstractReturnValueIgnored.lambda$static$8059ac76$1(AbstractReturnValueIgnored.java:275)
[ERROR]   	at com.google.errorprone.matchers.Matchers.lambda$allOf$93cd24cb$1(Matchers.java:136)
[ERROR]   	at com.google.errorprone.matchers.Matchers.lambda$anyOf$5390886b$1(Matchers.java:168)
[ERROR]   	at com.google.errorprone.bugpatterns.AbstractReturnValueIgnored.expectedExceptionTest(AbstractReturnValueIgnored.java:288)
[ERROR]   	at com.google.errorprone.bugpatterns.AbstractMustBeClosedChecker.matchNewClassOrMethodInvocation(AbstractMustBeClosedChecker.java:80)
[ERROR]   	at com.google.errorprone.bugpatterns.StreamResourceLeak.matchMethodInvocation(StreamResourceLeak.java:68)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:450)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:747)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:151)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1761)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.visitMemberSelect(TreeScanner.java:720)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitMemberSelect(ErrorProneScanner.java:729)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitMemberSelect(ErrorProneScanner.java:151)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2281)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:94)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.visitMethodInvocation(TreeScanner.java:531)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:752)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:151)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1761)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.visitReturn(TreeScanner.java:492)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitReturn(ErrorProneScanner.java:818)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitReturn(ErrorProneScanner.java:151)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1665)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:109)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:254)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:521)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:151)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1059)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:94)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:212)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:741)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:151)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:925)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:94)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:109)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:117)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:193)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:549)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:151)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:832)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:109)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:117)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:148)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:561)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:151)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:603)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:58)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
[ERROR]   	at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1421)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1368)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:960)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Trying to compile this produces the exception:

package example;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.stream.Stream;

record ExampleRecord(Path path)
{
    public Stream<Path> list() throws IOException {
        return Files.list(path);
    }
}

What version of Error Prone are you using?

2.6.0

Also maven 3.8.1 and JDK 16.0.1.

Have you found anything relevant by searching the web?

Issue #1629

copybara-service bot pushed a commit that referenced this issue May 12, 2021
Fixes #2324, #2323, #2322

PiperOrigin-RevId: 373431735
copybara-service bot pushed a commit that referenced this issue May 12, 2021
Fixes #2324, #2323, #2322

PiperOrigin-RevId: 373431735
copybara-service bot pushed a commit that referenced this issue May 12, 2021
Fixes #2324, #2323, #2322

PiperOrigin-RevId: 373452319
@cushon
Copy link
Collaborator

cushon commented May 29, 2021

51b5c4d

@cushon cushon closed this as completed May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants