Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
05683967
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
05683967
编写于
10月 19, 2011
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7101146: Paths should more directly managed by BaseFileManager
Reviewed-by: mcimadamore
上级
da6087bf
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
55 deletion
+34
-55
src/share/classes/com/sun/tools/javac/file/JavacFileManager.java
...re/classes/com/sun/tools/javac/file/JavacFileManager.java
+9
-19
src/share/classes/com/sun/tools/javac/file/Paths.java
src/share/classes/com/sun/tools/javac/file/Paths.java
+6
-24
src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
...classes/com/sun/tools/javac/nio/JavacPathFileManager.java
+1
-6
src/share/classes/com/sun/tools/javac/util/BaseFileManager.java
...are/classes/com/sun/tools/javac/util/BaseFileManager.java
+18
-6
未找到文件。
src/share/classes/com/sun/tools/javac/file/JavacFileManager.java
浏览文件 @
05683967
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
package
com.sun.tools.javac.file
;
package
com.sun.tools.javac.file
;
import
java.util.Comparator
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
...
@@ -41,6 +40,7 @@ import java.util.ArrayList;
...
@@ -41,6 +40,7 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.EnumSet
;
import
java.util.EnumSet
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Iterator
;
...
@@ -54,6 +54,7 @@ import javax.tools.JavaFileManager;
...
@@ -54,6 +54,7 @@ import javax.tools.JavaFileManager;
import
javax.tools.JavaFileObject
;
import
javax.tools.JavaFileObject
;
import
javax.tools.StandardJavaFileManager
;
import
javax.tools.StandardJavaFileManager
;
import
com.sun.tools.javac.code.Lint
;
import
com.sun.tools.javac.file.RelativePath.RelativeFile
;
import
com.sun.tools.javac.file.RelativePath.RelativeFile
;
import
com.sun.tools.javac.file.RelativePath.RelativeDirectory
;
import
com.sun.tools.javac.file.RelativePath.RelativeDirectory
;
import
com.sun.tools.javac.main.OptionName
;
import
com.sun.tools.javac.main.OptionName
;
...
@@ -83,10 +84,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
...
@@ -83,10 +84,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
return
buffer
.
toString
().
toCharArray
();
return
buffer
.
toString
().
toCharArray
();
}
}
/** Encapsulates knowledge of paths
*/
private
Paths
paths
;
private
FSInfo
fsInfo
;
private
FSInfo
fsInfo
;
private
boolean
contextUseOptimizedZip
;
private
boolean
contextUseOptimizedZip
;
...
@@ -154,13 +151,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
...
@@ -154,13 +151,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
@Override
@Override
public
void
setContext
(
Context
context
)
{
public
void
setContext
(
Context
context
)
{
super
.
setContext
(
context
);
super
.
setContext
(
context
);
if
(
paths
==
null
)
{
paths
=
Paths
.
instance
(
context
);
}
else
{
// Reuse the Paths object as it stores the locations that
// have been set with setLocation, etc.
paths
.
setContext
(
context
);
}
fsInfo
=
FSInfo
.
instance
(
context
);
fsInfo
=
FSInfo
.
instance
(
context
);
...
@@ -179,7 +169,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
...
@@ -179,7 +169,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
@Override
@Override
public
boolean
isDefaultBootClassPath
()
{
public
boolean
isDefaultBootClassPath
()
{
return
p
aths
.
isDefaultBootClassPath
();
return
searchP
aths
.
isDefaultBootClassPath
();
}
}
public
JavaFileObject
getFileForInput
(
String
name
)
{
public
JavaFileObject
getFileForInput
(
String
name
)
{
...
@@ -493,7 +483,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
...
@@ -493,7 +483,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
&&
p
aths
.
isDefaultBootClassPathRtJar
(
zipFileName
))
{
if
(!
ignoreSymbolFile
&&
searchP
aths
.
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
();
...
@@ -780,7 +770,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
...
@@ -780,7 +770,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
}
else
if
(
location
==
SOURCE_OUTPUT
)
{
}
else
if
(
location
==
SOURCE_OUTPUT
)
{
dir
=
(
getSourceOutDir
()
!=
null
?
getSourceOutDir
()
:
getClassOutDir
());
dir
=
(
getSourceOutDir
()
!=
null
?
getSourceOutDir
()
:
getClassOutDir
());
}
else
{
}
else
{
Iterable
<?
extends
File
>
path
=
p
aths
.
getPathForLocation
(
location
);
Iterable
<?
extends
File
>
path
=
searchP
aths
.
getPathForLocation
(
location
);
dir
=
null
;
dir
=
null
;
for
(
File
f:
path
)
{
for
(
File
f:
path
)
{
dir
=
f
;
dir
=
f
;
...
@@ -815,7 +805,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
...
@@ -815,7 +805,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
throws
IOException
throws
IOException
{
{
nullCheck
(
location
);
nullCheck
(
location
);
p
aths
.
lazy
();
searchP
aths
.
lazy
();
final
File
dir
=
location
.
isOutputLocation
()
?
getOutputDirectory
(
path
)
:
null
;
final
File
dir
=
location
.
isOutputLocation
()
?
getOutputDirectory
(
path
)
:
null
;
...
@@ -824,7 +814,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
...
@@ -824,7 +814,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
else
if
(
location
==
SOURCE_OUTPUT
)
else
if
(
location
==
SOURCE_OUTPUT
)
sourceOutDir
=
getOutputLocation
(
dir
,
S
);
sourceOutDir
=
getOutputLocation
(
dir
,
S
);
else
else
p
aths
.
setPathForLocation
(
location
,
path
);
searchP
aths
.
setPathForLocation
(
location
,
path
);
}
}
// where
// where
private
File
getOutputDirectory
(
Iterable
<?
extends
File
>
path
)
throws
IOException
{
private
File
getOutputDirectory
(
Iterable
<?
extends
File
>
path
)
throws
IOException
{
...
@@ -854,13 +844,13 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
...
@@ -854,13 +844,13 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
public
Iterable
<?
extends
File
>
getLocation
(
Location
location
)
{
public
Iterable
<?
extends
File
>
getLocation
(
Location
location
)
{
nullCheck
(
location
);
nullCheck
(
location
);
p
aths
.
lazy
();
searchP
aths
.
lazy
();
if
(
location
==
CLASS_OUTPUT
)
{
if
(
location
==
CLASS_OUTPUT
)
{
return
(
getClassOutDir
()
==
null
?
null
:
List
.
of
(
getClassOutDir
()));
return
(
getClassOutDir
()
==
null
?
null
:
List
.
of
(
getClassOutDir
()));
}
else
if
(
location
==
SOURCE_OUTPUT
)
{
}
else
if
(
location
==
SOURCE_OUTPUT
)
{
return
(
getSourceOutDir
()
==
null
?
null
:
List
.
of
(
getSourceOutDir
()));
return
(
getSourceOutDir
()
==
null
?
null
:
List
.
of
(
getSourceOutDir
()));
}
else
}
else
return
p
aths
.
getPathForLocation
(
location
);
return
searchP
aths
.
getPathForLocation
(
location
);
}
}
private
File
getClassOutDir
()
{
private
File
getClassOutDir
()
{
...
...
src/share/classes/com/sun/tools/javac/file/Paths.java
浏览文件 @
05683967
...
@@ -41,7 +41,6 @@ import java.util.zip.ZipFile;
...
@@ -41,7 +41,6 @@ import java.util.zip.ZipFile;
import
javax.tools.JavaFileManager.Location
;
import
javax.tools.JavaFileManager.Location
;
import
com.sun.tools.javac.code.Lint
;
import
com.sun.tools.javac.code.Lint
;
import
com.sun.tools.javac.util.Context
;
import
com.sun.tools.javac.util.ListBuffer
;
import
com.sun.tools.javac.util.ListBuffer
;
import
com.sun.tools.javac.util.Log
;
import
com.sun.tools.javac.util.Log
;
import
com.sun.tools.javac.util.Options
;
import
com.sun.tools.javac.util.Options
;
...
@@ -61,21 +60,6 @@ import static com.sun.tools.javac.main.OptionName.*;
...
@@ -61,21 +60,6 @@ import static com.sun.tools.javac.main.OptionName.*;
*/
*/
public
class
Paths
{
public
class
Paths
{
/** The context key for the todo list */
protected
static
final
Context
.
Key
<
Paths
>
pathsKey
=
new
Context
.
Key
<
Paths
>();
/** Get the Paths instance for this context.
* @param context the context
* @return the Paths instance for this context
*/
public
static
Paths
instance
(
Context
context
)
{
Paths
instance
=
context
.
get
(
pathsKey
);
if
(
instance
==
null
)
instance
=
new
Paths
(
context
);
return
instance
;
}
/** The log to use for warning output */
/** The log to use for warning output */
private
Log
log
;
private
Log
log
;
...
@@ -88,17 +72,15 @@ public class Paths {
...
@@ -88,17 +72,15 @@ public class Paths {
/** Access to (possibly cached) file info */
/** Access to (possibly cached) file info */
private
FSInfo
fsInfo
;
private
FSInfo
fsInfo
;
protected
Paths
(
Context
context
)
{
public
Paths
()
{
context
.
put
(
pathsKey
,
this
);
pathsForLocation
=
new
HashMap
<
Location
,
Path
>(
16
);
pathsForLocation
=
new
HashMap
<
Location
,
Path
>(
16
);
setContext
(
context
);
}
}
void
setContext
(
Context
context
)
{
public
void
update
(
Log
log
,
Options
options
,
Lint
lint
,
FSInfo
fsInfo
)
{
log
=
Log
.
instance
(
context
)
;
this
.
log
=
log
;
options
=
Options
.
instance
(
context
)
;
this
.
options
=
options
;
lint
=
Lint
.
instance
(
context
)
;
this
.
lint
=
lint
;
fsInfo
=
FSInfo
.
instance
(
context
)
;
this
.
fsInfo
=
fsInfo
;
}
}
/** Whether to warn about non-existent path elements */
/** Whether to warn about non-existent path elements */
...
...
src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
浏览文件 @
05683967
...
@@ -25,9 +25,7 @@
...
@@ -25,9 +25,7 @@
package
com.sun.tools.javac.nio
;
package
com.sun.tools.javac.nio
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.MalformedURLException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URL
;
...
@@ -60,7 +58,6 @@ import javax.tools.StandardLocation;
...
@@ -60,7 +58,6 @@ import javax.tools.StandardLocation;
import
static
java
.
nio
.
file
.
FileVisitOption
.*;
import
static
java
.
nio
.
file
.
FileVisitOption
.*;
import
static
javax
.
tools
.
StandardLocation
.*;
import
static
javax
.
tools
.
StandardLocation
.*;
import
com.sun.tools.javac.file.Paths
;
import
com.sun.tools.javac.util.BaseFileManager
;
import
com.sun.tools.javac.util.BaseFileManager
;
import
com.sun.tools.javac.util.Context
;
import
com.sun.tools.javac.util.Context
;
import
com.sun.tools.javac.util.List
;
import
com.sun.tools.javac.util.List
;
...
@@ -125,9 +122,8 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
...
@@ -125,9 +122,8 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
* Set the context for JavacPathFileManager.
* Set the context for JavacPathFileManager.
*/
*/
@Override
@Override
p
rotected
void
setContext
(
Context
context
)
{
p
ublic
void
setContext
(
Context
context
)
{
super
.
setContext
(
context
);
super
.
setContext
(
context
);
searchPaths
=
Paths
.
instance
(
context
);
}
}
@Override
@Override
...
@@ -272,7 +268,6 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
...
@@ -272,7 +268,6 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
private
boolean
inited
=
false
;
private
boolean
inited
=
false
;
private
Map
<
Location
,
PathsForLocation
>
pathsForLocation
;
private
Map
<
Location
,
PathsForLocation
>
pathsForLocation
;
private
Paths
searchPaths
;
private
static
class
PathsForLocation
extends
LinkedHashSet
<
Path
>
{
private
static
class
PathsForLocation
extends
LinkedHashSet
<
Path
>
{
private
static
final
long
serialVersionUID
=
6788510222394486733L
;
private
static
final
long
serialVersionUID
=
6788510222394486733L
;
...
...
src/share/classes/com/sun/tools/javac/util/BaseFileManager.java
浏览文件 @
05683967
...
@@ -25,11 +25,6 @@
...
@@ -25,11 +25,6 @@
package
com.sun.tools.javac.util
;
package
com.sun.tools.javac.util
;
import
com.sun.tools.javac.code.Source
;
import
com.sun.tools.javac.main.JavacOption
;
import
com.sun.tools.javac.main.OptionName
;
import
com.sun.tools.javac.main.RecognizedOptions
;
import
com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.Closeable
;
import
java.io.Closeable
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -54,6 +49,15 @@ import java.util.Map;
...
@@ -54,6 +49,15 @@ import java.util.Map;
import
javax.tools.JavaFileObject
;
import
javax.tools.JavaFileObject
;
import
javax.tools.JavaFileObject.Kind
;
import
javax.tools.JavaFileObject.Kind
;
import
com.sun.tools.javac.code.Lint
;
import
com.sun.tools.javac.code.Source
;
import
com.sun.tools.javac.file.FSInfo
;
import
com.sun.tools.javac.file.Paths
;
import
com.sun.tools.javac.main.JavacOption
;
import
com.sun.tools.javac.main.OptionName
;
import
com.sun.tools.javac.main.RecognizedOptions
;
import
com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition
;
/**
/**
* Utility methods for building a filemanager.
* Utility methods for building a filemanager.
* There are no references here to file-system specific objects such as
* There are no references here to file-system specific objects such as
...
@@ -63,15 +67,21 @@ public abstract class BaseFileManager {
...
@@ -63,15 +67,21 @@ public abstract class BaseFileManager {
protected
BaseFileManager
(
Charset
charset
)
{
protected
BaseFileManager
(
Charset
charset
)
{
this
.
charset
=
charset
;
this
.
charset
=
charset
;
byteBufferCache
=
new
ByteBufferCache
();
byteBufferCache
=
new
ByteBufferCache
();
searchPaths
=
createPaths
();
}
}
/**
/**
* Set the context for JavacPathFileManager.
* Set the context for JavacPathFileManager.
*/
*/
p
rotected
void
setContext
(
Context
context
)
{
p
ublic
void
setContext
(
Context
context
)
{
log
=
Log
.
instance
(
context
);
log
=
Log
.
instance
(
context
);
options
=
Options
.
instance
(
context
);
options
=
Options
.
instance
(
context
);
classLoaderClass
=
options
.
get
(
"procloader"
);
classLoaderClass
=
options
.
get
(
"procloader"
);
searchPaths
.
update
(
log
,
options
,
Lint
.
instance
(
context
),
FSInfo
.
instance
(
context
));
}
protected
Paths
createPaths
()
{
return
new
Paths
();
}
}
/**
/**
...
@@ -88,6 +98,8 @@ public abstract class BaseFileManager {
...
@@ -88,6 +98,8 @@ public abstract class BaseFileManager {
protected
String
classLoaderClass
;
protected
String
classLoaderClass
;
protected
Paths
searchPaths
;
protected
Source
getSource
()
{
protected
Source
getSource
()
{
String
sourceName
=
options
.
get
(
OptionName
.
SOURCE
);
String
sourceName
=
options
.
get
(
OptionName
.
SOURCE
);
Source
source
=
null
;
Source
source
=
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录