| 1 |
// Test case for Issue 1500: |
| 2 |
// https://github.com/typetools/checker-framework/issues/1500 |
| 3 |
|
| 4 |
import java.io.InputStream; |
| 5 |
import org.checkerframework.checker.nullness.qual.Nullable; |
| 6 |
|
| 7 |
public class TryFinally2 { |
| 8 |
|
| 9 |
@SuppressWarnings("nullness") // dummy implementation |
| 10 |
Process getProcess() { |
| 11 |
return null; |
| 12 |
} |
| 13 |
|
| 14 |
void performCommand() { |
| 15 |
Process proc = null; |
| 16 |
InputStream in = null; |
| 17 |
try { |
| 18 |
proc = getProcess(); |
| 19 |
in = proc.getInputStream(); |
| 20 |
return; |
| 21 |
} finally { |
| 22 |
closeQuietly(in); |
| 23 |
if (proc != null) { |
| 24 |
proc.destroy(); |
| 25 |
} |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
public static void closeQuietly(final @Nullable InputStream input) {} |
| 30 |
} |