Thu, 07 Jun 2012 20:30:57 -0700
7170079: Adjustments to build-infra makefiles
Reviewed-by: ohair, ohrstrom, ihse, jonas
Contributed-by: jonas <jonas.oreland@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>
jjg@837 | 1 | /* |
katleman@1013 | 2 | * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
jjg@837 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@837 | 4 | * |
jjg@837 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@837 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jjg@837 | 7 | * published by the Free Software Foundation. |
jjg@837 | 8 | * |
jjg@837 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@837 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@837 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@837 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@837 | 13 | * accompanied this code). |
jjg@837 | 14 | * |
jjg@837 | 15 | * You should have received a copy of the GNU General Public License version |
jjg@837 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@837 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@837 | 18 | * |
jjg@837 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
jjg@837 | 20 | * or visit www.oracle.com if you need additional information or have any |
jjg@837 | 21 | * questions. |
jjg@837 | 22 | */ |
jjg@837 | 23 | |
jjg@837 | 24 | /* |
jjg@837 | 25 | * @test |
jjg@837 | 26 | * @bug 6963934 |
jjg@837 | 27 | * @summary JCCompilationUnit.getImports does not report all imports |
jjg@837 | 28 | */ |
jjg@837 | 29 | |
jjg@837 | 30 | import java.io.File; |
jjg@837 | 31 | import javax.tools.JavaCompiler; |
jjg@837 | 32 | import javax.tools.StandardJavaFileManager; |
jjg@837 | 33 | import javax.tools.ToolProvider;; // NOTE: extra semicolon for test |
jjg@837 | 34 | |
jjg@837 | 35 | import com.sun.source.tree.CompilationUnitTree; |
jjg@837 | 36 | import com.sun.source.tree.ImportTree; |
jjg@837 | 37 | import com.sun.source.util.JavacTask; |
jjg@837 | 38 | ; // NOTE: extra semicolon for test |
jjg@837 | 39 | |
jjg@837 | 40 | public class T6963934 { |
jjg@837 | 41 | public static void main(String[] args) throws Exception { |
jjg@837 | 42 | File testSrc = new File(System.getProperty("test.src")); |
jjg@837 | 43 | File thisSrc = new File(testSrc, T6963934.class.getSimpleName() + ".java"); |
jjg@837 | 44 | JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); |
jjg@837 | 45 | StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); |
jjg@837 | 46 | JavacTask task = (JavacTask) compiler.getTask(null, fileManager, null, null, null, |
jjg@837 | 47 | fileManager.getJavaFileObjects(thisSrc)); |
jjg@837 | 48 | CompilationUnitTree tree = task.parse().iterator().next(); |
jjg@837 | 49 | int count = 0; |
jjg@837 | 50 | for (ImportTree importTree : tree.getImports()) { |
jjg@837 | 51 | System.out.println(importTree); |
jjg@837 | 52 | count++; |
jjg@837 | 53 | } |
jjg@837 | 54 | int expected = 7; |
jjg@837 | 55 | if (count != expected) |
jjg@837 | 56 | throw new Exception("unexpected number of imports found: " + count + ", expected: " + expected); |
jjg@837 | 57 | } |
jjg@837 | 58 | } |