Fri, 24 Jul 2009 14:47:01 -0700
6863746: javap should not scan ct.sym by default
Reviewed-by: mcimadamore
1.1 --- a/src/share/classes/com/sun/tools/javap/JavapFileManager.java Thu Jul 23 14:15:58 2009 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javap/JavapFileManager.java Fri Jul 24 14:47:01 2009 -0700 1.3 @@ -44,6 +44,7 @@ 1.4 class JavapFileManager extends JavacFileManager { 1.5 private JavapFileManager(Context context, Charset charset) { 1.6 super(context, true, charset); 1.7 + setIgnoreSymbolFile(true); 1.8 } 1.9 1.10 static JavapFileManager create(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log, Options options) {
2.1 --- a/src/share/classes/com/sun/tools/javap/JavapTask.java Thu Jul 23 14:15:58 2009 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javap/JavapTask.java Fri Jul 24 14:47:01 2009 -0700 2.3 @@ -235,12 +235,6 @@ 2.4 } 2.5 }, 2.6 2.7 - new Option(false, "-XDignore.symbol.file") { 2.8 - void process(JavapTask task, String opt, String arg) { 2.9 - task.options.ignoreSymbolFile = true; 2.10 - } 2.11 - }, 2.12 - 2.13 new Option(false, "-XDdetails") { 2.14 void process(JavapTask task, String opt, String arg) { 2.15 task.options.details = EnumSet.allOf(InstructionDetailWriter.Kind.class); 2.16 @@ -477,9 +471,6 @@ 2.17 throw new BadArgs("err.incompatible.options", sb); 2.18 } 2.19 2.20 - if (options.ignoreSymbolFile && fileManager instanceof JavapFileManager) 2.21 - ((JavapFileManager) fileManager).setIgnoreSymbolFile(true); 2.22 - 2.23 if ((classes == null || classes.size() == 0) && 2.24 !(noArgs || options.help || options.version || options.fullVersion)) { 2.25 throw new BadArgs("err.no.classes.specified");
3.1 --- a/src/share/classes/com/sun/tools/javap/Options.java Thu Jul 23 14:15:58 2009 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javap/Options.java Fri Jul 24 14:47:01 2009 -0700 3.3 @@ -88,5 +88,4 @@ 3.4 3.5 public boolean compat; // bug-for-bug compatibility mode with old javap 3.6 public boolean jsr277; 3.7 - public boolean ignoreSymbolFile; // file manager should ignore ct.sym 3.8 }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/tools/javap/T6863746.java Fri Jul 24 14:47:01 2009 -0700 4.3 @@ -0,0 +1,52 @@ 4.4 +/* 4.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 4.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 4.24 + * have any questions. 4.25 + */ 4.26 + 4.27 +import java.io.*; 4.28 + 4.29 +/* 4.30 + * @test 4.31 + * @bug 6863746 4.32 + * @summary javap should not scan ct.sym by default 4.33 + */ 4.34 + 4.35 +public class T6863746 { 4.36 + public static void main(String... args) throws Exception{ 4.37 + new T6863746().run(); 4.38 + } 4.39 + 4.40 + public void run() throws Exception { 4.41 + String[] args = { "-c", "java.lang.Object" }; 4.42 + StringWriter sw = new StringWriter(); 4.43 + PrintWriter pw = new PrintWriter(sw); 4.44 + int rc = com.sun.tools.javap.Main.run(args, pw); 4.45 + pw.close(); 4.46 + String out = sw.toString(); 4.47 + System.out.println(out); 4.48 + String[] lines = out.split("\n"); 4.49 + // If ct.sym is being read, the output does not include 4.50 + // Code attributes, so check for Code attributes as a 4.51 + // way of detecting that ct.sym is not being used. 4.52 + if (lines.length < 50 || out.indexOf("Code:") == -1) 4.53 + throw new Exception("unexpected output from javap"); 4.54 + } 4.55 +}