240N/A/*
2362N/A * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
240N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
240N/A *
240N/A * This code is free software; you can redistribute it and/or modify it
240N/A * under the terms of the GNU General Public License version 2 only, as
240N/A * published by the Free Software Foundation.
240N/A *
240N/A * This code is distributed in the hope that it will be useful, but WITHOUT
240N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
240N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
240N/A * version 2 for more details (a copy is included in the LICENSE file that
240N/A * accompanied this code).
240N/A *
240N/A * You should have received a copy of the GNU General Public License version
240N/A * 2 along with this work; if not, write to the Free Software Foundation,
240N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
240N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
240N/A */
240N/A
240N/A/**
240N/A * @test
240N/A * @bug 4160204 4234488
240N/A * @summary Create empty javadoc comments and verify that javac does not crash.
240N/A * @compile EmptyDocComments.java
240N/A */
240N/A
240N/A// WARNING: This file intentionally contains whitespace characters at the end of
240N/A// some lines. Do not delete them!
240N/A
240N/A// If this file fails to compile, then the test has failed. The test does not
240N/A// need to be run.
240N/A
240N/Apublic class EmptyDocComments
240N/A{
240N/A public static void Main(String [] args)
240N/A {
240N/A }
240N/A
240N/A // Verify that empty doc comments don't cause a crash.
240N/A
240N/A /**
240N/A * */
240N/A public static void emptyDocComment0()
240N/A {
240N/A System.out.println("javadoc comment");
240N/A System.out.println("- contains whitespace");
240N/A System.out.println("- ends on same line as potential comment");
240N/A }
240N/A
240N/A /**
240N/A ***/
240N/A public static void emptyDocComment1()
240N/A {
240N/A System.out.println("javadoc comment");
240N/A System.out.println("- contains nothing");
240N/A System.out.println("- ends on same line as potential comment");
240N/A }
240N/A
240N/A /** */
240N/A public static void emptyDocComment2()
240N/A {
240N/A System.out.println("javadoc comment");
240N/A System.out.println("- contains whitespace");
System.out.println("- ends on same line as comment start");
}
/**
*
*/
public static void emptyDocComment3()
{
System.out.println("javadoc comment");
System.out.println("- contains whitespace");
System.out.println("- ends on new line ");
}
/***/
public static void emptyDocComment4()
{
System.out.println("minimal javadoc comment");
System.out.println("- contains nothing");
System.out.println("- ends on same line as comment start");
}
/**/
public static void emptyDocComment5()
{
System.out.println("minimal _java_ comment");
System.out.println("- contains nothing");
System.out.println("- ends on same line as comment start");
}
/** **** */
public static void emptyDocComment6()
{
System.out.println("javadoc comment");
System.out.println("- contains \"*\"");
System.out.println("- ends on same line as comment start");
}
// Verify that we properly handle very small, non-empty comments.
/** a */
public static void singleChar0()
{
System.out.println("javadoc comment");
System.out.println("- contains a single character");
System.out.println("- ends on same line as comment start");
}
/**
* a */
public static void singleChar1()
{
System.out.println("javadoc comment");
System.out.println("- contains a single character and trailing whitespace");
System.out.println("- ends on same line as potential comment");
}
/**
* a
*/
public static void singleChar2()
{
System.out.println("javadoc comment");
System.out.println("- contains a single character, no trailing whitespace");
System.out.println("- ends on new line ");
}
/**
a
*/
public static void singleChar3()
{
System.out.println("javadoc comment");
System.out.println("- contains a single character and trailing whitespace");
System.out.println("- ends on new line ");
}
}