Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
9b92bdd3
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看板
提交
9b92bdd3
编写于
10月 25, 2011
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7104039: refactor/cleanup javac Paths class
Reviewed-by: mcimadamore
上级
c79a0fd2
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
789 addition
and
81 deletion
+789
-81
src/share/classes/com/sun/tools/apt/main/Main.java
src/share/classes/com/sun/tools/apt/main/Main.java
+2
-2
src/share/classes/com/sun/tools/javac/file/JavacFileManager.java
...re/classes/com/sun/tools/javac/file/JavacFileManager.java
+7
-68
src/share/classes/com/sun/tools/javac/file/Locations.java
src/share/classes/com/sun/tools/javac/file/Locations.java
+769
-0
src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
...classes/com/sun/tools/javac/nio/JavacPathFileManager.java
+4
-4
src/share/classes/com/sun/tools/javac/util/BaseFileManager.java
...are/classes/com/sun/tools/javac/util/BaseFileManager.java
+6
-6
src/share/classes/com/sun/tools/javadoc/DocletInvoker.java
src/share/classes/com/sun/tools/javadoc/DocletInvoker.java
+1
-1
未找到文件。
src/share/classes/com/sun/tools/apt/main/Main.java
浏览文件 @
9b92bdd3
/*
* Copyright (c) 2004, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 201
1
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -56,7 +56,7 @@ import com.sun.tools.apt.comp.UsageMessageNeededException;
import
com.sun.tools.apt.util.Bark
;
import
com.sun.mirror.apt.AnnotationProcessorFactory
;
import
static
com
.
sun
.
tools
.
javac
.
file
.
Path
s
.
pathToURLs
;
import
static
com
.
sun
.
tools
.
javac
.
file
.
Location
s
.
pathToURLs
;
/** This class provides a commandline interface to the apt build-time
* tool.
...
...
src/share/classes/com/sun/tools/javac/file/JavacFileManager.java
浏览文件 @
9b92bdd3
...
...
@@ -54,17 +54,14 @@ import javax.tools.JavaFileManager;
import
javax.tools.JavaFileObject
;
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.RelativeDirectory
;
import
com.sun.tools.javac.main.OptionName
;
import
com.sun.tools.javac.util.BaseFileManager
;
import
com.sun.tools.javac.util.Context
;
import
com.sun.tools.javac.util.List
;
import
com.sun.tools.javac.util.ListBuffer
;
import
static
javax
.
tools
.
StandardLocation
.*;
import
static
com
.
sun
.
tools
.
javac
.
main
.
OptionName
.*;
/**
* This class provides access to the source, class and other files
...
...
@@ -89,23 +86,9 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
private
boolean
contextUseOptimizedZip
;
private
ZipFileIndexCache
zipFileIndexCache
;
private
final
File
uninited
=
new
File
(
"U N I N I T E D"
);
private
final
Set
<
JavaFileObject
.
Kind
>
sourceOrClass
=
EnumSet
.
of
(
JavaFileObject
.
Kind
.
SOURCE
,
JavaFileObject
.
Kind
.
CLASS
);
/** The standard output directory, primarily used for classes.
* Initialized by the "-d" option.
* If classOutDir = null, files are written into same directory as the sources
* they were generated from.
*/
private
File
classOutDir
=
uninited
;
/** The output directory, used when generating sources while processing annotations.
* Initialized by the "-s" option.
*/
private
File
sourceOutDir
=
uninited
;
protected
boolean
mmappedIO
;
protected
boolean
ignoreSymbolFile
;
...
...
@@ -169,7 +152,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
@Override
public
boolean
isDefaultBootClassPath
()
{
return
searchPath
s
.
isDefaultBootClassPath
();
return
location
s
.
isDefaultBootClassPath
();
}
public
JavaFileObject
getFileForInput
(
String
name
)
{
...
...
@@ -483,7 +466,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
*/
private
Archive
openArchive
(
File
zipFileName
,
boolean
useOptimizedZip
)
throws
IOException
{
File
origZipFileName
=
zipFileName
;
if
(!
ignoreSymbolFile
&&
searchPath
s
.
isDefaultBootClassPathRtJar
(
zipFileName
))
{
if
(!
ignoreSymbolFile
&&
location
s
.
isDefaultBootClassPathRtJar
(
zipFileName
))
{
File
file
=
zipFileName
.
getParentFile
().
getParentFile
();
// ${java.home}
if
(
new
File
(
file
.
getName
()).
equals
(
new
File
(
"jre"
)))
file
=
file
.
getParentFile
();
...
...
@@ -770,7 +753,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
}
else
if
(
location
==
SOURCE_OUTPUT
)
{
dir
=
(
getSourceOutDir
()
!=
null
?
getSourceOutDir
()
:
getClassOutDir
());
}
else
{
Iterable
<?
extends
File
>
path
=
searchPaths
.
getPathFor
Location
(
location
);
Iterable
<?
extends
File
>
path
=
locations
.
get
Location
(
location
);
dir
=
null
;
for
(
File
f:
path
)
{
dir
=
f
;
...
...
@@ -805,64 +788,20 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
throws
IOException
{
nullCheck
(
location
);
searchPaths
.
lazy
();
final
File
dir
=
location
.
isOutputLocation
()
?
getOutputDirectory
(
path
)
:
null
;
if
(
location
==
CLASS_OUTPUT
)
classOutDir
=
getOutputLocation
(
dir
,
D
);
else
if
(
location
==
SOURCE_OUTPUT
)
sourceOutDir
=
getOutputLocation
(
dir
,
S
);
else
searchPaths
.
setPathForLocation
(
location
,
path
);
}
// where
private
File
getOutputDirectory
(
Iterable
<?
extends
File
>
path
)
throws
IOException
{
if
(
path
==
null
)
return
null
;
Iterator
<?
extends
File
>
pathIter
=
path
.
iterator
();
if
(!
pathIter
.
hasNext
())
throw
new
IllegalArgumentException
(
"empty path for directory"
);
File
dir
=
pathIter
.
next
();
if
(
pathIter
.
hasNext
())
throw
new
IllegalArgumentException
(
"path too long for directory"
);
if
(!
dir
.
exists
())
throw
new
FileNotFoundException
(
dir
+
": does not exist"
);
else
if
(!
dir
.
isDirectory
())
throw
new
IOException
(
dir
+
": not a directory"
);
return
dir
;
}
private
File
getOutputLocation
(
File
dir
,
OptionName
defaultOptionName
)
{
if
(
dir
!=
null
)
return
dir
;
String
arg
=
options
.
get
(
defaultOptionName
);
if
(
arg
==
null
)
return
null
;
return
new
File
(
arg
);
locations
.
setLocation
(
location
,
path
);
}
public
Iterable
<?
extends
File
>
getLocation
(
Location
location
)
{
nullCheck
(
location
);
searchPaths
.
lazy
();
if
(
location
==
CLASS_OUTPUT
)
{
return
(
getClassOutDir
()
==
null
?
null
:
List
.
of
(
getClassOutDir
()));
}
else
if
(
location
==
SOURCE_OUTPUT
)
{
return
(
getSourceOutDir
()
==
null
?
null
:
List
.
of
(
getSourceOutDir
()));
}
else
return
searchPaths
.
getPathForLocation
(
location
);
return
locations
.
getLocation
(
location
);
}
private
File
getClassOutDir
()
{
if
(
classOutDir
==
uninited
)
classOutDir
=
getOutputLocation
(
null
,
D
);
return
classOutDir
;
return
locations
.
getOutputLocation
(
CLASS_OUTPUT
);
}
private
File
getSourceOutDir
()
{
if
(
sourceOutDir
==
uninited
)
sourceOutDir
=
getOutputLocation
(
null
,
S
);
return
sourceOutDir
;
return
locations
.
getOutputLocation
(
SOURCE_OUTPUT
);
}
/**
...
...
src/share/classes/com/sun/tools/javac/file/
Path
s.java
→
src/share/classes/com/sun/tools/javac/file/
Location
s.java
浏览文件 @
9b92bdd3
此差异已折叠。
点击以展开。
src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
浏览文件 @
9b92bdd3
...
...
@@ -169,7 +169,7 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
@Override
public
boolean
isDefaultBootClassPath
()
{
return
searchPath
s
.
isDefaultBootClassPath
();
return
location
s
.
isDefaultBootClassPath
();
}
// <editor-fold defaultstate="collapsed" desc="Location handling">
...
...
@@ -227,13 +227,13 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
if
(
locn
instanceof
StandardLocation
)
{
switch
((
StandardLocation
)
locn
)
{
case
CLASS_PATH:
files
=
searchPath
s
.
userClassPath
();
files
=
location
s
.
userClassPath
();
break
;
case
PLATFORM_CLASS_PATH:
files
=
searchPath
s
.
bootClassPath
();
files
=
location
s
.
bootClassPath
();
break
;
case
SOURCE_PATH:
files
=
searchPath
s
.
sourcePath
();
files
=
location
s
.
sourcePath
();
break
;
case
CLASS_OUTPUT:
{
String
arg
=
options
.
get
(
D
);
...
...
src/share/classes/com/sun/tools/javac/util/BaseFileManager.java
浏览文件 @
9b92bdd3
...
...
@@ -52,7 +52,7 @@ 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.
Path
s
;
import
com.sun.tools.javac.file.
Location
s
;
import
com.sun.tools.javac.main.JavacOption
;
import
com.sun.tools.javac.main.OptionName
;
import
com.sun.tools.javac.main.RecognizedOptions
;
...
...
@@ -67,7 +67,7 @@ public abstract class BaseFileManager {
protected
BaseFileManager
(
Charset
charset
)
{
this
.
charset
=
charset
;
byteBufferCache
=
new
ByteBufferCache
();
searchPaths
=
createPath
s
();
locations
=
createLocation
s
();
}
/**
...
...
@@ -77,11 +77,11 @@ public abstract class BaseFileManager {
log
=
Log
.
instance
(
context
);
options
=
Options
.
instance
(
context
);
classLoaderClass
=
options
.
get
(
"procloader"
);
searchPath
s
.
update
(
log
,
options
,
Lint
.
instance
(
context
),
FSInfo
.
instance
(
context
));
location
s
.
update
(
log
,
options
,
Lint
.
instance
(
context
),
FSInfo
.
instance
(
context
));
}
protected
Paths
createPath
s
()
{
return
new
Path
s
();
protected
Locations
createLocation
s
()
{
return
new
Location
s
();
}
/**
...
...
@@ -98,7 +98,7 @@ public abstract class BaseFileManager {
protected
String
classLoaderClass
;
protected
Paths
searchPath
s
;
protected
Locations
location
s
;
protected
Source
getSource
()
{
String
sourceName
=
options
.
get
(
OptionName
.
SOURCE
);
...
...
src/share/classes/com/sun/tools/javadoc/DocletInvoker.java
浏览文件 @
9b92bdd3
...
...
@@ -80,7 +80,7 @@ public class DocletInvoker {
cpString
=
appendPath
(
System
.
getProperty
(
"env.class.path"
),
cpString
);
cpString
=
appendPath
(
System
.
getProperty
(
"java.class.path"
),
cpString
);
cpString
=
appendPath
(
docletPath
,
cpString
);
URL
[]
urls
=
com
.
sun
.
tools
.
javac
.
file
.
Path
s
.
pathToURLs
(
cpString
);
URL
[]
urls
=
com
.
sun
.
tools
.
javac
.
file
.
Location
s
.
pathToURLs
(
cpString
);
if
(
docletParentClassLoader
==
null
)
appClassLoader
=
new
URLClassLoader
(
urls
,
getDelegationClassLoader
(
docletClassName
));
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录