HADOOP-13544. JDiff reports unncessarily show unannotated APIs and cause confusion while our javadocs only show annotated and public APIs. (vinodkv via wangda)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/875062b5 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/875062b5 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/875062b5 Branch: refs/heads/HDFS-10467 Commit: 875062b5bc789158290bf93dadc71b5328ca4fee Parents: 8ae4729 Author: Wangda Tan <wan...@apache.org> Authored: Tue Sep 27 11:26:45 2016 -0700 Committer: Wangda Tan <wan...@apache.org> Committed: Tue Sep 27 11:26:45 2016 -0700 ---------------------------------------------------------------------- .../IncludePublicAnnotationsJDiffDoclet.java | 64 + .../jdiff/Apache_Hadoop_Common_2.7.2.xml | 41149 ++++++----------- .../jdiff/Apache_Hadoop_HDFS_2.7.2.xml | 21704 +-------- .../Apache_Hadoop_MapReduce_Common_2.7.2.xml | 727 +- .../Apache_Hadoop_MapReduce_Core_2.7.2.xml | 7059 +-- .../Apache_Hadoop_MapReduce_JobClient_2.7.2.xml | 962 +- .../hadoop-mapreduce-client/pom.xml | 4 +- hadoop-project-dist/pom.xml | 4 +- .../jdiff/Apache_Hadoop_YARN_API_2.7.2.xml | 530 +- .../jdiff/Apache_Hadoop_YARN_Client_2.7.2.xml | 613 +- .../jdiff/Apache_Hadoop_YARN_Common_2.7.2.xml | 1185 +- .../Apache_Hadoop_YARN_Server_Common_2.7.2.xml | 1056 +- hadoop-yarn-project/hadoop-yarn/pom.xml | 4 +- 13 files changed, 16499 insertions(+), 58562 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/875062b5/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/tools/IncludePublicAnnotationsJDiffDoclet.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/tools/IncludePublicAnnotationsJDiffDoclet.java b/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/tools/IncludePublicAnnotationsJDiffDoclet.java new file mode 100644 index 0000000..91b3a9d --- /dev/null +++ b/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/tools/IncludePublicAnnotationsJDiffDoclet.java @@ -0,0 +1,64 @@ +/* + * 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.hadoop.classification.tools; + +import com.sun.javadoc.DocErrorReporter; +import com.sun.javadoc.LanguageVersion; +import com.sun.javadoc.RootDoc; + +import jdiff.JDiff; + +/** + * A <a href="http://java.sun.com/javase/6/docs/jdk/api/javadoc/doclet/">Doclet</a> + * that only includes class-level elements that are annotated with + * {@link org.apache.hadoop.classification.InterfaceAudience.Public}. + * Class-level elements with no annotation are excluded. + * In addition, all elements that are annotated with + * {@link org.apache.hadoop.classification.InterfaceAudience.Private} or + * {@link org.apache.hadoop.classification.InterfaceAudience.LimitedPrivate} + * are also excluded. + * It delegates to the JDiff Doclet, and takes the same options. + */ +public class IncludePublicAnnotationsJDiffDoclet { + + public static LanguageVersion languageVersion() { + return LanguageVersion.JAVA_1_5; + } + + public static boolean start(RootDoc root) { + System.out.println( + IncludePublicAnnotationsJDiffDoclet.class.getSimpleName()); + RootDocProcessor.treatUnannotatedClassesAsPrivate = true; + return JDiff.start(RootDocProcessor.process(root)); + } + + public static int optionLength(String option) { + Integer length = StabilityOptions.optionLength(option); + if (length != null) { + return length; + } + return JDiff.optionLength(option); + } + + public static boolean validOptions(String[][] options, + DocErrorReporter reporter) { + StabilityOptions.validOptions(options, reporter); + String[][] filteredOptions = StabilityOptions.filterOptions(options); + return JDiff.validOptions(filteredOptions, reporter); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org