langtools/test/jdk/javadoc/tool/sourceOnly/p/SourceOnly.java
author ksrini
Wed, 10 Aug 2016 16:19:09 -0700
changeset 40310 a979695d72a1
parent 35426 374342e56a56
child 40508 74ef30d16fb9
permissions -rw-r--r--
8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
40310
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
     2
 * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
diff changeset
    21
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
package p;
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
40310
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    26
import java.util.Arrays;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    27
import java.util.Collections;
40310
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    28
import java.util.Locale;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    29
import java.util.Set;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    30
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    31
import javax.lang.model.SourceVersion;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    32
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    33
import jdk.javadoc.doclet.Doclet;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    34
import jdk.javadoc.doclet.DocletEnvironment;
40310
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    35
import jdk.javadoc.doclet.Reporter;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    36
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
/** Test that when running javadoc on a package, we only get
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 *  documentation for those classes for which source was provided.
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    40
public class SourceOnly implements Doclet {
40310
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    41
    NonSource dependency; // force a compilation error if not on classpath.
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    42
    @Override
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    43
    public boolean run(DocletEnvironment root) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    44
        if (root.getIncludedClasses().size() != 1)
40310
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    45
            throw new Error("wrong set of classes documented: " +
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    46
                    Arrays.asList(root.getIncludedClasses()));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    49
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    50
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    51
    public String getName() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    52
        return "Test";
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    53
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    54
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    55
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    56
    public Set<Option> getSupportedOptions() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    57
        return Collections.emptySet();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    58
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    59
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    60
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    61
    public SourceVersion getSupportedSourceVersion() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    62
        return SourceVersion.latest();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 5520
diff changeset
    63
    }
40310
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    64
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    65
    @Override
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    66
    public void init(Locale locale, Reporter reporter) {
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    67
        // do nothing
a979695d72a1 8152054: fix @ignored langtools/test/jdk/javadoc/tool/ tests
ksrini
parents: 35426
diff changeset
    68
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
}