Skip to content

Commit

Permalink
Resorce Leak compiler error/warning (detection) has some problem
Browse files Browse the repository at this point in the history
fixes #2207

Don't run tests using lambda below compliance 1.8
  • Loading branch information
stephan-herrmann authored and akurtakov committed Apr 1, 2024
1 parent 67e94ee commit 2e89a1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,8 @@ static void test() {
false);
}
public void testGH2207_2() {
if (this.complianceLevel < ClassFileConstants.JDK1_8)
return;
Map<String, String> options = getCompilerOptions();
options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.ERROR);
options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR);
Expand Down Expand Up @@ -1504,6 +1506,8 @@ void consumerNOK(ResourceProducer producer) {
options);
}
public void testGH2207_3() {
if (this.complianceLevel < ClassFileConstants.JDK1_8)
return;
Map<String, String> options = getCompilerOptions();
options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.ERROR);
options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR);
Expand Down Expand Up @@ -1543,6 +1547,8 @@ void consumer(ResourceProducer producer) {
options);
}
public void testGH2207_4() {
if (this.complianceLevel < ClassFileConstants.JDK1_8)
return;
Map<String, String> options = getCompilerOptions();
options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.ERROR);
options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7148,6 +7148,8 @@ void test(int sw) {
options);
}
public void testGH2207_1() {
if (this.complianceLevel < ClassFileConstants.JDK1_8)
return;
// relevant only since 19, where ExecutorService implements AutoCloseable
Map options = getCompilerOptions();
options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.ERROR);
Expand Down

0 comments on commit 2e89a1d

Please sign in to comment.