493N/A/*
553N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
493N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
493N/A *
493N/A * This code is free software; you can redistribute it and/or modify it
493N/A * under the terms of the GNU General Public License version 2 only, as
493N/A * published by the Free Software Foundation.
493N/A *
493N/A * This code is distributed in the hope that it will be useful, but WITHOUT
493N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
493N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
493N/A * version 2 for more details (a copy is included in the LICENSE file that
493N/A * accompanied this code).
493N/A *
493N/A * You should have received a copy of the GNU General Public License version
493N/A * 2 along with this work; if not, write to the Free Software Foundation,
493N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
493N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
493N/A */
493N/A
493N/A/*
493N/A * @test
493N/A * @bug 6634138
493N/A * @author Joseph D. Darcy
493N/A * @summary Verify source files output after processing is over are compiled
698N/A * @library ../../lib
698N/A * @build JavacTestingAbstractProcessor
493N/A * @compile T6634138.java
493N/A * @compile -processor T6634138 Dummy.java
493N/A * @run main ExerciseDependency
493N/A */
493N/A
493N/Aimport java.lang.annotation.Annotation;
493N/Aimport java.io.*;
493N/Aimport java.util.Collections;
493N/Aimport java.util.Set;
493N/Aimport java.util.HashSet;
493N/Aimport java.util.List;
493N/Aimport java.util.ArrayList;
493N/Aimport java.util.Arrays;
493N/Aimport javax.annotation.processing.*;
493N/Aimport javax.lang.model.SourceVersion;
493N/Aimport javax.lang.model.element.*;
493N/Aimport javax.lang.model.util.*;
493N/A
698N/Apublic class T6634138 extends JavacTestingAbstractProcessor {
493N/A public boolean process(Set<? extends TypeElement> annotations,
493N/A RoundEnvironment roundEnvironment) {
493N/A // Write out files *after* processing is over.
493N/A if (roundEnvironment.processingOver()) {
493N/A System.out.println("Writing out source files.");
493N/A try {
493N/A PrintWriter pw = new PrintWriter(filer.createSourceFile("foo.WrittenAfterProcessing").openWriter());
493N/A try {
493N/A pw.println("package foo;");
493N/A pw.println("public class WrittenAfterProcessing {");
493N/A pw.println(" public WrittenAfterProcessing() {super();}");
493N/A pw.println("}");
493N/A } finally {
493N/A pw.close();
493N/A }
493N/A
493N/A pw = new PrintWriter(filer.createSourceFile("foo.package-info").openWriter());
493N/A try {
493N/A pw.println("@Deprecated");
493N/A pw.println("package foo;");
493N/A } finally {
493N/A pw.close();
493N/A }
493N/A } catch(IOException io) {
493N/A throw new RuntimeException(io);
493N/A }
493N/A }
493N/A return true;
493N/A }
493N/A}
493N/A
493N/A
493N/A