Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
d485c90d
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看板
提交
d485c90d
编写于
3月 04, 2011
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
Reviewed-by: bpatel
上级
2c2ee4d7
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
95 addition
and
89 deletion
+95
-89
src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
.../com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
+5
-5
src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
...sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
+2
-3
src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
...sun/tools/doclets/formats/html/SourceToHTMLConverter.java
+2
-2
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
...lets/internal/toolkit/builders/SerializedFormBuilder.java
+2
-3
src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
...ses/com/sun/tools/doclets/internal/toolkit/util/Util.java
+14
-32
src/share/classes/com/sun/tools/javadoc/AnnotationDescImpl.java
...are/classes/com/sun/tools/javadoc/AnnotationDescImpl.java
+4
-2
src/share/classes/com/sun/tools/javadoc/AnnotationValueImpl.java
...re/classes/com/sun/tools/javadoc/AnnotationValueImpl.java
+4
-3
src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
+13
-3
src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java
...lasses/com/sun/tools/javadoc/ExecutableMemberDocImpl.java
+4
-2
src/share/classes/com/sun/tools/javadoc/FieldDocImpl.java
src/share/classes/com/sun/tools/javadoc/FieldDocImpl.java
+8
-5
src/share/classes/com/sun/tools/javadoc/ParameterizedTypeImpl.java
.../classes/com/sun/tools/javadoc/ParameterizedTypeImpl.java
+6
-6
src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java
src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java
+4
-3
src/share/classes/com/sun/tools/javadoc/TypeMaker.java
src/share/classes/com/sun/tools/javadoc/TypeMaker.java
+14
-14
src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java
...share/classes/com/sun/tools/javadoc/TypeVariableImpl.java
+5
-2
src/share/classes/com/sun/tools/javadoc/WildcardTypeImpl.java
...share/classes/com/sun/tools/javadoc/WildcardTypeImpl.java
+8
-4
未找到文件。
src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
浏览文件 @
d485c90d
/*
* Copyright (c) 1998, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
...
...
@@ -156,7 +156,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
if
(
index
<
0
)
{
return
htmlstr
;
}
StringBu
ffer
buf
=
new
StringBuff
er
();
StringBu
ilder
buf
=
new
StringBuild
er
();
int
previndex
=
0
;
while
(
true
)
{
// Search for lowercase version of {@docRoot}
...
...
@@ -2279,7 +2279,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
*/
public
String
commentTagsToString
(
Tag
holderTag
,
Doc
doc
,
Tag
[]
tags
,
boolean
isFirstSentence
)
{
StringBu
ffer
result
=
new
StringBuff
er
();
StringBu
ilder
result
=
new
StringBuild
er
();
// Array of all possible inline tags for this javadoc run
configuration
.
tagletManager
.
checkTags
(
doc
,
tags
,
true
);
for
(
int
i
=
0
;
i
<
tags
.
length
;
i
++)
{
...
...
@@ -2315,7 +2315,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
StringTokenizer
lines
=
new
StringTokenizer
(
text
,
"\r\n"
,
true
);
StringBuffer
textBuff
=
new
StringBuffer
();
while
(
lines
.
hasMoreTokens
())
{
StringBu
ffer
line
=
new
StringBuff
er
(
lines
.
nextToken
());
StringBu
ilder
line
=
new
StringBuild
er
(
lines
.
nextToken
());
Util
.
replaceTabs
(
configuration
.
sourcetab
,
line
);
textBuff
.
append
(
line
.
toString
());
}
...
...
@@ -2473,7 +2473,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return
text
;
}
int
endindex
=
startindex
+
tobe
.
length
();
StringBu
ffer
replaced
=
new
StringBuff
er
();
StringBu
ilder
replaced
=
new
StringBuild
er
();
if
(
startindex
>
0
)
{
replaced
.
append
(
text
.
substring
(
0
,
startindex
));
}
...
...
src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
浏览文件 @
d485c90d
/*
* Copyright (c) 1998, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
...
...
@@ -30,7 +30,6 @@ import java.util.*;
import
com.sun.javadoc.*
;
import
com.sun.tools.doclets.internal.toolkit.*
;
import
com.sun.tools.doclets.internal.toolkit.taglets.*
;
import
com.sun.tools.doclets.internal.toolkit.util.*
;
import
com.sun.tools.doclets.formats.html.markup.*
;
/**
...
...
@@ -53,7 +52,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
}
public
List
<
FieldDoc
>
members
(
ClassDoc
cd
)
{
return
Util
.
asList
(
cd
.
serializableFields
());
return
Arrays
.
asList
(
cd
.
serializableFields
());
}
protected
void
printTypeLinkNoDimension
(
Type
type
)
{
...
...
src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
浏览文件 @
d485c90d
/*
* Copyright (c) 2001, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
...
...
@@ -266,7 +266,7 @@ public class SourceToHTMLConverter {
private
static
void
addLine
(
Content
pre
,
String
line
,
int
tabLength
,
int
currentLineNo
)
{
if
(
line
!=
null
)
{
StringBu
ffer
lineBuffer
=
new
StringBuff
er
(
Util
.
escapeHtmlChars
(
line
));
StringBu
ilder
lineBuffer
=
new
StringBuild
er
(
Util
.
escapeHtmlChars
(
line
));
Util
.
replaceTabs
(
tabLength
,
lineBuffer
);
pre
.
addContent
(
new
RawHtml
(
lineBuffer
.
toString
()));
Content
anchor
=
HtmlTree
.
A_NAME
(
"line."
+
Integer
.
toString
(
currentLineNo
));
...
...
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
浏览文件 @
d485c90d
/*
* Copyright (c) 2003, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
...
...
@@ -375,8 +375,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
*/
public
void
buildFieldSerializationOverview
(
ClassDoc
classDoc
,
Content
classContentTree
)
{
if
(
classDoc
.
definesSerializableFields
())
{
FieldDoc
serialPersistentField
=
Util
.
asList
(
classDoc
.
serializableFields
()).
get
(
0
);
FieldDoc
serialPersistentField
=
classDoc
.
serializableFields
()[
0
];
// Check to see if there are inline comments, tags or deprecation
// information to be printed.
if
(
fieldWriter
.
shouldPrintOverview
(
serialPersistentField
))
{
...
...
src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
浏览文件 @
d485c90d
/*
* Copyright (c) 1999, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
...
...
@@ -382,7 +382,7 @@ public class Util {
out
.
close
();
}
}
catch
(
IOException
ie
)
{
ie
.
printStackTrace
();
ie
.
printStackTrace
(
System
.
err
);
throw
new
DocletAbortException
();
}
}
...
...
@@ -399,12 +399,12 @@ public class Util {
String
pkgPath
=
DirectoryManager
.
getDirectoryPath
(
pkgDoc
);
String
completePath
=
new
SourcePath
(
configuration
.
sourcepath
).
getDirectory
(
pkgPath
)
+
DirectoryManager
.
URL_FILE_SEPARATOR
;
//Make sure that both paths are using the same sep
e
rators.
//Make sure that both paths are using the same sep
a
rators.
completePath
=
Util
.
replaceText
(
completePath
,
File
.
separator
,
DirectoryManager
.
URL_FILE_SEPARATOR
);
pkgPath
=
Util
.
replaceText
(
pkgPath
,
File
.
separator
,
DirectoryManager
.
URL_FILE_SEPARATOR
);
return
completePath
.
substring
(
0
,
completePath
.
i
ndexOf
(
pkgPath
));
return
completePath
.
substring
(
0
,
completePath
.
lastI
ndexOf
(
pkgPath
));
}
catch
(
Exception
e
){
return
""
;
}
...
...
@@ -536,15 +536,6 @@ public class Util {
findAllInterfaceTypes
(
results
,
(
ClassDoc
)
type
,
true
,
configuration
);
}
public
static
<
T
extends
ProgramElementDoc
>
List
<
T
>
asList
(
T
[]
members
)
{
List
<
T
>
list
=
new
ArrayList
<
T
>();
for
(
int
i
=
0
;
i
<
members
.
length
;
i
++)
{
list
.
add
(
members
[
i
]);
}
return
list
;
}
/**
* Enclose in quotes, used for paths and filenames that contains spaces
*/
...
...
@@ -583,14 +574,7 @@ public class Util {
if
(
oldStr
==
null
||
newStr
==
null
||
oldStr
.
equals
(
newStr
))
{
return
originalStr
;
}
StringBuffer
result
=
new
StringBuffer
(
originalStr
);
int
startIndex
=
0
;
while
((
startIndex
=
result
.
indexOf
(
oldStr
,
startIndex
))
!=
-
1
)
{
result
=
result
.
replace
(
startIndex
,
startIndex
+
oldStr
.
length
(),
newStr
);
startIndex
+=
newStr
.
length
();
}
return
result
.
toString
();
return
originalStr
.
replace
(
oldStr
,
newStr
);
}
/**
...
...
@@ -833,19 +817,17 @@ public class Util {
* @param tabLength the length of each tab.
* @param s the String to scan.
*/
public
static
void
replaceTabs
(
int
tabLength
,
StringBuffer
s
)
{
int
index
,
col
;
StringBuffer
whitespace
;
while
((
index
=
s
.
indexOf
(
"\t"
))
!=
-
1
)
{
whitespace
=
new
StringBuffer
();
col
=
index
;
do
{
whitespace
.
append
(
" "
);
col
++;
}
while
((
col
%
tabLength
)
!=
0
);
s
.
replace
(
index
,
index
+
1
,
whitespace
.
toString
());
public
static
void
replaceTabs
(
int
tabLength
,
StringBuilder
s
)
{
if
(
whitespace
==
null
||
whitespace
.
length
()
<
tabLength
)
whitespace
=
String
.
format
(
"%"
+
tabLength
+
"s"
,
" "
);
int
index
=
0
;
while
((
index
=
s
.
indexOf
(
"\t"
,
index
))
!=
-
1
)
{
int
spaceCount
=
tabLength
-
index
%
tabLength
;
s
.
replace
(
index
,
index
+
1
,
whitespace
.
substring
(
0
,
spaceCount
));
index
+=
spaceCount
;
}
}
private
static
String
whitespace
;
/**
* The documentation for values() and valueOf() in Enums are set by the
...
...
src/share/classes/com/sun/tools/javadoc/AnnotationDescImpl.java
浏览文件 @
d485c90d
/*
* Copyright (c) 2003, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -92,8 +92,9 @@ public class AnnotationDescImpl implements AnnotationDesc {
* @com.example.foo
* Omit parens for marker annotations, and omit "value=" when allowed.
*/
@Override
public
String
toString
()
{
StringBu
ffer
sb
=
new
StringBuff
er
(
"@"
);
StringBu
ilder
sb
=
new
StringBuild
er
(
"@"
);
sb
.
append
(
annotation
.
type
.
tsym
);
ElementValuePair
vals
[]
=
elementValues
();
...
...
@@ -153,6 +154,7 @@ public class AnnotationDescImpl implements AnnotationDesc {
* Returns a string representation of this pair
* of the form "name=value".
*/
@Override
public
String
toString
()
{
return
meth
.
name
+
"="
+
value
();
}
...
...
src/share/classes/com/sun/tools/javadoc/AnnotationValueImpl.java
浏览文件 @
d485c90d
/*
* Copyright (c) 2003, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -30,7 +30,6 @@ import com.sun.javadoc.*;
import
com.sun.tools.javac.code.Attribute
;
import
com.sun.tools.javac.code.Symbol.*
;
import
com.sun.tools.javac.code.Type
;
import
com.sun.tools.javac.code.TypeTags
;
...
...
@@ -114,6 +113,7 @@ public class AnnotationValueImpl implements AnnotationValue {
* @return the text of a Java language annotation value expression
* whose value is the value of this annotation type element.
*/
@Override
public
String
toString
()
{
ToStringVisitor
tv
=
new
ToStringVisitor
();
attr
.
accept
(
tv
);
...
...
@@ -121,8 +121,9 @@ public class AnnotationValueImpl implements AnnotationValue {
}
private
class
ToStringVisitor
implements
Attribute
.
Visitor
{
private
final
StringBu
ffer
sb
=
new
StringBuff
er
();
private
final
StringBu
ilder
sb
=
new
StringBuild
er
();
@Override
public
String
toString
()
{
return
sb
.
toString
();
}
...
...
src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
浏览文件 @
d485c90d
/*
* Copyright (c) 1997, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
...
...
@@ -64,7 +64,6 @@ import com.sun.tools.javac.util.Name;
import
com.sun.tools.javac.util.Names
;
import
com.sun.tools.javac.util.Position
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
/**
...
...
@@ -147,6 +146,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
/**
* Return true if this is a class, not an interface.
*/
@Override
public
boolean
isClass
()
{
return
!
Modifier
.
isInterface
(
getModifiers
());
}
...
...
@@ -155,6 +155,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
* Return true if this is a ordinary class,
* not an enumeration, exception, an error, or an interface.
*/
@Override
public
boolean
isOrdinaryClass
()
{
if
(
isEnum
()
||
isInterface
()
||
isAnnotationType
())
{
return
false
;
...
...
@@ -172,6 +173,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
* Return true if this is an enumeration.
* (For legacy doclets, return false.)
*/
@Override
public
boolean
isEnum
()
{
return
(
getFlags
()
&
Flags
.
ENUM
)
!=
0
&&
...
...
@@ -182,6 +184,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
* Return true if this is an interface, but not an annotation type.
* Overridden by AnnotationTypeDocImpl.
*/
@Override
public
boolean
isInterface
()
{
return
Modifier
.
isInterface
(
getModifiers
());
}
...
...
@@ -189,6 +192,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
/**
* Return true if this is an exception class
*/
@Override
public
boolean
isException
()
{
if
(
isEnum
()
||
isInterface
()
||
isAnnotationType
())
{
return
false
;
...
...
@@ -204,6 +208,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
/**
* Return true if this is an error class
*/
@Override
public
boolean
isError
()
{
if
(
isEnum
()
||
isInterface
()
||
isAnnotationType
())
{
return
false
;
...
...
@@ -275,6 +280,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
/**
* Return the package that this class is contained in.
*/
@Override
public
PackageDoc
containingPackage
()
{
PackageDocImpl
p
=
env
.
getPackageDoc
(
tsym
.
packge
());
if
(
p
.
setDocPath
==
false
)
{
...
...
@@ -374,6 +380,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
* Return the qualified name and any type parameters.
* Each parameter is a type variable with optional bounds.
*/
@Override
public
String
toString
()
{
return
classToString
(
env
,
tsym
,
true
);
}
...
...
@@ -401,7 +408,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
* qualified by their enclosing class(es) only.
*/
static
String
classToString
(
DocEnv
env
,
ClassSymbol
c
,
boolean
full
)
{
StringBu
ffer
s
=
new
StringBuff
er
();
StringBu
ilder
s
=
new
StringBuild
er
();
if
(!
c
.
isInner
())
{
// if c is not an inner class
s
.
append
(
getClassName
(
c
,
full
));
}
else
{
...
...
@@ -449,10 +456,12 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
* Return the modifier string for this class. If it's an interface
* exclude 'abstract' keyword from the modifier string
*/
@Override
public
String
modifiers
()
{
return
Modifier
.
toString
(
modifierSpecifier
());
}
@Override
public
int
modifierSpecifier
()
{
int
modifiers
=
getModifiers
();
return
(
isInterface
()
||
isAnnotationType
())
...
...
@@ -1285,6 +1294,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
* Return the source position of the entity, or null if
* no position is available.
*/
@Override
public
SourcePosition
position
()
{
if
(
tsym
.
sourcefile
==
null
)
return
null
;
return
SourcePositionImpl
.
make
(
tsym
.
sourcefile
,
...
...
src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java
浏览文件 @
d485c90d
/*
* Copyright (c) 1997, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
11
, 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
...
...
@@ -226,7 +226,7 @@ public abstract class ExecutableMemberDocImpl
}
private
String
makeSignature
(
boolean
full
)
{
StringBu
ffer
result
=
new
StringBuff
er
();
StringBu
ilder
result
=
new
StringBuild
er
();
result
.
append
(
"("
);
for
(
List
<
Type
>
types
=
sym
.
type
.
getParameterTypes
();
types
.
nonEmpty
();
)
{
Type
t
=
types
.
head
;
...
...
@@ -251,6 +251,7 @@ public abstract class ExecutableMemberDocImpl
/**
* Generate a key for sorting.
*/
@Override
CollationKey
generateKey
()
{
String
k
=
name
()
+
flatSignature
()
+
typeParametersString
();
// ',' and '&' are between '$' and 'a': normalize to spaces.
...
...
@@ -263,6 +264,7 @@ public abstract class ExecutableMemberDocImpl
* Return the source position of the entity, or null if
* no position is available.
*/
@Override
public
SourcePosition
position
()
{
if
(
sym
.
enclClass
().
sourcefile
==
null
)
return
null
;
return
SourcePositionImpl
.
make
(
sym
.
enclClass
().
sourcefile
,
...
...
src/share/classes/com/sun/tools/javadoc/FieldDocImpl.java
浏览文件 @
d485c90d
/*
* Copyright (c) 1997, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
11
, 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
...
...
@@ -142,7 +142,7 @@ public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
return
v
+
(
suffix
==
'f'
||
suffix
==
'F'
?
""
+
suffix
:
""
);
}
private
static
String
sourceForm
(
char
c
)
{
StringBu
ffer
buf
=
new
StringBuff
er
(
8
);
StringBu
ilder
buf
=
new
StringBuild
er
(
8
);
buf
.
append
(
'\''
);
sourceChar
(
c
,
buf
);
buf
.
append
(
'\''
);
...
...
@@ -152,7 +152,7 @@ public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
return
"0x"
+
Integer
.
toString
(
c
&
0xff
,
16
);
}
private
static
String
sourceForm
(
String
s
)
{
StringBu
ffer
buf
=
new
StringBuff
er
(
s
.
length
()
+
5
);
StringBu
ilder
buf
=
new
StringBuild
er
(
s
.
length
()
+
5
);
buf
.
append
(
'\"'
);
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
...
...
@@ -161,7 +161,7 @@ public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
buf
.
append
(
'\"'
);
return
buf
.
toString
();
}
private
static
void
sourceChar
(
char
c
,
StringBu
ff
er
buf
)
{
private
static
void
sourceChar
(
char
c
,
StringBu
ild
er
buf
)
{
switch
(
c
)
{
case
'\b'
:
buf
.
append
(
"\\b"
);
return
;
case
'\t'
:
buf
.
append
(
"\\t"
);
return
;
...
...
@@ -179,7 +179,7 @@ public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
return
;
}
}
private
static
void
unicodeEscape
(
char
c
,
StringBu
ff
er
buf
)
{
private
static
void
unicodeEscape
(
char
c
,
StringBu
ild
er
buf
)
{
final
String
chars
=
"0123456789abcdef"
;
buf
.
append
(
"\\u"
);
buf
.
append
(
chars
.
charAt
(
15
&
(
c
>>
12
)));
...
...
@@ -201,6 +201,7 @@ public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
/**
* Is this Doc item a field (but not an enum constant?
*/
@Override
public
boolean
isField
()
{
return
!
isEnumConstant
();
}
...
...
@@ -209,6 +210,7 @@ public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
* Is this Doc item an enum constant?
* (For legacy doclets, return false.)
*/
@Override
public
boolean
isEnumConstant
()
{
return
(
getFlags
()
&
Flags
.
ENUM
)
!=
0
&&
!
env
.
legacyDoclet
;
...
...
@@ -257,6 +259,7 @@ public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
* Return the source position of the entity, or null if
* no position is available.
*/
@Override
public
SourcePosition
position
()
{
if
(
sym
.
enclClass
().
sourcefile
==
null
)
return
null
;
return
SourcePositionImpl
.
make
(
sym
.
enclClass
().
sourcefile
,
...
...
src/share/classes/com/sun/tools/javadoc/ParameterizedTypeImpl.java
浏览文件 @
d485c90d
/*
* Copyright (c) 2003, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -25,15 +25,11 @@
package
com.sun.tools.javadoc
;
import
com.sun.javadoc.*
;
import
static
com
.
sun
.
javadoc
.
LanguageVersion
.*;
import
com.sun.tools.javac.code.Symbol.ClassSymbol
;
import
com.sun.tools.javac.code.Type
;
import
com.sun.tools.javac.code.Type.ClassType
;
import
com.sun.tools.javac.util.List
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
...
...
@@ -55,6 +51,7 @@ public class ParameterizedTypeImpl
/**
* Return the generic class or interface that declared this type.
*/
@Override
public
ClassDoc
asClassDoc
()
{
return
env
.
getClassDoc
((
ClassSymbol
)
type
.
tsym
);
}
...
...
@@ -111,14 +108,17 @@ public class ParameterizedTypeImpl
// Asking for the "name" of a parameterized type doesn't exactly make
// sense. It's a type expression. Return the name of its generic
// type.
@Override
public
String
typeName
()
{
return
TypeMaker
.
getTypeName
(
type
,
false
);
}
@Override
public
ParameterizedType
asParameterizedType
()
{
return
this
;
}
@Override
public
String
toString
()
{
return
parameterizedTypeToString
(
env
,
(
ClassType
)
type
,
true
);
}
...
...
@@ -128,7 +128,7 @@ public class ParameterizedTypeImpl
if
(
env
.
legacyDoclet
)
{
return
TypeMaker
.
getTypeName
(
cl
,
full
);
}
StringBu
ffer
s
=
new
StringBuff
er
();
StringBu
ilder
s
=
new
StringBuild
er
();
if
(
cl
.
getEnclosingType
().
tag
!=
CLASS
)
{
// if not an inner class...
s
.
append
(
TypeMaker
.
getTypeName
(
cl
,
full
));
}
else
{
...
...
src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java
浏览文件 @
d485c90d
/*
* Copyright (c) 1997, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
11
, 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
...
...
@@ -358,14 +358,14 @@ class SeeTagImpl extends TagImpl implements SeeTag, LayoutCharacters {
String
parameters
;
StringBu
ff
er
typeId
;
StringBu
ild
er
typeId
;
ListBuffer
<
String
>
paramList
;
ParameterParseMachine
(
String
parameters
)
{
this
.
parameters
=
parameters
;
this
.
paramList
=
new
ListBuffer
<
String
>();
typeId
=
new
StringBu
ff
er
();
typeId
=
new
StringBu
ild
er
();
}
public
String
[]
parseParameters
()
{
...
...
@@ -464,6 +464,7 @@ class SeeTagImpl extends TagImpl implements SeeTag, LayoutCharacters {
/**
* Return the kind of this tag.
*/
@Override
public
String
kind
()
{
return
"@see"
;
}
...
...
src/share/classes/com/sun/tools/javadoc/TypeMaker.java
浏览文件 @
d485c90d
/*
* Copyright (c) 1997, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
11
, 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
...
...
@@ -27,15 +27,12 @@ package com.sun.tools.javadoc;
import
com.sun.javadoc.*
;
import
static
com
.
sun
.
javadoc
.
LanguageVersion
.*;
import
com.sun.tools.javac.code.Symbol
;
import
com.sun.tools.javac.code.Symbol.ClassSymbol
;
import
com.sun.tools.javac.code.Type
;
import
com.sun.tools.javac.code.Type.ClassType
;
import
com.sun.tools.javac.code.Type.TypeVar
;
import
com.sun.tools.javac.code.Type.ArrayType
;
import
com.sun.tools.javac.code.Types
;
import
com.sun.tools.javac.util.List
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
...
...
@@ -109,12 +106,13 @@ public class TypeMaker {
public
static
String
getTypeName
(
Type
t
,
boolean
full
)
{
switch
(
t
.
tag
)
{
case
ARRAY:
StringBu
ffer
dimension
=
new
StringBuff
er
();
StringBu
ilder
s
=
new
StringBuild
er
();
while
(
t
.
tag
==
ARRAY
)
{
dimension
=
dimension
.
append
(
"[]"
);
s
.
append
(
"[]"
);
t
=
((
ArrayType
)
t
).
elemtype
;
}
return
getTypeName
(
t
,
full
)
+
dimension
;
s
.
insert
(
0
,
getTypeName
(
t
,
full
));
return
s
.
toString
();
case
CLASS:
return
ClassDocImpl
.
getClassName
((
ClassSymbol
)
t
.
tsym
,
full
);
default
:
...
...
@@ -130,12 +128,13 @@ public class TypeMaker {
static
String
getTypeString
(
DocEnv
env
,
Type
t
,
boolean
full
)
{
switch
(
t
.
tag
)
{
case
ARRAY:
StringBu
ffer
dimension
=
new
StringBuff
er
();
StringBu
ilder
s
=
new
StringBuild
er
();
while
(
t
.
tag
==
ARRAY
)
{
dimension
=
dimension
.
append
(
"[]"
);
s
.
append
(
"[]"
);
t
=
env
.
types
.
elemtype
(
t
);
}
return
getTypeString
(
env
,
t
,
full
)
+
dimension
;
s
.
insert
(
0
,
getTypeString
(
env
,
t
,
full
));
return
s
.
toString
();
case
CLASS:
return
ParameterizedTypeImpl
.
parameterizedTypeToString
(
env
,
(
ClassType
)
t
,
full
);
...
...
@@ -157,7 +156,7 @@ public class TypeMaker {
if
(
env
.
legacyDoclet
||
sym
.
type
.
getTypeArguments
().
isEmpty
())
{
return
""
;
}
StringBu
ffer
s
=
new
StringBuff
er
();
StringBu
ilder
s
=
new
StringBuild
er
();
for
(
Type
t
:
sym
.
type
.
getTypeArguments
())
{
s
.
append
(
s
.
length
()
==
0
?
"<"
:
", "
);
s
.
append
(
TypeVariableImpl
.
typeVarToString
(
env
,
(
TypeVar
)
t
,
full
));
...
...
@@ -175,7 +174,7 @@ public class TypeMaker {
if
(
env
.
legacyDoclet
||
cl
.
getTypeArguments
().
isEmpty
())
{
return
""
;
}
StringBu
ffer
s
=
new
StringBuff
er
();
StringBu
ilder
s
=
new
StringBuild
er
();
for
(
Type
t
:
cl
.
getTypeArguments
())
{
s
.
append
(
s
.
length
()
==
0
?
"<"
:
", "
);
s
.
append
(
getTypeString
(
env
,
t
,
full
));
...
...
@@ -213,9 +212,9 @@ public class TypeMaker {
* For example, a two dimensional array of String returns '[][]'.
*/
public
String
dimension
()
{
StringBu
ffer
dimension
=
new
StringBuff
er
();
StringBu
ilder
dimension
=
new
StringBuild
er
();
for
(
Type
t
=
arrayType
;
t
.
tag
==
ARRAY
;
t
=
env
.
types
.
elemtype
(
t
))
{
dimension
=
dimension
.
append
(
"[]"
);
dimension
.
append
(
"[]"
);
}
return
dimension
.
toString
();
}
...
...
@@ -304,6 +303,7 @@ public class TypeMaker {
*
* @return name of type including any dimension information.
*/
@Override
public
String
toString
()
{
return
qualifiedTypeName
()
+
dimension
();
}
...
...
src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java
浏览文件 @
d485c90d
/*
* Copyright (c) 2003, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -78,14 +78,17 @@ public class TypeVariableImpl extends AbstractTypeImpl implements TypeVariable {
/**
* Return the ClassDoc of the erasure of this type variable.
*/
@Override
public
ClassDoc
asClassDoc
()
{
return
env
.
getClassDoc
((
ClassSymbol
)
env
.
types
.
erasure
(
type
).
tsym
);
}
@Override
public
TypeVariable
asTypeVariable
()
{
return
this
;
}
@Override
public
String
toString
()
{
return
typeVarToString
(
env
,
(
TypeVar
)
type
,
true
);
}
...
...
@@ -96,7 +99,7 @@ public class TypeVariableImpl extends AbstractTypeImpl implements TypeVariable {
* "extends" clause. Class names are qualified if "full" is true.
*/
static
String
typeVarToString
(
DocEnv
env
,
TypeVar
v
,
boolean
full
)
{
StringBu
ffer
s
=
new
StringBuff
er
(
v
.
toString
());
StringBu
ilder
s
=
new
StringBuild
er
(
v
.
toString
());
List
<
Type
>
bounds
=
getBounds
(
v
,
env
);
if
(
bounds
.
nonEmpty
())
{
boolean
first
=
true
;
...
...
src/share/classes/com/sun/tools/javadoc/WildcardTypeImpl.java
浏览文件 @
d485c90d
/*
* Copyright (c) 2003, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
...
@@ -28,8 +28,6 @@ package com.sun.tools.javadoc;
import
com.sun.javadoc.*
;
import
static
com
.
sun
.
javadoc
.
LanguageVersion
.*;
import
com.sun.tools.javac.code.Symbol.ClassSymbol
;
import
com.sun.tools.javac.code.Type
;
import
com.sun.tools.javac.util.List
;
...
...
@@ -69,18 +67,24 @@ public class WildcardTypeImpl extends AbstractTypeImpl implements WildcardType {
/**
* Return the ClassDoc of the erasure of this wildcard type.
*/
@Override
public
ClassDoc
asClassDoc
()
{
return
env
.
getClassDoc
((
ClassSymbol
)
env
.
types
.
erasure
(
type
).
tsym
);
}
@Override
public
WildcardType
asWildcardType
()
{
return
this
;
}
@Override
public
String
typeName
()
{
return
"?"
;
}
@Override
public
String
qualifiedTypeName
()
{
return
"?"
;
}
@Override
public
String
simpleTypeName
()
{
return
"?"
;
}
@Override
public
String
toString
()
{
return
wildcardTypeToString
(
env
,
(
Type
.
WildcardType
)
type
,
true
);
}
...
...
@@ -96,7 +100,7 @@ public class WildcardTypeImpl extends AbstractTypeImpl implements WildcardType {
if
(
env
.
legacyDoclet
)
{
return
TypeMaker
.
getTypeName
(
env
.
types
.
erasure
(
wildThing
),
full
);
}
StringBu
ffer
s
=
new
StringBuff
er
(
"?"
);
StringBu
ilder
s
=
new
StringBuild
er
(
"?"
);
List
<
Type
>
bounds
=
getExtendsBounds
(
wildThing
);
if
(
bounds
.
nonEmpty
())
{
s
.
append
(
" extends "
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录