langtools/test/tools/javac/lambda/BadLambdaExpr.java
changeset 27319 030080f03e4f
parent 14547 86d8d242b0c4
child 30730 d3ce7619db2c
--- a/langtools/test/tools/javac/lambda/BadLambdaExpr.java	Wed Oct 29 12:09:17 2014 +0100
+++ b/langtools/test/tools/javac/lambda/BadLambdaExpr.java	Wed Oct 29 17:25:23 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -105,18 +105,19 @@
 
         //create default shared JavaCompiler - reused across multiple compilations
         JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+        try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
 
-        for (ParameterListKind plk : ParameterListKind.values()) {
-            for (ParameterKind pk : ParameterKind.values()) {
-                for (ArrowKind ak : ArrowKind.values()) {
-                    for (ExprKind ek : ExprKind.values()) {
-                        new BadLambdaExpr(plk, pk, ak, ek).run(comp, fm);
+            for (ParameterListKind plk : ParameterListKind.values()) {
+                for (ParameterKind pk : ParameterKind.values()) {
+                    for (ArrowKind ak : ArrowKind.values()) {
+                        for (ExprKind ek : ExprKind.values()) {
+                            new BadLambdaExpr(plk, pk, ak, ek).run(comp, fm);
+                        }
                     }
                 }
             }
+            System.out.println("Total check executed: " + checkCount);
         }
-        System.out.println("Total check executed: " + checkCount);
     }
 
     ParameterListKind plk;