8004961: rename Plugin.call to Plugin.init

Reviewed-by: mcimadamore
This commit is contained in:
Jonathan Gibbons 2012-12-17 10:55:40 -08:00
parent 08823b6103
commit 3ce1d65326
4 changed files with 23 additions and 24 deletions

View File

@ -56,9 +56,9 @@ public interface Plugin {
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 args Arguments, if any, for the plug-in
*/
void call(JavacTask task, String... args);
void init(JavacTask task, String... args);
}

View File

@ -448,7 +448,7 @@ public class Main {
try {
if (task == null)
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) {
if (apiMode)
throw new RuntimeException(ex);

View File

@ -41,7 +41,7 @@ public class ShowTypePlugin implements Plugin {
return "showtype";
}
public void call(JavacTask task, String... args) {
public void init(JavacTask task, String... args) {
Pattern pattern = null;
if (args.length == 1)
pattern = Pattern.compile(args[0]);

View File

@ -1,22 +1,3 @@
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.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@ -42,10 +23,28 @@ import javax.tools.ToolProvider;
/**
* @test
* @bug 8001098
* @bug 8001098 8004961
* @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 static void main(String... args) throws Exception {
new Test().run();