changeset 120:5719406459e9

Purge MicroBenchmark annotation.
author shade
date Sat, 17 Aug 2013 17:06:50 +0400
parents f321a6407e5a
children 7a748398603b
files jmh-core/src/main/java/org/openjdk/jmh/annotations/MicroBenchmark.java jmh-core/src/main/java/org/openjdk/jmh/processor/internal/MicroBenchmarkProcessor.java jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandlers.java jmh-core/src/main/resources/META-INF/services/javax.annotation.processing.Processor
diffstat 4 files changed, 1 insertions(+), 134 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/annotations/MicroBenchmark.java	Sat Aug 17 16:08:45 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.jmh.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marks the microbenchmark method.
- * <p>
- * This annotation is low level and should not be used for most microbenchmarks,
- * as the method contract for {@link MicroBenchmark} is considered to be the part of
- * internal API and subject to change without notice. Use {@link GenerateMicroBenchmark} to generate portable microbenchmarks instead.
- * <p>
- * @author Staffan Friberg
- * @author Anders Astrand
- * @author Aleksey Shipilev
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-@Deprecated
-public @interface MicroBenchmark {
-
-    /**
-     * Type of benchmark.
-     * See {@link Mode} for available benchmark types.
-     */
-    Mode value() default Mode.Throughput;
-
-}
--- a/jmh-core/src/main/java/org/openjdk/jmh/processor/internal/MicroBenchmarkProcessor.java	Sat Aug 17 16:08:45 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.jmh.processor.internal;
-
-import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
-import org.openjdk.jmh.annotations.MicroBenchmark;
-
-import javax.annotation.processing.AbstractProcessor;
-import javax.annotation.processing.RoundEnvironment;
-import javax.annotation.processing.SupportedSourceVersion;
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.TypeElement;
-import javax.tools.Diagnostic.Kind;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/** @author staffan.friberg@oracle.com */
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
-public class MicroBenchmarkProcessor extends AbstractProcessor {
-
-    @Override
-    public Set<String> getSupportedAnnotationTypes() {
-        return Collections.singleton(MicroBenchmark.class.getName());
-    }
-
-    /**
-     * Process all method annotated with MicroBenchmark and add them to the list of available microbenchmarks.
-     * <p/>
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
-        try {
-            if (!roundEnv.processingOver()) {
-                // Still processing add all annotated methods to the set
-                for (TypeElement annotation : annotations) {
-                    for (Element element : roundEnv.getElementsAnnotatedWith(annotation)) {
-                        processingEnv.getMessager().printMessage(Kind.ERROR,
-                                "The " + MicroBenchmark.class.getSimpleName()
-                                        + " annotation is detected. This is not the supported API anymore. \n"
-                                        + "Please migrate to @" + GenerateMicroBenchmark.class.getSimpleName() + ".\n"
-                                        + element.getEnclosingElement() + '.' + element.toString());
-                    }
-                }
-            }
-        } catch (Throwable t) {
-            processingEnv.getMessager().printMessage(Kind.ERROR, "Annotation processor had throw exception: " + t);
-            t.printStackTrace(System.err);
-        }
-        return true;
-    }
-
-}
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandlers.java	Sat Aug 17 16:08:45 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandlers.java	Sat Aug 17 17:06:50 2013 +0400
@@ -24,7 +24,6 @@
  */
 package org.openjdk.jmh.runner;
 
-import org.openjdk.jmh.annotations.MicroBenchmark;
 import org.openjdk.jmh.logic.InfraControl;
 import org.openjdk.jmh.logic.results.Result;
 import org.openjdk.jmh.output.format.OutputFormat;
@@ -58,7 +57,7 @@
                     }
                     method = m;
                 } else {
-                    throw new IllegalArgumentException("MicroBenchmark parameters does not match the signature contract, see the " + MicroBenchmark.class + " documentation");
+                    throw new IllegalArgumentException("MicroBenchmark parameters does not match the signature contract.");
                 }
             }
         }
--- a/jmh-core/src/main/resources/META-INF/services/javax.annotation.processing.Processor	Sat Aug 17 16:08:45 2013 +0400
+++ b/jmh-core/src/main/resources/META-INF/services/javax.annotation.processing.Processor	Sat Aug 17 17:06:50 2013 +0400
@@ -21,7 +21,6 @@
 #    or visit www.oracle.com if you need additional information or have any
 #    questions.
 #
-org.openjdk.jmh.processor.internal.MicroBenchmarkProcessor
 org.openjdk.jmh.processor.internal.GenerateMicroBenchmarkProcessor
 org.openjdk.jmh.processor.internal.HelperMethodValidationProcessor
 org.openjdk.jmh.processor.internal.CompilerControlProcessor