langtools/test/tools/javadoc/sourceOption/SourceOption.java
author jjg
Wed, 15 Oct 2008 08:07:59 -0700
changeset 1475 19c0851667ca
parent 813 ab91293d33f4
child 1652 1324f96f3883
permissions -rw-r--r--
6748541: javadoc should be reusable Reviewed-by: bpatel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
813
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
     1
/*
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
     2
 * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
     4
 *
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
     8
 *
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    13
 * accompanied this code).
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    14
 *
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    18
 *
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    21
 * have any questions.
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    22
 */
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    23
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    24
/*
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    25
 * @test
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    26
 * @bug     6507179
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    27
 * @summary Ensure that "-source" option isn't ignored.
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    28
 * @author  Scott Seligman
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    29
 */
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    30
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    31
import com.sun.javadoc.*;
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    32
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    33
public class SourceOption extends Doclet {
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    34
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    35
    public static void main(String[] args) {
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    36
        if (com.sun.tools.javadoc.Main.execute(
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    37
                "javadoc",
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    38
                "SourceOption",
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 813
diff changeset
    39
                SourceOption.class.getClassLoader(),
813
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    40
                new String[] {"-source", "1.3", "p"}) != 0)
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    41
            throw new Error("Javadoc encountered warnings or errors.");
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    42
    }
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    43
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    44
    public static boolean start(RootDoc root) {
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    45
        root.classes();         // force parser into action
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    46
        return true;
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    47
    }
ab91293d33f4 6507179: javadoc -source 1.3 does not work with jdk6
jjg
parents:
diff changeset
    48
}