Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
39458a8b
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看板
提交
39458a8b
编写于
12月 16, 2012
作者:
J
jfranck
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8005098: Provide isSynthesized() information on Attribute.Compound
Reviewed-by: jjg
上级
2172d121
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
54 addition
and
23 deletion
+54
-23
make/build.properties
make/build.properties
+1
-1
src/share/classes/com/sun/tools/javac/code/Attribute.java
src/share/classes/com/sun/tools/javac/code/Attribute.java
+15
-0
src/share/classes/com/sun/tools/javac/code/Symbol.java
src/share/classes/com/sun/tools/javac/code/Symbol.java
+24
-9
src/share/classes/com/sun/tools/javac/comp/Annotate.java
src/share/classes/com/sun/tools/javac/comp/Annotate.java
+1
-0
src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
+5
-5
src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
+2
-2
src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java
src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java
+2
-2
src/share/classes/com/sun/tools/javadoc/ParameterImpl.java
src/share/classes/com/sun/tools/javadoc/ParameterImpl.java
+2
-2
src/share/classes/com/sun/tools/javadoc/ProgramElementDocImpl.java
.../classes/com/sun/tools/javadoc/ProgramElementDocImpl.java
+2
-2
未找到文件。
make/build.properties
浏览文件 @
39458a8b
...
...
@@ -68,7 +68,7 @@ javac.no.jdk.warnings = -XDignore.symbol.file=true
# set the following to -version to verify the versions of javac being used
javac.version.opt
=
# in time, there should be no exceptions to -Xlint:all
javac.lint.opts
=
-Xlint:all
,-deprecation
-Werror
javac.lint.opts
=
-Xlint:all -Werror
# options for the <javadoc> task for javac
#javadoc.jls3.url=http://java.sun.com/docs/books/jls/
...
...
src/share/classes/com/sun/tools/javac/code/Attribute.java
浏览文件 @
39458a8b
...
...
@@ -60,6 +60,9 @@ public abstract class Attribute implements AnnotationValue {
throw
new
UnsupportedOperationException
();
}
public
boolean
isSynthesized
()
{
return
false
;
}
/** The value for an annotation element of primitive type or String. */
public
static
class
Constant
extends
Attribute
{
...
...
@@ -136,6 +139,18 @@ public abstract class Attribute implements AnnotationValue {
* access this attribute.
*/
public
final
List
<
Pair
<
MethodSymbol
,
Attribute
>>
values
;
private
boolean
synthesized
=
false
;
@Override
public
boolean
isSynthesized
()
{
return
synthesized
;
}
public
void
setSynthesized
(
boolean
synthesized
)
{
this
.
synthesized
=
synthesized
;
}
public
Compound
(
Type
type
,
List
<
Pair
<
MethodSymbol
,
Attribute
>>
values
)
{
super
(
type
);
...
...
src/share/classes/com/sun/tools/javac/code/Symbol.java
浏览文件 @
39458a8b
...
...
@@ -83,13 +83,13 @@ public abstract class Symbol implements Element {
* Attributes of class symbols should be accessed through the accessor
* method to make sure that the class symbol is loaded.
*/
public
List
<
Attribute
.
Compound
>
get
AnnotationMirror
s
()
{
return
Assert
.
checkNonNull
(
annotations
.
getAttributes
()
);
public
List
<
Attribute
.
Compound
>
get
RawAttribute
s
()
{
return
annotations
.
getAttributes
(
);
}
/** Fetch a particular annotation from a symbol. */
public
Attribute
.
Compound
attribute
(
Symbol
anno
)
{
for
(
Attribute
.
Compound
a
:
get
AnnotationMirror
s
())
{
for
(
Attribute
.
Compound
a
:
get
RawAttribute
s
())
{
if
(
a
.
type
.
tsym
==
anno
)
return
a
;
}
return
null
;
...
...
@@ -446,6 +446,14 @@ public abstract class Symbol implements Element {
return
name
;
}
/**
* This is the implementation for {@code
* javax.lang.model.element.Element.getAnnotationMirrors()}.
*/
public
final
List
<
Attribute
.
Compound
>
getAnnotationMirrors
()
{
return
getRawAttributes
();
}
/**
* @deprecated this method should never be used by javac internally.
*/
...
...
@@ -662,15 +670,21 @@ public abstract class Symbol implements Element {
return
flags_field
;
}
public
List
<
Attribute
.
Compound
>
getAnnotationMirrors
()
{
@Override
public
List
<
Attribute
.
Compound
>
getRawAttributes
()
{
if
(
completer
!=
null
)
complete
();
if
(
package_info
!=
null
&&
package_info
.
completer
!=
null
)
{
package_info
.
complete
();
if
(
annotations
.
isEmpty
())
{
annotations
.
setAttributes
(
package_info
.
annotations
);
mergeAttributes
();
}
return
super
.
getRawAttributes
();
}
private
void
mergeAttributes
()
{
if
(
annotations
.
isEmpty
()
&&
!
package_info
.
annotations
.
isEmpty
())
{
annotations
.
setAttributes
(
package_info
.
annotations
);
}
return
Assert
.
checkNonNull
(
annotations
.
getAttributes
());
}
/** A package "exists" if a type or package that exists has
...
...
@@ -770,9 +784,10 @@ public abstract class Symbol implements Element {
return
members_field
;
}
public
List
<
Attribute
.
Compound
>
getAnnotationMirrors
()
{
@Override
public
List
<
Attribute
.
Compound
>
getRawAttributes
()
{
if
(
completer
!=
null
)
complete
();
return
Assert
.
checkNonNull
(
annotations
.
getAttributes
()
);
return
super
.
getRawAttributes
(
);
}
public
Type
erasure
(
Types
types
)
{
...
...
src/share/classes/com/sun/tools/javac/comp/Annotate.java
浏览文件 @
39458a8b
...
...
@@ -400,6 +400,7 @@ public class Annotate {
Attribute
.
Compound
c
=
enterAnnotation
(
annoTree
,
targetContainerType
,
ctx
.
env
);
c
.
setSynthesized
(
true
);
return
c
;
}
else
{
return
null
;
// errors should have been reported elsewhere
...
...
src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
浏览文件 @
39458a8b
...
...
@@ -721,7 +721,7 @@ public class ClassWriter extends ClassFile {
endAttr
(
alenIdx
);
acount
++;
}
acount
+=
writeJavaAnnotations
(
sym
.
get
AnnotationMirror
s
());
acount
+=
writeJavaAnnotations
(
sym
.
get
RawAttribute
s
());
return
acount
;
}
...
...
@@ -732,7 +732,7 @@ public class ClassWriter extends ClassFile {
boolean
hasVisible
=
false
;
boolean
hasInvisible
=
false
;
if
(
m
.
params
!=
null
)
for
(
VarSymbol
s
:
m
.
params
)
{
for
(
Attribute
.
Compound
a
:
s
.
get
AnnotationMirror
s
())
{
for
(
Attribute
.
Compound
a
:
s
.
get
RawAttribute
s
())
{
switch
(
types
.
getRetention
(
a
))
{
case
SOURCE:
break
;
case
CLASS:
hasInvisible
=
true
;
break
;
...
...
@@ -748,7 +748,7 @@ public class ClassWriter extends ClassFile {
databuf
.
appendByte
(
m
.
params
.
length
());
for
(
VarSymbol
s
:
m
.
params
)
{
ListBuffer
<
Attribute
.
Compound
>
buf
=
new
ListBuffer
<
Attribute
.
Compound
>();
for
(
Attribute
.
Compound
a
:
s
.
get
AnnotationMirror
s
())
for
(
Attribute
.
Compound
a
:
s
.
get
RawAttribute
s
())
if
(
types
.
getRetention
(
a
)
==
RetentionPolicy
.
RUNTIME
)
buf
.
append
(
a
);
databuf
.
appendChar
(
buf
.
length
());
...
...
@@ -763,7 +763,7 @@ public class ClassWriter extends ClassFile {
databuf
.
appendByte
(
m
.
params
.
length
());
for
(
VarSymbol
s
:
m
.
params
)
{
ListBuffer
<
Attribute
.
Compound
>
buf
=
new
ListBuffer
<
Attribute
.
Compound
>();
for
(
Attribute
.
Compound
a
:
s
.
get
AnnotationMirror
s
())
for
(
Attribute
.
Compound
a
:
s
.
get
RawAttribute
s
())
if
(
types
.
getRetention
(
a
)
==
RetentionPolicy
.
CLASS
)
buf
.
append
(
a
);
databuf
.
appendChar
(
buf
.
length
());
...
...
@@ -1636,7 +1636,7 @@ public class ClassWriter extends ClassFile {
}
acount
+=
writeFlagAttrs
(
c
.
flags
());
acount
+=
writeJavaAnnotations
(
c
.
get
AnnotationMirror
s
());
acount
+=
writeJavaAnnotations
(
c
.
get
RawAttribute
s
());
acount
+=
writeEnclosingMethodAttribute
(
c
);
acount
+=
writeExtraClassAttributes
(
c
);
...
...
src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
浏览文件 @
39458a8b
...
...
@@ -684,7 +684,7 @@ public class TreeMaker implements JCTree.Factory {
public
JCVariableDecl
VarDef
(
VarSymbol
v
,
JCExpression
init
)
{
return
(
JCVariableDecl
)
new
JCVariableDecl
(
Modifiers
(
v
.
flags
(),
Annotations
(
v
.
get
AnnotationMirror
s
())),
Modifiers
(
v
.
flags
(),
Annotations
(
v
.
get
RawAttribute
s
())),
v
.
name
,
Type
(
v
.
type
),
init
,
...
...
@@ -800,7 +800,7 @@ public class TreeMaker implements JCTree.Factory {
public
JCMethodDecl
MethodDef
(
MethodSymbol
m
,
Type
mtype
,
JCBlock
body
)
{
return
(
JCMethodDecl
)
new
JCMethodDecl
(
Modifiers
(
m
.
flags
(),
Annotations
(
m
.
get
AnnotationMirror
s
())),
Modifiers
(
m
.
flags
(),
Annotations
(
m
.
get
RawAttribute
s
())),
m
.
name
,
Type
(
mtype
.
getReturnType
()),
TypeParams
(
mtype
.
getTypeArguments
()),
...
...
src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java
浏览文件 @
39458a8b
...
...
@@ -288,9 +288,9 @@ public class PackageDocImpl extends DocImpl implements PackageDoc {
* Return an empty array if there are none.
*/
public
AnnotationDesc
[]
annotations
()
{
AnnotationDesc
res
[]
=
new
AnnotationDesc
[
sym
.
get
AnnotationMirror
s
().
length
()];
AnnotationDesc
res
[]
=
new
AnnotationDesc
[
sym
.
get
RawAttribute
s
().
length
()];
int
i
=
0
;
for
(
Attribute
.
Compound
a
:
sym
.
get
AnnotationMirror
s
())
{
for
(
Attribute
.
Compound
a
:
sym
.
get
RawAttribute
s
())
{
res
[
i
++]
=
new
AnnotationDescImpl
(
env
,
a
);
}
return
res
;
...
...
src/share/classes/com/sun/tools/javadoc/ParameterImpl.java
浏览文件 @
39458a8b
...
...
@@ -99,9 +99,9 @@ class ParameterImpl implements Parameter {
* Return an empty array if there are none.
*/
public
AnnotationDesc
[]
annotations
()
{
AnnotationDesc
res
[]
=
new
AnnotationDesc
[
sym
.
get
AnnotationMirror
s
().
length
()];
AnnotationDesc
res
[]
=
new
AnnotationDesc
[
sym
.
get
RawAttribute
s
().
length
()];
int
i
=
0
;
for
(
Attribute
.
Compound
a
:
sym
.
get
AnnotationMirror
s
())
{
for
(
Attribute
.
Compound
a
:
sym
.
get
RawAttribute
s
())
{
res
[
i
++]
=
new
AnnotationDescImpl
(
env
,
a
);
}
return
res
;
...
...
src/share/classes/com/sun/tools/javadoc/ProgramElementDocImpl.java
浏览文件 @
39458a8b
...
...
@@ -164,9 +164,9 @@ public abstract class ProgramElementDocImpl
* Return an empty array if there are none.
*/
public
AnnotationDesc
[]
annotations
()
{
AnnotationDesc
res
[]
=
new
AnnotationDesc
[
sym
.
get
AnnotationMirror
s
().
length
()];
AnnotationDesc
res
[]
=
new
AnnotationDesc
[
sym
.
get
RawAttribute
s
().
length
()];
int
i
=
0
;
for
(
Attribute
.
Compound
a
:
sym
.
get
AnnotationMirror
s
())
{
for
(
Attribute
.
Compound
a
:
sym
.
get
RawAttribute
s
())
{
res
[
i
++]
=
new
AnnotationDescImpl
(
env
,
a
);
}
return
res
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录