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 eclipse-jdt#2207

Don't run tests using lambda below compliance 1.8
  • Loading branch information
stephan-herrmann authored and gayanper committed Sep 7, 2024
1 parent 5b7c9c4 commit 000c9bb
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 000c9bb

Please sign in to comment.