test/tools/javac/EmptyDocComments.java

changeset 1
9a66ca7c79fa
child 554
9d9f26857129
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/EmptyDocComments.java	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,143 @@
     1.4 +/*
     1.5 + * Copyright 1999 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 + * have any questions.
    1.25 + */
    1.26 +
    1.27 +/**
    1.28 + * @test
    1.29 + * @bug 4160204 4234488
    1.30 + * @summary Create empty javadoc comments and verify that javac does not crash.
    1.31 + * @compile EmptyDocComments.java
    1.32 + */
    1.33 +
    1.34 +// WARNING: This file intentionally contains whitespace characters at the end of
    1.35 +// some lines.  Do not delete them!
    1.36 +
    1.37 +// If this file fails to compile, then the test has failed.  The test does not
    1.38 +// need to be run.
    1.39 +
    1.40 +public class EmptyDocComments
    1.41 +{
    1.42 +    public static void Main(String [] args)
    1.43 +    {
    1.44 +    }
    1.45 +
    1.46 +    // Verify that empty doc comments don't cause a crash.
    1.47 +
    1.48 +    /**
    1.49 +     *  */
    1.50 +    public static void emptyDocComment0()
    1.51 +    {
    1.52 +        System.out.println("javadoc comment");
    1.53 +        System.out.println("- contains whitespace");
    1.54 +        System.out.println("- ends on same line as potential comment");
    1.55 +    }
    1.56 +
    1.57 +    /**
    1.58 +     ***/
    1.59 +    public static void emptyDocComment1()
    1.60 +    {
    1.61 +        System.out.println("javadoc comment");
    1.62 +        System.out.println("- contains nothing");
    1.63 +        System.out.println("- ends on same line as potential comment");
    1.64 +    }
    1.65 +
    1.66 +    /** */
    1.67 +    public static void emptyDocComment2()
    1.68 +    {
    1.69 +        System.out.println("javadoc comment");
    1.70 +        System.out.println("- contains whitespace");
    1.71 +        System.out.println("- ends on same line as comment start");
    1.72 +    }
    1.73 +
    1.74 +    /**
    1.75 +      *
    1.76 +      */
    1.77 +    public static void emptyDocComment3()
    1.78 +    {
    1.79 +        System.out.println("javadoc comment");
    1.80 +        System.out.println("- contains whitespace");
    1.81 +        System.out.println("- ends on new line ");
    1.82 +    }
    1.83 +
    1.84 +    /***/
    1.85 +    public static void emptyDocComment4()
    1.86 +    {
    1.87 +        System.out.println("minimal javadoc comment");
    1.88 +        System.out.println("- contains nothing");
    1.89 +        System.out.println("- ends on same line as comment start");
    1.90 +    }
    1.91 +
    1.92 +    /**/
    1.93 +    public static void emptyDocComment5()
    1.94 +    {
    1.95 +        System.out.println("minimal _java_ comment");
    1.96 +        System.out.println("- contains nothing");
    1.97 +        System.out.println("- ends on same line as comment start");
    1.98 +    }
    1.99 +
   1.100 +    /** **** */
   1.101 +    public static void emptyDocComment6()
   1.102 +    {
   1.103 +        System.out.println("javadoc comment");
   1.104 +        System.out.println("- contains \"*\"");
   1.105 +        System.out.println("- ends on same line as comment start");
   1.106 +    }
   1.107 +
   1.108 +    // Verify that we properly handle very small, non-empty comments.
   1.109 +
   1.110 +    /** a */
   1.111 +    public static void singleChar0()
   1.112 +    {
   1.113 +        System.out.println("javadoc comment");
   1.114 +        System.out.println("- contains a single character");
   1.115 +        System.out.println("- ends on same line as comment start");
   1.116 +    }
   1.117 +
   1.118 +    /**
   1.119 +     * a      */
   1.120 +    public static void singleChar1()
   1.121 +    {
   1.122 +        System.out.println("javadoc comment");
   1.123 +        System.out.println("- contains a single character and trailing whitespace");
   1.124 +        System.out.println("- ends on same line as potential comment");
   1.125 +    }
   1.126 +
   1.127 +    /**
   1.128 +     * a
   1.129 +     */
   1.130 +    public static void singleChar2()
   1.131 +    {
   1.132 +        System.out.println("javadoc comment");
   1.133 +        System.out.println("- contains a single character, no trailing whitespace");
   1.134 +        System.out.println("- ends on new line ");
   1.135 +    }
   1.136 +
   1.137 +    /**
   1.138 +       a
   1.139 +     */
   1.140 +    public static void singleChar3()
   1.141 +    {
   1.142 +        System.out.println("javadoc comment");
   1.143 +        System.out.println("- contains a single character and trailing whitespace");
   1.144 +        System.out.println("- ends on new line ");
   1.145 +    }
   1.146 +}

mercurial