提交 adf2f1de 编写于 作者: J jjg

8001229: refactor javac so that ct.sym is just used for javac, not all clients of JavacFileManager

Reviewed-by: mcimadamore
上级 9fa48065
...@@ -90,7 +90,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil ...@@ -90,7 +90,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
EnumSet.of(JavaFileObject.Kind.SOURCE, JavaFileObject.Kind.CLASS); EnumSet.of(JavaFileObject.Kind.SOURCE, JavaFileObject.Kind.CLASS);
protected boolean mmappedIO; protected boolean mmappedIO;
protected boolean ignoreSymbolFile; protected boolean symbolFileEnabled;
protected enum SortFiles implements Comparator<File> { protected enum SortFiles implements Comparator<File> {
FORWARD { FORWARD {
...@@ -142,7 +142,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil ...@@ -142,7 +142,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
zipFileIndexCache = ZipFileIndexCache.getSharedInstance(); zipFileIndexCache = ZipFileIndexCache.getSharedInstance();
mmappedIO = options.isSet("mmappedIO"); mmappedIO = options.isSet("mmappedIO");
ignoreSymbolFile = options.isSet("ignore.symbol.file"); symbolFileEnabled = !options.isSet("ignore.symbol.file");
String sf = options.get("sortFiles"); String sf = options.get("sortFiles");
if (sf != null) { if (sf != null) {
...@@ -150,6 +150,13 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil ...@@ -150,6 +150,13 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
} }
} }
/**
* Set whether or not to use ct.sym as an alternate to rt.jar.
*/
public void setSymbolFileEnabled(boolean b) {
symbolFileEnabled = b;
}
@Override @Override
public boolean isDefaultBootClassPath() { public boolean isDefaultBootClassPath() {
return locations.isDefaultBootClassPath(); return locations.isDefaultBootClassPath();
...@@ -466,7 +473,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil ...@@ -466,7 +473,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
*/ */
private Archive openArchive(File zipFileName, boolean useOptimizedZip) throws IOException { private Archive openArchive(File zipFileName, boolean useOptimizedZip) throws IOException {
File origZipFileName = zipFileName; File origZipFileName = zipFileName;
if (!ignoreSymbolFile && locations.isDefaultBootClassPathRtJar(zipFileName)) { if (symbolFileEnabled && locations.isDefaultBootClassPathRtJar(zipFileName)) {
File file = zipFileName.getParentFile().getParentFile(); // ${java.home} File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
if (new File(file.getName()).equals(new File("jre"))) if (new File(file.getName()).equals(new File("jre")))
file = file.getParentFile(); file = file.getParentFile();
......
/* /*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -44,7 +44,7 @@ import com.sun.tools.javac.util.Context; ...@@ -44,7 +44,7 @@ import com.sun.tools.javac.util.Context;
class JavahFileManager extends JavacFileManager { class JavahFileManager extends JavacFileManager {
private JavahFileManager(Context context, Charset charset) { private JavahFileManager(Context context, Charset charset) {
super(context, true, charset); super(context, true, charset);
setIgnoreSymbolFile(true); setSymbolFileEnabled(false);
} }
static JavahFileManager create(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) { static JavahFileManager create(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) {
...@@ -56,8 +56,4 @@ class JavahFileManager extends JavacFileManager { ...@@ -56,8 +56,4 @@ class JavahFileManager extends JavacFileManager {
return new JavahFileManager(javac_context, null); return new JavahFileManager(javac_context, null);
} }
void setIgnoreSymbolFile(boolean b) {
ignoreSymbolFile = b;
}
} }
...@@ -500,7 +500,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask { ...@@ -500,7 +500,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
g.setForce(force); g.setForce(force);
if (fileManager instanceof JavahFileManager) if (fileManager instanceof JavahFileManager)
((JavahFileManager) fileManager).setIgnoreSymbolFile(true); ((JavahFileManager) fileManager).setSymbolFileEnabled(false);
JavaCompiler c = ToolProvider.getSystemJavaCompiler(); JavaCompiler c = ToolProvider.getSystemJavaCompiler();
List<String> opts = new ArrayList<String>(); List<String> opts = new ArrayList<String>();
......
/* /*
* Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -44,7 +44,7 @@ import com.sun.tools.javac.util.Context; ...@@ -44,7 +44,7 @@ import com.sun.tools.javac.util.Context;
public class JavapFileManager extends JavacFileManager { public class JavapFileManager extends JavacFileManager {
private JavapFileManager(Context context, Charset charset) { private JavapFileManager(Context context, Charset charset) {
super(context, true, charset); super(context, true, charset);
setIgnoreSymbolFile(true); setSymbolFileEnabled(false);
} }
public static JavapFileManager create(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) { public static JavapFileManager create(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) {
...@@ -56,8 +56,4 @@ public class JavapFileManager extends JavacFileManager { ...@@ -56,8 +56,4 @@ public class JavapFileManager extends JavacFileManager {
return new JavapFileManager(javac_context, null); return new JavapFileManager(javac_context, null);
} }
void setIgnoreSymbolFile(boolean b) {
ignoreSymbolFile = b;
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册