langtools/test/tools/javac/EmptyDocComments.java
author jeff
Wed, 22 Jun 2011 10:10:54 -0700
changeset 9916 c35ecac744a5
parent 5520 86e4b9a9da40
permissions -rw-r--r--
7057046: Add embedded license to THIRD PARTY README Reviewed-by: lana
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     2
 * Copyright (c) 1999, 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: 10
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
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
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
 * @test
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
 * @bug 4160204 4234488
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
 * @summary Create empty javadoc comments and verify that javac does not crash.
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
 * @compile EmptyDocComments.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
// WARNING: This file intentionally contains whitespace characters at the end of
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
// some lines.  Do not delete them!
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
// If this file fails to compile, then the test has failed.  The test does not
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
// need to be run.
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
public class EmptyDocComments
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
{
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
    public static void Main(String [] args)
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
    // Verify that empty doc comments don't cause a crash.
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
     *  */
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
    public static void emptyDocComment0()
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
        System.out.println("javadoc comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
        System.out.println("- contains whitespace");
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
        System.out.println("- ends on same line as potential comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
     ***/
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
    public static void emptyDocComment1()
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
        System.out.println("javadoc comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
        System.out.println("- contains nothing");
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
        System.out.println("- ends on same line as potential comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
    /** */
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    public static void emptyDocComment2()
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
        System.out.println("javadoc comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
        System.out.println("- contains whitespace");
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
        System.out.println("- ends on same line as comment start");
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
      *
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
      */
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    public static void emptyDocComment3()
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
        System.out.println("javadoc comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
        System.out.println("- contains whitespace");
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
        System.out.println("- ends on new line ");
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    /***/
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    public static void emptyDocComment4()
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
        System.out.println("minimal javadoc comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
        System.out.println("- contains nothing");
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
        System.out.println("- ends on same line as comment start");
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    /**/
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    public static void emptyDocComment5()
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
        System.out.println("minimal _java_ comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
        System.out.println("- contains nothing");
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
        System.out.println("- ends on same line as comment start");
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    /** **** */
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
    public static void emptyDocComment6()
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
        System.out.println("javadoc comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
        System.out.println("- contains \"*\"");
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
        System.out.println("- ends on same line as comment start");
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    // Verify that we properly handle very small, non-empty comments.
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    /** a */
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
    public static void singleChar0()
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
        System.out.println("javadoc comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
        System.out.println("- contains a single character");
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
        System.out.println("- ends on same line as comment start");
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     * a      */
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    public static void singleChar1()
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
        System.out.println("javadoc comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        System.out.println("- contains a single character and trailing whitespace");
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        System.out.println("- ends on same line as potential comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     * a
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    public static void singleChar2()
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
        System.out.println("javadoc comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
        System.out.println("- contains a single character, no trailing whitespace");
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
        System.out.println("- ends on new line ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
       a
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
    public static void singleChar3()
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    {
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
        System.out.println("javadoc comment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
        System.out.println("- contains a single character and trailing whitespace");
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
        System.out.println("- ends on new line ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
}