T6431879.java revision 553:9d9f26857129
1129277Sru/* 2129277Sru * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 3129277Sru * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4129277Sru * 5129277Sru * This code is free software; you can redistribute it and/or modify it 6129277Sru * under the terms of the GNU General Public License version 2 only, as 7129277Sru * published by the Free Software Foundation. 8129277Sru * 9129277Sru * This code is distributed in the hope that it will be useful, but WITHOUT 10129277Sru * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11129277Sru * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12129277Sru * version 2 for more details (a copy is included in the LICENSE file that 13129277Sru * accompanied this code). 14129277Sru * 15141201Sru * You should have received a copy of the GNU General Public License version 16129277Sru * 2 along with this work; if not, write to the Free Software Foundation, 17129277Sru * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18129277Sru * 19129277Sru * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20129277Sru * or visit www.oracle.com if you need additional information or have any 21129277Sru * questions. 22129277Sru */ 23129277Sru 24129277Sru/* 25131861Sru * @test 26129277Sru * @bug 6431879 27129277Sru * @summary TreePathSCanner(CompilationUnitTree tree, P p) overloading forces use of most specific type 28129277Sru */ 29129277Sru 30131530Sruimport java.io.*; 31131861Sruimport java.util.*; 32129277Sruimport javax.tools.*; 33131861Sruimport com.sun.source.tree.*; 34129277Sruimport com.sun.source.util.*; 35131861Sruimport com.sun.tools.javac.api.*; 36131861Sru 37129277Srupublic class T6431879 { 38131861Sru public static void main(String... args) throws IOException { 39131861Sru String testSrc = System.getProperty("test.src", "."); 40131861Sru String testClasses = System.getProperty("test.classes", "."); 41129277Sru JavacTool tool = JavacTool.create(); 42129277Sru StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null); 43129277Sru Iterable<? extends JavaFileObject> files = 44131861Sru fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6431879.class.getName()+".java"))); 45131861Sru JavacTask task = tool.getTask(null, fm, null, null, null, files); 46131861Sru Iterable<? extends CompilationUnitTree> trees = task.parse(); 47129277Sru TreeScanner<Void,Trees> dependencyScanner = new DependencyScanner(); 48131861Sru Trees treeUtil = Trees.instance(task); 49131861Sru for (CompilationUnitTree unit : trees) { 50131861Sru //System.err.println("scan " + unit); 51131861Sru dependencyScanner.scan(unit, treeUtil); 52129277Sru } 53131861Sru 54131861Sru } 55129277Sru 56129277Sru private static class DependencyScanner<R,P> extends TreePathScanner<R,P> { 57129277Sru public R visitIdentifier(IdentifierTree tree, P p) { 58131861Sru //System.err.println(tree); 59129277Sru return null; 60129277Sru } 61131861Sru } 62131861Sru} 63131861Sru