1 /* |
1 /* |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
54 * |
54 * |
55 * Some methods are not invoked from the compiler, and are excluded from the test. |
55 * Some methods are not invoked from the compiler, and are excluded from the test. |
56 */ |
56 */ |
57 void run() throws Exception { |
57 void run() throws Exception { |
58 JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); |
58 JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); |
59 defaultFileManager = compiler.getStandardFileManager(null, null, null); |
59 try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { |
60 |
60 defaultFileManager = fm; |
61 for (Method m: getMethodsExcept(JavaFileManager.class, "close", "getJavaFileForInput")) { |
61 |
62 test(m); |
62 for (Method m: getMethodsExcept(JavaFileManager.class, "close", "getJavaFileForInput")) { |
63 } |
63 test(m); |
64 |
64 } |
65 for (Method m: getMethodsExcept(FileObject.class, "delete")) { |
65 |
66 test(m); |
66 for (Method m: getMethodsExcept(FileObject.class, "delete")) { |
67 } |
67 test(m); |
68 |
68 } |
69 for (Method m: getMethods(JavaFileObject.class)) { |
69 |
70 test(m); |
70 for (Method m: getMethods(JavaFileObject.class)) { |
71 } |
71 test(m); |
72 |
72 } |
73 for (Method m: getMethodsExcept(Processor.class, "getCompletions")) { |
73 |
74 test(m); |
74 for (Method m: getMethodsExcept(Processor.class, "getCompletions")) { |
75 } |
75 test(m); |
76 |
76 } |
77 for (Method m: DiagnosticListener.class.getDeclaredMethods()) { |
77 |
78 test(m); |
78 for (Method m: DiagnosticListener.class.getDeclaredMethods()) { |
79 } |
79 test(m); |
80 |
80 } |
81 for (Method m: TaskListener.class.getDeclaredMethods()) { |
81 |
82 test(m); |
82 for (Method m: TaskListener.class.getDeclaredMethods()) { |
83 } |
83 test(m); |
84 |
84 } |
85 if (errors > 0) |
85 |
86 throw new Exception(errors + " errors occurred"); |
86 if (errors > 0) |
|
87 throw new Exception(errors + " errors occurred"); |
|
88 } |
87 } |
89 } |
88 |
90 |
89 /** Get a sorted set of the methods declared on a class. */ |
91 /** Get a sorted set of the methods declared on a class. */ |
90 Set<Method> getMethods(Class<?> clazz) { |
92 Set<Method> getMethods(Class<?> clazz) { |
91 return getMethodsExcept(clazz, new String[0]); |
93 return getMethodsExcept(clazz, new String[0]); |