langtools/test/tools/javac/processing/errors/TestClassNames.java
author akulyakh
Thu, 21 May 2015 11:41:04 -0700
changeset 30730 d3ce7619db2c
parent 19505 df0bd8ca483c
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:
19505
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 19505
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
19505
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
     4
 *
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
     7
 * published by the Free Software Foundation.
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
     8
 *
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    13
 * accompanied this code).
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    14
 *
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    18
 *
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    21
 * questions.
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    22
 */
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    23
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    24
/*
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    25
 * @test
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    26
 * @bug 7071377
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    27
 * @summary verify if erroneous class names are rejected
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    28
 * @library /tools/javac/lib
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 19505
diff changeset
    29
 * @modules jdk.compiler/com.sun.tools.javac.main
19505
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    30
 * @build TestClassNames JavacTestingAbstractProcessor CompileFail
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    31
 * @run main CompileFail ERROR  -processor TestClassNames TestClassNames.x.y
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    32
 * @run main CompileFail ERROR  -processor TestClassNames x.y.TestClassNames
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    33
 * @run main CompileFail ERROR  -processor NoClass NoClass.x.y
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    34
 */
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    35
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    36
import java.util.Set;
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    37
import javax.annotation.processing.*;
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    38
import javax.lang.model.element.*;
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    39
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    40
/**
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    41
 * No-op processor; should not be run.
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    42
 */
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    43
public class TestClassNames extends JavacTestingAbstractProcessor {
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    44
    public boolean process(Set<? extends TypeElement> annotations,
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    45
                           RoundEnvironment roundEnvironment) {
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    46
        return true;
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    47
    }
df0bd8ca483c 7071377: Exception when javac -processor is given a class name with invalid postfix
ksrini
parents:
diff changeset
    48
}