duke@1: /* ohair@554: * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as duke@1: * published by the Free Software Foundation. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. duke@1: */ duke@1: duke@1: /* duke@1: * @test duke@1: * @bug 6395974 duke@1: * @summary files are parsed even after failure to find annotation processor is reported duke@1: */ duke@1: duke@1: import java.io.*; duke@1: import java.util.*; duke@1: import javax.tools.*; duke@1: import com.sun.source.util.*; duke@1: import com.sun.tools.javac.api.*; duke@1: duke@1: duke@1: public class T6395974 { duke@1: public static void main(String... args) throws Throwable { duke@1: String self = T6395974.class.getName(); duke@1: duke@1: String testSrc = System.getProperty("test.src"); duke@1: duke@1: JavacTool tool = JavacTool.create(); duke@1: StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null); duke@1: Iterable f = duke@1: fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, self + ".java"))); duke@1: duke@1: PrintWriter out = new PrintWriter(System.err, true); duke@1: duke@1: JavacTaskImpl task = (JavacTaskImpl) tool.getTask(out, duke@1: fm, duke@1: null, duke@1: Arrays.asList("-processor", duke@1: "Foo.java"), duke@1: null, duke@1: f); duke@1: duke@1: MyTaskListener tl = new MyTaskListener(); duke@1: task.setTaskListener(tl); duke@1: duke@1: task.call(); duke@1: duke@1: if (tl.event != null) duke@1: throw new AssertionError("Unexpected TaskListener event: " + tl.event); duke@1: } duke@1: duke@1: static class MyTaskListener implements TaskListener { duke@1: public void started(TaskEvent e) { duke@1: System.err.println("Started: " + e); duke@1: if (event == null) duke@1: event = e; duke@1: } duke@1: public void finished(TaskEvent e) { duke@1: } duke@1: duke@1: TaskEvent event; duke@1: } duke@1: }