Return-Path: X-Original-To: apmail-ant-notifications-archive@minotaur.apache.org Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7DF8419EBD for ; Sat, 9 Apr 2016 11:39:32 +0000 (UTC) Received: (qmail 76579 invoked by uid 500); 9 Apr 2016 11:39:32 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 76450 invoked by uid 500); 9 Apr 2016 11:39:32 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 76436 invoked by uid 99); 9 Apr 2016 11:39:32 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Apr 2016 11:39:32 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 281E6DFA40; Sat, 9 Apr 2016 11:39:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bodewig@apache.org To: notifications@ant.apache.org Date: Sat, 09 Apr 2016 11:39:33 -0000 Message-Id: <6c722f1e84904957ae3b9ed10558c4bc@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/2] ant git commit: remove apt task, there is no apt tool in java8 remove apt task, there is no apt tool in java8 Project: http://git-wip-us.apache.org/repos/asf/ant/repo Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/afdf355c Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/afdf355c Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/afdf355c Branch: refs/heads/master Commit: afdf355c6570a12316d604254132491e64fcd4eb Parents: 3c930b9 Author: Stefan Bodewig Authored: Sat Apr 9 13:39:04 2016 +0200 Committer: Stefan Bodewig Committed: Sat Apr 9 13:39:04 2016 +0200 ---------------------------------------------------------------------- WHATSNEW | 3 + manual/Tasks/apt.html | 179 ------------ manual/tasklist.html | 1 - manual/tasksoverview.html | 6 - src/main/org/apache/tools/ant/taskdefs/Apt.java | 270 ------------------- .../taskdefs/compilers/AptCompilerAdapter.java | 187 ------------- .../compilers/AptExternalCompilerAdapter.java | 71 ----- .../tools/ant/taskdefs/defaults.properties | 1 - src/tests/antunit/taskdefs/apt/AptExample.java | 25 -- src/tests/antunit/taskdefs/apt/Distributed.java | 39 --- .../apt/DistributedAnnotationFactory.java | 50 ---- .../apt/DistributedAnnotationProcessor.java | 65 ----- 12 files changed, 3 insertions(+), 894 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/WHATSNEW ---------------------------------------------------------------------- diff --git a/WHATSNEW b/WHATSNEW index cbbdea9..4372dca 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -7,6 +7,9 @@ Changes that could break older environments: * Ant 1.10.x requires Java8 or newer at compile or build time. The 1.9.x series wil stay compatible with Java5. + * The task has been removed since apt itself has been removed + with Java8. + Fixed bugs: ----------- http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/manual/Tasks/apt.html ---------------------------------------------------------------------- diff --git a/manual/Tasks/apt.html b/manual/Tasks/apt.html deleted file mode 100644 index 4bdd9a9..0000000 --- a/manual/Tasks/apt.html +++ /dev/null @@ -1,179 +0,0 @@ - - - -Apt Task - - - -

Apt

-

Description

-

Runs the annotation processor tool (apt), and then optionally compiles - the original code, and any generated source code. -

This task runs on Java 1.5 to Java 1.7.

-

Apt is deprecated in Java 1.6, which can run annotation - processors as part of javac, and removed from the distribution in Java 1.8. - The task will fire an exception when attempting to run under Java 1.8.

- - -

This task inherits from the Javac Task, and thus - supports nearly all of the same attributes, and subelements. - There is one special case, the fork attribute, which is present - but which can only be set to true. That is, apt only works as - a forked process. -

-

- In addition, it supports - the following addition items:

- -

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
compileAfter running the Apt, should the code be compiled. (see the - -nocompile flag on the Apt executable)No, defaults to false.
factoryThe fully qualified classname of the AnnotationProcessFactory to be used - to construct annotation processors. This represents the -factory - command line flag of the Apt executable.No
factorypathrefThe reference id of the path used to find the classes needed by the - AnnotationProcessorFactory (and the location of the factory itself). - This represents the -factorypath flag on the Apt executable.No
preprocessdirThe directory used for preprocessing. This is the directory where the - generated source code will be place. This represents the -s flag on - the Apt executable.No
- -

Parameters specified as nested elements

- - -

factorypath

- -

You can specify the path used to find the classes needed by the AnnotationProcessorFactory - at runtime, using this element. It is represents as a generic path like structure. This - represents the -factorypath flag on the Apt executable.

- - -

option

- -

Used to represent a generic option to pass to Apt. This represents the -A flag on the - Apt executable. You can specify zero or more <option> elements.

- - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
nameThe name of the optionYes.
valueThe value to set the option toYes.
- -

Examples

-
-<apt srcdir="${src}"
-     destdir="${build}"
-     classpath="xyz.jar"
-     debug="on"
-     compile="true"
-     factory="com.mycom.MyAnnotationProcessorFactory"
-     factorypathref="my.factorypath.id"
-     preprocessdir="${preprocess.dir}">
-</apt>
-
-

compiles all .java files under the ${src} -directory, and stores -the .class files in the ${build} directory. -The classpath used includes xyz.jar, and compiling with -debug information is on. It also forces the generated source code to -be compiled. The generated source code will be placed in -${preprocess.dir} directory, using the class -com.mycom.MyAnnotationProcessorFactory to supply -AnnotationProcessor instances.

- - -

Notes

- -

-The inherited "fork" attribute is set to true by default; please do not change it. -

- -

-The inherited "compiler" attribute is ignored, as it is forced to use the Apt compiler -

- -

Using the Apt compiler with the "compile" option set to "true" - forces you to use Sun's Apt compiler, which will use the JDK's Javac compiler. - If you wish to use another compiler, you will first need run the Apt processor - with the "compile" flag set to "false", and then use a - <javac> task to compile first your original source code, and then the - generated source code:

- -
-<apt srcdir="${src}"
-     destdir="${build}"
-     classpath="xyz.jar"
-     debug="true"
-     compile="false"
-     factory="com.mycom.MyAnnotationProcessorFactory"
-     factorypathref="my.factorypath.id"
-     preprocessdir="${preprocess.dir}">
-</apt>
-
-<javac srcdir="${src}"
-       destdir="${build}"
-       classpath="xyz.jar"
-       debug="on"/>
-
-<javac srcdir="${preprocess.dir}"
-       destdir="${build}"
-       classpath="xyz.jar"
-       debug="true"/>
-
- -This may involve more build file coding, but the speedup gained from switching -to jikes may justify the effort. -

-

- - http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/manual/tasklist.html ---------------------------------------------------------------------- diff --git a/manual/tasklist.html b/manual/tasklist.html index 6578e55..003ba75 100644 --- a/manual/tasklist.html +++ b/manual/tasklist.html @@ -40,7 +40,6 @@
  • AntStructure
  • AntVersion
  • Apply/ExecOn
  • -
  • Apt
  • Attrib
  • Augment
  • Available
  • http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/manual/tasksoverview.html ---------------------------------------------------------------------- diff --git a/manual/tasksoverview.html b/manual/tasksoverview.html index 99aa11b..34b24fb 100644 --- a/manual/tasksoverview.html +++ b/manual/tasksoverview.html @@ -232,12 +232,6 @@ documentation.

    - Apt -

    Runs the annotation processor tool (apt), and then optionally compiles - the original code, and any generated source code.

    - - - JspC

    Runs the JSP compiler. It can be used to precompile JSP pages for fast initial invocation of JSP pages, deployment on a server without http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/main/org/apache/tools/ant/taskdefs/Apt.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/Apt.java b/src/main/org/apache/tools/ant/taskdefs/Apt.java deleted file mode 100644 index 52154a8..0000000 --- a/src/main/org/apache/tools/ant/taskdefs/Apt.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.tools.ant.taskdefs; - -import java.io.File; -import java.util.Vector; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.compilers.AptExternalCompilerAdapter; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; -import org.apache.tools.ant.util.JavaEnvUtils; - -/** - * Apt Task for running the Annotation processing tool for JDK 1.5. It derives - * from the existing Javac task, and forces the compiler based on whether we're - * executing internally, or externally. - * - * @since Ant 1.7 - */ - - -public class Apt - extends Javac { - private boolean compile = true; - private String factory; - private Path factoryPath; - private Vector

    The implementation of the apt compiler for JDK 1.5.

    - * - *

    As usual, the low level entry points for Java tools are neither documented or - * stable; this entry point may change from that of 1.5.0_01-b08 without any - * warning at all. The IDE decompile of the tool entry points is as follows:

    - *
    - * public class Main {
    - * public Main() ;
    - *
    - * public static transient void main(String... strings);
    - *
    - * public static transient int process(String... strings);
    - *
    - * public static transient int process(PrintWriter printWriter,
    - *      String... strings);
    - * public static transient int process(
    - *      AnnotationProcessorFactory annotationProcessorFactory,
    - *      String... strings);
    - *
    - * public static transient int process(
    - *      AnnotationProcessorFactory annotationProcessorFactory,
    - *      PrintWriter printWriter,
    - *      String... strings);
    - * private static transient int processing(
    - *      AnnotationProcessorFactory annotationProcessorFactory,
    - *      PrintWriter printWriter,
    - *      String... strings) ;
    - * }
    - * 
    - * - * This Adapter is designed to run Apt in-JVM, an option that is not actually - * exposed to end-users, because it was too brittle during beta testing; classpath - * problems being the core issue. - * - * @since Ant 1.7 - */ -public class AptCompilerAdapter extends DefaultCompilerAdapter { - - /** - * Integer returned by the Apt compiler to indicate success. - */ - private static final int APT_COMPILER_SUCCESS = 0; - /** - * class in tools.jar that implements APT - */ - public static final String APT_ENTRY_POINT = "com.sun.tools.apt.Main"; - - /** - * method used to compile. - */ - public static final String APT_METHOD_NAME = "process"; - - /** - * Get the facade task that fronts this adapter - * - * @return task instance - * @see DefaultCompilerAdapter#getJavac() - */ - protected Apt getApt() { - return (Apt) getJavac(); - } - - /** - * Using the front end arguments, set up the command line to run Apt - * - * @param apt task - * @param cmd command that is set up with the various switches from the task - * options - */ - static void setAptCommandlineSwitches(final Apt apt, final Commandline cmd) { - - if (!apt.isCompile()) { - cmd.createArgument().setValue("-nocompile"); - } - - // Process the factory class - final String factory = apt.getFactory(); - if (factory != null) { - cmd.createArgument().setValue("-factory"); - cmd.createArgument().setValue(factory); - } - - // Process the factory path - final Path factoryPath = apt.getFactoryPath(); - if (factoryPath != null) { - cmd.createArgument().setValue("-factorypath"); - cmd.createArgument().setPath(factoryPath); - } - - final File preprocessDir = apt.getPreprocessDir(); - if (preprocessDir != null) { - cmd.createArgument().setValue("-s"); - cmd.createArgument().setFile(preprocessDir); - } - - // Process the processor options - final Vector options = apt.getOptions(); - final Enumeration elements = options.elements(); - Apt.Option opt; - StringBuffer arg = null; - while (elements.hasMoreElements()) { - opt = (Apt.Option) elements.nextElement(); - arg = new StringBuffer(); - arg.append("-A").append(opt.getName()); - if (opt.getValue() != null) { - arg.append("=").append(opt.getValue()); - } - cmd.createArgument().setValue(arg.toString()); - } - } - - /** - * using our front end task, set up the command line switches - * - * @param cmd command line to set up - */ - protected void setAptCommandlineSwitches(final Commandline cmd) { - final Apt apt = getApt(); - setAptCommandlineSwitches(apt, cmd); - } - - /** - * Run the compilation. - * @return true on success. - * @throws BuildException if the compilation has problems. - */ - public boolean execute() throws BuildException { - attributes.log("Using apt compiler", Project.MSG_VERBOSE); - //set up the javac options - final Commandline cmd = setupModernJavacCommand(); - //then add the Apt options - setAptCommandlineSwitches(cmd); - - //finally invoke APT - // Use reflection to be able to build on all JDKs: - try { - final Class c = Class.forName(APT_ENTRY_POINT); - final Object compiler = c.newInstance(); - final Method compile = c.getMethod(APT_METHOD_NAME, - new Class[]{(new String[]{}).getClass()}); - final int result = ((Integer) compile.invoke - (compiler, new Object[]{cmd.getArguments()})) - .intValue(); - return (result == APT_COMPILER_SUCCESS); - } catch (final BuildException be) { - //rethrow build exceptions - throw be; - } catch (final Exception ex) { - //cast everything else to a build exception - throw new BuildException("Error starting apt compiler", - ex, location); - } - } -} http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/main/org/apache/tools/ant/taskdefs/compilers/AptExternalCompilerAdapter.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/AptExternalCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/AptExternalCompilerAdapter.java deleted file mode 100644 index dadb55b..0000000 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/AptExternalCompilerAdapter.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.tools.ant.taskdefs.compilers; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.Apt; -import org.apache.tools.ant.types.Commandline; - -/** - * The implementation of the apt compiler for JDK 1.5 using an external process - * - * @since Ant 1.7 - */ -public class AptExternalCompilerAdapter extends DefaultCompilerAdapter { - - - /** - * Get the facade task that fronts this adapter - * - * @return task instance - * @see DefaultCompilerAdapter#getJavac() - */ - protected Apt getApt() { - return (Apt) getJavac(); - } - - /** - * Performs a compile using the Javac externally. - * @return true the compilation was successful. - * @throws BuildException if there is a problem. - */ - public boolean execute() throws BuildException { - attributes.log("Using external apt compiler", Project.MSG_VERBOSE); - - - // Setup the apt executable - Apt apt = getApt(); - Commandline cmd = new Commandline(); - cmd.setExecutable(apt.getAptExecutable()); - setupModernJavacCommandlineSwitches(cmd); - AptCompilerAdapter.setAptCommandlineSwitches(apt, cmd); - int firstFileName = cmd.size(); - //add the files - logAndAddFilesToCompile(cmd); - - //run - return 0 == executeExternalCompile(cmd.getCommandline(), - firstFileName, - true); - - } - -} - http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/main/org/apache/tools/ant/taskdefs/defaults.properties ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/defaults.properties b/src/main/org/apache/tools/ant/taskdefs/defaults.properties index 9cf1499..e1022fb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/defaults.properties +++ b/src/main/org/apache/tools/ant/taskdefs/defaults.properties @@ -19,7 +19,6 @@ antcall=org.apache.tools.ant.taskdefs.CallTarget antstructure=org.apache.tools.ant.taskdefs.AntStructure antversion=org.apache.tools.ant.taskdefs.condition.AntVersion apply=org.apache.tools.ant.taskdefs.Transform -apt=org.apache.tools.ant.taskdefs.Apt attributenamespacedef=org.apache.tools.ant.taskdefs.AttributeNamespaceDef augment=org.apache.tools.ant.taskdefs.AugmentReference available=org.apache.tools.ant.taskdefs.Available http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/tests/antunit/taskdefs/apt/AptExample.java ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/apt/AptExample.java b/src/tests/antunit/taskdefs/apt/AptExample.java deleted file mode 100644 index 9d6fcba..0000000 --- a/src/tests/antunit/taskdefs/apt/AptExample.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -/** - */ -@Distributed( - protocol="CORBA", - distribution=Distributed.DistributionTypes.FEDERATED - ) -public class AptExample { -} http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/tests/antunit/taskdefs/apt/Distributed.java ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/apt/Distributed.java b/src/tests/antunit/taskdefs/apt/Distributed.java deleted file mode 100644 index ebc3467..0000000 --- a/src/tests/antunit/taskdefs/apt/Distributed.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -import java.lang.annotation.Annotation; -import java.lang.annotation.Target; -import java.lang.annotation.Retention; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.RetentionPolicy; - -/** - */ -@Documented -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = ElementType.TYPE) -public @interface Distributed { - - public DistributionTypes distribution() default DistributionTypes.LOCAL; - - public String protocol() default "RMI"; - - public enum DistributionTypes { SINGLETON, LOCAL, FAULT_TOLERANT, FEDERATED, MOBILE}; - - -} http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/tests/antunit/taskdefs/apt/DistributedAnnotationFactory.java ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/apt/DistributedAnnotationFactory.java b/src/tests/antunit/taskdefs/apt/DistributedAnnotationFactory.java deleted file mode 100644 index a8fb633..0000000 --- a/src/tests/antunit/taskdefs/apt/DistributedAnnotationFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -import com.sun.mirror.apt.AnnotationProcessorFactory; -import com.sun.mirror.apt.AnnotationProcessor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; - -import java.util.Collection; -import java.util.Set; -import java.util.Arrays; -import java.util.Collections; - - -/** - * This was the first piece of Java1.5 code in the source tree. - * @since 20050-03-09T21:29:25Z - */ -public class DistributedAnnotationFactory implements AnnotationProcessorFactory { - - private static final Collection supportedAnnotations - = Collections.unmodifiableCollection(Arrays.asList("*")); - - public Collection supportedOptions() { - return Collections.emptySet(); - } - - public Collection supportedAnnotationTypes() { - return supportedAnnotations; - } - - public AnnotationProcessor getProcessorFor( - Set annotationTypeDeclarations, - AnnotationProcessorEnvironment env) { - return new DistributedAnnotationProcessor(env); - } -} http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/tests/antunit/taskdefs/apt/DistributedAnnotationProcessor.java ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/apt/DistributedAnnotationProcessor.java b/src/tests/antunit/taskdefs/apt/DistributedAnnotationProcessor.java deleted file mode 100644 index f94ff7f..0000000 --- a/src/tests/antunit/taskdefs/apt/DistributedAnnotationProcessor.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -//found in tools.jar, not the JRE runtime. -import com.sun.mirror.apt.AnnotationProcessor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.mirror.declaration.ClassDeclaration; -import com.sun.mirror.util.SimpleDeclarationVisitor; -import static com.sun.mirror.util.DeclarationVisitors.*; - -import java.util.Map; - -/** - * Annotation processor outputs stuff - */ - -public class DistributedAnnotationProcessor implements AnnotationProcessor { - - public AnnotationProcessorEnvironment env; - - public DistributedAnnotationProcessor(AnnotationProcessorEnvironment env) { - this.env = env; - } - - public void echo(String text) { - env.getMessager().printNotice(text); - } - - public void process() { - echo("DistributedAnnotationProcessor-is-go"); - - Map options=env.getOptions(); - for(String key:options.keySet()) { - echo("Option ["+key+"] = "+options.get(key)); - } - - //work time - for (TypeDeclaration typeDecl : env.getSpecifiedTypeDeclarations()) { - typeDecl.accept(getDeclarationScanner(new ClassVisitor(), - NO_OP)); - } - } - - private class ClassVisitor extends SimpleDeclarationVisitor { - public void visitClassDeclaration(ClassDeclaration d) { - echo("visiting "+ d.getQualifiedName()); - } - } -}