-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
empty filter in resources does not work with java 8
- Loading branch information
Henry Coles
committed
Mar 10, 2022
1 parent
fe16792
commit c8e8088
Showing
4 changed files
with
50 additions
and
16 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...est/java/com/example/emptyreturns/AlreadyReturnsEmptyOptionalInTryWithResourcesBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.example.emptyreturns; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.util.Optional; | ||
|
||
public class AlreadyReturnsEmptyOptionalInTryWithResourcesBlock { | ||
public Optional<String> a() throws IOException { | ||
try(ByteArrayOutputStream os = new ByteArrayOutputStream()) { | ||
Double.parseDouble("12"); | ||
if (os.size() > 42) { | ||
return Optional.empty(); | ||
} | ||
return Optional.of("foo"); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
pitest-entry/src/test/java/org/pitest/util/CurrentRuntime.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.pitest.util; | ||
|
||
public class CurrentRuntime { | ||
|
||
public static int version() { | ||
String version = System.getProperty("java.version").replace("-ea", ""); | ||
if (version.startsWith("1.")) { | ||
version = version.substring(2, 3); | ||
} else { | ||
int dot = version.indexOf("."); | ||
if (dot != -1) { | ||
version = version.substring(0, dot); | ||
} | ||
} | ||
return Integer.parseInt(version); | ||
} | ||
} |
Binary file added
BIN
+1.36 KB
...leClasses/emptyReturns/AlreadyReturnsEmptyOptionalInTryWithResourcesBlock_javac.class.bin
Binary file not shown.