1 /* |
1 /* |
2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2016, 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. |
47 JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); |
47 JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); |
48 try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { |
48 try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { |
49 String srcdir = System.getProperty("test.src"); |
49 String srcdir = System.getProperty("test.src"); |
50 File file = new File(srcdir, args[0]); |
50 File file = new File(srcdir, args[0]); |
51 List<String> options = Arrays.asList( |
51 List<String> options = Arrays.asList( |
52 "-XaddExports:jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" |
52 "--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" |
53 ); |
53 ); |
54 JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, fm, null, options, null, fm.getJavaFileObjectsFromFiles(Arrays.asList(file))); |
54 JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, fm, null, options, null, fm.getJavaFileObjectsFromFiles(Arrays.asList(file))); |
55 Elements elements = task.getElements(); |
55 Elements elements = task.getElements(); |
56 for (Element clazz : task.enter(task.parse())) { |
56 for (Element clazz : task.enter(task.parse())) { |
57 String doc = elements.getDocComment(clazz); |
57 String doc = elements.getDocComment(clazz); |