com.sun.source.util.Plugin Java Examples

The following examples show how to use com.sun.source.util.Plugin. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlatformProviderTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public List<PluginInfo<Plugin>> getPlugins() {
    return Arrays.asList(new PluginInfo<Plugin>() {
        @Override
        public String getName() {
            return "testPlugin";
        }
        @Override
        public Map<String, String> getOptions() {
            return Collections.singletonMap("testPluginKey", "testPluginValue");
        }
        @Override
        public Plugin getPlugin() {
            return new PluginImpl();
        }
    });
}
 
Example #2
Source File: JDKPlatformProvider.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public List<PluginInfo<Plugin>> getPlugins() {
    return Collections.emptyList();
}
 
Example #3
Source File: JDKPlatformProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public List<PluginInfo<Plugin>> getPlugins() {
    return Collections.emptyList();
}
 
Example #4
Source File: QueryBeforeEnter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void testTooSoon(Path base) throws Exception {
    Path src = base.resolve("src");

    tb.writeJavaFiles(src,
                      "package test; public class Test {}");

    Path out = base.resolve("out");

    Files.createDirectories(out);

    Path reg = base.resolve("reg");
    Path regFile = reg.resolve("META-INF").resolve("services").resolve(Plugin.class.getName());

    Files.createDirectories(regFile.getParent());

    try (OutputStream regOut = Files.newOutputStream(regFile)) {
        regOut.write(PluginImpl.class.getName().getBytes());
    }

    String processorPath = System.getProperty("test.class.path") + File.pathSeparator + reg.toString();

    JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
    Path testSource = src.resolve("test").resolve("Test.java");
    try (StandardJavaFileManager fm = javaCompiler.getStandardFileManager(null, null, null)) {
        com.sun.source.util.JavacTask task =
            (com.sun.source.util.JavacTask) javaCompiler.getTask(null,
                                                          null,
                                                          d -> { throw new IllegalStateException(d.toString()); },
                                                          Arrays.asList("--processor-path", processorPath,
                                                                        "-processor", AP.class.getName(),
                                                                        "-Xplugin:test"),
                                                          null,
                                                          fm.getJavaFileObjects(testSource));
        task.call();
    }

    Main.compile(new String[] {"--processor-path", processorPath,
                               "-Xplugin:test",
                               testSource.toString()});
}
 
Example #5
Source File: PlatformDescription.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**Returns the javac Plugins that should be enabled in the current javac run.
 *
 * @return javac Plugins
 */
List<PluginInfo<Plugin>> getPlugins();
 
Example #6
Source File: PlatformDescription.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**Returns the javac Plugins that should be enabled in the current javac run.
 *
 * @return javac Plugins
 */
List<PluginInfo<Plugin>> getPlugins();