--- a/langtools/test/tools/javac/api/T6358786.java Wed Oct 29 12:09:17 2014 +0100
+++ b/langtools/test/tools/javac/api/T6358786.java Wed Oct 29 17:25:23 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -44,16 +44,17 @@
public class T6358786 {
public static void main(String... args) throws IOException {
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
- StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
- String srcdir = System.getProperty("test.src");
- File file = new File(srcdir, args[0]);
- JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, fm, null, null, null, fm.getJavaFileObjectsFromFiles(Arrays.asList(file)));
- Elements elements = task.getElements();
- for (TypeElement clazz : task.enter(task.parse())) {
- String doc = elements.getDocComment(clazz);
- if (doc == null)
- throw new AssertionError(clazz.getSimpleName() + ": no doc comment");
- System.out.format("%s: %s%n", clazz.getSimpleName(), doc);
+ try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
+ String srcdir = System.getProperty("test.src");
+ File file = new File(srcdir, args[0]);
+ JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, fm, null, null, null, fm.getJavaFileObjectsFromFiles(Arrays.asList(file)));
+ Elements elements = task.getElements();
+ for (TypeElement clazz : task.enter(task.parse())) {
+ String doc = elements.getDocComment(clazz);
+ if (doc == null)
+ throw new AssertionError(clazz.getSimpleName() + ": no doc comment");
+ System.out.format("%s: %s%n", clazz.getSimpleName(), doc);
+ }
}
}
}