langtools/test/tools/javac/util/NewlineOnlyDiagnostic.java
author akulyakh
Thu, 21 May 2015 11:41:04 -0700
changeset 30730 d3ce7619db2c
parent 27549 55a03b691be2
permissions -rw-r--r--
8076543: Add @modules as needed to the langtools tests Reviewed-by: jjg, shurailine
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27549
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27549
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
27549
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
     4
 *
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
     7
 * published by the Free Software Foundation.
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
     8
 *
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    13
 * accompanied this code).
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    14
 *
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    18
 *
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    21
 * questions.
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    22
 */
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    23
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    24
import javax.annotation.processing.*;
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    25
import javax.tools.Diagnostic.Kind;
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    26
import javax.lang.model.element.TypeElement;
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    27
import java.util.Set;
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    28
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    29
/*
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    30
 * @test
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    31
 * @bug 8060448
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    32
 * @summary Test that javac doesn't throw ArrayIndexOutOfBoundsException
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    33
 *          when logging the message "\n"
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    34
 * @library /tools/javac/lib
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27549
diff changeset
    35
 * @modules java.compiler
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27549
diff changeset
    36
 *          jdk.compiler
27549
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    37
 * @build   JavacTestingAbstractProcessor NewlineOnlyDiagnostic
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    38
 * @compile -processor NewlineOnlyDiagnostic NewlineOnlyDiagnostic.java
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    39
 */
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    40
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    41
public class NewlineOnlyDiagnostic extends JavacTestingAbstractProcessor {
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    42
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    43
    @Override
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    44
    public boolean process(Set<? extends TypeElement> types,RoundEnvironment rEnv) {
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    45
        processingEnv.getMessager().printMessage(Kind.NOTE,"\n");
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    46
        return true;
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    47
    }
55a03b691be2 8060448: ArrayIndexOutOfBoundsException with annotation processing printout of empty line
jfranck
parents:
diff changeset
    48
}