提交 8cfe3bfc 编写于 作者: J jjg

8004961: rename Plugin.call to Plugin.init

Reviewed-by: mcimadamore
上级 d1df4972
...@@ -56,9 +56,9 @@ public interface Plugin { ...@@ -56,9 +56,9 @@ public interface Plugin {
String getName(); String getName();
/** /**
* Invoke the plug-in for a given compilation task. * Initialize the plug-in for a given compilation task.
* @param task The compilation task that has just been started * @param task The compilation task that has just been started
* @param args Arguments, if any, for the plug-in * @param args Arguments, if any, for the plug-in
*/ */
void call(JavacTask task, String... args); void init(JavacTask task, String... args);
} }
...@@ -448,7 +448,7 @@ public class Main { ...@@ -448,7 +448,7 @@ public class Main {
try { try {
if (task == null) if (task == null)
task = JavacTask.instance(pEnv); task = JavacTask.instance(pEnv);
plugin.call(task, p.tail.toArray(new String[p.tail.size()])); plugin.init(task, p.tail.toArray(new String[p.tail.size()]));
} catch (Throwable ex) { } catch (Throwable ex) {
if (apiMode) if (apiMode)
throw new RuntimeException(ex); throw new RuntimeException(ex);
......
...@@ -41,7 +41,7 @@ public class ShowTypePlugin implements Plugin { ...@@ -41,7 +41,7 @@ public class ShowTypePlugin implements Plugin {
return "showtype"; return "showtype";
} }
public void call(JavacTask task, String... args) { public void init(JavacTask task, String... args) {
Pattern pattern = null; Pattern pattern = null;
if (args.length == 1) if (args.length == 1)
pattern = Pattern.compile(args[0]); pattern = Pattern.compile(args[0]);
......
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import javax.tools.ToolProvider;
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
...@@ -42,10 +23,28 @@ import javax.tools.ToolProvider; ...@@ -42,10 +23,28 @@ import javax.tools.ToolProvider;
/** /**
* @test * @test
* @bug 8001098 * @bug 8001098 8004961
* @summary Provide a simple light-weight "plug-in" mechanism for javac * @summary Provide a simple light-weight "plug-in" mechanism for javac
*/ */
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import javax.tools.ToolProvider;
public class Test { public class Test {
public static void main(String... args) throws Exception { public static void main(String... args) throws Exception {
new Test().run(); new Test().run();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册