python (65.2k questions)
javascript (44.3k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (13k questions)
How can Mockito mock a Kotlin `use` (aka try-with-resource)?
If I were trying to add mocks to the following code (where the MyTypeBuilder is mocked to return a mocked MyType - which implements Closeable):
myTypeBuilder.build(myTypeConfiguration).use { myType -&...

Alex Taylor
Votes: 0
Answers: 1
How to handle exceptions when a resource closes automatically in try with resources?
According to this link, if the source has a problem when opening and throws an exception and it is also in try parentheses, JVM closes it. My question is how to inform the user now that this source is...
aforz
Votes: 0
Answers: 2
Is try-finally being deprecated with Java 18+?
JEP 421, being released in the forthcoming Java 18, deprecates finalization. I understand this mean the finalize() method is being deprecated. However, it also mentions the try/finally block and menti...
k314159
Votes: 0
Answers: 1
Sonar scan says Use try-with-resources or close this "Stream" in a "finally" clause
Sonar qube is giving me the following error:
Use try-with-resources or close this "Stream" in a "finally" clause
This is my code:
Path start = Paths.get(filePath);
Stream<File...

Poorna Senani Gamage
Votes: 0
Answers: 3