T6412656.java revision 1732:e39669aea0bd
172613Skris/* 272613Skris * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 372613Skris * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 472613Skris * 572613Skris * This code is free software; you can redistribute it and/or modify it 672613Skris * under the terms of the GNU General Public License version 2 only, as 772613Skris * published by the Free Software Foundation. 872613Skris * 972613Skris * This code is distributed in the hope that it will be useful, but WITHOUT 1072613Skris * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1172613Skris * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1272613Skris * version 2 for more details (a copy is included in the LICENSE file that 1372613Skris * accompanied this code). 1472613Skris * 1572613Skris * You should have received a copy of the GNU General Public License version 1672613Skris * 2 along with this work; if not, write to the Free Software Foundation, 1772613Skris * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1872613Skris * 1972613Skris * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2072613Skris * or visit www.oracle.com if you need additional information or have any 2172613Skris * questions. 2272613Skris */ 2372613Skris 2472613Skris/* 2572613Skris * @test 2672613Skris * @bug 6412656 6443062 2772613Skris * @summary JSR 199: pass annotation processor instances to compiler 2872613Skris * @author Peter von der Ah\u00e9 2972613Skris * @library ../lib 3072613Skris * @build ToolTester 3172613Skris * @run main T6412656 3272613Skris */ 3372613Skris 3472613Skrisimport java.util.Set; 3572613Skrisimport java.util.Collections; 3672613Skrisimport javax.lang.model.element.TypeElement; 3772613Skrisimport javax.annotation.processing.*; 3872613Skrisimport com.sun.tools.javac.processing.AnnotationProcessingError; 3979998Skris 4072613Skris 4179998Skrispublic class T6412656 extends ToolTester { 4272613Skris 4372613Skris int count = 0; 4472613Skris 4572613Skris void test(String... args) { 4672613Skris task = tool.getTask(null, fm, null, null, 4772613Skris Collections.singleton(T6412656.class.getName()), null); 4879998Skris task.setProcessors(Collections.singleton(new MyProc(this))); 4979998Skris task.call(); 5079998Skris if (count == 0) 5179998Skris throw new AssertionError("Annotation processor not run"); 5272613Skris System.out.println("OK"); 5372613Skris } 5472613Skris 5579998Skris public static void main(String... args) { 5672613Skris new T6412656().test(args); 5772613Skris } 5872613Skris 5972613Skris @SupportedAnnotationTypes("*") 6072613Skris static class MyProc extends AbstractProcessor { 6172613Skris T6412656 test; 6272613Skris MyProc(T6412656 test) { 6372613Skris this.test = test; 6472613Skris } 6572613Skris public boolean process(Set<? extends TypeElement> annotations, 6672613Skris RoundEnvironment roundEnv) { 6772613Skris test.count++; 6872613Skris return false; 6972613Skris } 7072613Skris } 7172613Skris} 7272613Skris